[Libreoffice-commits] core.git: svgio/source
Xisco Fauli
anistenis at gmail.com
Tue Jan 26 01:19:38 PST 2016
svgio/source/svgreader/svgstyleattributes.cxx | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
New commits:
commit 7c151f39144b7401a99c7b736a41e5dce4ac4db1
Author: Xisco Fauli <anistenis at gmail.com>
Date: Sun Jan 17 23:54:31 2016 +0100
SVGIO: Fix issue when font size is in percentage and ...
... there's no parent style set
Sample:
<?xml version="1.0" encoding="UTF-8"?>
<svg height="600" width="400"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
font-size="100%">
<text x="5" y="15">Sample 1</text>
</svg>
Change-Id: Iec88c148475bf8a610286414083e9801faaf8d78
Reviewed-on: https://gerrit.libreoffice.org/21553
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 0bb05b4..3e3fa00 100644
--- a/svgio/source/svgreader/svgstyleattributes.cxx
+++ b/svgio/source/svgreader/svgstyleattributes.cxx
@@ -2314,6 +2314,10 @@ namespace svgio
SvgNumber SvgStyleAttributes::getFontSizeNumber() const
{
+ // default size is 'medium' or 16px, which is equal to the default PPI used in svgio ( 96.0 )
+ // converted to pixels
+ const double aDefaultSize = F_SVG_PIXEL_PER_INCH / 6.0;
+
if(maFontSizeNumber.isSet())
{
// #122524# Handle Unit_percent realtive to parent FontSize (see SVG1.1
@@ -2332,15 +2336,15 @@ namespace svgio
aParentNumber.getUnit(),
true);
}
+ // if there's no parent style, set the font size based on the default size
+ // 100% = 16px
+ return SvgNumber(
+ maFontSizeNumber.getNumber() * aDefaultSize / 100.0, Unit_px, true);
}
return maFontSizeNumber;
}
- // default size is 'medium' or 16px, which is equal to the default PPI used in svgio ( 96.0 )
- // converted to pixels
- const double aDefaultSize = F_SVG_PIXEL_PER_INCH / 6.0;
-
//In CSS2, the suggested scaling factor between adjacent indexes is 1.2
switch(maFontSize)
{
More information about the Libreoffice-commits
mailing list