diff options
author | Xisco Fauli <anistenis@gmail.com> | 2015-11-25 20:26:06 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-11-27 16:13:18 +0000 |
commit | 33e49a3b6655c1503dc81b583f5016fc3b2fda19 (patch) | |
tree | 2c5d140f629c84ea2d4d94d42989470de7172a3c /filter | |
parent | 49a32f4b2f1773df353bfd05af2f81d560025d18 (diff) |
tdf#96046 SVG: use the same PPI as in svgio
Change-Id: I211dcc6fb242cfbd05636d42a811523de8e83be6
Reviewed-on: https://gerrit.libreoffice.org/20182
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand@cib.de>
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/svg/units.cxx | 17 | ||||
-rw-r--r-- | filter/source/svg/units.hxx | 4 |
2 files changed, 13 insertions, 8 deletions
diff --git a/filter/source/svg/units.cxx b/filter/source/svg/units.cxx index 691305e5bf80..34360ac247ef 100644 --- a/filter/source/svg/units.cxx +++ b/filter/source/svg/units.cxx @@ -25,16 +25,17 @@ double convLength( double value, SvgUnit unit, const State& rState, char dir ) double fRet(value); switch ( unit ) { - case SVG_LENGTH_UNIT_CM: fRet *= 72.0/2.54; break; - case SVG_LENGTH_UNIT_IN: fRet *= 72.0; break; - case SVG_LENGTH_UNIT_MM: fRet *= 72.0/25.4; break; - case SVG_LENGTH_UNIT_PC: fRet *= 72.0/6.0; break; - case SVG_LENGTH_UNIT_USER: - case SVG_LENGTH_UNIT_PX: // no unit defaults to PX in svg, - // assume display to have 72DPI - case SVG_LENGTH_UNIT_PT: break; + case SVG_LENGTH_UNIT_CM: fRet *= F_SVG_PIXEL_PER_INCH/2.54; break; + case SVG_LENGTH_UNIT_IN: fRet *= F_SVG_PIXEL_PER_INCH; break; + case SVG_LENGTH_UNIT_MM: fRet *= F_SVG_PIXEL_PER_INCH/25.4; break; + case SVG_LENGTH_UNIT_PC: fRet *= F_SVG_PIXEL_PER_INCH/6.0; break; + case SVG_LENGTH_UNIT_PT: fRet *= F_SVG_PIXEL_PER_INCH/72.0; break; case SVG_LENGTH_UNIT_EM: fRet *= rState.mnFontSize; break; case SVG_LENGTH_UNIT_EX: fRet *= rState.mnFontSize / 2.0; break; + case SVG_LENGTH_UNIT_USER: + case SVG_LENGTH_UNIT_PX: + // no unit defaults to PX in svg, assume display to have 90DPI + break; case SVG_LENGTH_UNIT_PERCENTAGE: { double fBoxLen; diff --git a/filter/source/svg/units.hxx b/filter/source/svg/units.hxx index 84697e0b1f78..d348104de83c 100644 --- a/filter/source/svg/units.hxx +++ b/filter/source/svg/units.hxx @@ -14,6 +14,10 @@ namespace svgi { + // recommended value for this device dependent unit, see CSS2 section 4.3.2 Lengths + // Same as in svgio + #define F_SVG_PIXEL_PER_INCH 90.0 + struct State; enum SvgUnit { |