diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-12-17 15:07:26 +0100 |
---|---|---|
committer | Jan-Marek Glogowski <glogow@fbihome.de> | 2018-12-17 22:31:41 +0100 |
commit | 6d3faf6a048eedf3fe4a1f43545eeda38adb2763 (patch) | |
tree | e345920bb36c621de7d2e00742bb1999b2e17220 /vcl | |
parent | c821da3ecc3c309be2ec2db204a4c853b53fa979 (diff) |
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 <glogow@fbihome.de>
(cherry picked from commit 5d13f3efe0157559d3625c6b8fe7e9741e601215)
Reviewed-on: https://gerrit.libreoffice.org/65290
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/qt5/Qt5Graphics_Text.cxx | 7 |
1 files changed, 6 insertions, 1 deletions
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); |