summaryrefslogtreecommitdiff
path: root/pango/pango-font.h
blob: 063b0cea7046f96d25f6688710fbadea9341c9f9 (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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
/* Pango
 * pango-font.h: Font handling
 *
 * Copyright (C) 2000 Red Hat Software
 *
 * This 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.
 *
 * This 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 this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

#ifndef __PANGO_FONT_H__
#define __PANGO_FONT_H__

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include <pango/pango-coverage.h>
#include <pango/pango-types.h>

typedef struct _PangoFontDescription PangoFontDescription;
typedef struct _PangoFontClass PangoFontClass;
typedef struct _PangoFontMap PangoFontMap;
typedef struct _PangoFontMapClass PangoFontMapClass;
typedef struct _PangoFontMetrics PangoFontMetrics;

typedef enum {
  PANGO_STYLE_NORMAL,
  PANGO_STYLE_OBLIQUE,
  PANGO_STYLE_ITALIC
} PangoStyle;

typedef enum {
  PANGO_VARIANT_NORMAL,
  PANGO_VARIANT_SMALL_CAPS
} PangoVariant;

typedef enum {
  PANGO_WEIGHT_NORMAL = 400,
  PANGO_WEIGHT_BOLD = 700
} PangoWeight;

typedef enum {
  PANGO_STRETCH_ULTRA_CONDENSED,
  PANGO_STRETCH_EXTRA_CONDENSED,
  PANGO_STRETCH_CONDENSED,
  PANGO_STRETCH_SEMI_CONDENSED,
  PANGO_STRETCH_NORMAL,
  PANGO_STRETCH_SEMI_EXPANDED,
  PANGO_STRETCH_EXPANDED,
  PANGO_STRETCH_EXTRA_EXPANDED,
  PANGO_STRETCH_ULTRA_EXPANDED
} PangoStretch;

struct _PangoFontDescription
{
  char *family_name;

  PangoStyle style;
  PangoVariant variant;
  PangoWeight weight;
  PangoStretch stretch;

  int size;
};

struct _PangoFontMetrics
{
  int ascent;
  int descent;
};

PangoFontDescription *pango_font_description_copy        (const PangoFontDescription  *desc);
gboolean              pango_font_description_compare     (const PangoFontDescription  *desc1,
							  const PangoFontDescription  *desc2);
void                  pango_font_description_free        (PangoFontDescription        *desc);
void                  pango_font_descriptions_free       (PangoFontDescription       **descs,
							  int                          n_descs);

PangoFontDescription *pango_font_description_from_string (const char                  *str);
char *                pango_font_description_to_string   (const PangoFontDescription  *desc);


/* Logical fonts
  */
struct _PangoFont
{
  PangoFontClass *klass;

  /*< private >*/
  gint ref_count;
  GData *data;
};

struct _PangoFontClass
{
  void                  (*destroy)            (PangoFont      *font);
  PangoFontDescription *(*describe)           (PangoFont      *font);
  PangoCoverage *       (*get_coverage)       (PangoFont      *font,
					      const char      *lang);
  PangoEngineShape *    (*find_shaper)        (PangoFont      *font,
					       const char     *lang,
					       guint32         ch);
  void                  (*get_glyph_extents)  (PangoFont      *font,
					       PangoGlyph      glyph,
					       PangoRectangle *ink_rect,
					       PangoRectangle *logical_rect);
  void                  (*get_metrics)        (PangoFont        *font,
					       const gchar      *lang,
					       PangoFontMetrics *metrics);
};

void                  pango_font_init         (PangoFont      *font);
void                  pango_font_ref          (PangoFont      *font);
void                  pango_font_unref        (PangoFont      *font);
gpointer              pango_font_get_data     (PangoFont      *font,
					       const gchar    *key);
void                  pango_font_set_data     (PangoFont      *font,
					       const gchar    *key,
					       gpointer        data,
					       GDestroyNotify  destroy_func);


PangoFontDescription *pango_font_describe          (PangoFont        *font);
PangoCoverage *       pango_font_get_coverage      (PangoFont        *font,
						    const char       *lang);
PangoEngineShape *    pango_font_find_shaper       (PangoFont        *font,
						    const char       *lang,
						    guint32           ch);
void                  pango_font_get_metrics       (PangoFont        *font,
						    const gchar      *lang,
						    PangoFontMetrics *metrics);
void                  pango_font_get_glyph_extents (PangoFont        *font,
						    PangoGlyph        glyph,
						    PangoRectangle   *ink_rect,
						    PangoRectangle   *logical_rect);

/*
 * Font Map
 */

struct _PangoFontMap
{
  PangoFontMapClass *klass;

  /*< private >*/
  gint ref_count;
};

struct _PangoFontMapClass
{
  void       (*destroy)       (PangoFontMap               *fontmap);
  PangoFont *(*load_font)     (PangoFontMap               *fontmap,
			       const PangoFontDescription *desc);
  void       (*list_fonts)    (PangoFontMap               *fontmap,
			       const gchar                *family,
			       PangoFontDescription     ***descs,
			       int                        *n_descs);
  void       (*list_families) (PangoFontMap               *fontmap,
			       gchar                    ***families,
			       int                        *n_families);
};

void       pango_font_map_init      (PangoFontMap               *fontmap);
void       pango_font_map_ref       (PangoFontMap               *fontmap);
void       pango_font_map_unref     (PangoFontMap               *fontmap);
PangoFont *pango_font_map_load_font (PangoFontMap               *fontmap,
				     const PangoFontDescription *desc);

void       pango_font_map_list_fonts    (PangoFontMap           *fontmap,
					 const gchar            *family,
					 PangoFontDescription ***descs,
					 int                    *n_descs);
void       pango_font_map_list_families (PangoFontMap           *fontmap,
					 gchar                ***families,
					 int                    *n_families);
void       pango_font_map_free_families (gchar                 **families,
					 int                     n_families);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif __PANGO_FONT_H__