Skip to content

#2509 - Consult cmap format 14 (UVS) in shaping and subsetting - #2510

Open
swmal wants to merge 1 commit into
develop9from
feature/cmap-format-14
Open

#2509 - Consult cmap format 14 (UVS) in shaping and subsetting#2510
swmal wants to merge 1 commit into
develop9from
feature/cmap-format-14

Conversation

@swmal

@swmal swmal commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

cmap format 14 (Unicode Variation Sequences) was parsed into CmapSubtable14 but never consulted during shaping, so a base character followed by a variation selector always rendered the default glyph instead of the registered variant (common in CJK).

Changes

  • CmapTable: new TryGetGlyphId(base, selector) lookup against format 14.
  • TextShaper.MapToGlyphs: lookahead that consumes a registered pair into one glyph.
  • CmapSubsetProcessor: preserves variation-sequence data used by subsetted text, so the embedded PDF font matches the full font.
  • CmapTable serialization: stopped dropping format 14 subtables; fixed a subtable-dedup bug this uncovered.
  • CmapTableLoader / CmapSubtable14Deserializer: wired in and fixed existing-but-unused format 14 parsing (position wasn't restored between selector records).

Testing
Unit tests for the lookup, shaping lookahead (BMP and surrogate-pair selectors), and a subsetting round-trip parity test. Full EPPlus.Fonts.OpenType suite (410 tests) green. Manually verified via PDF export (BIZ UDGothic, U+585A + VS01) - distinct glyph IDs, confirmed visually.

@swmal swmal added the enhancement New feature or request label Sep 9, 2026
@swmal swmal added this to the EPPlus 9.0 or later milestone Sep 9, 2026
@swmal swmal self-assigned this Sep 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant