Repository navigation
feat(style): add user-defined text styles - #815
Merged
Merged
Conversation
Let users add their own Unicode font styles from Toolbar > Custom text styles. Each line is 'Name: <styled A-Z><a-z>[0-9]' (52 or 62 chars). Custom styles are merged into the existing style strip, live typing and undo. The style list, id lookup and reverse map are rebuilt together as one snapshot when the setting changes. TextInputPreference gains optional singleLine and showValue parameters.
CJK keyboards type U+FF1A, which made a valid 'Name:' line invalid. Also shorten the settings summary so it translates cleanly; the pre-commit hook regenerated it for all locales.
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 of Changes
Users can add their own Unicode font styles to the Font Style strip from
Toolbar > Custom text styles.Motivation & Context
Feature request: the Unicode font styles are hardcoded. Instead of a new editor screen, this reuses the existing text-input preference dialog and the existing style strip (which doubles as the preview), so the UI footprint is one settings row.
Changes Made
UnicodeStyleEngine: user-defined styles parsed from one string preference and merged with the built-ins. The style list, id lookup and reverse map are rebuilt together as one immutable snapshot, so live typing, apply and undo work for custom styles and readers never see a half-updated list.Name: <styled A-Z><a-z>[0-9](52 or 62 characters, whitespace ignored). Invalid lines and duplicate names are rejected in the dialog (OK disabled).TextInputPreference: optionalsingleLineandshowValueparameters.Settings.loadSettingspushes the preference into the engine, so changes apply on the next settings reload.docs/FEATURES.md: new section 46 plus index and summary rows.CustomTextStylesTest(validation, transform and undo, letters-only, surrogate pairs, removal).Verification & Testing
CustomTextStylesTestpasses./gradlew :app:assembleStandardDebugGuidelines Checklist