gnome-icon-text

Name

gnome-icon-text — Text wrapping functions.

Synopsis


#include <gnome.h>


struct      GnomeIconTextInfoRow
struct      GnomeIconTextInfo
GnomeIconTextInfo* gnome_icon_layout_text   (GdkFont *font,
                                             char *text,
                                             char *separators,
                                             int max_width,
                                             int confine);
void        gnome_icon_paint_text           (GnomeIconTextInfo *ti,
                                             GdkDrawable *drawable,
                                             GdkGC *gc,
                                             int x,
                                             int y,
                                             GtkJustification just);
void        gnome_icon_text_info_free       (GnomeIconTextInfo *ti);

Description

This module implements a generic and simple text wrapping and drawing interface.

The gnome_icon_layout_text() function can be used to layout a piece of text given a number of constraints. The gnome_icon_paint_text() routine is a simple routine that will render a piece of text that has been layed out by gnome_icon_layout_text().

Details


GnomeIconTextInfoRow

typedef struct {
	char *text;
	int width;
} GnomeIconTextInfoRow;


GnomeIconTextInfo

typedef struct {
	GList *rows;
	GdkFont *font;
	int width;
	int height;
	int baseline_skip;
} GnomeIconTextInfo;


gnome_icon_layout_text()

GnomeIconTextInfo* gnome_icon_layout_text   (GdkFont *font,
                                             char *text,
                                             char *separators,
                                             int max_width,
                                             int confine);

Wraps the specified text and returns a new GnomeIconTextInfo structure. text is word-wrapped as defined by the specified separators characters (or just at spaces if separators is NULL). The max_width parameter specifies the width at which text will be wrapped. If a word is too long to be wrapped and confine is TRUE, it will be force-split somewhere in the middle; if confine is FALSE, then the text may exceed the specified max_width.

font : The font that will be used to render this texttext : Text to be formattedseparators : Separators used to split the string optimallymax_width : Maximum width allowedconfine : whether it is mandatory to wrap at max_widthReturns


gnome_icon_paint_text()

void        gnome_icon_paint_text           (GnomeIconTextInfo *ti,
                                             GdkDrawable *drawable,
                                             GdkGC *gc,
                                             int x,
                                             int y,
                                             GtkJustification just);

Paints text that was laid out by gnome_icon_layout_text(). The text is painted at the specified coordinates, with the specified justification. This is just a sample implementation, other are possible.

ti : GnomeIconTextInfo returned by gnome_icon_layout_textdrawable : Target drawable.gc : GC used to render the stringx : x coordinatey : y coordinatejust : 


gnome_icon_text_info_free()

void        gnome_icon_text_info_free       (GnomeIconTextInfo *ti);

Frees a GnomeIconTextInfo structure. You should call this instead of freeing it yourself.

ti : the GnomeIconTextInfo returned by gnome_icon_layout_text