On 24 Jun 2009, at 19:19, Sam Fuqua wrote:
Hi Sam
> I took your advice and have gotten some error output. It doesn't
> print this every time, but it has printed for every font I have
> installed something to the effect of "Failed to load font file
> ___ . Could not load InputStream". If it could find the files
> itself, then I know that it wasn't me putting in a bad URL, but why
> would it be that it can't load any of them? I'm trying to use
> a .ttf font.
Went digging a bit, and in FOP Trunk, the message in question comes
from within o.a.fop.fonts.FontLoader.openFontURI(). I haven't yet
located the code in question in 0.95 or earlier, but from what I can
tell, it looks a bit like someone has been abusing the JAXP
StreamSource object to open simple binary streams which are in no way
related to XML... If it were used to load font-metrics XML, that I can
dig, but in case of plain byte streams, using the JAXP pattern does
not seem appropriate.
Try to follow:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontLoader.java?revision=746664First we try to obtain a Source object, via the FontResolver that is
passed in. The minimal resolver that is generated by the default
FontManager uses the StreamSource(String) constructor. It only passes
in the URI to the resource, which the JAXP API docs tell us leaves the
InputStream unset. I think (but am far from certain) that a JAXP-
compliant parser may even choose to ignore setting the systemId if the
content is not valid XML... which is one possible cause for the cited
message. Another one is that the URL is actually not valid according
to URI syntax.
Can you show us a few of those URLs?
>
> I also tried loading the font manually by creating a FontTriplet and
> EmbedFontInfo and adding it to the FopFactory FontCache, which gave
> no error except for the usual "Substituting with 'any'". Any ideas?
Was this after clearing the cache? It's a file called 'fop-
fonts.cache', normally residing in the user's home directory, in a
subdir named '.fop'. I would try deleting that to make sure the cache
is reconstituted from scratch. Activating DEBUG-level output will show
more info about what happens when the fonts are initially loaded.
Regards
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail:
fop-users-unsubscribe@...
For additional commands, e-mail:
fop-users-help@...