1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module pango.PgFontset; 26 27 private import gobject.ObjectG; 28 public import gtkc.pangotypes; 29 private import pango.PgFont; 30 private import pango.PgFontMetrics; 31 private import pango.c.functions; 32 public import pango.c.types; 33 34 35 /** 36 * A #PangoFontset represents a set of #PangoFont to use 37 * when rendering text. It is the result of resolving a 38 * #PangoFontDescription against a particular #PangoContext. 39 * It has operations for finding the component font for 40 * a particular Unicode character, and for finding a composite 41 * set of metrics for the entire fontset. 42 */ 43 public class PgFontset : ObjectG 44 { 45 /** the main Gtk struct */ 46 protected PangoFontset* pangoFontset; 47 48 /** Get the main Gtk struct */ 49 public PangoFontset* getPgFontsetStruct(bool transferOwnership = false) 50 { 51 if (transferOwnership) 52 ownedRef = false; 53 return pangoFontset; 54 } 55 56 /** the main Gtk struct as a void* */ 57 protected override void* getStruct() 58 { 59 return cast(void*)pangoFontset; 60 } 61 62 /** 63 * Sets our main struct and passes it to the parent class. 64 */ 65 public this (PangoFontset* pangoFontset, bool ownedRef = false) 66 { 67 this.pangoFontset = pangoFontset; 68 super(cast(GObject*)pangoFontset, ownedRef); 69 } 70 71 72 /** */ 73 public static GType getType() 74 { 75 return pango_fontset_get_type(); 76 } 77 78 /** 79 * Iterates through all the fonts in a fontset, calling @func for 80 * each one. If @func returns %TRUE, that stops the iteration. 81 * 82 * Params: 83 * func = Callback function 84 * data = data to pass to the callback function 85 * 86 * Since: 1.4 87 */ 88 public void foreac(PangoFontsetForeachFunc func, void* data) 89 { 90 pango_fontset_foreach(pangoFontset, func, data); 91 } 92 93 /** 94 * Returns the font in the fontset that contains the best glyph for the 95 * Unicode character @wc. 96 * 97 * Params: 98 * wc = a Unicode character 99 * 100 * Returns: a #PangoFont. The caller must call 101 * g_object_unref when finished with the font. 102 */ 103 public PgFont getFont(uint wc) 104 { 105 auto p = pango_fontset_get_font(pangoFontset, wc); 106 107 if(p is null) 108 { 109 return null; 110 } 111 112 return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p, true); 113 } 114 115 /** 116 * Get overall metric information for the fonts in the fontset. 117 * 118 * Returns: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref() 119 * when finished using the object. 120 */ 121 public PgFontMetrics getMetrics() 122 { 123 auto p = pango_fontset_get_metrics(pangoFontset); 124 125 if(p is null) 126 { 127 return null; 128 } 129 130 return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p, true); 131 } 132 }