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 = PgFontFamily
29  * strct   = PangoFontFamily
30  * realStrct=
31  * ctorStrct=
32  * clss    = PgFontFamily
33  * interf  = 
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = GObject
38  * implements:
39  * prefixes:
40  * 	- pango_font_family_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- pango.PgFontFace
48  * structWrap:
49  * 	- PangoFontFace* -> PgFontFace
50  * module aliases:
51  * local aliases:
52  * overrides:
53  */
54 
55 module pango.PgFontFamily;
56 
57 public  import gtkc.pangotypes;
58 
59 private import gtkc.pango;
60 private import glib.ConstructionException;
61 private import gobject.ObjectG;
62 
63 private import glib.Str;
64 private import pango.PgFontFace;
65 
66 
67 private import gobject.ObjectG;
68 
69 /**
70  * Pango supports a flexible architecture where a
71  * particular rendering architecture can supply an
72  * implementation of fonts. The PangoFont structure
73  * represents an abstract rendering-system-independent font.
74  * Pango provides routines to list available fonts, and
75  * to load a font of a given description.
76  */
77 public class PgFontFamily : ObjectG
78 {
79 	
80 	/** the main Gtk struct */
81 	protected PangoFontFamily* pangoFontFamily;
82 	
83 	
84 	/** Get the main Gtk struct */
85 	public PangoFontFamily* getPgFontFamilyStruct()
86 	{
87 		return pangoFontFamily;
88 	}
89 	
90 	
91 	/** the main Gtk struct as a void* */
92 	protected override void* getStruct()
93 	{
94 		return cast(void*)pangoFontFamily;
95 	}
96 	
97 	/**
98 	 * Sets our main struct and passes it to the parent class
99 	 */
100 	public this (PangoFontFamily* pangoFontFamily)
101 	{
102 		super(cast(GObject*)pangoFontFamily);
103 		this.pangoFontFamily = pangoFontFamily;
104 	}
105 	
106 	protected override void setStruct(GObject* obj)
107 	{
108 		super.setStruct(obj);
109 		pangoFontFamily = cast(PangoFontFamily*)obj;
110 	}
111 	
112 	/**
113 	 */
114 	
115 	/**
116 	 * Gets the name of the family. The name is unique among all
117 	 * fonts for the font backend and can be used in a PangoFontDescription
118 	 * to specify that a face from this family is desired.
119 	 * Returns: the name of the family. This string is owned by the family object and must not be modified or freed.
120 	 */
121 	public string getName()
122 	{
123 		// const char * pango_font_family_get_name (PangoFontFamily *family);
124 		return Str.toString(pango_font_family_get_name(pangoFontFamily));
125 	}
126 	
127 	/**
128 	 * A monospace font is a font designed for text display where the the
129 	 * characters form a regular grid. For Western languages this would
130 	 * mean that the advance width of all characters are the same, but
131 	 * this categorization also includes Asian fonts which include
132 	 * double-width characters: characters that occupy two grid cells.
133 	 * g_unichar_iswide() returns a result that indicates whether a
134 	 * character is typically double-width in a monospace font.
135 	 * The best way to find out the grid-cell size is to call
136 	 * pango_font_metrics_get_approximate_digit_width(), since the results
137 	 * of pango_font_metrics_get_approximate_char_width() may be affected
138 	 * by double-width characters.
139 	 * Since 1.4
140 	 * Returns: TRUE if the family is monospace.
141 	 */
142 	public int isMonospace()
143 	{
144 		// gboolean pango_font_family_is_monospace (PangoFontFamily *family);
145 		return pango_font_family_is_monospace(pangoFontFamily);
146 	}
147 	
148 	/**
149 	 * Lists the different font faces that make up family. The faces
150 	 * in a family share a common design, but differ in slant, weight,
151 	 * width and other aspects.
152 	 * Params:
153 	 * faces = location to store an array of pointers to PangoFontFace objects,
154 	 * or NULL. This array should be freed with g_free() when it is no
155 	 * longer needed. [out][allow-none][array length=n_faces][transfer container]
156 	 */
157 	public void listFaces(out PgFontFace[] faces)
158 	{
159 		// void pango_font_family_list_faces (PangoFontFamily *family,  PangoFontFace ***faces,  int *n_faces);
160 		PangoFontFace** outfaces = null;
161 		int nFaces;
162 		
163 		pango_font_family_list_faces(pangoFontFamily, &outfaces, &nFaces);
164 		
165 		
166 		faces = new PgFontFace[nFaces];
167 		for(int i = 0; i < nFaces; i++)
168 		{
169 			faces[i] = ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) outfaces[i]);
170 		}
171 	}
172 }