summaryrefslogtreecommitdiff
path: root/src/gui/font.h
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-24 09:51:50 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:14 -0300
commitd32452950262b4ec2b50b0e0af66f7870c8e5d5d (patch)
treed2122f2dd6cd5d415a4986619ad47d30506c78d8 /src/gui/font.h
parentf6738c7edfff2249e0b13f2a76962f45d02c86bb (diff)
downloadpardes-d32452950262b4ec2b50b0e0af66f7870c8e5d5d.tar.gz
pardes-d32452950262b4ec2b50b0e0af66f7870c8e5d5d.zip
Embolden bold text's outline before it is rasterized, and drop the old stb_truetype sources
Bold in the SDL shell was a smear of the finished glyph: every pixel took the larger of itself and three quarters of its left neighbour. That added a grey fringe on the right of each stem instead of a thicker stem, so bold read as blurred regular text, and at large sizes it barely read as bold at all. The rasterizer now does what Ghostty's FreeType face does: it loads the hinted glyph, thickens the outline with FT_Outline_Embolden, and renders that. The stems widen as one shape with hinted edges, and the advance is untouched, so the cell grid, caret and selection do not move. The strength is Ghostty's heuristic, 1/32 of the line height rounded up (one pixel at a 32 px line). A bitmap strike has no outline; it is widened by one whole pixel with FT_Bitmap_Embolden, the classic overstrike. Underline and strikethrough are still drawn into the cached cell mask (decorateLine). vendor/stb (stb_truetype.h and its implementation unit) was left over from the rasterizer FreeType replaced; nothing built or referenced it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Diffstat (limited to 'src/gui/font.h')
-rw-r--r--src/gui/font.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gui/font.h b/src/gui/font.h
index d965b418..4410bb7c 100644
--- a/src/gui/font.h
+++ b/src/gui/font.h
@@ -33,14 +33,16 @@ void ui_font_cell_metrics(UIFont *f, float px, int32_t *cell_w, int32_t *cell_h,
// Rasterize `cp` into `out` as a hinted grayscale cell mask (`stride` bytes per
// row). The origin is the baseline `ascent` pixels from the top. Pixels outside
// the glyph are zero. Missing codepoints render the face's .notdef glyph.
+// `bold` emboldens the outline before rendering (synthetic bold, same advance).
// Returns 1 when the glyph produced coverage, 0 for blank/error.
-int ui_font_raster(UIFont *f, float px, int32_t cp, uint8_t *out,
+int ui_font_raster(UIFont *f, float px, int32_t cp, int bold, uint8_t *out,
int32_t stride, int32_t cell_w, int32_t cell_h,
int32_t ascent);
// Center bitmap ink bounds, independent of advance and baseline bearings.
-int ui_font_raster_centered(UIFont *f, float px, int32_t cp, uint8_t *out,
- int32_t stride, int32_t width, int32_t height);
+int ui_font_raster_centered(UIFont *f, float px, int32_t cp, int bold,
+ uint8_t *out, int32_t stride, int32_t width,
+ int32_t height);
void ui_font_free(UIFont *f);