FreeTypeのベースラインあわせでかなりハマッタのでメモ

描画したいy座標 - bitmap_top


チュートリアルのどこかに書いてあったんかなぁ。
英語力がたりん・・・。


[追記]
ここにかいてありました。

6のbの最後あたりのパラグラフ。

Once you have a bitmapped glyph image, you can access it directly through glyph->bitmap (a simple bitmap descriptor), and position it through glyph->bitmap_left and glyph->bitmap_top.

Note that bitmap_left is the horizontal distance from the current pen position to the leftmost border of the glyph bitmap, while bitmap_top is the vertical distance from the pen position (on the baseline) to the topmost border of the glyph bitmap. It is positive to indicate an upwards distance.

http://freetype.sourceforge.net/freetype2/docs/tutorial/step1.html

GDIで書く場合、ペンの位置をフォントの左上の位置
(このサイトで言うtmAscent-gmGlyphOrigine.yの位置 http://marupeke296.com/WINT_GetGlyphOutline.html)
に持っていかなきゃならんのですが、
FreeTypeの場合、何もしなくてもペンの位置がベースラインにあります。
ただ、このままだと複数文字をラスタライズした場合に、
各々の文字でビットマップサイズが違うため、ベースラインがずれてしまいます。
それをあわせるために、bitmap_topプロパティで調整してやる必要がある、ということらしい。


色んなところいじってあわんなー、思ってたらそりゃあわんわorz