Intro SkikoFont abstraction for async font loading on all Skiko platforms - #2787
adamglin0 (adamglin0) wants to merge 4 commits into
Conversation
|
Ivan Matkov (@MatkovIvan) Igor Demin (@igordmn) Oleksandr Karpovich (@eymar) Could you assign reviewers for thsi PR, thanks. Additionally, SkiaParagraphIntrinsics currently lacks support for tracking asynchronous font resolution, so it can’t update once the fonts are ready. I plan to address this in a separate PR. We can now force a recompose by resizing the window, either programmatically or manually. |
Vladimir Mazunin (mazunin-v-jb)
left a comment
There was a problem hiding this comment.
Could you please update this PR as well and fix these comments?
Feel free to ping me when you are done, I'll continue to review
|
Vladimir Mazunin (@mazunin-v-jb) Thanks, I still need some time to review it. I’ll ping you when I’m done. |
Add an AndroidFont-shaped public SkikoFont API in ui-skiko and wire it through SkiaFontLoader and FontCache. Cache unvaried typefaces under baseCacheKey = identity only, then apply weight/style matching metadata and variationSettings under full cacheKey aliases. TypefaceLoader must select sources from identity, not from weight, style, or variation settings.
Cover base/full cache keys, two-level unvaried sharing across weight and variation settings, null-load retry behavior, and FontCache get/put/register.
Single commonMain sample that downloads a remote TTF via Ktor and shows async FontFamily resolution. Wire platform Ktor engines for desktop, Darwin, and web.
bc0ac7b to
916d3b0
Compare
|
Vladimir Mazunin (@mazunin-v-jb) Updated — removed the Android context docs, rebased onto jb-main / ui-skiko. baseCacheKey = identity → unvaried source (load once) cacheKey = identity|weight|style|variation → cloned face registered in FontCollection |
Previously, Skiko-based platforms lacked a public API for async font loading. While
PlatformFontserves as the low-level font representation, it is not designed for extensibility by developers. By introducingSkikoFont, we provide a mechanism similar toAndroidFonton Android, allowing developers to:Fixes CMP-8231 Async font loading support for iOS targets
Testing
This should be tested by QA, but because the SkiaParagraphIntrinsics-related items lack a listener for TypefaceResult.Async, you need to resize the window so that the text can reflow and display correctly.
(If #2789 is merged, it will automatically display after loading, with no further action required.)
Release Notes
Features - Multiple Platforms