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