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  * Conversion parameters:
26  * inFile  = 
27  * outPack = pango
28  * outFile = PgFontset
29  * strct   = PangoFontset
30  * realStrct=
31  * ctorStrct=
32  * clss    = PgFontset
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = GObject
38  * implements:
39  * prefixes:
40  * 	- pango_fontset_
41  * omit structs:
42  * omit prefixes:
43  * 	- pango_fontset_simple_
44  * omit code:
45  * omit signals:
46  * imports:
47  * 	- pango.PgFont
48  * 	- pango.PgFontMetrics
49  * structWrap:
50  * 	- PangoFont* -> PgFont
51  * 	- PangoFontMetrics* -> PgFontMetrics
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module pango.PgFontset;
58 
59 public  import gtkc.pangotypes;
60 
61 private import gtkc.pango;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import pango.PgFont;
67 private import pango.PgFontMetrics;
68 
69 
70 
71 private import gobject.ObjectG;
72 
73 /**
74  * Pango supports a flexible architecture where a
75  * particular rendering architecture can supply an
76  * implementation of fonts. The PangoFont structure
77  * represents an abstract rendering-system-independent font.
78  * Pango provides routines to list available fonts, and
79  * to load a font of a given description.
80  */
81 public class PgFontset : ObjectG
82 {
83 	
84 	/** the main Gtk struct */
85 	protected PangoFontset* pangoFontset;
86 	
87 	
88 	public PangoFontset* getPgFontsetStruct()
89 	{
90 		return pangoFontset;
91 	}
92 	
93 	
94 	/** the main Gtk struct as a void* */
95 	protected override void* getStruct()
96 	{
97 		return cast(void*)pangoFontset;
98 	}
99 	
100 	/**
101 	 * Sets our main struct and passes it to the parent class
102 	 */
103 	public this (PangoFontset* pangoFontset)
104 	{
105 		super(cast(GObject*)pangoFontset);
106 		this.pangoFontset = pangoFontset;
107 	}
108 	
109 	protected override void setStruct(GObject* obj)
110 	{
111 		super.setStruct(obj);
112 		pangoFontset = cast(PangoFontset*)obj;
113 	}
114 	
115 	/**
116 	 */
117 	
118 	/**
119 	 * Returns the font in the fontset that contains the best glyph for the
120 	 * Unicode character wc.
121 	 * Params:
122 	 * wc = a Unicode character
123 	 * Returns: a PangoFont. The caller must call g_object_unref when finished with the font. [transfer full]
124 	 */
125 	public PgFont getFont(uint wc)
126 	{
127 		// PangoFont * pango_fontset_get_font (PangoFontset *fontset,  guint wc);
128 		auto p = pango_fontset_get_font(pangoFontset, wc);
129 		
130 		if(p is null)
131 		{
132 			return null;
133 		}
134 		
135 		return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p);
136 	}
137 	
138 	/**
139 	 * Get overall metric information for the fonts in the fontset.
140 	 * Returns: a PangoFontMetrics object. The caller must call pango_font_metrics_unref() when finished using the object.
141 	 */
142 	public PgFontMetrics getMetrics()
143 	{
144 		// PangoFontMetrics * pango_fontset_get_metrics (PangoFontset *fontset);
145 		auto p = pango_fontset_get_metrics(pangoFontset);
146 		
147 		if(p is null)
148 		{
149 			return null;
150 		}
151 		
152 		return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p);
153 	}
154 	
155 	/**
156 	 * Iterates through all the fonts in a fontset, calling func for
157 	 * each one. If func returns TRUE, that stops the iteration.
158 	 * Since 1.4
159 	 * Params:
160 	 * func = Callback function. [closure data][scope call]
161 	 * data = data to pass to the callback function. [closure]
162 	 */
163 	public void foreac(PangoFontsetForeachFunc func, void* data)
164 	{
165 		// void pango_fontset_foreach (PangoFontset *fontset,  PangoFontsetForeachFunc func,  gpointer data);
166 		pango_fontset_foreach(pangoFontset, func, data);
167 	}
168 }