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