Add support font-kerning CSS3 property

Change-Id: Ie3894481ded40d20091bd0103ac426c1086f943f
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2018-04-24 13:59:08 +02:00
parent cdbebe6280
commit e8fd992849
3 changed files with 20 additions and 0 deletions

View File

@ -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.

View File

@ -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;

View File

@ -195,6 +195,7 @@ enum Property {
QtListNumberSuffix,
LineHeight,
QtLineHeightType,
FontKerning,
NumProperties
};