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

KoFontRegistry: add an assert checking fonts and lengths

Halla Remptdd694c8cca17
diff --git a/libs/flake/text/KoFontRegistry.cpp b/libs/flake/text/KoFontRegistry.cpp
index 44c099c323..9f5cd3679b 100644
--- a/libs/flake/text/KoFontRegistry.cpp
+++ b/libs/flake/text/KoFontRegistry.cpp
@@ -514,6 +514,11 @@ std::vector<FT_FaceSP> KoFontRegistry::facesForCSSValues(QVector<int> &lengths,
std::vector<FT_FaceSP> faces;
+ KIS_ASSERT_X(lengths.size() == fonts.size(),
+ "KoFontRegistry",
+ QString("Fonts and lengths don't have the same size. Fonts: %1. Length: %2")
+ .arg(fonts.size(), lengths.size()).toLatin1());
+
for (int i = 0; i < lengths.size(); i++) {
KoFFWWSConverter::FontFileEntry font = fonts.at(i);
// For some reason, FontConfig will sometimes return the wrong file index.