mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-11 13:39:55 +02:00
System/Libraries/Graphics2D: Chop 16px off X2 max pos in @get_truetype_text_width()
This is a quick and dirty hack to compensate for artifacts at the far right edge of the font rasterization buffer. Chopping off 16px allows us to get the proper width of the rasterized text.
This commit is contained in:
@@ -1172,6 +1172,7 @@ I64 @get_truetype_text_width(U8* font_name, I64 size, U8* text)
|
||||
CDC* dc = DCNew(Display.Width(), (size * 2));
|
||||
Free(dc->body);
|
||||
dc->body = @stbtt_RenderText(font, dc->width_internal, dc->height, ToI64(size * 1.2), text);
|
||||
dc->width -= 16;
|
||||
res = X2Pos(dc) - X1Pos(dc);
|
||||
DCDel(dc);
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user