font: pango: fix vertical alignment of non-ASCII glyphs
authorChang Liu <cl91tp@gmail.com>
Sat, 9 Mar 2013 11:26:48 +0000 (12:26 +0100)
committerDavid Herrmann <dh.herrmann@gmail.com>
Sat, 9 Mar 2013 11:26:48 +0000 (12:26 +0100)
pango_ft2_render_layout_line() requires the baseline offset as argument,
not the vertical extent of the glyphs. This is important as we currently
align glyphs to the bottom edge instead of the baseline.

Fix this by passing the cached baseline offset so all glyphs are correctly
aligned to the baseline. We then clip according to the cell-extents as
usual.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
src/font_pango.c

index c2954c6..0964123 100644 (file)
@@ -199,7 +199,7 @@ static int get_glyph(struct face *face, struct kmscon_glyph **out,
        bitmap.pixel_mode = FT_PIXEL_MODE_GRAY;
        bitmap.buffer = glyph->buf.data;
 
-       pango_ft2_render_layout_line(&bitmap, line, -rec.x, -rec.y);
+       pango_ft2_render_layout_line(&bitmap, line, -rec.x, face->baseline);
 
        pthread_mutex_lock(&face->glyph_lock);
        ret = shl_hashtable_insert(face->glyphs, (void*)(long)id, glyph);