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