return family_list;
}
-static inline bool isItalicOrOblique(const QString &style, const QString &otherstyle)
+static inline bool isStyleMatch(const QString &style, const QString &otherstyle)
{
const QString lowerstyle(style.toLower());
const QString lowerother(otherstyle.toLower());
if (lowerstyle == lowerother) {
return true;
}
+
if (lowerstyle.contains(QLatin1String("italic")) && lowerother.contains(QLatin1String("oblique"))) {
return true;
}
- return (lowerstyle.contains(QLatin1String("oblique")) && lowerother.contains(QLatin1String("italic")));
+ if (lowerstyle.contains(QLatin1String("oblique")) && lowerother.contains(QLatin1String("italic"))) {
+ return true;
+ }
+
+ if (lowerstyle == QLatin1String("normal") && lowerother == QLatin1String("regular")) {
+ return true;
+ }
+ return (lowerstyle == QLatin1String("regular") && lowerother == QLatin1String("normal"));
}
QT_BEGIN_INCLUDE_NAMESPACE
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || (!style.isEmpty() && !isItalicOrOblique(fontfamily.style, style))) {
+ || (!style.isEmpty() && !isStyleMatch(fontfamily.style, style))) {
continue;
}
result = fontfamily.fixedpitch;
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || (!style.isEmpty() && !isItalicOrOblique(fontfamily.style, style))) {
+ || (!style.isEmpty() && !isStyleMatch(fontfamily.style, style))) {
continue;
}
result = fontfamily.scalable;
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || !isItalicOrOblique(fontfamily.style, style)) {
+ || !isStyleMatch(fontfamily.style, style)) {
continue;
}
result.append(fontfamily.pointsize);
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || !isItalicOrOblique(fontfamily.style, style)) {
+ || !isStyleMatch(fontfamily.style, style)) {
continue;
}
if (fontfamily.pointsize != pointSize && !fontfamily.scalable) {
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || !isItalicOrOblique(fontfamily.style, style)) {
+ || !isStyleMatch(fontfamily.style, style)) {
continue;
}
if (fontfamily.scalable) {
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || !isItalicOrOblique(fontfamily.style, style)) {
+ || !isStyleMatch(fontfamily.style, style)) {
continue;
}
result = fontfamily.italic;
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || !isItalicOrOblique(fontfamily.style, style)) {
+ || !isStyleMatch(fontfamily.style, style)) {
continue;
}
result = fontfamily.bold;
foreach (const QtFontFamily &fontfamily, d->families) {
if (fontfamily.family.compare(parsedfamily, Qt::CaseInsensitive) != 0
|| (!parsedfoundry.isEmpty() && fontfamily.foundry.compare(parsedfoundry, Qt::CaseInsensitive) != 0)
- || !isItalicOrOblique(fontfamily.style, style)) {
+ || !isStyleMatch(fontfamily.style, style)) {
continue;
}
result = fontfamily.weight;