1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 */
19
20/*
21 * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
22 * file for a list of people on the GTK+ Team. See the ChangeLog
23 * files for a list of changes. These files are distributed with
24 * GTK+ at ftp://ftp.gtk.org/pub/gtk/.
25 */
26
27#if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION)
28
29#ifndef __GDK_FONT_H__
30#define __GDK_FONT_H__
31
32#include <gdk/gdktypes.h>
33#include <pango/pango.h>
34
35G_BEGIN_DECLS
36
37#define GDK_TYPE_FONT gdk_font_get_type ()
38
39/* Types of font.
40 * GDK_FONT_FONT: the font is an XFontStruct.
41 * GDK_FONT_FONTSET: the font is an XFontSet used for I18N.
42 */
43typedef enum
44{
45 GDK_FONT_FONT,
46 GDK_FONT_FONTSET
47} GdkFontType;
48
49struct _GdkFont
50{
51 GdkFontType type;
52 gint ascent;
53 gint descent;
54};
55
56GType gdk_font_get_type (void) G_GNUC_CONST;
57
58GdkFont* gdk_font_ref (GdkFont *font);
59void gdk_font_unref (GdkFont *font);
60gint gdk_font_id (const GdkFont *font);
61gboolean gdk_font_equal (const GdkFont *fonta,
62 const GdkFont *fontb);
63
64GdkFont *gdk_font_load_for_display (GdkDisplay *display,
65 const gchar *font_name);
66GdkFont *gdk_fontset_load_for_display (GdkDisplay *display,
67 const gchar *fontset_name);
68GdkFont *gdk_font_from_description_for_display (GdkDisplay *display,
69 PangoFontDescription *font_desc);
70
71#ifndef GDK_DISABLE_DEPRECATED
72
73#ifndef GDK_MULTIHEAD_SAFE
74GdkFont* gdk_font_load (const gchar *font_name);
75GdkFont* gdk_fontset_load (const gchar *fontset_name);
76GdkFont* gdk_font_from_description (PangoFontDescription *font_desc);
77#endif
78
79gint gdk_string_width (GdkFont *font,
80 const gchar *string);
81gint gdk_text_width (GdkFont *font,
82 const gchar *text,
83 gint text_length);
84gint gdk_text_width_wc (GdkFont *font,
85 const GdkWChar *text,
86 gint text_length);
87gint gdk_char_width (GdkFont *font,
88 gchar character);
89gint gdk_char_width_wc (GdkFont *font,
90 GdkWChar character);
91gint gdk_string_measure (GdkFont *font,
92 const gchar *string);
93gint gdk_text_measure (GdkFont *font,
94 const gchar *text,
95 gint text_length);
96gint gdk_char_measure (GdkFont *font,
97 gchar character);
98gint gdk_string_height (GdkFont *font,
99 const gchar *string);
100gint gdk_text_height (GdkFont *font,
101 const gchar *text,
102 gint text_length);
103gint gdk_char_height (GdkFont *font,
104 gchar character);
105
106void gdk_text_extents (GdkFont *font,
107 const gchar *text,
108 gint text_length,
109 gint *lbearing,
110 gint *rbearing,
111 gint *width,
112 gint *ascent,
113 gint *descent);
114void gdk_text_extents_wc (GdkFont *font,
115 const GdkWChar *text,
116 gint text_length,
117 gint *lbearing,
118 gint *rbearing,
119 gint *width,
120 gint *ascent,
121 gint *descent);
122void gdk_string_extents (GdkFont *font,
123 const gchar *string,
124 gint *lbearing,
125 gint *rbearing,
126 gint *width,
127 gint *ascent,
128 gint *descent);
129
130GdkDisplay * gdk_font_get_display (GdkFont *font);
131
132#endif /* GDK_DISABLE_DEPRECATED */
133
134G_END_DECLS
135
136#endif /* __GDK_FONT_H__ */
137
138#endif /* !GDK_DISABLE_DEPRECATED || GDK_COMPILATION || GTK_COMPILATION */
139