Name
gnome-icon-text -- Text wrapping functions for icon captions.
Description
This module implements a generic and simple interface for wrapping
text and painting it to a drawable. It is used by the
GnomeIconTextItem object to perform word
wrapping for icon text captions.
Details
struct GnomeIconTextInfoRow
typedef struct {
char *text;
int width;
GdkWChar *text_wc; /* text in wide characters */
int text_length; /* number of characters */
} GnomeIconTextInfoRow; |
This structure defines a row of text in the list of wrapped text
rows of the GnomeIconTextInfo structure.
The text field contains the text that
fits in that row, and width contains
the width in pixels of that text, calculated with respect to the
font that was used to format the text.
struct GnomeIconTextInfo
typedef struct {
GList *rows;
GdkFont *font;
int width;
int height;
int baseline_skip;
} GnomeIconTextInfo; |
This structure contains the information about a wrapped text
string. The rows field is a list of
GnomeIconTextInfoRow structures with the
final rows of text. The width,
height, and
baseline_skip fields contain the total
width, total height, and baseline height of the text in pixels,
respectively.
gnome_icon_layout_text ()
GnomeIconTextInfo* gnome_icon_layout_text (GdkFont *font,
char *text,
char *separators,
int max_width,
int confine); |
Creates a new &GnomeIconTextInfo structure by wrapping the specified
text. If non-NULL, the separators argument defines a set of characters
to be used as word delimiters for performing word wrapping. If it is
NULL, then only spaces will be used as word delimiters.
The max_width argument is used to specify the width at which word
wrapping will be performed. If there is a very long word that does not
fit in a single line, the confine argument can be used to specify
whether the word should be unconditionally split to fit or whether
the maximum width should be increased as necessary.
gnome_icon_paint_text ()
void gnome_icon_paint_text (GnomeIconTextInfo *ti,
GdkDrawable *drawable,
GdkGC *gc,
int x,
int y,
GtkJustification just); |
Paints the formatted text in the icon text info structure onto a drawable.
This is just a sample implementation; applications can choose to use other
rendering functions.
gnome_icon_text_info_free ()
Frees a &GnomeIconTextInfo structure. You should call this instead of
freeing the structure yourself.