1/* Pango
2 * pango-font.h: Font handling
3 *
4 * Copyright (C) 2000 Red Hat Software
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
15 *
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 */
21
22#ifndef __PANGO_FONT_H__
23#define __PANGO_FONT_H__
24
25#include <pango/pango-coverage.h>
26#include <pango/pango-types.h>
27
28#include <glib-object.h>
29
30G_BEGIN_DECLS
31
32/**
33 * PangoFontDescription:
34 *
35 * The #PangoFontDescription structure represents the description
36 * of an ideal font. These structures are used both to list
37 * what fonts are available on the system and also for specifying
38 * the characteristics of a font to load.
39 */
40typedef struct _PangoFontDescription PangoFontDescription;
41/**
42 * PangoFontMetrics:
43 *
44 * A #PangoFontMetrics structure holds the overall metric information
45 * for a font (possibly restricted to a script). The fields of this
46 * structure are private to implementations of a font backend. See
47 * the documentation of the corresponding getters for documentation
48 * of their meaning.
49 */
50typedef struct _PangoFontMetrics PangoFontMetrics;
51
52/**
53 * PangoStyle:
54 * @PANGO_STYLE_NORMAL: the font is upright.
55 * @PANGO_STYLE_OBLIQUE: the font is slanted, but in a roman style.
56 * @PANGO_STYLE_ITALIC: the font is slanted in an italic style.
57 *
58 * An enumeration specifying the various slant styles possible for a font.
59 **/
60typedef enum {
61 PANGO_STYLE_NORMAL,
62 PANGO_STYLE_OBLIQUE,
63 PANGO_STYLE_ITALIC
64} PangoStyle;
65
66/**
67 * PangoVariant:
68 * @PANGO_VARIANT_NORMAL: A normal font.
69 * @PANGO_VARIANT_SMALL_CAPS: A font with the lower case characters
70 * replaced by smaller variants of the capital characters.
71 *
72 * An enumeration specifying capitalization variant of the font.
73 */
74typedef enum {
75 PANGO_VARIANT_NORMAL,
76 PANGO_VARIANT_SMALL_CAPS
77} PangoVariant;
78
79/**
80 * PangoWeight:
81 * @PANGO_WEIGHT_THIN: the thin weight (= 100; Since: 1.24)
82 * @PANGO_WEIGHT_ULTRALIGHT: the ultralight weight (= 200)
83 * @PANGO_WEIGHT_LIGHT: the light weight (= 300)
84 * @PANGO_WEIGHT_SEMILIGHT: the semilight weight (= 350; Since: 1.36.7)
85 * @PANGO_WEIGHT_BOOK: the book weight (= 380; Since: 1.24)
86 * @PANGO_WEIGHT_NORMAL: the default weight (= 400)
87 * @PANGO_WEIGHT_MEDIUM: the normal weight (= 500; Since: 1.24)
88 * @PANGO_WEIGHT_SEMIBOLD: the semibold weight (= 600)
89 * @PANGO_WEIGHT_BOLD: the bold weight (= 700)
90 * @PANGO_WEIGHT_ULTRABOLD: the ultrabold weight (= 800)
91 * @PANGO_WEIGHT_HEAVY: the heavy weight (= 900)
92 * @PANGO_WEIGHT_ULTRAHEAVY: the ultraheavy weight (= 1000; Since: 1.24)
93 *
94 * An enumeration specifying the weight (boldness) of a font. This is a numerical
95 * value ranging from 100 to 1000, but there are some predefined values:
96 */
97typedef enum {
98 PANGO_WEIGHT_THIN = 100,
99 PANGO_WEIGHT_ULTRALIGHT = 200,
100 PANGO_WEIGHT_LIGHT = 300,
101 PANGO_WEIGHT_SEMILIGHT = 350,
102 PANGO_WEIGHT_BOOK = 380,
103 PANGO_WEIGHT_NORMAL = 400,
104 PANGO_WEIGHT_MEDIUM = 500,
105 PANGO_WEIGHT_SEMIBOLD = 600,
106 PANGO_WEIGHT_BOLD = 700,
107 PANGO_WEIGHT_ULTRABOLD = 800,
108 PANGO_WEIGHT_HEAVY = 900,
109 PANGO_WEIGHT_ULTRAHEAVY = 1000
110} PangoWeight;
111
112/**
113 * PangoStretch:
114 * @PANGO_STRETCH_ULTRA_CONDENSED: ultra condensed width
115 * @PANGO_STRETCH_EXTRA_CONDENSED: extra condensed width
116 * @PANGO_STRETCH_CONDENSED: condensed width
117 * @PANGO_STRETCH_SEMI_CONDENSED: semi condensed width
118 * @PANGO_STRETCH_NORMAL: the normal width
119 * @PANGO_STRETCH_SEMI_EXPANDED: semi expanded width
120 * @PANGO_STRETCH_EXPANDED: expanded width
121 * @PANGO_STRETCH_EXTRA_EXPANDED: extra expanded width
122 * @PANGO_STRETCH_ULTRA_EXPANDED: ultra expanded width
123 *
124 * An enumeration specifying the width of the font relative to other designs
125 * within a family.
126 */
127typedef enum {
128 PANGO_STRETCH_ULTRA_CONDENSED,
129 PANGO_STRETCH_EXTRA_CONDENSED,
130 PANGO_STRETCH_CONDENSED,
131 PANGO_STRETCH_SEMI_CONDENSED,
132 PANGO_STRETCH_NORMAL,
133 PANGO_STRETCH_SEMI_EXPANDED,
134 PANGO_STRETCH_EXPANDED,
135 PANGO_STRETCH_EXTRA_EXPANDED,
136 PANGO_STRETCH_ULTRA_EXPANDED
137} PangoStretch;
138
139/**
140 * PangoFontMask:
141 * @PANGO_FONT_MASK_FAMILY: the font family is specified.
142 * @PANGO_FONT_MASK_STYLE: the font style is specified.
143 * @PANGO_FONT_MASK_VARIANT: the font variant is specified.
144 * @PANGO_FONT_MASK_WEIGHT: the font weight is specified.
145 * @PANGO_FONT_MASK_STRETCH: the font stretch is specified.
146 * @PANGO_FONT_MASK_SIZE: the font size is specified.
147 * @PANGO_FONT_MASK_GRAVITY: the font gravity is specified (Since: 1.16.)
148 * @PANGO_FONT_MASK_VARIATIONS: OpenType font variations are specified (Since: 1.42)
149 *
150 * The bits in a #PangoFontMask correspond to fields in a
151 * #PangoFontDescription that have been set.
152 */
153typedef enum {
154 PANGO_FONT_MASK_FAMILY = 1 << 0,
155 PANGO_FONT_MASK_STYLE = 1 << 1,
156 PANGO_FONT_MASK_VARIANT = 1 << 2,
157 PANGO_FONT_MASK_WEIGHT = 1 << 3,
158 PANGO_FONT_MASK_STRETCH = 1 << 4,
159 PANGO_FONT_MASK_SIZE = 1 << 5,
160 PANGO_FONT_MASK_GRAVITY = 1 << 6,
161 PANGO_FONT_MASK_VARIATIONS = 1 << 7,
162} PangoFontMask;
163
164/* CSS scale factors (1.2 factor between each size) */
165/**
166 * PANGO_SCALE_XX_SMALL:
167 *
168 * The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
169 */
170/**
171 * PANGO_SCALE_X_SMALL:
172 *
173 * The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
174 */
175/**
176 * PANGO_SCALE_SMALL:
177 *
178 * The scale factor for one shrinking step (1 / 1.2).
179 */
180/**
181 * PANGO_SCALE_MEDIUM:
182 *
183 * The scale factor for normal size (1.0).
184 */
185/**
186 * PANGO_SCALE_LARGE:
187 *
188 * The scale factor for one magnification step (1.2).
189 */
190/**
191 * PANGO_SCALE_X_LARGE:
192 *
193 * The scale factor for two magnification steps (1.2 * 1.2).
194 */
195/**
196 * PANGO_SCALE_XX_LARGE:
197 *
198 * The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
199 */
200#define PANGO_SCALE_XX_SMALL ((double)0.5787037037037)
201#define PANGO_SCALE_X_SMALL ((double)0.6444444444444)
202#define PANGO_SCALE_SMALL ((double)0.8333333333333)
203#define PANGO_SCALE_MEDIUM ((double)1.0)
204#define PANGO_SCALE_LARGE ((double)1.2)
205#define PANGO_SCALE_X_LARGE ((double)1.4399999999999)
206#define PANGO_SCALE_XX_LARGE ((double)1.728)
207
208/*
209 * PangoFontDescription
210 */
211
212/**
213 * PANGO_TYPE_FONT_DESCRIPTION:
214 *
215 * The #GObject type for #PangoFontDescription.
216 */
217#define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
218
219PANGO_AVAILABLE_IN_ALL
220GType pango_font_description_get_type (void) G_GNUC_CONST;
221PANGO_AVAILABLE_IN_ALL
222PangoFontDescription *pango_font_description_new (void);
223PANGO_AVAILABLE_IN_ALL
224PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc);
225PANGO_AVAILABLE_IN_ALL
226PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription *desc);
227PANGO_AVAILABLE_IN_ALL
228guint pango_font_description_hash (const PangoFontDescription *desc) G_GNUC_PURE;
229PANGO_AVAILABLE_IN_ALL
230gboolean pango_font_description_equal (const PangoFontDescription *desc1,
231 const PangoFontDescription *desc2) G_GNUC_PURE;
232PANGO_AVAILABLE_IN_ALL
233void pango_font_description_free (PangoFontDescription *desc);
234PANGO_AVAILABLE_IN_ALL
235void pango_font_descriptions_free (PangoFontDescription **descs,
236 int n_descs);
237
238PANGO_AVAILABLE_IN_ALL
239void pango_font_description_set_family (PangoFontDescription *desc,
240 const char *family);
241PANGO_AVAILABLE_IN_ALL
242void pango_font_description_set_family_static (PangoFontDescription *desc,
243 const char *family);
244PANGO_AVAILABLE_IN_ALL
245const char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE;
246PANGO_AVAILABLE_IN_ALL
247void pango_font_description_set_style (PangoFontDescription *desc,
248 PangoStyle style);
249PANGO_AVAILABLE_IN_ALL
250PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE;
251PANGO_AVAILABLE_IN_ALL
252void pango_font_description_set_variant (PangoFontDescription *desc,
253 PangoVariant variant);
254PANGO_AVAILABLE_IN_ALL
255PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc) G_GNUC_PURE;
256PANGO_AVAILABLE_IN_ALL
257void pango_font_description_set_weight (PangoFontDescription *desc,
258 PangoWeight weight);
259PANGO_AVAILABLE_IN_ALL
260PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc) G_GNUC_PURE;
261PANGO_AVAILABLE_IN_ALL
262void pango_font_description_set_stretch (PangoFontDescription *desc,
263 PangoStretch stretch);
264PANGO_AVAILABLE_IN_ALL
265PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc) G_GNUC_PURE;
266PANGO_AVAILABLE_IN_ALL
267void pango_font_description_set_size (PangoFontDescription *desc,
268 gint size);
269PANGO_AVAILABLE_IN_ALL
270gint pango_font_description_get_size (const PangoFontDescription *desc) G_GNUC_PURE;
271PANGO_AVAILABLE_IN_1_8
272void pango_font_description_set_absolute_size (PangoFontDescription *desc,
273 double size);
274PANGO_AVAILABLE_IN_1_8
275gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE;
276PANGO_AVAILABLE_IN_1_16
277void pango_font_description_set_gravity (PangoFontDescription *desc,
278 PangoGravity gravity);
279PANGO_AVAILABLE_IN_1_16
280PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc) G_GNUC_PURE;
281
282PANGO_AVAILABLE_IN_1_42
283void pango_font_description_set_variations_static (PangoFontDescription *desc,
284 const char *settings);
285PANGO_AVAILABLE_IN_1_42
286void pango_font_description_set_variations (PangoFontDescription *desc,
287 const char *settings);
288PANGO_AVAILABLE_IN_1_42
289const char *pango_font_description_get_variations (const PangoFontDescription *desc) G_GNUC_PURE;
290
291PANGO_AVAILABLE_IN_ALL
292PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE;
293PANGO_AVAILABLE_IN_ALL
294void pango_font_description_unset_fields (PangoFontDescription *desc,
295 PangoFontMask to_unset);
296
297PANGO_AVAILABLE_IN_ALL
298void pango_font_description_merge (PangoFontDescription *desc,
299 const PangoFontDescription *desc_to_merge,
300 gboolean replace_existing);
301PANGO_AVAILABLE_IN_ALL
302void pango_font_description_merge_static (PangoFontDescription *desc,
303 const PangoFontDescription *desc_to_merge,
304 gboolean replace_existing);
305
306PANGO_AVAILABLE_IN_ALL
307gboolean pango_font_description_better_match (const PangoFontDescription *desc,
308 const PangoFontDescription *old_match,
309 const PangoFontDescription *new_match) G_GNUC_PURE;
310
311PANGO_AVAILABLE_IN_ALL
312PangoFontDescription *pango_font_description_from_string (const char *str);
313PANGO_AVAILABLE_IN_ALL
314char * pango_font_description_to_string (const PangoFontDescription *desc);
315PANGO_AVAILABLE_IN_ALL
316char * pango_font_description_to_filename (const PangoFontDescription *desc);
317
318/*
319 * PangoFontMetrics
320 */
321
322/**
323 * PANGO_TYPE_FONT_METRICS:
324 *
325 * The #GObject type for #PangoFontMetrics.
326 */
327#define PANGO_TYPE_FONT_METRICS (pango_font_metrics_get_type ())
328PANGO_AVAILABLE_IN_ALL
329GType pango_font_metrics_get_type (void) G_GNUC_CONST;
330PANGO_AVAILABLE_IN_ALL
331PangoFontMetrics *pango_font_metrics_ref (PangoFontMetrics *metrics);
332PANGO_AVAILABLE_IN_ALL
333void pango_font_metrics_unref (PangoFontMetrics *metrics);
334PANGO_AVAILABLE_IN_ALL
335int pango_font_metrics_get_ascent (PangoFontMetrics *metrics) G_GNUC_PURE;
336PANGO_AVAILABLE_IN_ALL
337int pango_font_metrics_get_descent (PangoFontMetrics *metrics) G_GNUC_PURE;
338PANGO_AVAILABLE_IN_ALL
339int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics) G_GNUC_PURE;
340PANGO_AVAILABLE_IN_ALL
341int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
342PANGO_AVAILABLE_IN_1_6
343int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics) G_GNUC_PURE;
344PANGO_AVAILABLE_IN_1_6
345int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
346PANGO_AVAILABLE_IN_1_6
347int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics) G_GNUC_PURE;
348PANGO_AVAILABLE_IN_1_6
349int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
350
351#ifdef PANGO_ENABLE_BACKEND
352
353PANGO_AVAILABLE_IN_ALL
354PangoFontMetrics *pango_font_metrics_new (void);
355
356struct _PangoFontMetrics
357{
358 /* <private> */
359 guint ref_count;
360
361 int ascent;
362 int descent;
363 int approximate_char_width;
364 int approximate_digit_width;
365 int underline_position;
366 int underline_thickness;
367 int strikethrough_position;
368 int strikethrough_thickness;
369};
370
371#endif /* PANGO_ENABLE_BACKEND */
372
373/*
374 * PangoFontFamily
375 */
376
377/**
378 * PANGO_TYPE_FONT_FAMILY:
379 *
380 * The #GObject type for #PangoFontFamily.
381 */
382/**
383 * PANGO_FONT_FAMILY:
384 * @object: a #GObject.
385 *
386 * Casts a #GObject to a #PangoFontFamily.
387 */
388/**
389 * PANGO_IS_FONT_FAMILY:
390 * @object: a #GObject.
391 *
392 * Returns: %TRUE if @object is a #PangoFontFamily.
393 */
394#define PANGO_TYPE_FONT_FAMILY (pango_font_family_get_type ())
395#define PANGO_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily))
396#define PANGO_IS_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY))
397
398typedef struct _PangoFontFamily PangoFontFamily;
399typedef struct _PangoFontFace PangoFontFace;
400
401PANGO_AVAILABLE_IN_ALL
402GType pango_font_family_get_type (void) G_GNUC_CONST;
403
404PANGO_AVAILABLE_IN_ALL
405void pango_font_family_list_faces (PangoFontFamily *family,
406 PangoFontFace ***faces,
407 int *n_faces);
408PANGO_AVAILABLE_IN_ALL
409const char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE;
410PANGO_AVAILABLE_IN_1_4
411gboolean pango_font_family_is_monospace (PangoFontFamily *family) G_GNUC_PURE;
412
413#ifdef PANGO_ENABLE_BACKEND
414
415#define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
416#define PANGO_IS_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
417#define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
418
419typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
420
421
422/**
423 * PangoFontFamily:
424 *
425 * The #PangoFontFamily structure is used to represent a family of related
426 * font faces. The faces in a family share a common design, but differ in
427 * slant, weight, width and other aspects.
428 */
429struct _PangoFontFamily
430{
431 GObject parent_instance;
432};
433
434struct _PangoFontFamilyClass
435{
436 GObjectClass parent_class;
437
438 /*< public >*/
439
440 void (*list_faces) (PangoFontFamily *family,
441 PangoFontFace ***faces,
442 int *n_faces);
443 const char * (*get_name) (PangoFontFamily *family);
444 gboolean (*is_monospace) (PangoFontFamily *family);
445
446 /*< private >*/
447
448 /* Padding for future expansion */
449 void (*_pango_reserved2) (void);
450 void (*_pango_reserved3) (void);
451 void (*_pango_reserved4) (void);
452};
453
454#endif /* PANGO_ENABLE_BACKEND */
455
456/*
457 * PangoFontFace
458 */
459
460/**
461 * PANGO_TYPE_FONT_FACE:
462 *
463 * The #GObject type for #PangoFontFace.
464 */
465/**
466 * PANGO_FONT_FACE:
467 * @object: a #GObject.
468 *
469 * Casts a #GObject to a #PangoFontFace.
470 */
471/**
472 * PANGO_IS_FONT_FACE:
473 * @object: a #GObject.
474 *
475 * Returns: %TRUE if @object is a #PangoFontFace.
476 */
477#define PANGO_TYPE_FONT_FACE (pango_font_face_get_type ())
478#define PANGO_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace))
479#define PANGO_IS_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE))
480
481PANGO_AVAILABLE_IN_ALL
482GType pango_font_face_get_type (void) G_GNUC_CONST;
483
484PANGO_AVAILABLE_IN_ALL
485PangoFontDescription *pango_font_face_describe (PangoFontFace *face);
486PANGO_AVAILABLE_IN_ALL
487const char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE;
488PANGO_AVAILABLE_IN_1_4
489void pango_font_face_list_sizes (PangoFontFace *face,
490 int **sizes,
491 int *n_sizes);
492PANGO_AVAILABLE_IN_1_18
493gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE;
494
495#ifdef PANGO_ENABLE_BACKEND
496
497#define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
498#define PANGO_IS_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
499#define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
500
501typedef struct _PangoFontFaceClass PangoFontFaceClass;
502
503/**
504 * PangoFontFace:
505 *
506 * The #PangoFontFace structure is used to represent a group of fonts with
507 * the same family, slant, weight, width, but varying sizes.
508 */
509struct _PangoFontFace
510{
511 GObject parent_instance;
512};
513
514struct _PangoFontFaceClass
515{
516 GObjectClass parent_class;
517
518 /*< public >*/
519
520 const char * (*get_face_name) (PangoFontFace *face);
521 PangoFontDescription * (*describe) (PangoFontFace *face);
522 void (*list_sizes) (PangoFontFace *face,
523 int **sizes,
524 int *n_sizes);
525 gboolean (*is_synthesized) (PangoFontFace *face);
526
527 /*< private >*/
528
529 /* Padding for future expansion */
530 void (*_pango_reserved3) (void);
531 void (*_pango_reserved4) (void);
532};
533
534#endif /* PANGO_ENABLE_BACKEND */
535
536/*
537 * PangoFont
538 */
539
540/**
541 * PANGO_TYPE_FONT:
542 *
543 * The #GObject type for #PangoFont.
544 */
545/**
546 * PANGO_FONT:
547 * @object: a #GObject.
548 *
549 * Casts a #GObject to a #PangoFont.
550 */
551/**
552 * PANGO_IS_FONT:
553 * @object: a #GObject.
554 *
555 * Returns: %TRUE if @object is a #PangoFont.
556 */
557#define PANGO_TYPE_FONT (pango_font_get_type ())
558#define PANGO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont))
559#define PANGO_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT))
560
561PANGO_AVAILABLE_IN_ALL
562GType pango_font_get_type (void) G_GNUC_CONST;
563
564PANGO_AVAILABLE_IN_ALL
565PangoFontDescription *pango_font_describe (PangoFont *font);
566PANGO_AVAILABLE_IN_1_14
567PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont *font);
568PANGO_AVAILABLE_IN_ALL
569PangoCoverage * pango_font_get_coverage (PangoFont *font,
570 PangoLanguage *language);
571PANGO_AVAILABLE_IN_ALL
572PangoEngineShape * pango_font_find_shaper (PangoFont *font,
573 PangoLanguage *language,
574 guint32 ch);
575PANGO_AVAILABLE_IN_ALL
576PangoFontMetrics * pango_font_get_metrics (PangoFont *font,
577 PangoLanguage *language);
578PANGO_AVAILABLE_IN_ALL
579void pango_font_get_glyph_extents (PangoFont *font,
580 PangoGlyph glyph,
581 PangoRectangle *ink_rect,
582 PangoRectangle *logical_rect);
583PANGO_AVAILABLE_IN_1_10
584PangoFontMap *pango_font_get_font_map (PangoFont *font);
585
586#ifdef PANGO_ENABLE_BACKEND
587
588#define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
589#define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
590#define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
591
592typedef struct _PangoFontClass PangoFontClass;
593
594/**
595 * PangoFont:
596 *
597 * The #PangoFont structure is used to represent
598 * a font in a rendering-system-independent matter.
599 * To create an implementation of a #PangoFont,
600 * the rendering-system specific code should allocate
601 * a larger structure that contains a nested
602 * #PangoFont, fill in the <structfield>klass</structfield> member of
603 * the nested #PangoFont with a pointer to
604 * a appropriate #PangoFontClass, then call
605 * pango_font_init() on the structure.
606 *
607 * The #PangoFont structure contains one member
608 * which the implementation fills in.
609 */
610struct _PangoFont
611{
612 GObject parent_instance;
613};
614
615struct _PangoFontClass
616{
617 GObjectClass parent_class;
618
619 /*< public >*/
620
621 PangoFontDescription *(*describe) (PangoFont *font);
622 PangoCoverage * (*get_coverage) (PangoFont *font,
623 PangoLanguage *language);
624 PangoEngineShape * (*find_shaper) (PangoFont *font,
625 PangoLanguage *language,
626 guint32 ch);
627 void (*get_glyph_extents) (PangoFont *font,
628 PangoGlyph glyph,
629 PangoRectangle *ink_rect,
630 PangoRectangle *logical_rect);
631 PangoFontMetrics * (*get_metrics) (PangoFont *font,
632 PangoLanguage *language);
633 PangoFontMap * (*get_font_map) (PangoFont *font);
634 PangoFontDescription *(*describe_absolute) (PangoFont *font);
635 /*< private >*/
636
637 /* Padding for future expansion */
638 void (*_pango_reserved1) (void);
639 void (*_pango_reserved2) (void);
640};
641
642/* used for very rare and miserable situtations that we cannot even
643 * draw a hexbox
644 */
645#define PANGO_UNKNOWN_GLYPH_WIDTH 10
646#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
647
648#endif /* PANGO_ENABLE_BACKEND */
649
650/**
651 * PANGO_GLYPH_EMPTY:
652 *
653 * The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
654 * special meaning, which is a zero-width empty glyph. This is useful for
655 * example in shaper modules, to use as the glyph for various zero-width
656 * Unicode characters (those passing pango_is_zero_width()).
657 */
658/**
659 * PANGO_GLYPH_INVALID_INPUT:
660 *
661 * The %PANGO_GLYPH_INVALID_INPUT macro represents a #PangoGlyph value that has a
662 * special meaning of invalid input. #PangoLayout produces one such glyph
663 * per invalid input UTF-8 byte and such a glyph is rendered as a crossed
664 * box.
665 *
666 * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
667 * on.
668 *
669 * Since: 1.20
670 */
671/**
672 * PANGO_GLYPH_UNKNOWN_FLAG:
673 *
674 * The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
675 * a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
676 * value, representing an unknown-character glyph for the respective #gunichar.
677 */
678/**
679 * PANGO_GET_UNKNOWN_GLYPH:
680 * @wc: a Unicode character
681 *
682 * The way this unknown glyphs are rendered is backend specific. For example,
683 * a box with the hexadecimal Unicode code-point of the character written in it
684 * is what is done in the most common backends.
685 *
686 * Returns: a #PangoGlyph value that means no glyph was found for @wc.
687 */
688#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF)
689#define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF)
690#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
691#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
692
693
694G_END_DECLS
695
696#endif /* __PANGO_FONT_H__ */
697