Bug 142161 - [EMF] PenStyle rendering is inaccurate, PS_INSIDEFRAME is incorrect
Summary: [EMF] PenStyle rendering is inaccurate, PS_INSIDEFRAME is incorrect
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: graphics stack (show other bugs)
(earliest affected)
5.2 all versions
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: bibisected, bisected
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
Reported: 2021-05-07 21:24 UTC by Valek Filippov
Modified: 2021-05-11 08:14 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

EMF sample with different pen styles (720 bytes, image/x-emf)
2021-05-07 21:25 UTC, Valek Filippov
Screenshot of the sample EMF file opened in MS Paint (10.33 KB, image/png)
2021-05-07 21:26 UTC, Valek Filippov
WMF sample for pen styles (324 bytes, image/x-wmf)
2021-05-07 21:52 UTC, Valek Filippov
How it looks in LibreOffice 7.2 master (29.91 KB, image/png)
2021-05-11 08:05 UTC, Xisco Faulí

Note You need to log in before you can comment on or make changes to this bug.
Description Valek Filippov 2021-05-07 21:24:28 UTC
LO seems to wrongly scale dashes in pen strokes and not consider PS_INSIDEFRAME for PenStyle in EMF.

Steps to Reproduce:
Open attached EMF sample.

Actual Results:
LO draws almost solid lines with a minimal gaps. Middle shape in the bottom row has the same size as other shapes.

Expected Results:
MS seems to use pen width to calculate the radius of the dots and add a gap of about same size between dots and/or dashes.
Width of the pen have to be equally distributed on both side of the path for all pens except PS_INSIDEFRAME (middle in the bottom row).
For PS_INSIDEFRAME according to the spec all width of the pen should be used inside of the path -- the shape size should match with BBox.

Reproducible: Always

User Profile Reset: No

Additional Info:
Thin black lines are added to highlight the difference. Y-coord for them are 200, 210, 360. Shapes on the bottom line have their Ymin/Ymax at 210 and 360.
Pen width is 20.
Comment 1 Valek Filippov 2021-05-07 21:25:20 UTC
Created attachment 171771 [details]
EMF sample with different pen styles
Comment 2 Valek Filippov 2021-05-07 21:26:51 UTC
Created attachment 171772 [details]
Screenshot of the sample EMF file opened in MS Paint
Comment 3 Valek Filippov 2021-05-07 21:52:09 UTC
Created attachment 171773 [details]
WMF sample for pen styles
Comment 4 Valek Filippov 2021-05-07 22:10:11 UTC
For WMF pen styles seems to be completely ignored.
WMF uses CreatePenIndirect MR.
EMF uses CreatePen MR.
Comment 5 Xisco Faulí 2021-05-11 08:05:49 UTC
Created attachment 171867 [details]
How it looks in LibreOffice 7.2 master
Comment 6 Xisco Faulí 2021-05-11 08:14:04 UTC
Penstyles are displayed like in the screenshot since

author	Chris Sherlock <chris.sherlock79@gmail.com>	2016-03-03 21:52:49 +1100
committer	Chris Sherlock <chris.sherlock79@gmail.com>	2016-03-04 18:23:15 +0000
commit	6381d26d73c614681601fda4a49c96e11a0e6f06 (patch)
tree	2ef7c86fa0490ef6b3cddb6ebb49e2b29309aba3
parent	c788f63726df3340e787bb92477d7ad31e7bc952 (diff)
tdf#79679 vcl: dashed lines show as solid lines when importing EMF files

Before this commit they were displayed a a solid line.

@Chris Sherlock, I thought you might be interested in this issue