fix: load Android auto-size-input fonts from the app's bundled assets (OK-57825) - #116
Merged
Merged
Conversation
…s (OK-57825) makeTypeface() resolved fontFamily with Typeface.create(String, int), which only looks up system font families. A bundled family such as Roobert-Medium silently fell back to the default typeface, so the Android input, prefix and suffix drew in Roboto or the OEM system font while iOS found the same family through UIAppFonts. Resolve the typeface through ReactFontManager, the lookup React Native Text uses: fonts registered at runtime (expo-font), then assets/fonts/<family>.ttf|otf, and only then Typeface.create. Auto-size measurement uses the same typeface, so the fitted size follows the real glyph widths. pager-view's native headers made the same change in 3.0.141. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Bump all 40 publishable packages to 3.0.146 and record the Android auto-size-input font fix in the changelog. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
5 tasks
Contributor
|
@codex review |
Contributor
|
@codex security review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
Codex Review: Didn't find any major issues. Nice work! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
originalix
approved these changes
Sep 17, 2026
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.
Summary
fontFamilythe app passes, including fonts bundled in the app'sassets/fontsor registered at runtime by expo-font. Before this change, a bundled family such asRoobert-Mediumsilently fell back to the system font on Android, while iOS rendered it (OK-57825).AutoSizeInput.ktchanges. Props, JS and iOS are unchanged.Root cause
fontFamily="Roobert-Medium"toAutoSizeInputView(since app-monorepo #12392).UIFont(name:size:). The app registersRoobert-Medium.ttfthroughUIAppFonts, and the font's PostScript name isRoobert-Medium, so the lookup succeeds.Typeface.create(fontFamily, style). That API takes noContextorAssetManagerand only looks up system font families. An unknown family does not throw: it returns the default typeface, so thetry/catchnever ran. The digits and the token symbol rendered in Roboto, or in the OEM system font on many Chinese ROMs.assets/fonts/Roobert-*.ttf, and expo-font registers the same families at runtime. Both live in React Native'sReactFontManager, which this view never queried.Change
makeTypeface()resolves the family withReactFontManager.getInstance().getTypeface(family, style, context.assets), the lookup React NativeTextuses: fonts registered at runtime, thenassets/fonts/<family>.ttf|otf, thenTypeface.createfor system families. pager-view's native headers made the same change in 3.0.141 (fix(android): keep the tab bar under the keyboard and load pager-view header fonts OK-63557 OK-63273 #113).Typeface.defaultFromStyle(style).fontWeightstill maps only"bold"toTypeface.BOLD.AutoWidthFontFitprobe, the binary searches and the side-label widths) calls the samemakeTypeface(), so the fitted size is computed from Roobert's glyph widths instead of the fallback font's.Verification
apps/mobile/android/app/src/main/assets/fonts/Roobert-Medium.ttfis byte-identical to the copy the JS font loader uses, and its PostScript name isRoobert-Medium(checked with fontTools).resolveHeaderTypefaceand matches React Native 0.86.2'sReactFontManager.getTypeface(String, Int, AssetManager?). The module already depends onreact-android.Other native font lookups checked
ReactFontManager(since 3.0.141)fontWithName:size:ReactFontManagerRCTFontcreateFromAsset("fonts/Roobert-*.ttf")UIFont(name:)Paintwith no typeface: system fontCATextLayerwith no font: HelveticaPaintwith no typeface, fake boldUIFont.systemFont(ofSize:weight: .semibold)perp-depth-bar and segment-slider never set an app font on either platform. That is not a lookup bug, so they are left for a separate change.
Release
a057c55fcf2a5f65b0Published from this branch with the
latestdist-tag in run 35243178308. The run's registry check passed for all 40 packages, withlatestpointing at 3.0.146. The downloaded@onekeyfe/react-native-auto-size-input@3.0.146tarball'sAutoSizeInput.ktandAutoSizeInput.swiftare byte-identical tof2a5f65b0.🤖 Generated with Claude Code