Add missing sk_fontmgr_legacy_create_typeface C API - #198
Merged
Conversation
Exposes SkFontMgr::legacyMakeTypeface() to the C API for reliable default typeface resolution on Android, where matchFamilyStyle(null) returns null but legacyMakeTypeface(null) uses fDefaultStyleSet. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
3 tasks
mattleibow
added a commit
to mono/SkiaSharp
that referenced
this pull request
Apr 25, 2026
Includes sk_fontmgr_legacy_create_typeface C API from mono/skia#198. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mattleibow
added a commit
to mono/SkiaSharp
that referenced
this pull request
Apr 25, 2026
Updates submodule from fb76f3dd84 to f5345469d1 (mono/skia#198). Adds the sk_fontmgr_legacy_create_typeface C API that was missing from the squash merge of mono/skia#195. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ramezgerges
added a commit
to ramezgerges/skia
that referenced
this pull request
Apr 26, 2026
Brings in the latest mono/skia 'skiasharp' branch updates on top of the m147 work-in-progress: * Add variable font C API for typeface variation queries and cloning (mono#185) * Add sk_fontmgr_legacy_create_typeface C API (mono#198, mono#195) — replaces the old sk_default_fontmgr.{cpp,h} with a single C entry point that forwards to SkFontMgr::legacyMakeTypeface(). Fixes the Android default-typeface SIGSEGV. * Use int32_t instead of long for SkManagedStream move offset (mono#186) — fail-loud on overflow instead of silent truncation of platform-dependent C long. * Update libpng to 1.6.58 * Update libexpat to 2.7.5 Conflict resolutions: - DEPS: keep m147's freetype roll, take origin/skiasharp's libexpat 2.7.5 (and libpng 1.6.58 auto-merged the same way). - src/c/sk_default_fontmgr.cpp: accept origin/skiasharp's deletion; their legacyMakeTypeface refactor obviates our m147 carry of that file. - src/c/sk_typeface.cpp: re-apply our m139 SkFontScanner fix to the Android and FontConfig SkFontMgr_New_* call sites, which moved into this file as part of their refactor. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
What happened
During the review of PR #195, the
sk_fontmgr_legacy_create_typefacefunction was addedin a separate commit (
e6736d19f) pushed to a local branch (dev/issue-3693-legacy-typeface)on mono/skia — but this commit was not pushed to the PR author's fork branch. When PR #195
was squash-merged, only the commits on the fork's branch were included. The separately pushed
commit was left behind, so the function that the PR was named after was never actually merged.
This was a process error: the fix should have been pushed to the PR branch (on the author's
fork) before merging, not to a separate branch on the upstream repo.
Fix
This PR cherry-picks commit
e6736d19f23da0746c4291ed7223e69ffbce3ac1ontoskiasharptoadd the missing function.
What the function does
sk_fontmgr_legacy_create_typefaceexposesSkFontMgr::legacyMakeTypeface()to the C API.It is needed by SkiaSharp's
SKTypeface.Defaultto reliably resolve the platform defaulttypeface on Android, where
matchFamilyStyle(null)returns null becauseonMatchFamily(null)rejects null family names.
legacyMakeTypeface(null)bypasses this by usingfDefaultStyleSet(which searches "sans-serif", "Roboto", then falls back to style set 0).
Without this function,
SKTypeface.Defaultfalls back to the empty typeface on Android API 36,causing all text measurement and drawing to produce zero/nothing.