Home
Analytics
Using ARIALUNI font with bold style
YairLenga
Hi,
I'm working on a report that is deployed in multiple localized versions. We purchased the AscenderFonts' ARIALUNI True Type font, and we have modified the fonts_config to include it in the designer and the runtime.
While the ARIALUNI fonts provide excellent coverage for many locales, we got complaints from users about the header (which were using BOLD attribute). After some debugging, we narrowed the problem to the fact the the ARIALUNI font does not have pre-defined BOLD (and ITALIC) variants. Instead the itext package is using "simulated" bold (using wide stroke for the drawing the outline).
Most other fonts (Helvetica, Times, ...) have hand-crafted Bold variant - that looks much better that ARIALUNI
The source of the bad headers seems to the the values that is used for the simulated bold (simulateBold in the org.eclipse.birt.report.engine.emitter.pdf plugins, under: src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java).
The original version is using a LineWidth of 0.9 (see below). Replacing the 0.9 with 0.2 created a much nicer output for English characters, and a readable output for eastern languages (Japanese, Korean, ...).
private void simulateBold( PdfContentByte cb )
{
cb.setTextRenderingMode( PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE );
cb.setLineWidth( 0.9f );
cb.setTextMatrix( 0, 0 );
}
My questions:
1. Does anyone know how to modify that code so that it can take the "Weight" level parameter from the css/style, and use it to decide on the value. e.g. Currently, any number between 100-900 can be entered (as well as "Bold", "Light"). The ideal solution will use the value (probably LineWidth= bold/600.)
2. How can the change be submitted into the baseline BIRT ? Is there a developer that can take make the simple change and integrate it into future BIRT version.
If parameterization is hard, may be one can use a configuration parameter, system property or similar to override the setting. It will be nice to support the same logic to the "Italic" option (which is using hard-coded constants EmitterUtil.ITALIC_HORIZONTAL_COEFFICIENT).
Any suggestion will be appreciated.
Yair
Find more posts tagged with
Comments
gliu
Currently BIRT doesn't provide a way to customize the simulation of BOLD/ITLIC font, you can create a enhancement entry for this issue on<br />
<a class='bbc_url' href='
https://bugs.eclipse.org/bugs/enter_bug.cgi?classification=BIRT'>https://bugs.eclipse.org/bugs/enter_bug.cgi?classification=BIRT</a><br
/>
You also could attach you patch, it should be welcome.<br />
<blockquote class='ipsBlockquote' data-author="YairLenga"><p>Hi,<br />
<br />
I'm working on a report that is deployed in multiple localized versions. We purchased the AscenderFonts' ARIALUNI True Type font, and we have modified the fonts_config to include it in the designer and the runtime.<br />
<br />
While the ARIALUNI fonts provide excellent coverage for many locales, we got complaints from users about the header (which were using BOLD attribute). After some debugging, we narrowed the problem to the fact the the ARIALUNI font does not have pre-defined BOLD (and ITALIC) variants. Instead the itext package is using "simulated" bold (using wide stroke for the drawing the outline).<br />
<br />
Most other fonts (Helvetica, Times, ...) have hand-crafted Bold variant - that looks much better that ARIALUNI<br />
<br />
The source of the bad headers seems to the the values that is used for the simulated bold (simulateBold in the org.eclipse.birt.report.engine.emitter.pdf plugins, under: src/org/eclipse/birt/report/engine/emitter/pdf/PDFPage.java).<br />
<br />
The original version is using a LineWidth of 0.9 (see below). Replacing the 0.9 with 0.2 created a much nicer output for English characters, and a readable output for eastern languages (Japanese, Korean, ...).<br />
<br />
private void simulateBold( PdfContentByte cb )<br />
{<br />
cb.setTextRenderingMode( PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE );<br />
cb.setLineWidth( 0.9f );<br />
cb.setTextMatrix( 0, 0 );<br />
}<br />
<br />
My questions:<br />
<br />
1. Does anyone know how to modify that code so that it can take the "Weight" level parameter from the css/style, and use it to decide on the value. e.g. Currently, any number between 100-900 can be entered (as well as "Bold", "Light"). The ideal solution will use the value (probably LineWidth= bold/600.)<br />
<br />
2. How can the change be submitted into the baseline BIRT ? Is there a developer that can take make the simple change and integrate it into future BIRT version.<br />
<br />
If parameterization is hard, may be one can use a configuration parameter, system property or similar to override the setting. It will be nice to support the same logic to the "Italic" option (which is using hard-coded constants EmitterUtil.ITALIC_HORIZONTAL_COEFFICIENT).<br />
<br />
Any suggestion will be appreciated.<br />
<br />
Yair</p></blockquote>