Bug 142261 - [EMF/EMF+] SetMiterLimit support
Summary: [EMF/EMF+] SetMiterLimit support
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
Version:
(earliest affected)
7.2.0.0.alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard: target:7.4.0
Keywords:
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2021-05-13 18:01 UTC by Valek Filippov
Modified: 2022-05-13 21:19 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
EMF sample with SetMiterLimit 2 and SetMiterLimit 20 (340 bytes, image/x-emf)
2021-05-13 18:02 UTC, Valek Filippov
Details
Screenshot of the sample EMF file opened in MS Paint (4.83 KB, image/png)
2021-05-13 18:04 UTC, Valek Filippov
Details
How it looks in LO 7.2 master from May 11, 2021 (1.72 KB, image/png)
2021-05-13 18:05 UTC, Valek Filippov
Details
EMF+ with different Line Joints and different Line Miter Minimum Angles (51.42 KB, image/emf)
2022-05-12 11:52 UTC, Bartosz
Details
EMF+ This is how it should looks like (MS Paint) (607.67 KB, image/png)
2022-05-12 11:53 UTC, Bartosz
Details
EMF with different Line Joints and different Line Miter Minimum Angles (2.84 KB, image/emf)
2022-05-13 21:19 UTC, Bartosz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Valek Filippov 2021-05-13 18:01:02 UTC
Description:
LO doesn't support SetMiterLimit

Steps to Reproduce:
Open attached EMF sample

Actual Results:
LO bevels both joins

Expected Results:
Only join of the left shape should be beveled


Reproducible: Always


User Profile Reset: No



Additional Info:
Probably more samples with different miter values would be required to figure out the right behavior.
Comment 1 Valek Filippov 2021-05-13 18:02:05 UTC
Created attachment 171970 [details]
EMF sample with SetMiterLimit 2 and SetMiterLimit 20
Comment 2 Valek Filippov 2021-05-13 18:04:40 UTC
Created attachment 171971 [details]
Screenshot of the sample EMF file opened in MS Paint
Comment 3 Valek Filippov 2021-05-13 18:05:05 UTC
Created attachment 171972 [details]
How it looks in LO 7.2 master from May 11, 2021
Comment 4 Roman Kuznetsov 2021-05-22 17:52:24 UTC
confirm in

Version: 7.2.0.0.alpha1+ / LibreOffice Community
Build ID: 128f67e0efa02294205a1abe1be874557ecdcecd
CPU threads: 4; OS: Linux 5.5; UI render: default; VCL: kf5 (cairo+xcb)
Locale: ru-RU (ru_RU.UTF-8); UI: ru-RU
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-05-19_06:21:05
Calc: threaded
Comment 5 Bartosz 2022-04-20 07:22:52 UTC
More information about miter is available at:
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-miterlimit

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-emfplus/5ef071f3-f503-4f16-b027-7c4bcf2d1d81

https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-emf/2637d0d0-92dd-48e8-be5e-6400b4d1fc5e

In vcl/win/gdi/gdiimpl.cxx there is an mehod which translate miterangle to miterlimit:

        case basegfx::B2DLineJoin::Miter :
        {
            const Gdiplus::REAL aMiterLimit(1.0/sin(fMiterMinimumAngle/2.0));

            aPen.SetMiterLimit(aMiterLimit);
            // tdf#99165 MS's LineJoinMiter creates non standard conform miter additional
            // graphics, somewhere clipped in some distance from the edge point, dependent
            // of MiterLimit. The more default-like option is LineJoinMiterClipped, so use
            // that instead
            aPen.SetLineJoin(Gdiplus::LineJoinMiterClipped);
            break;
        }
Comment 6 Bartosz 2022-05-12 11:52:36 UTC
Created attachment 180074 [details]
EMF+ with different Line Joints and different Line Miter Minimum Angles
Comment 7 Bartosz 2022-05-12 11:53:10 UTC
Created attachment 180075 [details]
EMF+ This is how it should looks like (MS Paint)
Comment 8 Commit Notification 2022-05-13 11:50:18 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/e709ebe42ad06974b822366e4eea1a6c2ee61e10

tdf#142261 EMF+ Add support for Miter Limit

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 9 Bartosz 2022-05-13 21:19:10 UTC
Created attachment 180109 [details]
EMF with different Line Joints and different Line Miter Minimum Angles