alternative to assert
[gtkD.git] / gtkD / src / pango / PgFontDescription.d
bloba30eaf50b6cbb1c1eaab11ce7ecf94f1433b5693
1 /*
2 * This file is part of gtkD.
4 * gtkD is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; either version 2.1 of the License, or
7 * (at your option) any later version.
9 * gtkD is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with gtkD; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 // generated automatically - do not change
20 // find conversion definition on APILookup.txt
21 // implement new conversion functionalities on the wrap.utils pakage
24 * Conversion parameters:
25 * inFile = pango-Fonts.html
26 * outPack = pango
27 * outFile = PgFontDescription
28 * strct = PangoFontDescription
29 * realStrct=
30 * ctorStrct=
31 * clss = PgFontDescription
32 * interf =
33 * class Code: Yes
34 * interface Code: No
35 * template for:
36 * extend =
37 * implements:
38 * prefixes:
39 * - pango_font_description_
40 * omit structs:
41 * omit prefixes:
42 * - pango_font_metrics_
43 * - pango_font_family_
44 * - pango_font_face_
45 * - pango_font_map_
46 * - pango_fontset_simple_
47 * omit code:
48 * imports:
49 * - pango.PgContext
50 * - pango.PgItem
51 * - pango.PgLayout
52 * - pango.PgFontMetrics
53 * - pango.PgFontFamily
54 * - pango.PgFontFace
55 * - pango.PgFontMap
56 * - pango.PgFontsetSimple
57 * - pango.PgAttribute
58 * - pango.PgAttributeList
59 * - pango.PgLanguage
60 * - pango.PgTabArray
61 * - pango.PgLayout
62 * - pango.PgLayoutIter
63 * - pango.PgScriptIter
64 * - glib.Str
65 * structWrap:
66 * - PangoAttribute* -> PgAttribute
67 * - PangoAttributeList* -> PgAttributeList
68 * - PangoContext* -> PgContext
69 * - PangoFontFace* -> PgFontFace
70 * - PangoFontFamily* -> PgFontFamily
71 * - PangoFontMap* -> PgFontMap
72 * - PangoFontMetrics* -> PgFontMetrics
73 * - PangoFontsetSimple* -> PgFontsetSimple
74 * - PangoItem* -> PgItem
75 * - PangoLanguage* -> PgLanguage
76 * - PangoLayout* -> PgLayout
77 * - PangoLayoutIter* -> PgLayoutIter
78 * - PangoScriptIter* -> PgScriptIter
79 * - PangoTabArray* -> PgTabArray
80 * module aliases:
81 * local aliases:
84 module pango.PgFontDescription;
86 version(noAssert)
88 version(Tango)
90 import tango.io.Stdout; // use the tango loging?
94 private import gtkc.pangotypes;
96 private import gtkc.pango;
99 private import pango.PgContext;
100 private import pango.PgItem;
101 private import pango.PgLayout;
102 private import pango.PgFontMetrics;
103 private import pango.PgFontFamily;
104 private import pango.PgFontFace;
105 private import pango.PgFontMap;
106 private import pango.PgFontsetSimple;
107 private import pango.PgAttribute;
108 private import pango.PgAttributeList;
109 private import pango.PgLanguage;
110 private import pango.PgTabArray;
111 private import pango.PgLayout;
112 private import pango.PgLayoutIter;
113 private import pango.PgScriptIter;
114 private import glib.Str;
120 * Description
121 * Pango supports a flexible architecture where a
122 * particular rendering architecture can supply an
123 * implementation of fonts. The PangoFont structure
124 * represents an abstract rendering-system-independent font.
125 * Pango provides routines to list available fonts, and
126 * to load a font of a given description.
128 public class PgFontDescription
131 /** the main Gtk struct */
132 protected PangoFontDescription* pangoFontDescription;
135 public PangoFontDescription* getPgFontDescriptionStruct()
137 return pangoFontDescription;
141 /** the main Gtk struct as a void* */
142 protected void* getStruct()
144 return cast(void*)pangoFontDescription;
148 * Sets our main struct and passes it to the parent class
150 public this (PangoFontDescription* pangoFontDescription)
152 version(noAssert)
154 if ( pangoFontDescription is null )
156 int zero = 0;
157 version(Tango)
159 Stdout("struct pangoFontDescription is null on constructor").newline;
161 else
163 printf("struct pangoFontDescription is null on constructor");
165 zero = zero / zero;
168 else
170 assert(pangoFontDescription !is null, "struct pangoFontDescription is null on constructor");
172 this.pangoFontDescription = pangoFontDescription;
176 * Creates a nwe font description and set the family nd the size
177 * param: family Family
178 * param: size Size
180 public this(char[] family, int size)
182 this();
183 setFamily("Sans");
184 setSize(size * PANGO_SCALE);
203 * Creates a new font description structure with all fields unset.
204 * Returns:
205 * the newly allocated PangoFontDescription, which
206 * should be freed using pango_font_description_free().
208 public this ()
210 // PangoFontDescription* pango_font_description_new (void);
211 this(cast(PangoFontDescription*)pango_font_description_new() );
215 * Make a copy of a PangoFontDescription.
216 * desc:
217 * a PangoFontDescription
218 * Returns:
219 * the newly allocated PangoFontDescription, which should
220 * be freed with pango_font_description_free().
222 public PangoFontDescription* copy()
224 // PangoFontDescription* pango_font_description_copy (const PangoFontDescription *desc);
225 return pango_font_description_copy(pangoFontDescription);
229 * Like pango_font_description_copy(), but only a shallow copy is made
230 * of the family name and other allocated fields. The result can only
231 * be used until desc is modified or freed. This is meant to be used
232 * when the copy is only needed temporarily.
233 * desc:
234 * a PangoFontDescription
235 * Returns:
236 * the newly allocated PangoFontDescription, which should
237 * be freed with pango_font_description_free().
239 public PangoFontDescription* copyStatic()
241 // PangoFontDescription* pango_font_description_copy_static (const PangoFontDescription *desc);
242 return pango_font_description_copy_static(pangoFontDescription);
246 * Computes a hash of a PangoFontDescription structure suitable
247 * to be used, for example, as an argument to g_hash_table_new().
248 * The hash value is independent of desc->mask.
249 * desc:
250 * a PangoFontDescription
251 * Returns:
252 * the hash value.
254 public uint hash()
256 // guint pango_font_description_hash (const PangoFontDescription *desc);
257 return pango_font_description_hash(pangoFontDescription);
261 * Compares two font descriptions for equality. Two font descriptions
262 * are considered equal if the fonts they describe are provably identical.
263 * This means that their masks do not have to match, as long as other fields
264 * are all the same. (Two font descriptions may result in identical fonts
265 * being loaded, but still compare FALSE.)
266 * desc1:
267 * a PangoFontDescription
268 * desc2:
269 * another PangoFontDescription
270 * Returns:
271 * TRUE if the two font descriptions are identical,
272 * FALSE otherwise.
274 public int equal(PangoFontDescription* desc2)
276 // gboolean pango_font_description_equal (const PangoFontDescription *desc1, const PangoFontDescription *desc2);
277 return pango_font_description_equal(pangoFontDescription, desc2);
281 * Frees a font description.
282 * desc:
283 * a PangoFontDescription
285 public void free()
287 // void pango_font_description_free (PangoFontDescription *desc);
288 pango_font_description_free(pangoFontDescription);
292 * Frees a list of font descriptions from pango_font_map_list_fonts()
293 * descs:
294 * a pointer to an array of PangoFontDescription
295 * n_descs:
296 * number of font descriptions in descs
298 public static void pangoFontDescriptionsFree(PangoFontDescription** descs, int nDescs)
300 // void pango_font_descriptions_free (PangoFontDescription **descs, int n_descs);
301 pango_font_descriptions_free(descs, nDescs);
305 * Sets the family name field of a font description. The family
306 * name represents a family of related font styles, and will
307 * resolve to a particular PangoFontFamily. In some uses of
308 * PangoFontDescription, it is also possible to use a comma
309 * separated list of family names for this field.
310 * desc:
311 * a PangoFontDescription.
312 * family:
313 * a string representing the family name.
315 public void setFamily(char[] family)
317 // void pango_font_description_set_family (PangoFontDescription *desc, const char *family);
318 pango_font_description_set_family(pangoFontDescription, Str.toStringz(family));
322 * Like pango_font_description_set_family(), except that no
323 * copy of family is made. The caller must make sure that the
324 * string passed in stays around until desc has been freed
325 * or the name is set again. This function can be used if
326 * family is a static string such as a C string literal, or
327 * if desc is only needed temporarily.
328 * desc:
329 * a PangoFontDescription
330 * family:
331 * a string representing the family name.
333 public void setFamilyStatic(char[] family)
335 // void pango_font_description_set_family_static (PangoFontDescription *desc, const char *family);
336 pango_font_description_set_family_static(pangoFontDescription, Str.toStringz(family));
340 * Gets the family name field of a font description. See
341 * pango_font_description_set_family().
342 * desc:
343 * a PangoFontDescription.
344 * Returns:
345 * the family name field for the font description, or
346 * NULL if not previously set. This has the same life-time
347 * as the font description itself and should not be freed.
349 public char[] getFamily()
351 // const char* pango_font_description_get_family (const PangoFontDescription *desc);
352 return Str.toString(pango_font_description_get_family(pangoFontDescription) );
356 * Sets the style field of a PangoFontDescription. The
357 * PangoStyle enumeration describes whether the font is slanted and
358 * the manner in which it is slanted; it can be either
359 * PANGO_STYLE_NORMAL, PANGO_STYLE_ITALIC, or PANGO_STYLE_OBLIQUE.
360 * Most fonts will either have a italic style or an oblique
361 * style, but not both, and font matching in Pango will
362 * match italic specifications with oblique fonts and vice-versa
363 * if an exact match is not found.
364 * desc:
365 * a PangoFontDescription
366 * style:
367 * the style for the font description
369 public void setStyle(PangoStyle style)
371 // void pango_font_description_set_style (PangoFontDescription *desc, PangoStyle style);
372 pango_font_description_set_style(pangoFontDescription, style);
376 * Gets the style field of a PangoFontDescription. See
377 * pango_font_description_set_style().
378 * desc:
379 * a PangoFontDescription
380 * Returns:
381 * the style field for the font description.
382 * Use pango_font_description_get_set_fields() to find out if
383 * the field was explicitly set or not.
385 public PangoStyle getStyle()
387 // PangoStyle pango_font_description_get_style (const PangoFontDescription *desc);
388 return pango_font_description_get_style(pangoFontDescription);
392 * Sets the variant field of a font description. The PangoVariant
393 * can either be PANGO_VARIANT_NORMAL or PANGO_VARIANT_SMALL_CAPS.
394 * desc:
395 * a PangoFontDescription
396 * variant:
397 * the variant type for the font description.
399 public void setVariant(PangoVariant variant)
401 // void pango_font_description_set_variant (PangoFontDescription *desc, PangoVariant variant);
402 pango_font_description_set_variant(pangoFontDescription, variant);
406 * Gets the variant field of a PangoFontDescription. See
407 * pango_font_description_set_variant().
408 * desc:
409 * a PangoFontDescription.
410 * Returns:
411 * the variant field for the font description. Use
412 * pango_font_description_get_set_fields() to find out if
413 * the field was explicitly set or not.
415 public PangoVariant getVariant()
417 // PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc);
418 return pango_font_description_get_variant(pangoFontDescription);
422 * Sets the weight field of a font description. The weight field
423 * specifies how bold or light the font should be. In addition
424 * to the values of the PangoWeight enumeration, other intermediate
425 * numeric values are possible.
426 * desc:
427 * a PangoFontDescription
428 * weight:
429 * the weight for the font description.
431 public void setWeight(PangoWeight weight)
433 // void pango_font_description_set_weight (PangoFontDescription *desc, PangoWeight weight);
434 pango_font_description_set_weight(pangoFontDescription, weight);
438 * Gets the weight field of a font description. See
439 * pango_font_description_set_weight().
440 * desc:
441 * a PangoFontDescription
442 * Returns:
443 * the weight field for the font description. Use
444 * pango_font_description_get_set_fields() to find out if
445 * the field was explicitly set or not.
447 public PangoWeight getWeight()
449 // PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc);
450 return pango_font_description_get_weight(pangoFontDescription);
454 * Sets the stretch field of a font description. The stretch field
455 * specifies how narrow or wide the font should be.
456 * desc:
457 * a PangoFontDescription
458 * stretch:
459 * the stretch for the font description
461 public void setStretch(PangoStretch stretch)
463 // void pango_font_description_set_stretch (PangoFontDescription *desc, PangoStretch stretch);
464 pango_font_description_set_stretch(pangoFontDescription, stretch);
468 * Gets the stretch field of a font description.
469 * See pango_font_description_set_stretch().
470 * desc:
471 * a PangoFontDescription.
472 * Returns:
473 * the stretch field for the font description. Use
474 * pango_font_description_get_set_fields() to find out if
475 * the field was explicitly set or not.
477 public PangoStretch getStretch()
479 // PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc);
480 return pango_font_description_get_stretch(pangoFontDescription);
484 * Sets the size field of a font description in fractional points. This is mutually
485 * exclusive with pango_font_description_set_absolute_size().
486 * desc:
487 * a PangoFontDescription
488 * size:
489 * the size of the font in points, scaled by PANGO_SCALE. (That is,
490 * a size value of 10 * PANGO_SCALE is a 10 point font. The conversion
491 * factor between points and device units depends on system configuration
492 * and the output device. For screen display, a logical DPI of 96 is
493 * common, in which case a 10 point font corresponds to a 10 * (96 / 72) = 13.3
494 * pixel font. Use pango_font_description_set_absolute_size() if you need
495 * a particular size in device units.
497 public void setSize(int size)
499 // void pango_font_description_set_size (PangoFontDescription *desc, gint size);
500 pango_font_description_set_size(pangoFontDescription, size);
504 * Gets the size field of a font description.
505 * See pango_font_description_set_size().
506 * desc:
507 * a PangoFontDescription
508 * Returns:
509 * the size field for the font description in points or device units.
510 * You must call pango_font_description_get_size_is_absolute()
511 * to find out which is the case. Returns 0 if the size field has not
512 * previously been set or it has been set to 0 explicitly.
513 * Use pango_font_description_get_set_fields() to
514 * find out if the field was explicitly set or not.
516 public int getSize()
518 // gint pango_font_description_get_size (const PangoFontDescription *desc);
519 return pango_font_description_get_size(pangoFontDescription);
523 * Sets the size field of a font description, in device units. This is mutually
524 * exclusive with pango_font_description_set_size().
525 * desc:
526 * a PangoFontDescription
527 * size:
528 * the new size, in Pango units. There are PANGO_SCALE Pango units in one
529 * device unit. For an output backend where a device unit is a pixel, a size
530 * value of 10 * PANGO_SCALE gives a 10 pixel font.
531 * Since 1.8
533 public void setAbsoluteSize(double size)
535 // void pango_font_description_set_absolute_size (PangoFontDescription *desc, double size);
536 pango_font_description_set_absolute_size(pangoFontDescription, size);
540 * Determines whether the size of the font is in points or device units.
541 * See pango_font_description_set_size() and pango_font_description_set_absolute_size().
542 * desc:
543 * a PangoFontDescription
544 * Returns:
545 * whether the size for the font description is in
546 * points or device units. Use pango_font_description_get_set_fields() to
547 * find out if the size field of the font description was explicitly set or not.
548 * Since 1.8
550 public int getSizeIsAbsolute()
552 // gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc);
553 return pango_font_description_get_size_is_absolute(pangoFontDescription);
557 * Sets the gravity field of a font description. The gravity field
558 * specifies how the glyphs should be rotated. If gravity is
559 * PANGO_GRAVITY_AUTO, this actually unsets the gravity mask on
560 * the font description.
561 * This function is seldom useful to the user. Gravity should normally
562 * be set on a PangoContext.
563 * desc:
564 * a PangoFontDescription
565 * gravity:
566 * the gravity for the font description.
567 * Since 1.16
569 public void setGravity(PangoGravity gravity)
571 // void pango_font_description_set_gravity (PangoFontDescription *desc, PangoGravity gravity);
572 pango_font_description_set_gravity(pangoFontDescription, gravity);
576 * Gets the gravity field of a font description. See
577 * pango_font_description_set_gravity().
578 * desc:
579 * a PangoFontDescription
580 * Returns:
581 * the gravity field for the font description. Use
582 * pango_font_description_get_set_fields() to find out if
583 * the field was explicitly set or not.
584 * Since 1.16
586 public PangoGravity getGravity()
588 // PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc);
589 return pango_font_description_get_gravity(pangoFontDescription);
593 * Determines which fields in a font description have been set.
594 * desc:
595 * a PangoFontDescription
596 * Returns:
597 * a bitmask with bits set corresponding to the
598 * fields in desc that have been set.
600 public PangoFontMask getSetFields()
602 // PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc);
603 return pango_font_description_get_set_fields(pangoFontDescription);
607 * Unsets some of the fields in a PangoFontDescription. The unset
608 * fields will get back to their default values.
609 * desc:
610 * a PangoFontDescription
611 * to_unset:
612 * bitmask of fields in the desc to unset.
614 public void unsetFields(PangoFontMask toUnset)
616 // void pango_font_description_unset_fields (PangoFontDescription *desc, PangoFontMask to_unset);
617 pango_font_description_unset_fields(pangoFontDescription, toUnset);
621 * Merges the fields that are set in desc_to_merge into the fields in
622 * desc. If replace_existing is FALSE, only fields in desc that
623 * are not already set are affected. If TRUE, then fields that are
624 * already set will be replaced as well.
625 * desc:
626 * a PangoFontDescription
627 * desc_to_merge:
628 * the PangoFontDescription to merge from
629 * replace_existing:
630 * if TRUE, replace fields in desc with the
631 * corresponding values from desc_to_merge, even if they
632 * are already exist.
634 public void merge(PangoFontDescription* descToMerge, int replaceExisting)
636 // void pango_font_description_merge (PangoFontDescription *desc, const PangoFontDescription *desc_to_merge, gboolean replace_existing);
637 pango_font_description_merge(pangoFontDescription, descToMerge, replaceExisting);
641 * Like pango_font_description_merge(), but only a shallow copy is made
642 * of the family name and other allocated fields. desc can only be
643 * used until desc_to_merge is modified or freed. This is meant
644 * to be used when the merged font description is only needed temporarily.
645 * desc:
646 * a PangoFontDescription
647 * desc_to_merge:
648 * the PangoFontDescription to merge from
649 * replace_existing:
650 * if TRUE, replace fields in desc with the
651 * corresponding values from desc_to_merge, even if they
652 * are already exist.
654 public void mergeStatic(PangoFontDescription* descToMerge, int replaceExisting)
656 // void pango_font_description_merge_static (PangoFontDescription *desc, const PangoFontDescription *desc_to_merge, gboolean replace_existing);
657 pango_font_description_merge_static(pangoFontDescription, descToMerge, replaceExisting);
661 * Determines if the style attributes of new_match are a closer match
662 * for desc than old_match, or if old_match is NULL, determines if
663 * new_match is a match at all. Approximate matching is done for
664 * weight and style; other attributes must match exactly.
665 * desc:
666 * a PangoFontDescription
667 * old_match:
668 * a PangoFontDescription, or NULL
669 * new_match:
670 * a PangoFontDescription
671 * Returns:
672 * TRUE if new_match is a better match
674 public int betterMatch(PangoFontDescription* oldMatch, PangoFontDescription* newMatch)
676 // gboolean pango_font_description_better_match (const PangoFontDescription *desc, const PangoFontDescription *old_match, const PangoFontDescription *new_match);
677 return pango_font_description_better_match(pangoFontDescription, oldMatch, newMatch);
681 * Creates a new font description from a string representation in the
682 * form "[FAMILY-LIST] [STYLE-OPTIONS] [SIZE]", where FAMILY-LIST is a
683 * comma separated list of families optionally terminated by a comma,
684 * STYLE_OPTIONS is a whitespace separated list of words where each WORD
685 * describes one of style, variant, weight, stretch, or gravity, and SIZE
686 * is a decimal number (size in points) or optionally followed by the
687 * unit modifier "px" for absolute size. Any one of the options may
688 * be absent. If FAMILY-LIST is absent, then the family_name field of
689 * the resulting font description will be initialized to NULL. If
690 * STYLE-OPTIONS is missing, then all style options will be set to the
691 * default values. If SIZE is missing, the size in the resulting font
692 * description will be set to 0.
693 * str:
694 * string representation of a font description.
695 * Returns:
696 * a new PangoFontDescription.
698 public static PangoFontDescription* fromString(char[] str)
700 // PangoFontDescription* pango_font_description_from_string (const char *str);
701 return pango_font_description_from_string(Str.toStringz(str));
705 * Creates a string representation of a font description. See
706 * pango_font_description_from_string() for a description of the
707 * format of the string representation. The family list in the
708 * string description will only have a terminating comma if the
709 * last word of the list is a valid style option.
710 * desc:
711 * a PangoFontDescription
712 * Returns:
713 * a new string that must be freed with g_free().
715 public char[] toString()
717 // char* pango_font_description_to_string (const PangoFontDescription *desc);
718 return Str.toString(pango_font_description_to_string(pangoFontDescription) );
722 * Creates a filename representation of a font description. The
723 * filename is identical to the result from calling
724 * pango_font_description_to_string(), but with underscores instead of
725 * characters that are untypical in filenames, and in lower case only.
726 * desc:
727 * a PangoFontDescription
728 * Returns:
729 * a new string that must be freed with g_free().
731 public char[] toFilename()
733 // char* pango_font_description_to_filename (const PangoFontDescription *desc);
734 return Str.toString(pango_font_description_to_filename(pangoFontDescription) );
754 * Finds the best matching shaper for a font for a particular
755 * language tag and character point.
756 * font:
757 * a PangoFont
758 * language:
759 * the language tag
760 * ch:
761 * a Unicode character.
762 * Returns:
763 * the best matching shaper.
765 public static PangoEngineShape* pangoFontFindShaper(PangoFont* font, PgLanguage language, uint ch)
767 // PangoEngineShape* pango_font_find_shaper (PangoFont *font, PangoLanguage *language, guint32 ch);
768 return pango_font_find_shaper(font, (language is null) ? null : language.getPgLanguageStruct(), ch);
772 * Returns a description of the font, with font size set in points.
773 * Use pango_font_describe_with_absolute_size() if you want the font
774 * size in device units.
775 * font:
776 * a PangoFont
777 * Returns:
778 * a newly-allocated PangoFontDescription object.
780 public static PangoFontDescription* pangoFontDescribe(PangoFont* font)
782 // PangoFontDescription* pango_font_describe (PangoFont *font);
783 return pango_font_describe(font);
787 * Returns a description of the font, with absolute font size set
788 * (in device units). Use pango_font_describe() if you want the font
789 * size in points.
790 * font:
791 * a PangoFont
792 * Returns:
793 * a newly-allocated PangoFontDescription object.
794 * Since 1.14
796 public static PangoFontDescription* pangoFontDescribeWithAbsoluteSize(PangoFont* font)
798 // PangoFontDescription* pango_font_describe_with_absolute_size (PangoFont *font);
799 return pango_font_describe_with_absolute_size(font);
803 * Computes the coverage map for a given font and language tag.
804 * font:
805 * a PangoFont
806 * language:
807 * the language tag
808 * Returns:
809 * a newly-allocated PangoCoverage object.
811 public static PangoCoverage* pangoFontGetCoverage(PangoFont* font, PgLanguage language)
813 // PangoCoverage* pango_font_get_coverage (PangoFont *font, PangoLanguage *language);
814 return pango_font_get_coverage(font, (language is null) ? null : language.getPgLanguageStruct());
818 * Gets the logical and ink extents of a glyph within a font. The
819 * coordinate system for each rectangle has its origin at the
820 * base line and horizontal origin of the character with increasing
821 * coordinates extending to the right and down. The macros PANGO_ASCENT(),
822 * PANGO_DESCENT(), PANGO_LBEARING(), and PANGO_RBEARING() can be used to convert
823 * from the extents rectangle to more traditional font metrics. The units
824 * of the rectangles are in 1/PANGO_SCALE of a device unit.
825 * font:
826 * a PangoFont
827 * glyph:
828 * the glyph index
829 * ink_rect:
830 * rectangle used to store the extents of the glyph as drawn
831 * or NULL to indicate that the result is not needed.
832 * logical_rect:
833 * rectangle used to store the logical extents of the glyph
834 * or NULL to indicate that the result is not needed.
836 public static void pangoFontGetGlyphExtents(PangoFont* font, PangoGlyph glyph, PangoRectangle* inkRect, PangoRectangle* logicalRect)
838 // void pango_font_get_glyph_extents (PangoFont *font, PangoGlyph glyph, PangoRectangle *ink_rect, PangoRectangle *logical_rect);
839 pango_font_get_glyph_extents(font, glyph, inkRect, logicalRect);
843 * Gets overall metric information for a font. Since the metrics may be
844 * substantially different for different scripts, a language tag can
845 * be provided to indicate that the metrics should be retrieved that
846 * correspond to the script(s) used by that language.
847 * font:
848 * a PangoFont
849 * language:
850 * language tag used to determine which script to get the metrics
851 * for, or NULL to indicate to get the metrics for the entire
852 * font.
853 * Returns:
854 * a PangoFontMetrics object. The caller must call pango_font_metrics_unref()
855 * when finished using the object.
857 public static PgFontMetrics pangoFontGetMetrics(PangoFont* font, PgLanguage language)
859 // PangoFontMetrics* pango_font_get_metrics (PangoFont *font, PangoLanguage *language);
860 return new PgFontMetrics( pango_font_get_metrics(font, (language is null) ? null : language.getPgLanguageStruct()) );
864 * Gets the font map for which the font was created.
865 * font:
866 * a PangoFont
867 * Returns:
868 * the PangoFontMap for the font
869 * Since 1.10
871 public static PgFontMap pangoFontGetFontMap(PangoFont* font)
873 // PangoFontMap* pango_font_get_font_map (PangoFont *font);
874 return new PgFontMap( pango_font_get_font_map(font) );
907 * Returns the font in the fontset that contains the best glyph for the
908 * Unicode character wc.
909 * fontset:
910 * a PangoFontset
911 * wc:
912 * a Unicode character
913 * Returns:
914 * a PangoFont. The caller must call g_object_unref when finished
915 * with the font.
917 public static PangoFont* pangoFontsetGetFont(PangoFontset* fontset, uint wc)
919 // PangoFont* pango_fontset_get_font (PangoFontset *fontset, guint wc);
920 return pango_fontset_get_font(fontset, wc);
924 * Get overall metric information for the fonts in the fontset.
925 * fontset:
926 * a PangoFontset
927 * Returns:
928 * a PangoFontMetrics object. The caller must call pango_font_metrics_unref()
929 * when finished using the object.
931 public static PgFontMetrics pangoFontsetGetMetrics(PangoFontset* fontset)
933 // PangoFontMetrics* pango_fontset_get_metrics (PangoFontset *fontset);
934 return new PgFontMetrics( pango_fontset_get_metrics(fontset) );
939 * Iterates through all the fonts in a fontset, calling func for
940 * each one. If func returns TRUE, that stops the iteration.
941 * fontset:
942 * a PangoFontset
943 * func:
944 * Callback function
945 * data:
946 * data to pass to the callback function
947 * Since 1.4
949 public static void pangoFontsetForeach(PangoFontset* fontset, PangoFontsetForeachFunc func, void* data)
951 // void pango_fontset_foreach (PangoFontset *fontset, PangoFontsetForeachFunc func, gpointer data);
952 pango_fontset_foreach(fontset, func, data);