[Libreoffice-commits] core.git: Branch 'distro/collabora/cp-5.3' - desktop/source
Ashod Nakashian
ashod.nakashian at collabora.co.uk
Thu Jun 28 13:31:06 UTC 2018
desktop/source/lib/init.cxx | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
New commits:
commit e7f65920b12517b31f0c5cbfd0dcb8df96d20ba4
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
Date: Thu Jun 28 01:07:32 2018 -0400
desktop: initialize fonts in pre-init
Change-Id: I5a3acc41196c7e0672514fa2dae00e5fc0f76a1f
Reviewed-on: https://gerrit.libreoffice.org/56573
Reviewed-by: Jan Holesovsky <kendy at collabora.com>
Tested-by: Jan Holesovsky <kendy at collabora.com>
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c8593b96859b..687e37e7f29d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -62,6 +62,7 @@
#include <com/sun/star/linguistic2/LinguServiceManager.hpp>
#include <com/sun/star/linguistic2/XSpellChecker.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
#include <editeng/fontitem.hxx>
#include <editeng/flstitem.hxx>
@@ -104,6 +105,7 @@
#include <sfx2/sfxbasemodel.hxx>
#include <svl/undo.hxx>
#include <unotools/datetime.hxx>
+#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <app.hxx>
@@ -3833,6 +3835,30 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// 3) InitVCL()
aService->initialize({css::uno::makeAny<OUString>("preload")});
+ // Initialize fonts.
+ css::uno::Sequence< css::lang::Locale > aLocales;
+ css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLangSrv = css::linguistic2::LinguServiceManager::create(xContext);
+ if (xLangSrv.is())
+ {
+ css::uno::Reference<css::linguistic2::XSpellChecker> xSpell(xLangSrv->getSpellChecker(), css::uno::UNO_QUERY);
+ css::uno::Reference<css::linguistic2::XSupportedLocales> xLocales(xSpell, css::uno::UNO_QUERY);
+ if (xLocales.is())
+ aLocales = xLocales->getLocales();
+ }
+
+ for (const auto& aLocale : aLocales)
+ {
+ //TODO: Add more types and cache more aggessively. For now this initializes the fontcache.
+ using namespace ::com::sun::star::i18n::ScriptType;
+ LanguageType nLang;
+ nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType(aLocale, false), LATIN);
+ OutputDevice::GetDefaultFont(DefaultFontType::LATIN_SPREADSHEET, nLang, GetDefaultFontFlags::OnlyOne);
+ nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType(aLocale, false), ASIAN);
+ OutputDevice::GetDefaultFont(DefaultFontType::CJK_SPREADSHEET, nLang, GetDefaultFontFlags::OnlyOne);
+ nLang = MsLangId::resolveSystemLanguageByScriptType(LanguageTag::convertToLanguageType(aLocale, false), COMPLEX);
+ OutputDevice::GetDefaultFont(DefaultFontType::CTL_SPREADSHEET, nLang, GetDefaultFontFlags::OnlyOne);
+ }
+
preloadData();
// Release Solar Mutex, lo_startmain thread should acquire it.
More information about the Libreoffice-commits
mailing list