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++

Try to prioritize the font closest to the typographic name.

Wolthera van Hövell tot Westerflier146e803b02c3
diff --git a/libs/flake/text/KoFFWWSConverter.cpp b/libs/flake/text/KoFFWWSConverter.cpp
index ec629586bc..dd2d581eb0 100644
--- a/libs/flake/text/KoFFWWSConverter.cpp
+++ b/libs/flake/text/KoFFWWSConverter.cpp
@@ -701,6 +701,19 @@ void KoFFWWSConverter::sortIntoWWSFamilies()
KIS_ASSERT_RECOVER_NOOP(childBegin(child) == childEnd(child));
d->fontFamilyCollection.erase(child);
}
+
+ QVector<KisForest<FontFamilyNode>::child_iterator> moveToFront;
+ for (auto font = tempList.childBegin(); font != tempList.childEnd(); font++) {
+ // prioritize the font with the name closest to the typographic family, so other fonts get sorted into it.
+ if(font->fontFamily == typographic->fontFamily && font != tempList.childBegin()) {
+ moveToFront.append(font);
+ }
+ }
+ while (!moveToFront.isEmpty()) {
+ auto font = moveToFront.takeLast();
+ tempList.move(font, tempList.childBegin());
+ }
+
if (KisForestDetail::size(tempList) > 0) {
//Do most regular first...
KoSvgText::FontFormatType testType = types.contains(KoSvgText::OpenTypeFontType)? KoSvgText::OpenTypeFontType: types.first();