Skip to content

fix(textstyle): font list under its field and coloured, MTEXT origin marks under the labels - #2438

Merged
HakanSeven12 merged 12 commits into
HakanSeven12:mainfrom
turbuczn:fix/text-style-fixes-2
Nov 2, 2026
Merged

HakanSeven12 merged 12 commits into
HakanSeven12:mainfrom
turbuczn:fix/text-style-fixes-2

Conversation

@turbuczn

@turbuczn turbuczn commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Builds on #2437 — please review the last commit only.

Second and last fix PR for the text style manager redesign (#2413): the UI requests from the manual test plus the remaining small UI fixes.

Font picker

  • The list opens directly below the Font field, left edges aligned. It was 340 px wide, wider than the room under the field, so it flipped over the style list; it is now as wide as the field (a narrow field, as in the MTEXT toolbar, keeps a 260 px list).
  • Coloured kind tags from the theme palette: SHX grey, TT green, "!" orange for a missing font. Section titles are emphasised, file names easier to read. Checked in the light and the dark theme (a shared readable_accent helper keeps every accent text at 4.5:1 or better).
  • A missing font names the font that really draws it (Face::resolve: e.g. a bundled stroke font of the name, otherwise Standard), in orange, instead of always "Standard".

MTEXT editor

  • The By style / Custom / Mixed marks of Font, Height, Width factor and Oblique sit on their own line under the label: green, red and orange, one size smaller and italic.
  • Without a font of its own, the Font field shows the style's font (also after a style switch) instead of a cut-off "[Style default]".
  • A missing style font is marked as soon as the editor opens.
  • The Oblique field has its own label key; the dimension style "Oblique" key is unchanged.

Smaller fixes

  • Switching to a TrueType font shows a note on what it turned off: "Turned off for the TrueType font: Vertical, Big font (gbcbig.shx)."
  • Validation messages as specified: "Must be between −85° and 85°." (oblique) and "Enter 0 or a positive number." (height).
  • Hungarian translations: "Styles in use" and the MTEXT oblique label.
  • The toolbar shows icons only at the same width where the two columns stack (was 640 vs 920 px).

Tests

  • New text_style_ui_tests: list position at 1280 and 780 px, tags and the missing note, the stand-in name, origin marks under their labels, the style font after a style switch, the TrueType note; light and dark snapshots of the font list and the MTEXT editor.
  • Updated: validation texts, layout (icons only where the columns stack), Hungarian labels, the readable-accent contrast in both themes. The MTEXT Position menu test now looks for "Normal", since "By style" is also the new mark's text.

All new strings are in all 23 locale files (Hungarian translated, other new strings in English; the existing translations of the missing-font note were kept with the font name as a placeholder).

With this PR the text style manager redesign (#2413) is complete.

🤖 Generated with Claude Code

turbuczn and others added 11 commits November 1, 2026 09:27
Oblique, tracking and colour set with nothing selected no longer re-serialise
the whole text through parse_mtext / to_mtext_string. They patch one leading
\Q / \T / \C control in the raw source, the way the object font and width
already do; codes that format only part of the text keep overriding it, and
clearing formatting leaves these whole-text controls in place. Reopening the
editor shows the whole-text oblique and tracking. folded_value and
apply_globals are gone.

The height is saved exactly as opened until its field is edited (the field
still shows it rounded), and the line spacing factor is kept as f64, so an
untouched Apply changes nothing and does not mark the drawing modified.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The text style manager parsed its rounded field text back on every Select and
Apply, so a style the user only looked at lost precision and the drawing was
marked modified. The editor now works on a draft: an exact copy of the style
plus the text each number field showed when loaded; only a changed field is
parsed and written. Toggles and font picks edit the draft too.

New, Copy, Delete and starting a rename write the draft first, so a typed
value is copied instead of lost. Renaming rewrites only the texts naming the
style, through get_entity_mut, and the open manager keeps their before-images:
Close restores them and Apply puts them in the same undo step as the style
table. A style merged in as XREF|Name is read-only. The stage re-baselines
after the ribbon sync, so a second untouched Apply changes nothing.

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

The stroke font list stored its display names ("Simplex", "Standard") as the
font file; it now stores the SHX file each one stands for (simplex.shx,
txt.shx, ...), and still recognises the old names. Picking a stroke font drops
the bold and italic bits and keeps the character set and pitch; picking a
TrueType family stores its regular face file with the family and turns off
vertical text and the big font.

A DXF read keeps the ACAD font record it loaded, and the writer wrote it after
the one it builds from the style: each save added a stale family, and a switch
to a stroke font came back as TrueType after reload. Save preparation now drops
the loaded record when it holds only the font.

A new attribute or attribute definition no longer copies the style's backward
and upside-down flags, which the XOR with the style cancelled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… the selected one

A number the text style manager cannot apply used to be dropped silently. The
width factor (0.01 to 100), oblique angle (-85 to 85 degrees) and height (0 or
more) now turn red with the reason under the field, and Apply stays off with
"N fields need fixing before Apply." beside it until they are fixed. The typed
text is kept; a field the user did not touch is never an error, even when the
drawing stores a value outside the range. The shared style frame takes the
reason, so other managers can use it.

A new text style starts as a copy of the selected one, like a new dimension
style. A "Use Big Font" switch, for stroke fonts only, clears the big font when
turned off and gives it back when turned on; picking a TrueType font turns it
off.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The text style manager had two long lists (stroke fonts, system fonts) plus
free text fields for the font file and family; the MTEXT toolbar had its own
short list of ten names that it wrote as "\FStandard;", which no other
program can find. Both now use one shared picker (src/ui/font_picker.rs).

The head is the search field: typing filters the list by shown name or file.
The list has sections: the fonts the drawing's text styles use, the bundled
stroke fonts with the real SHX file each one stores (Simplex -> simplex.shx),
the SHX files in the downloaded-fonts and support folders, and the TrueType
families. A font the drawing names but nothing here draws is marked with the
warning icon and "missing - drawn with Standard", in the list and in the
head. A name nobody lists can still be typed and picked ("Use ...").

A pick in the style manager goes through the existing draft rules (a stroke
font drops bold/italic, a TrueType font drops vertical and the big font). A
"Font style" choice (Regular / Bold / Italic / Bold Italic) replaces the two
check boxes; it offers the faces the family has installed, keeps a stored
face this machine lacks, and is off for stroke fonts. In MTEXT a stroke font
is written by its file (\Fsimplex.shx;), a family as before.

The check for a missing SHX file moves out of missing_shx_fonts into
font_repo::shx_file_missing, so the picker and the font download use the
same rule. Ten new strings, in all 23 catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…o its texts

Changing a text style's fixed height, width factor or oblique angle used to
leave the existing texts as they were, because TEXT, ATTRIB and ATTDEF store
their own width and oblique, and every text stores its height. Apply now
writes the new value into each text that still shows the style's old one:
model space, layouts, block definitions and the attributes of inserts.

A value set on the text itself stays: a different height or width, or an
MTEXT whole-text \W / \Q code (an MTEXT without one already draws with the
style's width and oblique). A fixed height that was or becomes 0 changes no
existing text. Texts in external references are not changed. The texts go
into the style manager's transaction, so one Undo takes back the style and
the texts together, and closing without Apply leaves them untouched.

Before Apply the window says what will happen, for example "Height: 2.5 →
3.5. 24 texts that follow the style are updated. Inside block definitions: 4.
7 texts with their own value keep them." The texts using the selected style
are listed once when it is selected, so the line follows each keystroke
without walking the drawing again. Six new strings, in all 23 catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lue comes from

The MTEXT editor's first row now shows the style's values and marks where
each one comes from, on all four fields that a style can set:

- Font, Height, Width factor and Oblique carry "By style", "Custom" or
  "Mixed". The height follows a fixed style height (none is shown when the
  style asks for the height of each text); the oblique angle follows unless
  a whole-text \Q sets one. Mixed means the value comes from the style but
  some characters have their own.
- The Oblique field moves from the More menu into the first row and shows
  the style's angle when the text has none of its own. Typing the style's
  angle removes the code; typing 0 under a slanted style writes \Q0;.
- A right click on a Custom field offers "Reset to style (15°)": it removes
  the whole-text \f, \W or \Q, or gives the text the style's fixed height,
  as one undo step. Codes that format only part of the text stay.
- Picking another style brings its oblique angle into the field, and a
  height that followed the old style takes the new style's height; a height
  of the text's own stays.

Builds on the lossless whole-text controls of fix/mtext-lossless-globals
(merged into this branch). One new string, in all 23 catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The MTEXT editor gets a style menu ("…" beside the Style list):

- New style from selection… asks for a name and makes a copy of the
  text's style with the values the selected characters share. The text
  then uses the new style; its whole-text codes that only repeat the
  style go, so every field shows "By style".
- Update "<style>" from selection writes the shared values into the
  text's own style. The change reaches every text that follows the
  style, as an Apply in the style manager does, in one undo step. Off for
  a style from an external reference.
- Text Style Manager… opens the manager on the text's style; after an
  Apply there the open editor shows the style's new values.

Only what a text style stores is read: the font with its bold and
italic, the height, the width factor and the oblique angle (the whole
text when nothing is selected). A value the characters do not share
stays as the style has it, a style that asks for each text's height
keeps asking, and a stroke font goes in as its real SHX file through the
style manager's own draft calls.

Five new strings, in all 23 catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… style is used

The text style manager takes the layout of the approved mockup:

- The properties sit in three framed groups (Font, Size, Effects) with
  short hints, under the style name, its status with a text count and
  the "Compare with" row. A changed number says what is stored
  ("Modified · was 2.5000").
- Beside them: what Apply does to the texts (moved to the top and
  framed), a preview of the draft resolved as the drawing resolves a
  style (SHX file on disk, big font, TrueType face, filled glyphs) with
  a sample text field, and where the style is used by kind and block.
- List rows show how many texts use each style and a lock on
  referenced styles; "Styles in use" works here too.
- In a narrow window the two columns stack, the Apply summary first,
  and the toolbar shows icons only.

All five style managers get toolbar icons (two new SVGs: import,
set current) and a rename hint under the list.

One walk of the drawing gives the list counts and the selected style's
texts, run where the text walk ran before, not on every frame. The tabs
and TextStyleDialogTab are gone; the "Compare with" row is shared.

16 new strings, in all 23 catalogs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ist and preview

- A copy of, or a new style from, a referenced style is the drawing's own:
  the name loses its `XREF|` part and the copy is no longer referenced.
- While a field holds a value that cannot be applied, switching styles,
  New, Copy, Delete, Import and Rename wait, so the typed value stays.
- The nameless shape-file entries are not listed or offered for comparison.
- An MTEXT with a whole-text height code keeps its height on Apply.
- Delete is off for Standard, the current style and a style texts use.
- The font picker lists a bare stroke name (`txt`) as its SHX file.
- A common TrueType family stores its usual file name where no installed
  file is known (the web).
- The preview caption wraps under the drawing instead of running over it.
- The named object dictionary keeps its order when the multileader style
  dictionary is synced, so an untouched Apply changes nothing.
- Removed the unused Message::MTextFont.
- Tests: rename reaches attributes, inserts and block texts; test 1 compares
  the whole drawing; the TrueType test always runs; a new TEXT takes a first
  fixed height; an MTEXT font pick leaves the style alone; the window draws
  wide and narrow in both themes.

Part of HakanSeven12#2413.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@turbuczn
turbuczn force-pushed the fix/text-style-fixes-2 branch from 93213be to 41bd1a0 Compare November 1, 2026 18:12
…marks under the labels

The font list opens right under the Font field, as wide as the field, so
it no longer flips over the style list. Its kind tags are coloured from the
theme (SHX grey, TT green, a missing font's "!" orange), the stand-in of a
missing font is the font that really draws it and shows in orange, section
titles stand out and file names are easy to read, in light and dark themes.

In the MTEXT editor the By style / Custom / Mixed marks sit on their own
line under the Font, Height, Width factor and Oblique labels, green, red
and orange, smaller and italic. Without a font of its own the Font field
shows the style's font, also after a style switch, and a missing style
font is marked as soon as the editor opens.

A TrueType font switch says what it turned off (Vertical, Big font), the
oblique and height messages say what the field accepts, the oblique field
of the editor has its own label key (Hungarian "Ferde szög"), "Styles in
use" is translated, and the toolbar shows icons only where the columns
stack.

Refs HakanSeven12#2413

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@turbuczn
turbuczn force-pushed the fix/text-style-fixes-2 branch from 41bd1a0 to cb601ee Compare November 1, 2026 18:48
@HakanSeven12
HakanSeven12 merged commit aac1b62 into HakanSeven12:main Nov 2, 2026
6 checks passed
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