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