tdf#123072 Qt5 don't register unknown PSP fonts
LO's own font handling backend has some additional font styles,
which are unknown to Qt, probably because it uses some stricter
handling to decide which fonts are "usable", and because Qt seems
to not know about some style types AFAIK.
The main problem is QFontDatabase::addApplicationFont, as this
seems to parse the whole font instead of a kind of registration,
which takes ages for something like the Noto CJK style variants.
As a workaround this drops the registration of all the additional
PSP fonts. Both Qt5 and PSP use fontconfig but there is definitly
some difference here, which needs to be resolved in some other
way at some point.
Change-Id: Id63cd0258ff56ee988323551820500b2c72a12be
Reviewed-on: https://gerrit.libreoffice.org/69576
Tested-by: Jenkins
Reviewed-by: Jan-Marek Glogowski <glogow@fbihome.de>
diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx
index 5943b32..693f67fe 100644
--- a/vcl/qt5/Qt5Graphics_Text.cxx
+++ b/vcl/qt5/Qt5Graphics_Text.cxx
@@ -97,9 +97,6 @@
return;
QFontDatabase aFDB;
QStringList aFontFamilyList;
if (bUseFontconfig)
aFontFamilyList = aFDB.families();
GlyphCache& rGC = GlyphCache::GetInstance();
psp::PrintFontManager& rMgr = psp::PrintFontManager::get();
::std::vector<psp::fontID> aList;
@@ -120,18 +117,6 @@
aDFA.IncreaseQualityBy(4096);
const OString& rFileName = rMgr.getFontFileSysPath(aInfo.m_nID);
rGC.AddFontFile(rFileName, nFaceNum, nVariantNum, aInfo.m_nID, aDFA);
// register font files unknown to Qt
if (bUseFontconfig)
{
QString aFilename = toQString(
OStringToOUString(rMgr.getFontFileSysPath(aInfo.m_nID), RTL_TEXTENCODING_UTF8));
QRawFont aRawFont(aFilename, 0.0);
QString aFamilyName = aRawFont.familyName();
if (!aFontFamilyList.contains(aFamilyName)
|| !aFDB.styles(aFamilyName).contains(aRawFont.styleName()))
QFontDatabase::addApplicationFont(aFilename);
}
}
if (bUseFontconfig)