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