[cairo] Text in Windows Metafiles (EMF)
Kozhevnikov Mikhail
mikhailkozhevnikov at yandex.ru
Sat Mar 7 07:30:08 PST 2009
Hello,
I also found out that the same works well when using normal HDC as a target. But I can't make it work with Metafiles.
Anybody's familiar with the code of cairo-win32-printing-surface.c? I have no idea what could be the problem.
Thanks,
-- Mikhail
> Hello,
> The following code attempts to write some text to windows metafile using Cairo:
> HDC hdc = 0;
> hdc = CreateEnhMetaFile(NULL, "test.emf", NULL, NULL);
> StartPage(hdc);
>
> cairo_surface_t *surface = cairo_win32_printing_surface_create(hdc);
> cairo_t *cr = cairo_create(surface);
> cairo_rectangle(cr, 0, 0, 100, 100);
> cairo_set_source_rgb(cr, 0.5, 1, 0.5);
> cairo_fill(cr);
>
> cairo_move_to(cr, 0, 80);
> cairo_set_source_rgb(cr, 0, 0, 0);
> cairo_show_text(cr, "hello world");
> cairo_destroy(cr);
> cairo_surface_destroy(surface);
> EndPage(hdc);
> CloseEnhMetaFile(hdc);
> Attached are results of the above code execution and the output of the same code when using PNG surface. On the first one the text is missing.
> Any ideas why it might not work?
> Details:
> 1) It looks like some drawing code for text is executed - if we use much larger font, the size of the image will be increased, as it is determined automatically.
> 2) I tried setting up font size and face, it doesn't fix the thing.
> Considerations are appreciated!
> Mikhail.
--
Яндекс.Открытки. Свежие открытки у вас в почтовом ящике http://cards.yandex.ru/subscribe.xml
More information about the cairo
mailing list