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 	public static GType getType()
73 	{
74 		return pango_font_face_get_type();
75 	}
76 
77 	/**
78 	 * Returns the family, style, variant, weight and stretch of
79 	 * a #PangoFontFace. The size field of the resulting font description
80 	 * will be unset.
81 	 *
82 	 * Return: a newly-created #PangoFontDescription structure
83 	 *     holding the description of the face. Use pango_font_description_free()
84 	 *     to free the result.
85 	 */
86 	public PgFontDescription describe()
87 	{
88 		auto p = pango_font_face_describe(pangoFontFace);
89 		
90 		if(p is null)
91 		{
92 			return null;
93 		}
94 		
95 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p, true);
96 	}
97 
98 	/**
99 	 * Gets a name representing the style of this face among the
100 	 * different faces in the #PangoFontFamily for the face. This
101 	 * name is unique among all faces in the family and is suitable
102 	 * for displaying to users.
103 	 *
104 	 * Return: the face name for the face. This string is
105 	 *     owned by the face object and must not be modified or freed.
106 	 */
107 	public string getFaceName()
108 	{
109 		return Str.toString(pango_font_face_get_face_name(pangoFontFace));
110 	}
111 
112 	/**
113 	 * Returns whether a #PangoFontFace is synthesized by the underlying
114 	 * font rendering engine from another face, perhaps by shearing, emboldening,
115 	 * or lightening it.
116 	 *
117 	 * Return: whether @face is synthesized.
118 	 *
119 	 * Since: 1.18
120 	 */
121 	public bool isSynthesized()
122 	{
123 		return pango_font_face_is_synthesized(pangoFontFace) != 0;
124 	}
125 
126 	/**
127 	 * List the available sizes for a font. This is only applicable to bitmap
128 	 * fonts. For scalable fonts, stores %NULL at the location pointed to by
129 	 * @sizes and 0 at the location pointed to by @n_sizes. The sizes returned
130 	 * are in Pango units and are sorted in ascending order.
131 	 *
132 	 * Params:
133 	 *     sizes = location to store a pointer to an array of int. This array
134 	 *         should be freed with g_free().
135 	 *     nSizes = location to store the number of elements in @sizes
136 	 *
137 	 * Since: 1.4
138 	 */
139 	public void listSizes(out int[] sizes)
140 	{
141 		int* outsizes = null;
142 		int nSizes;
143 		
144 		pango_font_face_list_sizes(pangoFontFace, &outsizes, &nSizes);
145 		
146 		sizes = outsizes[0 .. nSizes];
147 	}
148 }