Follow-up to #117, which added the seventh copy.
OtlDump renders the same block of HTML in seven places: the backtrack, input and lookahead
sequences a context rule matches, and the example fragments each contributes.
$html .= '<div class="context">CONTEXT: ';
for ($ff = count($backtrackGlyphs) - 1; $ff >= 0; $ff--) {
$html .= '<div>Backtrack #' . $ff . ': <span class="unicode">' . $this->formatUniStr($backtrackGlyphs[$ff]) . '</span></div>';
$exampleB[] = $this->formatEntityFirst($backtrackGlyphs[$ff]);
}
...
| where |
lookup |
OtlDump.php:1140 |
GSUB 5/1 |
OtlDump.php:1206 |
GSUB 5/2 |
OtlDump.php:1272 |
GSUB 5/3 |
OtlDump.php:1351 |
GSUB 6/1 |
OtlDump.php:1465 |
GSUB 6/2 |
OtlDump.php:1571 |
GSUB 6/3 |
OtlDump.php:2857 |
all six GPOS 7 and 8 formats, in reportGPOSrule() |
Six of those are older than #117; the seventh arrived with it, because the GPOS reporters
were written to the shape the GSUB ones already had. reportGPOSrule() is the
generalisation the other six want: it is 1351 line for line, and the class-aware superset
of 1465, which reports class 0 as what it excludes rather than as a list.
What a fix looks like
Lift reportGPOSrule()'s CONTEXT half into a method the seven share. Everything above the
for that walks the lookup records is common; the $class0excl parameter already covers
the one variation, and passing it empty gives the glyph-list form.
What does not share cleanly
The half below it - the $exB/$exL example fragments handed to the nested lookup at
level 2 - is not a drop-in, and the differences are in the output rather than the code:
- GPOS prepends
‍ to each lookahead entry (OtlDump.php:2897) where GSUB appends
it (OtlDump.php:1399).
- GSUB calls
formatEntity() on each input glyph where GPOS reuses the precomputed
$exampleI, which is formatEntityFirst().
Whether those are two deliberate renderings or one of them is a bug is worth settling
first, because the tests/data/otldump/*.txt fixtures pin both and a shared version has to
pick one.
Safety
tests/data/otldump/*.txt covers every font in tests/data/ttf and pins this markup
exactly, so a share that leaves all 23 byte-identical has not changed the report.
Follow-up to #117, which added the seventh copy.
OtlDumprenders the same block of HTML in seven places: the backtrack, input and lookaheadsequences a context rule matches, and the example fragments each contributes.
OtlDump.php:1140OtlDump.php:1206OtlDump.php:1272OtlDump.php:1351OtlDump.php:1465OtlDump.php:1571OtlDump.php:2857reportGPOSrule()Six of those are older than #117; the seventh arrived with it, because the GPOS reporters
were written to the shape the GSUB ones already had.
reportGPOSrule()is thegeneralisation the other six want: it is
1351line for line, and the class-aware supersetof
1465, which reports class 0 as what it excludes rather than as a list.What a fix looks like
Lift
reportGPOSrule()'s CONTEXT half into a method the seven share. Everything above theforthat walks the lookup records is common; the$class0exclparameter already coversthe one variation, and passing it empty gives the glyph-list form.
What does not share cleanly
The half below it - the
$exB/$exLexample fragments handed to the nested lookup atlevel 2 - is not a drop-in, and the differences are in the output rather than the code:
‍to each lookahead entry (OtlDump.php:2897) where GSUB appendsit (
OtlDump.php:1399).formatEntity()on each input glyph where GPOS reuses the precomputed$exampleI, which isformatEntityFirst().Whether those are two deliberate renderings or one of them is a bug is worth settling
first, because the
tests/data/otldump/*.txtfixtures pin both and a shared version has topick one.
Safety
tests/data/otldump/*.txtcovers every font intests/data/ttfand pins this markupexactly, so a share that leaves all 23 byte-identical has not changed the report.