Kaydet (Commit) bcef1c1c authored tarafından Ashod Nakashian's avatar Ashod Nakashian Kaydeden (comit) Jan Holesovsky

desktop: initialize fonts in pre-init

Reviewed-on: https://gerrit.libreoffice.org/56573Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
Tested-by: 's avatarJan Holesovsky <kendy@collabora.com>
(cherry picked from commit e7f65920)

Change-Id: I5a3acc41196c7e0672514fa2dae00e5fc0f76a1f
üst 713e8d6e
......@@ -63,6 +63,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>
......@@ -105,6 +106,7 @@
#include <svl/undo.hxx>
#include <unotools/datetime.hxx>
#include <android/compatibility.hxx>
#include <i18nlangtag/mslangid.hxx>
#include <i18nlangtag/languagetag.hxx>
#include <vcl/builder.hxx>
#include <vcl/abstdlg.hxx>
......@@ -3923,6 +3925,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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment