« il: 20 Agosto 2013, 16:36:08 »
Riporto questa domanda inserita nella M.L.I.:
"
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 "
"
I have to add that this problem only came up because there seems to be
no property delivering the page width (or surface width) in user
coordinates. At least I haven't found one. If there was, the line would
go something like Cairo.MoveTo((Cairo.SurfaceExtents.Width / 2) - (Cairo.TextExtents("Hell world").Width / 2), 40)
That's why I had to use a fixed value.
Rolf "
Registrato
« Chiunque, non ricorrendo lo stato di necessità, nel proprio progetto Gambas fa uso delle istruzioni Shell o Exec, è punito con la sanzione pecuniaria da euro 20,00 a euro 60,00. »