GooCanvasText

GooCanvasText — a text item.

Functions

Properties

PangoAlignment alignment Read / Write
GooCanvasAnchorType anchor Read / Write
PangoEllipsizeMode ellipsize Read / Write
gdouble height Read / Write
gchar * text Read / Write
gboolean use-markup Read / Write
gdouble width Read / Write
PangoWrapMode wrap Read / Write
gdouble x Read / Write
gdouble y Read / Write

Types and Values

struct GooCanvasText

Object Hierarchy

    GObject
    ╰── GooCanvasItemSimple
        ╰── GooCanvasText

Implemented Interfaces

GooCanvasText implements GooCanvasItem.

Description

GooCanvasText represents a text item.

It is a subclass of GooCanvasItemSimple and so inherits all of the style properties such as "fill-color".

It also implements the GooCanvasItem interface, so you can use the GooCanvasItem functions such as goo_canvas_item_raise() and goo_canvas_item_rotate().

The “width” and “height” properties specify the area of the item. If it exceeds that area because there is too much text, it is clipped. The properties can be set to -1 to disable clipping.

To create a GooCanvasText use goo_canvas_text_new().

To get or set the properties of an existing GooCanvasText, use g_object_get() and g_object_set().

Functions

goo_canvas_text_new ()

GooCanvasItem *
goo_canvas_text_new (GooCanvasItem *parent,
                     const char *string,
                     gdouble x,
                     gdouble y,
                     gdouble width,
                     GooCanvasAnchorType anchor,
                     ...);

Creates a new text item.

Here's an example showing how to create a text item with the bottom right of the text box placed at (500,500):

1
2
3
GooCanvasItem *text = goo_canvas_text_new (mygroup, "Hello World", 500.0, 500.0, 200.0, GOO_CANVAS_ANCHOR_SE,
                                           "fill-color", "blue",
                                           NULL);

Parameters

parent

the parent item, or NULL. If a parent is specified, it will assume ownership of the item, and the item will automatically be freed when it is removed from the parent. Otherwise call g_object_unref() to free it.

[skip]

string

the text to display.

 

x

the x coordinate of the text.

 

y

the y coordinate of the text.

 

width

the width of the text item, or -1 for unlimited width.

 

anchor

the position of the text relative to the given x and y coordinates. For example an anchor of GDK_ANCHOR_NW will result in the top-left of the text being placed at the given x and y coordinates. An anchor of GDK_ANCHOR_CENTER will result in the center of the text being placed at the x and y coordinates.

 

...

optional pairs of property names and values, and a terminating NULL.

 

Returns

a new text item.

[transfer full]


goo_canvas_text_get_natural_extents ()

void
goo_canvas_text_get_natural_extents (GooCanvasText *text,
                                     PangoRectangle *ink_rect,
                                     PangoRectangle *logical_rect);

Gets the natural extents of the text, in the text item's coordinate space.

The final extents of the text may be different, if the text item is placed in a layout container such as GooCanvasTable.

Parameters

text

a GooCanvasText.

 

ink_rect

the location to return the ink rect, or NULL.

[out][allow-none]

logical_rect

the location to return the logical rect, or NULL.

[out][allow-none]

Types and Values

struct GooCanvasText

struct GooCanvasText;

The GooCanvasText struct contains private data only.

Property Details

The “alignment” property

  “alignment”                PangoAlignment

How to align the text.

Flags: Read / Write

Default value: PANGO_ALIGN_LEFT


The “anchor” property

  “anchor”                   GooCanvasAnchorType

How to position the text relative to the given x and y coordinates.

Flags: Read / Write

Default value: GOO_CANVAS_ANCHOR_NORTH_WEST


The “ellipsize” property

  “ellipsize”                PangoEllipsizeMode

The preferred place to ellipsize the string, if the label does not have enough room to display the entire string.

Flags: Read / Write

Default value: PANGO_ELLIPSIZE_NONE


The “height” property

  “height”                   gdouble

The height to use to layout the text, or -1 to let the text use as much vertical space as needed.

Flags: Read / Write

Default value: -1


The “text” property

  “text”                     gchar *

The text to display.

Flags: Read / Write

Default value: NULL


The “use-markup” property

  “use-markup”               gboolean

Whether to parse PangoMarkup in the text, to support different styles.

Flags: Read / Write

Default value: FALSE


The “width” property

  “width”                    gdouble

The width to use to layout the text, or -1 to let the text use as much horizontal space as needed.

Flags: Read / Write

Default value: -1


The “wrap” property

  “wrap”                     PangoWrapMode

The preferred method of wrapping the string if a width has been set.

Flags: Read / Write

Default value: PANGO_WRAP_WORD


The “x” property

  “x”                        gdouble

The x coordinate of the text.

Flags: Read / Write

Default value: 0


The “y” property

  “y”                        gdouble

The y coordinate of the text.

Flags: Read / Write

Default value: 0