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 <khaled@libreoffice.org>
This commit is contained in:
Khaled Hosny
2026-03-02 21:46:13 +01:00
committed by Khaled Hosny
parent 059b717535
commit 5825e9cfdb
10 changed files with 25 additions and 7 deletions
@@ -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()));
}
}
@@ -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),
@@ -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());
@@ -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);
@@ -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,
+3 -1
View File
@@ -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());
}
}
@@ -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;
@@ -90,6 +90,7 @@ namespace drawinglayer::primitive2d
const basegfx::BColor& rFontColor,
const Color& rFillColor,
short nLetterSpacing,
bool bOpticalSizing,
/// local parameters
const basegfx::BColor& rOverlineColor,
@@ -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;
@@ -420,6 +420,7 @@ namespace svgio::svgreader
aFill,
COL_TRANSPARENT,
0,
false,
// extra props for decorated
aDecoColor,