[cairo] OpenType fonts in Windows Metafiles
Zoltán Turányi
teknos at gmail.com
Wed Nov 25 11:30:50 PST 2009
Hi,
I am writing an OLE server application. Such applications need to provide an
old format Windows Metafile (and not an Enhanced Metafile) to container
applications. I attempted to create a printing surface passing on the DC for
a Windows Metafile, but got an out-of memory error. I deducted that cairo
does not support Metafile surfaces.
Then I created an Enhanced Metafile and passed the resulting DC to
cairo_win32_create_printing_surface and I was able to draw. Next, I wanted
to convert the resulting metafile to a an old format Windows Metafile using
the code below, but text simply disappears, if I use an OpenType font.
However, if I use the "Courier" font it shows.
unsigned size = GetWinMetaFileBits(hemf, 0, NULL,
MM_ANISOTROPIC, pDC->m_hDC);
BYTE *buff = (BYTE*)malloc(size);
size = GetWinMetaFileBits(hemf, size, buff, MM_ANISOTROPIC,
pDC->m_hDC);
HMETAFILE hwmf = SetMetaFileBitsEx(size, buff);
I attached two emf files showing the drawing and the resulting wmf files
that does/does not have the text in them. (Note that wmf files have a
thumbnail bitmap stored with them, which shows the text, but if you drop the
wmf onto a PowerPointslide, it misses the text.)
The funny thing is that both the emf and the wmf file contain the relevant
textout records, but I cannot figure out why it never shows with
TrueType/OpenType fonts in the wmf file. I have tried it both on Vista and
XP.
Can anyone give me a hint what may go wrong here, or how else to produce an
old format Windows Metafile with Cairo?
Zoltan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.cairographics.org/archives/cairo/attachments/20091125/d65c5dfc/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arial.emf
Type: application/octet-stream
Size: 6268 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20091125/d65c5dfc/attachment-0004.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: arial.wmf
Type: application/octet-stream
Size: 8162 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20091125/d65c5dfc/attachment-0005.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: courier.emf
Type: application/octet-stream
Size: 25972 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20091125/d65c5dfc/attachment-0006.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: courier.wmf
Type: application/octet-stream
Size: 43480 bytes
Desc: not available
Url : http://lists.cairographics.org/archives/cairo/attachments/20091125/d65c5dfc/attachment-0007.obj
More information about the cairo
mailing list