You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Matthias Reischenbacher <ma...@gmx.at> on 2010/03/05 15:22:02 UTC

Symbol and Wingdings Font support

Hi,

I've tested the new support for Symbol and Wingdings fonts with the 
latest FOP trunk and wanted to share with you two observations:

1. In my fop config file font auto detection is enabled. Nevertheless 
Wingdings and Symbol fonts are not automatically detected inside the 
Windows Fonts folder. I had to copy the .ttf files inside the folder 
where my font base url is pointing to 
(fopFactory.getFontManager().setFontBaseURL()). Then it worked just 
fine. Generating the font metrics was not necessary and neither did I 
have to declare the fonts explicitly in the fop config file.

2. I've also tried to use the Symbol font inside SVGs, especially with 
the Ohm-character. But the Ohm-character is not displayed correctly 
because a fallback is done to Helvetica. That's strange because when 
inserting the ohm-Symbol as normal text inside a fo:block element it 
worked without any problem. I'm attaching a sample SVG file. Could you 
please tell me if I'm doing something wrong or if this is a FOP bug?

Thanks & Regards,
Matthias Reischenbacher

Re: Symbol and Wingdings Font support

Posted by Matthias Reischenbacher <ma...@gmx.at>.
Hi Jeremias,

>> I've tested the new support for Symbol and Wingdings fonts with the
>> latest FOP trunk and wanted to share with you two observations:
>>
>> 1. In my fop config file font auto detection is enabled. Nevertheless
>> Wingdings and Symbol fonts are not automatically detected inside the
>> Windows Fonts folder. I had to copy the .ttf files inside the folder
>> where my font base url is pointing to
>> (fopFactory.getFontManager().setFontBaseURL()). Then it worked just
>> fine. Generating the font metrics was not necessary and neither did I
>> have to declare the fonts explicitly in the fop config file.
>
> I noticed something similar myself lately. Took me hours to track down.
> In the end, it was this: FOP's font cache file [1] was still carrying
> the information that Symbol and Wingdings have not been loaded
> successfully (with the previous FOP version). That's why FOP won't load
> the font. Once you delete the cache file I expect FOP to find the two
> fonts in the Windows Fonts folder. Maybe I should have changed the
> serialization version number for the font cache so it is deleted
> automatically.
>
> [1]<HOME>/.fop/fop-fonts.cache

Thanks for the tip, that was the problem also in my case.

>> 2. I've also tried to use the Symbol font inside SVGs, especially with
>> the Ohm-character. But the Ohm-character is not displayed correctly
>> because a fallback is done to Helvetica. That's strange because when
>> inserting the ohm-Symbol as normal text inside a fo:block element it
>> worked without any problem. I'm attaching a sample SVG file. Could you
>> please tell me if I'm doing something wrong or if this is a FOP bug?
>
> You're using the Ohm Glyph from Unicode:&#x2126; But FOP does not
> currently map the Symbol TTF font into the right Unicode codepoints
> where possible (we'd probably need a heuristic for that). Instead
> everything is mapped into F020 to F0FF and 0020 to 00FF. I expect
> &#xF057; to work for the Ohm symbol. Not optimal, I know. Using 2126
> with the Arial Unicode MS should work, though.

Using &#xF057; did work as you said. Actually I had inserted the unicode 
character myself. The original SVG file contained the letter "W" instead 
of the unicode character. Would it be possible (and valid) to map the 
letter to its representation in the Symbol font? Doing this actually 
works inside fo:block, but I'm aware of what you said in your last post 
about the differences in font handling between Batik and FOP.

Thanks for you help!

Regards,
Matthias Reischenbacher

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Symbol and Wingdings Font support

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
Hi Matthias

On 05.03.2010 15:22:02 Matthias Reischenbacher wrote:
> Hi,
> 
> I've tested the new support for Symbol and Wingdings fonts with the 
> latest FOP trunk and wanted to share with you two observations:
> 
> 1. In my fop config file font auto detection is enabled. Nevertheless 
> Wingdings and Symbol fonts are not automatically detected inside the 
> Windows Fonts folder. I had to copy the .ttf files inside the folder 
> where my font base url is pointing to 
> (fopFactory.getFontManager().setFontBaseURL()). Then it worked just 
> fine. Generating the font metrics was not necessary and neither did I 
> have to declare the fonts explicitly in the fop config file.

I noticed something similar myself lately. Took me hours to track down.
In the end, it was this: FOP's font cache file [1] was still carrying
the information that Symbol and Wingdings have not been loaded
successfully (with the previous FOP version). That's why FOP won't load
the font. Once you delete the cache file I expect FOP to find the two
fonts in the Windows Fonts folder. Maybe I should have changed the
serialization version number for the font cache so it is deleted
automatically.

[1] <HOME>/.fop/fop-fonts.cache

> 2. I've also tried to use the Symbol font inside SVGs, especially with 
> the Ohm-character. But the Ohm-character is not displayed correctly 
> because a fallback is done to Helvetica. That's strange because when 
> inserting the ohm-Symbol as normal text inside a fo:block element it 
> worked without any problem. I'm attaching a sample SVG file. Could you 
> please tell me if I'm doing something wrong or if this is a FOP bug?

You're using the Ohm Glyph from Unicode: &#x2126; But FOP does not
currently map the Symbol TTF font into the right Unicode codepoints
where possible (we'd probably need a heuristic for that). Instead
everything is mapped into F020 to F0FF and 0020 to 00FF. I expect
&#xF057; to work for the Ohm symbol. Not optimal, I know. Using 2126
with the Arial Unicode MS should work, though.

Please note, that Batik (SVG) works a little differently from FOP
(XSL-FO) in the font area. We've tried to get as much equal behaviour as
possible but there are limits. As a rule of thumb, fonts to be used
inside SVG need to be installed both with FOP and with the operating
system (so AWT/Java2D has it available).

> Thanks & Regards,
> Matthias Reischenbacher




Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org