Bug 137440

Summary: [EMF] FILEOPEN: Wrong text due to missing ETO_GLYPH_INDEX option from EMR_EXTTEXTOUTW record
Product: LibreOffice Reporter: Timur <timur>
Component: WriterAssignee: Not Assigned <libreoffice-bugs>
Status: NEW ---    
Severity: normal CC: gang65, xiscofauli
Priority: medium Keywords: filter:emf
Version: 3.6.0.4 release   
Hardware: All   
OS: All   
See Also: https://bugs.documentfoundation.org/show_bug.cgi?id=131381
Whiteboard:
Crash report or crash signature: Regression By:
Bug Depends on:    
Bug Blocks: 103859    
Attachments: EMF
Logs from importing emf file

Description Timur 2020-10-13 08:40:17 UTC
MSO created DOCX attachment 165503 [details] from (dumpyard) bug 131381 opens EMF image with wrong text, as compared with MSO in attachment 165504 [details] .

DOCX is old format, but similar if resaved in MSO. Didn't open in LO 3.5. Similar from 3.6 to 7.1+ for me. Test in Windows 7 OpenGL and GDI (with and without OpenGL) for older LO 6.4 and Skia and GDI in LO 7.1+.

Reported added different comparison with MSO as attachment 166332 [details]. I don't know how he gets that.
Comment 1 Xisco FaulĂ­ 2020-10-13 08:51:09 UTC
Reproduced in

Version: 7.1.0.0.alpha0+
Build ID: a9976a958b2857e308c6598532151878615bfd9f
CPU threads: 4; OS: Linux 5.7; UI render: default; VCL: gtk3
Locale: en-US (en_US.UTF-8); UI: en-US
Calc: threaded
Comment 2 Timur 2020-11-09 14:58:33 UTC
Created attachment 167142 [details]
EMF

Fileopen DOCX is not important. Also if EMF inserted in new Writer.
Comment 3 Bartosz 2020-11-10 16:32:17 UTC
Created attachment 167176 [details]
Logs from importing emf file
Comment 4 Bartosz 2020-11-10 19:06:08 UTC
The root cause of wrongly displayed text is lack of implementation of ETO_GLYPH_INDEX option from EMR_EXTTEXTOUTW record.

ETO_GLYPH_INDEX bit indicates that the codes for characters in an output text string are
actually indexes of the character glyphs in a TrueType font. Glyph indexes are font-specific, so to
display the correct characters on playback, the font that is used MUST be identical to the font used
to generate the indexes.

Generally it is not possible to get right character from Unicode, and it should be taken directly from TrueType font index. More information:
https://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/5c88ddaf-5dbe-4f81-9c0d-83785798d500/how-to-get-right-unicode-character-when-exttextoutw-called-with-etoglyphindex-set-in-fuoptions?forum=windowssdk

I found also some useful implementation on Qt side, which could be helpful:
https://bugreports.qt.io/browse/QTBUG-40683
Comment 5 Julien Nabet 2022-04-23 13:49:47 UTC
Just for the record, on pc Debian x86-64 with master sources updated today, I noticed these logs:
warn:emfio:8686:8686:emfio/source/reader/emfreader.cxx:1927: SJ: ETO_PDY || ETO_GLYPH_INDEX in EMF
warn:drawinglayer.emf:8686:8686:drawinglayer/source/tools/emfphelperdata.cxx:1773: EMF+	 TODO SetPixelOffsetMode
warn:drawinglayer.emf:8686:8686:drawinglayer/source/tools/emfphelperdata.cxx:1760: EMF+	 TODO SetAntiAliasMode
warn:drawinglayer.emf:8686:8686:drawinglayer/source/tools/emfphelperdata.cxx:1767: EMF+	 TODO InterpolationMode
Comment 6 Bartosz 2022-05-26 00:19:07 UTC
More information: https://docs.microsoft.com/en-us/typography/opentype/spec/cmap
Comment 7 QA Administrators 2024-05-26 03:14:56 UTC
Dear Timur,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug