[Gambas-user] Cairo: coordinates

Rolf-Werner Eilert eilert-sprachen at ...221...
Tue Aug 20 09:28:30 CEST 2013


What confused me a bit when using Cairo was the coordinates system.

Initiating the page with width = 210 mm and height = 297 mm, I would 
expect to be able to center a string of text with

  Cairo.MoveTo((210 / 2) - (Cairo.TextExtents("Hello world").Width / 2), 40)

for example (in practice, I would write 105 instead of 210 / 2 of course...)

Now, it turned out instead that I had to write

  Cairo.MoveTo(297 - (Cairo.TextExtents("Hello world").Width / 2), 40)

to center the line, so obviously the page is 297 * 2 wide, not 210 mm.

Why's that?

Rolf




More information about the User mailing list