Implementing SVG attribute "stroke-miterlimit" ( tdf#48066)

Regina Henschel rb.henschel at t-online.de
Thu Apr 7 12:35:31 UTC 2016


Hi all,

I have made some progress. But a new problem comes up.

I have changed WinSalGraphicsImpl::drawPolyLine [3] so that it gets an 
additional parameter fMiterMinimumAngle (same meaning as in 
createAreaGeometryForJoin) and uses it for gdi+. The rendering in 
edit-mode in Draw and Impress is correct then with gdi+ on Windows. Even 
Text in SVG works out of the box. [BTW: The current rendering using gdi+ 
is wrong, see my report bug#99102.]

The behavior of gdi+ is described in [1]. To get the same kind of 
behavior as in LO, when the miter limit is exceeded, the LineJoin type 
'LineJoinMiterClipped' has to be used.

Being only in LibreOffice and SVG, that would be no problem. But MS 
seems to use different defaults. The rendering in PowerPoint looks like 
gdi+ type 'LineJoinMiter'. The specification for 'lim' in ECMA-376, Part 
1, chapter 20.1.8.43, has no details, and I have not found details 
otherwhere.

This gdi+ type 'LineJoinMiter' kind of clipping (see the image in the 
article [1]) will be used in SVG 2 [2] too under the identifier 
'miter-clip'.

So my question: Ignore interoperability with MS? If not, how to solve it?

Kind regards
Regina

[1] 
https://msdn.microsoft.com/en-us/library/windows/desktop/ms534148%28v=vs.85%29.aspx

[2] https://www.w3.org/TR/svg-strokes/#StrokeShape

[3]
diff --git a/vcl/win/gdi/gdiimpl.cxx b/vcl/win/gdi/gdiimpl.cxx
index 7febbe8..36ecb31 100644
--- a/vcl/win/gdi/gdiimpl.cxx
+++ b/vcl/win/gdi/gdiimpl.cxx
@@ -2031,7 +2031,8 @@ bool WinSalGraphicsImpl::drawPolyLine(
      double fTransparency,
      const basegfx::B2DVector& rLineWidths,
      basegfx::B2DLineJoin eLineJoin,
-    css::drawing::LineCap eLineCap)
+    css::drawing::LineCap eLineCap,
+    double fMiterMinimumAngle)
  {
      const sal_uInt32 nCount(rPolygon.count());

@@ -2064,9 +2065,9 @@ bool WinSalGraphicsImpl::drawPolyLine(
              }
              case basegfx::B2DLineJoin::Miter :
              {
-                const Gdiplus::REAL aMiterLimit(15.0);
+                const Gdiplus::REAL 
aMiterLimit(1/sin(fMiterMinimumAngle/2.0));
                  Gdiplus::DllExports::GdipSetPenMiterLimit(pTestPen, 
aMiterLimit);
-                Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, 
Gdiplus::LineJoinMiter);
+                Gdiplus::DllExports::GdipSetPenLineJoin(pTestPen, 
Gdiplus::LineJoinMiterClipped);
                  break;
              }
              case basegfx::B2DLineJoin::Round :



More information about the LibreOffice mailing list