drawinglayer/source/primitive2d/textbreakuphelper.cxx         |    4 +++-
 drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx  |    4 +++-
 drawinglayer/source/primitive2d/textprimitive2d.cxx           |    4 +++-
 drawinglayer/source/processor2d/vclprocessor2d.cxx            |    2 ++
 drawinglayer/source/tools/emfphelperdata.cxx                  |    2 ++
 drawinglayer/source/tools/wmfemfhelper.cxx                    |    4 +++-
 editeng/source/editeng/StripPortionsHelper.cxx                |    4 ++--
 include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx |    1 +
 include/drawinglayer/primitive2d/textprimitive2d.hxx          |    6 +++++-
 svgio/source/svgreader/svgcharacternode.cxx                   |    1 +
 10 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit 5825e9cfdbe8c8ab33a4db06bc9581aaed6c48de
Author:     Khaled Hosny <[email protected]>
AuthorDate: Mon Mar 2 08:33:11 2026 +0200
Commit:     Khaled Hosny <[email protected]>
CommitDate: Mon Mar 2 21:46:13 2026 +0100

    tdf#153368: Support optical size for variable fonts, part 8
    
    Channel optical sizing option through drawing layer, otherwise it
    doesn’t work in Draw/Impress.
    
    Change-Id: I96cd3177dcf816b5c1e065663d4a8c90f187704f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/200765
    Tested-by: Jenkins
    Reviewed-by: Khaled Hosny <[email protected]>

diff --git a/drawinglayer/source/primitive2d/textbreakuphelper.cxx 
b/drawinglayer/source/primitive2d/textbreakuphelper.cxx
index 12bcc9d73bc2..fe0b71a67d9c 100644
--- a/drawinglayer/source/primitive2d/textbreakuphelper.cxx
+++ b/drawinglayer/source/primitive2d/textbreakuphelper.cxx
@@ -148,6 +148,7 @@ namespace drawinglayer::primitive2d
                         mrSource.getFontColor(),
                         mrSource.getTextFillColor(),
                         mrSource.getLetterSpacing(),
+                        mrSource.getOpticalSizing(),
 
                         pTextDecoratedPortionPrimitive2D->getOverlineColor(),
                         pTextDecoratedPortionPrimitive2D->getTextlineColor(),
@@ -180,7 +181,8 @@ namespace drawinglayer::primitive2d
                         mrSource.getLocale(),
                         mrSource.getFontColor(),
                         COL_TRANSPARENT,
-                        mrSource.getLetterSpacing()));
+                        mrSource.getLetterSpacing(),
+                        mrSource.getOpticalSizing()));
             }
         }
 
diff --git a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
index 2d95a178d172..7421fa7e1271 100644
--- a/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textdecoratedprimitive2d.cxx
@@ -465,6 +465,7 @@ namespace drawinglayer::primitive2d
             const basegfx::BColor& rFontColor,
             const Color& rFillColor,
             short nLetterSpacing,
+            bool bOpticalSizing,
 
             // local parameters
             const basegfx::BColor& rOverlineColor,
@@ -490,7 +491,8 @@ namespace drawinglayer::primitive2d
                 rLocale,
                 rFontColor,
                 rFillColor,
-                nLetterSpacing),
+                nLetterSpacing,
+                bOpticalSizing),
             maBufferedBrokenUpText(),
             maBufferedDecorationGeometry(),
             maOverlineColor(rOverlineColor),
diff --git a/drawinglayer/source/primitive2d/textprimitive2d.cxx 
b/drawinglayer/source/primitive2d/textprimitive2d.cxx
index b16c530f04c2..137d867cee38 100644
--- a/drawinglayer/source/primitive2d/textprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/textprimitive2d.cxx
@@ -205,7 +205,8 @@ TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D(
     basegfx::B2DHomMatrix rNewTransform, OUString rText, sal_Int32 
nTextPosition,
     sal_Int32 nTextLength, std::vector<double>&& rDXArray, 
std::vector<sal_Bool>&& rKashidaArray,
     attribute::FontAttribute aFontAttribute, css::lang::Locale aLocale,
-    const basegfx::BColor& rFontColor, const Color& rTextFillColor, short 
nLetterSpacing)
+    const basegfx::BColor& rFontColor, const Color& rTextFillColor, short 
nLetterSpacing,
+    bool bOpticalSizing)
     : maTextTransform(std::move(rNewTransform))
     , maText(std::move(rText))
     , mnTextPosition(nTextPosition)
