From 7c1c0ca0d25f9b8158f9e66d496ea69e23e77a45 Mon Sep 17 00:00:00 2001 From: handa Date: Tue, 6 Nov 2007 04:44:29 +0000 Subject: [PATCH] (ft_open): Keep rfont's metrics in 26.6 fixed pixels. (ft_find_metric): Adjust glyph's metrics. (ft_encapsulate): Keep rfont's metrics in 26.6 fixed pixels. (ft_drive_otf): Set mark glyph's xadv to 0. --- src/font-ft.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/font-ft.c b/src/font-ft.c index 2786550..8701d3f 100644 --- a/src/font-ft.c +++ b/src/font-ft.c @@ -1541,9 +1541,9 @@ ft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) rfont->driver = &mfont__ft_driver; rfont->info = ft_rfont; rfont->fontp = ft_face; - rfont->ascent = ft_face->size->metrics.ascender >> 6; - rfont->descent = - ft_face->size->metrics.descender >> 6; - rfont->max_advance = ft_face->size->metrics.max_advance >> 6; + rfont->ascent = ft_face->size->metrics.ascender; + rfont->descent = - ft_face->size->metrics.descender; + rfont->max_advance = ft_face->size->metrics.max_advance; rfont->baseline_offset = 0; rfont->x_ppem = ft_face->size->metrics.x_ppem; rfont->y_ppem = ft_face->size->metrics.y_ppem; @@ -1554,16 +1554,16 @@ ft_open (MFrame *frame, MFont *font, MFont *spec, MRealizedFont *rfont) if (! FT_IS_SCALABLE (ft_face) && FT_Get_BDF_Property (ft_face, "_MULE_BASELINE_OFFSET", &prop) == 0) { - rfont->baseline_offset = prop.u.integer; - rfont->ascent += prop.u.integer; - rfont->descent -= prop.u.integer; + rfont->baseline_offset = prop.u.integer << 6; + rfont->ascent += prop.u.integer << 6; + rfont->descent -= prop.u.integer << 6; } } #endif /* HAVE_FTBDF_H */ if (FT_IS_SCALABLE (ft_face)) rfont->average_width = 0; else - rfont->average_width = ft_face->available_sizes->width; + rfont->average_width = ft_face->available_sizes->width << 6; rfont->next = MPLIST_VAL (frame->realized_font_list); MPLIST_VAL (frame->realized_font_list) = rfont; MDEBUG_PRINT (" ok\n"); @@ -1634,8 +1634,9 @@ ft_find_metric (MRealizedFont *rfont, MGlyphString *gstring, g->g.ascent = metrics->horiBearingY; g->g.descent = metrics->height - metrics->horiBearingY; } - g->g.ascent += rfont->baseline_offset >> 6; - g->g.descent -= rfont->baseline_offset >> 6; + g->g.yadv = 0; + g->g.ascent += rfont->baseline_offset; + g->g.descent -= rfont->baseline_offset; g->g.measured = 1; } } @@ -2119,7 +2120,7 @@ ft_encapsulate (MFrame *frame, MSymbol data_type, void *data) if (FT_IS_SCALABLE (ft_face)) rfont->average_width = 0; else - rfont->average_width = ft_face->available_sizes->width; + rfont->average_width = ft_face->available_sizes->width << 6; rfont->next = MPLIST_VAL (frame->realized_font_list); MPLIST_VAL (frame->realized_font_list) = rfont; @@ -2441,6 +2442,8 @@ ft_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, adjustment[i].xoff = (base_x - mark_x); adjustment[i].yoff = - (base_y - mark_y); adjustment[i].back = (g - prev); + adjustment[i].xadv = 0; + adjustment[i].advance_is_absolute = 1; adjustment[i].set = 1; } } -- 1.7.10.4