Skip to content

Mark positioning, script-aware GPOS/GSUB feature lookup, and ligature feature-tag support (#2503) - #2507

Merged
AdrianEPPlus merged 4 commits into
develop9from
fix/i2503
Sep 9, 2026
Merged

Mark positioning, script-aware GPOS/GSUB feature lookup, and ligature feature-tag support (#2503)#2507
AdrianEPPlus merged 4 commits into
develop9from
fix/i2503

Conversation

@swmal

@swmal swmal commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Renders mark-to-base positioning, makes GPOS/GSUB feature lookup
script-aware, and exposes ligature feature selection through
PdfPageSettings. Closes #2503.

Changes

  • Mark positioning: MarkToBaseProvider now computes pen-relative,
    additive offsets (HarfBuzz convention); PdfContentStream reads
    XOffset/YOffset via Ts and paired TJ adjustments.
  • Script-aware feature lookup: new ScriptFeatureResolver filters
    FeatureList entries by ScriptList/LangSys instead of tag alone.
    Fixes a real defect where an arab-only kern record leaked into
    Latin text. Applied across all six GPOS/GSUB processors (kerning,
    single adjustment, mark-to-base, ligatures, chaining contextual,
    single substitution).
  • Ligature feature tags: LigatureProcessor now reads tags from
    GsubFeatures instead of a hardcoded "liga", and unwraps
    extension-wrapped (Type 7) ligature lookups, which GSUB does not
    flatten the way GPOS does.
  • Public API: GsubFeature/GposFeature flag enums and
    PdfPageSettings.GsubFeatures/GposFeatures, wired through
    PdfTextShaper.

Verification

Confirmed in exported PDFs: Á now aligns with its precomposed
control glyph, a previously leaking period no longer receives a
Ts offset, and EBGaramond's dlig merges "Th" into a single,
measurably narrower ligature glyph when requested. Extensive unit
test coverage, including synthetic-table regression tests for the
script-leak defect.

Known gaps

  • Measurement-path/render-path width parity is still unverified.
  • No dedicated script-leak test for three of six GPOS/GSUB processors
    (same fix, same pattern as the tested ones).

@swmal swmal changed the title Fix/i2503 Mark positioning, script-aware GPOS/GSUB feature lookup, and ligature feature-tag support (#2503) Sep 9, 2026
@AdrianEPPlus
AdrianEPPlus merged commit e8450a6 into develop9 Sep 9, 2026
2 checks passed
@AdrianEPPlus
AdrianEPPlus deleted the fix/i2503 branch September 9, 2026 08:38
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.

2 participants