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