Bug 51209

Summary: [PATCH] SVG text in AFP creates miscoded GOCA text
Product: Fop - Now in Jira Reporter: Mehdi Houshmand <med1985>
Component: fontsAssignee: fop-dev
Severity: normal    
Priority: P2    
Version: all   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: GOCA text poorly encoded test
patch to address issue described

Description Mehdi Houshmand 2011-05-17 10:12:22 UTC
Created attachment 27014 [details]
GOCA text poorly encoded test

This bug is caused by the SVG fonts are handled in AFP (and in general). There is a disparity between the way normal text, which is rendered into PTOCA, and SVG text, which is rendered to GOCA, is handled. The EBCDIC encoding isn't passed through to the GOCA object (GraphicalCharacterString), the GCS ALWAYS converts text using Cp1146 encoding regardless of what's given in the fop.xconf. I've attached an FO that illustrates the point.

I'm not that familiar with SVG so I may have copy/pasted some superfluous information but the bug is clearly visible if converted to AFP.
Comment 1 Mehdi Houshmand 2011-05-17 13:07:49 UTC
To add to this, if you wish to produce the correctly rendered AFP, you can change the EBCDIC encoding scheme to "CP500". This can be done by changing o.a.f.afp.goca.GraphicsCharacterString.getStringAsBytes() from:

    private byte[] getStringAsBytes() throws UnsupportedEncodingException {
        return str.getBytes(AFPConstants.EBCIDIC_ENCODING);


    private byte[] getStringAsBytes() throws UnsupportedEncodingException {
        return str.getBytes("Cp500");

This will provide the correct encoding scheme for Helvetica ONLY and render the FO properly. Though obviously this doesn't address the larger issue already described.
Comment 2 Luis Bernardo 2012-01-06 14:38:47 UTC
Created attachment 28122 [details]
patch to address issue described
Comment 3 Luis Bernardo 2012-01-17 15:19:07 UTC
edited title to reflect patch
Comment 4 Chris Bowditch 2012-01-18 11:54:59 UTC
Hi Luis,

Thanks for the patch. This has been committed in revision 1232845.


Comment 5 Glenn Adams 2012-04-07 01:41:33 UTC
resetting P2 open bugs to P3 pending further review
Comment 6 Glenn Adams 2012-04-08 09:11:03 UTC
increase priority due to presence of a patch
Comment 7 Mehdi Houshmand 2012-04-08 09:17:38 UTC
Patch applied, this can be closed