Open
Conversation
16688d6 to
a53e063
Compare
|
@mfazekas thank you! |
a53e063 to
64ab88b
Compare
64ab88b to
cfe8e4e
Compare
HayesGordon
reviewed
Feb 25, 2026
dskuza
reviewed
Feb 25, 2026
dskuza
reviewed
Feb 25, 2026
88a361d to
ca4786f
Compare
42eb65e to
7ac409b
Compare
HayesGordon
reviewed
Mar 2, 2026
android/src/main/java/com/margelo/nitro/rive/HybridRiveFontConfig.kt
Outdated
Show resolved
Hide resolved
9624c4a to
2c28c78
Compare
Replace separate addFallbackFont/addFallbackFontFromResource/addFallbackFontFromURL with a single addFallbackFont(source: FontSource) that accepts require() IDs, URI objects, resource names, URLs, or raw ArrayBuffer bytes. All methods are now async. Renamed native HybridObject from Rive to RiveFontConfig to better reflect its purpose.
The font file existed in example/ios/ but wasn't referenced in the Xcode project, so addFallbackFontFromResource couldn't find it at runtime.
Prevents "Cannot set value for property" error on initial render when the riv file hasn't loaded yet.
This reverts commit 16688d6.
…s API
Adds `{ name: string }` to FontSource for system fonts (e.g. `{ name: 'Thonburi' }` on iOS,
`{ name: 'serif' }` on Android). Renames `addFallbackFont` to `addFallbackFonts` accepting
an array to make font ordering explicit and avoid sequential awaits.
Separate font loading from configuration — loadFont() returns opaque FallbackFont handles, setFallbackFonts() accepts a weight-keyed map. System fonts always appended as last resort.
2c28c78 to
36aadef
Compare
dskuza
previously approved these changes
Mar 2, 2026
dskuza
left a comment
There was a problem hiding this comment.
From the Apple side, this looks good to me. The one thing I would question (but it could be a followup) is whether we can add constants for the weights. You can see what Apple uses by viewing UIFont.Weight documentation, but it's also similar to this name mapping.
ios/HybridRiveFontConfig.swift
Outdated
| let requestedWeight = Int(weight.rawWeight) | ||
| let fonts = Self.fontsByWeight[requestedWeight] ?? Self.fontsByWeight[0] ?? [] | ||
| var providers: [RiveFallbackFontProvider] = fonts | ||
| providers.append(RiveFallbackFontDescriptor()) |
There was a problem hiding this comment.
Is this the way of "guaranteeing" there's at least one fallback font in use (if all else fail)? We don't do this on iOS (there's only a default if you don't provide an explicit list). Not saying this is wrong, just something to call out.
System fallback is no longer silently appended — users explicitly include 'default' in the font array to opt in.
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.
Adds
RiveFonts— font fallback API for react-native. Two-phase design: load fonts into opaque handles, then configure a weight-based fallback map. System font fallback is opt-in via a'default'sentinel.How to test
Open the Font Fallback exerciser in the example app (
Exercisers > Font Fallback).1. Custom fonts only — select fonts, mount without "System Fallback" toggle — unsupported scripts show tofu.
2. Custom fonts + system fallback — select fonts, toggle "System Fallback" on, mount — unsupported scripts render via platform default.
3. Font ordering — toggles show selection order (1, 2, 3…) since fallback priority follows insertion order.