3 ms·
It's really difficult to achieve. The article mentions EMF/EMF+. this format is basically a list of calls to GDI.h and is a bitch to map to other graphic stack
by kakwa_ 9y ago
It's really difficult to achieve.
The article mentions EMF/EMF+. this format is basically a list of calls to GDI.h and is a bitch to map to other graphic stacks when you are not on Windows.
The specification of the format is public (kudos for Microsoft), it helps a lot. But there are a lot of corner cases and the spec can be quite hard to understand some times. Computing correctly the origin is tricky for example (VIEWPORTORGEX, WINDOWORGEX etc).
For some stuff, it's impossible to get it right.
One example that comes to my mind is a text encoding bug I got a year ago (I maintain an emf to svg conversion library). It took me one week to track it down. In most cases the strings are UTF-16. But in weird cases, when the ETO_GLYPH_INDEX flag is set, the "encoding" is directly the index of the glyph inside the selected font.
It's not the most portable way to handle text... If you don't have the exact same font on your computer, there is a good chance the text will not be displayed correctly.
And converting back to a well known encoding is tricky (using the cmap tables of the ttf file, you have to build a reverse cmap, pray there is a 1-1 mapping between glyph and unicode, and convert back to utf-8 or something).
Even Microsoft itself, on the Mac OS, version got it wrong.
- chris_wot 9y agoCan you link to that library?
- buovjaga 9y agoI found it in his submission history: https://github.com/kakwa/libemf2svg https://github.com/kakwa/libemf2svg
- kakwa_ 9y agothanks ^^ For information, the bits of code that is handling "font index encoding": https://github.com/kakwa/libemf2svg/blob/master/src/lib/emf2svg_utils.c#L1012 https://github.com/kakwa/libemf2svg/blob/master/src/lib/emf2... To https://github.com/kakwa/libemf2svg/blob/master/src/lib/emf2svg_utils.c#L1278 https://github.com/kakwa/libemf2svg/blob/master/src/lib/emf2...
- chris_wot 9y agoI think we might a similar issue - thanks!