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

source code of gtk/subprojects/pango/pango/pango-font.h