summaryrefslogtreecommitdiff
path: root/libnautilus-extensions/nautilus-scalable-font.h
blob: 9528cf5f6cb1f8e64b792805b8f4a23b1ec981c7 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* nautilus-scalable-font.h - A GtkObject subclass for access to scalable fonts.

   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>
*/

/* NautilusScalableFont is a GtkObject that provdes a simple
 * interface to Raph Levien's librsvg FreeType2 based anti aliased
 * text rendering.
 *
 * Currently, only Type1 fonts are supported.
 *
 * Fonts are automatically queried and used if available.  Right
 * now this is fairly simple code which does not handle all the 
 * complexities of the hell that is unix fonts.
 *
 * In the Star Trek future, we will use gnome-print (gnome-font?).
 * However, we will keep the interface to scalable font usage simple
 * and hidden behind this interface.
 */

#ifndef NAUTILUS_SCALABLE_FONT_H
#define NAUTILUS_SCALABLE_FONT_H

#include <gtk/gtkobject.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <libgnome/gnome-defs.h>
#include <libnautilus-extensions/nautilus-string-list.h>
#include <libart_lgpl/art_rect.h>

BEGIN_GNOME_DECLS

#define NAUTILUS_TYPE_SCALABLE_FONT		(nautilus_scalable_font_get_type ())
#define NAUTILUS_SCALABLE_FONT(obj)		(GTK_CHECK_CAST ((obj), NAUTILUS_TYPE_SCALABLE_FONT, NautilusScalableFont))
#define NAUTILUS_SCALABLE_FONT_CLASS(klass)	(GTK_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_SCALABLE_FONT, NautilusScalableFontClass))
#define NAUTILUS_IS_SCALABLE_FONT(obj)		(GTK_CHECK_TYPE ((obj), NAUTILUS_TYPE_SCALABLE_FONT))
#define NAUTILUS_IS_SCALABLE_FONT_CLASS(klass)	(GTK_CHECK_CLASS_TYPE ((klass), NAUTILUS_TYPE_SCALABLE_FONT))

typedef struct _NautilusScalableFont	       NautilusScalableFont;
typedef struct _NautilusScalableFontClass      NautilusScalableFontClass;
typedef struct _NautilusScalableFontDetail     NautilusScalableFontDetail;

struct _NautilusScalableFont
{
	/* Superclass */
	GtkObject		object;

	/* Private things */
	NautilusScalableFontDetail	*detail;
};

struct _NautilusScalableFontClass
{
	GtkObjectClass		parent_class;
};

GtkType                nautilus_scalable_font_get_type                  (void);
GtkObject *            nautilus_scalable_font_new                       (const char                  *family,
									 const char                  *weight,
									 const char                  *slant,
									 const char                  *set_width);
void                   nautilus_scalable_font_measure_text              (const NautilusScalableFont  *font,
									 guint                        font_width,
									 guint                        font_height,
									 const char                  *text,
									 guint                       *text_width_out,
									 guint                       *text_height_out);
void                   nautilus_scalable_font_measure_text_lines        (NautilusScalableFont        *font,
									 guint                        font_width,
									 guint                        font_height,
									 const char                  *text_lines[],
									 guint			      num_text_lines,
									 guint                        text_line_widths[],
									 guint                        text_line_heights[],
									 guint                       *max_width_out,
									 guint                       *total_height_out);
void                   nautilus_scalable_font_draw_text                 (const NautilusScalableFont  *font,
									 GdkPixbuf                   *destination_pixbuf,
									 const ArtIRect              *destination_area,
									 guint                        font_width,
									 guint                        font_height,
									 const char                  *text,
									 guint32                      color,
									 guchar                       overall_alpha);
void                   nautilus_scalable_font_draw_text_lines           (const NautilusScalableFont  *font,
									 GdkPixbuf                   *destination_pixbuf,
									 const ArtIRect              *destination_area,
									 guint                        font_width,
									 guint                        font_height,
									 const char                  *text_lines[],
									 const guint                  text_line_widths[],
									 const guint                  text_line_heights[],
									 GtkJustification             justification,
									 const guint                  num_lines,
									 guint                        line_offset,
									 guint32                      color,
									 guchar                       overall_alpha);
guint                  nautilus_scalable_font_largest_fitting_font_size (const NautilusScalableFont  *font,
									 const char                  *text,
									 guint                        available_width,
									 const guint                  font_sizes[],
									 guint                        num_font_sizes);
NautilusScalableFont  *nautilus_scalable_font_get_default_font          (void);
NautilusStringList *   nautilus_scalable_font_get_font_family_list      (void);
gboolean               nautilus_scalable_font_query_font                (const char                  *family,
									 NautilusStringList         **weights,
									 NautilusStringList         **slants,
									 NautilusStringList         **set_widths);
gboolean               nautilus_scalable_font_query_font                (const char                  *family,
									 NautilusStringList         **weights,
									 NautilusStringList         **slants,
									 NautilusStringList         **set_widths);

END_GNOME_DECLS

#endif /* NAUTILUS_SCALABLE_FONT_H */