Details
-
Bug
-
Resolution: Unresolved
-
P4: Low
-
None
-
4.6.2
-
None
Description
When saving an EPS file, Qt is not using the correct glyph names in the embedded subset fonts it writes out. Placeholder glyph names are used (eg. "/gl87") where the real glyph name is available. This prevents the user from being able to copy and paste text from the EPS file when opened in (say) Mac OS X Preview.
Test case attached. Build and run eps-glyph-name-bug.pro, which will output "test.eps". This embeds a subset of Times New Roman consisting of the glyphs "t", "e" and "s". Look at the EPS file in a text editor and you'll see these are named "/gl87", "/gl72" and "/gl86" which correspond to the glyph indices in the original Times font. Now open this EPS file with an EPS renderer that supports copy and paste (I use Mac OS X Preview), select the text and copy it to the clipboard. Pasting it into another application gives Unicode garbage. I've tried this in 4.6.2 and in 4.7.0 beta 2 with the same results in each.
The bug seems to be in QFontSubset::glyphName, which is using the wrong value to deference the reverseMap vector. It's using the glyph indices from the original font, not the index in the (much smaller) subset of glyphs being embedded. Changing this resolves the problem for me, so I've attached a simple patch.