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

Ensure there's a /fonts/ folder in the resource folder where people can put their fonts.

Wolthera van Hövell tot Westerflier73fcd803d099
diff --git a/libs/flake/text/KoFontRegistry.cpp b/libs/flake/text/KoFontRegistry.cpp
index 9f5cd3679b..e9fd4ebba1 100644
--- a/libs/flake/text/KoFontRegistry.cpp
+++ b/libs/flake/text/KoFontRegistry.cpp
@@ -123,6 +123,11 @@ public:
}
m_config.reset(config);
+ // Add fonts folder from resource folder.
+ const QString fontsFolder = KoResourcePaths::saveLocation("data", "/fonts/", true);
+ const FcChar8 *vals = reinterpret_cast<const FcChar8 *>(fontsFolder.toUtf8().data());
+ FcConfigAppFontAddDir(m_config.data(), vals);
+
/// Setup the change tracker.
FcStrList *list = FcConfigGetFontDirs(m_config.data());
FcStrListFirst(list);
@@ -135,6 +140,7 @@ public:
dirString = FcStrListNext(list);
path = QString::fromUtf8(reinterpret_cast<char *>(dirString));
}
+ paths.append(fontsFolder);
FcStrListDone(list);
changeTracker.reset(new KoFontChangeTracker(paths));
changeTracker->resetChangeTracker();