Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
font: Reimplement font::get_max_height() using Pango
A few caveats: * This implementation allows configuring the font family class and style to select the correct font for any given context. The default values are equivalent to what was being done in the SDL_ttf-based version, but not future-proof. Users like the GUI2 textbox should make use of the new optional parameters to select a more relevant font going forward (not part of this commit). * Pango has a line height metric, equivalent to SDL_ttf's TTF_FontLineSkip(). However, this is not what we want here -- the ascender + descender formula is intended to give us a neat box where the tallest glyph can fit, not the minimum distance between baselines. This is important for the GUI2 textbox in particular. * The internal implementation uses the default text renderer and sets relevant parameters. This should not introduce new issues, but if it does then that means someone is not resetting the renderer properly before using it. This notably rids GUI2 of its one known dependency on SDL_ttf.
- Loading branch information
Showing
4 changed files
with
52 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters