src/gui/text/qfontengine.cpp
branchRCL_3
changeset 7 3f74d0d4af4c
parent 5 d3bac044e0f0
--- a/src/gui/text/qfontengine.cpp	Mon Mar 15 12:43:09 2010 +0200
+++ b/src/gui/text/qfontengine.cpp	Thu Apr 08 14:19:33 2010 +0300
@@ -379,6 +379,15 @@
     Q_ASSERT(positions.size() == glyphs_out.size());
 }
 
+void QFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
+{
+    glyph_metrics_t gi = boundingBox(glyph);
+    bool isValid = gi.isValid();
+    if (leftBearing != 0)
+        *leftBearing = isValid ? gi.x.toReal() : 0.0;
+    if (rightBearing != 0)
+        *rightBearing = isValid ? (gi.xoff - gi.x - gi.width).toReal() : 0.0;
+}
 
 glyph_metrics_t QFontEngine::tightBoundingBox(const QGlyphLayout &glyphs)
 {
@@ -1385,6 +1394,12 @@
     return overall;
 }
 
+void QFontEngineMulti::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing)
+{
+    int which = highByte(glyph);
+    engine(which)->getGlyphBearings(stripped(glyph), leftBearing, rightBearing);
+}
+
 void QFontEngineMulti::addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs,
                                         QPainterPath *path, QTextItem::RenderFlags flags)
 {