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 harfbuzz.feature_t;
26 
27 private import glib.MemorySlice;
28 private import glib.Str;
29 private import gtkd.Loader;
30 private import harfbuzz.c.functions;
31 public  import harfbuzz.c.types;
32 
33 
34 /**
35  * The #hb_feature_t is the structure that holds information about requested
36  * feature application. The feature will be applied with the given value to all
37  * glyphs which are in clusters between @start (inclusive) and @end (exclusive).
38  * Setting start to #HB_FEATURE_GLOBAL_START and end to #HB_FEATURE_GLOBAL_END
39  * specifies that the feature always applies to the entire buffer.
40  */
41 public final class feature_t
42 {
43 	/** the main Gtk struct */
44 	protected hb_feature_t* hb_feature;
45 	protected bool ownedRef;
46 
47 	/** Get the main Gtk struct */
48 	public hb_feature_t* getfeature_tStruct(bool transferOwnership = false)
49 	{
50 		if (transferOwnership)
51 			ownedRef = false;
52 		return hb_feature;
53 	}
54 
55 	/** the main Gtk struct as a void* */
56 	protected void* getStruct()
57 	{
58 		return cast(void*)hb_feature;
59 	}
60 
61 	/**
62 	 * Sets our main struct and passes it to the parent class.
63 	 */
64 	public this (hb_feature_t* hb_feature, bool ownedRef = false)
65 	{
66 		this.hb_feature = hb_feature;
67 		this.ownedRef = ownedRef;
68 	}
69 
70 	~this ()
71 	{
72 		if ( Linker.isLoaded(LIBRARY_HARFBUZZ) && ownedRef )
73 			sliceFree(hb_feature);
74 	}
75 
76 
77 	/**
78 	 * The #hb_tag_t tag of the feature
79 	 */
80 	public @property hb_tag_t tag()
81 	{
82 		return hb_feature.tag;
83 	}
84 
85 	/** Ditto */
86 	public @property void tag(hb_tag_t value)
87 	{
88 		hb_feature.tag = value;
89 	}
90 
91 	/**
92 	 * The value of the feature. 0 disables the feature, non-zero (usually
93 	 * 1) enables the feature.  For features implemented as lookup type 3 (like
94 	 * 'salt') the @value is a one based index into the alternates.
95 	 */
96 	public @property uint value()
97 	{
98 		return hb_feature.value;
99 	}
100 
101 	/** Ditto */
102 	public @property void value(uint value)
103 	{
104 		hb_feature.value = value;
105 	}
106 
107 	/**
108 	 * the cluster to start applying this feature setting (inclusive).
109 	 */
110 	public @property uint start()
111 	{
112 		return hb_feature.start;
113 	}
114 
115 	/** Ditto */
116 	public @property void start(uint value)
117 	{
118 		hb_feature.start = value;
119 	}
120 
121 	/**
122 	 * the cluster to end applying this feature setting (exclusive).
123 	 */
124 	public @property uint end()
125 	{
126 		return hb_feature.end;
127 	}
128 
129 	/** Ditto */
130 	public @property void end(uint value)
131 	{
132 		hb_feature.end = value;
133 	}
134 
135 	/** */
136 	public static GType getType()
137 	{
138 		return hb_gobject_feature_get_type();
139 	}
140 
141 	/**
142 	 * Converts a #hb_feature_t into a %NULL-terminated string in the format
143 	 * understood by hb_feature_from_string(). The client in responsible for
144 	 * allocating big enough size for @buf, 128 bytes is more than enough.
145 	 *
146 	 * Params:
147 	 *     buf = output string
148 	 *
149 	 * Since: 0.9.5
150 	 */
151 	public void String(out char[] buf)
152 	{
153 		hb_feature_to_string(hb_feature, buf.ptr, cast(uint)buf.length);
154 	}
155 }