Uploaded image for project: 'FOP'
  1. FOP
  2. FOP-2468

Render svg throw NPE if use local fonts with metrics xml.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 2.5
    • None
    • foreign/svg
    • None

    Description

      I got a error when use svg with local fonts. It seems boundingboxes is null.

      SVG graphic could not be rendered. Reason: java.lang.NullPointerException
      java.lang.NullPointerException
      at org.apache.fop.fonts.MultiByteFont.getBoundingBox(MultiByteFont.java:210)
      at org.apache.fop.fonts.LazyFont.getBoundingBox(LazyFont.java:301)
      at org.apache.fop.svg.font.FOPGVTGlyphVector.buildBoundingBoxes(FOPGVTGlyphVector.java:428)
      at org.apache.fop.svg.font.FOPGVTGlyphVector.getBoundingBoxes(FOPGVTGlyphVector.java:420)
      at org.apache.fop.svg.font.FOPGVTGlyphVector.getGlyphMetrics(FOPGVTGlyphVector.java:290)
      at org.apache.batik.bridge.GlyphLayout.doExplicitGlyphLayout(Unknown Source)
      at org.apache.batik.bridge.GlyphLayout.adjustTextSpacing(Unknown Source)
      at org.apache.batik.bridge.GlyphLayout.getAdvance2D(Unknown Source)
      at org.apache.batik.bridge.StrokingTextPainter.getTextChunk(Unknown Source)
      at org.apache.batik.bridge.StrokingTextPainter.computeTextRuns(Unknown Source)
      at org.apache.fop.svg.NativeTextPainter.computeTextRuns(NativeTextPainter.java:223)
      at org.apache.batik.bridge.StrokingTextPainter.getTextRuns(Unknown Source)
      at org.apache.batik.bridge.StrokingTextPainter.getBounds2D(Unknown Source)
      at org.apache.batik.bridge.TextNode.getPrimitiveBounds(Unknown Source)
      at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedPrimitiveBounds(Unknown Source)
      at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(Unknown Source)
      at org.apache.batik.gvt.CompositeGraphicsNode.getPrimitiveBounds(Unknown Source)
      at org.apache.batik.gvt.CompositeGraphicsNode.getTransformedPrimitiveBounds(Unknown Source)
      at org.apache.batik.gvt.AbstractGraphicsNode.getTransformedBounds(Unknown Source)
      at org.apache.batik.gvt.CompositeGraphicsNode.getPrimitiveBounds(Unknown Source)
      at org.apache.batik.gvt.AbstractGraphicsNode.getBounds(Unknown Source)
      at org.apache.batik.gvt.AbstractGraphicsNode.paint(Unknown Source)
      at org.apache.fop.render.pdf.PDFImageHandlerSVG.handleImage(PDFImageHandlerSVG.java:207)
      at org.apache.fop.render.intermediate.AbstractIFPainter.drawImage(AbstractIFPainter.java:249)
      at org.apache.fop.render.intermediate.AbstractIFPainter.drawImage(AbstractIFPainter.java:205)
      at org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingImageHandler(AbstractIFPainter.java:170)
      at org.apache.fop.render.intermediate.AbstractIFPainter.drawImageUsingDocument(AbstractIFPainter.java:319)
      at org.apache.fop.render.pdf.PDFPainter.drawImage(PDFPainter.java:232)
      at org.apache.fop.render.intermediate.IFRenderer.renderForeignObject(IFRenderer.java:1308)
      at org.apache.fop.render.AbstractRenderer.renderInlineViewport(AbstractRenderer.java:861)
      at org.apache.fop.render.AbstractPathOrientedRenderer.renderInlineViewport(AbstractPathOrientedRenderer.java:832)
      at org.apache.fop.render.intermediate.IFRenderer.renderInlineViewport(IFRenderer.java:862)
      at org.apache.fop.render.AbstractRenderer.renderInlineArea(AbstractRenderer.java:714)
      at org.apache.fop.render.intermediate.IFRenderer.renderInlineArea(IFRenderer.java:926)
      at org.apache.fop.render.AbstractRenderer.renderLineArea(AbstractRenderer.java:689)
      at org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:571)
      at org.apache.fop.render.AbstractRenderer.renderBlock(AbstractRenderer.java:612)
      at org.apache.fop.render.intermediate.IFRenderer.renderBlock(IFRenderer.java:998)
      at org.apache.fop.render.AbstractRenderer.renderBlocks(AbstractRenderer.java:556)
      at org.apache.fop.render.AbstractRenderer.renderFlow(AbstractRenderer.java:456)
      at org.apache.fop.render.AbstractPathOrientedRenderer.renderFlow(AbstractPathOrientedRenderer.java:785)
      at org.apache.fop.render.AbstractRenderer.renderMainReference(AbstractRenderer.java:433)
      at org.apache.fop.render.AbstractRenderer.renderBodyRegion(AbstractRenderer.java:357)
      at org.apache.fop.render.AbstractRenderer.renderRegionViewport(AbstractRenderer.java:304)
      at org.apache.fop.render.intermediate.IFRenderer.renderRegionViewport(IFRenderer.java:737)
      at org.apache.fop.render.AbstractRenderer.renderPageAreas(AbstractRenderer.java:278)
      at org.apache.fop.render.AbstractRenderer.renderPage(AbstractRenderer.java:243)
      at org.apache.fop.render.intermediate.IFRenderer.renderPage(IFRenderer.java:585)
      at org.apache.fop.area.RenderPagesModel.addPage(RenderPagesModel.java:123)
      at org.apache.fop.layoutmgr.AbstractPageSequenceLayoutManager.finishPage(AbstractPageSequenceLayoutManager.java:315)
      at org.apache.fop.layoutmgr.PageSequenceLayoutManager.finishPage(PageSequenceLayoutManager.java:213)
      at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:137)
      at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
      at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:130)
      at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:360)
      at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
      at org.apache.xalan.transformer.TransformerIdentityImpl.endElement(TransformerIdentityImpl.java:1101)
      at org.apache.xerces.parsers.AbstractSAXParser.endElement(Unknown Source)
      at org.apache.xerces.xinclude.XIncludeHandler.endElement(Unknown Source)
      at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanEndElement(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
      at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      at org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:484)
      at org.apache.fop.cli.InputHandler.transformTo(InputHandler.java:285)
      at org.apache.fop.cli.InputHandler.renderTo(InputHandler.java:115)
      at org.apache.fop.cli.Main.startFOP(Main.java:186)
      at org.apache.fop.cli.Main.main(Main.java:217)

      Attachments

        1. bug.zip
          9 kB
          chunlinyao
        2. test.fo
          0.9 kB
          chunlinyao

        Activity

          People

            Unassigned Unassigned
            chunlinyao chunlinyao
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: