From 7eef6029ec44a8ec3606dbd9c7d2f438f0dd21a9 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Mon, 17 Aug 2026 22:38:50 +0300 Subject: [PATCH] tdf#171624: Make font variation settings per script We had only one shared setting for the three script groups, which means the same variation settings are applied to the three groups, which makes no sense as they often use entirely different fonts. Change-Id: I6f2a8b4d1c9e0357a6b2d8f4e1c7093b5a2d6e84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/209222 Tested-by: Jenkins Reviewed-by: Khaled Hosny --- editeng/qa/unit/core-test.cxx | 23 ++++++++ editeng/source/editeng/editattr.cxx | 3 +- editeng/source/editeng/editdoc.cxx | 40 ++++++++++++- editeng/source/editeng/eerdll.cxx | 2 + include/editeng/editids.hrc | 2 + include/editeng/eeitem.hxx | 4 +- include/editeng/unoprnms.hxx | 2 + include/editeng/unotext.hxx | 4 +- include/xmloff/xmltoken.hxx | 2 + .../OpenDocument-v1.4+libreoffice-schema.rng | 10 ++++ sw/inc/hintids.hxx | 6 +- sw/inc/unoprnms.hxx | 2 + sw/qa/extras/odfexport/odfexport.cxx | 56 +++++++++++++++++++ sw/source/core/bastyp/init.cxx | 2 + sw/source/core/inc/swfntcch.hxx | 2 +- sw/source/core/inc/swfont.hxx | 10 ++-- sw/source/core/layout/wsfrm.cxx | 2 + sw/source/core/text/atrhndl.hxx | 2 +- sw/source/core/text/atrstck.cxx | 35 ++++++++---- sw/source/core/txtnode/swfont.cxx | 6 +- sw/source/core/unocore/unomap1.cxx | 4 ++ sw/source/core/unocore/unomapproperties.hxx | 4 ++ sw/source/filter/html/css1atr.cxx | 11 ++++ sw/source/filter/html/htmlatr.cxx | 2 + sw/source/filter/html/htmlcss1.cxx | 6 ++ sw/source/filter/html/svxcss1.cxx | 13 ++++- sw/source/filter/html/swhtml.hxx | 2 + xmloff/inc/xmlprop.hxx | 2 + xmloff/source/core/xmltoken.cxx | 2 + xmloff/source/text/txtprmap.cxx | 4 ++ xmloff/source/token/tokens.txt | 2 + 31 files changed, 239 insertions(+), 28 deletions(-) diff --git a/editeng/qa/unit/core-test.cxx b/editeng/qa/unit/core-test.cxx index 4b32b9b100c6..0d3650b4c5e1 100644 --- a/editeng/qa/unit/core-test.cxx +++ b/editeng/qa/unit/core-test.cxx @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -141,6 +142,7 @@ public: void testTdf162803StaleKashidaArray(); void testTdf157037PasteTextAutoDirection(); void testFontVariationsItem(); + void testFontVariationsScript(); void testEscapementNotPreservedOnParaBreak(); void testAutoDirNotPreservedOnParaBreak(); void testFontTypographicConversion(); @@ -180,6 +182,7 @@ public: CPPUNIT_TEST(testTdf162803StaleKashidaArray); CPPUNIT_TEST(testTdf157037PasteTextAutoDirection); CPPUNIT_TEST(testFontVariationsItem); + CPPUNIT_TEST(testFontVariationsScript); CPPUNIT_TEST(testEscapementNotPreservedOnParaBreak); CPPUNIT_TEST(testAutoDirNotPreservedOnParaBreak); CPPUNIT_TEST(testFontTypographicConversion); @@ -2470,6 +2473,26 @@ void Test::testTdf157037PasteTextAutoDirection() CPPUNIT_ASSERT(!aEditEngine.IsRightToLeft(4)); } +void Test::testFontVariationsScript() +{ + CPPUNIT_ASSERT(IsScriptItemValid(EE_CHAR_FONTVARIATIONS, i18n::ScriptType::LATIN)); + CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS, i18n::ScriptType::ASIAN)); + CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS, i18n::ScriptType::COMPLEX)); + + CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS_CJK, i18n::ScriptType::LATIN)); + CPPUNIT_ASSERT(IsScriptItemValid(EE_CHAR_FONTVARIATIONS_CJK, i18n::ScriptType::ASIAN)); + CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS_CJK, i18n::ScriptType::COMPLEX)); + + CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS_CTL, i18n::ScriptType::LATIN)); + CPPUNIT_ASSERT(!IsScriptItemValid(EE_CHAR_FONTVARIATIONS_CTL, i18n::ScriptType::ASIAN)); + CPPUNIT_ASSERT(IsScriptItemValid(EE_CHAR_FONTVARIATIONS_CTL, i18n::ScriptType::COMPLEX)); + + CPPUNIT_ASSERT_EQUAL(sal_uInt16(EE_CHAR_FONTVARIATIONS_CJK), + GetScriptItemId(EE_CHAR_FONTVARIATIONS, SvtScriptType::ASIAN)); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(EE_CHAR_FONTVARIATIONS_CTL), + GetScriptItemId(EE_CHAR_FONTVARIATIONS, SvtScriptType::COMPLEX)); +} + void Test::testFontVariationsItem() { // Test default construction (empty variations) diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index ba785a799eb2..a4aad600cd6d 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -484,7 +484,8 @@ void EditCharAttribOpticalSizing::SetFont( SvxFont& rFont, OutputDevice* ) EditCharAttribFontVariations::EditCharAttribFontVariations(SfxItemPool& rPool, const SfxPoolItem& rItem, sal_Int32 _nStart, sal_Int32 _nEnd) : EditCharAttrib(rPool, rItem, _nStart, _nEnd) { - assert(rItem.Which() == EE_CHAR_FONTVARIATIONS); + assert(rItem.Which() == EE_CHAR_FONTVARIATIONS || rItem.Which() == EE_CHAR_FONTVARIATIONS_CJK + || rItem.Which() == EE_CHAR_FONTVARIATIONS_CTL); } void EditCharAttribFontVariations::SetFont( SvxFont& rFont, OutputDevice* ) diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 8a84b47acc3f..16a76a302004 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -111,6 +111,9 @@ sal_uInt16 GetScriptItemId( sal_uInt16 nItemId, SvtScriptType nScriptType ) case EE_CHAR_ITALIC: nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_ITALIC_CJK : EE_CHAR_ITALIC_CTL; break; + case EE_CHAR_FONTVARIATIONS: + nId = ( nScriptType == SvtScriptType::ASIAN ) ? EE_CHAR_FONTVARIATIONS_CJK : EE_CHAR_FONTVARIATIONS_CTL; + break; } } @@ -168,6 +171,15 @@ bool IsScriptItemValid( sal_uInt16 nItemId, short nScriptType ) case EE_CHAR_ITALIC_CTL: bValid = nScriptType == i18n::ScriptType::COMPLEX; break; + case EE_CHAR_FONTVARIATIONS: + bValid = nScriptType == i18n::ScriptType::LATIN; + break; + case EE_CHAR_FONTVARIATIONS_CJK: + bValid = nScriptType == i18n::ScriptType::ASIAN; + break; + case EE_CHAR_FONTVARIATIONS_CTL: + bValid = nScriptType == i18n::ScriptType::COMPLEX; + break; } return bValid; @@ -329,6 +341,8 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sa } break; case EE_CHAR_FONTVARIATIONS: + case EE_CHAR_FONTVARIATIONS_CJK: + case EE_CHAR_FONTVARIATIONS_CTL: { return new EditCharAttribFontVariations(rPool, rAttr, nS, nE ); } @@ -1244,11 +1258,16 @@ void YrsInsertAttribImplImpl(YrsWrite const& yw, SfxPoolItem const& rItm, break; } case EE_CHAR_FONTVARIATIONS: + case EE_CHAR_FONTVARIATIONS_CJK: + case EE_CHAR_FONTVARIATIONS_CTL: { SvxFontVariationsItem const& rItem{static_cast(rItm)}; OUString aStr = vcl::font::VariationsToString(rItem.GetVariations()); attr = yinput_str(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8)); - attrName = "EE_CHAR_FONTVARIATIONS"; + attrName = rItm.Which() == EE_CHAR_FONTVARIATIONS + ? "EE_CHAR_FONTVARIATIONS" + : rItm.Which() == EE_CHAR_FONTVARIATIONS_CJK ? "EE_CHAR_FONTVARIATIONS_CJK" + : "EE_CHAR_FONTVARIATIONS_CTL"; break; } default: @@ -1611,6 +1630,10 @@ char const* YrsWhichToAttrName(sal_Int16 const nWhich) return "EE_CHAR_OPTICALSIZING"; case EE_CHAR_FONTVARIATIONS: return "EE_CHAR_FONTVARIATIONS"; + case EE_CHAR_FONTVARIATIONS_CJK: + return "EE_CHAR_FONTVARIATIONS_CJK"; + case EE_CHAR_FONTVARIATIONS_CTL: + return "EE_CHAR_FONTVARIATIONS_CTL"; default: assert(false); abort(); @@ -1861,6 +1884,14 @@ void YrsImplInsertAttr(SfxItemSet & rSet, ::std::vector *const pRemo { nWhich = EE_CHAR_FONTVARIATIONS; } + else if (strcmp(pKey, "EE_CHAR_FONTVARIATIONS_CJK") == 0) + { + nWhich = EE_CHAR_FONTVARIATIONS_CJK; + } + else if (strcmp(pKey, "EE_CHAR_FONTVARIATIONS_CTL") == 0) + { + nWhich = EE_CHAR_FONTVARIATIONS_CTL; + } else if (pKey[0] == 'E' && pKey[1] == 'E' && pKey[2] == '_') { abort(); @@ -2500,6 +2531,8 @@ void YrsImplInsertAttr(SfxItemSet & rSet, ::std::vector *const pRemo break; } case EE_CHAR_FONTVARIATIONS: + case EE_CHAR_FONTVARIATIONS_CJK: + case EE_CHAR_FONTVARIATIONS_CTL: { yvalidate(rValue.tag == Y_JSON_STRING); OUString aStr = OStringToOUString( @@ -3278,6 +3311,7 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S sal_uInt16 nWhich_FontHeight = GetScriptItemId( EE_CHAR_FONTHEIGHT, nScriptType ); sal_uInt16 nWhich_Weight = GetScriptItemId( EE_CHAR_WEIGHT, nScriptType ); sal_uInt16 nWhich_Italic = GetScriptItemId( EE_CHAR_ITALIC, nScriptType ); + sal_uInt16 nWhich_FontVariations = GetScriptItemId( EE_CHAR_FONTVARIATIONS, nScriptType ); if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontInfo ) == SfxItemState::SET ) ) { @@ -3338,8 +3372,8 @@ void CreateFont( SvxFont& rFont, const SfxItemSet& rSet, bool bSearchInParent, S rFont.SetRelief( rSet.Get( EE_CHAR_RELIEF ).GetValue() ); if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_OPTICALSIZING ) == SfxItemState::SET ) ) rFont.SetOpticalSizing( rSet.Get( EE_CHAR_OPTICALSIZING ).GetValue() ); - if ( bSearchInParent || ( rSet.GetItemState( EE_CHAR_FONTVARIATIONS ) == SfxItemState::SET ) ) - rFont.SetVariations( rSet.Get( EE_CHAR_FONTVARIATIONS ).GetVariations() ); + if ( bSearchInParent || ( rSet.GetItemState( nWhich_FontVariations ) == SfxItemState::SET ) ) + rFont.SetVariations( static_cast(rSet.Get( nWhich_FontVariations )).GetVariations() ); // Operator == compares the individual members of the font if the impl pointer is // not equal. If all members are the same, this assignment makes diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 5f660588835a..3b0c2cff13c4 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -164,6 +164,8 @@ ItemInfoPackage& getItemInfoPackageEditEngine() { EE_CHAR_SCRIPT_HINT, new SvxScriptHintItem( EE_CHAR_SCRIPT_HINT ), SID_ATTR_CHAR_SCRIPT_HINT, SFX_ITEMINFOFLAG_NONE }, { EE_CHAR_OPTICALSIZING, new SvxOpticalSizingItem( false, EE_CHAR_OPTICALSIZING ), SID_ATTR_CHAR_OPTICAL_SIZING, SFX_ITEMINFOFLAG_NONE }, { EE_CHAR_FONTVARIATIONS, new SvxFontVariationsItem( EE_CHAR_FONTVARIATIONS ), SID_ATTR_CHAR_FONT_VARIATIONS, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_FONTVARIATIONS_CJK, new SvxFontVariationsItem( EE_CHAR_FONTVARIATIONS_CJK ), SID_ATTR_CHAR_CJK_FONT_VARIATIONS, SFX_ITEMINFOFLAG_NONE }, + { EE_CHAR_FONTVARIATIONS_CTL, new SvxFontVariationsItem( EE_CHAR_FONTVARIATIONS_CTL ), SID_ATTR_CHAR_CTL_FONT_VARIATIONS, SFX_ITEMINFOFLAG_NONE }, { EE_FEATURE_TAB, new SfxVoidItem( EE_FEATURE_TAB ), 0, SFX_ITEMINFOFLAG_NONE }, { EE_FEATURE_LINEBR, new SfxVoidItem( EE_FEATURE_LINEBR ), 0, SFX_ITEMINFOFLAG_NONE }, { EE_FEATURE_NOTCONV, new SvxColorItem( COL_RED, EE_FEATURE_NOTCONV ), SID_ATTR_CHAR_CHARSETCOLOR, SFX_ITEMINFOFLAG_NONE }, diff --git a/include/editeng/editids.hrc b/include/editeng/editids.hrc index 03ec04ac879b..6d5279164dba 100644 --- a/include/editeng/editids.hrc +++ b/include/editeng/editids.hrc @@ -192,6 +192,8 @@ class SvxOpticalSizingItem; #define SID_ATTR_PARA_ADJUST_END ( SID_EDIT_START + 80 ) #define SID_ATTR_CHAR_OPTICAL_SIZING TypedWhichId( SID_EDIT_START + 81 ) #define SID_ATTR_CHAR_FONT_VARIATIONS TypedWhichId( SID_EDIT_START + 82 ) +#define SID_ATTR_CHAR_CJK_FONT_VARIATIONS TypedWhichId( SID_EDIT_START + 83 ) +#define SID_ATTR_CHAR_CTL_FONT_VARIATIONS TypedWhichId( SID_EDIT_START + 84 ) #if 95 > (SID_EDIT_END-SID_EDIT_START) diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx index 9491438fcd95..f68b5b819bfc 100644 --- a/include/editeng/eeitem.hxx +++ b/include/editeng/eeitem.hxx @@ -137,8 +137,10 @@ inline constexpr TypedWhichId EE_CHAR_RUBY (EE inline constexpr TypedWhichId EE_CHAR_SCRIPT_HINT (EE_CHAR_START+33); inline constexpr TypedWhichId EE_CHAR_OPTICALSIZING (EE_CHAR_START+34); inline constexpr TypedWhichId EE_CHAR_FONTVARIATIONS (EE_CHAR_START+35); +inline constexpr TypedWhichId EE_CHAR_FONTVARIATIONS_CJK (EE_CHAR_START+36); +inline constexpr TypedWhichId EE_CHAR_FONTVARIATIONS_CTL (EE_CHAR_START+37); -inline constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 35); +inline constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 37); inline constexpr sal_uInt16 EE_FEATURE_START (EE_CHAR_END + 1); inline constexpr sal_uInt16 EE_FEATURE_TAB (EE_FEATURE_START + 0); diff --git a/include/editeng/unoprnms.hxx b/include/editeng/unoprnms.hxx index 5b2e4e621ba5..2c734dbabd43 100644 --- a/include/editeng/unoprnms.hxx +++ b/include/editeng/unoprnms.hxx @@ -320,6 +320,8 @@ inline constexpr OUString UNO_NAME_EDIT_CHAR_FONTPITCH = u"CharFontPitch"_ustr; inline constexpr OUString UNO_NAME_EDIT_CHAR_POSTURE = u"CharPosture"_ustr; inline constexpr OUString UNO_NAME_EDIT_CHAR_WEIGHT = u"CharWeight"_ustr; inline constexpr OUString UNO_NAME_EDIT_CHAR_FONTVARIATIONS = u"CharFontVariations"_ustr; +inline constexpr OUString UNO_NAME_EDIT_CHAR_FONTVARIATIONS_ASIAN = u"CharFontVariationsAsian"_ustr; +inline constexpr OUString UNO_NAME_EDIT_CHAR_FONTVARIATIONS_COMPLEX = u"CharFontVariationsComplex"_ustr; inline constexpr OUString UNO_NAME_EDIT_CHAR_OPTICALSIZING = u"CharOpticalSizing"_ustr; inline constexpr OUString UNO_NAME_EDIT_CHAR_LOCALE = u"CharLocale"_ustr; diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index b1bc3d1f6667..d5a219d4e750 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -139,7 +139,9 @@ struct SfxItemPropertyMapEntry; { UNO_NAME_EDIT_CHAR_RUBY_POSITION, EE_CHAR_RUBY, ::cppu::UnoType::get(), 0, MID_RUBY_POSITION }, \ { UNO_NAME_EDIT_CHAR_SCRIPT_HINT, EE_CHAR_SCRIPT_HINT, ::cppu::UnoType::get(), 0, MID_SCRIPTHINT }, \ { UNO_NAME_EDIT_CHAR_OPTICALSIZING, EE_CHAR_OPTICALSIZING, ::cppu::UnoType::get(), 0, 0 }, \ - { UNO_NAME_EDIT_CHAR_FONTVARIATIONS, EE_CHAR_FONTVARIATIONS, ::cppu::UnoType::get(), 0, 0 } + { UNO_NAME_EDIT_CHAR_FONTVARIATIONS, EE_CHAR_FONTVARIATIONS, ::cppu::UnoType::get(), 0, 0 }, \ + { UNO_NAME_EDIT_CHAR_FONTVARIATIONS_ASIAN, EE_CHAR_FONTVARIATIONS_CJK, ::cppu::UnoType::get(), 0, 0 }, \ + { UNO_NAME_EDIT_CHAR_FONTVARIATIONS_COMPLEX, EE_CHAR_FONTVARIATIONS_CTL, ::cppu::UnoType::get(), 0, 0 } #define SVX_UNOEDIT_FONT_PROPERTIES \ diff --git a/include/xmloff/xmltoken.hxx b/include/xmloff/xmltoken.hxx index 9d925c045326..a211477ce279 100644 --- a/include/xmloff/xmltoken.hxx +++ b/include/xmloff/xmltoken.hxx @@ -901,6 +901,8 @@ namespace xmloff::token { XML_FONT_STYLE_NAME_ASIAN, XML_FONT_STYLE_NAME_COMPLEX, XML_FONT_VARIATION_SETTINGS, + XML_FONT_VARIATION_SETTINGS_ASIAN, + XML_FONT_VARIATION_SETTINGS_COMPLEX, XML_FONT_VARIANT, XML_FONT_WEIGHT, XML_FONT_WEIGHT_ASIAN, diff --git a/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng b/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng index 7af8203bb0c8..83ef25e7fb3c 100644 --- a/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng +++ b/schema/libreoffice/OpenDocument-v1.4+libreoffice-schema.rng @@ -4209,6 +4209,16 @@ xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1. + + + + + + + + + + diff --git a/sw/inc/hintids.hxx b/sw/inc/hintids.hxx index 258126c2c31a..c802f93f9316 100644 --- a/sw/inc/hintids.hxx +++ b/sw/inc/hintids.hxx @@ -251,7 +251,11 @@ inline constexpr TypedWhichId RES_CHRATR_OPTICAL_SIZING(RE + 46); inline constexpr TypedWhichId RES_CHRATR_FONT_VARIATIONS(RES_CHRATR_BEGIN + 47); -inline constexpr sal_uInt16 RES_CHRATR_END(RES_CHRATR_BEGIN + 48); +inline constexpr TypedWhichId RES_CHRATR_CJK_FONT_VARIATIONS(RES_CHRATR_BEGIN + + 48); +inline constexpr TypedWhichId RES_CHRATR_CTL_FONT_VARIATIONS(RES_CHRATR_BEGIN + + 49); +inline constexpr sal_uInt16 RES_CHRATR_END(RES_CHRATR_BEGIN + 50); // this Attribute used only in a TextNodes SwpAttr-Array inline constexpr sal_uInt16 RES_TXTATR_BEGIN(RES_CHRATR_END); diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 66defe22fe80..f82f78f15fa8 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -154,6 +154,8 @@ inline constexpr OUString UNO_NAME_CHAR_ESCAPEMENT_HEIGHT = u"CharEscapementHeig inline constexpr OUString UNO_NAME_CHAR_TRANSPARENCE = u"CharTransparence"_ustr; inline constexpr OUString UNO_NAME_CHAR_OPTICAL_SIZING = u"CharOpticalSizing"_ustr; inline constexpr OUString UNO_NAME_CHAR_FONT_VARIATIONS = u"CharFontVariations"_ustr; +inline constexpr OUString UNO_NAME_CHAR_CJK_FONT_VARIATIONS = u"CharFontVariationsAsian"_ustr; +inline constexpr OUString UNO_NAME_CHAR_CTL_FONT_VARIATIONS = u"CharFontVariationsComplex"_ustr; inline constexpr OUString UNO_NAME_HIDE_TAB_LEADER_AND_PAGE_NUMBERS = u"HideTabLeaderAndPageNumber"_ustr; inline constexpr OUString UNO_NAME_TAB_IN_TOC = u"TabInTOC"_ustr; diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index febbea7df8e3..36aec075bc16 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -1639,6 +1639,62 @@ CPPUNIT_TEST_FIXTURE(Test, testFontVariationSettings) getProperty(xRun, u"CharFontVariations"_ustr)); } +CPPUNIT_TEST_FIXTURE(Test, testFontVariationSettingsPerScript) +{ + createSwDoc(); + + uno::Reference xCursor(getRun(getParagraph(1), 1), uno::UNO_QUERY); + xCursor->setPropertyValue(u"CharFontVariations"_ustr, uno::Any(u"\"wght\" 700"_ustr)); + xCursor->setPropertyValue(u"CharFontVariationsAsian"_ustr, uno::Any(u"\"wght\" 500"_ustr)); + xCursor->setPropertyValue(u"CharFontVariationsComplex"_ustr, uno::Any(u"\"wght\" 300"_ustr)); + + save(TestFilter::ODT); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPath(pXmlDoc, + "//style:style/style:text-properties[@loext:font-variation-settings='\"wght\" 700']", + 1); + assertXPath(pXmlDoc, + "//style:style/style:text-properties" + "[@loext:font-variation-settings-asian='\"wght\" 500']", + 1); + assertXPath(pXmlDoc, + "//style:style/style:text-properties" + "[@loext:font-variation-settings-complex='\"wght\" 300']", + 1); + + saveAndReload(TestFilter::ODT); + uno::Reference xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(u"\"wght\" 700"_ustr, + getProperty(xRun, u"CharFontVariations"_ustr)); + CPPUNIT_ASSERT_EQUAL(u"\"wght\" 500"_ustr, + getProperty(xRun, u"CharFontVariationsAsian"_ustr)); + CPPUNIT_ASSERT_EQUAL(u"\"wght\" 300"_ustr, + getProperty(xRun, u"CharFontVariationsComplex"_ustr)); +} + +CPPUNIT_TEST_FIXTURE(Test, testFontVariationSettingsWesternOnly) +{ + createSwDoc(); + + uno::Reference xCursor(getRun(getParagraph(1), 1), uno::UNO_QUERY); + xCursor->setPropertyValue(u"CharFontVariations"_ustr, uno::Any(u"\"wght\" 700"_ustr)); + + save(TestFilter::ODT); + xmlDocUniquePtr pXmlDoc = parseExport(u"content.xml"_ustr); + assertXPathNoAttribute(pXmlDoc, "//style:style/style:text-properties", + "font-variation-settings-asian"); + assertXPathNoAttribute(pXmlDoc, "//style:style/style:text-properties", + "font-variation-settings-complex"); + + saveAndReload(TestFilter::ODT); + uno::Reference xRun(getRun(getParagraph(1), 1), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(u"\"wght\" 700"_ustr, + getProperty(xRun, u"CharFontVariations"_ustr)); + CPPUNIT_ASSERT_EQUAL(OUString(), getProperty(xRun, u"CharFontVariationsAsian"_ustr)); + CPPUNIT_ASSERT_EQUAL(OUString(), + getProperty(xRun, u"CharFontVariationsComplex"_ustr)); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index f4dddee4b5a6..67dfba71b8af 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -336,6 +336,8 @@ std::unique_ptr createItemInfoPackageSwAttributes() { RES_CHRATR_SCRIPT_HINT, new SvxScriptHintItem( RES_CHRATR_SCRIPT_HINT ), SID_ATTR_CHAR_SCRIPT_HINT, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_OPTICAL_SIZING, new SvxOpticalSizingItem( false, RES_CHRATR_OPTICAL_SIZING ), SID_ATTR_CHAR_OPTICAL_SIZING, SFX_ITEMINFOFLAG_NONE }, { RES_CHRATR_FONT_VARIATIONS, new SvxFontVariationsItem( RES_CHRATR_FONT_VARIATIONS ), SID_ATTR_CHAR_FONT_VARIATIONS, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CJK_FONT_VARIATIONS, new SvxFontVariationsItem( RES_CHRATR_CJK_FONT_VARIATIONS ), SID_ATTR_CHAR_CJK_FONT_VARIATIONS, SFX_ITEMINFOFLAG_NONE }, + { RES_CHRATR_CTL_FONT_VARIATIONS, new SvxFontVariationsItem( RES_CHRATR_CTL_FONT_VARIATIONS ), SID_ATTR_CHAR_CTL_FONT_VARIATIONS, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_REFMARK, new SwFormatRefMark( SwMarkName() ), 0, SFX_ITEMINFOFLAG_NONE }, { RES_TXTATR_TOXMARK, createSwTOXMarkForItemInfoPackage(), 0, SFX_ITEMINFOFLAG_NONE }, diff --git a/sw/source/core/inc/swfntcch.hxx b/sw/source/core/inc/swfntcch.hxx index cbd56ca33781..d18d6f2f65b5 100644 --- a/sw/source/core/inc/swfntcch.hxx +++ b/sw/source/core/inc/swfntcch.hxx @@ -18,7 +18,7 @@ */ #pragma once -#define NUM_DEFAULT_VALUES 42 +#define NUM_DEFAULT_VALUES 44 #include "swfont.hxx" diff --git a/sw/source/core/inc/swfont.hxx b/sw/source/core/inc/swfont.hxx index e6a2c6e8beef..4816099fbdd4 100644 --- a/sw/source/core/inc/swfont.hxx +++ b/sw/source/core/inc/swfont.hxx @@ -239,7 +239,8 @@ public: inline void SetCaseMap( const SvxCaseMap eNew ); inline void SetEmphasisMark( const FontEmphasisMark eValue ); inline void SetOpticalSizing( bool bOpticalSizing ); - inline void SetVariations( const std::vector& rVariations ); + inline void SetVariations( const std::vector& rVariations, + const SwFontScript nWhich ); // methods for sub-/superscript inline void SetEscapement( const short nNewEsc ); @@ -735,12 +736,11 @@ inline void SwSubFont::SetVariations( const std::vector& r Font::SetVariations( rVariations ); } -inline void SwFont::SetVariations( const std::vector& rVariations ) +inline void SwFont::SetVariations( const std::vector& rVariations, + const SwFontScript nWhich ) { m_bFontChg = true; - m_aSub[SwFontScript::Latin].SetVariations( rVariations ); - m_aSub[SwFontScript::CJK].SetVariations( rVariations ); - m_aSub[SwFontScript::CTL].SetVariations( rVariations ); + m_aSub[nWhich].SetVariations( rVariations ); } inline void SwFont::SetPropWidth( const sal_uInt16 nNew ) diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index 20971b164ae6..4baa0371a943 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -2632,6 +2632,8 @@ void SwContentFrame::UpdateAttr_( const SfxPoolItem* pOld, const SfxPoolItem* pN case RES_CHRATR_NOHYPHEN: case RES_CHRATR_OPTICAL_SIZING: case RES_CHRATR_FONT_VARIATIONS: + case RES_CHRATR_CJK_FONT_VARIATIONS: + case RES_CHRATR_CTL_FONT_VARIATIONS: case RES_PARATR_NUMRULE: rInvFlags |= SwContentFrameInvFlags::SetCompletePaint; break; diff --git a/sw/source/core/text/atrhndl.hxx b/sw/source/core/text/atrhndl.hxx index 50f0f51836fa..6d532433e452 100644 --- a/sw/source/core/text/atrhndl.hxx +++ b/sw/source/core/text/atrhndl.hxx @@ -18,7 +18,7 @@ */ #pragma once -#define NUM_ATTRIBUTE_STACKS 48 +#define NUM_ATTRIBUTE_STACKS 50 #include #include diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx index f06b44303d56..388831e36a33 100644 --- a/sw/source/core/text/atrstck.cxx +++ b/sw/source/core/text/atrstck.cxx @@ -120,17 +120,19 @@ const sal_uInt8 StackPos[ RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN + 1 ] = 39, // RES_CHRATR_SCRIPT_HINT, // 45 40, // RES_CHRATR_OPTICAL_SIZING // 46 41, // RES_CHRATR_FONT_VARIATIONS // 47 - 42, // RES_TXTATR_REFMARK, // 48 - 43, // RES_TXTATR_TOXMARK, // 49 - 44, // RES_TXTATR_META, // 50 - 44, // RES_TXTATR_METAFIELD, // 51 - 0, // RES_TXTATR_AUTOFMT, // 52 - 0, // RES_TXTATR_INETFMT // 53 - 0, // RES_TXTATR_CHARFMT, // 54 - 45, // RES_TXTATR_CJK_RUBY, // 55 - 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 56 - 46, // RES_TXTATR_INPUTFIELD // 57 - 47, // RES_TXTATR_CONTENTCONTROL // 58 + 42, // RES_CHRATR_CJK_FONT_VARIATIONS // 48 + 43, // RES_CHRATR_CTL_FONT_VARIATIONS // 49 + 44, // RES_TXTATR_REFMARK, // 50 + 45, // RES_TXTATR_TOXMARK, // 51 + 46, // RES_TXTATR_META, // 52 + 46, // RES_TXTATR_METAFIELD, // 53 + 0, // RES_TXTATR_AUTOFMT, // 54 + 0, // RES_TXTATR_INETFMT // 55 + 0, // RES_TXTATR_CHARFMT, // 56 + 47, // RES_TXTATR_CJK_RUBY, // 57 + 0, // RES_TXTATR_UNKNOWN_CONTAINER, // 58 + 48, // RES_TXTATR_INPUTFIELD // 59 + 49, // RES_TXTATR_CONTENTCONTROL // 60 }; namespace CharFormat @@ -839,7 +841,16 @@ void SwAttrHandler::FontChg(const SfxPoolItem& rItem, SwFont& rFnt, bool bPush ) rFnt.SetOpticalSizing( rItem.StaticWhichCast(RES_CHRATR_OPTICAL_SIZING).GetValue() ); break; case RES_CHRATR_FONT_VARIATIONS : - rFnt.SetVariations( rItem.StaticWhichCast(RES_CHRATR_FONT_VARIATIONS).GetVariations() ); + rFnt.SetVariations( rItem.StaticWhichCast(RES_CHRATR_FONT_VARIATIONS).GetVariations(), + SwFontScript::Latin ); + break; + case RES_CHRATR_CJK_FONT_VARIATIONS : + rFnt.SetVariations( rItem.StaticWhichCast(RES_CHRATR_CJK_FONT_VARIATIONS).GetVariations(), + SwFontScript::CJK ); + break; + case RES_CHRATR_CTL_FONT_VARIATIONS : + rFnt.SetVariations( rItem.StaticWhichCast(RES_CHRATR_CTL_FONT_VARIATIONS).GetVariations(), + SwFontScript::CTL ); break; case RES_TXTATR_CJK_RUBY : rFnt.SetVertical( 0_deg10, m_bVertLayout ); diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx index 451122f175f8..fdb7c9c4dc79 100644 --- a/sw/source/core/txtnode/swfont.cxx +++ b/sw/source/core/txtnode/swfont.cxx @@ -669,7 +669,11 @@ void SwFont::SetDiffFnt( const SfxItemSet *pAttrSet, if( const SvxOpticalSizingItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_OPTICAL_SIZING ) ) SetOpticalSizing( pItem->GetValue() ); if( const SvxFontVariationsItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_FONT_VARIATIONS ) ) - SetVariations( pItem->GetVariations() ); + SetVariations( pItem->GetVariations(), SwFontScript::Latin ); + if( const SvxFontVariationsItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CJK_FONT_VARIATIONS ) ) + SetVariations( pItem->GetVariations(), SwFontScript::CJK ); + if( const SvxFontVariationsItem* pItem = pAttrSet->GetItemIfSet( RES_CHRATR_CTL_FONT_VARIATIONS ) ) + SetVariations( pItem->GetVariations(), SwFontScript::CTL ); } else { diff --git a/sw/source/core/unocore/unomap1.cxx b/sw/source/core/unocore/unomap1.cxx index dba83dc42464..cf993f32b90f 100644 --- a/sw/source/core/unocore/unomap1.cxx +++ b/sw/source/core/unocore/unomap1.cxx @@ -208,6 +208,8 @@ std::span SwUnoPropertyMapProvider::GetCharStyleP { UNO_NAME_CHAR_NO_HYPHENATION, RES_CHRATR_NOHYPHEN , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_OPTICAL_SIZING, RES_CHRATR_OPTICAL_SIZING , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_FONT_VARIATIONS, RES_CHRATR_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CHAR_CJK_FONT_VARIATIONS, RES_CHRATR_CJK_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CHAR_CTL_FONT_VARIATIONS, RES_CHRATR_CTL_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_SHADOWED, RES_CHRATR_SHADOWED , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_CONTOURED, RES_CHRATR_CONTOUR, cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_WORD_MODE, RES_CHRATR_WORDLINEMODE,cppu::UnoType::get() , PROPERTY_NONE, 0}, @@ -282,6 +284,8 @@ std::span SwUnoPropertyMapProvider::GetAutoCharS { UNO_NAME_CHAR_NO_HYPHENATION, RES_CHRATR_NOHYPHEN , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_OPTICAL_SIZING, RES_CHRATR_OPTICAL_SIZING , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_FONT_VARIATIONS, RES_CHRATR_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CHAR_CJK_FONT_VARIATIONS, RES_CHRATR_CJK_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CHAR_CTL_FONT_VARIATIONS, RES_CHRATR_CTL_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_SHADOWED, RES_CHRATR_SHADOWED , cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_CONTOURED, RES_CHRATR_CONTOUR, cppu::UnoType::get() , PROPERTY_NONE, 0}, { UNO_NAME_CHAR_WORD_MODE, RES_CHRATR_WORDLINEMODE,cppu::UnoType::get() , PROPERTY_NONE, 0}, diff --git a/sw/source/core/unocore/unomapproperties.hxx b/sw/source/core/unocore/unomapproperties.hxx index 53b141a67983..0ec513ad13f0 100644 --- a/sw/source/core/unocore/unomapproperties.hxx +++ b/sw/source/core/unocore/unomapproperties.hxx @@ -175,6 +175,8 @@ { UNO_NAME_CHAR_NO_HYPHENATION, RES_CHRATR_NOHYPHEN, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { UNO_NAME_CHAR_OPTICAL_SIZING, RES_CHRATR_OPTICAL_SIZING, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { UNO_NAME_CHAR_FONT_VARIATIONS, RES_CHRATR_FONT_VARIATIONS, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ + { UNO_NAME_CHAR_CJK_FONT_VARIATIONS, RES_CHRATR_CJK_FONT_VARIATIONS, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ + { UNO_NAME_CHAR_CTL_FONT_VARIATIONS, RES_CHRATR_CTL_FONT_VARIATIONS, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { UNO_NAME_CHAR_SHADOWED, RES_CHRATR_SHADOWED, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { UNO_NAME_CHAR_CONTOURED, RES_CHRATR_CONTOUR, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, 0 }, \ { UNO_NAME_DROP_CAP_FORMAT, RES_PARATR_DROP, cppu::UnoType::get(), PropertyAttribute::MAYBEVOID, MID_DROPCAP_FORMAT | CONVERT_TWIPS }, \ @@ -452,6 +454,8 @@ { UNO_NAME_CHAR_NO_HYPHENATION, RES_CHRATR_NOHYPHEN , cppu::UnoType::get() , PROPERTY_NONE, 0},\ { UNO_NAME_CHAR_OPTICAL_SIZING, RES_CHRATR_OPTICAL_SIZING , cppu::UnoType::get() , PROPERTY_NONE, 0},\ { UNO_NAME_CHAR_FONT_VARIATIONS, RES_CHRATR_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0},\ + { UNO_NAME_CHAR_CJK_FONT_VARIATIONS, RES_CHRATR_CJK_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0},\ + { UNO_NAME_CHAR_CTL_FONT_VARIATIONS, RES_CHRATR_CTL_FONT_VARIATIONS , cppu::UnoType::get() , PROPERTY_NONE, 0},\ { UNO_NAME_CHAR_SHADOWED, RES_CHRATR_SHADOWED , cppu::UnoType::get() , PROPERTY_NONE, 0},\ { UNO_NAME_CHAR_CONTOURED, RES_CHRATR_CONTOUR, cppu::UnoType::get() , PROPERTY_NONE, 0},\ { UNO_NAME_DROP_CAP_FORMAT, RES_PARATR_DROP, cppu::UnoType::get() , PROPERTY_NONE, MID_DROPCAP_FORMAT|CONVERT_TWIPS },\ diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 5098bfec568b..9e6005f5daca 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -2560,6 +2560,15 @@ static SwHTMLWriter& OutCSS1_SvxOpticalSizing( SwHTMLWriter& rWrt, const SfxPool static SwHTMLWriter& OutCSS1_SvxFontVariations( SwHTMLWriter& rWrt, const SfxPoolItem& rHt ) { + sal_uInt16 nScript = CSS1_OUTMODE_WESTERN; + switch( rHt.Which() ) + { + case RES_CHRATR_CJK_FONT_VARIATIONS: nScript = CSS1_OUTMODE_CJK; break; + case RES_CHRATR_CTL_FONT_VARIATIONS: nScript = CSS1_OUTMODE_CTL; break; + } + if( !rWrt.IsCSS1Script( nScript ) ) + return rWrt; + const auto& rVariations = static_cast(rHt).GetVariations(); if( !rVariations.empty() ) { @@ -3487,6 +3496,8 @@ SwAttrFnTab const aCSS1AttrFnTab = { /* RES_CHRATR_SCRIPT_HINT */ nullptr, /* RES_CHRATR_OPTICAL_SIZING */ OutCSS1_SvxOpticalSizing, /* RES_CHRATR_FONT_VARIATIONS */ OutCSS1_SvxFontVariations, +/* RES_CHRATR_CJK_FONT_VARIATIONS */ OutCSS1_SvxFontVariations, +/* RES_CHRATR_CTL_FONT_VARIATIONS */ OutCSS1_SvxFontVariations, /* RES_TXTATR_REFMARK */ nullptr, /* RES_TXTATR_TOXMARK */ nullptr, diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index e55f8b6c0319..2c35f2e14887 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -3326,6 +3326,8 @@ const SwAttrFnTab aHTMLAttrFnTab = { /* RES_CHRATR_SCRIPT_HINT */ nullptr, /* RES_CHRATR_OPTICAL_SIZING */ OutHTML_CSS1Attr, /* RES_CHRATR_FONT_VARIATIONS */ OutHTML_CSS1Attr, +/* RES_CHRATR_CJK_FONT_VARIATIONS */ OutHTML_CSS1Attr, +/* RES_CHRATR_CTL_FONT_VARIATIONS */ OutHTML_CSS1Attr, /* RES_TXTATR_REFMARK */ nullptr, /* RES_TXTATR_TOXMARK */ nullptr, diff --git a/sw/source/filter/html/htmlcss1.cxx b/sw/source/filter/html/htmlcss1.cxx index 52b43bac388e..c00d047de0e4 100644 --- a/sw/source/filter/html/htmlcss1.cxx +++ b/sw/source/filter/html/htmlcss1.cxx @@ -1606,6 +1606,12 @@ HTMLAttr **SwHTMLParser::GetAttrTabEntry( sal_uInt16 nWhich ) case RES_CHRATR_FONT_VARIATIONS: ppAttr = &m_xAttrTab->pFontVariations; break; + case RES_CHRATR_CJK_FONT_VARIATIONS: + ppAttr = &m_xAttrTab->pFontVariationsCJK; + break; + case RES_CHRATR_CTL_FONT_VARIATIONS: + ppAttr = &m_xAttrTab->pFontVariationsCTL; + break; case RES_CHRATR_BOX: ppAttr = &m_xAttrTab->pCharBox; break; diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 02184ca09a8d..a9d2713d171a 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -288,6 +288,8 @@ struct SvxCSS1ItemIds sal_uInt16 nBlink; sal_uInt16 nOpticalSizing; sal_uInt16 nFontVariations; + sal_uInt16 nFontVariationsCJK; + sal_uInt16 nFontVariationsCTL; sal_uInt16 nLineSpacing; sal_uInt16 nAdjust; @@ -745,6 +747,8 @@ SvxCSS1Parser::SvxCSS1Parser( SfxItemPool& rPool, OUString aBaseURL, aItemIds.nBlink = initTrueWhich( SID_ATTR_FLASH ); aItemIds.nOpticalSizing = initTrueWhich( SID_ATTR_CHAR_OPTICAL_SIZING ); aItemIds.nFontVariations = initTrueWhich( SID_ATTR_CHAR_FONT_VARIATIONS ); + aItemIds.nFontVariationsCJK = initTrueWhich( SID_ATTR_CHAR_CJK_FONT_VARIATIONS ); + aItemIds.nFontVariationsCTL = initTrueWhich( SID_ATTR_CHAR_CTL_FONT_VARIATIONS ); aItemIds.nLineSpacing = initTrueWhich( SID_ATTR_PARA_LINESPACE ); aItemIds.nAdjust = initTrueWhich( SID_ATTR_PARA_ADJUST ); @@ -1297,7 +1301,14 @@ static void ParseCSS1_font_variation_settings( const CSS1Expression *pExpr, } if( !aVariations.empty() ) - rItemSet.Put( SvxFontVariationsItem( std::move(aVariations), aItemIds.nFontVariations ) ); + { + SvxFontVariationsItem aItem( std::move(aVariations), aItemIds.nFontVariations ); + rItemSet.Put( aItem ); + aItem.SetWhich( aItemIds.nFontVariationsCJK ); + rItemSet.Put( aItem ); + aItem.SetWhich( aItemIds.nFontVariationsCTL ); + rItemSet.Put( aItem ); + } } static void ParseCSS1_text_transform( const CSS1Expression *pExpr, diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 5bef30c3462b..1374cab5e597 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -131,6 +131,8 @@ struct HTMLAttrTable HTMLAttr* pCharBox; HTMLAttr* pOpticalSizing; HTMLAttr* pFontVariations; + HTMLAttr* pFontVariationsCJK; + HTMLAttr* pFontVariationsCTL; }; class HTMLAttr diff --git a/xmloff/inc/xmlprop.hxx b/xmloff/inc/xmlprop.hxx index 679c4c57629a..6c43722cd239 100644 --- a/xmloff/inc/xmlprop.hxx +++ b/xmloff/inc/xmlprop.hxx @@ -89,6 +89,8 @@ inline constexpr OUString PROP_CharFontStyleName = u"CharFontStyleName"_ustr; inline constexpr OUString PROP_CharFontStyleNameAsian = u"CharFontStyleNameAsian"_ustr; inline constexpr OUString PROP_CharFontStyleNameComplex = u"CharFontStyleNameComplex"_ustr; inline constexpr OUString PROP_CharFontVariations = u"CharFontVariations"_ustr; +inline constexpr OUString PROP_CharFontVariationsAsian = u"CharFontVariationsAsian"_ustr; +inline constexpr OUString PROP_CharFontVariationsComplex = u"CharFontVariationsComplex"_ustr; inline constexpr OUString PROP_CharHeight = u"CharHeight"_ustr; inline constexpr OUString PROP_CharHeightAsian = u"CharHeightAsian"_ustr; inline constexpr OUString PROP_CharHeightComplex = u"CharHeightComplex"_ustr; diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx index 7520f237c33f..62ac360567a0 100644 --- a/xmloff/source/core/xmltoken.cxx +++ b/xmloff/source/core/xmltoken.cxx @@ -912,6 +912,8 @@ namespace xmloff::token { TOKEN( "font-style-name-asian", XML_FONT_STYLE_NAME_ASIAN ), TOKEN( "font-style-name-complex", XML_FONT_STYLE_NAME_COMPLEX ), TOKEN( "font-variation-settings", XML_FONT_VARIATION_SETTINGS ), + TOKEN( "font-variation-settings-asian", XML_FONT_VARIATION_SETTINGS_ASIAN ), + TOKEN( "font-variation-settings-complex", XML_FONT_VARIATION_SETTINGS_COMPLEX ), TOKEN( "font-variant", XML_FONT_VARIANT ), TOKEN( "font-weight", XML_FONT_WEIGHT ), TOKEN( "font-weight-asian", XML_FONT_WEIGHT_ASIAN ), diff --git a/xmloff/source/text/txtprmap.cxx b/xmloff/source/text/txtprmap.cxx index 74d72c4ba781..c50f61c3fdbf 100644 --- a/xmloff/source/text/txtprmap.cxx +++ b/xmloff/source/text/txtprmap.cxx @@ -255,6 +255,8 @@ XMLPropertyMapEntry constexpr aXMLParaPropMap[] = MT_E( PROP_CharRelief, XML_NAMESPACE_STYLE, XML_FONT_RELIEF, XML_TYPE_TEXT_FONT_RELIEF, 0 ), MAP_EXT( PROP_CharOpticalSizing, XML_NAMESPACE_LO_EXT, XML_FONT_OPTICAL_SIZING, XML_TYPE_TEXT_FONT_OPTICAL_SIZING | XML_TYPE_PROP_TEXT, 0 ), MAP_EXT( PROP_CharFontVariations, XML_NAMESPACE_LO_EXT, XML_FONT_VARIATION_SETTINGS, XML_TYPE_STRING | XML_TYPE_PROP_TEXT, 0 ), + MAP_EXT( PROP_CharFontVariationsAsian, XML_NAMESPACE_LO_EXT, XML_FONT_VARIATION_SETTINGS_ASIAN, XML_TYPE_STRING | XML_TYPE_PROP_TEXT, 0 ), + MAP_EXT( PROP_CharFontVariationsComplex, XML_NAMESPACE_LO_EXT, XML_FONT_VARIATION_SETTINGS_COMPLEX, XML_TYPE_STRING | XML_TYPE_PROP_TEXT, 0 ), // RES_CHRATR_HIDDEN MT_E( PROP_CharHidden, XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TYPE_TEXT_HIDDEN_AS_DISPLAY|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_TEXT_DISPLAY ), // RES_CHRATR_OVERLINE @@ -645,6 +647,8 @@ XMLPropertyMapEntry constexpr aXMLTextPropMap[] = MT_E( PROP_CharRelief, XML_NAMESPACE_STYLE, XML_FONT_RELIEF, XML_TYPE_TEXT_FONT_RELIEF, 0 ), MAP_EXT( PROP_CharOpticalSizing, XML_NAMESPACE_LO_EXT, XML_FONT_OPTICAL_SIZING, XML_TYPE_TEXT_FONT_OPTICAL_SIZING | XML_TYPE_PROP_TEXT, 0 ), MAP_EXT( PROP_CharFontVariations, XML_NAMESPACE_LO_EXT, XML_FONT_VARIATION_SETTINGS, XML_TYPE_STRING | XML_TYPE_PROP_TEXT, 0 ), + MAP_EXT( PROP_CharFontVariationsAsian, XML_NAMESPACE_LO_EXT, XML_FONT_VARIATION_SETTINGS_ASIAN, XML_TYPE_STRING | XML_TYPE_PROP_TEXT, 0 ), + MAP_EXT( PROP_CharFontVariationsComplex, XML_NAMESPACE_LO_EXT, XML_FONT_VARIATION_SETTINGS_COMPLEX, XML_TYPE_STRING | XML_TYPE_PROP_TEXT, 0 ), // RES_CHRATR_HIDDEN MT_E( PROP_CharHidden, XML_NAMESPACE_TEXT, XML_DISPLAY, XML_TYPE_TEXT_HIDDEN_AS_DISPLAY|MID_FLAG_SPECIAL_ITEM_IMPORT, CTF_TEXT_DISPLAY ), // RES_CHRATR_OVERLINE diff --git a/xmloff/source/token/tokens.txt b/xmloff/source/token/tokens.txt index 21edb1cdb27a..27ce2a6b7d88 100644 --- a/xmloff/source/token/tokens.txt +++ b/xmloff/source/token/tokens.txt @@ -816,6 +816,8 @@ font-style-name font-style-name-asian font-style-name-complex font-variation-settings +font-variation-settings-asian +font-variation-settings-complex font-variant font-weight font-weight-asian