Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Fonts rendered different when generating PDF report
starspn
<span style='font-family: Trebuchet MS'><br />
<br />
<strong class='bbc'><em class='bbc'>Birt Version : 3.7.2 | runtime : birt-runtime-3_7_2 (pojo runtime) | OS : Ubuntu 12.04</em></strong><br />
<br />
Hi <br />
<br />
Recently I had this problem: although my font Verdana is installed on the system (Ubuntu12.04) and my reports in Verdana font too, the PDF file appear in Times New Roman, so hopefully this topic will help.<br />
<br />
Here is my solution to the problem.<br />
<br />
<strong class='bbc'>Step 1</strong> : Install Microsoft TrueType core fonts and FreeType fonts<br />
<pre class='_prettyXprint _lang-auto _linenums:0'># sudo apt-get install msttcorefonts cabextract x-ttcidfont-conf</pre>
>> they will be installed under <em class='bbc'>/usr/share/fonts/truetype/</em><br />
>> It might be needed that you restart the machine.<br />
<br />
<strong class='bbc'>Step 2</strong> : Edit fontsConfig.xml<br />
<br />
Since the new birt pojo runtime doesn't have the platforms/plugins directory where you can edit the fontsConfig.xml file , here is my work around<br />
<br />
1. Open the terminal and cd to reportengine libs directory<br />
e.g <pre class='_prettyXprint _lang-auto _linenums:0'># cd /home/user1/birt/birt-runtime-3_7_2/ReportEngine/lib</pre> to access the lib directory where all the birt jars are contained.<br />
<br />
2. type the following command to extact only fontsConfig.xml from the birt runtime jar file (org.eclipse.birt.runtime_3.7.2.v20120214-1408.jar)<br />
<pre class='_prettyXprint _lang-auto _linenums:0'># jar xf org.eclipse.birt.runtime_3.7.2.v20120214-1408.jar fontsConfig.xml
</pre>
the fontsConfig.xml will be extracted to the current directory.<br />
3. Now you are ready to edit the file by executing the following command <pre class='_prettyXprint _lang-auto _linenums:0'># gedit fontsConfig.xml</pre>
<br />
Then replace font-aliases and font-paths with the fonts you want in my case i want Verdana <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<font-aliases>
<mapping name="serif" font-family="Verdana" />
<mapping name="sans-serif" font-family="Verdana" />
<mapping name="monospace" font-family="Courier" />
<mapping name="cursive" font-family="Verdana" />
<mapping name="fantasy" font-family="Verdana" />
</font-aliases>
<font-paths>
<path path="/usr/share/fonts/truetype/msttcorefonts/verdana.ttf" />
<path path="/usr/share/fonts/truetype/msttcorefonts" />
<path path="/usr/share/fonts/truetype" />
</font-paths>
</pre>
<br />
Save and close.<br />
4. The last we must export our changes back to the jar by updating the jar with the following command<br />
<pre class='_prettyXprint _lang-auto _linenums:0'># jar uf org.eclipse.birt.runtime_3.7.2.v20120214-1408.jar fontsConfig.xml
</pre>
5. You can delete the extracted file fontsConfig.xml <pre class='_prettyXprint _lang-auto _linenums:0'># rm fontsConfig.xml</pre>
<br />
<br />
Then you are good to go.<br />
<br />
</span>
Find more posts tagged with
Comments
mwilliams
Great write up! Would you mind putting this in the devShare, so it's easier for others to locate? Thanks!
Max S.
<p>I messed around trying to edit these .xml files inside the .jar, only to discover that changing an .xml file within the jar caused it to be ignored because its signature was no longer valid, so I had to remove the signatures to get rid of the below warnings (I followed the solution in <a data-ipb='nomediaparse' href='
http://stackoverflow.com/questions/7619727/birt-3-7-runtime-customizing-of-pdf-fonts-and-jdbc-drivers-are-not-possible-any'>this</a>
; post):
</p><pre class="_prettyXprint">WARNING: fontsConfig_linux:SHA1 digest error for fontsConfig_linux.xmljava.lang.SecurityException: SHA1 digest error for fontsConfig_linux.xml</pre>
mwilliams
<p>Thanks for the info, Max!</p>
nikstefanov
<p>I had a compatible problem with Cyrillic fonts - it always was generated with Helvetica in PDF. I set a style with font-family defined on all containers and voila - I've got a pretty looking pdf. I've got this idea from <a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php/topic/23292-customizing-fontsconfig/'>here</a>.</p>
;