Closed withoutboats closed 8 years ago
gtktsm contains this comment:
/*
* There is no way to check whether a font is a monospace font.
* Moreover, there is no "monospace extents" field of fonts that we can
* use to calculate a suitable cell size. Any bounding-boxes provided
* by the fonts are mostly useless for cell-size computations.
* Therefore, we simply render a bunch of ASCII characters and compute
* the cell-size from these. If you passed a monospace font, it will
* work out greatly. If you passed some other font, you will get a
* suitable tradeoff (well, don't do that..).
*/
Excellent. This looks like a great example of what we want to do, thanks!
Font extents work correctly now!
We need to know the dimensions of the visible area of the terminal in terms of characters for a variety of use cases. Currently, we attempt to derive this information from the
FontExtents
struct of the cairo library, which has several fields.However, the information presented by this struct is not the information we actually want, and it results in weird dimensions in several ways - opening
vim
in the scaffolding terminal is a good demonstration of the issue.If someone could figure out how to derive from a cairo canvas or a font the actual dimensions of a character in that font, that would be really helpful. Assuming a monospace font is fine.