Skip to content

feat: improve font resolver#290

Merged
PeterStaar-IBM merged 2 commits into
mainfrom
dev/improve-font-resolver
Jul 2, 2026
Merged

feat: improve font resolver#290
PeterStaar-IBM merged 2 commits into
mainfrom
dev/improve-font-resolver

Conversation

@PeterStaar-IBM

Copy link
Copy Markdown
Member

Summary

Improve Blend2D renderer font resolution by replacing path-only, fuzzy-first system font matching with deterministic metadata-based resolution.

This change adds a richer font resolver that indexes actual font face metadata, supports .ttc face indexes, handles Standard 14 / URW / TeX aliases, and isolates macOS,
Windows, and Linux font discovery behind platform helpers.

Before

blend2d_renderer_preview

After

blend2d_renderer_preview

Details

  • Index system fonts by Blend2D face metadata:
    • family name
    • full name
    • subfamily name
    • PostScript name
    • weight
    • style
    • path + face index
  • Support TrueType/OpenType collections by iterating BLFontData::face_count().
  • Cache loaded BLFontFace objects by {path, face_index}.
  • Resolve fonts in a deterministic order before fuzzy matching:
    • subset-prefix stripping
    • normalization
    • explicit aliases
    • exact metadata lookup
    • style selection
    • TeX fallback families
    • fuzzy matching as last resort
    • OS fallback font
  • Add aliases for:
    • PDF Standard 14 fonts
    • URW/Ghostscript fonts such as Nimbus families
    • common TeX/Computer Modern and Latin Modern families
  • Add platform-specific font directory and fallback handling for:
    • macOS
    • Windows
    • Linux
  • Keep actual font face loading lazy; font faces are only loaded after a match is selected.

Notes

This improves substitution quality and cross-platform behavior, but it does not yet render embedded PDF font programs. Specialized subset fonts such as CMTT10, CMSY7,
and CMEX10 can still require embedded font support for fully faithful output.

Signed-off-by: Peter Staar <taa@zurich.ibm.com>
Signed-off-by: Peter Staar <taa@zurich.ibm.com>
@PeterStaar-IBM PeterStaar-IBM requested a review from cau-git July 2, 2026 12:37
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @PeterStaar-IBM, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

@PeterStaar-IBM PeterStaar-IBM requested a review from dolfim-ibm July 2, 2026 13:28

@cau-git cau-git left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PeterStaar-IBM PeterStaar-IBM merged commit a7f201f into main Jul 2, 2026
34 checks passed
@PeterStaar-IBM PeterStaar-IBM deleted the dev/improve-font-resolver branch July 2, 2026 13:58
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