diff options
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qabstracttextdocumentlayout.h | 2 | ||||
-rw-r--r-- | src/gui/text/qcssparser.cpp | 62 | ||||
-rw-r--r-- | src/gui/text/qcssparser_p.h | 1 | ||||
-rw-r--r-- | src/gui/text/qcssscanner.cpp | 847 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 132 | ||||
-rw-r--r-- | src/gui/text/qfont.h | 12 | ||||
-rw-r--r-- | src/gui/text/qfont_p.h | 4 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 54 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtextformat.cpp | 23 | ||||
-rw-r--r-- | src/gui/text/qtextformat.h | 6 | ||||
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 3 | ||||
-rw-r--r-- | src/gui/text/qtextodfwriter.cpp | 2 |
14 files changed, 648 insertions, 504 deletions
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index 8fea27f772..3371401420 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -143,7 +143,9 @@ public: virtual void drawObject(QPainter *painter, const QRectF &rect, QTextDocument *doc, int posInDocument, const QTextFormat &format) = 0; }; +#ifndef Q_CLANG_QDOC Q_DECLARE_INTERFACE(QTextObjectInterface, "org.qt-project.Qt.QTextObjectInterface") +#endif QT_END_NAMESPACE diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp index 325fd26a31..91fa40eddf 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: @@ -721,7 +723,8 @@ static ColorData parseColorValue(QCss::Value v) if (lst.count() != 2) return ColorData(); - if ((lst.at(0).compare(QLatin1String("palette"), Qt::CaseInsensitive)) == 0) { + const QString &identifier = lst.at(0); + if ((identifier.compare(QLatin1String("palette"), Qt::CaseInsensitive)) == 0) { int role = findKnownValue(lst.at(1).trimmed(), values, NumKnownValues); if (role >= Value_FirstColorRole && role <= Value_LastColorRole) return (QPalette::ColorRole)(role-Value_FirstColorRole); @@ -729,8 +732,16 @@ static ColorData parseColorValue(QCss::Value v) return ColorData(); } - bool rgb = lst.at(0).startsWith(QLatin1String("rgb")); - bool rgba = lst.at(0).startsWith(QLatin1String("rgba")); + const bool rgb = identifier.startsWith(QLatin1String("rgb")); + const bool hsv = !rgb && identifier.startsWith(QLatin1String("hsv")); + const bool hsl = !rgb && !hsv && identifier.startsWith(QLatin1String("hsl")); + + if (!rgb && !hsv && !hsl) + return ColorData(); + + const bool hasAlpha = identifier.size() == 4 && identifier.at(3) == QLatin1Char('a'); + if (identifier.size() > 3 && !hasAlpha) + return ColorData(); Parser p(lst.at(1)); if (!p.testExpr()) @@ -743,7 +754,8 @@ static ColorData parseColorValue(QCss::Value v) for (int i = 0; i < qMin(tokenCount, 7); i += 2) { if (colorDigits.at(i).type == Value::Percentage) { - colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (255. / 100.); + const qreal maxRange = (rgb || i != 0) ? 255. : 359.; + colorDigits[i].variant = colorDigits.at(i).variant.toReal() * (maxRange / 100.); colorDigits[i].type = Value::Number; } else if (colorDigits.at(i).type != Value::Number) { return ColorData(); @@ -754,20 +766,29 @@ static ColorData parseColorValue(QCss::Value v) if (tokenCount < 5) return ColorData(); + // ### Qt6: replace this with a check and return invalid color when token count does not match + if (hasAlpha && tokenCount != 7) + qWarning("QCssParser::parseColorValue: Specified color with alpha value but no alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' ')))); + if (!hasAlpha && tokenCount != 5) + qWarning("QCssParser::parseColorValue: Specified color without alpha value but alpha given: '%s'", qPrintable(lst.join(QLatin1Char(' ')))); + int v1 = colorDigits.at(0).variant.toInt(); int v2 = colorDigits.at(2).variant.toInt(); int v3 = colorDigits.at(4).variant.toInt(); int alpha = 255; - if (tokenCount >= 7) { + if (tokenCount == 7) { int alphaValue = colorDigits.at(6).variant.toInt(); - if (rgba && alphaValue <= 1) + if (alphaValue <= 1) alpha = colorDigits.at(6).variant.toReal() * 255.; else alpha = alphaValue; } - return rgb ? QColor::fromRgb(v1, v2, v3, alpha) - : QColor::fromHsv(v1, v2, v3, alpha); + if (rgb) + return QColor::fromRgb(v1, v2, v3, alpha); + if (hsv) + return QColor::fromHsv(v1, v2, v3, alpha); + return QColor::fromHsl(v1, v2, v3, alpha); } static QColor colorFromData(const ColorData& c, const QPalette &pal) @@ -1142,6 +1163,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) { @@ -1166,11 +1200,13 @@ static bool setFontWeightFromValue(const QCss::Value &value, QFont *font) static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *font, int start = 0) { QString family; + QStringList families; bool shouldAddSpace = false; for (int i = start; i < values.count(); ++i) { const QCss::Value &v = values.at(i); if (v.type == Value::TermOperatorComma) { - family += QLatin1Char(','); + families << family; + family.clear(); shouldAddSpace = false; continue; } @@ -1182,9 +1218,12 @@ static bool setFontFamilyFromValues(const QVector<QCss::Value> &values, QFont *f family += str; shouldAddSpace = true; } - if (family.isEmpty()) + if (!family.isEmpty()) + families << family; + if (families.isEmpty()) return false; - font->setFamily(family); + font->setFamily(families.at(0)); + font->setFamilies(families); return true; } @@ -1274,6 +1313,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 }; diff --git a/src/gui/text/qcssscanner.cpp b/src/gui/text/qcssscanner.cpp index 33dc01c8bc..d48cbb71d7 100644 --- a/src/gui/text/qcssscanner.cpp +++ b/src/gui/text/qcssscanner.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2018 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -37,7 +37,7 @@ ** ****************************************************************************/ -// auto generated. DO NOT EDIT. +// auto generated by qtbase/util/lexgen/. DO NOT EDIT. class QCssScanner_Generated { public: @@ -75,23 +75,23 @@ int QCssScanner_Generated::lex() // initial state ch = next(); if (ch.unicode() >= 9 && ch.unicode() <= 10) - goto state_1; + goto state_4; if (ch.unicode() >= 12 && ch.unicode() <= 13) - goto state_1; + goto state_4; if (ch.unicode() == 32) - goto state_1; + goto state_4; if (ch.unicode() == 33) { token = QCss::EXCLAMATION_SYM; goto found; } if (ch.unicode() == 34) - goto state_3; + goto state_2; if (ch.unicode() == 35) - goto state_4; + goto state_1; if (ch.unicode() == 36) - goto state_5; - if (ch.unicode() == 39) goto state_6; + if (ch.unicode() == 39) + goto state_5; if (ch.unicode() == 40) { token = QCss::LPAREN; goto found; @@ -101,17 +101,17 @@ int QCssScanner_Generated::lex() goto found; } if (ch.unicode() == 42) - goto state_9; + goto state_8; if (ch.unicode() == 43) - goto state_10; + goto state_7; if (ch.unicode() == 44) - goto state_11; + goto state_14; if (ch.unicode() == 45) - goto state_12; - if (ch.unicode() == 46) goto state_13; + if (ch.unicode() == 46) + goto state_12; if (ch.unicode() == 47) - goto state_14; + goto state_11; if (ch.unicode() >= 48 && ch.unicode() <= 57) goto state_15; if (ch.unicode() == 58) { @@ -123,64 +123,56 @@ int QCssScanner_Generated::lex() goto found; } if (ch.unicode() == 60) - goto state_18; + goto state_20; if (ch.unicode() == 61) { token = QCss::EQUAL; goto found; } if (ch.unicode() == 62) - goto state_20; + goto state_18; if (ch.unicode() == 64) - goto state_21; + goto state_26; if (ch.unicode() == 91) { token = QCss::LBRACKET; goto found; } if (ch.unicode() == 92) - goto state_23; + goto state_30; if (ch.unicode() == 93) { token = QCss::RBRACKET; goto found; } if (ch.unicode() == 94) - goto state_25; + goto state_28; if (ch.unicode() == 95) - goto state_26; + goto state_21; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_26; + goto state_21; if (ch.unicode() == 123) - goto state_27; + goto state_22; if (ch.unicode() == 124) - goto state_28; + goto state_25; if (ch.unicode() == 125) { token = QCss::RBRACE; goto found; } if (ch.unicode() == 126) - goto state_30; + goto state_23; goto out; state_1: - lastAcceptingPos = pos; - token = QCss::S; ch = next(); - if (ch.unicode() >= 9 && ch.unicode() <= 10) - goto state_31; - if (ch.unicode() >= 12 && ch.unicode() <= 13) + if (ch.unicode() == 45) goto state_31; - if (ch.unicode() == 32) + if (ch.unicode() >= 48 && ch.unicode() <= 57) goto state_31; - if (ch.unicode() == 43) - goto state_10; - if (ch.unicode() == 44) - goto state_11; - if (ch.unicode() == 62) - goto state_20; - if (ch.unicode() == 123) - goto state_27; - if (ch.unicode() == 126) + if (ch.unicode() == 92) goto state_32; + if (ch.unicode() == 95) + goto state_31; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_31; goto out; - state_3: + state_2: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); @@ -204,93 +196,101 @@ int QCssScanner_Generated::lex() goto state_33; goto out; state_4: + lastAcceptingPos = pos; + token = QCss::S; ch = next(); - if (ch.unicode() == 45) - goto state_36; - if (ch.unicode() >= 48 && ch.unicode() <= 57) + if (ch.unicode() >= 9 && ch.unicode() <= 10) goto state_36; - if (ch.unicode() == 92) - goto state_37; - if (ch.unicode() == 95) + if (ch.unicode() >= 12 && ch.unicode() <= 13) goto state_36; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + if (ch.unicode() == 32) goto state_36; + if (ch.unicode() == 43) + goto state_7; + if (ch.unicode() == 44) + goto state_14; + if (ch.unicode() == 62) + goto state_18; + if (ch.unicode() == 123) + goto state_22; + if (ch.unicode() == 126) + goto state_37; goto out; state_5: - ch = next(); - if (ch.unicode() == 61) { - token = QCss::ENDSWITH; - goto found; - } - goto out; - state_6: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; + goto state_38; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; - state_9: - lastAcceptingPos = pos; - token = QCss::STAR; + state_6: ch = next(); if (ch.unicode() == 61) { - token = QCss::CONTAINS; + token = QCss::ENDSWITH; goto found; } goto out; - state_10: + state_7: lastAcceptingPos = pos; token = QCss::PLUS; goto out; + state_8: + lastAcceptingPos = pos; + token = QCss::STAR; + ch = next(); + if (ch.unicode() == 61) { + token = QCss::CONTAINS; + goto found; + } + goto out; state_11: lastAcceptingPos = pos; - token = QCss::COMMA; + token = QCss::SLASH; + ch = next(); + if (ch.unicode() == 42) { + token = handleCommentStart(); + goto found; + } goto out; state_12: lastAcceptingPos = pos; + token = QCss::DOT; + ch = next(); + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_44; + goto out; + state_13: + lastAcceptingPos = pos; token = QCss::MINUS; ch = next(); if (ch.unicode() == 45) - goto state_43; + goto state_45; if (ch.unicode() == 92) - goto state_23; + goto state_30; if (ch.unicode() == 95) - goto state_26; + goto state_21; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_26; - goto out; - state_13: - lastAcceptingPos = pos; - token = QCss::DOT; - ch = next(); - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_44; + goto state_21; goto out; state_14: lastAcceptingPos = pos; - token = QCss::SLASH; - ch = next(); - if (ch.unicode() == 42) { - token = handleCommentStart(); - goto found; - } + token = QCss::COMMA; goto out; state_15: lastAcceptingPos = pos; @@ -299,68 +299,70 @@ int QCssScanner_Generated::lex() if (ch.unicode() == 37) goto state_46; if (ch.unicode() == 45) - goto state_47; - if (ch.unicode() == 46) goto state_48; + if (ch.unicode() == 46) + goto state_47; if (ch.unicode() >= 48 && ch.unicode() <= 57) goto state_49; if (ch.unicode() == 92) - goto state_50; - if (ch.unicode() == 95) goto state_51; + if (ch.unicode() == 95) + goto state_50; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_51; + goto state_50; goto out; state_18: + lastAcceptingPos = pos; + token = QCss::GREATER; + goto out; + state_20: ch = next(); if (ch.unicode() == 33) goto state_52; goto out; - state_20: - lastAcceptingPos = pos; - token = QCss::GREATER; - goto out; state_21: + lastAcceptingPos = pos; + token = QCss::IDENT; ch = next(); - if (ch.unicode() == 45) + if (ch.unicode() == 40) goto state_53; - if (ch.unicode() == 92) + if (ch.unicode() == 45) goto state_54; - if (ch.unicode() == 95) + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_54; + if (ch.unicode() == 92) goto state_55; + if (ch.unicode() == 95) + goto state_54; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_55; + goto state_54; + goto out; + state_22: + lastAcceptingPos = pos; + token = QCss::LBRACE; goto out; state_23: + lastAcceptingPos = pos; + token = QCss::TILDE; ch = next(); - if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_56; - if (ch.unicode() == 11) - goto state_56; - if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_56; - if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_56; - if (ch.unicode() >= 103) - goto state_56; + if (ch.unicode() == 61) { + token = QCss::INCLUDES; + goto found; + } goto out; state_25: + lastAcceptingPos = pos; + token = QCss::OR; ch = next(); if (ch.unicode() == 61) { - token = QCss::BEGINSWITH; + token = QCss::DASHMATCH; goto found; } goto out; state_26: - lastAcceptingPos = pos; - token = QCss::IDENT; ch = next(); - if (ch.unicode() == 40) - goto state_58; if (ch.unicode() == 45) - goto state_59; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_59; + goto state_58; if (ch.unicode() == 92) goto state_60; if (ch.unicode() == 95) @@ -368,52 +370,53 @@ int QCssScanner_Generated::lex() if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) goto state_59; goto out; - state_27: - lastAcceptingPos = pos; - token = QCss::LBRACE; - goto out; state_28: - lastAcceptingPos = pos; - token = QCss::OR; ch = next(); if (ch.unicode() == 61) { - token = QCss::DASHMATCH; + token = QCss::BEGINSWITH; goto found; } goto out; state_30: - lastAcceptingPos = pos; - token = QCss::TILDE; ch = next(); - if (ch.unicode() == 61) { - token = QCss::INCLUDES; - goto found; - } + if (ch.unicode() >= 1 && ch.unicode() <= 9) + goto state_62; + if (ch.unicode() == 11) + goto state_62; + if (ch.unicode() >= 14 && ch.unicode() <= 47) + goto state_62; + if (ch.unicode() >= 58 && ch.unicode() <= 96) + goto state_62; + if (ch.unicode() >= 103) + goto state_62; goto out; state_31: lastAcceptingPos = pos; - token = QCss::S; + token = QCss::HASH; ch = next(); - if (ch.unicode() >= 9 && ch.unicode() <= 10) - goto state_31; - if (ch.unicode() >= 12 && ch.unicode() <= 13) - goto state_31; - if (ch.unicode() == 32) - goto state_31; - if (ch.unicode() == 43) - goto state_10; - if (ch.unicode() == 44) - goto state_11; - if (ch.unicode() == 62) - goto state_20; - if (ch.unicode() == 123) - goto state_27; - if (ch.unicode() == 126) - goto state_32; + if (ch.unicode() == 45) + goto state_63; + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_63; + if (ch.unicode() == 92) + goto state_64; + if (ch.unicode() == 95) + goto state_63; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_63; goto out; state_32: - lastAcceptingPos = pos; - token = QCss::TILDE; + ch = next(); + if (ch.unicode() >= 1 && ch.unicode() <= 9) + goto state_65; + if (ch.unicode() == 11) + goto state_65; + if (ch.unicode() >= 14 && ch.unicode() <= 47) + goto state_65; + if (ch.unicode() >= 58 && ch.unicode() <= 96) + goto state_65; + if (ch.unicode() >= 103) + goto state_65; goto out; state_33: lastAcceptingPos = pos; @@ -445,78 +448,75 @@ int QCssScanner_Generated::lex() state_35: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_63; + goto state_66; if (ch.unicode() == 10) - goto state_64; + goto state_67; if (ch.unicode() == 11) - goto state_63; + goto state_66; if (ch.unicode() == 12) - goto state_65; + goto state_69; if (ch.unicode() == 13) - goto state_66; + goto state_68; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_63; + goto state_66; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_63; + goto state_66; if (ch.unicode() >= 103) - goto state_63; + goto state_66; goto out; state_36: lastAcceptingPos = pos; - token = QCss::HASH; + token = QCss::S; ch = next(); - if (ch.unicode() == 45) - goto state_67; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_67; - if (ch.unicode() == 92) - goto state_68; - if (ch.unicode() == 95) - goto state_67; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_67; + if (ch.unicode() >= 9 && ch.unicode() <= 10) + goto state_36; + if (ch.unicode() >= 12 && ch.unicode() <= 13) + goto state_36; + if (ch.unicode() == 32) + goto state_36; + if (ch.unicode() == 43) + goto state_7; + if (ch.unicode() == 44) + goto state_14; + if (ch.unicode() == 62) + goto state_18; + if (ch.unicode() == 123) + goto state_22; + if (ch.unicode() == 126) + goto state_37; goto out; state_37: - ch = next(); - if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_69; - if (ch.unicode() == 11) - goto state_69; - if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_69; - if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_69; - if (ch.unicode() >= 103) - goto state_69; + lastAcceptingPos = pos; + token = QCss::TILDE; goto out; - state_39: + state_38: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; + goto state_38; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; - state_40: + state_39: lastAcceptingPos = pos; token = QCss::STRING; goto out; - state_41: + state_40: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) goto state_70; @@ -525,9 +525,9 @@ int QCssScanner_Generated::lex() if (ch.unicode() == 11) goto state_70; if (ch.unicode() == 12) - goto state_72; - if (ch.unicode() == 13) goto state_73; + if (ch.unicode() == 13) + goto state_72; if (ch.unicode() >= 14 && ch.unicode() <= 47) goto state_70; if (ch.unicode() >= 58 && ch.unicode() <= 96) @@ -535,13 +535,6 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 103) goto state_70; goto out; - state_43: - ch = next(); - if (ch.unicode() == 62) { - token = QCss::CDC; - goto found; - } - goto out; state_44: lastAcceptingPos = pos; token = QCss::NUMBER; @@ -549,15 +542,22 @@ int QCssScanner_Generated::lex() if (ch.unicode() == 37) goto state_46; if (ch.unicode() == 45) - goto state_47; + goto state_48; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_75; + goto state_74; if (ch.unicode() == 92) - goto state_50; - if (ch.unicode() == 95) goto state_51; + if (ch.unicode() == 95) + goto state_50; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_51; + goto state_50; + goto out; + state_45: + ch = next(); + if (ch.unicode() == 62) { + token = QCss::CDC; + goto found; + } goto out; state_46: lastAcceptingPos = pos; @@ -565,17 +565,17 @@ int QCssScanner_Generated::lex() goto out; state_47: ch = next(); - if (ch.unicode() == 92) - goto state_50; - if (ch.unicode() == 95) - goto state_51; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_51; + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_44; goto out; state_48: ch = next(); - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_44; + if (ch.unicode() == 92) + goto state_51; + if (ch.unicode() == 95) + goto state_50; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_50; goto out; state_49: lastAcceptingPos = pos; @@ -584,45 +584,45 @@ int QCssScanner_Generated::lex() if (ch.unicode() == 37) goto state_46; if (ch.unicode() == 45) - goto state_47; - if (ch.unicode() == 46) goto state_48; + if (ch.unicode() == 46) + goto state_47; if (ch.unicode() >= 48 && ch.unicode() <= 57) goto state_49; if (ch.unicode() == 92) - goto state_50; - if (ch.unicode() == 95) goto state_51; + if (ch.unicode() == 95) + goto state_50; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_51; + goto state_50; goto out; state_50: + lastAcceptingPos = pos; + token = QCss::LENGTH; ch = next(); - if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_76; - if (ch.unicode() == 11) + if (ch.unicode() == 45) goto state_76; - if (ch.unicode() >= 14 && ch.unicode() <= 47) + if (ch.unicode() >= 48 && ch.unicode() <= 57) goto state_76; - if (ch.unicode() >= 58 && ch.unicode() <= 96) + if (ch.unicode() == 92) + goto state_77; + if (ch.unicode() == 95) goto state_76; - if (ch.unicode() >= 103) + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) goto state_76; goto out; state_51: - lastAcceptingPos = pos; - token = QCss::LENGTH; ch = next(); - if (ch.unicode() == 45) - goto state_77; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_77; - if (ch.unicode() == 92) + if (ch.unicode() >= 1 && ch.unicode() <= 9) + goto state_78; + if (ch.unicode() == 11) + goto state_78; + if (ch.unicode() >= 14 && ch.unicode() <= 47) + goto state_78; + if (ch.unicode() >= 58 && ch.unicode() <= 96) + goto state_78; + if (ch.unicode() >= 103) goto state_78; - if (ch.unicode() == 95) - goto state_77; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_77; goto out; state_52: ch = next(); @@ -630,15 +630,27 @@ int QCssScanner_Generated::lex() goto state_79; goto out; state_53: + lastAcceptingPos = pos; + token = QCss::FUNCTION; + goto out; + state_54: + lastAcceptingPos = pos; + token = QCss::IDENT; ch = next(); - if (ch.unicode() == 92) + if (ch.unicode() == 40) + goto state_53; + if (ch.unicode() == 45) goto state_54; - if (ch.unicode() == 95) + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_54; + if (ch.unicode() == 92) goto state_55; + if (ch.unicode() == 95) + goto state_54; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_55; + goto state_54; goto out; - state_54: + state_55: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) goto state_80; @@ -651,7 +663,16 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 103) goto state_80; goto out; - state_55: + state_58: + ch = next(); + if (ch.unicode() == 92) + goto state_60; + if (ch.unicode() == 95) + goto state_59; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_59; + goto out; + state_59: lastAcceptingPos = pos; token = QCss::ATKEYWORD_SYM; ch = next(); @@ -666,58 +687,80 @@ int QCssScanner_Generated::lex() if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) goto state_81; goto out; - state_56: + state_60: + ch = next(); + if (ch.unicode() >= 1 && ch.unicode() <= 9) + goto state_83; + if (ch.unicode() == 11) + goto state_83; + if (ch.unicode() >= 14 && ch.unicode() <= 47) + goto state_83; + if (ch.unicode() >= 58 && ch.unicode() <= 96) + goto state_83; + if (ch.unicode() >= 103) + goto state_83; + goto out; + state_62: lastAcceptingPos = pos; token = QCss::IDENT; ch = next(); if (ch.unicode() == 40) - goto state_58; + goto state_53; if (ch.unicode() == 45) - goto state_59; + goto state_54; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_59; + goto state_54; if (ch.unicode() == 92) - goto state_60; + goto state_55; if (ch.unicode() == 95) - goto state_59; + goto state_54; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_59; - goto out; - state_58: - lastAcceptingPos = pos; - token = QCss::FUNCTION; + goto state_54; goto out; - state_59: + state_63: lastAcceptingPos = pos; - token = QCss::IDENT; + token = QCss::HASH; ch = next(); - if (ch.unicode() == 40) - goto state_58; if (ch.unicode() == 45) - goto state_59; + goto state_63; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_59; + goto state_63; if (ch.unicode() == 92) - goto state_60; + goto state_64; if (ch.unicode() == 95) - goto state_59; + goto state_63; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_59; + goto state_63; goto out; - state_60: + state_64: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_83; + goto state_84; if (ch.unicode() == 11) - goto state_83; + goto state_84; if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_83; + goto state_84; if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_83; + goto state_84; if (ch.unicode() >= 103) - goto state_83; + goto state_84; goto out; - state_63: + state_65: + lastAcceptingPos = pos; + token = QCss::HASH; + ch = next(); + if (ch.unicode() == 45) + goto state_63; + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_63; + if (ch.unicode() == 92) + goto state_64; + if (ch.unicode() == 95) + goto state_63; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_63; + goto out; + state_66: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); @@ -740,7 +783,7 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 123) goto state_33; goto out; - state_64: + state_67: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); @@ -763,12 +806,14 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 123) goto state_33; goto out; - state_65: + state_68: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) goto state_33; + if (ch.unicode() == 10) + goto state_85; if (ch.unicode() == 11) goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) @@ -786,14 +831,12 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 123) goto state_33; goto out; - state_66: + state_69: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) goto state_33; - if (ch.unicode() == 10) - goto state_84; if (ch.unicode() == 11) goto state_33; if (ch.unicode() >= 14 && ch.unicode() <= 33) @@ -811,191 +854,133 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 123) goto state_33; goto out; - state_67: - lastAcceptingPos = pos; - token = QCss::HASH; - ch = next(); - if (ch.unicode() == 45) - goto state_67; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_67; - if (ch.unicode() == 92) - goto state_68; - if (ch.unicode() == 95) - goto state_67; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_67; - goto out; - state_68: - ch = next(); - if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_85; - if (ch.unicode() == 11) - goto state_85; - if (ch.unicode() >= 14 && ch.unicode() <= 47) - goto state_85; - if (ch.unicode() >= 58 && ch.unicode() <= 96) - goto state_85; - if (ch.unicode() >= 103) - goto state_85; - goto out; - state_69: - lastAcceptingPos = pos; - token = QCss::HASH; - ch = next(); - if (ch.unicode() == 45) - goto state_67; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_67; - if (ch.unicode() == 92) - goto state_68; - if (ch.unicode() == 95) - goto state_67; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_67; - goto out; state_70: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; + goto state_38; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; state_71: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; + goto state_38; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; state_72: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; + goto state_38; + if (ch.unicode() == 10) + goto state_86; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; state_73: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; - if (ch.unicode() == 10) - goto state_86; + goto state_38; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; - state_75: + state_74: lastAcceptingPos = pos; token = QCss::NUMBER; ch = next(); if (ch.unicode() == 37) goto state_46; if (ch.unicode() == 45) - goto state_47; + goto state_48; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_75; + goto state_74; if (ch.unicode() == 92) - goto state_50; - if (ch.unicode() == 95) goto state_51; + if (ch.unicode() == 95) + goto state_50; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_51; + goto state_50; goto out; state_76: lastAcceptingPos = pos; token = QCss::LENGTH; ch = next(); if (ch.unicode() == 45) - goto state_77; + goto state_76; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_77; + goto state_76; if (ch.unicode() == 92) - goto state_78; - if (ch.unicode() == 95) - goto state_77; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_77; - goto out; - state_77: - lastAcceptingPos = pos; - token = QCss::LENGTH; - ch = next(); - if (ch.unicode() == 45) goto state_77; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_77; - if (ch.unicode() == 92) - goto state_78; if (ch.unicode() == 95) - goto state_77; + goto state_76; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_77; + goto state_76; goto out; - state_78: + state_77: ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) goto state_87; @@ -1008,6 +993,21 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 103) goto state_87; goto out; + state_78: + lastAcceptingPos = pos; + token = QCss::LENGTH; + ch = next(); + if (ch.unicode() == 45) + goto state_76; + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_76; + if (ch.unicode() == 92) + goto state_77; + if (ch.unicode() == 95) + goto state_76; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_76; + goto out; state_79: ch = next(); if (ch.unicode() == 45) { @@ -1017,18 +1017,20 @@ int QCssScanner_Generated::lex() goto out; state_80: lastAcceptingPos = pos; - token = QCss::ATKEYWORD_SYM; + token = QCss::IDENT; ch = next(); + if (ch.unicode() == 40) + goto state_53; if (ch.unicode() == 45) - goto state_81; + goto state_54; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_81; + goto state_54; if (ch.unicode() == 92) - goto state_82; + goto state_55; if (ch.unicode() == 95) - goto state_81; + goto state_54; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_81; + goto state_54; goto out; state_81: lastAcceptingPos = pos; @@ -1060,23 +1062,36 @@ int QCssScanner_Generated::lex() goto out; state_83: lastAcceptingPos = pos; - token = QCss::IDENT; + token = QCss::ATKEYWORD_SYM; ch = next(); - if (ch.unicode() == 40) - goto state_58; if (ch.unicode() == 45) - goto state_59; + goto state_81; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_59; + goto state_81; if (ch.unicode() == 92) - goto state_60; + goto state_82; if (ch.unicode() == 95) - goto state_59; + goto state_81; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_59; + goto state_81; goto out; state_84: lastAcceptingPos = pos; + token = QCss::HASH; + ch = next(); + if (ch.unicode() == 45) + goto state_63; + if (ch.unicode() >= 48 && ch.unicode() <= 57) + goto state_63; + if (ch.unicode() == 92) + goto state_64; + if (ch.unicode() == 95) + goto state_63; + if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) + goto state_63; + goto out; + state_85: + lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) @@ -1098,58 +1113,43 @@ int QCssScanner_Generated::lex() if (ch.unicode() >= 123) goto state_33; goto out; - state_85: - lastAcceptingPos = pos; - token = QCss::HASH; - ch = next(); - if (ch.unicode() == 45) - goto state_67; - if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_67; - if (ch.unicode() == 92) - goto state_68; - if (ch.unicode() == 95) - goto state_67; - if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_67; - goto out; state_86: lastAcceptingPos = pos; token = QCss::INVALID; ch = next(); if (ch.unicode() >= 1 && ch.unicode() <= 9) - goto state_39; + goto state_38; if (ch.unicode() == 11) - goto state_39; + goto state_38; if (ch.unicode() >= 14 && ch.unicode() <= 38) - goto state_39; + goto state_38; if (ch.unicode() == 39) - goto state_40; - if (ch.unicode() >= 40 && ch.unicode() <= 91) goto state_39; + if (ch.unicode() >= 40 && ch.unicode() <= 91) + goto state_38; if (ch.unicode() == 92) - goto state_41; + goto state_40; if (ch.unicode() >= 93 && ch.unicode() <= 96) - goto state_39; + goto state_38; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_39; + goto state_38; if (ch.unicode() >= 123) - goto state_39; + goto state_38; goto out; state_87: lastAcceptingPos = pos; token = QCss::LENGTH; ch = next(); if (ch.unicode() == 45) - goto state_77; + goto state_76; if (ch.unicode() >= 48 && ch.unicode() <= 57) - goto state_77; + goto state_76; if (ch.unicode() == 92) - goto state_78; - if (ch.unicode() == 95) goto state_77; + if (ch.unicode() == 95) + goto state_76; if ((ch.unicode() >= 'a' && ch.unicode() <= 'z') || (ch.unicode() >= 'A' && ch.unicode() <= 'Z') || ch.unicode() >= 256) - goto state_77; + goto state_76; goto out; state_89: lastAcceptingPos = pos; @@ -1176,4 +1176,3 @@ int QCssScanner_Generated::lex() } return token; } - diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 580a09427c..258a9ba675 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -116,7 +116,17 @@ bool QFontDef::exactMatch(const QFontDef &other) const if (stretch != 0 && other.stretch != 0 && stretch != other.stretch) return false; + if (families.size() != other.families.size()) + return false; + QString this_family, this_foundry, other_family, other_foundry; + for (int i = 0; i < families.size(); ++i) { + QFontDatabase::parseFontName(families.at(i), this_foundry, this_family); + QFontDatabase::parseFontName(other.families.at(i), other_foundry, other_family); + if (this_family != other_family || this_foundry != other_foundry) + return false; + } + QFontDatabase::parseFontName(family, this_foundry, this_family); QFontDatabase::parseFontName(other.family, other_foundry, other_family); @@ -261,6 +271,9 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) if (! (mask & QFont::FamilyResolved)) request.family = other->request.family; + if (!(mask & QFont::FamiliesResolved)) + request.families = other->request.families; + if (! (mask & QFont::StyleNameResolved)) request.styleName = other->request.styleName; @@ -340,7 +353,7 @@ QFontEngineData::~QFontEngineData() \class QFont \reentrant - \brief The QFont class specifies a font used for drawing text. + \brief The QFont class specifies a query for a font used for drawing text. \ingroup painting \ingroup appearance @@ -348,6 +361,7 @@ QFontEngineData::~QFontEngineData() \ingroup richtext-processing \inmodule QtGui + QFont can be regarded as a query for one or more fonts on the system. When you create a QFont object you specify various attributes that you want the font to have. Qt will use the font with the specified @@ -355,9 +369,15 @@ QFontEngineData::~QFontEngineData() matching installed font. The attributes of the font that is actually used are retrievable from a QFontInfo object. If the window system provides an exact match exactMatch() returns \c true. - Use QFontMetrics to get measurements, e.g. the pixel length of a + Use QFontMetricsF to get measurements, e.g. the pixel length of a string using QFontMetrics::width(). + Attributes which are not specifically set will not affect the font + selection algorithm, and default values will be preferred instead. + + To load a specific physical font, typically represented by a single file, + use QRawFont instead. + Note that a QGuiApplication instance must exist before a QFont can be used. You can set the application's default font with QGuiApplication::setFont(). @@ -390,8 +410,6 @@ QFontEngineData::~QFontEngineData() setStyleHint(). The default family (corresponding to the current style hint) is returned by defaultFamily(). - The font-matching algorithm has a lastResortFamily() and - lastResortFont() in cases where a suitable match cannot be found. You can provide substitutions for font family names using insertSubstitution() and insertSubstitutions(). Substitutions can be removed with removeSubstitutions(). Use substitute() to retrieve @@ -419,18 +437,21 @@ QFontEngineData::~QFontEngineData() \target fontmatching The font matching algorithm works as follows: \list 1 - \li The specified font family is searched for. - \li If not found, the styleHint() is used to select a replacement - family. - \li Each replacement font family is searched for. - \li If none of these are found or there was no styleHint(), "helvetica" - will be searched for. - \li If "helvetica" isn't found Qt will try the lastResortFamily(). - \li If the lastResortFamily() isn't found Qt will try the - lastResortFont() which will always return a name of some kind. + \li The specified font families (set by setFamilies()) are searched for. + \li If not found, then if set the specified font family exists and can be used to represent + the writing system in use, it will be selected. + \li If not, a replacement font that supports the writing system is + selected. The font matching algorithm will try to find the + best match for all the properties set in the QFont. How this is + done varies from platform to platform. + \li If no font exists on the system that can support the text, + then special "missing character" boxes will be shown in its place. \endlist - Note that the actual font matching algorithm varies from platform to platform. + \note If the selected font, though supporting the writing system in general, + is missing glyphs for one or more specific characters, then Qt will try to + find a fallback font for this or these particular characters. This feature + can be disabled using QFont::NoFontMerging style strategy. In Windows a request for the "Courier" font is automatically changed to "Courier New", an improved version of Courier that allows for smooth scaling. @@ -499,6 +520,7 @@ QFontEngineData::~QFontEngineData() individually and then considered resolved. \value FamilyResolved + \value FamiliesResolved \value SizeResolved \value StyleHintResolved \value StyleStrategyResolved @@ -1684,6 +1706,7 @@ bool QFont::operator<(const QFont &f) const if (r1.stretch != r2.stretch) return r1.stretch < r2.stretch; if (r1.styleHint != r2.styleHint) return r1.styleHint < r2.styleHint; if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy; + if (r1.families != r2.families) return r1.families < r2.families; if (r1.family != r2.family) return r1.family < r2.family; if (f.d->capital != d->capital) return f.d->capital < d->capital; @@ -2133,14 +2156,14 @@ void QFont::cacheStatistics() { } +#if QT_DEPRECATED_SINCE(5, 13) /*! \fn QString QFont::lastResortFamily() const - Returns the "last resort" font family name. + \obsolete - The current implementation tries a wide variety of common fonts, - returning the first one it finds. Is is possible that no family is - found in which case an empty string is returned. + This function is deprecated and is not in use by the font + selection algorithm in Qt 5. It always returns "helvetica". \sa lastResortFont() */ @@ -2148,6 +2171,7 @@ QString QFont::lastResortFamily() const { return QString::fromLatin1("helvetica"); } +#endif extern QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script); @@ -2169,34 +2193,63 @@ QString QFont::defaultFamily() const return QString(); } +#if QT_DEPRECATED_SINCE(5, 13) /*! \fn QString QFont::lastResortFont() const - Returns a "last resort" font name for the font matching algorithm. - This is used if the last resort family is not available. It will - always return a name, if necessary returning something like - "fixed" or "system". + \obsolete + + Deprecated function. Since Qt 5.0, this is not used by the font selection algorithm. For + compatibility it remains in the API, but will always return the same value as lastResortFamily(). +*/ +QString QFont::lastResortFont() const +{ + return lastResortFamily(); +} +#endif - The current implementation tries a wide variety of common fonts, - returning the first one it finds. The implementation may change - at any time, but this function will always return a string - containing something. +/*! + \since 5.13 - It is theoretically possible that there really isn't a - lastResortFont() in which case Qt will abort with an error - message. We have not been able to identify a case where this - happens. Please \l{bughowto.html}{report it as a bug} if - it does, preferably with a list of the fonts you have installed. + Returns the requested font family names, i.e. the names set in the last + setFamilies() call or via the constructor. Otherwise it returns an + empty list. - \sa lastResortFamily() + \sa setFamily(), setFamilies(), family(), substitutes(), substitute() */ -QString QFont::lastResortFont() const + +QStringList QFont::families() const { - qFatal("QFont::lastResortFont: Cannot find any reasonable font"); - // Shut compiler up - return QString(); + return d->request.families; } +/*! + \since 5.13 + + Sets the list of family names for the font. The names are case + insensitive and may include a foundry name. The first family in + \a families will be set as the main family for the font. + + Each family name entry in \a families may optionally also include a + foundry name, e.g. "Helvetica [Cronyx]". If the family is + available from more than one foundry and the foundry isn't + specified, an arbitrary foundry is chosen. If the family isn't + available a family will be set using the \l{QFont}{font matching} + algorithm. + + \sa family(), families(), setFamily(), setStyleHint(), QFontInfo +*/ + +void QFont::setFamilies(const QStringList &families) +{ + if ((resolve_mask & QFont::FamiliesResolved) && d->request.families == families) + return; + detach(); + d->request.families = families; + resolve_mask |= QFont::FamiliesResolved; +} + + /***************************************************************************** QFont stream functions *****************************************************************************/ @@ -2261,6 +2314,8 @@ QDataStream &operator<<(QDataStream &s, const QFont &font) s << (quint8)font.d->request.hintingPreference; if (s.version() >= QDataStream::Qt_5_6) s << (quint8)font.d->capital; + if (s.version() >= QDataStream::Qt_5_13) + s << font.d->request.families; return s; } @@ -2356,6 +2411,11 @@ QDataStream &operator>>(QDataStream &s, QFont &font) s >> value; font.d->capital = QFont::Capitalization(value); } + if (s.version() >= QDataStream::Qt_5_13) { + QStringList value; + s >> value; + font.d->request.families = value; + } return s; } diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 9c250c82c3..1fe450e002 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -164,7 +164,8 @@ public: WordSpacingResolved = 0x4000, HintingPreferenceResolved = 0x8000, StyleNameResolved = 0x10000, - AllPropertiesResolved = 0x1ffff + FamiliesResolved = 0x20000, + AllPropertiesResolved = 0x3ffff }; QFont(); @@ -179,6 +180,9 @@ public: QString family() const; void setFamily(const QString &); + QStringList families() const; + void setFamilies(const QStringList &); + QString styleName() const; void setStyleName(const QString &); @@ -282,8 +286,10 @@ public: static void cacheStatistics(); QString defaultFamily() const; - QString lastResortFamily() const; - QString lastResortFont() const; +#if QT_DEPRECATED_SINCE(5, 13) + QT_DEPRECATED QString lastResortFamily() const; + QT_DEPRECATED QString lastResortFont() const; +#endif QFont resolve(const QFont &) const; inline uint resolve() const { return resolve_mask; } diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 350ba7ce3c..09c18de5a6 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -78,6 +78,7 @@ struct QFontDef } QString family; + QStringList families; QString styleName; QStringList fallBackFamilies; @@ -109,6 +110,7 @@ struct QFontDef && styleStrategy == other.styleStrategy && ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch && family == other.family + && families == other.families && styleName == other.styleName && hintingPreference == other.hintingPreference ; @@ -122,6 +124,7 @@ struct QFontDef if (styleHint != other.styleHint) return styleHint < other.styleHint; if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy; if (family != other.family) return family < other.family; + if (families != other.families) return families < other.families; if (styleName != other.styleName) return styleName < other.styleName; if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference; @@ -144,6 +147,7 @@ inline uint qHash(const QFontDef &fd, uint seed = 0) Q_DECL_NOTHROW ^ qHash(fd.ignorePitch) ^ qHash(fd.fixedPitch) ^ qHash(fd.family, seed) + ^ qHash(fd.families, seed) ^ qHash(fd.styleName) ^ qHash(fd.hintingPreference) ; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 196eebb353..42e7871214 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -696,20 +696,20 @@ static QStringList familyList(const QFontDef &req) { // list of families to try QStringList family_list; - if (req.family.isEmpty()) - return family_list; - const auto list = req.family.splitRef(QLatin1Char(',')); - const int numFamilies = list.size(); - family_list.reserve(numFamilies); - for (int i = 0; i < numFamilies; ++i) { - QStringRef str = list.at(i).trimmed(); - if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"'))) - || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\'')))) - str = str.mid(1, str.length() - 2); - family_list << str.toString(); + family_list << req.families; + if (!req.family.isEmpty()) { + const auto list = req.family.splitRef(QLatin1Char(',')); + const int numFamilies = list.size(); + family_list.reserve(numFamilies); + for (int i = 0; i < numFamilies; ++i) { + QStringRef str = list.at(i).trimmed(); + if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"'))) + || (str.startsWith(QLatin1Char('\'')) && str.endsWith(QLatin1Char('\'')))) + str = str.mid(1, str.length() - 2); + family_list << str.toString(); + } } - // append the substitute list for each family in family_list for (int i = 0, size = family_list.size(); i < size; ++i) family_list += QFont::substitutes(family_list.at(i)); @@ -2688,9 +2688,8 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) } QString family_name, foundry_name; - - parseFontName(request.family, foundry_name, family_name); - + const QString requestFamily = request.families.size() > 0 ? request.families.at(0) : request.family; + parseFontName(requestFamily, foundry_name, family_name); QtFontDesc desc; QList<int> blackListed; int index = match(multi ? QChar::Script_Common : script, request, family_name, foundry_name, &desc, blackListed); @@ -2703,8 +2702,8 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) // Don't pass empty family names to the platform font database, since it will then invoke its own matching // and we will be out of sync with the matched font. - if (fontDef.family.isEmpty()) - fontDef.family = desc.family->name; + if (fontDef.families.isEmpty() && fontDef.family.isEmpty()) + fontDef.families = QStringList(desc.family->name); engine = loadEngine(script, fontDef, desc.family, desc.foundry, desc.style, desc.size); @@ -2717,13 +2716,13 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) } if (!engine) { - if (!request.family.isEmpty()) { + if (!requestFamily.isEmpty()) { QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint); if (styleHint == QFont::AnyStyle && request.fixedPitch) styleHint = QFont::TypeWriter; QStringList fallbacks = request.fallBackFamilies - + fallbacksForFamily(request.family, + + fallbacksForFamily(requestFamily, QFont::Style(request.style), styleHint, QChar::Script(script)); @@ -2741,7 +2740,7 @@ QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script) index = match(multi ? QChar::Script_Common : script, def, def.family, QLatin1String(""), &desc, blackListed); if (index >= 0) { QFontDef loadDef = def; - if (loadDef.family.isEmpty()) + if (loadDef.families.isEmpty() && loadDef.family.isEmpty()) loadDef.family = desc.family->name; engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size); if (engine) @@ -2782,7 +2781,10 @@ void QFontDatabase::load(const QFontPrivate *d, int script) // look for the requested font in the engine data cache // note: fallBackFamilies are not respected in the EngineData cache key; // join them with the primary selection family to avoid cache misses - req.family = fallBackFamilies.join(QLatin1Char(',')); + if (!d->request.family.isEmpty()) + req.family = fallBackFamilies.join(QLatin1Char(',')); + if (!d->request.families.isEmpty()) + req.families = fallBackFamilies; d->engineData = fontCache->findEngineData(req); if (!d->engineData) { @@ -2803,14 +2805,14 @@ void QFontDatabase::load(const QFontPrivate *d, int script) req.fallBackFamilies = fallBackFamilies; if (!req.fallBackFamilies.isEmpty()) - req.family = req.fallBackFamilies.takeFirst(); + req.families = QStringList(req.fallBackFamilies.takeFirst()); // list of families to try QStringList family_list; - if (!req.family.isEmpty()) { + if (!req.families.isEmpty()) { // Add primary selection - family_list << req.family; + family_list << req.families.at(0); // add the default family QString defaultFamily = QGuiApplication::font().family(); @@ -2824,11 +2826,11 @@ void QFontDatabase::load(const QFontPrivate *d, int script) QStringList::ConstIterator it = family_list.constBegin(), end = family_list.constEnd(); for (; !fe && it != end; ++it) { - req.family = *it; + req.families = QStringList(*it); fe = QFontDatabase::findFont(req, script); if (fe) { - if (fe->type() == QFontEngine::Box && !req.family.isEmpty()) { + if (fe->type() == QFontEngine::Box && !req.families.isEmpty()) { if (fe->ref.load() == 0) delete fe; fe = 0; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 9b0b0ec0d5..b06b64ca63 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1842,7 +1842,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at) { QFontDef request(fontDef); request.styleStrategy |= QFont::NoFontMerging; - request.family = fallbackFamilyAt(at - 1); + request.families = QStringList(fallbackFamilyAt(at - 1)); // At this point, the main script of the text has already been considered // when fetching the list of fallback families from the database, and the diff --git a/src/gui/text/qsyntaxhighlighter.h b/src/gui/text/qsyntaxhighlighter.h index d87f89f0fd..ad0d50a4c0 100644 --- a/src/gui/text/qsyntaxhighlighter.h +++ b/src/gui/text/qsyntaxhighlighter.h @@ -64,7 +64,7 @@ class Q_GUI_EXPORT QSyntaxHighlighter : public QObject public: explicit QSyntaxHighlighter(QObject *parent); explicit QSyntaxHighlighter(QTextDocument *parent); - virtual ~QSyntaxHighlighter(); + ~QSyntaxHighlighter(); void setDocument(QTextDocument *doc); QTextDocument *document() const; diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 4957da1908..18de8408b5 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -361,6 +361,9 @@ void QTextFormatPrivate::recalcFont() const case QTextFormat::FontFamily: f.setFamily(props.at(i).value.toString()); break; + case QTextFormat::FontFamilies: + f.setFamilies(props.at(i).value.toStringList()); + break; case QTextFormat::FontPointSize: f.setPointSizeF(props.at(i).value.toReal()); break; @@ -562,6 +565,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt) Character properties \value FontFamily + \value FontFamilies \value FontPointSize \value FontPixelSize \value FontSizeAdjustment Specifies the change in size given to the fontsize already set using @@ -1390,7 +1394,23 @@ QTextCharFormat::QTextCharFormat(const QTextFormat &fmt) \sa font() */ +/*! + \fn void QTextCharFormat::setFontFamilies(const QStringList &families) + \since 5.13 + + Sets the text format's font \a families. + + \sa setFont() +*/ + +/*! + \fn QStringList QTextCharFormat::fontFamilies() const + \since 5.13 + + Returns the text format's font families. + \sa font() +*/ /*! \fn void QTextCharFormat::setFontPointSize(qreal size) @@ -1919,6 +1939,9 @@ void QTextCharFormat::setFont(const QFont &font, FontPropertiesInheritanceBehavi if (mask & QFont::FamilyResolved) setFontFamily(font.family()); + if (mask & QFont::FamiliesResolved) + setFontFamilies(font.families()); + if (mask & QFont::SizeResolved) { const qreal pointSize = font.pointSizeF(); if (pointSize > 0) { diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index a8e573d5a4..d27d2e7f17 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -188,6 +188,7 @@ public: FontStyleStrategy = 0x1FE4, FontKerning = 0x1FE5, FontHintingPreference = 0x1FE6, + FontFamilies = 0x1FE7, FontFamily = 0x2000, FontPointSize = 0x2001, FontSizeAdjustment = 0x2002, @@ -428,6 +429,11 @@ public: inline QString fontFamily() const { return stringProperty(FontFamily); } + inline void setFontFamilies(const QStringList &families) + { setProperty(FontFamilies, QVariant(families)); } + inline QVariant fontFamilies() const + { return property(FontFamilies); } + inline void setFontPointSize(qreal size) { setProperty(FontPointSize, size); } inline qreal fontPointSize() const diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index c9a2a33e5a..04300a4d22 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -861,7 +861,8 @@ QString QTextHtmlParser::parseWord() ++pos; while (pos < len) { QChar c = txt.at(pos++); - if (c == QLatin1Char('\'')) + // Allow for escaped single quotes as they may be part of the string + if (c == QLatin1Char('\'') && (txt.length() > 1 && txt.at(pos - 2) != QLatin1Char('\\'))) break; else word += c; diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 103e0a8222..f5d73affab 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -89,7 +89,7 @@ public: contentStream = device; } - virtual ~QXmlStreamStrategy() + ~QXmlStreamStrategy() { if (contentStream) contentStream->close(); |