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.PgFontFace;
26 
27 private import glib.Str;
28 private import glib.c.functions;
29 private import gobject.ObjectG;
30 private import pango.PgFontDescription;
31 private import pango.PgFontFamily;
32 private import pango.c.functions;
33 public  import pango.c.types;
34 
35 
36 /**
37  * A `PangoFontFace` is used to represent a group of fonts with
38  * the same family, slant, weight, and width, but varying sizes.
39  */
40 public class PgFontFace : ObjectG
41 {
42 	/** the main Gtk struct */
43 	protected PangoFontFace* pangoFontFace;
44 
45 	/** Get the main Gtk struct */
46 	public PangoFontFace* getPgFontFaceStruct(bool transferOwnership = false)
47 	{
48 		if (transferOwnership)
49 			ownedRef = false;
50 		return pangoFontFace;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected override void* getStruct()
55 	{
56 		return cast(void*)pangoFontFace;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (PangoFontFace* pangoFontFace, bool ownedRef = false)
63 	{
64 		this.pangoFontFace = pangoFontFace;
65 		super(cast(GObject*)pangoFontFace, ownedRef);
66 	}
67 
68 
69 	/** */
70 	public static GType getType()
71 	{
72 		return pango_font_face_get_type();
73 	}
74 
75 	/**
76 	 * Returns the family, style, variant, weight and stretch of
77 	 * a `PangoFontFace`. The size field of the resulting font description
78 	 * will be unset.
79 	 *
80 	 * Returns: a newly-created `PangoFontDescription` structure
81 	 *     holding the description of the face. Use [method@Pango.FontDescription.free]
82 	 *     to free the result.
83 	 */
84 	public PgFontDescription describe()
85 	{
86 		auto __p = pango_font_face_describe(pangoFontFace);
87 
88 		if(__p is null)
89 		{
90 			return null;
91 		}
92 
93 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) __p, true);
94 	}
95 
96 	/**
97 	 * Gets a name representing the style of this face among the
98 	 * different faces in the `PangoFontFamily` for the face. The
99 	 * name is suitable for displaying to users.
100 	 *
101 	 * Returns: the face name for the face. This string is
102 	 *     owned by the face object and must not be modified or freed.
103 	 */
104 	public string getFaceName()
105 	{
106 		return Str.toString(pango_font_face_get_face_name(pangoFontFace));
107 	}
108 
109 	/**
110 	 * Gets the `PangoFontFamily` that @face belongs to.
111 	 *
112 	 * Returns: the `PangoFontFamily`
113 	 *
114 	 * Since: 1.46
115 	 */
116 	public PgFontFamily getFamily()
117 	{
118 		auto __p = pango_font_face_get_family(pangoFontFace);
119 
120 		if(__p is null)
121 		{
122 			return null;
123 		}
124 
125 		return ObjectG.getDObject!(PgFontFamily)(cast(PangoFontFamily*) __p);
126 	}
127 
128 	/**
129 	 * Returns whether a `PangoFontFace` is synthesized by the underlying
130 	 * font rendering engine from another face, perhaps by shearing, emboldening,
131 	 * or lightening it.
132 	 *
133 	 * Returns: whether @face is synthesized.
134 	 *
135 	 * Since: 1.18
136 	 */
137 	public bool isSynthesized()
138 	{
139 		return pango_font_face_is_synthesized(pangoFontFace) != 0;
140 	}
141 
142 	/**
143 	 * List the available sizes for a font.
144 	 *
145 	 * This is only applicable to bitmap fonts. For scalable fonts, stores
146 	 * %NULL at the location pointed to by @sizes and 0 at the location pointed
147 	 * to by @n_sizes. The sizes returned are in Pango units and are sorted
148 	 * in ascending order.
149 	 *
150 	 * Params:
151 	 *     sizes = location to store a pointer to an array of int. This array
152 	 *         should be freed with g_free().
153 	 *
154 	 * Since: 1.4
155 	 */
156 	public void listSizes(out int[] sizes)
157 	{
158 		int* outsizes;
159 		int nSizes;
160 
161 		pango_font_face_list_sizes(pangoFontFace, &outsizes, &nSizes);
162 
163 		sizes = outsizes[0 .. nSizes];
164 	}
165 }