|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
Cross-platform fontsHi,
I'm using fop to render PDFs in a variety of languages, including Asian fonts. I have no way of knowing what language the PDF will be printed in, and I also need it to work on multiple systems. From what I've read, the PDF renderer cannot detect OS Fonts. Does this also mean that the auto-detect does not work in a config file for PDFs? Is there any way to auto-detect programmatically in an embedded environment? I'm not sure how to go about writing the font metrics, since some of the fonts would be copyrighted and not all of them would be available on every machine. -- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsHi,
I believe I've found my solution here: http://www.ibm.com/developerworks/xml/library/x-ospdf/ Sam
2009/6/15 Sam Fuqua <samfuqua@...> Hi, -- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsOn 15 Jun 2009, at 19:36, Sam Fuqua wrote:
Hi Sam > I'm using fop to render PDFs in a variety of languages, including > Asian fonts. I have no way of knowing what language the PDF will be > printed in, and I also need it to work on multiple systems. From > what I've read, the PDF renderer cannot detect OS Fonts. That is not exactly true. It is true that the PDFRenderer does not detect OS fonts, but FOP definitely does, to the extent that they reside in one of the standard font-locations for the target platform. For example, for Windows, FOP tries '%WINDIR%/FONTS'. On *nix, it will search dirs like '/usr/local/fonts' and '/usr/share/fonts'. All that detection is triggered automatically, provided that the config contains an <auto-detect/> entry, as described here: http://xmlgraphics.apache.org/fop/0.95/fonts.html#basics One limitation in FOP 0.95 is that it does not yet do automatic font- selection from a specified list. So, even if there are Asian fonts available on the system, and they are properly detected, they will only be actually used IFF the corresponding text is surrounded by an FO (for example, a fo:wrapper) that explicitly sets the right font-family for that portion of text. FOP Trunk already has basic support for font-selection-strategy, but still no character-by-character, so if two subsequent characters need to be rendered in a different font, they still have to physically separated by at least a zero-width-space for font-selection to work. Regards Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: Cross-platform fontsHi Andreas,
Thanks for your reply. Is there any way to set the font configuration programmatically? Or must I load it from a file? Sam On Mon, Jun 15, 2009 at 3:07 PM, Andreas Delmelle <andreas.delmelle@...> wrote: On 15 Jun 2009, at 19:36, Sam Fuqua wrote: -- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsOn 15 Jun 2009, at 23:06, Sam Fuqua wrote:
Hi Sam > Thanks for your reply. Is there any way to set the font > configuration programmatically? Or must I load it from a file? AFAICT, auto-detection is an option that cannot be set programmatically, so I guess that means it must be loaded from a config-file... Anyone? Regards Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: Cross-platform fontsI believe that the closest that I could get to programmatically was to create a string and load that in through an InputStream.
Sam On Tue, Jun 16, 2009 at 3:29 AM, Andreas Delmelle <andreas.delmelle@...> wrote:
-- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsI end up creating a DOM representing the user-config and using that to
configure the fop font system. While unwieldy, it does seem to work after I got past the issues discussed on list. On Tue, 2009-06-16 at 09:29 +0200, Andreas Delmelle wrote: > On 15 Jun 2009, at 23:06, Sam Fuqua wrote: > > Hi Sam > > > Thanks for your reply. Is there any way to set the font > > configuration programmatically? Or must I load it from a file? > > AFAICT, auto-detection is an option that cannot be set > programmatically, so I guess that means it must be loaded from a > config-file... > > Anyone? > > > Regards > > Andreas > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: fop-users-unsubscribe@... > For additional commands, e-mail: fop-users-help@... > Steve Ebersole <steve@...> Hibernate.org --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: Cross-platform fontsHi Andreas,
Just to make sure that I'm understanding what you you're saying:
Thanks again for your always great support. Sam On Mon, Jun 15, 2009 at 3:07 PM, Andreas Delmelle <andreas.delmelle@...> wrote: On 15 Jun 2009, at 19:36, Sam Fuqua wrote: -- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsOn 16 Jun 2009, at 17:09, Sam Fuqua wrote:
Hi Sam > Just to make sure that I'm understanding what you you're saying: > • the <auto-detect> tag will cause FOP to detect my fonts > • in order to print non-Latin text in non-Latin fonts, I need to > specify which font family to use > What is the purpose of the font-selection-strategy property? If I > don't need character by character font specification, is this a way > to automatically have non-Latin text rendered using a non-Latin fonts? More or less, yes. Note that you still need to specify the font- family, but you could do something like: <block font-family="Helvetica,Uming"> ... </block> In FOP Trunk, if there are any words in the block that cannot be fully mapped to glyphs in the 'Helvetica' family, then FOP will try 'SimSun' too. FOP 0.95 only looks at the first family specified in the list. HTH! Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: Cross-platform fontsHi Andreas,
Unfortunately, my problem still seems to be the same. The console always logs that Arial cound not be found, so it is defaulting to "any", which I believe is mapped internally to 'Times'. I'm using Linux, so instead of Times New Roman, it's the Nimbus counterpart. When the pdf comes up, the Latin text displays as expected, though the Japanese text displays as '###', which would indicate a missing glyph. However, the character renders properly everywhere else on my system. I believe that the font has the glyph, but that FOP is having trouble finding it. I really hate asking such an open-ended, vague question, but do you have any ideas why it would not be finding that glyph? Sam On Tue, Jun 16, 2009 at 1:03 PM, Andreas Delmelle <andreas.delmelle@...> wrote:
-- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsOn 16 Jun 2009, at 22:15, Sam Fuqua wrote:
Hi Sam > Unfortunately, my problem still seems to be the same. The console > always logs that Arial cound not be found, so it is defaulting to > "any", which I believe is mapped internally to 'Times'. I'm using > Linux, so instead of Times New Roman, it's the Nimbus counterpart. > When the pdf comes up, the Latin text displays as expected, though > the Japanese text displays as '###', which would indicate a missing > glyph. However, the character renders properly everywhere else on > my system. I believe that the font has the glyph, but that FOP is > having trouble finding it. No, it means that FOP is trying to use the Base14 Times font, which definitely does not contain any glyphs for non-western characters. The fact that the characters render properly in a web-browser or word- processor on your system means that those applications actually perform font-selection behind the scenes (based on the availability of glyphs for a specific Unicode codepoint) With FOP 0.95 or earlier, the user has to make sure the text-blocks in question have the correct font-family, in order to guarantee that they are rendered correctly. As suggested earlier, this can be achieved by wrapping Japanese words in a fo:wrapper with the right font-family. For FOP Trunk, you can specify a list of font-families to try on the fo:root or fo:page-sequence. FOP 0.95 is not yet as clever, and will always only try the first family specified in the list in that case, but Trunk will perform basic, per-word font-selection. Per-character font-selection has not yet been implemented, but can be emulated by inserting zero-width spaces as boundaries. Regards Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: Cross-platform fontsAndreas,
Thank you for all your help. It's making much more sense now. It turned out my configuration file was incorrect so my fonts were not being detected. Unfortunately, I've now got a new problem with this. I put in a breakpoint after the FopFactory is configured and recieved this in my fopFactory.getFontCache(): { ... file:/usr/share/fonts/truetype/unfonts/UnBatang.ttf=metrics-url=null,embed-url=file:/usr/share/fonts/truetype/unfonts/UnBatang.ttf, kerning=true, font-triplet=[UnBatang,normal,400], lastModified=1211962415000, ... } I used UnBatang as my font-family, yet 15:14:36,072 [SslListener1-4] WARN org.apache.fop.fonts.FontInfo - Font 'UnBatang,normal,400' not found. Substituting with 'any,normal,400'. showed up in my log. Is there something more I need to do to get it to work, or is this a glitch? I'm using 0.94 and I'm stuck with it for this project. Sam On Wed, Jun 17, 2009 at 4:48 AM, Andreas Delmelle <andreas.delmelle@...> wrote:
-- Sam Fuqua ΣΝ ΘΗ 454 |
|
|
Re: Cross-platform fontsOn 17 Jun 2009, at 21:30, Sam Fuqua wrote:
Hi Sam > <snip /> > I used UnBatang as my font-family, yet > 15:14:36,072 [SslListener1-4] WARN > org.apache.fop.fonts.FontInfo - Font > 'UnBatang,normal,400' not found. Substituting with 'any,normal,400'. > showed up in my log. Is there something more I need to do to get it > to work, or is this a glitch? I'm using 0.94 and I'm stuck with it > for this project. I'm not sure... I don't have a deployed 0.94 to test this on. Can you try 0.95 to check if this behavior persists in that version? Regards Andreas --------------------------------------------------------------------- To unsubscribe, e-mail: fop-users-unsubscribe@... For additional commands, e-mail: fop-users-help@... |
|
|
Re: Cross-platform fontsHi,
I haven't been able to deploy a .95 to test this, but further use shows that this only happens after the first time it is run. I can generate the PDF properly one time, and then it stops detecting my fonts properly. Would this be a problem with the cache being loaded multiple times? I have the FopFactory and transfomation inside of a function, so I thought that they would get scoped out and be regenerated fresh each time. Sam On Thu, Jun 18, 2009 at 3:29 AM, Andreas Delmelle <andreas.delmelle@...> wrote:
-- Sam Fuqua ΣΝ ΘΗ 454 |
| Free embeddable forum powered by Nabble | Forum Help |