xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Sargent <rsarg...@xmission.com>
Subject Re: fop called in xslt extension is not finding fonts
Date Thu, 02 Jun 2011 14:50:52 GMT
Hello Mehdi,

Thanks for your work on this. I think you're on the right track but not 
sure how to proceed.

I may be misunderstanding things but in my use of the API  the choice of 
mime type defines IF vs PDF.  I accomplish this in the constructor with 
this (reflective) code.

    fopFactoryMethod = fopFactoryClass.getMethod("newFop", String.class,
    userAgent.getClass(), OutputStream.class);
    Object fop = fopFactoryMethod.invoke(fopFactory, getMimeType(),
    userAgent, out);

The getMimeType() call returns "application/pdf" or 
"application/X-fop-areatree".  That's the only difference in my two 
invocations of fop. In particular, the fonts are handled identically.

So I'm still a brick shy of a load here.



On 06/02/2011 01:47 AM, mehdi houshmand wrote:
> Hi Rob,
>
> I just tested this on my system and I was finding the same results as
> you... When I set the output format to IF, FOP wasn't working. So
> anyway, I fixed it by setting the output MIME type, which is done via
> the command line as such:
>
> ./fop -c fop.xconf test.fo -if<insert mime-type>  output.if
>
> so in my case it was:
>
> ./fop -c fop.xconf test.fo -if application/pdf output.if
>
> When you think about it, it does make sense. You refer to fonts in the
> fop.xconf as a child of their rendering output, which allows you to
> distinguish different font files according to the document output
> format. There wouldn't be any way of FOP knowing your desired FINAL
> output format if you were processing to IF.
>
> How you do that using FOPs API, I don't know, but I can't imagine that
> would be hard to find out.
>
> Mehdi
>
> On 1 June 2011 19:18, Rob Sargent<rsargent@xmission.com>  wrote:
>> Again with thanks to Jeremias, I'm successfully sizing the region-before for
>> dynamically generated tables. I'm doing this via and xslt extension function
>> (Xalan style).
>>
>> The xslt extension calls my sizing function which employs fop-1.0 to
>> generate an IF from the given dom.Node.  I notice that during the function's
>> invocation of fop-1.0 that the named fonts are not found and are substituted
>> with "any" in the resultant intermediate format output, with font-size=1000
>> (!!!!), with log messages like  'Font "Optima-Oblique,normal,700" not found.
>> Substituting with "any,normal,700'.  I'm doubly confused because the fo is
>> ultimately processed to pdf by the same fop-1.0.
>>
>> I have to confess that I'm invoking fop reflectively since we have many
>> versions in play and I need each to have their own classpath.  That said the
>> same invocation happens for both the extension and the final processing.
>> Here's part of the where the font path is set:
>>
>>             final Method setFontBaseURLMethod =
>> fopFactoryClass.getMethod("setFontBaseURL", new Class[]{String.class});
>>             String fontsURL = "file://" + bundlePath + fopHome + "/fonts";
>>             setFontBaseURLMethod.invoke(fopFactory, new Object[]{fontsURL});
>>
>> I suspect there is some subtle distinction between generating IF and PDF
>> output?
>>
>> I get good results with this if the caller of my function is processed with
>> fop-1.0.  If the caller is processed by fop-0.95 the estimated size is much
>> too large and I mis-size the region. In both cases the IF has
>> 'font-name="any"' so I'm a little surprised it work at all?!
>>
>> Any pointers on where I've messed up would be greatly appreciated.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
>> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>>
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>

Mime
View raw message