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:
parent
0d303b0134
commit
d60fc53798
1 changed files with 1 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue