Skip to content

[patch] Keep a value slider's minus sign readable in every culture and font - #728

Merged
matt-edmondson merged 1 commit into
mainfrom
claude/project-thread-kicv7a
Oct 25, 2026
Merged

matt-edmondson merged 1 commit into
mainfrom
claude/project-thread-kicv7a

Conversation

@matt-edmondson

Copy link
Copy Markdown
Contributor

Requested by Matt · project thread

Before: in cultures whose negative sign is U+2212 (sv-SE, nb-NO, fi-FI on ICU) a slider resting just below zero read "−0,00" and the typing box opened with U+2212. With ImGui's default font, or an atlas built from reduced or default ranges, every negative value drew the missing-glyph box.

After: "-0" is dropped in every culture, the typing box always gets a hyphen, the face writes U+2212 when the font has it and a hyphen when it doesn't, and the reduced ranges FontMemoryGuard falls back to include U+2212.

How: ValueSliderState.Format measures a leading hyphen, U+2212 or the culture's NegativeSign, and rewrites a kept sign as a hyphen. Display takes the sign to write; ValueSlider passes U+2212 only when ImGui.GetFont().IsGlyphInFont says the font has it. AddEssentialSymbols adds U+2212 explicitly, since its loop skips every other code point.

Tests: unit tests for a built U+2212 culture (plus a real sv-SE one, inconclusive where the runtime has no culture data) and for the hyphen fallback; a reduced-ranges test in InterfaceFontTests; and two UI tests that read the slider's draw list, one with the bundled Nerd Font (U+2212 drawn) and one with ImGui's default font (hyphen drawn, no fallback glyph), the second failing without the fix. WidgetTest.Start gains an onStart hook for registering the font. Locally: ImGui.App.Tests, ImGui.Widgets.Tests, ImGui.Widgets.UITests and ImGuiWidgetsDemo.UITests all pass.

Closes #647
Closes #648


Generated by Claude Code

…d font

Format and Display now recognise the culture's own negative sign (U+2212 on ICU
for sv-SE, nb-NO and fi-FI), so "-0" is still dropped and the typing box always
gets a hyphen. The face falls back to a hyphen when the current font has no
U+2212, and the reduced font ranges now include it.

Closes #647
Closes #648

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SsRr8z8hXLPW8TfAQWKiDk
@matt-edmondson matt-edmondson self-assigned this Oct 25, 2026
@matt-edmondson
matt-edmondson merged commit 2f655e3 into main Oct 25, 2026
9 checks passed
@matt-edmondson
matt-edmondson deleted the claude/project-thread-kicv7a branch October 25, 2026 12:45
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants