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