Repository navigation
Custom typeface: import a TTF or OTF file - #52
Open
user12xxxxxx wants to merge 2 commits into
Open
user12xxxxxx wants to merge 2 commits into
user12xxxxxx wants to merge 2 commits into
Conversation
Appearance -> Typeface gains "Choose a font file...", which opens the system file picker (no permission). The picked file is copied to files/fonts/custom after Typeface.Builder confirms Android can load it; anything else is refused with a toast and the previous font stays. One slot: a new pick replaces it. FontChoice.CUSTOM plus Settings.customFontName (label only). FocusTheme uses the imported font everywhere and falls back to the default face when the file is missing, e.g. after restoring settings on another phone; Appearance then shows Sans. The split clock measures the font's "00:00" width instead of assuming the sans/mono constants. The font file is not part of the settings backup. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
Settings → Appearance → Typeface gains "Choose a font file…": pick any TTF or OTF on the phone through the system file picker (no new permission, no new dependency). The font is used for all text in the launcher.
files/fonts/customonly afterTypeface.Builder(file).build()confirms Android can load it. Anything else is refused with a toast ("That is not a TTF or OTF font") and the previous font stays.FocusThemefalls back to the default face when the file is missing (for example after restoring settings on another phone), and Appearance then shows Sans."00:00"width instead of using the fixed sans/mono constants, so a wide font does not overflow its half.Files
ui/theme/CustomFont.kt(new): import, validate, load, measuredata/Settings.kt:FontChoice.CUSTOM,customFontNameui/theme/Theme.kt,ui/home/HomeScreen.kt,ui/settings/LauncherPages.ktSettingsBackupTest: round-tripsCUSTOM+ name3-details/ui-system.md, journal)Limits
Verified
./gradlew :app:testDebugUnitTest :app:lintDebug: 37 tests pass, lint 0 errors..ttfwas refused with the toast. With the stored file deleted, the app restarted in Sans with no crash.🤖 Generated with Claude Code