10
66
Fork
You've already forked fcft
14

Some questions on the usage of this library... #117

Open
opened 2026年04月06日 21:03:32 +02:00 by EAfton · 0 comments

Thank you, @dnkl, for this library, I am a contributor who is trying to improve the GUI code of a certain big-name open source library using your work. However a few questions are on my mind...

  1. What is the best way of querying text extents? I am currently just looping over the glyphs, adding the x advance onto a "width" variable and doing h = max(h, (font->ascent - glyph->y + glyph->height)) for this, sometimes the calculated bounding box is noticeably off, especially in width, compared to what I am measuring with an image editor.

  2. How do I calculate the perfect ascender value for a glyph array so I can perfectly position text? Using the one in the font struct as shown in the docs does work, but it often slides down a bit compared to what I am expecting, I had a similar issue with the X11 core fonts system, I fixed it by using the ascent field in the XCharStruct returned by XTextExtents rather than using the font ascent.

I would appreciate any help!

Thank you, @dnkl, for this library, I am a contributor who is trying to improve the GUI code of a certain big-name open source library using your work. However a few questions are on my mind... 1. What is the best way of querying text extents? I am currently just looping over the glyphs, adding the x advance onto a "width" variable and doing h = max(h, (font->ascent - glyph->y + glyph->height)) for this, sometimes the calculated bounding box is noticeably off, especially in width, compared to what I am measuring with an image editor. 2. How do I calculate the perfect ascender value for a glyph array so I can perfectly position text? Using the one in the font struct as shown in the docs does work, but it often slides down a bit compared to what I am expecting, I had a similar issue with the X11 core fonts system, I fixed it by using the ascent field in the XCharStruct returned by XTextExtents rather than using the font ascent. I would appreciate any help!
Sign in to join this conversation.
No Branch/Tag specified
master
colrv1
releases/3.3
rasterize-utf8
spacing
releases/3.2
releases/3.1
releases/3.0
releases/2.5
releases/2.4
releases/2.3
releases/2.2
releases/2.1
releases/2.0
releases/1.0
3.3.3
3.3.2
3.3.1
3.3.0
3.2.0
3.1.10
3.1.9
3.1.8
3.1.7
3.1.6
3.1.5
3.1.4
3.1.3
3.1.2
3.1.1
3.1.0
3.0.1
3.0.0
2.5.1
2.5.0
2.4.6
2.4.5
2.4.4
2.4.3
2.4.2
2.4.1
2.4.0
2.3.3
2.3.2
2.3.1
2.3.0
2.2.92
2.2.91
2.2.90
2.2.7
2.2.6
2.2.5
2.2.4
2.2.3
2.2.2
2.2.1
2.2.0
2.1.3
2.1.2
2.1.1
2.1.0
2.0.0
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.1
1.0.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.5
0.3.4
0.3.3
0.3.2
0.3.1
0.3.0
0.2.0
0.1.1
0.1.0
0.0.0
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
dnkl/fcft#117
Reference in a new issue
dnkl/fcft
No description provided.
Delete branch "%!s()"

Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?