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