Home
Analytics
Customizing fontsConfig
kullmanp
In order to customize the fonts in BIRT (especially in PDF output) one can change/add the configuration files in org.eclipse.birt.report.engine.fonts. I'm looking for a way to specify my own files without changing the bundle from eclipse.org. Any ideas and best practices are welcome.
- I tried with a fragment for the fonts bundle but it didn't work
- I was thinking about deploying my own bundle under the name of org.eclipse.birt.report.engine.fonts. Does it make sense?
Regards,
Peter
Find more posts tagged with
Comments
Susana
I don't know if this helps, as I've taken another approach altogether:
All my report templates import the same .css file.
Each time a new font is chosen, I have to edit each affected template. Haven't got too may yet, so it's feasible.
kullmanp
Susana, I think your solution is not related to my problem. I have a finished report design and I want to render a PDF. In the design I have chosen some special fonts and these fonts are not rendered by the PDF renderer.
Perhaps, I should clarify my setup: I'm trying to integrate BIRT into a rcp application and am using WebViewer.display(report, params) to render a report. How can I ship additional fonts in this setup?
Regards,
Peter
Susana
Hum, I render PDF through a batch process. My fonts weren't showing because they were not available at the running server. I used a .css file to define my preferred font list for each style and imported those styles into the report design templates.<br />
<br />
Example:<br />
.f2 {<br />
font-family: "Courier New", "Courier", "monospace";<br />
...<br />
}<br />
<br />
If won't work for you, I'm sorry.<br />
Maybe someone else can help you.<br />
<br />
<blockquote class='ipsBlockquote' data-author="'kullmanp'" data-cid="82524" data-time="1315570400" data-date="09 September 2011 - 05:13 AM"><p>
Susana, I think your solution is not related to my problem. I have a finished report design and I want to render a PDF. In the design I have chosen some special fonts and these fonts are not rendered by the PDF renderer.<br />
<br />
Perhaps, I should clarify my setup: I'm trying to integrate BIRT into a rcp application and am using WebViewer.display(report, params) to render a report. How can I ship additional fonts in this setup?<br />
<br />
Regards,<br />
Peter<br /></p></blockquote>
kullmanp
<blockquote class='ipsBlockquote' data-author="'Susana'" data-cid="82535" data-time="1315584502" data-date="09 September 2011 - 09:08 AM"><p>
Hum, I render PDF through a batch process. My fonts weren't showing because they were not available at the running server. I used a .css file to define my preferred font list for each style and imported those styles into the report design templates.<br />
<br />
Example:<br />
.f2 {<br />
font-family: "Courier New", "Courier", "monospace";<br />
...<br />
}<br />
<br />
If won't work for you, I'm sorry.<br />
Maybe someone else can help you.<br /></p></blockquote>
<br />
You just seem to allow for some fonts to be substituted if they are not available as far as I can see. But I would like to use a specific font. I works well for me if I add the font to fontsConfig.xml. <br />
<br />
I still don't know how to ship my own fontConfig_pdf.xml. I haven't found anything in the integration book (I also looked at the new edition). Here is the relevant code in FontManagerMappingFactory:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
protected URL getConfigURL( String configName )
{
// try to load the format specific configuration
String fileName = configName + ".xml";
Bundle bundle = Platform
.getBundle( "org.eclipse.birt.report.engine.fonts" ); //$NON-NLS-1$
if ( bundle != null )
{
return bundle.getEntry( fileName );
}
return getClass( ).getClassLoader( ).getResource( fileName );
}
</pre>
There seems to be no way to ship my own stuff. bundle.getEntry() doesn't look in fragments as far as I know.<br />
<br />
Regards, <br />
Peter
kullmanp
Anybody?
kullmanp
Our client has supplied us with a different font file for which no special encoding has to be specified. I can deliver this font in a fragment to the org.eclipe.birt.report.engine.fonts bundle (in the fonts directory). For me (and our customer) the problem is solved. The question remains open, though.
Regards,
Peter
nikstefanov
<p>I want to thanks Susana. Your post realy helped me. 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.</p>