Add ghostel-glyph-scale-floor: configurable minimum glyph scale#302
Merged
Conversation
Closes dakra#298. Adds a buffer-local defcustom `ghostel-glyph-scale-floor` (number, 0.0–1.0, default 0.0) that clamps the computed glyph scale from below. At 0.0 the existing strict-grid behavior is unchanged; at 1.0 CJK and other fallback glyphs render at natural font size, at the cost of slightly taller rows when fallback metrics exceed the primary cell. Being buffer-local means different ghostel buffers can use different settings independently. Implementation: - One @max in adjustGlyph (Renderer.zig) after the existing @min - FontInfo carries glyph_scale_floor so a change triggers a full viewport invalidation without an extra symbol-value call per cell - emacs.zig gains asFloat(val, default) which uses (numberp)+(float) to coerce integers to f64 and avoids a wrong-type-argument signal corrupting the env's non-local exit state; std.math.clamp enforces the [0.0, 1.0] range on the Zig side - updateFontInfo fast-path keeps env.eq as the outer gate so the nil-font case (no font before, no font now) correctly returns false - ERT test: ghostel-test-glyph-scale-floor-clamps-scale verifies the floor prevents shrinking below 1.0
|
I just wanted to let you know that it works for me. (I had to fix the codesign issue in the brach) |
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.

Closes #298.
Summary
Adds a buffer-local
defcustom ghostel-glyph-scale-floor(number, 0.0–1.0, default0.0) that clamps the computed glyph scale from below inadjustGlyph.0.0(default) the existing strict-grid behavior is completely unchanged.1.0CJK and other fallback glyphs render at natural font size, at the cost of slightly taller rows when fallback metrics exceed the primary cell size.0.9prevents shrinking below 90% while still correcting grossly oversized glyphs.Being buffer-local means different ghostel buffers (a TUI session vs. a plain shell) can use different settings independently.
Implementation notes
@maxinadjustGlyph(Renderer.zig) after the existing@minFontInfocarriesglyph_scale_floorso a floor change triggers a full viewport invalidation without an extrasymbol-valuecall per cellemacs.ziggainsasFloat(val, default)which uses(numberp)+(float)to safely coerce integers tof64, avoiding awrong-type-argumentsignal that would corrupt the env's non-local exit state;std.math.clampenforces the[0.0, 1.0]range on the Zig side regardless of what is set programmaticallyupdateFontInfokeepsenv.eqas the outer gate so the nil-font case (no font before, no font now) correctly returns false and doesn't trigger a spurious force-full redrawghostel-test-glyph-scale-floor-clamps-scalefeeds a glyph larger than the cell with floor1.0and asserts it is not shrunk