Implement TTF_SetFontCharSpacing()#578
Conversation
This lets configure an optional uniform character spacing, that is applied after each drawn glyph in addition to the normal glyph's advance.
Ctrl + , - decreases character spacing Ctrl + . - increases character spacing
d61f630 to
94049fd
Compare
|
I think 1 glyph isn't one character in all languages. HarfBuzz should do the letter-spacing .. |
|
Looks good, thanks! |
Oh, that's a really good point. @ivan-mogilko, can you take a look at this? |
Right, I was wondering about ligatures too... @slouken , on a separate note, there was another mine PR (#538) opened few months ago made for SDL2 branch, but there was no update to it for a while. Should I also remake this on the main branch instead? |
We're not planning to add new functions to the SDL2 API at this point. Separately from that, I was concerned that people might be confused about which function they should call to get measurement information, and I haven't sat down and thoroughly thought it through. Could you provide a use case for this? |
Resolves #561
This is an experimental proposal, which adds an optional uniform character spacing, applied after each drawn glyph in addition to the normal glyph's advance. Spacing may be both positive or negative. Setting this to 0 ensures that the font is drawn using only its kerning.
Two new functions declared as:
Character spacing value is in pixels on input, but stored as a 26.6 FP in the TTF_Font struct, for compatibility with GlyphPosition's fields. When calculating glyph positions, "char_spacing" is added to each pos's x_advance.
Additionally, added two new key controls to the "showfont" example:
Ctrl + , - decreases character spacing
Ctrl + . - increases character spacing