Skip to content

Draw the font faces a family actually has (#69) - #387

Open
NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:fix/69-font-weights
Open

NikitkaRa wants to merge 1 commit into
storytold:mainfrom
NikitkaRa:fix/69-font-weights

Conversation

@NikitkaRa

Copy link
Copy Markdown
Contributor

Summary

  • The Home font menu lists each family's own faces (Light, Semibold, and the rest), not only Regular, Bold and Italic.
  • A named face is drawn from that face, and a .pptx save writes it in the typeface name (Inter Light) so it comes back as the same face.
  • Bold still selects the family's Bold face.

Test plan

  • cargo test -p deckcraft-pptx --lib typeface::
  • cargo test -p deckcraft-engine --lib a_named_font_style
  • cargo test -p deckcraft-pptx --test roundtrip a_named_font_style
  • cargo clippy -p deckcraft-fonts -p deckcraft-model -p deckcraft-text -p deckcraft-engine -p deckcraft-pptx -p deckcraft-ui-egui -- -D warnings
  • Open a deck, pick Light or Semibold from the font style menu, save as .pptx, and reopen

Made with Cursor

anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
Co-authored-by: Brandon Thomas <echelon@gmail.com>
anishguduru pushed a commit to anishguduru/deckcraft that referenced this pull request Oct 16, 2026
* M7: select real Japanese fallback faces by family and weight

Refs storytold#184. Keep Type 3 font-name reporting separate in storytold#387; missing weights and the small web font input remain explicit limitations.

Assisted-by: OpenAI GPT-6.1 (gpt-6.1-sol)

* Test the Japanese fallback name for a sans source: the Gothic face since storytold#394 matches the source style

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

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Light, Medium and Semibold were collapsed to Regular or Bold. The font menu now lists the family's own faces, and a named face is what gets saved in the typeface.

Co-authored-by: Cursor <cursoragent@cursor.com>
@NikitkaRa
NikitkaRa force-pushed the fix/69-font-weights branch from 06cac49 to 7c5a512 Compare October 16, 2026 19:02
@Harrison-Booth

Copy link
Copy Markdown
Contributor

Thanks for this. Listing and drawing the font faces a family really has (Light, Semibold and so on), and saving them by typeface name, still looks valuable. I checked just now: the PR is open, GitHub reports it conflicts with main, and no one has commented on it. Do you plan to bring it up to date with main? If you would rather not, I can open a PR that credits you, keeps your commits and shows a git range-diff against this one, so you'll still get credit and have visible work.

aiongg added a commit to aiongg/deckcraft that referenced this pull request Oct 27, 2026
aiongg added a commit that referenced this pull request Oct 27, 2026
* ui: use craft_ui::ComboBox so dropdown menus grow back (egui#5225); repin craft-libs

* chore(deps): craft-libs 60d60d48 (dropdown fixes)

* chore(deps): craft-libs 6af63481 (dropdown fixes)

* chore(deps): craft-libs 4d7b82f7 (dropdown fixes)

* chore(deps): craft-libs 92d392cf (#387 merged)

* chore(xtask): pdf-deps expects craft-libs 92d392cf

@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: the font faces a family actually has are drawn (#69). The family's own list (Light, Semibold and others) is offered, drawn and saved as the typeface name, and the ROADMAP's scores are rewritten by hand (feature breadth 80% weighted over 191 features, menu bar coverage 59% of 217 items), which are measurements made by the project's tooling and are better regenerated by it. PowerPoint offers fonts such as "Segoe UI Semibold" as separate families, so saving the face as the typeface name matches the file format. This overlaps deckcraft#1864 and designcraft#1969 on named instances and legacy names, and the font naming rules should be shared. 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.

@aiongg aiongg added the bugfix Fixes something that is broken: wrong result, crash, data loss label Nov 4, 2026

@aiongg aiongg 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.

AI-generated review (Opus). Not a maintainer decision.

Changes needed:

This adds a per-family face menu, draws the chosen face and writes it into the .pptx typeface name. Rendering and the basic save and reopen path work, but the face is kept apart from the family and goes stale in several paths.

  • crates/model/src/text.rs:412 inherits font_style on its own, but crates/pptx/src/read/dml.rs:533-541 only sets it when a style was split off. A run with an explicit latin typeface="Arial" under a list style with Inter Light therefore draws and saves as Arial Light. A plain typeface should clear the inherited face (for example by storing an empty style), and format.bold or choosing Regular should not let an inherited face come back.
  • Changing the family keeps the face: format.font (crates/engine/src/cmd/format.rs:316) and the Font dialog's write (format.rs:518-520) set font but leave font_style, so Inter Light then Arial is saved as Arial Light.
  • The Font dialog's Bold and Italic (format.rs:524-529) set the flags without clearing font_style, and font_dialog_params (format.rs:665-666) reads the raw flags. On a Semibold run, unticking Bold keeps it Semibold, and the dialog can disagree with the ribbon.
  • Splitting the typeface on read changes what Replace Fonts sees (crates/engine/src/fonts.rs:71, 165). A deck using Segoe UI Semibold now lists Segoe UI, and replacing it keeps Semibold on the new family. Theme fonts (crates/pptx/src/read/theme.rs:20) are not split, so the same face can show up under two names.
  • The substitutes entries segoe ui light, segoe ui semibold and franklin gothic medium (crates/fonts/src/fontdb.rs:39, 46) can no longer be reached from runs, because the family is split before lookup.
  • ROADMAP.md adds a second Feature breadth row (80%) beside the existing 84%, a second Features dimension row and a second Tables row (89% beside 97%). These look like merge leftovers. The headline numbers should be regenerated by the parity tool, not added by hand.
  • The ribbon list (crates/ui-egui/src/ribbon.rs:512-527) and the face lookup in layout (crates/text/src/lib.rs:437-440) do what the description says.

Claims checked:

  • verified: The Home font menu lists each family's own faces, not only Regular, Bold and Italic (crates/ui-egui/src/ribbon.rs:512-527 builds the style dropdown from FontDb::styles(&font) (crates/fonts/src/fontdb.rs:847-863) and runs format.fontStyle on click)
  • verified: A named face is drawn from that face (crates/text/src/lib.rs:437-440 uses font_style as the style name for document_face and suppresses fake bold and italic when the named style already implies them. The face chain and cascade use st.style_name (lib.rs:508, 802, 875, 886))
  • contradicted: A .pptx save writes the face in the typeface name so it comes back as the same face (The writer joins family and face at crates/pptx/src/write/dml.rs:688 and the reader splits them at crates/pptx/src/read/dml.rs:533-541. But a plain typeface leaves font_style None, and crates/model/src/text.rs:412…
  • contradicted: Bold still selects the family's Bold face (format.bold clears font_style (crates/engine/src/cmd/format.rs:270-276), but the Font dialog's write sets bold and italic without clearing it (format.rs:524-529), and font_dialog_params reads the raw flags (format.rs:665-666). Clearing to None also lets an…

Recommendation: update the pull request; it will be reviewed again.

Reviewed at 7c5a512.

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

bugfix Fixes something that is broken: wrong result, crash, data loss

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants