[cairo] EMF: text clipping
teknos at gmail.com
Thu Dec 17 23:57:59 PST 2009
I think my previous mail did not reach you and the list, so here is its
I have ran into the same (or just a similar) problem. After some debugging I
have found that printing surfaces query the clip box on creation and later
drop all glyphs that are outside that clip region (plus some margin). The
dropping is specific to fonts (and I think also for bitmap fallback, but I
am not sure) and is not done for e.g., paths.
Specifically, in cairo-win32-printing-surface.c the function
create() calls the GetClipBox() windows GDI call to set the surface.extent
field of the surface under creation. This is sometimes too small -as you say
coming from device metrics-, so glyph dropping will happen. I found no way
yet to create a metafile context which did not have this limitation. I also
think this is the reason why one cannot draw on a device context created
from an old format Windows metafile (wmf) - such contexts cannot return a
clip box, so surface creation fails.
The glyph dropping happens in _cairo_gstate_transform_glyphs_to_backend(),
which uses surface.extent to see which glyphs to drop. This function does
not drop any glyph if you call it with num_transformed_glyphs=NULL.
So what I did to avoid this problem is to change the call to this function
to set this parameter to NULL and recompiled cairo. Voila, it works.
I am new to cairo and don't really know whom to report such bugs (which may
not be bugs in reality), so any help here is appreciated. Maybe these should
be discussed on this list.
2009/12/18 Kozhevnikov Mikhail <mikhailkozhevnikov at yandex.ru>
> Anybody knows the way to prevent text clipping when drawing to windows
> Cairo (or GDI?) seems to use the current device metrics (i.e. 1600x900 for
> my monitor) to clip the text in a metafile. That is, I can not create a
> metafile of, say, 2000x2000 - the text will be clipped out.
> I've tried cairo_reset_clip() and some WinAPI calls, e.g. SetViewportExtEx,
> SetWindowsExtEx, SelectClipRgn, but they make no difference.
> Thanks in advance,
> (and sorry for bothering everybody with windows metafiles)
> cairo mailing list
> cairo at cairographics.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cairo