From ff7f5e1bbd4a9a3e3fa3e4ddb349c97605dc8a01 Mon Sep 17 00:00:00 2001 From: Bartosz Kosiorek Date: Sun, 7 May 2017 02:57:26 +0200 Subject: tdf#31814 Introduce minimal value of line width to fix EMF+ import issues Based on observation of different EMF+ files (eg. exported by ChemDraw), there is minimal value of line width. This commit is fixing all such import issues. Change-Id: I5c26a1b511363eb1e429bf770ad0f482b124ecb5 Reviewed-on: https://gerrit.libreoffice.org/37319 Tested-by: Jenkins Reviewed-by: Bartosz Kosiorek --- cppcanvas/source/mtfrenderer/emfppen.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cppcanvas/source/mtfrenderer/emfppen.cxx b/cppcanvas/source/mtfrenderer/emfppen.cxx index 03014b37b7a7..b3b0c97dcb8a 100755 --- a/cppcanvas/source/mtfrenderer/emfppen.cxx +++ b/cppcanvas/source/mtfrenderer/emfppen.cxx @@ -103,12 +103,16 @@ namespace cppcanvas void EMFPPen::SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) { -#if OSL_DEBUG_LEVEL > 1 - if (penWidth == 0.0) { - SAL_INFO("cppcanvas.emf", "TODO: pen with zero width - using minimal which might not be correct"); - } -#endif + // If a zero width is specified, a minimum value is used, which is determined by the units. + //TODO Add support for other units than Pixel rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize(penWidth == 0.0 ? 0.05 : penWidth, 0)).getLength()); + + // tdf#31814 Based on observation of different EMF+ files (eg. exported by ChemDraw), + // there is minimal value of line width + if (rStrokeAttributes.StrokeWidth < 1.0) + { + rStrokeAttributes.StrokeWidth = 1.0; + } } /// Convert stroke caps between EMF+ and rendering API -- cgit v1.2.3