Hi,
Did you ever manage to do this?

I need to do something similar because my embedded FOP is running in a
Webapp and the font metric file and the TTF file are hidden inside the
WEB-INF directory and so the metric-url and embed-url in my fop-config
is no good (even if they were accessible via a URL I don't know the
hostname or context path until runtime)

What would be really nice is someway to pass the fontMetric and TTF file
to the Renderer as InputSource (or InputStream). This way I can get the
font files from the hidden WEB-INF dir using

InputStream fontmetric =
serve.servlet.getServletContext().getResourceAsStream("/WEB-INF/metric.x
ml");
InputStream embed =
serve.servlet.getServletContext().getResourceAsStream("/WEB-INF/font.TTF
"); 
Renderer myRenderer = new PDFRenderer();
FontInfo myFontInfo = new FontInfo();

// method needed ...(ahem)
myFontInfo.addFont("FontName", "FontStyle", "FontWeight", fontmetric,
embed);
 
myRenderer.setupFontInfo(myFontInfo);
userAgent.setRendererOverride(myRenderer);

Am I on the right track? Has anyone done this (or better) and mind
sharing the code?

Cheers

Karl

On 2006-01-26 16:22:42 Jeremias Maerki wrote:
> Looking at the source code, you'd need to do the following:
> - Subclass the Renderer implementation (ex. PDFRenderer) so you gain
> access to the protected fontList member variable.
> - Fill the fontList variable much like
> FontSetup.buildFontListFromConfiguration() does. This code will need
to
> run before you start the rendering run or at least before
> PrintRenderer.setupFontInfo() is called.
> - Instantiate your subclassed Renderer yourself and set it on the
> FOUserAgent using setRendererOverride().
>
> Have fun!

> On 26.01.2006 16:59:17 Stefan Burkard wrote:
>> hi fop-users
>> 
>> i know i can use a custom font by building an xml-file with it's 
>> kerning-values and configuring a font definition in the
user-config-file.
>> 
>> but how can i include the font programatically? i don't like to have
a 
>> user-config-file at all. i found examples to set the font-directory
or 
>> base-directory programatically, but i didn't found an example for 
>> configuring fonts directly in java.
>> 
>> can anybody help me?
>> thanks
>> stefan


NOTICE
This e-mail and any attachments are confidential and may contain copyright 
material of Macquarie Bank or third parties. If you are not the intended 
recipient of this email you should not read, print, re-transmit, store or act 
in reliance on this e-mail or any attachments, and should destroy all copies of 
them. Macquarie Bank does not guarantee the integrity of any emails or any 
attached files. The views or opinions expressed are the author's own and may 
not reflect the views or opinions of Macquarie Bank.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to