@@ -217,6 +218,7 @@ TextSimplePortionPrimitive2D::TextSimplePortionPrimitive2D(
     , maFontColor(rFontColor)
     , maTextFillColor(rTextFillColor)
     , mnLetterSpacing(nLetterSpacing)
+    , mbOpticalSizing(bOpticalSizing)
 {
 #if OSL_DEBUG_LEVEL > 0
     const sal_Int32 aStringLength(getText().getLength());
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx 
b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index bcaaa1c3c360..28a2d63baaec 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -452,6 +452,8 @@ void 
VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
             // tdf#168371 set letter spacing so that VCL knows it has to 
disable ligatures
             aFont.SetFixKerning(rTextCandidate.getLetterSpacing());
 
+            aFont.SetOpticalSizing(rTextCandidate.getOpticalSizing());
+
             // tdf#152990 set the font after the MapMode is (potentially) set 
so canvas uses the desired
             // font size
             mpOutputDevice->SetFont(aFont);
diff --git a/drawinglayer/source/tools/emfphelperdata.cxx 
b/drawinglayer/source/tools/emfphelperdata.cxx
index 0edcda846828..ec5590e5eb26 100644
--- a/drawinglayer/source/tools/emfphelperdata.cxx
+++ b/drawinglayer/source/tools/emfphelperdata.cxx
@@ -1771,6 +1771,7 @@ namespace emfplushelper
                                             color.getBColor(), // Font Color
                                             COL_TRANSPARENT,   // Fill Color
                                             0,
+                                            false,
                                             color.getBColor(), // OverlineColor
                                             color.getBColor(), // TextlineColor
                                             
drawinglayer::primitive2d::TEXT_LINE_NONE,
@@ -2270,6 +2271,7 @@ namespace emfplushelper
                                                     color.getBColor(),
                                                     COL_TRANSPARENT,
                                                     0,
+                                                    false,
                                                     color.getBColor(),
                                                     color.getBColor(),
                                                     
drawinglayer::primitive2d::TEXT_LINE_NONE,
diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx 
b/drawinglayer/source/tools/wmfemfhelper.cxx
index 716c1653b33a..aed7755b0c21 100644
--- a/drawinglayer/source/tools/wmfemfhelper.cxx
+++ b/drawinglayer/source/tools/wmfemfhelper.cxx
@@ -1130,6 +1130,7 @@ namespace wmfemfhelper
                     aFontColor,
                     aFillColor,
                     rFont.GetFixKerning(),
+                    rFont.GetOpticalSizing(),
 
                     // attributes for TextDecoratedPortionPrimitive2D
                     rProperty.getOverlineColorActive() ? 
rProperty.getOverlineColor() : aFontColor,
@@ -1159,7 +1160,8 @@ namespace wmfemfhelper
                     std::move(aLocale),
                     aFontColor,
                     COL_TRANSPARENT,
-                    rFont.GetFixKerning());
+                    rFont.GetFixKerning(),
+                    rFont.GetOpticalSizing());
             }
         }
 
