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

FOP gets an error for Windows Japanese font.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Resolution: Cannot Reproduce
    • 0.95
    • None
    • font/unqualified
    • None
    • Operating System: Windows XP
      Platform: PC
    • 46460

    Description

      Problem:

      You get:
      [Fatal Error] msmincho.xml:1:171: Character reference "&#0" is an invalid XML character

      if you make font metrics files from msmincho.ttc and msgothic.ttc of Windows and use them.

      To reproduce it, set up the attached file: fopdoc.zip as c:\fopdoc, fop.xconf.xml(one of the zip) as ${fop.home}/conf/fop.xconf.xml, and run ant as follows:

      c:\fopdoc>ant

      For your convenience, I included ant's error message as err.txt in the attached file: fopdoc.zip.

      Solution:

      I found something in "public final String readTTFString(int len)" of org.apache.fop.fonts.truetype.FontFileReader.

      When I replaced the character encoding discerning heuristic:

      final String encoding;
      if ((tmp.length > 0) && (tmp[0] == 0))

      { encoding = "UTF-16BE"; }

      else

      { encoding = "ISO-8859-1"; }

      with the following:

      String encoding = "ISO-8859-1";
      for(int c: tmp) {
      c &= 0xff;
      if(c==0 || c >= 0x80)

      { encoding = "UTF-16BE"; break; }

      }

      everything went fine.

      Attachments

        1. fopdoc.zip
          7 kB
          Mamoru Asagami

        Activity

          People

            Unassigned Unassigned
            lovelylovelyflora@ab.auone-net.jp Mamoru Asagami
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: