Re: Clipping text



On Mon, 2008-07-28 at 11:12 -0700, Brandon Lewis wrote:
> I need to be able to control how wide text objecs are to prevent them from 
> protruding past the edges of objects. I'm working on a fairly complicated user 
> interface for the PiTiVi video editor which uses goocanvas. Here's a recent 
> screenshot:
> 
> http://bp2.blogger.com/_0j8m-AnSlU8/SIQHGx-BB-I/AAAAAAAAAB8/DWH3g_PpWUc/s1600-h/new_layout.png
> 
> I am having trouble understanding how to use the clip-path property on an 
> object. Essentially I want to be able to clip the text label's length to the 
> width of the rectangular background. Setting the clip at all seems to do nothing 
> or make object completely invisible, depending on the values I am using.
> 
> Are the clip-path coordinates relative to the object or to the canvas?

The clip-path should be expressed in the item's coordinate space, i.e.
the same coordinates you use for positioning the text item.

The "Clipping" page of the demo uses this for clipping:

  item = goo_canvas_text_new (root, "Sample Text", 520, 300, -1, 
                              GTK_ANCHOR_NW,
			      "clip-path", "M535,300 h75 v40 h-75 z",
			      NULL);
 
That clips the start and end of the text off. You need to do something
like that.

Damon




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