summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-text-layout.h
blob: 02a4198286ac2ef9b8d5e3ad6f861ef494cb2aaf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* nautilus-text-layout.h - Functions to layout text.

   Copyright (C) 1999, 2000 Eazel, Inc.

   The Gnome Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Gnome Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Authors: Ramiro Estrugo <ramiro@eazel.com>
*/

#ifndef NAUTILUS_TEXT_LAYOUT_H
#define NAUTILUS_TEXT_LAYOUT_H

#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnome/gnome-defs.h>
#include <libnautilus-extensions/nautilus-scalable-font.h>
#include <libart_lgpl/art_rect.h>

BEGIN_GNOME_DECLS

/*
 * The following text_layout stuff was shamelessly plundered
 * from libgnomeui/gnome-icon-text.[ch] by Federico Mena.
 *
 * It was hacked to use NautilusScalableFont and GdkPixbuf
 * instead of GdkFont and GdkDrawable.  We want to use the
 * same layout algorithm in Nautilus so that both the smooth
 * and not smooth text rendering cases have predictably 
 * similar result.
 *
 * I also made some minor Nautilus-like style changes. -re

 */
typedef struct
{
	char *text;
	int width;
	guint text_length;
} NautilusTextLayoutRow;

typedef struct
{
	GList *rows;
	const NautilusScalableFont *font;
	int font_size;
	int width;
	int height;
	int baseline_skip;
} NautilusTextLayout;

NautilusTextLayout *nautilus_text_layout_new   (const NautilusScalableFont *font,
						int                         font_size,
						const char                 *text,
						const char                 *separators,
						int                         max_width,
						gboolean                    confine);
void                nautilus_text_layout_paint (const NautilusTextLayout   *text_info,
						GdkPixbuf                  *pixbuf,
						int                         x,
						int                         y,
						GtkJustification            justification,
						guint32                     color,
						gboolean                    underlined);
void                nautilus_text_layout_free  (NautilusTextLayout         *text_info);

END_GNOME_DECLS

#endif /* NAUTILUS_TEXT_LAYOUT_H */