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

New commits:
commit 15e359b4892736da9332de0350887531008c8ea3
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 15:01:44 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>
    (cherry picked from commit f7c069e1008949a07481dc56e40bcd82343884dc)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132052
    Tested-by: Jenkins
    Reviewed-by: Szymon Kłos <szymon.k...@collabora.com>

diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx 
b/svx/source/tbxctrls/StylesPreviewWindow.cxx
index 8996b0083628..8ad09344aa0f 100644
--- a/svx/source/tbxctrls/StylesPreviewWindow.cxx
+++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx
@@ -28,6 +28,7 @@
 #include <sfx2/tplpitem.hxx>
 #include <sfx2/viewsh.hxx>
 #include <vcl/virdev.hxx>
+#include <vcl/settings.hxx>
 
 #include <editeng/editids.hrc>
 #include <editeng/fontitem.hxx>
@@ -45,11 +46,14 @@
 #include <editeng/emphasismarkitem.hxx>
 #include <editeng/brushitem.hxx>
 
+#include <i18nlangtag/mslangid.hxx>
+
 #include <svx/xfillit0.hxx>
 #include <svx/xdef.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 <vcl/commandevent.hxx>
@@ -264,7 +268,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