Skip to content

feat(style): add user-defined text styles - #815

Merged
LeanBitLab merged 3 commits into
mainfrom
feat/custom-text-styles
Nov 15, 2026
Merged

LeanBitLab merged 3 commits into
mainfrom
feat/custom-text-styles

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

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.
  • Format: one style per line, 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: optional singleLine and showValue parameters.
  • Settings.loadSettings pushes the preference into the engine, so changes apply on the next settings reload.
  • docs/FEATURES.md: new section 46 plus index and summary rows.
  • New unit test CustomTextStylesTest (validation, transform and undo, letters-only, surrogate pairs, removal).
  • The repo pre-commit hook auto-generated machine translations of the 2 new strings for 29 locales (58 entries); they are included in this PR.

Verification & Testing

  • CustomTextStylesTest passes
  • Builds via ./gradlew :app:assembleStandardDebug
  • Installed on a device: Toolbar screen shows the row, dialog opens, no crash in logcat
  • Visual check of the style strip with a custom style, live typing and undo

Guidelines Checklist

  • This PR addresses a single focused concern.
  • Does not add unnecessary dependencies or binary blobs.
  • No em dashes used in comments, descriptions, or documentation.

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.
@LeanBitLab
LeanBitLab merged commit d389679 into main Nov 15, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the feat/custom-text-styles branch November 15, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ Proxy