Attached is a sample input FO, output IF, and output PDF example showing the
functioning of complex chained contextual glyph substitution and glyph
positioning operations, now available on my working dev branch at git://
github.com/skynavga/fop.git.

The GDEF (glyph definition) table is now supported as well in order to
correctly process the IgnoreBase, IgnoreLigatures, IgnoreMarks lookup flags
according to font defined glyph classes.

Regards,
Glenn
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
  <fo:layout-master-set>
    <fo:simple-page-master master-name="simple" page-height="29.7cm" page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" margin-right="2.5cm">
      <fo:region-body margin-top="3cm"/>
      <fo:region-before extent="3cm"/>
      <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="simple" writing-mode="lr">
    <fo:flow flow-name="xsl-region-body">
      <fo:block font-size="16pt" font-family="sans-serif" line-height="18pt" space-after.optimum="20pt" border="0pt solid red" padding="2pt" text-align="center">
Chained Contextual Substitution and Positioning
      </fo:block>
      <fo:block font-size="10pt" font-family="sans-serif" line-height="12pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="justify">
The following demonstrates a complex combination of multiple glyph substitution and glyph positioning operations. When the ALEF (logically) precedes WAW and REH graphemes,
there is no special substitution or positioning (see rightmost letter groups). However, when ALEF (logically) follows WAW and REH graphemes,
the latter are (pair) kerned so that the trail of their stroke lies under ALEF. When ALEF is combined with HAMZA BELOW, this kerning would normally cause the trail
of the stroke of WAW and REH to overlap the HAMZA BELOW. In order to resolve this, the font uses the GSUB 'ccmp' feature to decompose ALEF WITH HAMZA BELOW into
its constituent parts. The HAMZA is then further adjusted twice by the GPOS 'mark' feature to (1) attach the HAMZA BELOW mark to the ALEF base glyph, and then
(2) to lower the HAMZA BELOW mark (due to the presence of the WAW or REH allograph) to prevent intersection (see leftmost letter groups).
      </fo:block>
      <fo:block font-size="10pt" font-family="sans-serif" line-height="12pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="justify">
The following example is based on the Microsoft Simplified Arabic 5.0 font. Other fonts may have varying results depending upon whether they contain the necessary
GSUB and GPOS tables to accomplish these adjustments.
      </fo:block>
      <fo:block font-size="32pt" font-family="Simplified Arabic" line-height="48pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="center">
&#x0625;&#x0624;
&#x0624;&#x0625;
      </fo:block>
      <fo:block font-size="32pt" font-family="Simplified Arabic" line-height="48pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="center">
&#x0625;&#x0631;
&#x0631;&#x0625;
      </fo:block>
      <fo:block font-size="32pt" font-family="Simplified Arabic" line-height="48pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="center">
&#x0625;&#x0632;
&#x0632;&#x0625;
      </fo:block>
      <fo:block font-size="32pt" font-family="Simplified Arabic" line-height="48pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="center">
&#x0625;&#x0648;
&#x0648;&#x0625;
      </fo:block>
      <fo:block font-size="32pt" font-family="Simplified Arabic" line-height="48pt" space-after.optimum="4pt" border="0pt solid red" padding="2pt" text-align="center">
