Repository navigation
[patch] Keep a value slider's minus sign readable in every culture and font - #728
Merged
Merged
Conversation
…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
|
This was referenced Oct 26, 2026
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.



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
FontMemoryGuardfalls back to include U+2212.How:
ValueSliderState.Formatmeasures a leading hyphen, U+2212 or the culture'sNegativeSign, and rewrites a kept sign as a hyphen.Displaytakes the sign to write;ValueSliderpasses U+2212 only whenImGui.GetFont().IsGlyphInFontsays the font has it.AddEssentialSymbolsadds 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.Startgains anonStarthook 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