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