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.PgFontFamily;
26 
27 private import glib.Str;
28 private import gobject.ObjectG;
29 private import gtkc.pango;
30 public  import gtkc.pangotypes;
31 private import pango.PgFontFace;
32 
33 
34 /**
35  * The #PangoFontFamily structure is used to represent a family of related
36  * font faces. The faces in a family share a common design, but differ in
37  * slant, weight, width and other aspects.
38  */
39 public class PgFontFamily : ObjectG
40 {
41 	/** the main Gtk struct */
42 	protected PangoFontFamily* pangoFontFamily;
43 
44 	/** Get the main Gtk struct */
45 	public PangoFontFamily* getPgFontFamilyStruct()
46 	{
47 		return pangoFontFamily;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)pangoFontFamily;
54 	}
55 
56 	protected override void setStruct(GObject* obj)
57 	{
58 		pangoFontFamily = cast(PangoFontFamily*)obj;
59 		super.setStruct(obj);
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (PangoFontFamily* pangoFontFamily, bool ownedRef = false)
66 	{
67 		this.pangoFontFamily = pangoFontFamily;
68 		super(cast(GObject*)pangoFontFamily, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return pango_font_family_get_type();
76 	}
77 
78 	/**
79 	 * Gets the name of the family. The name is unique among all
80 	 * fonts for the font backend and can be used in a #PangoFontDescription
81 	 * to specify that a face from this family is desired.
82 	 *
83 	 * Return: the name of the family. This string is owned
84 	 *     by the family object and must not be modified or freed.
85 	 */
86 	public string getName()
87 	{
88 		return Str.toString(pango_font_family_get_name(pangoFontFamily));
89 	}
90 
91 	/**
92 	 * A monospace font is a font designed for text display where the the
93 	 * characters form a regular grid. For Western languages this would
94 	 * mean that the advance width of all characters are the same, but
95 	 * this categorization also includes Asian fonts which include
96 	 * double-width characters: characters that occupy two grid cells.
97 	 * g_unichar_iswide() returns a result that indicates whether a
98 	 * character is typically double-width in a monospace font.
99 	 *
100 	 * The best way to find out the grid-cell size is to call
101 	 * pango_font_metrics_get_approximate_digit_width(), since the results
102 	 * of pango_font_metrics_get_approximate_char_width() may be affected
103 	 * by double-width characters.
104 	 *
105 	 * Return: %TRUE if the family is monospace.
106 	 *
107 	 * Since: 1.4
108 	 */
109 	public bool isMonospace()
110 	{
111 		return pango_font_family_is_monospace(pangoFontFamily) != 0;
112 	}
113 
114 	/**
115 	 * Lists the different font faces that make up @family. The faces
116 	 * in a family share a common design, but differ in slant, weight,
117 	 * width and other aspects.
118 	 *
119 	 * Params:
120 	 *     faces = location to store an array of pointers to #PangoFontFace objects,
121 	 *         or %NULL. This array should be freed with g_free() when it is no
122 	 *         longer needed.
123 	 *     nFaces = location to store number of elements in @faces.
124 	 */
125 	public void listFaces(out PgFontFace[] faces)
126 	{
127 		PangoFontFace** outfaces = null;
128 		int nFaces;
129 		
130 		pango_font_family_list_faces(pangoFontFamily, &outfaces, &nFaces);
131 		
132 		faces = new PgFontFace[nFaces];
133 		for(size_t i = 0; i < nFaces; i++)
134 		{
135 			faces[i] = ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) outfaces[i]);
136 		}
137 	}
138 }