You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Dirk Bromberg <di...@familie-bromberg.de> on 2007/01/03 18:33:53 UTC
own URIResolver for ttf fonts?
Hi,
is it possible the override a resolver for the destination of the ttf
file (whole font handling)?
- ttf file
- metrics xml file
I've tried the URIResolver but it works only for things like images ...
Thanks
Dirk
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: own URIResolver for ttf fonts?
Posted by Dirk Bromberg <di...@familie-bromberg.de>.
Hey,
this sounds great. So i'll hope that the release it going fine this time
:-) good luck!
Dirk
Jeremias Maerki schrieb:
> The latest FOP Trunk (and the soon-to-be-released 0.93) loads fonts and
> metric files through the URIResolver. You can easily write your own
> URIResolver (see [1] as an example) to handle URIs to font resources in
> a special way. BTW, you can omit the step with the metrics file with the
> latest version. This is a new feature where we'd be glad for some
> feedback.
>
> [1] http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/servlet/ServletContextURIResolver.java?view=markup
>
> On 03.01.2007 18:33:53 Dirk Bromberg wrote:
>
>> Hi,
>>
>> is it possible the override a resolver for the destination of the ttf
>> file (whole font handling)?
>>
>> - ttf file
>> - metrics xml file
>>
>> I've tried the URIResolver but it works only for things like images ...
>>
>>
>> Thanks
>>
>>
>> Dirk
>>
>
>
> Jeremias Maerki
>
>
> ---------------------------------------------------------------------
> 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
Re: Adding ttf font to a PDF using FOP 0.92 beta
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The stuff isn't really designed to be set up this way, but maybe you can
get some ideas by looking at:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/fonts/FontSetup.java?view=markup
On 05.01.2007 18:43:34 Richard King wrote:
> Hi all,
> I wish to add a font via java rather than a configuration file.
> I have tried the below code. How do I include the metrics info?
> Does anyone know how to add a font without using the "setUserConfig(<File>)" method?
>
> FopFactory fopFactory = FopFactory.newInstance();
> FOUserAgent userAgent = fopFactory.newFOUserAgent();
>
> PDFRenderer pdfrenderer = new PDFRenderer();
> pdfrenderer.setUserAgent(userAgent);
> FontInfo fontinfo = new FontInfo();
> fontinfo.addFontProperties("Wingdings","Wingdings","normal", Font.NORMAL);
> pdfrenderer.setupFontInfo(fontinfo);
> userAgent.setRendererOverride(pdfrenderer);
>
> out = new java.io.FileOutputStream(fopOutputDir + fileRoot + ".pdf");
> out = new java.io.BufferedOutputStream(out);
> Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
>
> Source xsltSrc = new StreamSource(fopDirectory + xslName);
> TransformerFactory transformerFactory = TransformerFactory.newInstance();
> Transformer transformer = transformerFactory.newTransformer(xsltSrc);
>
> Cheers,
> Richard
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Adding ttf font to a PDF using FOP 0.92 beta
Posted by Richard King <ri...@allfinanz.com>.
Hi all,
I wish to add a font via java rather than a configuration file.
I have tried the below code. How do I include the metrics info?
Does anyone know how to add a font without using the "setUserConfig(<File>)" method?
FopFactory fopFactory = FopFactory.newInstance();
FOUserAgent userAgent = fopFactory.newFOUserAgent();
PDFRenderer pdfrenderer = new PDFRenderer();
pdfrenderer.setUserAgent(userAgent);
FontInfo fontinfo = new FontInfo();
fontinfo.addFontProperties("Wingdings","Wingdings","normal", Font.NORMAL);
pdfrenderer.setupFontInfo(fontinfo);
userAgent.setRendererOverride(pdfrenderer);
out = new java.io.FileOutputStream(fopOutputDir + fileRoot + ".pdf");
out = new java.io.BufferedOutputStream(out);
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
Source xsltSrc = new StreamSource(fopDirectory + xslName);
TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer(xsltSrc);
Cheers,
Richard
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
Re: own URIResolver for ttf fonts?
Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
The latest FOP Trunk (and the soon-to-be-released 0.93) loads fonts and
metric files through the URIResolver. You can easily write your own
URIResolver (see [1] as an example) to handle URIs to font resources in
a special way. BTW, you can omit the step with the metrics file with the
latest version. This is a new feature where we'd be glad for some
feedback.
[1] http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/src/java/org/apache/fop/servlet/ServletContextURIResolver.java?view=markup
On 03.01.2007 18:33:53 Dirk Bromberg wrote:
> Hi,
>
> is it possible the override a resolver for the destination of the ttf
> file (whole font handling)?
>
> - ttf file
> - metrics xml file
>
> I've tried the URIResolver but it works only for things like images ...
>
>
> Thanks
>
>
> Dirk
Jeremias Maerki
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: own URIResolver for ttf fonts?
Posted by Peter <pc...@gmail.com>.
I see.
I have stepped through the code a bit in the debugger (the trunk from a
couple of weeks ago) and I do have the impression that the font ttf and xml
files should be resolved through the uri resolver configured with
setURIResolver on the user agent.
The only exception I can detect is when the uri starts with data:.
Perhaps a version difference?
Peter
> -----Original Message-----
> From: Dirk Bromberg [mailto:dirk@familie-bromberg.de]
> Sent: Wednesday, January 03, 2007 9:32 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: Re: own URIResolver for ttf fonts?
>
> No,
>
> what i need is a way to add a resolver which pulls the files out of an
> database.
>
> So it is more like the basepath...
>
> Dirk
>
> Peter schrieb:
> > Perhaps the setFontBaseURL method in FopFactory does what you want ?
> >
> > Peter
> >
> >
> >> -----Original Message-----
> >> From: Dirk Bromberg [mailto:dirk@familie-bromberg.de]
> >> Sent: Wednesday, January 03, 2007 6:34 PM
> >> To: fop-users@xmlgraphics.apache.org
> >> Subject: own URIResolver for ttf fonts?
> >>
> >> Hi,
> >>
> >> is it possible the override a resolver for the destination of the ttf
> >> file (whole font handling)?
> >>
> >> - ttf file
> >> - metrics xml file
> >>
> >> I've tried the URIResolver but it works only for things like images ...
> >>
> >>
> >> Thanks
> >>
> >>
> >> Dirk
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
>
>
> ---------------------------------------------------------------------
> 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
Re: own URIResolver for ttf fonts?
Posted by Dirk Bromberg <di...@familie-bromberg.de>.
No,
what i need is a way to add a resolver which pulls the files out of an
database.
So it is more like the basepath...
Dirk
Peter schrieb:
> Perhaps the setFontBaseURL method in FopFactory does what you want ?
>
> Peter
>
>
>> -----Original Message-----
>> From: Dirk Bromberg [mailto:dirk@familie-bromberg.de]
>> Sent: Wednesday, January 03, 2007 6:34 PM
>> To: fop-users@xmlgraphics.apache.org
>> Subject: own URIResolver for ttf fonts?
>>
>> Hi,
>>
>> is it possible the override a resolver for the destination of the ttf
>> file (whole font handling)?
>>
>> - ttf file
>> - metrics xml file
>>
>> I've tried the URIResolver but it works only for things like images ...
>>
>>
>> Thanks
>>
>>
>> Dirk
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
RE: own URIResolver for ttf fonts?
Posted by Peter <pc...@gmail.com>.
Perhaps the setFontBaseURL method in FopFactory does what you want ?
Peter
> -----Original Message-----
> From: Dirk Bromberg [mailto:dirk@familie-bromberg.de]
> Sent: Wednesday, January 03, 2007 6:34 PM
> To: fop-users@xmlgraphics.apache.org
> Subject: own URIResolver for ttf fonts?
>
> Hi,
>
> is it possible the override a resolver for the destination of the ttf
> file (whole font handling)?
>
> - ttf file
> - metrics xml file
>
> I've tried the URIResolver but it works only for things like images ...
>
>
> Thanks
>
>
> Dirk
>
> ---------------------------------------------------------------------
> 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