summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-06-28 01:07:32 -0400
committerJan Holesovsky <kendy@collabora.com>2018-10-08 17:30:07 +0200
commit752494ee759efdf976c44ffd6408a7f861215901 (patch)
treea6cc478e9c29638b2ee4cb8792462adbe5ed432e /desktop
parentb89bf7e197be88ca60c1910835080a26e092dfaa (diff)
desktop: initialize fonts in pre-init
Reviewed-on: https://gerrit.libreoffice.org/56573 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com> (cherry picked from commit e7f65920b12517b31f0c5cbfd0dcb8df96d20ba4) Change-Id: I5a3acc41196c7e0672514fa2dae00e5fc0f76a1f Reviewed-on: https://gerrit.libreoffice.org/61492 Tested-by: Jenkins Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/lib/init.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 477a3feb8180..db92368d6cb0 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -75,6 +75,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>
@@ -116,6 +117,7 @@
#include <sfx2/sfxbasemodel.hxx>
#include <svl/undo.hxx>
#include <unotools/datetime.hxx>
+#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <vcl/builder.hxx>
#include <vcl/abstdlg.hxx>
@@ -3982,6 +3984,31 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
// Force load some modules
VclBuilder::preload();
VclAbstractDialogFactory::Create();
+
+ // 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.