vcl/qt5/Qt5Graphics_Text.cxx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
New commits: commit 5d13f3efe0157559d3625c6b8fe7e9741e601215 Author: Jan-Marek Glogowski <glo...@fbihome.de> AuthorDate: Mon Dec 17 15:07:26 2018 +0100 Commit: Jan-Marek Glogowski <glo...@fbihome.de> CommitDate: Mon Dec 17 21:19:18 2018 +0100 Qt5 don't re-register system fonts System fonts are already registered in the QFontDatabase. And addApplicationFont seems to be really expensive especially when registering large fonts like the Noto CJK fonts, which increases load time by 4 seconds per font. This skips all font + style combinations already known in the DB. Since addApplicationFont already relies on fontconfig on Unix/X11 this should be fine. Change-Id: Ief13a613abd99b9fe391d9afe868541035340d1c Reviewed-on: https://gerrit.libreoffice.org/65270 Tested-by: Jenkins Reviewed-by: Jan-Marek Glogowski <glo...@fbihome.de> diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index ba7133f7b53e..19a05f8410fc 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -98,6 +98,7 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) if (bUseFontconfig) { + const QStringList aFontFamilyList = aFDB.families(); ::std::vector<psp::fontID> aList; psp::FastPrintFontInfo aInfo; @@ -109,7 +110,11 @@ void Qt5Graphics::GetDevFontList(PhysicalFontCollection* pPFC) continue; QString aFilename = toQString( OStringToOUString(rMgr.getFontFileSysPath(aInfo.m_nID), RTL_TEXTENCODING_UTF8)); - QFontDatabase::addApplicationFont(aFilename); + QRawFont aRawFont(aFilename, 0.0); + QString aFamilyName = aRawFont.familyName(); + if (!aFontFamilyList.contains(aFamilyName) + || !aFDB.styles(aFamilyName).contains(aRawFont.styleName())) + QFontDatabase::addApplicationFont(aFilename); } SalGenericInstance::RegisterFontSubstitutors(pPFC); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits