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 
74 	public static GType getType()
75 	{
76 		return pango_font_family_get_type();
77 	}
78 
79 	/**
80 	 * Gets the name of the family. The name is unique among all
81 	 * fonts for the font backend and can be used in a #PangoFontDescription
82 	 * to specify that a face from this family is desired.
83 	 *
84 	 * Return: the name of the family. This string is owned
85 	 *     by the family object and must not be modified or freed.
86 	 */
87 	public string getName()
88 	{
89 		return Str.toString(pango_font_family_get_name(pangoFontFamily));
90 	}
91 
92 	/**
93 	 * A monospace font is a font designed for text display where the the
94 	 * characters form a regular grid. For Western languages this would
95 	 * mean that the advance width of all characters are the same, but
96 	 * this categorization also includes Asian fonts which include
97 	 * double-width characters: characters that occupy two grid cells.
98 	 * g_unichar_iswide() returns a result that indicates whether a
99 	 * character is typically double-width in a monospace font.
100 	 *
101 	 * The best way to find out the grid-cell size is to call
102 	 * pango_font_metrics_get_approximate_digit_width(), since the results
103 	 * of pango_font_metrics_get_approximate_char_width() may be affected
104 	 * by double-width characters.
105 	 *
106 	 * Return: %TRUE if the family is monospace.
107 	 *
108 	 * Since: 1.4
109 	 */
110 	public bool isMonospace()
111 	{
112 		return pango_font_family_is_monospace(pangoFontFamily) != 0;
113 	}
114 
115 	/**
116 	 * Lists the different font faces that make up @family. The faces
117 	 * in a family share a common design, but differ in slant, weight,
118 	 * width and other aspects.
119 	 *
120 	 * Params:
121 	 *     faces = location to store an array of pointers to #PangoFontFace objects,
122 	 *         or %NULL. This array should be freed with g_free() when it is no
123 	 *         longer needed.
124 	 *     nFaces = location to store number of elements in @faces.
125 	 */
126 	public void listFaces(out PgFontFace[] faces)
127 	{
128 		PangoFontFace** outfaces = null;
129 		int nFaces;
130 		
131 		pango_font_family_list_faces(pangoFontFamily, &outfaces, &nFaces);
132 		
133 		faces = new PgFontFace[nFaces];
134 		for(size_t i = 0; i < nFaces; i++)
135 		{
136 			faces[i] = ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) outfaces[i]);
137 		}
138 	}
139 }