mirror of
https://github.com/JannisHeydemann/BoredOS.git
synced 2026-05-30 10:26:59 +00:00
FIX: cpuinfo stack overflow and add GUI tab character support
This commit is contained in:
@@ -330,6 +330,13 @@ int font_manager_get_string_width_scaled(ttf_font_t *font, const char *s, float
|
||||
while (*s) {
|
||||
int advance, lsb;
|
||||
uint32_t codepoint = utf8_decode(&s);
|
||||
|
||||
if (codepoint == '\t') {
|
||||
stbtt_GetCodepointHMetrics(info, ' ', &advance, &lsb);
|
||||
width += (int)(advance * real_scale + 0.5f) * 4;
|
||||
continue;
|
||||
}
|
||||
|
||||
stbtt_fontinfo *current_info = info;
|
||||
float current_scale = real_scale;
|
||||
|
||||
@@ -350,6 +357,12 @@ int font_manager_get_codepoint_width_scaled(ttf_font_t *font, uint32_t codepoint
|
||||
stbtt_fontinfo *info = (stbtt_fontinfo *)font->info;
|
||||
float real_scale = stbtt_ScaleForPixelHeight(info, scale);
|
||||
|
||||
if (codepoint == '\t') {
|
||||
int advance, lsb;
|
||||
stbtt_GetCodepointHMetrics(info, ' ', &advance, &lsb);
|
||||
return (int)(advance * real_scale + 0.5f) * 4;
|
||||
}
|
||||
|
||||
if (stbtt_FindGlyphIndex(info, codepoint) == 0 && fallback_font) {
|
||||
info = (stbtt_fontinfo *)fallback_font->info;
|
||||
real_scale = stbtt_ScaleForPixelHeight(info, scale);
|
||||
|
||||
Reference in New Issue
Block a user