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 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (PangoFontFace* pangoFontFace, bool ownedRef = false)
62 	{
63 		this.pangoFontFace = pangoFontFace;
64 		super(cast(GObject*)pangoFontFace, ownedRef);
65 	}
66 
67 
68 	/** */
69 	public static GType getType()
70 	{
71 		return pango_font_face_get_type();
72 	}
73 
74 	/**
75 	 * Returns the family, style, variant, weight and stretch of
76 	 * a #PangoFontFace. The size field of the resulting font description
77 	 * will be unset.
78 	 *
79 	 * Returns: a newly-created #PangoFontDescription structure
80 	 *     holding the description of the face. Use pango_font_description_free()
81 	 *     to free the result.
82 	 */
83 	public PgFontDescription describe()
84 	{
85 		auto p = pango_font_face_describe(pangoFontFace);
86 
87 		if(p is null)
88 		{
89 			return null;
90 		}
91 
92 		return ObjectG.getDObject!(PgFontDescription)(cast(PangoFontDescription*) p, true);
93 	}
94 
95 	/**
96 	 * Gets a name representing the style of this face among the
97 	 * different faces in the #PangoFontFamily for the face. This
98 	 * name is unique among all faces in the family and is suitable
99 	 * 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 	 * Returns whether a #PangoFontFace is synthesized by the underlying
111 	 * font rendering engine from another face, perhaps by shearing, emboldening,
112 	 * or lightening it.
113 	 *
114 	 * Returns: whether @face is synthesized.
115 	 *
116 	 * Since: 1.18
117 	 */
118 	public bool isSynthesized()
119 	{
120 		return pango_font_face_is_synthesized(pangoFontFace) != 0;
121 	}
122 
123 	/**
124 	 * List the available sizes for a font. This is only applicable to bitmap
125 	 * fonts. For scalable fonts, stores %NULL at the location pointed to by
126 	 * @sizes and 0 at the location pointed to by @n_sizes. The sizes returned
127 	 * are in Pango units and are sorted in ascending order.
128 	 *
129 	 * Params:
130 	 *     sizes = location to store a pointer to an array of int. This array
131 	 *         should be freed with g_free().
132 	 *
133 	 * Since: 1.4
134 	 */
135 	public void listSizes(out int[] sizes)
136 	{
137 		int* outsizes = null;
138 		int nSizes;
139 
140 		pango_font_face_list_sizes(pangoFontFace, &outsizes, &nSizes);
141 
142 		sizes = outsizes[0 .. nSizes];
143 	}
144 }