[Libreoffice-commits] core.git: filter/source
Xisco Fauli
anistenis at gmail.com
Fri Nov 27 08:13:50 PST 2015
filter/source/svg/units.cxx | 17 +++++++++--------
filter/source/svg/units.hxx | 4 ++++
2 files changed, 13 insertions(+), 8 deletions(-)
New commits:
commit 33e49a3b6655c1503dc81b583f5016fc3b2fda19
Author: Xisco Fauli <anistenis at gmail.com>
Date: Wed Nov 25 20:26:06 2015 +0100
tdf#96046 SVG: use the same PPI as in svgio
Change-Id: I211dcc6fb242cfbd05636d42a811523de8e83be6
Reviewed-on: https://gerrit.libreoffice.org/20182
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Armin Le Grand <Armin.Le.Grand at cib.de>
diff --git a/filter/source/svg/units.cxx b/filter/source/svg/units.cxx
index 691305e..34360ac 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 84697e0b..d348104 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
{
More information about the Libreoffice-commits
mailing list