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