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 Peter Neu <pe...@gmx.net> on 2006/09/01 10:49:33 UTC

AW: Setting configuration of fonts in java code?

Hello,

I'm working my way through the src code of FOP in order to find a way
to configure the font setup in the java code. But this seems rather
difficult. The org.apache.fop.configuration.FontInfo object gives me the
possibility to insert the font names and stuff but I cannot insert the
metric file directly because only the path is taken there. 

Is there a way to do this ?

URL url = new URL("http://localhost:90/nbw06/xml/ttfcm.xml");
conn = url.openConnection();
metricFile = conn.getInputStream();
URL url2 = new URL2("http://localhost:90/nbw06/xml/verdana.ttf");
Conn2 = url.openConnection();
embedFile= conn2.getInputStream();

FontTriplet fontTrip1 = new FontTriplet("Verdana","normal","bold");
FontTriplet fontTrip2 = new FontTriplet("Verdana","normal","normal");
LinkedList l = new LinkedList();
l.add(fontTrip1);
l.add(fontTrip2);

FontInfo fontInf = new FontInfo("Verdana", metricFile ,false,l, embedFile);

//And Notify FOP of additional font ??


Cheers,
Pete





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


Re: AW: AW: Setting configuration of fonts in java code?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 1, 2006, at 11:27, Peter Neu wrote:

> Hm, is this possible? When fop reads the userconfig.xml, where is  
> the base
> directory? The application runs in tomcat so I don't know where to  
> put the
> base dir.

I think so. Unfortunately, I'm not all to familiar with getting this  
info in a servlet context, but isn't it possible to obtain the root  
from the below tree via the servlet?
(maybe others on this list immediately know the idiom for retrieving  
that)

In that case, it might become even simpler:

fopFactory.setFontBaseURL(
     {root here} + System.getProperty("file.separator") + "XML");

Same line of code for both platforms.

HTH!

Andreas

>
> File system looks like this
>
>
> ROOT
> |----WEB-INF
> |        |--------classes
> |
> |----XML
>        |------- userconfig.xml
>        |------- verdana.ttf
>        |------- ttfcm.xml


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


AW: AW: Setting configuration of fonts in java code?

Posted by Peter Neu <pe...@gmx.net>.
Hm, is this possible? When fop reads the userconfig.xml, where is the base
directory? The application runs in tomcat so I don't know where to put the
base dir. 

File system looks like this


ROOT
|----WEB-INF
|        |--------classes
|
|----XML
       |------- userconfig.xml
       |------- verdana.ttf
       |------- ttfcm.xml




 

> -----Ursprüngliche Nachricht-----
> Von: Andreas L Delmelle [mailto:a_l.delmelle@pandora.be]
> Gesendet: Freitag, 1. September 2006 10:57
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: AW: Setting configuration of fonts in java code?
> 
> On Sep 1, 2006, at 10:49, Peter Neu wrote:
> 
> Hi,
> 
> > I'm working my way through the src code of FOP in order to find a way
> > to configure the font setup in the java code. But this seems rather
> > difficult. The org.apache.fop.configuration.FontInfo object gives
> > me the
> > possibility to insert the font names and stuff but I cannot insert the
> > metric file directly because only the path is taken there.
> 
> Re-reading your original problem: wouldn't the solution be to use
> relative URIs? If you can make sure the relative locations are the
> same on both platforms, then only the fontBaseDir would have to be
> defined separately --which seems much easier...
> 
> HTH!
> 
> Andreas
> 
> 
> ---------------------------------------------------------------------
> 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: AW: Setting configuration of fonts in java code?

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 1, 2006, at 10:49, Peter Neu wrote:

Hi,

> I'm working my way through the src code of FOP in order to find a way
> to configure the font setup in the java code. But this seems rather
> difficult. The org.apache.fop.configuration.FontInfo object gives  
> me the
> possibility to insert the font names and stuff but I cannot insert the
> metric file directly because only the path is taken there.

Re-reading your original problem: wouldn't the solution be to use  
relative URIs? If you can make sure the relative locations are the  
same on both platforms, then only the fontBaseDir would have to be  
defined separately --which seems much easier...

HTH!

Andreas


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