svx/source/tbxctrls/StylesPreviewWindow.cxx |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

New commits:
commit f7c069e1008949a07481dc56e40bcd82343884dc
Author:     Szymon Kłos <szymon.k...@collabora.com>
AuthorDate: Mon Mar 28 07:53:54 2022 +0200
Commit:     Szymon Kłos <szymon.k...@collabora.com>
CommitDate: Mon Mar 28 10:27:26 2022 +0200

    Notebookbar style previews: use CJK or CTL fonts if needed
    
    Change-Id: I4757cf7af16a11895ec0c6e71257f2b4f02cda68
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132159
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Mert Tumer <mert.tu...@collabora.com>

diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx 
b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index a45289e15348..16a435fdb217 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -45,11 +45,14 @@
 #include <editeng/emphasismarkitem.hxx>
 #include <editeng/brushitem.hxx>
 
+#include <i18nlangtag/mslangid.hxx>
+
 #include <svx/xfillit0.hxx>
 #include <svx/svddef.hxx>
 #include <svx/xflclit.hxx>
 
 #include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/i18n/ScriptType.hpp>
 #include <com/sun/star/uno/Sequence.hxx>
 #include <cppuhelper/weak.hxx>
 
@@ -269,7 +272,16 @@ void StyleItemController::DrawEntry(vcl::RenderContext& 
rRenderContext)
 
     Color aFontHighlight = COL_AUTO;
 
-    const SvxFontItem* const pFontItem = 
pItemSet->GetItem<SvxFontItem>(SID_ATTR_CHAR_FONT);
+    sal_Int16 nScriptType
+        = 
MsLangId::getScriptType(Application::GetSettings().GetUILanguageTag().getLanguageType());
+
+    sal_uInt16 nFontSlot = SID_ATTR_CHAR_FONT;
+    if (nScriptType == css::i18n::ScriptType::ASIAN)
+        nFontSlot = SID_ATTR_CHAR_CJK_FONT;
+    else if (nScriptType == css::i18n::ScriptType::COMPLEX)
+        nFontSlot = SID_ATTR_CHAR_CTL_FONT;
+
+    const SvxFontItem* const pFontItem = 
pItemSet->GetItem<SvxFontItem>(nFontSlot);
     const SvxFontHeightItem* const pFontHeightItem
         = pItemSet->GetItem<SvxFontHeightItem>(SID_ATTR_CHAR_FONTHEIGHT);
 

Reply via email to