Skip to content
Discussion options

You must be logged in to vote

Ok, thanks to your answer, I dug in a bit more.

What happens in the galley layout code is that each character is aligned to a pixel so that it renders clearly, so the actual achieved spacing (what I call the stride) is, on average, a bit off, and ends up being an integer.

So, the floating point glyph.advance_width (what the font metrics you linked to yields, many thanks!!!) is the ideal advance width; the slight rounding off of each glyph's pos.x causes the actual advance width to be an integer. Here, at the moment, glyph.advance_width is 8.639999, and the "stride" measured by the above code is 9.000000. Using the stride works perfectly for char cell <-> cursor X mapping So, I'll keep the…

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by barries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants