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 Tracey Zellmann <tr...@comcast.net> on 2006/03/06 13:54:00 UTC

getting veradana font to work

I am not able to get Verdana to work. I have tried to follow the 
documentation. I have also read the recent emails about embedded font 
problems, but I can't quite follow the details.

I am getting this error.
SEVERE: svg graphic could not be rendered: null
java.lang.NullPointerException
at org.apache.fop.fonts.LazyFont.mapChar(LazyFont.java:97)
at org.apache.fop.fonts.Font.mapChar(Font.java:144)
at org.apache.fop.svg.PDFTextPainter.getStringWidth(PDFTextPainter.java:266)
at org.apache.fop.svg.PDFTextPainter.paint(PDFTextPainter.java:219)
at org.apache.batik.gvt.TextNode.primitivePaint(Unknown Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown Source)
at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(Unknown Source)
at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source), and many 
more...

Here are the steps I have taken

Create font metrics from the local Verdana.ttf file in C:\WINDOWS\FONTS 
using TTFReader
the command window messages indicates it was successful, and the file is 
ttfcm.xml
I did use the -enc ansi otpion. My target customers are using Windows and 
will have the same Verdana font available locally.

Register Fonts with FOP.
I took the configuration file that comes with the distribution fop.xconf, 
and added these elements in the fonts element.
<fo:inline font-family="Verdana" font-weight="normal" font-style="normal">
     Verdana-normal-normal font
</fo:inline>

<font 
metrics-url="fle:///C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-0.91beta/ttfcm.xml">
     <font-triplet name="Verdana" style="normal" weight="normal"/>
</font>



Tell FOP about the configuration

        Fop fop = new Fop(MimeConstants.MIME_PDF);
        DefaultConfigurationBuilder cfgBuilder =
            new DefaultConfigurationBuilder();
        Configuration cfg = cfgBuilder.buildFromFile(
     "C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-    0.91beta/conf/fop.xconf");
        FOUserAgent userAgent = fop.getUserAgent();
        userAgent.setUserConfig(cfg);

For completeness, here is how I am trying to invoke the font within the svg 
element.

<g style="font-family: Verdana, sans-serif; font-size: 10pt; stroke: none; 
fill: black;">

Any help would be appreciated. Is there a worked example that touches all 
the aspects?




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


Re: getting veradana font to work

Posted by Tracey Zellmann <tr...@comcast.net>.
HOORAY!

You are exactly right. That was it. I was tearing out my hair.

Sorry to take your time with a typo, but I just couldn't find it without 
another pair of eyes.

----- Original Message ----- 
From: "Dirk Bromberg" <di...@familie-bromberg.de>
To: <fo...@xmlgraphics.apache.org>
Sent: Monday, March 06, 2006 7:57 AM
Subject: Re: getting veradana font to work


> Have you seen the typo error ?:
>
> <font 
> metrics-url="fle:///C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-0.91beta/ttfcm.xml">
> --->                   ^^^^
>    <font-triplet name="Verdana" style="normal" weight="normal"/>
> </font>
>
> Dirk
>
> Tracey Zellmann wrote:
>> I am not able to get Verdana to work. I have tried to follow the 
>> documentation. I have also read the recent emails about embedded font 
>> problems, but I can't quite follow the details.
>>
>> I am getting this error.
>> SEVERE: svg graphic could not be rendered: null
>> java.lang.NullPointerException
>> at org.apache.fop.fonts.LazyFont.mapChar(LazyFont.java:97)
>> at org.apache.fop.fonts.Font.mapChar(Font.java:144)
>> at 
>> org.apache.fop.svg.PDFTextPainter.getStringWidth(PDFTextPainter.java:266)
>> at org.apache.fop.svg.PDFTextPainter.paint(PDFTextPainter.java:219)
>> at org.apache.batik.gvt.TextNode.primitivePaint(Unknown Source)
>> at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
>> at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown 
>> Source)
>> at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
>> at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown 
>> Source)
>> at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(Unknown Source)
>> at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source), and 
>> many more...
>>
>> Here are the steps I have taken
>>
>> Create font metrics from the local Verdana.ttf file in C:\WINDOWS\FONTS 
>> using TTFReader
>> the command window messages indicates it was successful, and the file is 
>> ttfcm.xml
>> I did use the -enc ansi otpion. My target customers are using Windows and 
>> will have the same Verdana font available locally.
>>
>> Register Fonts with FOP.
>> I took the configuration file that comes with the distribution fop.xconf, 
>> and added these elements in the fonts element.
>> <fo:inline font-family="Verdana" font-weight="normal" 
>> font-style="normal">
>>     Verdana-normal-normal font
>> </fo:inline>
>>
>> <font 
>> metrics-url="fle:///C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-0.91beta/ttfcm.xml">
>>     <font-triplet name="Verdana" style="normal" weight="normal"/>
>> </font>
>>
>>
>>
>> Tell FOP about the configuration
>>
>>        Fop fop = new Fop(MimeConstants.MIME_PDF);
>>        DefaultConfigurationBuilder cfgBuilder =
>>            new DefaultConfigurationBuilder();
>>        Configuration cfg = cfgBuilder.buildFromFile(
>>     "C:/unzipped/fop-0.91beta-bin-jdk1.4/fop- 
>> 0.91beta/conf/fop.xconf");
>>        FOUserAgent userAgent = fop.getUserAgent();
>>        userAgent.setUserConfig(cfg);
>>
>> For completeness, here is how I am trying to invoke the font within the 
>> svg element.
>>
>> <g style="font-family: Verdana, sans-serif; font-size: 10pt; stroke: 
>> none; fill: black;">
>>
>> Any help would be appreciated. Is there a worked example that touches all 
>> the aspects?
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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: getting veradana font to work

Posted by Dirk Bromberg <di...@familie-bromberg.de>.
Have you seen the typo error ?:

<font 
metrics-url="fle:///C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-0.91beta/ttfcm.xml"> 

--->                   ^^^^
    <font-triplet name="Verdana" style="normal" weight="normal"/>
</font>

Dirk

Tracey Zellmann wrote:
> I am not able to get Verdana to work. I have tried to follow the 
> documentation. I have also read the recent emails about embedded font 
> problems, but I can't quite follow the details.
>
> I am getting this error.
> SEVERE: svg graphic could not be rendered: null
> java.lang.NullPointerException
> at org.apache.fop.fonts.LazyFont.mapChar(LazyFont.java:97)
> at org.apache.fop.fonts.Font.mapChar(Font.java:144)
> at 
> org.apache.fop.svg.PDFTextPainter.getStringWidth(PDFTextPainter.java:266)
> at org.apache.fop.svg.PDFTextPainter.paint(PDFTextPainter.java:219)
> at org.apache.batik.gvt.TextNode.primitivePaint(Unknown Source)
> at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
> at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown 
> Source)
> at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
> at org.apache.batik.gvt.CompositeGraphicsNode.primitivePaint(Unknown 
> Source)
> at org.apache.batik.gvt.CanvasGraphicsNode.primitivePaint(Unknown Source)
> at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source), 
> and many more...
>
> Here are the steps I have taken
>
> Create font metrics from the local Verdana.ttf file in 
> C:\WINDOWS\FONTS using TTFReader
> the command window messages indicates it was successful, and the file 
> is ttfcm.xml
> I did use the -enc ansi otpion. My target customers are using Windows 
> and will have the same Verdana font available locally.
>
> Register Fonts with FOP.
> I took the configuration file that comes with the distribution 
> fop.xconf, and added these elements in the fonts element.
> <fo:inline font-family="Verdana" font-weight="normal" 
> font-style="normal">
>     Verdana-normal-normal font
> </fo:inline>
>
> <font 
> metrics-url="fle:///C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-0.91beta/ttfcm.xml"> 
>
>     <font-triplet name="Verdana" style="normal" weight="normal"/>
> </font>
>
>
>
> Tell FOP about the configuration
>
>        Fop fop = new Fop(MimeConstants.MIME_PDF);
>        DefaultConfigurationBuilder cfgBuilder =
>            new DefaultConfigurationBuilder();
>        Configuration cfg = cfgBuilder.buildFromFile(
>     "C:/unzipped/fop-0.91beta-bin-jdk1.4/fop-    
> 0.91beta/conf/fop.xconf");
>        FOUserAgent userAgent = fop.getUserAgent();
>        userAgent.setUserConfig(cfg);
>
> For completeness, here is how I am trying to invoke the font within 
> the svg element.
>
> <g style="font-family: Verdana, sans-serif; font-size: 10pt; stroke: 
> none; fill: black;">
>
> Any help would be appreciated. Is there a worked example that touches 
> all the aspects?
>
>
>
>
> ---------------------------------------------------------------------
> 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