Discussions
Categories
Choose a Product
THRUST SERVICES
CORE APPS
CE PRODUCTS
...
Quick Links
POPULAR
HELPFUL TIPS
Groups
My Links
FOR SIGNED IN MEMBERS:
Back to website
Home
Developing Analytics Applications
Fonts rendered different when generating PDF report
Migrateduser
<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
There are no comments yet