Lines Matching refs:i

285 			for ($i = 1; $i <= $this->numTTCFonts; $i++) {
286 $this->TTCFonts[$i]['offset'] = $this->read_ulong();
306 for ($i = 0; $i < $this->numTables; $i++) {
372 for ($i = 0; $i < $len; $i += 4) {
373 $hi += (ord($data[$i]) << 8) + ord($data[$i + 1]);
374 $lo += (ord($data[$i + 2]) << 8) + ord($data[$i + 3]);
557 // Only called if font is not to be used as embedded subset i.e. NOT called for SIP/SMP fonts
581 for ($i = 1; $i <= $this->numTTCFonts; $i++) {
582 $this->TTCFonts[$i]['offset'] = $this->read_ulong();
594 for ($i = 0; $i < $cmapTableCount; $i++) {
667 for ($i = 1; $i <= $this->numTTCFonts; $i++) {
668 $this->TTCFonts[$i]['offset'] = $this->read_ulong();
688 for ($i = 0; $i < $numRecords; $i++) {
746 // CHECK IF psName valid (PadaukBook contains illegal characters in Name ID 6 i.e. Postscript Name)
749 for ($i = 0; $i < $nameLength; $i++) {
750 $c = $psName[$i];
1017 for ($i = 0; $i < $cmapTableCount; $i++) {
1058 // Format 12 CMAP does characters above Unicode BMP i.e. some HKCS characters U+20000 and above
1070 for ($i = 0; $i < $nGroups; $i++) {
1100 // Map Unmapped glyphs (or glyphs mapped to upper PUA U+F00000 onwards i.e. > U+2FFFF) - from $numGlyphs
1218 for ($i = 0; $i < $nPairs; $i++) {
1343 for ($i = 0; $i < $MarkSetCount; $i++) {
1346 for ($i = 0; $i < $MarkSetCount; $i++) {
1347 $this->seek($MarkSetOffset[$i]);
1349 $this->MarkGlyphSets[$i] = ' ' . implode('| ', $glyphs);
1403 for ($i = 0; $i < $GlyphCount; $i++) {
1404 $gid = $StartGlyph + $i;
1415 for ($i = 0; $i < $tableCount; $i++) {
1453 for ($i = 0; $i < $ScriptCount; $i++) {
1468 for ($i = 0; $i < $LangSysCount; $i++) {
1489 for ($i = 0; $i < $FeatureCount; $i++) {
1501 for ($i = 0; $i < $FeatureCount; $i++) {
1506 $Feature[$i] = ['tag' => $tag];
1507 $Feature[$i]['offset'] = $FeatureList_offset + $this->read_ushort();
1510 for ($i = 0; $i < $FeatureCount; $i++) {
1511 $this->seek($Feature[$i]['offset']);
1513 $Feature[$i]['LookupCount'] = $Lookupcount = $this->read_ushort();
1514 $Feature[$i]['LookupListIndex'] = [];
1516 $Feature[$i]['LookupListIndex'][] = $this->read_ushort();
1537 // list of Lookups in order they need to be run i.e. order listed in Lookup table
1556 for ($i = 0; $i < $LookupCount; $i++) {
1557 $Offsets[$i] = $LookupList_offset + $this->read_ushort();
1560 for ($i = 0; $i < $LookupCount; $i++) {
1562 $this->seek($Offsets[$i]);
1564 $GSLookup[$i]['Type'] = $this->read_ushort();
1565 $GSLookup[$i]['Flag'] = $flag = $this->read_ushort();
1566 $GSLookup[$i]['SubtableCount'] = $SubtableCount[$i] = $this->read_ushort();
1568 for ($c = 0; $c < $SubtableCount[$i]; $c++) {
1569 $GSLookup[$i]['Subtables'][$c] = $Offsets[$i] + $this->read_ushort();
1574 $GSLookup[$i]['MarkFilteringSet'] = $this->read_ushort();
1576 $GSLookup[$i]['MarkFilteringSet'] = '';
1580 if ($GSLookup[$i]['Type'] == 7) {
1582 for ($c = 0; $c < $SubtableCount[$i]; $c++) {
1583 $this->seek($GSLookup[$i]['Subtables'][$c]);
1587 $GSLookup[$i]['Subtables'][$c] = $GSLookup[$i]['Subtables'][$c] + $ext_offset;
1589 $GSLookup[$i]['Type'] = $type;
1595 for ($i = 0; $i < $LookupCount; $i++) {
1596 for ($c = 0; $c < $GSLookup[$i]['SubtableCount']; $c++) {
1597 $this->seek($GSLookup[$i]['Subtables'][$c]);
1600 if ($GSLookup[$i]['Type'] == 5 && $PosFormat == 3) {
1602 } elseif ($GSLookup[$i]['Type'] == 6 && $PosFormat == 3) {
1607 // NB Coverage only looks at glyphs for position 1 (i.e. 5.3 and 6.3) // NEEDS TO READ ALL ********************
1608 $Coverage = $GSLookup[$i]['Subtables'][$c] + $this->read_ushort();
1611 $this->GSLuCoverage[$i][$c] = $glyphs;
1624 for ($i = 0; $i < $LookupCount; $i++) {
1625 $Lookup[$i]['offset'] = $LookupList_offset + $this->read_ushort();
1628 for ($i = 0; $i < $LookupCount; $i++) {
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'] = '';
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;
1657 for ($i = 0; $i < $LookupCount; $i++) {
1658 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1659 $this->seek($Lookup[$i]['Subtable'][$c]['Offset']);
1661 $Lookup[$i]['Subtable'][$c]['Format'] = $SubstFormat;
1672 7 Extension Substitution Extension mechanism for other substitutions (i.e. this excludes the Extension type substitution itself)
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();
1846 throw new \Mpdf\Exception\FontException(sprintf('Lookup Type "%s" not supported.', $Lookup[$i]['Type']));
1853 for ($i = 0; $i < $LookupCount; $i++) {
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);
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);
2205 for ($i = 0; $i < $matchCount; $i++) {
2206 if (isset($vs['replace'][$i]) && preg_match('/^0[A-F0-9]{4}$/', $vs['match'][$i])) {
2207 if (preg_match('/^0[EF][A-F0-9]{3}$/', $vs['replace'][$i])) {
2208 $rtlpua[] = $vs['replace'][$i];
2216 for ($i = 0; $i < $matchCount; $i++) {
2230 if (isset($variants[1])) { // i.e. final form
2375 for ($i = 0; $i < $n; $i++) {
2376 if (hexdec($rtlpua[$i]) < hexdec('E000') || hexdec($rtlpua[$i]) > hexdec('F8FF')) {
2377 unset($rtlpua[$i]);
2427 foreach ($lul as $i => $tag) {
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'];
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];
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'];
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) {
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];
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'];
2943 // $this->MarkAttachmentType is already adjusted for this i.e. contains all Marks except those in the MarkAttachmentClassDef table
2967 // $this->MarkAttachmentType is already adjusted for this i.e. contains all Marks except those in the MarkAttachmentClassDef table
3074 for ($i = 0; $i < $nInput; $i++) {
3075 if ($i > 0) {
3078 if ($i >= $seqIndex && $i < ($seqIndex + $mLen)) {
3079 $str .= "(" . $lookupGlyphs[($i - $seqIndex)] . ")";
3081 $str .= "(" . $inputGlyphs[($i)] . ")";
3095 for ($i = 1; $i <= count($inputGlyphs); $i++) {
3096 if ($i > 1) {
3099 $str .= "(" . $inputGlyphs[($i - 1)] . ")";
3113 for ($i = (count($backtrackGlyphs) - 1); $i >= 0; $i--) {
3114 $str .= "(" . $backtrackGlyphs[$i] . ")" . $ignore . " ";
3128 for ($i = 0; $i < count($lookaheadGlyphs); $i++) {
3129 $str .= $ignore . " (" . $lookaheadGlyphs[$i] . ")";
3244 for ($i = 0; $i < $GlyphCount; $i++) {
3245 $startGlyphID = $StartGlyph + $i;
3246 $endGlyphID = $StartGlyph + $i;
3256 for ($i = 0; $i < $tableCount; $i++) {
3294 for ($i = 0; $i < $ScriptCount; $i++) {
3309 for ($i = 0; $i < $LangSysCount; $i++) {
3330 for ($i = 0; $i < $FeatureCount; $i++) {
3340 for ($i = 0; $i < $FeatureCount; $i++) {
3345 $Feature[$i] = ['tag' => $tag];
3346 $Feature[$i]['offset'] = $FeatureList_offset + $this->read_ushort();
3349 for ($i = 0; $i < $FeatureCount; $i++) {
3350 $this->seek($Feature[$i]['offset']);
3352 $Feature[$i]['LookupCount'] = $Lookupcount = $this->read_ushort();
3353 $Feature[$i]['LookupListIndex'] = [];
3355 $Feature[$i]['LookupListIndex'][] = $this->read_ushort();
3379 // list of Lookups in order they need to be run i.e. order listed in Lookup table
3398 for ($i = 0; $i < $LookupCount; $i++) {
3399 $Offsets[$i] = $LookupList_offset + $this->read_ushort();
3402 for ($i = 0; $i < $LookupCount; $i++) {
3403 $this->seek($Offsets[$i]);
3404 $Lookup[$i]['Type'] = $this->read_ushort();
3405 $Lookup[$i]['Flag'] = $flag = $this->read_ushort();
3406 $Lookup[$i]['SubtableCount'] = $SubtableCount[$i] = $this->read_ushort();
3407 for ($c = 0; $c < $SubtableCount[$i]; $c++) {
3408 $Lookup[$i]['Subtables'][$c] = $Offsets[$i] + $this->read_ushort();
3412 $Lookup[$i]['MarkFilteringSet'] = $this->read_ushort();
3414 $Lookup[$i]['MarkFilteringSet'] = '';
3418 if ($Lookup[$i]['Type'] == 9) {
3420 for ($c = 0; $c < $SubtableCount[$i]; $c++) {
3421 $this->seek($Lookup[$i]['Subtables'][$c]);
3424 $Lookup[$i]['Subtables'][$c] = $Lookup[$i]['Subtables'][$c] + $this->read_ulong();
3426 $Lookup[$i]['Type'] = $type;
3432 for ($i = 0; $i < $LookupCount; $i++) {
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) {
3443 // NB Coverage only looks at glyphs for position 1 (i.e. 7.3 and 8.3) // NEEDS TO READ ALL ********************
3445 $Coverage = $Lookup[$i]['Subtables'][$c] + $this->read_ushort();
3448 $this->LuCoverage[$i][$c] = $glyphs;
3488 for ($i = 1; $i <= $this->numTTCFonts; $i++) {
3489 $this->TTCFonts[$i]['offset'] = $this->read_ulong();
3518 for ($i = 0; $i < $cmapTableCount; $i++) {
3785 if ($glyphLen > 2 && ($up[1] & (1 << 15))) { // If number of contours <= -1 i.e. composiste glyph
3980 for ($i = 1; $i <= $this->numTTCFonts; $i++) {
3981 $this->TTCFonts[$i]['offset'] = $this->read_ulong();
4010 for ($i = 0; $i < $cmapTableCount; $i++) {
4039 // Format 12 CMAP does characters above Unicode BMP i.e. some HKCS characters U+20000 and above
4051 for ($i = 0; $i < $nGroups; $i++) {
4174 // Needs to have a name entry in 3,0 (e.g. symbol) - original font will be 3,1 (i.e. Unicode)
4180 for ($i = 0; $i < $numRecords; $i++) {
4184 $pos = 6 + ($i * 12) + 2;
4661 for ($i = 0; $i < $segCount; $i++) {
4668 for ($i = 0; $i < $segCount; $i++) {
4674 for ($i = 0; $i < $segCount; $i++) {
4681 for ($i = 0; $i < $segCount; $i++) {
4792 for ($i = 1; $i <= $this->numTTCFonts; $i++) {
4793 $this->TTCFonts[$i]['offset'] = $this->read_ulong();
4820 for ($i = 0; $i < $cmapTableCount; $i++) {