Skip to content

Fonts: add custom font from files via UI file picker, drag-and-drop, and font.add path support - #829

Open
GhostMitra wants to merge 1 commit into
storytold:mainfrom
GhostMitra:feat/add-font-from-file
Open

GhostMitra wants to merge 1 commit into
storytold:mainfrom
GhostMitra:feat/add-font-from-file

Conversation

@GhostMitra

Copy link
Copy Markdown
Contributor

Summary

Allows users to load custom font files (.ttf, .otf, .ttc, .woff, .woff2) directly into DeckCraft for the session via:

  1. Home Ribbon Font Dropdown: Added "Add Font from File…" button which opens a native file dialog with font filters (.ttf, .otf, .ttc, .woff, .woff2).
  2. Drag & Drop: Dropping a font file onto the DeckCraft window is now recognized by infer_command and loaded via font.add.
  3. Desktop & Web Integration:
    • Desktop uses native rfd::FileDialog with font filters.
    • Web uses rfd::AsyncFileDialog and inbox file delivery.
  4. Engine font.add enhancement:
    • font.add now accepts both base64 data and file path (via crate::io::read_file).
  5. Feedback:
    • Status messages report the number of font faces added (e.g. "Added 1 font face from CustomFont.ttf").
  6. Contributor Attribution: Added @GhostMitra to contributors/people.toml.

Validation

  • cargo fmt --check passed.
  • cargo clippy --workspace --all-targets -- -D warnings passed (0 warnings).
  • cargo test -p deckcraft-engine --lib font_add passed.
  • cargo test -p deckcraft-ui-egui --lib font passed (all 16 tests passed).
  • cargo xtask assets passed (47 asset files attributed).
  • cargo xtask layers passed (28 crates, 0 violations).
  • cargo xtask wasm passed (all 23 crates passed).

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ReviewerA — source-read COMMENT (not an approval)

I read the head of the diff: custom fonts can be added from files through a file picker, drag and drop, and font.add path support, with ttf, otf, ttc, woff and woff2 accepted, and the author is added to contributors/people.toml. Installing a user-provided font into a document is a licence matter: the font's embedding permission (the fsType flags in the OS/2 table) must be honoured when the font is embedded into a saved file or exported PDF, and restricted fonts must not be embedded. Font parsing is untrusted input, with woff2 decompression a known source of memory-safety bugs, so decompressed sizes must be bounded; a font file picked by the user is copied into the document or into a user folder, which should be stated. I did not read the loader. I have not run it, and no exact-head CI result exists for this head. Nothing was run.

I ran nothing and have no exact-head CI result for this PR, so this is not an approval. Where a diff was long I read its code hunks rather than every generated or documentation line.

Status: waiting_author.

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.

2 participants