Use screen metrics instead of ideal metrics to compute glyph extents. --- commit 09390f6d3fe5b8d53e69a145791d3f67633bface tree 063c314c6c748975db94f9a3016ebf9cdb24f136 parent ff04370b771797f1619eb1776b427782e418538c author Brian Ewins Mon, 18 Dec 2006 03:10:12 +0000 committer Brian Ewins Mon, 18 Dec 2006 03:10:12 +0000 src/cairo-atsui-font.c | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index d24dd16..e1fffe2 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -377,28 +377,30 @@ _cairo_atsui_font_init_glyph_metrics (ca cairo_text_extents_t extents; OSStatus err; GlyphID theGlyph = _cairo_scaled_glyph_index (scaled_glyph); - ATSGlyphIdealMetrics metricsH, metricsV; - ATSUStyle style; + ATSGlyphScreenMetrics metricsH, metricsV; + ATSUStyle style,style1; ATSUVerticalCharacterType verticalType = kATSUStronglyVertical; const ATSUAttributeTag theTag[] = { kATSUVerticalCharacterTag }; const ByteCount theSizes[] = { sizeof(verticalType) }; ATSUAttributeValuePtr theValues[] = { &verticalType }; + double xscale; + double yscale; + + _cairo_matrix_compute_scale_factors(&font->base.scale, &xscale, &yscale, 1); - ATSUCreateAndCopyStyle(font->unscaled_style, &style); + ATSUCreateAndCopyStyle(font->style, &style); - err = ATSUGlyphGetIdealMetrics(style, - 1, &theGlyph, 0, &metricsH); + err = ATSUGlyphGetScreenMetrics(style, + 1, &theGlyph, 0, false, false, &metricsH); err = ATSUSetAttributes(style, 1, theTag, theSizes, theValues); - err = ATSUGlyphGetIdealMetrics(style, - 1, &theGlyph, 0, &metricsV); - - extents.x_bearing = metricsH.sideBearing.x; - extents.y_bearing = metricsV.advance.y; - extents.width = - metricsH.advance.x - metricsH.sideBearing.x - metricsH.otherSideBearing.x; - extents.height = - -metricsV.advance.y - metricsV.sideBearing.y - metricsV.otherSideBearing.y; - extents.x_advance = metricsH.advance.x; + err = ATSUGlyphGetScreenMetrics(style, + 1, &theGlyph, 0, false, false, &metricsV); + + extents.width = metricsH.width/xscale; + extents.height = metricsH.height/yscale; + extents.x_bearing = metricsH.sideBearing.x/xscale; + extents.y_bearing = metricsV.sideBearing.y/yscale - extents.height; + extents.x_advance = metricsH.deviceAdvance.x/xscale; extents.y_advance = 0; _cairo_scaled_glyph_set_metrics (scaled_glyph,