diff options
-rw-r--r-- | src/gui/doc/src/richtext.qdoc | 3 | ||||
-rw-r--r-- | src/gui/text/qcssparser.cpp | 16 | ||||
-rw-r--r-- | src/gui/text/qcssparser_p.h | 1 |
3 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/doc/src/richtext.qdoc b/src/gui/doc/src/richtext.qdoc index a0f739d418..a8ba076e3d 100644 --- a/src/gui/doc/src/richtext.qdoc +++ b/src/gui/doc/src/richtext.qdoc @@ -1197,6 +1197,9 @@ \row \li \c text-transform \li [ uppercase | lowercase ] \li Select the transformation that will be performed on the text prior to displaying it. + \row \li \c font-kerning + \li [ normal | none ] + \li Enables or disables kerning between text characters. \row \li \c font-variant \li small-caps \li Perform the smallcaps transformation on the text prior to displaying it. diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 70623939e1..e604062356 100644 --- a/src/gui/text/qcssparser.cpp +++ b/src/gui/text/qcssparser.cpp @@ -115,6 +115,7 @@ static const QCssKnownValue properties[NumProperties - 1] = { { "float", Float }, { "font", Font }, { "font-family", FontFamily }, + { "font-kerning", FontKerning }, { "font-size", FontSize }, { "font-style", FontStyle }, { "font-variant", FontVariant }, @@ -368,6 +369,7 @@ static inline bool isInheritable(Property propertyId) { switch (propertyId) { case Font: + case FontKerning: case FontFamily: case FontSize: case FontStyle: @@ -1142,6 +1144,19 @@ static bool setFontStyleFromValue(const QCss::Value &value, QFont *font) return false; } +static bool setFontKerningFromValue(const QCss::Value &value, QFont *font) +{ + if (value.type != Value::KnownIdentifier) + return false ; + switch (value.variant.toInt()) { + case Value_Normal: font->setKerning(true); return true; + case Value_None: font->setKerning(false); return true; + case Value_Auto: return true; + default: break; + } + return false; +} + static bool setFontWeightFromValue(const QCss::Value &value, QFont *font) { if (value.type == Value::KnownIdentifier) { @@ -1274,6 +1289,7 @@ bool ValueExtractor::extractFont(QFont *font, int *fontSizeAdjustment) case FontStyle: setFontStyleFromValue(val, font); break; case FontWeight: setFontWeightFromValue(val, font); break; case FontFamily: setFontFamilyFromValues(decl.d->values, font); break; + case FontKerning: setFontKerningFromValue(val, font); break; case TextDecoration: setTextDecorationFromValues(decl.d->values, font); break; case Font: parseShorthandFontProperty(decl.d->values, font, fontSizeAdjustment); break; case FontVariant: setFontVariantFromValue(val, font); break; diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h index c1594531ea..8f992f8c59 100644 --- a/src/gui/text/qcssparser_p.h +++ b/src/gui/text/qcssparser_p.h @@ -195,6 +195,7 @@ enum Property { QtListNumberSuffix, LineHeight, QtLineHeightType, + FontKerning, NumProperties }; |