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 glib.c.functions;
29 private import gobject.ObjectG;
30 private import pango.PgFontFace;
31 private import pango.c.functions;
32 public  import pango.c.types;
33 
34 
35 /**
36  * A `PangoFontFamily` is used to represent a family of related
37  * font faces.
38  * 
39  * The font faces in a family share a common design, but differ in
40  * slant, weight, width or other aspects.
41  */
42 public class PgFontFamily : ObjectG
43 {
44 	/** the main Gtk struct */
45 	protected PangoFontFamily* pangoFontFamily;
46 
47 	/** Get the main Gtk struct */
48 	public PangoFontFamily* getPgFontFamilyStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return pangoFontFamily;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected override void* getStruct()
57 	{
58 		return cast(void*)pangoFontFamily;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (PangoFontFamily* pangoFontFamily, bool ownedRef = false)
65 	{
66 		this.pangoFontFamily = pangoFontFamily;
67 		super(cast(GObject*)pangoFontFamily, ownedRef);
68 	}
69 
70 
71 	/** */
72 	public static GType getType()
73 	{
74 		return pango_font_family_get_type();
75 	}
76 
77 	/**
78 	 * Gets the `PangoFontFace` of @family with the given name.
79 	 *
80 	 * Params:
81 	 *     name = the name of a face. If the name is %NULL,
82 	 *         the family's default face (fontconfig calls it "Regular")
83 	 *         will be returned.
84 	 *
85 	 * Returns: the `PangoFontFace`,
86 	 *     or %NULL if no face with the given name exists.
87 	 *
88 	 * Since: 1.46
89 	 */
90 	public PgFontFace getFace(string name)
91 	{
92 		auto __p = pango_font_family_get_face(pangoFontFamily, Str.toStringz(name));
93 
94 		if(__p is null)
95 		{
96 			return null;
97 		}
98 
99 		return ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) __p);
100 	}
101 
102 	/**
103 	 * Gets the name of the family.
104 	 *
105 	 * The name is unique among all fonts for the font backend and can
106 	 * be used in a `PangoFontDescription` to specify that a face from
107 	 * this family is desired.
108 	 *
109 	 * Returns: the name of the family. This string is owned
110 	 *     by the family object and must not be modified or freed.
111 	 */
112 	public string getName()
113 	{
114 		return Str.toString(pango_font_family_get_name(pangoFontFamily));
115 	}
116 
117 	/**
118 	 * A monospace font is a font designed for text display where the the
119 	 * characters form a regular grid.
120 	 *
121 	 * For Western languages this would
122 	 * mean that the advance width of all characters are the same, but
123 	 * this categorization also includes Asian fonts which include
124 	 * double-width characters: characters that occupy two grid cells.
125 	 * g_unichar_iswide() returns a result that indicates whether a
126 	 * character is typically double-width in a monospace font.
127 	 *
128 	 * The best way to find out the grid-cell size is to call
129 	 * [method@Pango.FontMetrics.get_approximate_digit_width], since the
130 	 * results of [method@Pango.FontMetrics.get_approximate_char_width] may
131 	 * be affected by double-width characters.
132 	 *
133 	 * Returns: %TRUE if the family is monospace.
134 	 *
135 	 * Since: 1.4
136 	 */
137 	public bool isMonospace()
138 	{
139 		return pango_font_family_is_monospace(pangoFontFamily) != 0;
140 	}
141 
142 	/**
143 	 * A variable font is a font which has axes that can be modified to
144 	 * produce different faces.
145 	 *
146 	 * Returns: %TRUE if the family is variable
147 	 *
148 	 * Since: 1.44
149 	 */
150 	public bool isVariable()
151 	{
152 		return pango_font_family_is_variable(pangoFontFamily) != 0;
153 	}
154 
155 	/**
156 	 * Lists the different font faces that make up @family.
157 	 *
158 	 * The faces in a family share a common design, but differ in slant, weight,
159 	 * width and other aspects.
160 	 *
161 	 * Params:
162 	 *     faces = location to store an array of pointers to `PangoFontFace` objects,
163 	 *         or %NULL. This array should be freed with g_free() when it is no
164 	 *         longer needed.
165 	 */
166 	public void listFaces(out PgFontFace[] faces)
167 	{
168 		PangoFontFace** outfaces = null;
169 		int nFaces;
170 
171 		pango_font_family_list_faces(pangoFontFamily, &outfaces, &nFaces);
172 
173 		faces = new PgFontFace[nFaces];
174 		for(size_t i = 0; i < nFaces; i++)
175 		{
176 			faces[i] = ObjectG.getDObject!(PgFontFace)(cast(PangoFontFace*) outfaces[i]);
177 		}
178 	}
179 }