You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Would it be possible to add functionality for centering text inside a rect both vertically and horizontally?
Right now when you use FC_DrawBox with FC_ALIGN_CENTER it only centers the text horizontally inside the rect you provide.
What do you think about renaming FC_ALIGN_CENTER to FC_ALIGN_CENTERH, and adding FC_ALIGN_CENTERV? Then the new FC_ALIGN_CENTER would then center both vertically and horizontally while the other two would do one or the other.
To do the vertical alignmentent of text inside a rect I guess you would first need to know the total number of lines that are in the text. Then use that number to calculate the y position to start drawing the lines.
The text was updated successfully, but these errors were encountered:
Vertical alignment would be nice. I think I had held off on implementing it because I hadn't fixed the font metrics (and still haven't). The vertical measurement of the font (i.e. FC_GetHeight()) isn't actually right. It returns something bigger than the full height of the glyphs and doesn't quite match the ascent+descent that I would expect. If I remember correctly, I traced this back to something SDL_ttf was doing (in TTF_FontHeight()), but I haven't looked at it in a long time.
As for the interface, I think the vertical alignment could be an extra parameter for FC_Effect. Adding it would affect only that struct and FC_MakeEffect().
Would it be possible to add functionality for centering text inside a rect both vertically and horizontally?
Right now when you use FC_DrawBox with FC_ALIGN_CENTER it only centers the text horizontally inside the rect you provide.
What do you think about renaming FC_ALIGN_CENTER to FC_ALIGN_CENTERH, and adding FC_ALIGN_CENTERV? Then the new FC_ALIGN_CENTER would then center both vertically and horizontally while the other two would do one or the other.
To do the vertical alignmentent of text inside a rect I guess you would first need to know the total number of lines that are in the text. Then use that number to calculate the y position to start drawing the lines.
The text was updated successfully, but these errors were encountered: