[ 
https://issues.apache.org/jira/browse/FOP-1614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13830523#comment-13830523
 ] 

James Burton commented on FOP-1614:
-----------------------------------

Adding my two cents here.  I've been trying to get my SVG files to exact 
convert to PDF for a couple of weeks now.  

Right now, I'm trying to get the Linux side working.  Batik relies on AWT to 
match fonts, and the font matching in AWT is dependent on the native classes 
loaded by the JVM. I'm testing with JDK 7u45. Here's what what I've found so 
far:

  When going from SVG to a PDF, the font that Batik matches matters, because 
Batik controls the placement of each character.  If Batik picks a junk font, 
then even if the correct font is picked in the PDF, the "micro-alignment" will 
be off.    To see what I mean, put a break point in 
org.apache.fop.pdf.adjustGlyphTJ().

  Batik relies on AWT which, on Linux, relies on fontconfig to match fonts.

  To have fine control over what font Batik uses, you can change the fontconfig 
for the whole system, see "man fonts-conf" or you can use use the environmental 
variable FONTCONFIG_FILE to affect your one process. Create a specific 
"fonts.conf" from an existing one, like /usr/fonts/fonts.conf.  Edit it so you 
only have <dir>yourfonts</dir> lines for the fonts you want included.  Check 
the rest of the file for stuff you might not want (watch out for includes).  
You can test what fonts it brings in with "fc-list" and "fc-match" after 
exporting your FONTCONFIG_FILE pointing to your new file.  

  Set the FONTCONFIG_FILE before starting up your java application.  

  Once you got Batik picking the right fonts, you then must make sure the same 
fonts are known to FOP.  To confuse things, the <auto-detect> command in the 
fop.xconf file brings in the "system" fonts using some hard coded paths.  It 
doesn't use fontconfig.  See 
org.apache.fop.fonts.autodetect.UnixFontDirFinder.getSearchableDirectories().  
I would suggest not using <auto-detect> and mentioning the same font 
directories that you setup with fonts.conf.

  You would then drop any new fonts you have into the directory that both 
fop.xconf and FONTCONFIG_FILE point to and you should be set.

> Fonts not found for SVG texts (when not in C:\WINNT\Fonts)
> ----------------------------------------------------------
>
>                 Key: FOP-1614
>                 URL: https://issues.apache.org/jira/browse/FOP-1614
>             Project: Fop
>          Issue Type: Bug
>          Components: svg
>    Affects Versions: 0.95
>         Environment: Operating System: Windows 2000
> Platform: PC
>            Reporter: M.H.
>
> I configured FOP to use custom fonts with their TTF files being in a custom 
> directory - and not C:\WINNT\Fonts (reason: license restrictions only allows 
> usage of some fonts in the FOP application and not in any other Windows 
> applications, like e.g. Word). This works flawlessly for FOP texts.
> However, SVGs are also included (referenced/linked) in the XSLs. And for 
> texts in these SVGs, the fonts are only used/found if they are stored in 
> C:\WINNT\Fonts! It seems that FOP doesn't tell its SVG engine (Batik) where 
> to find the fonts, as FOP itself knows it from its configuration XML. Is 
> Batik using the font configuartion of FOP at all or is there some additional 
> configuration possible to tell FOP to set its font configuration also for 
> Batik?



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to