Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Fix selecting fonts whose full name is the same as their family name.

Wolthera van Hövell tot Westerflier645ed3a967f9
diff --git a/libs/flake/text/KoFFWWSConverter.cpp b/libs/flake/text/KoFFWWSConverter.cpp
index 3e37bd68a4..7457e56bd4 100644
--- a/libs/flake/text/KoFFWWSConverter.cpp
+++ b/libs/flake/text/KoFFWWSConverter.cpp
@@ -974,8 +974,16 @@ KisForest<FontFamilyNode>::composition_iterator searchNodes (KisForest<FontFamil
if (childBegin(it) == childEnd(it)) {
// For the lowest nodes, we only want to test the full name.
QStringList local = it->localizedFullName.values();
+
+ // For some fonts, the full name is the exact same as the typographic family name,
+ // in which case, we want to ignore the full name.
+ QStringList localFamily = it->localizedFontFamilies.values();
+ bool inLocalFamilyToo = (localFamily.contains(familySimplified, Qt::CaseInsensitive)
+ || localFamily.contains(familyLower, Qt::CaseInsensitive));
+
if (local.contains(familySimplified, Qt::CaseInsensitive)
|| local.contains(familyLower, Qt::CaseInsensitive)) {
+ if (inLocalFamilyToo) continue;
break;
} else {
continue;