Skip to content

Glyph-level fallback by Unicode script#2355

Merged
swmal merged 1 commit into
develop9from
feature/fallbackfonts-v4
May 21, 2026
Merged

Glyph-level fallback by Unicode script#2355
swmal merged 1 commit into
develop9from
feature/fallbackfonts-v4

Conversation

@swmal
Copy link
Copy Markdown
Contributor

@swmal swmal commented May 21, 2026

Glyph-level fallback by Unicode script

When a primary font lacks a glyph, EPPlus now routes the lookup based on the code point's Unicode script rather than scanning a fixed fallback list.

Changes

  • New UnicodeScript enum and UnicodeScriptClassifier (binary search over a sorted range table, O(log n) per code point).
  • DefaultFontProvider rewritten to dispatch by script: Emoji and Math go to the bundled Noto fonts; other scripts (Han, Hiragana, Katakana, Hangul, Arabic, Hebrew, Thai, Devanagari) walk a named fallback chain resolved lazily through the engine.
  • IEpplusFontConfiguration.SetScriptFallback(script, params names) lets users replace any chain. Sensible defaults included for the eight scripts above.
  • DefaultFontProvider now requires an OpenTypeFontEngine so it can resolve named fallbacks on demand.

Bug fix

TextShaper now reserves FontId 0 for the primary font on every reset, even when no glyphs come from it.

…ed Noto Emoji/Math or named fallback fonts configured via SetScriptFallback. Fixed primary-font FontId invariant.
@swmal swmal self-assigned this May 21, 2026
@swmal swmal added the enhancement New feature or request label May 21, 2026
@swmal swmal added this to the EPPlus 9.0 or later milestone May 21, 2026
@swmal swmal merged commit c87e239 into develop9 May 21, 2026
2 checks passed
@github-project-automation github-project-automation Bot moved this to Pending Release in Epplus Enhancements May 21, 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: Pending Release

Development

Successfully merging this pull request may close these issues.

1 participant