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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to