Bug 142495 - [EMF] ETO_OPAQUE and ETO_CLIP support for EmrText object
Summary: [EMF] ETO_OPAQUE and ETO_CLIP support for EmrText object
Status: CLOSED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Bartosz
URL:
Whiteboard: target:7.2.0
Keywords:
Depends on:
Blocks: EMF-WMF
  Show dependency treegraph
 
Reported: 2021-05-26 12:21 UTC by Valek Filippov
Modified: 2024-04-15 08:02 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
EMF sample with ETO_OPAQUE/ETO_CLIP flags (1.00 KB, image/x-emf)
2021-05-26 12:22 UTC, Valek Filippov
Details
Screenshot of the sample EMF file opened in MS Paint (3.26 KB, image/png)
2021-05-26 12:23 UTC, Valek Filippov
Details
EMF sample with text rotated by 'Escapement' (1.00 KB, image/x-emf)
2021-05-26 12:24 UTC, Valek Filippov
Details
EMF sample with world rotated by XForm (1.04 KB, image/x-emf)
2021-05-26 12:26 UTC, Valek Filippov
Details
EMF sample with world skewed by XForm (1.04 KB, image/x-emf)
2021-05-26 12:27 UTC, Valek Filippov
Details
EMF sample with world scaled by XForm (1.04 KB, image/x-emf)
2021-05-26 12:28 UTC, Valek Filippov
Details
EMF sample with world rotated by XForm (1.04 KB, image/x-emf)
2021-05-26 12:39 UTC, Valek Filippov
Details
Screenshot with skew (4.38 KB, image/png)
2021-05-26 12:39 UTC, Valek Filippov
Details
Screenshot with rotation by XForm (6.43 KB, image/png)
2021-05-26 12:41 UTC, Valek Filippov
Details
Screenshot with Escapement (3.08 KB, image/png)
2021-05-26 12:42 UTC, Valek Filippov
Details
Screenshot with scale (6.37 KB, image/png)
2021-05-26 12:43 UTC, Valek Filippov
Details
EMF sample with ETO_OPAQUE and SetBKMode = 1 (56.67 KB, image/x-emf)
2021-05-29 18:00 UTC, Valek Filippov
Details
How ETO_OPAQUE with SetBKMode=1 should look like (9.73 KB, image/png)
2021-05-29 18:01 UTC, Valek Filippov
Details
EMF image created by LTSplice (122.36 KB, image/emf)
2021-05-30 08:15 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-26 12:21:13 UTC
Description:
LO ignores ETO_OPAQUE and ETO_CLIP flags of he EmrText object.

Steps to Reproduce:
Open attached EMF sample

Actual Results:
Three lines of the same text with red, green and blue background approx. the height of the text.

Expected Results:
Lines with green and blue backgrounds should be clipped right behind the left stem of the letter "D".
Green line is also clipped at the top.
Blue line background height is greater than the text, extra size goes down.
Additional red rectangle is shown in the top left corner.


Reproducible: Always


User Profile Reset: No



Additional Info:
Additional rectangle is the result of using the combination of ETO_OPAQUE flag and rectangle with the coordinates different from text position.
Comment 1 Valek Filippov 2021-05-26 12:22:24 UTC
Created attachment 172355 [details]
EMF sample with ETO_OPAQUE/ETO_CLIP flags
Comment 2 Valek Filippov 2021-05-26 12:23:34 UTC
Created attachment 172356 [details]
Screenshot of the sample EMF file opened in MS Paint
Comment 3 Valek Filippov 2021-05-26 12:24:52 UTC
Created attachment 172357 [details]
EMF sample with text rotated by 'Escapement'

Implementation in MS Paint/Wordpad looks weird
Comment 4 Valek Filippov 2021-05-26 12:26:57 UTC
Created attachment 172358 [details]
EMF sample with world rotated by XForm

Presence of m12 or m21 in XForm seems to cancel ETO_OPAQUE
Comment 5 Valek Filippov 2021-05-26 12:27:35 UTC
Created attachment 172359 [details]
EMF sample with world skewed by XForm
Comment 6 Valek Filippov 2021-05-26 12:28:48 UTC
Created attachment 172360 [details]
EMF sample with world scaled by XForm

Scaling applies to ETO_OPAQUE
Comment 7 Valek Filippov 2021-05-26 12:39:13 UTC
Created attachment 172361 [details]
EMF sample with world rotated by XForm

Better sample with rotation. Observation about m12/m21 wasn't correct.
Comment 8 Valek Filippov 2021-05-26 12:39:42 UTC
Created attachment 172362 [details]
Screenshot with skew
Comment 9 Valek Filippov 2021-05-26 12:41:40 UTC
Created attachment 172363 [details]
Screenshot with rotation by XForm

Sample was changed to make empty red rectangle visible and the size of the blue OPAQUE area more prominent.
Comment 10 Valek Filippov 2021-05-26 12:42:13 UTC
Created attachment 172364 [details]
Screenshot with Escapement
Comment 11 Valek Filippov 2021-05-26 12:43:10 UTC
Created attachment 172365 [details]
Screenshot with scale
Comment 12 Commit Notification 2021-05-28 19:48:38 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3a9027609e7ee0c7af457b06426093782ca295a8

tdf#53004 tdf#142495 WMF EMF Fix displaying Text with OPAQUE and CLIPPED

It will be available in 7.2.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 13 Valek Filippov 2021-05-29 16:40:01 UTC
Newer versions of LTSpice allows export to EMF (instead of WMF in older versions) and using ETO_OPAQUE extensively.
I verified that with this fix the import is correct for LTSpiceXVII.
Comment 14 Valek Filippov 2021-05-29 18:00:15 UTC
Created attachment 172439 [details]
EMF sample with ETO_OPAQUE and SetBKMode = 1

Looks like ETO_OPAQUE wins over SetBKMode == 1 (Transparent) for filling the rectangle.
MS Paint and Wordpad show red logo on this sample, while fixed version of LO doesn't.
Comment 15 Valek Filippov 2021-05-29 18:01:21 UTC
Created attachment 172440 [details]
How ETO_OPAQUE with SetBKMode=1 should look like
Comment 16 Bartosz 2021-05-30 08:15:02 UTC
Created attachment 172450 [details]
EMF image created by LTSplice
Comment 17 Commit Notification 2021-05-31 05:33:28 UTC
Bartosz Kosiorek committed a patch related to this issue.
It has been pushed to "master":

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

tdf#53004 tdf#142495 WMF EMF Always display Text rectangle

It will be available in 7.2.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.