diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-09 16:04:40 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-04-19 05:18:50 +0200 |
commit | edef46e82e7e54a27004f9ee6e99108390736d12 (patch) | |
tree | c1071275ef31d5b50417f9529ca72daa88f21482 /svgio/source | |
parent | 75fe059974dcb80c3f78110c73ab799afc6f4ca3 (diff) |
tdf#160717: fix ex handling
Same as in commit e27572686130df43d1d65c574b0c34f39fc0d1a9
(tdf#160593: make sure to use current element's font size for em unit,
2024-04-18) for em.
Change-Id: Id9003c0426a6b373456da1aa1550f7ff07f766a3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/166235
Tested-by: Mike Kaganski <mike.kaganski@collabora.com>
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svgio/source')
-rw-r--r-- | svgio/source/svgreader/SvgNumber.cxx | 2 | ||||
-rw-r--r-- | svgio/source/svgreader/svgnode.cxx | 21 |
2 files changed, 5 insertions, 18 deletions
diff --git a/svgio/source/svgreader/SvgNumber.cxx b/svgio/source/svgreader/SvgNumber.cxx index 4a48ffbfb4e9..72a44dbdd032 100644 --- a/svgio/source/svgreader/SvgNumber.cxx +++ b/svgio/source/svgreader/SvgNumber.cxx @@ -39,7 +39,7 @@ double SvgNumber::solveNonPercentage(const InfoProvider& rInfoProvider) const case SvgUnit::em: return mfNumber * rInfoProvider.getCurrentFontSize(); case SvgUnit::ex: - return mfNumber * rInfoProvider.getCurrentXHeightInherited() * 0.5; + return mfNumber * rInfoProvider.getCurrentXHeight(); case SvgUnit::px: return mfNumber; case SvgUnit::pt: diff --git a/svgio/source/svgreader/svgnode.cxx b/svgio/source/svgreader/svgnode.cxx index a46fc1f76ccb..80d727a2c697 100644 --- a/svgio/source/svgreader/svgnode.cxx +++ b/svgio/source/svgreader/svgnode.cxx @@ -703,25 +703,12 @@ namespace { return 0.0; } - double SvgNode::getCurrentXHeightInherited() const - { - if(getParent()) - { - return getParent()->getCurrentXHeight(); - } - else - { - return 0.0; - } - } - double SvgNode::getCurrentXHeight() const { - if(getSvgStyleAttributes()) - // for XHeight, use FontSize currently - return getSvgStyleAttributes()->getFontSizeNumber().solve(*this, NumberType::ycoordinate); - - return getCurrentXHeightInherited(); + // https://drafts.csswg.org/css-values-4/#ex + // for XHeight, use 0.5em fallback currently + // FIXME: use "x-height of the first available font" + return getCurrentFontSize() * 0.5; } void SvgNode::setId(OUString const & rId) |