[cairo] Problem in dot matrix windows printer!!!

Adrian Johnson ajohnson at redneon.com
Tue Mar 1 00:52:33 PST 2011

On 01/03/11 13:19, wahono at acosys.co.id wrote:
> Hi,
> I use cairo for printing interface. I use it in FreePascal.
> I got trouble in dot matrix printer which have different resolution
> between x and y. I use LX-300+II (120X72DPI).
> So I should scale cairo surface to match with printer resolution. And with
> this way, I got good result. All drawing object is printed as in screen.
> But for text, I got unproportional scale, even I dont use scale surface.
> The text is printed unscaled width and height, but white space is scaled.
> So the text is printed crossing between chars.
> I got his trouble when I use cairo_show_text, but after I change to :
>     cairo_text_path (fcairo.context, pchar(stringtolatin1(str1)));
>     cairo_fill(fcairo.context);
> I got good result. But the problem is, because the text is printed as
> graphic, so printing is very slow, and char is not printed perfectly, some
> chars doesn't print clearly.
> Maybe this is a bug, or any trick for windows printer?
> Thank in advance.

If you are getting a different scale between text and graphics it looks
like a problem with the GDI mapping mode. Cairo sets the GDI mapping
mode to MM_TEXT when drawing text. You could try setting your GDI
mapping mode to MM_TEXT and use either cairo_scale or
SetWorldTransform() to adjust the scale to a 1:1 aspect ratio.

> Wahono
> --
> cairo mailing list
> cairo at cairographics.org
> http://lists.cairographics.org/mailman/listinfo/cairo

More information about the cairo mailing list