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 mk...@exceldata.com on 2005/04/29 12:08:20 UTC

FOP and Fonts

Hey everyone

I'm currently using FOP for a printing engine (0.20.5 or latest from 
maintaince branch) which works great.

But regarding fonts I have a problem, which I wouldn't expect to be the 
first FOP user to have, so I'll ask here in hope of some good answers.

Currently the printing engine generates either a preview, prints directlty 
to printer or generates a PDF. The printing is based on a swing table
and all attributes from the table is converted to XSL-FO incl. the used 
font.
I would like to configure fonts on the fly as part of the printing 
process:
1) First acquire the filename(s) and location of the font involved
2) Generate the XML metrics file (for PDF cases)
3) Configure FOP (using the Options() approach)

step 2. + 3. are quite simple AFAICS, but step 1. is more tricky - is 
there any way to obtain this information from AWT or somewhere else ????

If anyone see another possible solution or any problems besides 1. in my 
suggested aprroach, comments are appreciated :)

Best regards

Mikael

Re: FOP and Fonts

Posted by "J.Pietschmann" <j3...@yahoo.de>.
Andreas L. Delmelle wrote:
>>You can search some standard directories (C:/Windows/fonts,
>>/usr/X11R6/fonts etc.), which is not very robust. Unfortunately,
>>Java deprecated access to environment variables...
> 
> 
> Deprecated? Well, it's a bit confusing: in 1.4.2 indeed they are. I don't
> get that impression when browsing through the 1.5 API docs though...

The 1.3 docs state that System.getenv will be removed real soon
now and that everybody should switch to Java properties. Maybe
they found this impractical and changed mind...

If there's access to evvironment variables
  getenv("WINDIR")+"/fonts"
will get the windows font diretory (don't copy this literally...)
There are environment variables set by an X server which should point
to the font ressources there. If the program is not run in an X
environment, there should be tricks involving xmkmf or IMakefiles
for getting the X font directory, provided IMake is installed and
properly configured on this machine (don't count on that unless
you doublechecked yourself).

J.Pietschmann

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


RE: FOP and Fonts

Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: J.Pietschmann [mailto:j3322ptm@yahoo.de]
>

Hi,

> mka@exceldata.com wrote:
> > step 2. + 3. are quite simple AFAICS, but step 1. is more tricky - is
> > there any way to obtain this information from AWT or somewhere else ????
>
> No, the AWT doesn't provide an interface to get the font directory
> or for resolving a font name into a file.
>
> You can search some standard directories (C:/Windows/fonts,
> /usr/X11R6/fonts etc.), which is not very robust. Unfortunately,
> Java deprecated access to environment variables...

Deprecated? Well, it's a bit confusing: in 1.4.2 indeed they are. I don't
get that impression when browsing through the 1.5 API docs though...
System.getenv($varname) is a non-deprecated method call (and in 1.5 Sun has
even added a variant without parameter, which returns a generic
String-String Map containing all defined environment vars).
One can only wonder what their intention was...

Anyway, it seems Mikael can use System.getenv(...) without concern.


Greetz,

Andreas


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


Re: FOP and Fonts

Posted by "J.Pietschmann" <j3...@yahoo.de>.
mka@exceldata.com wrote:
> step 2. + 3. are quite simple AFAICS, but step 1. is more tricky - is 
> there any way to obtain this information from AWT or somewhere else ????

No, the AWT doesn't provide an interface to get the font directory
or for resolving a font name into a file.

You can search some standard directories (C:/Windows/fonts,
/usr/X11R6/fonts etc.), which is not very robust. Unfortunately,
Java deprecated access to environment variables, which would have
made the task quite a bit easier. You might want to call an
external program for this purpose.

J.Pietschmann

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