Skip to content

feat(ui-egui): font boxes filter, recents, script groups, add font, sample fonts - #396

Open
mameen wants to merge 14 commits into
AlienTechSoftware:mainfrom
mameen:feat/wordcraft-font-picker/agent-1
Open

mameen wants to merge 14 commits into
AlienTechSoftware:mainfrom
mameen:feat/wordcraft-font-picker/agent-1

Conversation

@mameen

@mameen mameen commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • The family box filters as you type (exact, then prefix, then contains); Up, Down and Enter pick a match.
  • Recently Used Fonts above the list, shared by the ribbon and the floating toolbar.
  • The family list is grouped by script under bold headings on a band (Latin, Greek, Cyrillic, Arabic, Hebrew, Devanagari, Thai, Chinese, Japanese, Korean; Other for the rest). Typing a script name lists that script's fonts first.
  • Font names are left-aligned and indented under their heading, drawn in their own font once loaded, on the picker colours.
  • Add Font… at the bottom of the family list: multi-select file picker, copies the font files into the user's fonts folder, and reads the installed fonts again.
  • An amber mark with a tooltip when the family on the page is not installed.
  • Usage events (font chosen, list opened, font added or skipped, missing font, catalogue read) go to the telemetry session and the local log through a sink the app installs. Nothing is uploaded.
  • The font logic lives in a font_picker module and an font_install module, with no egui in them, so they can move to a shared library later.
image

Known gaps

  • Recents are lost on restart; half-point sizes wait on a format decision.

Test plan

  • cargo xtask ci passes locally (all checks, full UI suite).
  • Checked by eye in the app: heading and name layout, colours on the purple theme, typing a script name.

🤖 Generated with Claude Code

@alientechsw alientechsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

local testing

@mameen
mameen force-pushed the feat/wordcraft-font-picker/agent-1 branch from 33a1bbc to 0d29cb3 Compare November 18, 2026 20:56

@leifrossau leifrossau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a nice step up, and keeping the matching, recents and script logic in egui-free modules with tests makes it easy to follow.

A few things I found, roughly in order of importance (details inline):

  1. Add Font can empty an installed font: picking a file that is already in the fonts folder copies it onto itself (fs::copy truncates; I checked it).
  2. Clicking away applies the half-typed filter as the font family.
  3. Scrolling the family list reads font files and calls set_fonts on the UI thread as rows come into view.
  4. Rows grow when their font loads, and the sections are rebuilt and cloned every frame.
  5. Smaller ones: the floating toolbar doesn't update recents, a catalog-read race, a leaked catalog per rescan, Windows registration, and the usage sink with telemetry off.

I read the diff and the code around it, but haven't built or run this branch.

🤖 Generated with Claude Code

Comment thread crates/ui-egui/src/font_install.rs Resolved
Comment thread crates/ui-egui/src/combo.rs Resolved
Comment thread crates/ui-egui/src/combo.rs Resolved
Comment thread crates/ui-egui/src/combo.rs Resolved
Comment thread crates/ui-egui/src/ribbon.rs Resolved
Comment thread crates/ui-egui/src/floating.rs Resolved
Comment thread crates/ui-egui/src/fonts.rs Resolved
Comment thread crates/ui-egui/src/fonts.rs Resolved
pub fn user_fonts_dir() -> Option<PathBuf> {
#[cfg(target_os = "windows")]
{
std::env::var_os("LOCALAPPDATA").map(|local| PathBuf::from(local).join("Microsoft").join("Windows").join("Fonts"))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Windows a per-user font is only installed once it's also registered under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Fonts (and loaded with AddFontResourceEx / announced with WM_FONTCHANGE). Copying the file makes it show in NoteCraft, which scans this folder itself, but Windows and other apps won't see it. A page that uses it then renders with a fallback in WordCraft or a browser.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Acknowledged, not implemented yet. The limitation is recorded in docs/gaps.md (commit 02f6780): a font copied into the user's folder shows in NoteCraft but not in Windows or other applications until it is registered. Registration needs your decision; this thread stays open for it.

Comment thread apps/notecraft/src/main.rs Resolved

@alientechsw alientechsw left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't merge yet please

@DWAA1660
DWAA1660 marked this pull request as draft November 18, 2026 22:01
alientechsw and others added 13 commits November 18, 2026 14:07
Typing in the family box lists the families that contain the text,
Up and Down move the highlight, and Enter applies it. The size box is
unchanged. One new UI test is ignored until its focus problem is found.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The filter test clicked the Font Family arrow, which opens the list and
never focuses the text box, so typed text went nowhere. It now clicks
the Font name box. The test runs again and passes.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
A font family box lists the families used lately above All Fonts, and
the ribbon and the floating bar share the list. The matching, recents
and size check live in a font_picker module with no egui in it, so it
can move to a shared library later. Ported from WordCraft's ranking.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
A family box shows an amber mark, with a tooltip, when the family on
the page is not among the installed fonts. The warning waits until the
installed list is known, so it does not flash while fonts load.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The family list shows every name in that font, as a sample, once the
font is loaded. Fonts load as their rows come into view, and a row
falls back to the interface font until then. The list keeps NoteCraft's
drop-down position and look. The size list is unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The family list has a heading for each script a font covers, so the list
scrolls from language to language. Fonts covering none of the listed
scripts go under Other. The catalogue reads each font's characters once.

Fixes a press on a typed match: the list stayed on the matches until the
release, so the click lands on the row that was pressed. The font tests
now choose a font by typing its name, as a user does.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Clippy's needless_borrow check failed the CI gate on the font test that
clicks the family name. Passing the name as &str fixes it.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Add Font… opens a multi-select file picker, copies the font files into the
user's fonts folder, and reads the installed fonts again. Script headings are
bold on a band, and typing a script name lists that script's fonts first.
Usage events (font chosen, list opened, font added or skipped, missing font,
catalogue read) go to the telemetry session and the local log, through a sink
the app installs; nothing is uploaded.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The family list shows each font name left-aligned and indented under its
script heading, on the picker colours. The size list is unchanged.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The WASM and Android builds have no installed-font catalogue and no file
dialog, so the add-font and script-section code failed to compile there.
Those calls are now compiled only on Windows, macOS and Linux; the other
platforms get stubs that do nothing.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Add Font no longer empties a font already in the folder, and refuses to
overwrite a different font with the same name. A click away applies only an
exact family name, not half-typed text. Floating toolbar and ribbon share the
recent list. The usage log always records events, and telemetry only when a
session exists. Family rows have a fixed height. Script sections are built once
per catalogue read. Font files are read on background threads and added in one
batch per frame. The catalogue publishes only newer reads and is shared, not
leaked.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
The missing-font test waits for the notice, which now appears after a
background lookup. docs/gaps.md records that Add Font does not register
fonts with Windows yet.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Background font loading can still request a frame, so the test waits for the frames to settle rather than running one step.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
@mameen
mameen force-pushed the feat/wordcraft-font-picker/agent-1 branch from 0d29cb3 to 77dd914 Compare November 18, 2026 22:16
@alientechsw
alientechsw marked this pull request as ready for review November 18, 2026 22:21
The non-desktop build no longer uses BTreeMap, so the Android clippy check failed on the unused import.

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

3 participants