Lines Matching refs:Lookup

1537 				// list of Lookups in order they need to be run i.e. order listed in Lookup table
1549 // Get metadata and offsets for whole Lookup List table
1579 // Lookup Type 7: Extension
1593 // Process Whole LookupList - Get LuCoverage = Lookup coverage just for first glyph
1619 // Get metadata and offsets for whole Lookup List table
1622 $Lookup = [];
1625 $Lookup[$i]['offset'] = $LookupList_offset + $this->read_ushort();
1629 $this->seek($Lookup[$i]['offset']);
1630 $Lookup[$i]['Type'] = $this->read_ushort();
1631 $Lookup[$i]['Flag'] = $flag = $this->read_ushort();
1632 $Lookup[$i]['SubtableCount'] = $this->read_ushort();
1633 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1634 $Lookup[$i]['Subtable'][$c]['Offset'] = $Lookup[$i]['offset'] + $this->read_ushort();
1638 $Lookup[$i]['MarkFilteringSet'] = $this->read_ushort();
1640 $Lookup[$i]['MarkFilteringSet'] = '';
1643 // Lookup Type 7: Extension
1644 if ($Lookup[$i]['Type'] == 7) {
1646 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1647 $this->seek($Lookup[$i]['Subtable'][$c]['Offset']);
1650 $Lookup[$i]['Subtable'][$c]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ulong();
1652 $Lookup[$i]['Type'] = $type;
1658 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1659 $this->seek($Lookup[$i]['Subtable'][$c]['Offset']);
1661 $Lookup[$i]['Subtable'][$c]['Format'] = $SubstFormat;
1664 Lookup['Type'] Enumeration table for glyph substitution
1677 if ($Lookup[$i]['Type'] == 1) {
1678 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1680 $Lookup[$i]['Subtable'][$c]['DeltaGlyphID'] = $this->read_short();
1684 $Lookup[$i]['Subtable'][$c]['Glyphs'][] = $this->read_ushort();
1688 elseif ($Lookup[$i]['Type'] == 2) {
1689 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1690 $Lookup[$i]['Subtable'][$c]['SequenceCount'] = $SequenceCount = $this->read_short();
1692 $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1696 $this->seek($Lookup[$i]['Subtable'][$c]['Sequences'][$s]['Offset']);
1697 $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['GlyphCount'] = $this->read_short();
1698 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['GlyphCount']; $g++) {
1699 $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['SubstituteGlyphID'][] = $this->read_ushort();
1703 elseif ($Lookup[$i]['Type'] == 3) {
1704 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1705 $Lookup[$i]['Subtable'][$c]['AlternateSetCount'] = $AlternateSetCount = $this->read_short();
1707 $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1712 $this->seek($Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['Offset']);
1713 $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['GlyphCount'] = $this->read_short();
1714 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['GlyphCount']; $g++) {
1715 $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['SubstituteGlyphID'][] = $this->read_ushort();
1719 elseif ($Lookup[$i]['Type'] == 4) {
1720 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1721 $Lookup[$i]['Subtable'][$c]['LigSetCount'] = $LigSetCount = $this->read_short();
1723 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1727 $this->seek($Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Offset']);
1728 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount'] = $this->read_short();
1729 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount']; $g++) {
1730 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigatureOffset'][$g] = $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Offset'] + $this->read_ushort();
1734 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount']; $g++) {
1736 $this->seek($Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigatureOffset'][$g]);
1737 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['LigGlyph'] = $this->read_ushort();
1738 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount'] = $this->read_ushort();
1739 for ($l = 1; $l < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount']; $l++) {
1740 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['GlyphID'][$l] = $this->read_ushort();
1745 elseif ($Lookup[$i]['Type'] == 5) {
1748 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1749 $Lookup[$i]['Subtable'][$c]['SubRuleSetCount'] = $SubRuleSetCount = $this->read_short();
1751 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1755 $this->seek($Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['Offset']);
1756 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount'] = $this->read_short();
1757 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount']; $g++) {
1758 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleOffset'][$g] = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['Offset'] + $this->read_ushort();
1763 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount']; $g++) {
1765 $this->seek($Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleOffset'][$g]);
1767 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['GlyphCount'] = $this->read_ushort();
1768 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstCount'] = $this->read_ushort();
1770 for ($l = 1; $l < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['GlyphCount']; $l++) {
1771 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['Input'][$l] = $this->read_ushort();
1774 for ($l = 0; $l < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstCount']; $l++) {
1775 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstLookupRecord'][$l]['SequenceIndex'] = $this->read_ushort();
1776 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstLookupRecord'][$l]['LookupListIndex'] = $this->read_ushort();
1782 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1783 $Lookup[$i]['Subtable'][$c]['ClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1784 $Lookup[$i]['Subtable'][$c]['SubClassSetCnt'] = $this->read_ushort();
1785 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubClassSetCnt']; $b++) {
1788 $Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][] = 0;
1790 $Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $offset;
1794 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Lookup[$i]['Type'] . ", Format " . $SubstFormat . " not supported (ttfontsuni.php).");
1797 elseif ($Lookup[$i]['Type'] == 6) {
1800 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1801 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount'] = $this->read_ushort();
1802 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount']; $b++) {
1803 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetOffset'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1807 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1808 $Lookup[$i]['Subtable'][$c]['BacktrackClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1809 $Lookup[$i]['Subtable'][$c]['InputClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1810 $Lookup[$i]['Subtable'][$c]['LookaheadClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1811 $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt'] = $this->read_ushort();
1812 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt']; $b++) {
1815 $Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][] = $offset;
1817 $Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $offset;
1822 $Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount'] = $this->read_ushort();
1823 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']; $b++) {
1824 $Lookup[$i]['Subtable'][$c]['CoverageBacktrack'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1826 $Lookup[$i]['Subtable'][$c]['InputGlyphCount'] = $this->read_ushort();
1827 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['InputGlyphCount']; $b++) {
1828 $Lookup[$i]['Subtable'][$c]['CoverageInput'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1830 $Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount'] = $this->read_ushort();
1831 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']; $b++) {
1832 $Lookup[$i]['Subtable'][$c]['CoverageLookahead'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1834 $Lookup[$i]['Subtable'][$c]['SubstCount'] = $this->read_ushort();
1835 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubstCount']; $b++) {
1836 $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'] = $this->read_ushort();
1837 $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'] = $this->read_ushort();
1838 // Substitution Lookup Record
1839 // All contextual substitution subtables specify the substitution data in a Substitution Lookup Record
1846 throw new \Mpdf\Exception\FontException(sprintf('Lookup Type "%s" not supported.', $Lookup[$i]['Type']));
1854 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1855 $SubstFormat = $Lookup[$i]['Subtable'][$c]['Format'];
1858 if ($Lookup[$i]['Type'] == 1) {
1859 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1866 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1869 if (isset($Lookup[$i]['Subtable'][$c]['DeltaGlyphID'])) { // Format 1
1870 $substitute[] = unicode_hex($this->glyphToChar[($glyphs[$g] + $Lookup[$i]['Subtable'][$c]['DeltaGlyphID'])][0]);
1872 $substitute[] = unicode_hex($this->glyphToChar[($Lookup[$i]['Subtable'][$c]['Glyphs'][$g])][0]);
1874 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute];
1877 elseif ($Lookup[$i]['Type'] == 2) {
1878 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1885 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1888 if (!isset($Lookup[$i]['Subtable'][$c]['Sequences'][$g]['SubstituteGlyphID']) || count($Lookup[$i]['Subtable'][$c]['Sequences'][$g]['SubstituteGlyphID']) == 0) {
1891 foreach ($Lookup[$i]['Subtable'][$c]['Sequences'][$g]['SubstituteGlyphID'] as $sub) {
1894 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute];
1897 elseif ($Lookup[$i]['Type'] == 3) {
1898 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1905 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1908 $gid = $Lookup[$i]['Subtable'][$c]['AlternateSets'][$g]['SubstituteGlyphID'][0];
1913 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute];
1916 elseif ($Lookup[$i]['Type'] == 4) {
1917 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1919 $LigSetCount = $Lookup[$i]['Subtable'][$c]['LigSetCount'];
1921 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount']; $g++) {
1926 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1929 for ($l = 1; $l < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount']; $l++) {
1930 $gid = $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['GlyphID'][$l];
1933 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $rpl, $Lookup[$i]['MarkFilteringSet'])) {
1938 $gid = $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['LigGlyph'];
1943 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute, 'CompCount' => $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount']];
1947 elseif ($Lookup[$i]['Type'] == 5) {
1950 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1951 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
1953 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubRuleSetCount']; $s++) {
1954 $SubRuleSet = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s];
1955 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['FirstGlyph'] = $CoverageGlyphs[$s];
1956 for ($r = 0; $r < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount']; $r++) {
1957 $GlyphCount = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$r]['GlyphCount'];
1959 $glyphID = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$r]['Input'][$g];
1960 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$r]['InputGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
1966 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1967 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
1969 $InputClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['ClassDefOffset']);
1970 $Lookup[$i]['Subtable'][$c]['InputClasses'] = $InputClasses;
1971 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubClassSetCnt']; $s++) {
1972 if ($Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s] > 0) {
1973 $this->seek($Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s]);
1974 $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRuleCnt'] = $SubClassRuleCnt = $this->read_ushort();
1977 $SubClassRule[$b] = $Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s] + $this->read_ushort();
1978 $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRule'][$b] = $SubClassRule[$b];
1983 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubClassSetCnt']; $s++) {
1984 if ($Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s] > 0) {
1985 $SubClassRuleCnt = $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRuleCnt'];
1987 $this->seek($Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRule'][$b]);
1999 $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRule'][$b] = $Rule;
2005 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['InputGlyphCount']; $b++) {
2006 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageInput'][$b]);
2008 $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'][] = implode("|", $glyphs);
2010 throw new \Mpdf\Exception\FontException("Lookup Type 5, SubstFormat 3 not tested. Please report this with the name of font used - " . $this->fontkey);
2013 elseif ($Lookup[$i]['Type'] == 6) {
2016 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
2017 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
2019 $ChainSubRuleSetCnt = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount'];
2022 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubRuleSetOffset'][$s]);
2023 $ChainSubRuleCnt = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleCount'] = $this->read_ushort();
2025 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleOffset'][$r] = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetOffset'][$s] + $this->read_ushort();
2029 $ChainSubRuleCnt = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleCount'];
2032 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleOffset'][$r]);
2034 $BacktrackGlyphCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['BacktrackGlyphCount'] = $this->read_ushort();
2037 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['BacktrackGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
2040 $InputGlyphCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['InputGlyphCount'] = $this->read_ushort();
2043 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['InputGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
2046 $LookaheadGlyphCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['LookaheadGlyphCount'] = $this->read_ushort();
2049 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['LookaheadGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
2052 $SubstCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['SubstCount'] = $this->read_ushort();
2054 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['SequenceIndex'][$lu] = $this->read_ushort();
2055 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['LookupListIndex'][$lu] = $this->read_ushort();
2061 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
2062 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
2064 $BacktrackClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['BacktrackClassDefOffset']);
2065 $Lookup[$i]['Subtable'][$c]['BacktrackClasses'] = $BacktrackClasses;
2067 $InputClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['InputClassDefOffset']);
2068 $Lookup[$i]['Subtable'][$c]['InputClasses'] = $InputClasses;
2070 $LookaheadClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['LookaheadClassDefOffset']);
2071 $Lookup[$i]['Subtable'][$c]['LookaheadClasses'] = $LookaheadClasses;
2073 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt']; $s++) {
2074 if ($Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s] > 0) {
2075 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s]);
2076 $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRuleCnt'] = $ChainSubClassRuleCnt = $this->read_ushort();
2079 $ChainSubClassRule[$b] = $Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s] + $this->read_ushort();
2080 $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRule'][$b] = $ChainSubClassRule[$b];
2085 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt']; $s++) {
2086 if (isset($Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRuleCnt'])) {
2087 $ChainSubClassRuleCnt = $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRuleCnt'];
2092 if ($Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s] > 0) {
2093 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRule'][$b]);
2113 $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRule'][$b] = $Rule;
2119 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']; $b++) {
2120 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageBacktrack'][$b]);
2122 $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'][] = implode("|", $glyphs);
2124 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['InputGlyphCount']; $b++) {
2125 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageInput'][$b]);
2127 $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'][] = implode("|", $glyphs);
2130 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']; $b++) {
2131 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageLookahead'][$b]);
2133 $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'][] = implode("|", $glyphs);
2153 $volt = $this->_getGSUBarray($Lookup, $lul, $st);
2418 function _getGSUBarray(&$Lookup, &$lul, $scripttag)
2428 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
2429 $SubstFormat = $Lookup[$i]['Subtable'][$c]['Format'];
2432 if ($Lookup[$i]['Type'] == 1) {
2433 $subCount = count($Lookup[$i]['Subtable'][$c]['subs']);
2435 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2436 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][0];
2443 elseif ($Lookup[$i]['Type'] == 2) {
2444 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2445 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2446 $substitute = implode(" ", $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute']);
2453 elseif ($Lookup[$i]['Type'] == 3) {
2454 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2455 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2456 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][0];
2463 elseif ($Lookup[$i]['Type'] == 4) {
2464 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2465 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2466 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][0];
2468 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2471 $volt[] = ['match' => $repl, 'replace' => $subs, 'tag' => $tag, 'key' => $inputGlyphs[0], 'type' => 4, 'CompCount' => $Lookup[$i]['Subtable'][$c]['subs'][$s]['CompCount'], 'Lig' => $substitute];
2474 elseif ($Lookup[$i]['Type'] == 5) {
2477 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2478 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubRuleSetCount']; $s++) {
2481 foreach ($Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'] as $rule) {
2487 $inputGlyphs[0] = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['FirstGlyph'];
2498 // $Lookup[$lup] = secondary Lookup
2499 for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
2500 if (count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
2501 foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
2506 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2515 $subRule['rules'][] = ['type' => $Lookup[$lup]['Type'], 'match' => $lookupGlyphs, 'replace' => $luss['substitute'], 'seqIndex' => $seqIndex, 'key' => $lookupGlyphs[0],];
2529 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2530 foreach ($Lookup[$i]['Subtable'][$c]['SubClassSet'] as $inputClass => $cscs) {
2536 $inputGlyphs[0] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$inputClass];
2541 if (isset($Lookup[$i]['Subtable'][$c]['InputClasses'][$classindex])) {
2542 $inputGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$classindex];
2561 // $Lookup[$lup] = secondary Lookup
2562 for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
2563 if (isset($Lookup[$lup]['Subtable'][$lus]['subs']) && count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
2564 foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
2569 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2583 $subRule['rules'][] = ['type' => $Lookup[$lup]['Type'], 'match' => $lookupGlyphs, 'replace' => $luss['substitute'], 'seqIndex' => $seqIndex, 'key' => $lookupGlyphs[0],];
2598 // IgnoreMarks flag set on main Lookup table
2599 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2600 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'];
2602 $nInput = $Lookup[$i]['Subtable'][$c]['InputGlyphCount'];
2604 if ($Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']) {
2605 $backtrackGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'];
2613 if ($Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']) {
2614 $lookaheadGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'];
2627 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubstCount']; $b++) {
2628 $lup = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'];
2629 $seqIndex = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'];
2630 for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
2631 if (count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
2632 foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
2637 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2650 $subRule['rules'][] = ['type' => $Lookup[$lup]['Type'], 'match' => $lookupGlyphs, 'replace' => $luss['substitute'], 'seqIndex' => $seqIndex, 'key' => $lookupGlyphs[0],];
2662 elseif ($Lookup[$i]['Type'] == 6) {
2666 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2667 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount']; $s++) {
2671 $firstInputGlyph = $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'][$s]; // First input gyyph
2673 foreach ($Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'] as $rule) {
2708 // $Lookup[$lup] = secondary Lookup
2709 for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
2710 if (count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
2711 foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
2716 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2730 $subRule['rules'][] = ['type' => $Lookup[$lup]['Type'], 'match' => $lookupGlyphs, 'replace' => $luss['substitute'], 'seqIndex' => $seqIndex, 'key' => $lookupGlyphs[0],];
2745 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2746 foreach ($Lookup[$i]['Subtable'][$c]['ChainSubClassSet'] as $inputClass => $cscs) {
2751 // $Lookup[$i]['Subtable'][$c]['InputClasses'][(class)] e.g. 02E6|02E7|02E8
2752 // $Lookup[$i]['Subtable'][$c]['LookaheadClasses'][(class)]
2753 // $Lookup[$i]['Subtable'][$c]['BacktrackClasses'][(class)]
2759 if (isset($Lookup[$i]['Subtable'][$c]['InputClasses'][$inputClass])) {
2760 $inputGlyphs[0] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$inputClass];
2768 if (isset($Lookup[$i]['Subtable'][$c]['InputClasses'][$classindex])) {
2769 $inputGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$classindex];
2783 if (isset($Lookup[$i]['Subtable'][$c]['BacktrackClasses'][$classindex])) {
2784 $backtrackGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['BacktrackClasses'][$classindex];
2800 if (isset($Lookup[$i]['Subtable'][$c]['LookaheadClasses'][$classindex])) {
2801 $lookaheadGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['LookaheadClasses'][$classindex];
2824 // $Lookup[$lup] = secondary Lookup
2825 for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
2826 if (count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
2827 foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
2832 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2846 $subRule['rules'][] = ['type' => $Lookup[$lup]['Type'], 'match' => $lookupGlyphs, 'replace' => $luss['substitute'], 'seqIndex' => $seqIndex, 'key' => $lookupGlyphs[0],];
2860 // IgnoreMarks flag set on main Lookup table
2861 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
2862 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'];
2864 $nInput = $Lookup[$i]['Subtable'][$c]['InputGlyphCount'];
2866 if ($Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']) {
2867 $backtrackGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'];
2874 if ($Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']) {
2875 $lookaheadGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'];
2887 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubstCount']; $b++) {
2888 $lup = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'];
2889 $seqIndex = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'];
2890 for ($lus = 0; $lus < $Lookup[$lup]['SubtableCount']; $lus++) {
2891 if (count($Lookup[$lup]['Subtable'][$lus]['subs'])) {
2892 foreach ($Lookup[$lup]['Subtable'][$lus]['subs'] as $luss) {
2897 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2910 $subRule['rules'][] = ['type' => $Lookup[$lup]['Type'], 'match' => $lookupGlyphs, 'replace' => $luss['substitute'], 'seqIndex' => $seqIndex, 'key' => $lookupGlyphs[0],];
2960 // for Input - set on secondary Lookup table if in Context, and set Backtrack and Lookahead on Context Lookup
3003 // This originally returned e.g. ((?:(?:[IGNORE8]))*) when NOT specific to a Lookup e.g. rtlSub in
3008 // // If UseMarkFilteringSet (specific to the Lookup) return the string
3049 A====== SequenceIndex=1 ; Lookup match nGlyphs=1
3050 B=================== SequenceIndex=1 ; Lookup match nGlyphs=2
3051 C=============================== SequenceIndex=1 ; Lookup match nGlyphs=3
3052 D======================= SequenceIndex=2 ; Lookup match nGlyphs=2
3053 E===================================== SequenceIndex=2 ; Lookup match nGlyphs=3
3054 F====================== SequenceIndex=4 ; Lookup match nGlyphs=2
3070 // $lookupGlyphs = array of glyphs (single Glyphs) making up Lookup Input sequence
3071 $mLen = count($lookupGlyphs); // nGlyphs in the secondary Lookup match
3093 // $lookupGlyphs = array of glyphs making up Lookup Input sequence - if applicable
3142 // $mLen nGlyphs in the secondary Lookup match - if no secondary lookup, should=$nInput
3379 // list of Lookups in order they need to be run i.e. order listed in Lookup table
3391 // Get metadata and offsets for whole Lookup List table
3394 $Lookup = [];
3404 $Lookup[$i]['Type'] = $this->read_ushort();
3405 $Lookup[$i]['Flag'] = $flag = $this->read_ushort();
3406 $Lookup[$i]['SubtableCount'] = $SubtableCount[$i] = $this->read_ushort();
3408 $Lookup[$i]['Subtables'][$c] = $Offsets[$i] + $this->read_ushort();
3412 $Lookup[$i]['MarkFilteringSet'] = $this->read_ushort();
3414 $Lookup[$i]['MarkFilteringSet'] = '';
3417 // Lookup Type 9: Extension
3418 if ($Lookup[$i]['Type'] == 9) {
3421 $this->seek($Lookup[$i]['Subtables'][$c]);
3424 $Lookup[$i]['Subtables'][$c] = $Lookup[$i]['Subtables'][$c] + $this->read_ulong();
3426 $Lookup[$i]['Type'] = $type;
3430 // Process Whole LookupList - Get LuCoverage = Lookup coverage just for first glyph
3433 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
3434 $this->seek($Lookup[$i]['Subtables'][$c]);
3437 if ($Lookup[$i]['Type'] == 7 && $PosFormat == 3) {
3439 } elseif ($Lookup[$i]['Type'] == 8 && $PosFormat == 3) {
3445 $Coverage = $Lookup[$i]['Subtables'][$c] + $this->read_ushort();
3454 return [$GPOSScriptLang, $gpos, $Lookup];