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 *
149 * The bits in a #PangoFontMask correspond to fields in a
150 * #PangoFontDescription that have been set.
151 */
152typedef enum {
153 PANGO_FONT_MASK_FAMILY = 1 << 0,
154 PANGO_FONT_MASK_STYLE = 1 << 1,
155 PANGO_FONT_MASK_VARIANT = 1 << 2,
156 PANGO_FONT_MASK_WEIGHT = 1 << 3,
157 PANGO_FONT_MASK_STRETCH = 1 << 4,
158 PANGO_FONT_MASK_SIZE = 1 << 5,
159 PANGO_FONT_MASK_GRAVITY = 1 << 6
160} PangoFontMask;
161
162/* CSS scale factors (1.2 factor between each size) */
163/**
164 * PANGO_SCALE_XX_SMALL:
165 *
166 * The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
167 */
168/**
169 * PANGO_SCALE_X_SMALL:
170 *
171 * The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
172 */
173/**
174 * PANGO_SCALE_SMALL:
175 *
176 * The scale factor for one shrinking step (1 / 1.2).
177 */
178/**
179 * PANGO_SCALE_MEDIUM:
180 *
181 * The scale factor for normal size (1.0).
182 */
183/**
184 * PANGO_SCALE_LARGE:
185 *
186 * The scale factor for one magnification step (1.2).
187 */
188/**
189 * PANGO_SCALE_X_LARGE:
190 *
191 * The scale factor for two magnification steps (1.2 * 1.2).
192 */
193/**
194 * PANGO_SCALE_XX_LARGE:
195 *
196 * The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
197 */
198#define PANGO_SCALE_XX_SMALL ((double)0.5787037037037)
199#define PANGO_SCALE_X_SMALL ((double)0.6444444444444)
200#define PANGO_SCALE_SMALL ((double)0.8333333333333)
201#define PANGO_SCALE_MEDIUM ((double)1.0)
202#define PANGO_SCALE_LARGE ((double)1.2)
203#define PANGO_SCALE_X_LARGE ((double)1.4399999999999)
204#define PANGO_SCALE_XX_LARGE ((double)1.728)
205
206/*
207 * PangoFontDescription
208 */
209
210/**
211 * PANGO_TYPE_FONT_DESCRIPTION:
212 *
213 * The #GObject type for #PangoFontDescription.
214 */
215#define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
216
217PANGO_AVAILABLE_IN_ALL
218GType pango_font_description_get_type (void) G_GNUC_CONST;
219PANGO_AVAILABLE_IN_ALL
220PangoFontDescription *pango_font_description_new (void);
221PANGO_AVAILABLE_IN_ALL
222PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc);
223PANGO_AVAILABLE_IN_ALL
224PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription *desc);
225PANGO_AVAILABLE_IN_ALL
226guint pango_font_description_hash (const PangoFontDescription *desc) G_GNUC_PURE;
227PANGO_AVAILABLE_IN_ALL
228gboolean pango_font_description_equal (const PangoFontDescription *desc1,
229 const PangoFontDescription *desc2) G_GNUC_PURE;
230PANGO_AVAILABLE_IN_ALL
231void pango_font_description_free (PangoFontDescription *desc);
232PANGO_AVAILABLE_IN_ALL
233void pango_font_descriptions_free (PangoFontDescription **descs,
234 int n_descs);
235
236PANGO_AVAILABLE_IN_ALL
237void pango_font_description_set_family (PangoFontDescription *desc,
238 const char *family);
239PANGO_AVAILABLE_IN_ALL
240void pango_font_description_set_family_static (PangoFontDescription *desc,
241 const char *family);
242PANGO_AVAILABLE_IN_ALL
243const char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE;
244PANGO_AVAILABLE_IN_ALL
245void pango_font_description_set_style (PangoFontDescription *desc,
246 PangoStyle style);
247PANGO_AVAILABLE_IN_ALL
248PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE;
249PANGO_AVAILABLE_IN_ALL
250void pango_font_description_set_variant (PangoFontDescription *desc,
251 PangoVariant variant);
252PANGO_AVAILABLE_IN_ALL
253PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc) G_GNUC_PURE;
254PANGO_AVAILABLE_IN_ALL
255void pango_font_description_set_weight (PangoFontDescription *desc,
256 PangoWeight weight);
257PANGO_AVAILABLE_IN_ALL
258PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc) G_GNUC_PURE;
259PANGO_AVAILABLE_IN_ALL
260void pango_font_description_set_stretch (PangoFontDescription *desc,
261 PangoStretch stretch);
262PANGO_AVAILABLE_IN_ALL
263PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc) G_GNUC_PURE;
264PANGO_AVAILABLE_IN_ALL
265void pango_font_description_set_size (PangoFontDescription *desc,
266 gint size);
267PANGO_AVAILABLE_IN_ALL
268gint pango_font_description_get_size (const PangoFontDescription *desc) G_GNUC_PURE;
269PANGO_AVAILABLE_IN_1_8
270void pango_font_description_set_absolute_size (PangoFontDescription *desc,
271 double size);
272PANGO_AVAILABLE_IN_1_8
273gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE;
274PANGO_AVAILABLE_IN_1_16
275void pango_font_description_set_gravity (PangoFontDescription *desc,
276 PangoGravity gravity);
277PANGO_AVAILABLE_IN_1_16
278PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc) G_GNUC_PURE;
279
280PANGO_AVAILABLE_IN_ALL
281PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE;
282PANGO_AVAILABLE_IN_ALL
283void pango_font_description_unset_fields (PangoFontDescription *desc,
284 PangoFontMask to_unset);
285
286PANGO_AVAILABLE_IN_ALL
287void pango_font_description_merge (PangoFontDescription *desc,
288 const PangoFontDescription *desc_to_merge,
289 gboolean replace_existing);
290PANGO_AVAILABLE_IN_ALL
291void pango_font_description_merge_static (PangoFontDescription *desc,
292 const PangoFontDescription *desc_to_merge,
293 gboolean replace_existing);
294
295PANGO_AVAILABLE_IN_ALL
296gboolean pango_font_description_better_match (const PangoFontDescription *desc,
297 const PangoFontDescription *old_match,
298 const PangoFontDescription *new_match) G_GNUC_PURE;
299
300PANGO_AVAILABLE_IN_ALL
301PangoFontDescription *pango_font_description_from_string (const char *str);
302PANGO_AVAILABLE_IN_ALL
303char * pango_font_description_to_string (const PangoFontDescription *desc);
304PANGO_AVAILABLE_IN_ALL
305char * pango_font_description_to_filename (const PangoFontDescription *desc);
306
307/*
308 * PangoFontMetrics
309 */
310
311/**
312 * PANGO_TYPE_FONT_METRICS:
313 *
314 * The #GObject type for #PangoFontMetrics.
315 */
316#define PANGO_TYPE_FONT_METRICS (pango_font_metrics_get_type ())
317PANGO_AVAILABLE_IN_ALL
318GType pango_font_metrics_get_type (void) G_GNUC_CONST;
319PANGO_AVAILABLE_IN_ALL
320PangoFontMetrics *pango_font_metrics_ref (PangoFontMetrics *metrics);
321PANGO_AVAILABLE_IN_ALL
322void pango_font_metrics_unref (PangoFontMetrics *metrics);
323PANGO_AVAILABLE_IN_ALL
324int pango_font_metrics_get_ascent (PangoFontMetrics *metrics) G_GNUC_PURE;
325PANGO_AVAILABLE_IN_ALL
326int pango_font_metrics_get_descent (PangoFontMetrics *metrics) G_GNUC_PURE;
327PANGO_AVAILABLE_IN_ALL
328int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics) G_GNUC_PURE;
329PANGO_AVAILABLE_IN_ALL
330int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
331PANGO_AVAILABLE_IN_1_6
332int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics) G_GNUC_PURE;
333PANGO_AVAILABLE_IN_1_6
334int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
335PANGO_AVAILABLE_IN_1_6
336int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics) G_GNUC_PURE;
337PANGO_AVAILABLE_IN_1_6
338int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
339
340#ifdef PANGO_ENABLE_BACKEND
341
342PANGO_AVAILABLE_IN_ALL
343PangoFontMetrics *pango_font_metrics_new (void);
344
345struct _PangoFontMetrics
346{
347 /* <private> */
348 guint ref_count;
349
350 int ascent;
351 int descent;
352 int approximate_char_width;
353 int approximate_digit_width;
354 int underline_position;
355 int underline_thickness;
356 int strikethrough_position;
357 int strikethrough_thickness;
358};
359
360#endif /* PANGO_ENABLE_BACKEND */
361
362/*
363 * PangoFontFamily
364 */
365
366/**
367 * PANGO_TYPE_FONT_FAMILY:
368 *
369 * The #GObject type for #PangoFontFamily.
370 */
371/**
372 * PANGO_FONT_FAMILY:
373 * @object: a #GObject.
374 *
375 * Casts a #GObject to a #PangoFontFamily.
376 */
377/**
378 * PANGO_IS_FONT_FAMILY:
379 * @object: a #GObject.
380 *
381 * Returns: %TRUE if @object is a #PangoFontFamily.
382 */
383#define PANGO_TYPE_FONT_FAMILY (pango_font_family_get_type ())
384#define PANGO_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily))
385#define PANGO_IS_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY))
386
387typedef struct _PangoFontFamily PangoFontFamily;
388typedef struct _PangoFontFace PangoFontFace;
389
390PANGO_AVAILABLE_IN_ALL
391GType pango_font_family_get_type (void) G_GNUC_CONST;
392
393PANGO_AVAILABLE_IN_ALL
394void pango_font_family_list_faces (PangoFontFamily *family,
395 PangoFontFace ***faces,
396 int *n_faces);
397PANGO_AVAILABLE_IN_ALL
398const char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE;
399PANGO_AVAILABLE_IN_1_4
400gboolean pango_font_family_is_monospace (PangoFontFamily *family) G_GNUC_PURE;
401
402#ifdef PANGO_ENABLE_BACKEND
403
404#define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
405#define PANGO_IS_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
406#define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
407
408typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
409
410
411/**
412 * PangoFontFamily:
413 *
414 * The #PangoFontFamily structure is used to represent a family of related
415 * font faces. The faces in a family share a common design, but differ in
416 * slant, weight, width and other aspects.
417 */
418struct _PangoFontFamily
419{
420 GObject parent_instance;
421};
422
423struct _PangoFontFamilyClass
424{
425 GObjectClass parent_class;
426
427 /*< public >*/
428
429 void (*list_faces) (PangoFontFamily *family,
430 PangoFontFace ***faces,
431 int *n_faces);
432 const char * (*get_name) (PangoFontFamily *family);
433 gboolean (*is_monospace) (PangoFontFamily *family);
434
435 /*< private >*/
436
437 /* Padding for future expansion */
438 void (*_pango_reserved2) (void);
439 void (*_pango_reserved3) (void);
440 void (*_pango_reserved4) (void);
441};
442
443#endif /* PANGO_ENABLE_BACKEND */
444
445/*
446 * PangoFontFace
447 */
448
449/**
450 * PANGO_TYPE_FONT_FACE:
451 *
452 * The #GObject type for #PangoFontFace.
453 */
454/**
455 * PANGO_FONT_FACE:
456 * @object: a #GObject.
457 *
458 * Casts a #GObject to a #PangoFontFace.
459 */
460/**
461 * PANGO_IS_FONT_FACE:
462 * @object: a #GObject.
463 *
464 * Returns: %TRUE if @object is a #PangoFontFace.
465 */
466#define PANGO_TYPE_FONT_FACE (pango_font_face_get_type ())
467#define PANGO_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace))
468#define PANGO_IS_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE))
469
470PANGO_AVAILABLE_IN_ALL
471GType pango_font_face_get_type (void) G_GNUC_CONST;
472
473PANGO_AVAILABLE_IN_ALL
474PangoFontDescription *pango_font_face_describe (PangoFontFace *face);
475PANGO_AVAILABLE_IN_ALL
476const char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE;
477PANGO_AVAILABLE_IN_1_4
478void pango_font_face_list_sizes (PangoFontFace *face,
479 int **sizes,
480 int *n_sizes);
481PANGO_AVAILABLE_IN_1_18
482gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE;
483
484#ifdef PANGO_ENABLE_BACKEND
485
486#define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
487#define PANGO_IS_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
488#define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
489
490typedef struct _PangoFontFaceClass PangoFontFaceClass;
491
492/**
493 * PangoFontFace:
494 *
495 * The #PangoFontFace structure is used to represent a group of fonts with
496 * the same family, slant, weight, width, but varying sizes.
497 */
498struct _PangoFontFace
499{
500 GObject parent_instance;
501};
502
503struct _PangoFontFaceClass
504{
505 GObjectClass parent_class;
506
507 /*< public >*/
508
509 const char * (*get_face_name) (PangoFontFace *face);
510 PangoFontDescription * (*describe) (PangoFontFace *face);
511 void (*list_sizes) (PangoFontFace *face,
512 int **sizes,
513 int *n_sizes);
514 gboolean (*is_synthesized) (PangoFontFace *face);
515
516 /*< private >*/
517
518 /* Padding for future expansion */
519 void (*_pango_reserved3) (void);
520 void (*_pango_reserved4) (void);
521};
522
523#endif /* PANGO_ENABLE_BACKEND */
524
525/*
526 * PangoFont
527 */
528
529/**
530 * PANGO_TYPE_FONT:
531 *
532 * The #GObject type for #PangoFont.
533 */
534/**
535 * PANGO_FONT:
536 * @object: a #GObject.
537 *
538 * Casts a #GObject to a #PangoFont.
539 */
540/**
541 * PANGO_IS_FONT:
542 * @object: a #GObject.
543 *
544 * Returns: %TRUE if @object is a #PangoFont.
545 */
546#define PANGO_TYPE_FONT (pango_font_get_type ())
547#define PANGO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont))
548#define PANGO_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT))
549
550PANGO_AVAILABLE_IN_ALL
551GType pango_font_get_type (void) G_GNUC_CONST;
552
553PANGO_AVAILABLE_IN_ALL
554PangoFontDescription *pango_font_describe (PangoFont *font);
555PANGO_AVAILABLE_IN_1_14
556PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont *font);
557PANGO_AVAILABLE_IN_ALL
558PangoCoverage * pango_font_get_coverage (PangoFont *font,
559 PangoLanguage *language);
560PANGO_AVAILABLE_IN_ALL
561PangoEngineShape * pango_font_find_shaper (PangoFont *font,
562 PangoLanguage *language,
563 guint32 ch);
564PANGO_AVAILABLE_IN_ALL
565PangoFontMetrics * pango_font_get_metrics (PangoFont *font,
566 PangoLanguage *language);
567PANGO_AVAILABLE_IN_ALL
568void pango_font_get_glyph_extents (PangoFont *font,
569 PangoGlyph glyph,
570 PangoRectangle *ink_rect,
571 PangoRectangle *logical_rect);
572PANGO_AVAILABLE_IN_1_10
573PangoFontMap *pango_font_get_font_map (PangoFont *font);
574
575#ifdef PANGO_ENABLE_BACKEND
576
577#define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
578#define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
579#define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
580
581typedef struct _PangoFontClass PangoFontClass;
582
583/**
584 * PangoFont:
585 *
586 * The #PangoFont structure is used to represent
587 * a font in a rendering-system-independent matter.
588 * To create an implementation of a #PangoFont,
589 * the rendering-system specific code should allocate
590 * a larger structure that contains a nested
591 * #PangoFont, fill in the <structfield>klass</structfield> member of
592 * the nested #PangoFont with a pointer to
593 * a appropriate #PangoFontClass, then call
594 * pango_font_init() on the structure.
595 *
596 * The #PangoFont structure contains one member
597 * which the implementation fills in.
598 */
599struct _PangoFont
600{
601 GObject parent_instance;
602};
603
604struct _PangoFontClass
605{
606 GObjectClass parent_class;
607
608 /*< public >*/
609
610 PangoFontDescription *(*describe) (PangoFont *font);
611 PangoCoverage * (*get_coverage) (PangoFont *font,
612 PangoLanguage *language);
613 PangoEngineShape * (*find_shaper) (PangoFont *font,
614 PangoLanguage *language,
615 guint32 ch);
616 void (*get_glyph_extents) (PangoFont *font,
617 PangoGlyph glyph,
618 PangoRectangle *ink_rect,
619 PangoRectangle *logical_rect);
620 PangoFontMetrics * (*get_metrics) (PangoFont *font,
621 PangoLanguage *language);
622 PangoFontMap * (*get_font_map) (PangoFont *font);
623 PangoFontDescription *(*describe_absolute) (PangoFont *font);
624 /*< private >*/
625
626 /* Padding for future expansion */
627 void (*_pango_reserved1) (void);
628 void (*_pango_reserved2) (void);
629};
630
631/* used for very rare and miserable situtations that we cannot even
632 * draw a hexbox
633 */
634#define PANGO_UNKNOWN_GLYPH_WIDTH 10
635#define PANGO_UNKNOWN_GLYPH_HEIGHT 14
636
637#endif /* PANGO_ENABLE_BACKEND */
638
639/**
640 * PANGO_GLYPH_EMPTY:
641 *
642 * The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
643 * special meaning, which is a zero-width empty glyph. This is useful for
644 * example in shaper modules, to use as the glyph for various zero-width
645 * Unicode characters (those passing pango_is_zero_width()).
646 */
647/**
648 * PANGO_GLYPH_INVALID_INPUT:
649 *
650 * The %PANGO_GLYPH_INVALID_INPUT macro represents a #PangoGlyph value that has a
651 * special meaning of invalid input. #PangoLayout produces one such glyph
652 * per invalid input UTF-8 byte and such a glyph is rendered as a crossed
653 * box.
654 *
655 * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
656 * on.
657 *
658 * Since: 1.20
659 */
660/**
661 * PANGO_GLYPH_UNKNOWN_FLAG:
662 *
663 * The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
664 * a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
665 * value, representing an unknown-character glyph for the respective #gunichar.
666 */
667/**
668 * PANGO_GET_UNKNOWN_GLYPH:
669 * @wc: a Unicode character
670 *
671 * The way this unknown glyphs are rendered is backend specific. For example,
672 * a box with the hexadecimal Unicode code-point of the character written in it
673 * is what is done in the most common backends.
674 *
675 * Returns: a #PangoGlyph value that means no glyph was found for @wc.
676 */
677#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF)
678#define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF)
679#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
680#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
681
682
683G_END_DECLS
684
685#endif /* __PANGO_FONT_H__ */
686