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