You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-dev@xmlgraphics.apache.org by "simon steiner (JIRA)" <ji...@apache.org> on 2018/05/16 12:55:00 UTC

[jira] [Resolved] (FOP-1617) FOP gets an error for Windows Japanese font.

     [ https://issues.apache.org/jira/browse/FOP-1617?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

simon steiner resolved FOP-1617.
--------------------------------
    Resolution: Cannot Reproduce

> FOP gets an error for Windows Japanese font.
> --------------------------------------------
>
>                 Key: FOP-1617
>                 URL: https://issues.apache.org/jira/browse/FOP-1617
>             Project: FOP
>          Issue Type: Bug
>          Components: font/unqualified
>    Affects Versions: 0.95
>         Environment: Operating System: Windows XP
> Platform: PC
>            Reporter: Mamoru Asagami
>         Attachments: fopdoc.zip
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)