View Single Post
Old February 1, 2019, 22:26   #70
t4nk
Swordsman
 
Join Date: May 2016
Posts: 330
t4nk is on a distinguished road
Quote:
Originally Posted by Bandobras View Post
My ttf (that is WOFF) font doesn't lie about its size, I hope.
It not really a lie... as the Freetype maintainer likes to explain, the only REAL way to determine font size in pixels is to render all glyphs For example, I recall DejaVuSansMono does leave stray pixels (at some sizes).

Quote:
Anyway, I handle scalable fonts by always creating a black texture of the nominal size and pasting the texture I got from sdl2-ttf in the center, cutting off any portions that stick out. In this way I get no border and no stray pixels after wiping out previous glyphs.
Very reasonable idea. I decided to add borders to (most) glyphs because I didn't want to "lose data", but I didn't consider that one-pixel borders would actually add up to a rather big number of wasted pixels... Getting rid of them would allow to display several more lines/columns (or use bigger font size with the same term size)... yeah, I really should be cropping glyphs instead. Thanks!
t4nk is offline   Reply With Quote