Summary: | Fonts not found for SVG texts (when not in C:\WINNT\Fonts) | ||
---|---|---|---|
Product: | Fop - Now in Jira | Reporter: | M.H. <mhilpert> |
Component: | svg | Assignee: | fop-dev |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P3 | ||
Version: | 0.95 | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Windows 2000 | ||
Bug Depends on: | 46374 | ||
Bug Blocks: |
Description
M.H.
2008-12-10 02:02:48 UTC
This is a known issue and it's not primarily a FOP issue, but a Batik issue. I've recently documented that particularity although I still haven't re-published the updated website. For your convenience here's an excerpt: https://svn.eu.apache.org/viewvc/xmlgraphics/fop/trunk/src/documentation/content/xdocs/trunk/graphics.xml?view=markup ------------------------------- <section id="svg-font-selection"> <title>Font selection notes</title> <p> Apache Batik uses the AWT/Java2D subsystem as font source while FOP has its on font subsystem. Great care has been taken that font selection does the best possible choices. But it must be noted when creating PDF or PostScript that a font used in SVG graphics needs to be registered with the operating system as well as in FOP's configuration. By using FOP's font auto-detection, you simply have to install the font in the operating system and not care about anything else. This is less of an issue if you create formats like TIFFs, PNGs or PCL because in these cases SVG graphics are usually rendered to bitmaps which means that on both sides (Batik and FOP), AWT/Java2D is used as the single font source. </p> <p> Whenever an SVG is converted into a PDF or PostScript file, the font that has been used inside Batik has to be mapped to a font used by the actual output format. Features like font substitution in FOP may need to be taken into account but can also be an advantage when working around font mapping issues. Like for XSL-FO content, you'll get a warning if a particular font could not be found and had to be substituted, or if a particular glyph is missing in a font. </p> </section> ------------------------------- Anyway, Batik would need to be changed to allow plugging in an external font source like FOP's font configuration. There's no easy solution to this. It would mean working with the Batik developers and quite a bit of work. Don't expect anyone to do that for you in the near future. I don't see a work-around other than installing the necessary font in your operating system to make them available to Batik. I know there is a code section in Batik that can load a TrueType font from an external file (not installed in the operating system), so it might be possible to specify the location of a font somehow. But I don't know how that works and if it's really possible. You will have to ask on batik-users. I guess we can keep this issue around as a reminder. But given the amount of work expected compared to the expected gain it is realistic to assume this won't be implemented soon. I tried to set the custom TTF fonts in a custom fontconfig.properties for the Java application. java ... -Dsun.awt.fontconfig=C:/test/fontconfig.properties This works in a test Java application (i.e.: I can uses the TTF font which is not in C:\WINNT\Fonts in Java by creating a Font object with the correct font family name and sub name). UNfortunately, Batik seems to ignore this. So, this seems to be an issue of Batik not offering an API (for FOP) to set custom font sources? Basically, yes. If I remember correctly, there are hints in the code that something like this could be added. But when I looked into it, it looked like too much work for my time budget at that time. I don't think Batik would willingly ignore additional fonts made available through -Dsun.awt.fontconfig since this is an AWT facility. If that property makes sure that the fonts are integrated into the AWT font subsystem the fonts should really be available to Batik. But again, maybe the people on batik-users@xmlgraphics.apache.org know more. OKay, I opened a new bug for Batik: https://issues.apache.org/bugzilla/show_bug.cgi?id=46374 I've committed a small change to Batik that allows non-AWT-toolkit-provided fonts to be embedded in SVG. resetting P2 open bugs to P3 pending further review |