Details
-
Bug
-
Status: Open
-
Resolution: Unresolved
-
2.5
-
None
-
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();