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