I'm having a little trouble groking gtk_text_layout_draw() and the x and
y offsets for the GdkDrawable. I just want to get my facts straight.

In the GnomeCanvasItem's draw method, a GdkDrawable is passed in, and I
am subsequently passing that into gtk_text_layout_draw(). When I pass in
an xoffset and X coordinate of 0, the text renders correctly but in the
wrong location since I actually want it at 20 (for example).

Consider the following awesome ASCII rendering of my GdkDrawable with
xoffset/yoffset of 0 and (x,y) coordinates of (0,0).
|This is a test.
|I like tests.

When I set xoffset and yoffset to 1 (assuming 1 == 1 character), drawing
to (0,0):
| like tests.

As you can see, to get the text to draw at the location I actually want,
I would have to have negative X and Y offsets. When I remove the
assertion in gtktextdisplay.c that xoffset and yoffset >= 0, the text is
rendered in the correct location. I haven't investigated deeply enough
to see if this breaks anything else, but I don't see why it would.

I am getting the offset from the X and Y coordinates passed into the
GnomeCanvasItem's draw method and doing it in much the same fashion as
GnomeCanvasRect. I can give more details if necessary.

If you understand and I'm not totally on crack, I can commit to remove
the assertion against negative offsets.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]