FreeType正确定位字母和理解FreeType FT_Face参数

huangapple go评论91阅读模式
英文:

Freetype correct positioning of letters and undestanding freetype FT_Face parameters

问题

我正在使用Freetype将文本光栅化到图像中,我能够正确获取字符,但没有考虑字符是否应该放置在比“正常”水平更低的位置。Freetype的FT_Face中是否有任何参数可以告诉我这一点。

这是正常光栅化(正确)和我的示例。

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.

Here is an example of the normal raster (correct) and mine.
FreeType正确定位字母和理解FreeType FT_Face参数

答案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.

huangapple
  • 本文由 发表于 2023年3月7日 20:22:44
  • 转载请务必保留本文链接:https://go.coder-hub.com/75661923.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定