英文:
Freetype correct positioning of letters and undestanding freetype FT_Face parameters
问题
我正在使用Freetype将文本光栅化到图像中,我能够正确获取字符,但没有考虑字符是否应该放置在比“正常”水平更低的位置。Freetype的FT_Face
中是否有任何参数可以告诉我这一点。
这是正常光栅化(正确)和我的示例。
英文:
Im using Freetype for rastering text into a image, im getting the letters correctly but Im not taking into account if the letters should be putted lower than the "normal" level. Is there any parameter in the FT_Face
of Freetype that tells me this.
答案1
得分: 3
你正在寻找FT_GlyphSlotRec
中的 bitmap_top
变量。它告诉你字形顶部距离基线多少像素。
在 FT_GlyphSlot
中还有更多与布局相关的变量,因此您可能希望确保没有忽略任何您应该注意的变量,比如 advance
,它告诉您应该移动多少像素的 1/64,以到达下一个字形,以及 bitmap_left
,我认为它告诉你字形位置右侧的位图应该从哪里开始。
英文:
You're looking for the bitmap_top
variable in the FT_GlyphSlotRec
. It tells you how many pixels above the baseline the top of the glyph should be.
There are more layout-related variables in FT_GlyphSlot so you might want to make sure you're not ignoring any that you should be paying attention to, such as the advance
, which tells you how many 1/64ths of pixels you should move to the next glyph, and the bitmap_left
, which (I think) tells you how many pixels to the right of the glyph position the bitmap should start.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论