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 private import pango.PgFont;
66 private import pango.PgFontMetrics;
67 
68 
69 private import gobject.ObjectG;
70 
71 /**
72  * Pango supports a flexible architecture where a
73  * particular rendering architecture can supply an
74  * implementation of fonts. The PangoFont structure
75  * represents an abstract rendering-system-independent font.
76  * Pango provides routines to list available fonts, and
77  * to load a font of a given description.
78  */
79 public class PgFontset : ObjectG
80 {
81 	
82 	/** the main Gtk struct */
83 	protected PangoFontset* pangoFontset;
84 	
85 	
86 	/** Get the main Gtk struct */
87 	public PangoFontset* getPgFontsetStruct()
88 	{
89 		return pangoFontset;
90 	}
91 	
92 	
93 	/** the main Gtk struct as a void* */
94 	protected override void* getStruct()
95 	{
96 		return cast(void*)pangoFontset;
97 	}
98 	
99 	/**
100 	 * Sets our main struct and passes it to the parent class
101 	 */
102 	public this (PangoFontset* pangoFontset)
103 	{
104 		super(cast(GObject*)pangoFontset);
105 		this.pangoFontset = pangoFontset;
106 	}
107 	
108 	protected override void setStruct(GObject* obj)
109 	{
110 		super.setStruct(obj);
111 		pangoFontset = cast(PangoFontset*)obj;
112 	}
113 	
114 	/**
115 	 */
116 	
117 	/**
118 	 * Returns the font in the fontset that contains the best glyph for the
119 	 * Unicode character wc.
120 	 * Params:
121 	 * wc = a Unicode character
122 	 * Returns: a PangoFont. The caller must call g_object_unref when finished with the font. [transfer full]
123 	 */
124 	public PgFont getFont(uint wc)
125 	{
126 		// PangoFont * pango_fontset_get_font (PangoFontset *fontset,  guint wc);
127 		auto p = pango_fontset_get_font(pangoFontset, wc);
128 		
129 		if(p is null)
130 		{
131 			return null;
132 		}
133 		
134 		return ObjectG.getDObject!(PgFont)(cast(PangoFont*) p);
135 	}
136 	
137 	/**
138 	 * Get overall metric information for the fonts in the fontset.
139 	 * Returns: a PangoFontMetrics object. The caller must call pango_font_metrics_unref() when finished using the object.
140 	 */
141 	public PgFontMetrics getMetrics()
142 	{
143 		// PangoFontMetrics * pango_fontset_get_metrics (PangoFontset *fontset);
144 		auto p = pango_fontset_get_metrics(pangoFontset);
145 		
146 		if(p is null)
147 		{
148 			return null;
149 		}
150 		
151 		return ObjectG.getDObject!(PgFontMetrics)(cast(PangoFontMetrics*) p);
152 	}
153 	
154 	/**
155 	 * Iterates through all the fonts in a fontset, calling func for
156 	 * each one. If func returns TRUE, that stops the iteration.
157 	 * Since 1.4
158 	 * Params:
159 	 * func = Callback function. [closure data][scope call]
160 	 * data = data to pass to the callback function. [closure]
161 	 */
162 	public void foreac(PangoFontsetForeachFunc func, void* data)
163 	{
164 		// void pango_fontset_foreach (PangoFontset *fontset,  PangoFontsetForeachFunc func,  gpointer data);
165 		pango_fontset_foreach(pangoFontset, func, data);
166 	}
167 }