Repository navigation
Enclose Characters: put a character in a circle, square, triangle or diamond - #301
Merged
Merged
Conversation
vangel76
force-pushed
the
feat/enclose-characters
branch
4 times, most recently
from
October 10, 2026 23:45
20a3781 to
fe3dc72
Compare
Contributor
Author
|
Rebased onto main (after #315/#308/#294/#397/#399 and others). Conflicts: revision tables, i18n catalogs (kept main's "Formatted" next to ours), an engine test placed next to main's new Delete Columns test, parity numbers. |
vangel76
force-pushed
the
feat/enclose-characters
branch
from
October 11, 2026 07:54
fe3dc72 to
440468e
Compare
… around a character (storytold#297) New command format.enclose {"shape": "circle|square|triangle|diamond" | null, "style"?: "shrink|enlarge", "text"?: string} puts one full-width or up to two half-width characters in an enclosure, changes its shape, or (null) takes the text back out. It is stored the way ECMA-376 describes it: an EQ field with the overstrike switch, eq \o\ac(○,字), with the text as its plain-text result. Layout now draws EQ \o fields: the arguments overstruck as one cluster (centred, \al or \ar). An enclosure symbol among them is drawn as a vector shape around the text in the text's colour, so it never depends on the font having ○ □ △ ◇; "shrink text" scales the text into a one-em shape, "enlarge symbol" grows the shape around text at its own size. Screen and PDF both get it through the display list. Imported Word documents with enclosed characters used to show nothing (the field has no result); they now render. .docx: written as Word stores enclosed characters (begin, the code split so the symbol and the text have their own run sizes, end, no result); the reader recovers the style from those sizes. The style lives in the model as a trailing \* enlarge on the code, never written to a file. Home › Font gets an Enclose Characters button that opens a dialog (Style: None / Shrink text / Enlarge symbol, Text, Enclosure list, a drawn preview); scripts with a shape never see it. Strings in every interface catalog. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vangel76
force-pushed
the
feat/enclose-characters
branch
from
October 11, 2026 16:50
440468e to
7486393
Compare
# Conflicts: # ROADMAP.md # crates/docx/tests/roundtrip.rs # crates/layout/src/display.rs # crates/layout/src/para.rs # crates/layout/src/tests.rs # crates/ui-egui/src/i18n/et.tsv # crates/ui-egui/src/i18n/ru.tsv # crates/ui-egui/src/i18n/tr.tsv # docs/file-format-parity.md # docs/gaps.md # docs/layout-parity.md # docs/parity-checklist.md # docs/target-app-parity.md
Member
|
Thanks for the contribution, @vangel76! This is now merged into main. If you haven't already, please come join us on Discord: https://discord.gg/artcraft |
daghantektepe
added a commit
to daghantektepe/wordcraft
that referenced
this pull request
Nov 6, 2026
…cter in a circle, square, triangle or diamond tamamlandı
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #297
What changed
Command
format.enclose {"shape": "circle|square|triangle|diamond" | null, "style"?: "shrink|enlarge", "text"?: string}works on one full-width character or up to two half-width ones (anything else is an error). It can also change the shape of enclosed characters that are selected or next to the caret, andnullturns them back into plain text. Each step can be undone. Thetextparameter is the dialog's Text box: it replaces the selection, or goes in at the caret.Model: enclosed characters are an
EQfield with the overstrike switch, as ECMA-376 Part 1 §17.16.5.20 describes:eq \o\ac(○,字). Its cached result is the text, so plain-text export, search and PDF text still read字. Parsing lives in the newwordcraft_doc::eqmodule (parse_overstrike,Enclosure).Layout/render/PDF: general
EQ \osupport. The arguments are drawn on top of each other as one cluster, centred by default or aligned with\al/\ar. An enclosure symbol is drawn as a vectorDraw::Shape(ellipse, rectangle, triangle or diamond) in the text colour, so it doesn't depend on the font having ○□△◇:Before this change, Word documents with enclosed characters showed nothing at all, because Word writes no field result for them.
.docx:
\* enlargeon the code. It never reaches a file.UI: a Home › Font › Enclose Characters button (icon drawn in code) opens a dialog with Style (None / Shrink text / Enlarge symbol), Text, an Enclosure list, a drawn preview and OK. Scripts and agents that pass a shape never see the dialog. The new strings are in all 8 catalogs, including
sr.tsvandsr-latn.tsv.Docs: parity checklist regenerated. ROADMAP, gaps, target-app, UI, file-format and layout parity docs updated.
Parity
Before: 402/434 (92.6%). After: 403/434 (92.9%) (rebased on main). The floor test value is unchanged.
Testing
wordcraft-doceq::tests: Word's enclosure codes, nested switches,;separators, escapes and plain\oparse; other fields and EQ switches are rejected.wordcraft-engineenclose_characters_make_an_eq_field_and_come_back_out:nullrestores the text and selects it, and undo works;.docxround trip keeps both fields and both styles;textinserts at the caret.wordcraft-docxenclosed_characters_round_trip_in_words_structure: the written XML has noseparate, no marker and a shrunk text run. All four shape/style/size combinations read back identical.wordcraft-layoutenclosed_characters_draw_a_shape_around_the_text: the shape is drawn around the shrunk text, the next text follows the shape, enlarge grows the shape, and plain\ooverstrikes without a shape.wordcraft-ui-eguienclose_characters_button_opens_the_dialog.ui_shot: checked the dialog and the rendering of all four shapes, enlarge and a CJK character, at 200%.cargo testandcargo clippy --all-targets -D warningson doc, layout, docx, engine and ui-egui;cargo fmt;cargo xtask layers,assets,wasmandparity.🤖 Generated with Claude Code