Skip to content

Text: a space after a symbol-font character keeps the run's font - #1417

Merged
h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
pick2510:fix/symbol-run-space
Oct 30, 2026
Merged

h-a-n-a-s-h-i merged 1 commit into
storytold:mainfrom
pick2510:fix/symbol-run-space

Conversation

@pick2510

@pick2510 pick2510 commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What

An arrow typed with a symbol font, as in "→ Only regulations…", is stored as U+F0E0 with <a:sym typeface="Wingdings"/>. PowerPoint puts that a:sym on the whole run, words included. PowerPoint draws only the symbol code in Wingdings; the space after it is in the run's own font.

DeckCraft kept that space in the arrow's face, because spaces, digits and punctuation stay in the face of the text before them. Wingdings' space is about four times as wide as a text font's, so the words after the arrow started about 20 pt too far right (24 pt text).

Evidence

  • Synthetic probe. A text box written by DeckCraft with four 24 pt lines: a:sym on a whole "→ Only …" run, a:sym on the arrow's run alone, plain text, and the arrow without a space. In PowerPoint for Mac 16.114's PDF export, the first two lines are identical. DeckCraft now draws the same; before, the first line had the wide gap.
  • Real decks. On a private corpus of 166 real-world decks (3,690 visible slides; not attached) compared with PowerPoint's PDF exports, two slides with such arrows improve (3.6% → 2.5% and 4.7% → 4.2% of pixels differing). 78 slides change slightly, none by more than 0.23 points. The largest is a slide whose lines already wrapped where PowerPoint keeps them on one line. Its "⇒" spaces are now Arial spaces, as in PowerPoint, which moves that existing wrong wrap by a word.

How

crates/text/src/lib.rs: a neutral cluster (space, digit, punctuation) stays in the previous face only if that face isn't a symbol font (is_symbol_font: Wingdings, Webdings, Symbol, Marlett). Otherwise it takes the run's font like any other character. Symbol codes themselves still draw in the a:sym font.

Relation to #1049

#1049 (amosarc) makes all ASCII and high-ANSI neutrals take the run's Latin typeface by code range, which would also cover this case. It's broader (CJK runs, glyph advances), and this PR is one condition. If #1049 lands first, this reduces to its test, which pins the Wingdings case.

Tests

text::tests::a_space_after_a_symbol_font_character_keeps_the_runs_font: with a:sym Wingdings on the whole run, the space and the words aren't in Wingdings, and "Only" starts where it does when only the arrow carries a:sym. Like the other symbol-font tests, it skips when Wingdings isn't installed (it runs on macOS with Office). Before: the space in the Wingdings run, and "Only" at 62.6 pt instead of 42.4 pt.

cargo xtask ci: fmt, clippy, pdf-deps, assets, layers and wasm pass, and so do the doctests. cargo test --workspace --no-fail-fast passes 2,112 tests, with one failure, backstage::tests::start_screen_opens_the_palette_and_preferences (a panic in egui's font code since the egui 0.37 migration), which fails the same way on main.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed text following symbol-font characters so spaces, digits, and punctuation use the appropriate text font, improving spacing and layout.

PowerPoint stores an arrow typed in a Wingdings run as U+F0E0 with
<a:sym typeface="Wingdings"/> on the whole run, and draws only the
symbol code in Wingdings: the space after it is the run's own font. A
synthetic deck with "→ Only …" (U+F0E0, a space, words) in one run with
a:sym, and the same with a:sym on the arrow's run alone, exported as
PDF, draws both lines alike. DeckCraft kept the space in the arrow's
face, since spaces, digits and punctuation stay in the face of the text
before them, and Wingdings' space is about four times a text font's: the
words started 20 pt further right.

A neutral character no longer stays in a symbol font's face
(is_symbol_font); it takes the run's font like any other.

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

coderabbitai Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between aaf6c1c and 0865152.

Files selected for processing: 3
  • ROADMAP.md
  • crates/text/src/lib.rs
  • crates/text/src/tests.rs

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Walkthrough

The change prevents neutral characters after symbol-font characters from reusing the symbol font. A conditional test checks font selection and word positioning when Wingdings covers the symbol.

Changes: Symbol-font character selection

Layer / File(s) Summary
Neutral character selection and validation
crates/text/src/lib.rs, crates/text/src/tests.rs, ROADMAP.md
The preceding-face reuse rule now excludes recognized symbol fonts. The test checks that a following space and words do not use Wingdings, and compares word positioning. The roadmap records the change.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related issues

  • Issue 1364 reports that spaces and + after fallback symbols use the fallback font instead of the run font. This change addresses neutral-character font selection after symbol-font characters.

Suggested reviewers: echelon, hamzaelkachtaf4-star

Merge Risk: Minimal · up to 08651

The font-selection change appears ready to merge after normal checks; no actionable risk remains.

Architecture risk: Low · up to 08651

The change affects 2 systems.

Changed systems: crates, ROADMAP.md

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 2 changed files map to changed impact.
  • observed — ROADMAP.md (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in ROADMAP.md: Adds a progress-log entry describing that spaces, digits, and punctuation after symbol-font characters now draw in the run’s own font, rather than in the symbol font.
  • observed — Modified behavior in ROADMAP.md: Adds a trivial revision-history entry for the progress-log update about characters following symbol-font characters.
  • observed — Modified behavior in crates/text/src/lib.rs: The comment now excludes symbol fonts from the stated rule for keeping spaces, digits, and punctuation with the preceding text face, noting that symbol-font spaces can be much wider.
  • observed — Modified behavior in crates/text/src/lib.rs: Preceding-face reuse for neutral clusters now requires that the preceding face is not a recognized symbol font. Previously, any non-color preceding face could be reused if it covered the cluster and the character style matched; symbol-font faces now proceed to the cascade path instead.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 … Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preserving the run's font for a space after a symbol-font character.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@Harrison-Booth

Copy link
Copy Markdown
Contributor

I checked the PowerPoint claim in this PR against real PowerPoint on Windows (COM). I did not build or run the Rust code, so the new test was not run by me (it skips without Wingdings anyway). This PR currently conflicts with main (merge state DIRTY); I reviewed the diff at 0865152.

What I ran: a hand-built .pptx with two 24 pt text boxes, both Arial with <a:sym typeface="Wingdings"/>: one where the whole run "U+F0E0 Only regulations" carries the a:sym, one where the arrow is a run of its own with the a:sym and " Only regulations" follows without it. I read the character positions through COM (BoundLeft):

  • Both boxes give identical positions: the arrow at 27.2 pt, the space at 50.7 pt, "O" at 57.3 pt, and the same right edge.
  • The space is 6.6 pt wide, which is Arial's space at 24 pt (0.278 em), not Wingdings' much wider space.

So PowerPoint draws only the symbol code in the a:sym font and the space and the words in the run's own font, which is what this PR does. I did not compare the PDF output or the 166-deck corpus from the description.

@h-a-n-a-s-h-i
h-a-n-a-s-h-i merged commit c66fee1 into storytold:main Oct 30, 2026
7 checks passed
h-a-n-a-s-h-i pushed a commit that referenced this pull request Oct 30, 2026
Text: a space after a symbol-font character keeps the run's font
@echelon

echelon commented Oct 30, 2026

Copy link
Copy Markdown
Member

Landed on main, thank you @pick2510 for the contribution! If you haven't already, come join us on Discord: https://discord.gg/artcraft

@echelon

echelon commented Oct 30, 2026

Copy link
Copy Markdown
Member

Note on what I changed before landing: merged main in and moved the guard to shape_cells in crates/text/src/shape.rs.

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.

4 participants