diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-09 13:03:07 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-18 18:21:09 +0200 |
commit | e27572686130df43d1d65c574b0c34f39fc0d1a9 (patch) | |
tree | 9531c7778adc6ee9830fb91f1024533f549d3b8d /svgio/inc | |
parent | d7214aba95bbdcbd40e87ef50fc66f2e2ec4f5ff (diff) |
tdf#160593: make sure to use current element's font size for em unit
According to https://drafts.csswg.org/css-values-4/#font-relative-length
em is "equal to the computed value of the font-size property of the element
on which it is used". This means, that for an element that defines its own
font-size, attributes like 'dy' using em refer to the new font-size, not to
inherited font-size.
Change-Id: Ie5a013df99a68edddf466e4c0ee5311f6219fcb2
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166233
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svgio/inc')
-rw-r--r-- | svgio/inc/SvgNumber.hxx | 4 | ||||
-rw-r--r-- | svgio/inc/svgnode.hxx | 3 | ||||
-rw-r--r-- | svgio/inc/svgtspannode.hxx | 2 |
3 files changed, 3 insertions, 6 deletions
diff --git a/svgio/inc/SvgNumber.hxx b/svgio/inc/SvgNumber.hxx index b2fc51b6f7ac..6e371ba94b26 100644 --- a/svgio/inc/SvgNumber.hxx +++ b/svgio/inc/SvgNumber.hxx @@ -37,8 +37,8 @@ class InfoProvider public: virtual ~InfoProvider() {} virtual basegfx::B2DRange getCurrentViewPort() const = 0; - /// return font size of node inherited from parents - virtual double getCurrentFontSizeInherited() const = 0; + /// return font size of node, either set here or inherited from parents + virtual double getCurrentFontSize() const = 0; /// return xheight of node inherited from parents virtual double getCurrentXHeightInherited() const = 0; }; diff --git a/svgio/inc/svgnode.hxx b/svgio/inc/svgnode.hxx index 073b011c5f6c..6732e8bb142d 100644 --- a/svgio/inc/svgnode.hxx +++ b/svgio/inc/svgnode.hxx @@ -164,10 +164,9 @@ namespace svgio::svgreader /// InfoProvider support for %, em and ex values virtual basegfx::B2DRange getCurrentViewPort() const override; - virtual double getCurrentFontSizeInherited() const override; + virtual double getCurrentFontSize() const override; virtual double getCurrentXHeightInherited() const override; - double getCurrentFontSize() const; double getCurrentXHeight() const; /// Id access diff --git a/svgio/inc/svgtspannode.hxx b/svgio/inc/svgtspannode.hxx index 84033685d8f9..0740c3cece24 100644 --- a/svgio/inc/svgtspannode.hxx +++ b/svgio/inc/svgtspannode.hxx @@ -53,8 +53,6 @@ namespace svgio::svgreader virtual const SvgStyleAttributes* getSvgStyleAttributes() const override; virtual void parseAttribute(SVGToken aSVGToken, const OUString& aContent) override; - double getCurrentFontSize() const; - /// X content const SvgNumberVector& getX() const { return maX; } void setX(SvgNumberVector&& aX) { maX = std::move(aX); } |