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 	public static GType getType()
77 	{
78 		return pango_fontset_get_type();
79 	}
80 
81 	/**
82 	 * Iterates through all the fonts in a fontset, calling @func for
83 	 * each one. If @func returns %TRUE, that stops the iteration.
84 	 *
85 	 * Params:
86 	 *     func = Callback function
87 	 *     data = data to pass to the callback function
88 	 *
89 	 * Since: 1.4
90 	 */
91 	public void foreac(PangoFontsetForeachFunc func, void* data)
92 	{
93 		pango_fontset_foreach(pangoFontset, func, data);
94 	}
95 
96 	/**
97 	 * Returns the font in the fontset that contains the best glyph for the
98 	 * Unicode character @wc.
99 	 *
100 	 * Params:
101 	 *     wc = a Unicode character
102 	 *
103 	 * Return: a #PangoFont. The caller must call
104 	 *     g_object_unref when finished with the font.
105 	 */
106 	public PgFont getFont(uint wc)
107 	{
108 		auto p = pango_fontset_get_font(pangoFontset, wc);
109 		
110 		if(p is null)
111 		{
112 			return null;
113 		}
114 		
115 		return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p, true);
116 	}
117 
118 	/**
119 	 * Get overall metric information for the fonts in the fontset.
120 	 *
121 	 * Return: a #PangoFontMetrics object. The caller must call pango_font_metrics_unref()
122 	 *     when finished using the object.
123 	 */
124 	public PgFontMetrics getMetrics()
125 	{
126 		auto p = pango_fontset_get_metrics(pangoFontset);
127 		
128 		if(p is null)
129 		{
130 			return null;
131 		}
132 		
133 		return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p, true);
134 	}
135 }