summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-06-27 15:23:03 +0200
committerQt by Nokia <qt-info@nokia.com>2011-06-27 16:52:31 +0200
commit06c20891c12fd1089f7c41138fd50c6b26fdda69 (patch)
tree1db0d733ea7f114794b2eb9ebc262d374758bfae
parente3172080a2e39ce0f76764ce1aef873642666a79 (diff)
Add missing APIs to QRawFont and some additional notes to fromFont
Change-Id: I8487a2e32f5b71a1eb51dcb8540cb5de2def09f6 Reviewed-on: http://codereview.qt.nokia.com/769 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
-rw-r--r--src/gui/text/qrawfont.cpp27
-rw-r--r--src/gui/text/qrawfont.h2
2 files changed, 29 insertions, 0 deletions
diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp
index 71762df09f..4c65ad5de0 100644
--- a/src/gui/text/qrawfont.cpp
+++ b/src/gui/text/qrawfont.cpp
@@ -393,6 +393,30 @@ qreal QRawFont::unitsPerEm() const
}
/*!
+ Returns the thickness for drawing lines (underline, overline, etc.)
+ along with text drawn in this font.
+ */
+qreal QRawFont::lineThickness() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->lineThickness().toReal();
+}
+
+/*!
+ Returns the position from baseline for drawing underlines below the text
+ rendered with this font.
+ */
+qreal QRawFont::underlinePosition() const
+{
+ if (!isValid())
+ return 0.0;
+
+ return d->fontEngine->underlinePosition().toReal();
+}
+
+/*!
Returns the family name of this QRawFont.
*/
QString QRawFont::familyName() const
@@ -652,6 +676,9 @@ extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSyst
/*!
Fetches the physical representation based on a \a font query. The physical font returned is
the font that will be preferred by Qt in order to display text in the selected \a writingSystem.
+
+ \warning This function is potentially expensive and should not be called in performance
+ sensitive code.
*/
QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem)
{
diff --git a/src/gui/text/qrawfont.h b/src/gui/text/qrawfont.h
index aca33af127..d517c9ad7a 100644
--- a/src/gui/text/qrawfont.h
+++ b/src/gui/text/qrawfont.h
@@ -111,6 +111,8 @@ public:
qreal xHeight() const;
qreal averageCharWidth() const;
qreal maxCharWidth() const;
+ qreal lineThickness() const;
+ qreal underlinePosition() const;
qreal unitsPerEm() const;