&#x0625;&#x0698;
&#x0698;&#x0625;
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
<?xml version="1.0" encoding="UTF-8"?>
<document xmlns="http://xmlgraphics.apache.org/fop/intermediate"; xmlns:xlink="http://www.w3.org/1999/xlink"; xmlns:nav="http://xmlgraphics.apache.org/fop/intermediate/document-navigation";>
<header>
<x:xmpmeta xmlns:x="adobe:ns:meta/">
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
<rdf:Description xmlns:xmp="http://ns.adobe.com/xap/1.0/"; rdf:about="">
<xmp:CreateDate>2010-09-21T23:08:51+08:00</xmp:CreateDate>
<xmp:CreatorTool>Apache FOP Version svn-trunk</xmp:CreatorTool>
<xmp:MetadataDate>2010-09-21T23:08:51+08:00</xmp:MetadataDate>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
</header>
<page-sequence xml:space="preserve">
<page index="0" name="1" page-master-name="simple" width="595275" height="841889">
<page-header/>
<content>
<viewport transform="translate(70866,28346)" width="453543" height="85039"/>
<viewport transform="translate(70866,742678)" width="453543" height="42519"/>
<viewport transform="translate(70866,113385)" width="453543" height="671812">
<font family="sans-serif" style="normal" weight="400" variant="normal" size="16000" color="#000000"/>
<text x="56211" y="15088" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 -480 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -800">Chained Contextual Substitution and Positioning</text>
<font size="10000"/>
<text x="0" y="52555" word-spacing="172" dx="0 0 0 0 0 -300 0 0 0 -150 0 0 0 0 0 0 0 0 0 0 0 0 -100 0 0 0 0 0 0 0 0 0 0 0 0 -300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100">The following demonstrates a complex combination of multiple glyph substitution and glyph positioning</text>
<text x="0" y="64555" word-spacing="2520" dx="0 0 0 0 -100 0 0 0 0 0 -150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -500 -500 0 0 0 0 0 0 0 0 0 0 -100 -100 0 0 0 0 0 0 -150">operations. When the ALEF (logically) precedes WAW and REH graphemes, there is no special</text>
<text x="0" y="76555" word-spacing="555" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100 0 0 0 0 0 0 0 0 0 -150 -100 -300 -250 0 -500 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300 0 0 0 -150 0 0 0 -500 -500">substitution or positioning (see rightmost letter groups). However, when ALEF (logically) follows WAW</text>
<text x="0" y="88555" word-spacing="210" dx="0 0 0 0 0 0 0 0 0 -100 -100 0 0 0 0 0 0 -150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -200 0 250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1500">and REH graphemes, the latter are (pair) kerned so that the trail of their stroke lies under ALEF. When</text>
<text x="0" y="100555" word-spacing="-651" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300 -800 0 0 0 0 0 0 0 -200 0 250 0 0 0 0 0 -100 0 0 0 0 0 0 0 250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -200 0 0 0 0 0 -500 -500">ALEF is combined with HAMZA BELOW, this kerning would normally cause the trail of the stroke of WAW</text>
<text x="0" y="112555" word-spacing="-808" dx="0 0 0 0 0 0 0 0 0 0 0 0 -150 -250 0 150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300 -800 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -250 0 0 0 0 0 -150 0 0 0 0 0 0 -300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300">and REH to overlap the HAMZA BELOW. In order to resolve this, the font uses the GSUB 'ccmp' feature to</text>
<text x="0" y="124555" word-spacing="-299" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 400 0 -150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 400">decompose ALEF WITH HAMZA BELOW into its constituent parts. The HAMZA is then further adjusted</text>
<text x="0" y="136555" word-spacing="186" dx="0 0 0 0 0 0 0 -200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 150 0 0 0 -300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300 0 0 0 0 150">twice by the GPOS 'mark' feature to (1) attach the HAMZA BELOW mark to the ALEF base glyph, and</text>
<text x="0" y="148555" word-spacing="1110" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 0 -150 -100 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -300 0 0 0 0 150 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -500 -500 0 0 0 0 0 0 0 0 0 0 0 0 0 -100 -100">then (2) to lower the HAMZA BELOW mark (due to the presence of the WAW or REH allograph) to</text>
<text x="0" y="160555" dx="0 0 0 -300 -250 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100">prevent intersection (see leftmost letter groups).</text>
<text x="0" y="180555" word-spacing="-454" dx="0 0 0 0 0 -300 0 0 0 -150 0 0 0 0 0 -300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -100 0 0 0 0 0 0 0 0 0 -300 0 0 0 0 0 0 0 0 0 0 0 -300 0 0 0 0 0 0 -300 0 0 0 -200 -250 0 0 -250 0 300">The following example is based on the Microsoft Simplified Arabic 5.0 font. Other fonts may have varying</text>
<text x="0" y="192555" word-spacing="1075" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -200 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 300 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -200">results depending upon whether they contain the necessary GSUB and GPOS tables to accomplish</text>
<text x="0" y="204555" dx="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -150">these adjustments.</text>
<font family="Simplified Arabic" size="32000"/>
<text x="203587" y="249472" dp="3 4672 -7008 Z6 -4672 0 -4672 0">ٕاؤ</text>
<text x="219363" y="249472"> </text>
<text x="229507" y="249472">ؤإ</text>
<text x="203363" y="305472" dp="3 4672 -7008 Z6 -7808 0 -7808 0">ٕار</text>
<text x="217795" y="305472"> </text>
<text x="227939" y="305472">رإ</text>
<text x="203363" y="361472" dp="3 4672 -7008 Z6 -7808 0 -7808 0">ٕاز</text>
<text x="217795" y="361472"> </text>
<text x="227939" y="361472">زإ</text>
<text x="203587" y="417472" dp="3 4672 -7008 Z6 -4672 0 -4672 0">ٕاو</text>
<text x="219363" y="417472"> </text>
<text x="229507" y="417472">وإ</text>
<text x="203363" y="473472" dp="3 4672 -7008 Z6 -7808 0 -7808 0">ٕاژ</text>
<text x="217795" y="473472"> </text>
<text x="227939" y="473472">ژإ</text>
</viewport>
</content>
<page-trailer/>
</page>
</page-sequence>
<trailer/>
</document>

Attachment: test.pdf
Description: Adobe PDF document

Reply via email to