Skip to content

FOP-3342: A script's default language system shared with a named one is kept under dflt - #111

Open
plutext wants to merge 1 commit into
apache:mainfrom
plutext:FOP-3342
Open

plutext wants to merge 1 commit into
apache:mainfrom
plutext:FOP-3342

Conversation

@plutext

@plutext plutext commented Oct 2, 2026

Copy link
Copy Markdown

Fixes FOP-3342.

OTFAdvancedTypographicTableReader.readScriptTable compared each LangSys record's offset
with the default LangSys offset and, when they were equal, dropped the default and made
that language the script's default tag:

    if (dl == lo) { dl = 0; dt = lt; }

constructLookups then registered the features under (script, that language) only and
nothing under (script, "dflt"). Font builders share the table on purpose: FontForge writes
one LangSys table for the default and for every language whose feature list equals it. So
a request for the script's default language system found nothing and fell back to the DFLT
script, which lists whatever the font's author put there.

DejaVu Sans is the visible case. Its GPOS latn default is the table latn/ROM and the Sami
systems point at, listing kern lookups 14 and 15; DFLT/dflt lists lookup 15 alone, a
20-glyph subtable with no Latin letter. Measured on this branch, 14pt "AVATAR To Ye",
kerning on, line width from mutool draw -F stext:

                      no language   language="ROM"   language="en"
  before              99.68 pt      91.55 pt         99.68 pt
  after               91.55 pt      91.55 pt         99.68 pt

Before, the font kerned only when the language named the record that shares the table.
(language="en" is the separate FOP-3341: the FO language code is never translated to the
font's tag and the fallback skips the script's default.)

Its arab default is shared with KUR in GSUB and GPOS both, and DFLT lists no contextual
form and no mark lookup, so Arabic set in DejaVu Sans under a default language was drawn
as isolated letters. Of 1356 OpenType fonts installed on one
Linux machine, 252 share a default this way.

The default LangSys table is now read and registered under "dflt" whether or not a named
record points at the same table; a named language sharing it is still read under its own
tag. SharedDefaultLanguageSystemTestCase uses the DejaVuLGCSerif already in the test tree,
whose GPOS latn default is shared with AZE and whose GPOS has no DFLT script:
(latn, dflt, kern) must match and "AV" must kern. Its first case fails without the change.

🤖 Generated with Claude Code

…is kept under dflt

OTFAdvancedTypographicTableReader.readScriptTable compared each LangSys record's offset
with the default LangSys offset and, when they were equal, dropped the default and made
that language the script's default tag:

    if (dl == lo) { dl = 0; dt = lt; }

constructLookups then registered the features under (script, that language) only and
nothing under (script, "dflt"). Font builders share the table on purpose: FontForge writes
one LangSys table for the default and for every language whose feature list equals it. So
a request for the script's default language system found nothing and fell back to the DFLT
script, which lists whatever the font's author put there.

DejaVu Sans is the visible case. Its GPOS latn default is the table latn/ROM and the Sami
systems point at, listing kern lookups 14 and 15; DFLT/dflt lists lookup 15 alone, a
20-glyph subtable with no Latin letter. Measured on this branch, 14pt "AVATAR To Ye",
kerning on, line width from mutool draw -F stext:

                      no language   language="ROM"   language="en"
  before              99.68 pt      91.55 pt         99.68 pt
  after               91.55 pt      91.55 pt         99.68 pt

Before, the font kerned only when the language named the record that shares the table.
(language="en" is the separate FOP-3341: the FO language code is never translated to the
font's tag and the fallback skips the script's default.)

Its arab default is shared with KUR in GSUB and GPOS both, and DFLT lists no contextual
form and no mark lookup, so Arabic set in DejaVu Sans under a default language was drawn
as isolated letters. Of 1356 OpenType fonts installed on one
Linux machine, 252 share a default this way.

The default LangSys table is now read and registered under "dflt" whether or not a named
record points at the same table; a named language sharing it is still read under its own
tag. SharedDefaultLanguageSystemTestCase uses the DejaVuLGCSerif already in the test tree,
whose GPOS latn default is shared with AZE and whose GPOS has no DFLT script:
(latn, dflt, kern) must match and "AV" must kern. Its first case fails without the change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant