summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-07-06 16:49:29 -0400
committerJan Holesovsky <kendy@collabora.com>2018-09-12 17:59:16 +0200
commit0c9924495eb8010eedd3c93641f995ae560b3aad (patch)
tree6ab9b900cfd8ccb298b499552ffaa87ef2083eca
parent0f7dc36f3d8688805584f6269f722f4b75c83ea8 (diff)
desktop: move font initialization into preloadData
Reviewed-on: https://gerrit.libreoffice.org/57160 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit bbba0902fc1f1c6bb2a7f1e6ff2b682e2fbd3cc9) Change-Id: I66840512b45e987cc7b08b07b65bdb24f2023a41
-rw-r--r--desktop/source/lib/init.cxx50
1 files changed, 26 insertions, 24 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 1f5842e1ea26..9d5f43108672 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3795,9 +3795,35 @@ static void preloadData()
images.getImageUrl("forcefed.png", "style", "FO_oo");
std::cerr << "Preload languages\n";
+
// force load language singleton
SvtLanguageTable::HasLanguageType(LANGUAGE_SYSTEM);
LanguageTag::isValidBcp47("foo", nullptr);
+
+ std::cerr << "Preload fonts\n";
+
+ // Initialize fonts.
+ 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);
+ }
}
static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl)
@@ -3928,30 +3954,6 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
preloadData();
- // 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);
- }
-
// Release Solar Mutex, lo_startmain thread should acquire it.
Application::ReleaseSolarMutex();
}