summaryrefslogtreecommitdiffstats
path: root/src/gui/text
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-05-02 12:13:06 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-05-02 13:15:59 (GMT)
commit2c8df8bfb679885c3cbd2ee02f5e4053fdd554c2 (patch)
treedcf216e681ec5812364bbd6e5a6ae472b4e44759 /src/gui/text
parent18122b473ecbd85ba953f70743b1756358bf7c0c (diff)
downloadQt-2c8df8bfb679885c3cbd2ee02f5e4053fdd554c2.zip
Qt-2c8df8bfb679885c3cbd2ee02f5e4053fdd554c2.tar.gz
Qt-2c8df8bfb679885c3cbd2ee02f5e4053fdd554c2.tar.bz2
Add required font metrics functions to QRawFont
Reviewed-by: Eskil
Diffstat (limited to 'src/gui/text')
-rw-r--r--src/gui/text/qrawfont.cpp52
-rw-r--r--src/gui/text/qrawfont.h4
2 files changed, 56 insertions, 0 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 1bce909..46c892c 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -302,6 +302,58 @@ qreal QRawFont::descent() const
}
/*!
+ Returns the xHeight of this QRawFont in pixel units.
+
+ \sa QFontMetricsF::xHeight()
+*/
+qreal QRawFont::xHeight() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->xHeight().toReal();
+}
+
+/*!
+ Returns the leading of this QRawFont in pixel units.
+
+ \sa QFontMetricsF::leading()
+*/
+qreal QRawFont::leading() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->leading().toReal();
+}
+
+/*!
+ Returns the average character width of this QRawFont in pixel units.
+
+ \sa QFontMetricsF::averageCharWidth()
+*/
+qreal QRawFont::averageCharWidth() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->averageCharWidth().toReal();
+}
+
+/*!
+ Returns the width of the widest character in the font.
+
+ \sa QFontMetricsF::maxWidth()
+*/
+qreal QRawFont::maxCharWidth() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->maxCharWidth();
+}
+
+/*!
Returns the pixel size set for this QRawFont. The pixel size affects how glyphs are
rasterized, the size of glyphs returned by pathForGlyph(), and is used to convert
internal metrics from design units to logical pixel units.
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index 56aeefc..900c07a 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -103,6 +103,10 @@ public:
qreal ascent() const;
qreal descent() const;
+ qreal leading() const;
+ qreal xHeight() const;
+ qreal averageCharWidth() const;
+ qreal maxCharWidth() const;
qreal unitsPerEm() const;