Lines Matching refs:Lookup

1267 					// list of Lookups in order they need to be run i.e. order listed in Lookup table
1306 // Get metadata and offsets for whole Lookup List table
1328 // Lookup Type 7: Extension
1343 // Process Whole LookupList - Get LuCoverage = Lookup coverage just for first glyph
1389 // Get metadata and offsets for whole Lookup List table
1392 $Lookup = [];
1394 $Lookup[$i]['offset'] = $LookupList_offset + $this->read_ushort();
1397 $this->seek($Lookup[$i]['offset']);
1398 $Lookup[$i]['Type'] = $this->read_ushort();
1399 $Lookup[$i]['Flag'] = $flag = $this->read_ushort();
1400 $Lookup[$i]['SubtableCount'] = $this->read_ushort();
1401 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1402 $Lookup[$i]['Subtable'][$c]['Offset'] = $Lookup[$i]['offset'] + $this->read_ushort();
1406 $Lookup[$i]['MarkFilteringSet'] = $this->read_ushort();
1408 $Lookup[$i]['MarkFilteringSet'] = '';
1411 // Lookup Type 7: Extension
1412 if ($Lookup[$i]['Type'] == 7) {
1414 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1415 $this->seek($Lookup[$i]['Subtable'][$c]['Offset']);
1418 $Lookup[$i]['Subtable'][$c]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ulong();
1420 $Lookup[$i]['Type'] = $type;
1424 //print_r($Lookup); exit;
1428 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1429 $this->seek($Lookup[$i]['Subtable'][$c]['Offset']);
1431 $Lookup[$i]['Subtable'][$c]['Format'] = $SubstFormat;
1434 Lookup['Type'] Enumeration table for glyph substitution
1447 if ($Lookup[$i]['Type'] == 1) {
1448 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1450 $Lookup[$i]['Subtable'][$c]['DeltaGlyphID'] = $this->read_short();
1455 $Lookup[$i]['Subtable'][$c]['Glyphs'][] = $this->read_ushort();
1461 if ($Lookup[$i]['Type'] == 2) {
1462 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1463 $Lookup[$i]['Subtable'][$c]['SequenceCount'] = $SequenceCount = $this->read_short();
1465 $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1469 $this->seek($Lookup[$i]['Subtable'][$c]['Sequences'][$s]['Offset']);
1470 $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['GlyphCount'] = $this->read_short();
1471 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['GlyphCount']; $g++) {
1472 $Lookup[$i]['Subtable'][$c]['Sequences'][$s]['SubstituteGlyphID'][] = $this->read_ushort();
1477 if ($Lookup[$i]['Type'] == 3) {
1478 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1479 $Lookup[$i]['Subtable'][$c]['AlternateSetCount'] = $AlternateSetCount = $this->read_short();
1481 $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1486 $this->seek($Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['Offset']);
1487 $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['GlyphCount'] = $this->read_short();
1488 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['GlyphCount']; $g++) {
1489 $Lookup[$i]['Subtable'][$c]['AlternateSets'][$s]['SubstituteGlyphID'][] = $this->read_ushort();
1494 if ($Lookup[$i]['Type'] == 4) {
1495 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1496 $Lookup[$i]['Subtable'][$c]['LigSetCount'] = $LigSetCount = $this->read_short();
1498 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1502 $this->seek($Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Offset']);
1503 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount'] = $this->read_short();
1504 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount']; $g++) {
1505 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigatureOffset'][$g] = $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Offset'] + $this->read_ushort();
1509 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount']; $g++) {
1511 $this->seek($Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigatureOffset'][$g]);
1512 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['LigGlyph'] = $this->read_ushort();
1513 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount'] = $this->read_ushort();
1514 for ($l = 1; $l < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount']; $l++) {
1515 $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['GlyphID'][$l] = $this->read_ushort();
1521 if ($Lookup[$i]['Type'] == 5) {
1524 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1525 $Lookup[$i]['Subtable'][$c]['SubRuleSetCount'] = $SubRuleSetCount = $this->read_short();
1527 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['Offset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_short();
1531 $this->seek($Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['Offset']);
1532 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount'] = $this->read_short();
1533 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount']; $g++) {
1534 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleOffset'][$g] = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['Offset'] + $this->read_ushort();
1539 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount']; $g++) {
1541 $this->seek($Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleOffset'][$g]);
1543 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['GlyphCount'] = $this->read_ushort();
1544 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstCount'] = $this->read_ushort();
1546 for ($l = 1; $l < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['GlyphCount']; $l++) {
1547 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['Input'][$l] = $this->read_ushort();
1550 for ($l = 0; $l < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstCount']; $l++) {
1551 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstLookupRecord'][$l]['SequenceIndex'] = $this->read_ushort();
1552 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$g]['SubstLookupRecord'][$l]['LookupListIndex'] = $this->read_ushort();
1559 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1560 $Lookup[$i]['Subtable'][$c]['ClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1561 $Lookup[$i]['Subtable'][$c]['SubClassSetCnt'] = $this->read_ushort();
1562 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubClassSetCnt']; $b++) {
1565 $Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][] = 0;
1567 $Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $offset;
1571 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Lookup[$i]['Type'] . ", Format " . $SubstFormat . " not supported (ttfontsuni.php).");
1576 if ($Lookup[$i]['Type'] == 6) {
1579 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1580 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount'] = $this->read_ushort();
1581 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount']; $b++) {
1582 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetOffset'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1587 $Lookup[$i]['Subtable'][$c]['CoverageTableOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1588 $Lookup[$i]['Subtable'][$c]['BacktrackClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1589 $Lookup[$i]['Subtable'][$c]['InputClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1590 $Lookup[$i]['Subtable'][$c]['LookaheadClassDefOffset'] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1591 $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt'] = $this->read_ushort();
1592 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt']; $b++) {
1595 $Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][] = $offset;
1597 $Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $offset;
1603 $Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount'] = $this->read_ushort();
1604 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']; $b++) {
1605 $Lookup[$i]['Subtable'][$c]['CoverageBacktrack'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1607 $Lookup[$i]['Subtable'][$c]['InputGlyphCount'] = $this->read_ushort();
1608 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['InputGlyphCount']; $b++) {
1609 $Lookup[$i]['Subtable'][$c]['CoverageInput'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1611 $Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount'] = $this->read_ushort();
1612 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']; $b++) {
1613 $Lookup[$i]['Subtable'][$c]['CoverageLookahead'][] = $Lookup[$i]['Subtable'][$c]['Offset'] + $this->read_ushort();
1615 $Lookup[$i]['Subtable'][$c]['SubstCount'] = $this->read_ushort();
1616 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubstCount']; $b++) {
1617 $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'] = $this->read_ushort();
1618 $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'] = $this->read_ushort();
1620 Substitution Lookup Record
1621 All contextual substitution subtables specify the substitution data in a Substitution Lookup Record (SubstLookupRecord). Each record contains a SequenceIndex, which indicates the position where the substitution will occur in the glyph sequence. In addition, a LookupListIndex identifies the lookup to be applied at the glyph position specified by the SequenceIndex.
1628 throw new \Mpdf\Exception\FontException("Lookup Type " . $Lookup[$i]['Type'] . " not supported.");
1637 //print_r($Lookup); exit;
1642 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
1643 $SubstFormat = $Lookup[$i]['Subtable'][$c]['Format'];
1646 if ($Lookup[$i]['Type'] == 1) {
1647 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1654 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1657 if (isset($Lookup[$i]['Subtable'][$c]['DeltaGlyphID'])) { // Format 1
1658 $substitute[] = unicode_hex($this->glyphToChar[($glyphs[$g] + $Lookup[$i]['Subtable'][$c]['DeltaGlyphID'])][0]);
1660 $substitute[] = unicode_hex($this->glyphToChar[($Lookup[$i]['Subtable'][$c]['Glyphs'][$g])][0]);
1662 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute];
1666 if ($Lookup[$i]['Type'] == 2) {
1667 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1674 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1677 if (!isset($Lookup[$i]['Subtable'][$c]['Sequences'][$g]['SubstituteGlyphID']) || count($Lookup[$i]['Subtable'][$c]['Sequences'][$g]['SubstituteGlyphID']) == 0) {
1680 foreach ($Lookup[$i]['Subtable'][$c]['Sequences'][$g]['SubstituteGlyphID'] as $sub) {
1683 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute];
1687 if ($Lookup[$i]['Type'] == 3) {
1688 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1695 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1699 for ($gl = 0; $gl < $Lookup[$i]['Subtable'][$c]['AlternateSets'][$g]['GlyphCount']; $gl++) {
1700 $gid = $Lookup[$i]['Subtable'][$c]['AlternateSets'][$g]['SubstituteGlyphID'][$gl];
1704 //$gid = $Lookup[$i]['Subtable'][$c]['AlternateSets'][$g]['SubstituteGlyphID'][0];
1707 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute];
1710 print_r($Lookup[$i]['Subtable']);
1715 if ($Lookup[$i]['Type'] == 4) {
1716 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1718 $LigSetCount = $Lookup[$i]['Subtable'][$c]['LigSetCount'];
1720 for ($g = 0; $g < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['LigCount']; $g++) {
1725 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $replace[0], $Lookup[$i]['MarkFilteringSet'])) {
1728 for ($l = 1; $l < $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount']; $l++) {
1729 $gid = $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['GlyphID'][$l];
1732 if ($this->_checkGSUBignore($Lookup[$i]['Flag'], $rpl, $Lookup[$i]['MarkFilteringSet'])) {
1737 $gid = $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['LigGlyph'];
1739 $Lookup[$i]['Subtable'][$c]['subs'][] = ['Replace' => $replace, 'substitute' => $substitute, 'CompCount' => $Lookup[$i]['Subtable'][$c]['LigSet'][$s]['Ligature'][$g]['CompCount']];
1744 if ($Lookup[$i]['Type'] == 5) {
1747 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1748 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
1750 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubRuleSetCount']; $s++) {
1751 $SubRuleSet = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s];
1752 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['FirstGlyph'] = $CoverageGlyphs[$s];
1753 for ($r = 0; $r < $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRuleCount']; $r++) {
1754 $GlyphCount = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$r]['GlyphCount'];
1756 $glyphID = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$r]['Input'][$g];
1757 $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'][$r]['InputGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
1764 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1765 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
1767 $InputClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['ClassDefOffset']);
1768 $Lookup[$i]['Subtable'][$c]['InputClasses'] = $InputClasses;
1770 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubClassSetCnt']; $s++) {
1771 if ($Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s] > 0) {
1772 $this->seek($Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s]);
1773 $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRuleCnt'] = $SubClassRuleCnt = $this->read_ushort();
1776 $SubClassRule[$b] = $Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s] + $this->read_ushort();
1777 $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRule'][$b] = $SubClassRule[$b];
1782 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubClassSetCnt']; $s++) {
1783 $SubClassRuleCnt = $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRuleCnt'];
1785 if ($Lookup[$i]['Subtable'][$c]['SubClassSetOffset'][$s] > 0) {
1786 $this->seek($Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRule'][$b]);
1798 $Lookup[$i]['Subtable'][$c]['SubClassSet'][$s]['SubClassRule'][$b] = $Rule;
1805 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['InputGlyphCount']; $b++) {
1806 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageInput'][$b]);
1808 $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'][] = implode("|", $glyphs);
1810 throw new \Mpdf\Exception\FontException("Lookup Type 5, SubstFormat 3 not tested. Please report this with the name of font used - " . $this->fontkey);
1816 if ($Lookup[$i]['Type'] == 6) {
1819 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1820 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
1822 $ChainSubRuleSetCnt = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount'];
1825 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubRuleSetOffset'][$s]);
1826 $ChainSubRuleCnt = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleCount'] = $this->read_ushort();
1828 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleOffset'][$r] = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetOffset'][$s] + $this->read_ushort();
1832 $ChainSubRuleCnt = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleCount'];
1835 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRuleOffset'][$r]);
1837 $BacktrackGlyphCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['BacktrackGlyphCount'] = $this->read_ushort();
1840 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['BacktrackGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
1843 $InputGlyphCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['InputGlyphCount'] = $this->read_ushort();
1846 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['InputGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
1849 $LookaheadGlyphCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['LookaheadGlyphCount'] = $this->read_ushort();
1852 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['LookaheadGlyphs'][$g] = unicode_hex($this->glyphToChar[$glyphID][0]);
1855 $SubstCount = $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['SubstCount'] = $this->read_ushort();
1857 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['SequenceIndex'][$lu] = $this->read_ushort();
1858 $Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'][$r]['LookupListIndex'][$lu] = $this->read_ushort();
1865 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageTableOffset']);
1866 $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'] = $CoverageGlyphs = $this->_getCoverage();
1868 $BacktrackClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['BacktrackClassDefOffset']);
1869 $Lookup[$i]['Subtable'][$c]['BacktrackClasses'] = $BacktrackClasses;
1871 $InputClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['InputClassDefOffset']);
1872 $Lookup[$i]['Subtable'][$c]['InputClasses'] = $InputClasses;
1874 $LookaheadClasses = $this->_getClasses($Lookup[$i]['Subtable'][$c]['LookaheadClassDefOffset']);
1875 $Lookup[$i]['Subtable'][$c]['LookaheadClasses'] = $LookaheadClasses;
1877 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt']; $s++) {
1878 if ($Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s] > 0) {
1879 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s]);
1880 $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRuleCnt'] = $ChainSubClassRuleCnt = $this->read_ushort();
1883 $ChainSubClassRule[$b] = $Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s] + $this->read_ushort();
1884 $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRule'][$b] = $ChainSubClassRule[$b];
1889 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['ChainSubClassSetCnt']; $s++) {
1890 $ChainSubClassRuleCnt = $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRuleCnt'];
1892 if ($Lookup[$i]['Subtable'][$c]['ChainSubClassSetOffset'][$s] > 0) {
1893 $this->seek($Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRule'][$b]);
1913 $Lookup[$i]['Subtable'][$c]['ChainSubClassSet'][$s]['ChainSubClassRule'][$b] = $Rule;
1920 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']; $b++) {
1921 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageBacktrack'][$b]);
1923 $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'][] = implode("|", $glyphs);
1925 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['InputGlyphCount']; $b++) {
1926 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageInput'][$b]);
1928 $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'][] = implode("|", $glyphs);
1931 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']; $b++) {
1932 $this->seek($Lookup[$i]['Subtable'][$c]['CoverageLookahead'][$b]);
1934 $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'][] = implode("|", $glyphs);
1964 $this->_getGSUBarray($Lookup, $lul, $st);
1968 //print_r($Lookup); exit;
1975 function _getGSUBarray(&$Lookup, &$lul, $scripttag, $level = 1, $coverage = '', $exB = '', $exL = '')
1989 $html .= 'Lookup #' . $i . ' [tag: <span style="color:#000066;">' . $tag . '</span>]</h5>';
1990 $ignore = $this->_getGSUBignoreString($Lookup[$i]['Flag'], $Lookup[$i]['MarkFilteringSet']);
1995 $Type = $Lookup[$i]['Type'];
1996 $Flag = $Lookup[$i]['Flag'];
2003 for ($c = 0; $c < $Lookup[$i]['SubtableCount']; $c++) {
2010 $SubstFormat = $Lookup[$i]['Subtable'][$c]['Format'];
2013 if ($Lookup[$i]['Type'] == 1) {
2015 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2016 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2017 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][0];
2043 if ($Lookup[$i]['Type'] == 2) {
2045 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2046 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2047 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'];
2073 if ($Lookup[$i]['Type'] == 3) {
2075 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2076 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2077 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][0];
2099 if (count($Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute']) > 1) {
2100 for ($alt = 1; $alt < count($Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute']); $alt++) {
2101 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][$alt];
2111 if ($Lookup[$i]['Type'] == 4) {
2113 for ($s = 0; $s < count($Lookup[$i]['Subtable'][$c]['subs']); $s++) {
2114 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['subs'][$s]['Replace'];
2115 $substitute = $Lookup[$i]['Subtable'][$c]['subs'][$s]['substitute'][0];
2141 if ($Lookup[$i]['Type'] == 5) {
2146 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['SubRuleSetCount']; $s++) {
2150 foreach ($Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['SubRule'] as $rctr => $rule) {
2157 $inputGlyphs[0] = $Lookup[$i]['Subtable'][$c]['SubRuleSet'][$s]['FirstGlyph'];
2195 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2198 $html .= $this->_getGSUBarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
2210 foreach ($Lookup[$i]['Subtable'][$c]['SubClassSet'] as $inputClass => $cscs) {
2218 $inputGlyphs[0] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$inputClass];
2224 $inputGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$classindex];
2229 $class0excl = implode('|', $Lookup[$i]['Subtable'][$c]['InputClasses']);
2281 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2284 $html .= $this->_getGSUBarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
2295 // IgnoreMarks flag set on main Lookup table
2296 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'];
2298 $nInput = $Lookup[$i]['Subtable'][$c]['InputGlyphCount'];
2308 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubstCount']; $b++) {
2309 $lup = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'];
2310 $seqIndex = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'];
2335 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2338 $html .= $this->_getGSUBarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
2347 //print_r($Lookup[$i]);
2351 if ($Lookup[$i]['Type'] == 6) {
2356 for ($s = 0; $s < $Lookup[$i]['Subtable'][$c]['ChainSubRuleSetCount']; $s++) {
2360 $firstInputGlyph = $Lookup[$i]['Subtable'][$c]['CoverageGlyphs'][$s]; // First input gyyph
2361 foreach ($Lookup[$i]['Subtable'][$c]['ChainSubRuleSet'][$s]['ChainSubRule'] as $rctr => $rule) {
2438 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2441 $html .= $this->_getGSUBarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
2453 foreach ($Lookup[$i]['Subtable'][$c]['ChainSubClassSet'] as $inputClass => $cscs) {
2460 // $Lookup[$i]['Subtable'][$c]['InputClasses'][(class)] e.g. 02E6|02E7|02E8
2461 // $Lookup[$i]['Subtable'][$c]['LookaheadClasses'][(class)]
2462 // $Lookup[$i]['Subtable'][$c]['BacktrackClasses'][(class)]
2468 $inputGlyphs[0] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$inputClass];
2473 $inputGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['InputClasses'][$classindex];
2477 $class0excl = implode('|', $Lookup[$i]['Subtable'][$c]['InputClasses']);
2484 $backtrackGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['BacktrackClasses'][$classindex];
2493 $lookaheadGlyphs[$gcl] = $Lookup[$i]['Subtable'][$c]['LookaheadClasses'][$classindex];
2576 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2579 $html .= $this->_getGSUBarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
2584 //print_r($Lookup[$i]['Subtable'][$c]); exit;
2589 // IgnoreMarks flag set on main Lookup table
2590 $inputGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageInputGlyphs'];
2592 $nInput = $Lookup[$i]['Subtable'][$c]['InputGlyphCount'];
2594 if ($Lookup[$i]['Subtable'][$c]['BacktrackGlyphCount']) {
2595 $backtrackGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'];
2600 if ($Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']) {
2601 $lookaheadGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'];
2624 for ($b = 0; $b < $Lookup[$i]['Subtable'][$c]['SubstCount']; $b++) {
2625 $lup = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['LookupListIndex'];
2626 $seqIndex = $Lookup[$i]['Subtable'][$c]['SubstLookupRecord'][$b]['SequenceIndex'];
2660 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
2663 $html .= $this->_getGSUBarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
2682 //print_r($Lookup); exit;
2717 // for Input - set on secondary Lookup table if in Context, and set Backtrack and Lookahead on Context Lookup
2796 A====== SequenceIndex=1 ; Lookup match nGlyphs=1
2797 B=================== SequenceIndex=1 ; Lookup match nGlyphs=2
2798 C=============================== SequenceIndex=1 ; Lookup match nGlyphs=3
2799 D======================= SequenceIndex=2 ; Lookup match nGlyphs=2
2800 E===================================== SequenceIndex=2 ; Lookup match nGlyphs=3
2801 F====================== SequenceIndex=4 ; Lookup match nGlyphs=2
2817 // $lookupGlyphs = array of glyphs (single Glyphs) making up Lookup Input sequence
2818 $mLen = count($lookupGlyphs); // nGlyphs in the secondary Lookup match
2840 // $lookupGlyphs = array of glyphs making up Lookup Input sequence - if applicable
2889 // $mLen nGlyphs in the secondary Lookup match - if no secondary lookup, should=$nInput
3121 // list of Lookups in order they need to be run i.e. order listed in Lookup table
3156 // Get metadata and offsets for whole Lookup List table
3159 $Lookup = [];
3167 $Lookup[$i]['Type'] = $this->read_ushort();
3168 $Lookup[$i]['Flag'] = $flag = $this->read_ushort();
3169 $Lookup[$i]['SubtableCount'] = $SubtableCount[$i] = $this->read_ushort();
3171 $Lookup[$i]['Subtables'][$c] = $Offsets[$i] + $this->read_ushort();
3175 $Lookup[$i]['MarkFilteringSet'] = $this->read_ushort();
3177 // else { $Lookup[$i]['MarkFilteringSet'] = ''; }
3178 // Lookup Type 9: Extension
3179 if ($Lookup[$i]['Type'] == 9) {
3182 $this->seek($Lookup[$i]['Subtables'][$c]);
3185 $Lookup[$i]['Subtables'][$c] = $Lookup[$i]['Subtables'][$c] + $this->read_ulong();
3187 $Lookup[$i]['Type'] = $type;
3207 $this->_getGPOSarray($Lookup, $lul, $st);
3211 return [$GPOSScriptLang, $gpos, $Lookup];
3221 function _getGPOSarray(&$Lookup, $lul, $scripttag, $level = 1, $lcoverage = '', $exB = '', $exL = '')
3234 $html .= 'Lookup #' . $luli . ' [tag: <span style="color:#000066;">' . $tag . '</span>]</h5>';
3235 $ignore = $this->_getGSUBignoreString($Lookup[$luli]['Flag'], $Lookup[$luli]['MarkFilteringSet']);
3240 $Type = $Lookup[$luli]['Type'];
3241 $Flag = $Lookup[$luli]['Flag'];
3248 for ($c = 0; $c < $Lookup[$luli]['SubtableCount']; $c++) {
3256 $subtable_offset = $Lookup[$luli]['Subtables'][$c];
3263 if ($Lookup[$luli]['Type'] == 1) {
3368 if ($Lookup[$luli]['Type'] == 2) {
3539 if ($Lookup[$luli]['Type'] == 3) {
3592 if ($Lookup[$luli]['Type'] == 4) {
3636 if ($Lookup[$luli]['Type'] == 5) {
3711 if ($Lookup[$luli]['Type'] == 6) {
3754 if ($Lookup[$luli]['Type'] == 7) {
3760 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Type . " Format " . $PosFormat . " not YET TESTED.");
3766 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Type . " Format " . $PosFormat . " not YET TESTED.");
3772 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Type . " Format " . $PosFormat . " not YET TESTED.");
3774 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Type . ", Format " . $PosFormat . " not supported.");
3782 if ($Lookup[$luli]['Type'] == 8) {
3788 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Type . " Format " . $PosFormat . " not TESTED YET.");
3794 $html .= '<div>GPOS Lookup Type 8: Format 2 not yet supported in OTL dump</div>';
3797 throw new \Mpdf\Exception\FontException("GPOS Lookup Type " . $Type . " Format " . $PosFormat . " not TESTED YET.");
3897 // Lookup list is in the [inputGlyphs] at ['SequenceIndex']
3900 $html .= $this->_getGPOSarray($Lookup, $lul2, $scripttag, 2, $inputGlyphs[$seqIndex], $exB, $exL);
3921 //print_r($Lookup); exit;