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 private import gtkc.pango;
29 public  import gtkc.pangotypes;
30 private import pango.PgFont;
31 private import pango.PgFontMetrics;
32 
33 
34 /**
35  * A #PangoFontset represents a set of #PangoFont to use
36  * when rendering text. It is the result of resolving a
37  * #PangoFontDescription against a particular #PangoContext.
38  * It has operations for finding the component font for
39  * a particular Unicode character, and for finding a composite
40  * set of metrics for the entire fontset.
41  */
42 public class PgFontset : ObjectG
43 {
44 	/** the main Gtk struct */
45 	protected PangoFontset* pangoFontset;
46 
47 	/** Get the main Gtk struct */
48 	public PangoFontset* getPgFontsetStruct()
49 	{
50 		return pangoFontset;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)pangoFontset;
57 	}
58 
59 	protected override void setStruct(GObject* obj)
60 	{
61 		pangoFontset = cast(PangoFontset*)obj;
62 		super.setStruct(obj);
63 	}
64 
65 	/**
66 	 * Sets our main struct and passes it to the parent class.
67 	 */
68 	public this (PangoFontset* pangoFontset, bool ownedRef = false)
69 	{
70 		this.pangoFontset = pangoFontset;
71 		super(cast(GObject*)pangoFontset, ownedRef);
72 	}
73 
74 	/**
75 	 */
76 
77 	public static GType getType()
78 	{
79 		return pango_fontset_get_type();
80 	}
81 
82 	/**
83 	 * Iterates through all the fonts in a fontset, calling @func for
84 	 * each one. If @func returns %TRUE, that stops the iteration.
85 	 *
86 	 * Params:
87 	 *     func = Callback function
88 	 *     data = data to pass to the callback function
89 	 *
90 	 * Since: 1.4
91 	 */
92 	public void foreac(PangoFontsetForeachFunc func, void* data)
93 	{
94 		pango_fontset_foreach(pangoFontset, func, data);
95 	}
96 
97 	/**
98 	 * Returns the font in the fontset that contains the best glyph for the
99 	 * Unicode character @wc.
100 	 *
101 	 * Params:
102 	 *     wc = a Unicode character
103 	 *
104 	 * Return: a #PangoFont. The caller must call
105 	 *     g_object_unref when finished with the font.
106 	 */
107 	public PgFont getFont(uint wc)
108 	{
109 		auto p = pango_fontset_get_font(pangoFontset, wc);
110 		
111 		if(p is null)
112 		{
113 			return null;
114 		}
115 		
116 		return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p, true);
117 	}
118 
119 	/**
120 	 * Get overall metric information for the fonts in the fontset.
121 	 *
122 	 * Return: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
123 	 *     when finished using the object.
124 	 */
125 	public PgFontMetrics getMetrics()
126 	{
127 		auto p = pango_fontset_get_metrics(pangoFontset);
128 		
129 		if(p is null)
130 		{
131 			return null;
132 		}
133 		
134 		return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p);
135 	}
136 }