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 Stefan Burkard <ne...@burknet.ch> on 2006/01/26 16:59:17 UTC

how to embed a font programatically

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


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: how to embed a font programatically

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
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


Jeremias Maerki


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: how to embed a font programatically

Posted by Uwe Klosa <uw...@ub.uu.se>.
Hi Stefan

I'm using my own fonts and the userconfig file. All fonts, metrics and configuration are stored in my web application. The bug with the 
base URL is solved in svn trunk. The application works just fine.

Unfortunately I can't help you with with the configuration of fonts.

Cheers
Uwe

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
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
>