Use screen metrics instead of ideal metrics to compute glyph extents. --- commit 4ddcef32faee1f997c304cb60eacdd5b0496388c tree 5c6fffe7fb9506e584f47c1a8d6d63d1d684d92a parent e3b7a707d4562c308b97a0ec2662ae5a7d3a2272 author Brian Ewins Mon, 18 Dec 2006 02:45:58 +0000 committer Brian Ewins Mon, 18 Dec 2006 02:45:58 +0000 src/cairo-atsui-font.c | 33 ++++++++++++++++++--------------- 1 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/cairo-atsui-font.c b/src/cairo-atsui-font.c index d24dd16..4c9a8cf 100644 --- a/src/cairo-atsui-font.c +++ b/src/cairo-atsui-font.c @@ -377,28 +377,31 @@ _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.height = metricsH.height/yscale; + extents.x_advance = metricsH.deviceAdvance.x/xscale; extents.y_advance = 0; _cairo_scaled_glyph_set_metrics (scaled_glyph,