summaryrefslogtreecommitdiff
path: root/svgio/source
diff options
context:
space:
mode:
authorXisco Fauli <anistenis@gmail.com>2016-01-17 23:54:31 +0100
committerArmin Le Grand <Armin.Le.Grand@cib.de>2016-01-26 09:19:04 +0000
commit7c151f39144b7401a99c7b736a41e5dce4ac4db1 (patch)
treecd9dab9d2fa815d392adb1d413373948cd92a7f4 /svgio/source
parent3bd5a251925d8660718553a7702198d6d2251502 (diff)
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@libreoffice.org> Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'svgio/source')
-rw-r--r--svgio/source/svgreader/svgstyleattributes.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/svgio/source/svgreader/svgstyleattributes.cxx b/svgio/source/svgreader/svgstyleattributes.cxx
index 0bb05b4341d1..3e3fa0091378 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)
{