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

Fop invalid position combining mark for Thai text (CTL)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Resolution: Unresolved
    • 2.5
    • None
    • font/unqualified
    • None
    • Operating System: All
      Platform: PC
    • 53573

    Description

      1. In order to make Thai glyph substitution work, the language tag must be "dflt" instead of "th". This is because many popular Thai font use "dflt".
      2. Using "dflt" language, both GSUB and GPOS are used. The problem is after it used, all glyph are placed further to the right.

      Notes:
      1. Many Thai combining glyph have negative alignment. I suspect this is involved in miss alignment calculation.
      2. The ratio of displacement seem irrational. If it shifted to the left by the same ratio, it is still invalid.

      Question:
      Should "dflt" being load by default ?

      XML Data for testing:
      <?xml version="1.0" encoding="UTF-8"?>
      <data>กุญญูฐฐูฏฏูฎฎูบบ่บี่ปป่ปี่กำปำถํ้า</data>

      XSLT for testing:
      <?xml version="1.0" encoding="ISO-8859-1"?>

      <xsl:stylesheet version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

      <xsl:template match="/">
      <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
      <fo:simple-page-master master-name="A4">
      <fo:region-body />
      </fo:simple-page-master>
      </fo:layout-master-set>

      <fo:page-sequence master-reference="A4">
      <fo:flow flow-name="xsl-region-body">
      <fo:block script="thai" language="dflt" font-size="32pt" font-family="AngsanaUPC">
      <xsl:value-of select="data" />
      </fo:block>
      </fo:flow>
      </fo:page-sequence>
      </fo:root>
      </xsl:template>

      </xsl:stylesheet>

      The fop.xconf has added font into fonts section of applicaton/pdf renderer:
      <font embed-url="file:///c:/windows/fonts/angsau.ttf" kerning="yes">
      <font-triplet name="AngsanaUPC" style="normal" weight="normal"/>
      </font>

      The Java code used to reproduce:

      FopFactory fopFac = FopFactory.newInstance(new File("fop.xconf"));
      OutputStream outputStream = new BufferedOutputStream(new FileOutputStream("c:\\temp
      fopThai.pdf"));

      Fop fop = fopFac.newFop(MimeConstants.MIME_PDF, outputStream);

      TransformerFactory transFac = TransformerFactory.newInstance();
      Source xslData = new StreamSource(new File("data.xslt"));
      Transformer trans = transFac.newTransformer(xslData);
      Result res = new SAXResult(fop.getDefaultHandler());

      Source xmlData = new StreamSource(new File("thaidata.xml"));
      trans.transform(xmlData, res);

      outputStream.close();

      Attachments

        1. Untitled.jpg
          26 kB
          Nattapong Sirilappanich
        2. test.fo.xml
          1 kB
          Glenn Adams
        3. test.pdf
          15 kB
          Glenn Adams
        4. thaidata.xml
          0.2 kB
          Nattapong Sirilappanich
        5. data.xslt
          0.9 kB
          Nattapong Sirilappanich
        6. fopThai5.pdf
          15 kB
          Nattapong Sirilappanich
        7. thai.fo
          1.0 kB
          Nattapong Sirilappanich
        8. fop.log
          316 kB
          Nattapong Sirilappanich

        Issue Links

          Activity

            People

              gadams Glenn Adams
              natta@th.ibm.com Nattapong Sirilappanich
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: