FreeType - help me understand the glyph advance.y property

I am learning the basics of the FreeType API for use in OpenGL, and I'm confused about one thing. You download the font, and then each glyph is loaded one at a time into the glyph slot. A glyph has several fields, including advance , which has a field x and a y . Now I understand that it is indicated that y not used much, but if I use a situation in which y is used, I do not understand that each character is displayed in isolation in the glyph slot, since the glyph can know that all subsequent should characters be displayed with a certain fractional offset? What if you have to make a lot of the same character in a row? Wouldn't you end the slow diagonal slope or reduce your final text block?

+5
source share
1 answer

Historically, advance.y is mainly used for vertical text, for example, used in Asia ( FT_LOAD_VERTICAL_LAYOUT calls it.) In the normal rendering case, you should not get non-zero values ​​for advance.x and advance.y at the same time.

But it is also useful to use Freetype in a more general way. If you want to write Latin vertical text with an inclined angle of 30 Β°, you can still use the same structures: you apply (via FT_Set_Transform ) a 30 Β° inclination matrix to each glyph, but also to the progress vector; and the result will indeed have a diagonal slope; as expected!

+1
source

Source: https://habr.com/ru/post/1213552/


All Articles