Using Cairo under C++ on a Raspberry Pi, and trying to clip text drawing to inside a given rectangle.
I'd have thought that it would be as simple as this:
cairo_t* cp = cairo_create(psurface); // set font, etc cairo_rectangle(cp, 0, 0, 100, 100); // Desired clipping rect cairo_clip(cp); cairo_show_text(cp, "pretend that this string is > 100px wide"); cairo_destroy(cp);
but it always causes no text to appear. If I omit the call to cairo_clip() the text does appear (albeit unclipped).
I'm wanting only the last few chars of the string to get clipped.
What's the trick?