Uploaded image for project: 'Batik'
  1. Batik
  2. BATIK-695

svggen Font fails to load Arial Unicode in Batik 1.6

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.6
    • Fix Version/s: None
    • Component/s: SVGGraphics2D
    • Labels:
      None
    • Environment:
      Operating System: Windows XP
      Platform: All

      Description

      Here's the stacktrace:

      java.lang.NegativeArraySizeException
      at org.apache.batik.svggen.font.table.HmtxTable.init(HmtxTable.java:59)
      at org.apache.batik.svggen.font.Font.read(Font.java:178)
      at org.apache.batik.svggen.font.Font.create(Font.java:196)

      If I had to take a guess at a solution, from that stacktrace it appears Batik
      failed to read a value for numberOfHMetrics from the HHEA table in the TTF. I
      took a quick look at the TTF specification from Microsoft and it appears this
      value is an unsigned short:

      http://www.microsoft.com/OpenType/OTSpec/hhea.htm

      ...however, Apache Batik is reading it in as a normal Java short (which is
      signed) on line 58 of org.apache.batik.svggen.font.table.HheaTable. The huge
      number of glyph entries in Arial Unicode probably means the number of entries in
      the HMTX table exceeds 32768 hence the short wraps around to a negative value,
      and thus the initialization of the hMetrics Array fails. Using an int to store
      this value and correcting for the negative bit with a mask should solve the problem.

      Note that we think we've successfully run tests with Arial Unicode in the past,
      so perhaps this is a regression in Batik 1.6?

        Attachments

          Activity

            People

            • Assignee:
              batik-dev@xmlgraphics.apache.org Batik Developer's Mailing list
              Reporter:
              pfarland@adobe.com Peter Farland
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: