summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont.h
diff options
context:
space:
mode:
authorJiang Jiang <jiang.jiang@nokia.com>2011-06-04 12:47:22 (GMT)
committerJiang Jiang <jiang.jiang@nokia.com>2011-06-10 11:13:11 (GMT)
commitae9cc6c29521f1b597c3120f638d125892cdd593 (patch)
tree24992ca1539efdb1c6fd0c4752d4de3f153d5b68 /src/gui/text/qfont.h
parentf541c78e1bc5b293466b40e6f10496199a4a5d73 (diff)
downloadQt-ae9cc6c29521f1b597c3120f638d125892cdd593.zip
Qt-ae9cc6c29521f1b597c3120f638d125892cdd593.tar.gz
Qt-ae9cc6c29521f1b597c3120f638d125892cdd593.tar.bz2
Allow selecting fonts with irregular style names
Fonts like "Helvetica Neue UltraLight" or "Skia Regular Black Condensed" can't be selected in Qt because either they don't report correct numeric values for weight/stretch/etc. or these values are not mapped from QFont enums in a linear way. Thus we provide a shortcut to select these fonts with PostScript name or full name without resorting to family name matching in QFontDatabase (these fonts are not registered in font database anyway). After this, we can simply use: QFont font("Helvetica Neue"); font.setStyleName("UltraLight"); to select these fonts. QCoreTextFontEngineMulti matched like this can be created directly from the CTFontRef instance instead of creating from the font name, making this process faster. The commit also cleaned up the font loading process in Mac font database a bit, moving the code for family matching into a separate function. Add QFontInfo::styleName() and QRawFont::styleName() to access the resolved style name for a font. Task-number: QTBUG-19366 Change-Id: Iad07768c02ed06cc8d6b7395dec554384f410506 Reviewed-on: http://codereview.qt.nokia.com/333 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Jiang Jiang <jiang.jiang@nokia.com> (cherry picked from commit 97391be5ebddc62545ddb88f92fc2045bfa10711)
Diffstat (limited to 'src/gui/text/qfont.h')
-rw-r--r--src/gui/text/qfont.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index 7636ecf..14f290c 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -156,7 +156,8 @@ public:
LetterSpacingResolved = 0x2000,
WordSpacingResolved = 0x4000,
HintingPreferenceResolved = 0x8000,
- AllPropertiesResolved = 0xffff
+ StyleNameResolved = 0x10000,
+ AllPropertiesResolved = 0x1ffff
};
QFont();
@@ -168,6 +169,9 @@ public:
QString family() const;
void setFamily(const QString &);
+ QString styleName() const;
+ void setStyleName(const QString &);
+
int pointSize() const;
void setPointSize(int);
qreal pointSizeF() const;