diff --git a/editeng/source/editeng/StripPortionsHelper.cxx 
b/editeng/source/editeng/StripPortionsHelper.cxx
index e04a25316960..d31956e45b18 100644
--- a/editeng/source/editeng/StripPortionsHelper.cxx
+++ b/editeng/source/editeng/StripPortionsHelper.cxx
@@ -201,7 +201,7 @@ buildTextPortionPrimitive(const DrawPortionInfo& rInfo, 
const OUString& rText,
             rNewTransform, rText, rInfo.mnTextStart, rInfo.mnTextLen, 
std::vector(rDXArray),
             std::move(aKashidaArray), rFontAttribute,
             rInfo.mpLocale ? *rInfo.mpLocale : css::lang::Locale(), 
aBFontColor, aTextFillColor,
-            rInfo.mrFont.GetFixKerning(),
+            rInfo.mrFont.GetFixKerning(), rInfo.mrFont.GetOpticalSizing(),
 
             // attributes for TextDecoratedPortionPrimitive2D
             aBOverlineColor, aBUnderlineColor, eFontOverline, eFontLineStyle, 
bUnderlineAbove,
@@ -215,7 +215,7 @@ buildTextPortionPrimitive(const DrawPortionInfo& rInfo, 
const OUString& rText,
             rNewTransform, rText, rInfo.mnTextStart, rInfo.mnTextLen, 
std::vector(rDXArray),
             std::move(aKashidaArray), rFontAttribute,
             rInfo.mpLocale ? *rInfo.mpLocale : css::lang::Locale(), 
aBFontColor, aTextFillColor,
-            rInfo.mrFont.GetFixKerning());
+            rInfo.mrFont.GetFixKerning(), rInfo.mrFont.GetOpticalSizing());
     }
 
     return pNewPrimitive;
diff --git a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx 
b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
index c635dc93ecfe..50a75e706386 100644
--- a/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textdecoratedprimitive2d.hxx
@@ -90,6 +90,7 @@ namespace drawinglayer::primitive2d
                 const basegfx::BColor& rFontColor,
                 const Color& rFillColor,
                 short nLetterSpacing,
+                bool bOpticalSizing,
 
                 /// local parameters
                 const basegfx::BColor& rOverlineColor,
diff --git a/include/drawinglayer/primitive2d/textprimitive2d.hxx 
b/include/drawinglayer/primitive2d/textprimitive2d.hxx
index 7916d4916b4f..e368acc5a2a8 100644
--- a/include/drawinglayer/primitive2d/textprimitive2d.hxx
+++ b/include/drawinglayer/primitive2d/textprimitive2d.hxx
@@ -138,6 +138,9 @@ private:
     /// Letter spacing
     short mnLetterSpacing;
 
+    /// Optical sizing
+    bool mbOpticalSizing;
+
 protected:
     /// local decomposition.
     virtual Primitive2DReference
@@ -158,7 +161,7 @@ public:
                                  attribute::FontAttribute aFontAttribute, 
css::lang::Locale aLocale,
                                  const basegfx::BColor& rFontColor,
                                  const Color& rTextFillColor = COL_TRANSPARENT,
-                                 short nLetterSpacing = 0);
+                                 short nLetterSpacing = 0, bool bOpticalSizing 
= false);
 
     /** get text outlines as polygons and their according 
ObjectTransformation. Handles all
         the necessary VCL outline extractions, scaling adaptations and other 
stuff.
@@ -178,6 +181,7 @@ public:
     const basegfx::BColor& getFontColor() const { return maFontColor; }
     const Color& getTextFillColor() const { return maTextFillColor; }
     short getLetterSpacing() const { return mnLetterSpacing; }
+    bool getOpticalSizing() const { return mbOpticalSizing; }
 
     /// helpers for determining various decoration states
     virtual bool hasTextRelief() const;
diff --git a/svgio/source/svgreader/svgcharacternode.cxx 
b/svgio/source/svgreader/svgcharacternode.cxx
index 1ea05de21219..cc27be2f59af 100644
--- a/svgio/source/svgreader/svgcharacternode.cxx
+++ b/svgio/source/svgreader/svgcharacternode.cxx
@@ -420,6 +420,7 @@ namespace svgio::svgreader
                     aFill,
                     COL_TRANSPARENT,
                     0,
+                    false,
 
                     // extra props for decorated
                     aDecoColor,

Reply via email to