Rev 1892 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1892 | Rev 3959 | ||
---|---|---|---|
1 | /* cairo - a vector graphics library with display and print output |
1 | /* cairo - a vector graphics library with display and print output |
2 | * |
2 | * |
3 | * Copyright © 2005 Red Hat Inc. |
3 | * Copyright © 2005 Red Hat Inc. |
4 | * |
4 | * |
5 | * This library is free software; you can redistribute it and/or |
5 | * This library is free software; you can redistribute it and/or |
6 | * modify it either under the terms of the GNU Lesser General Public |
6 | * modify it either under the terms of the GNU Lesser General Public |
7 | * License version 2.1 as published by the Free Software Foundation |
7 | * License version 2.1 as published by the Free Software Foundation |
8 | * (the "LGPL") or, at your option, under the terms of the Mozilla |
8 | * (the "LGPL") or, at your option, under the terms of the Mozilla |
9 | * Public License Version 1.1 (the "MPL"). If you do not alter this |
9 | * Public License Version 1.1 (the "MPL"). If you do not alter this |
10 | * notice, a recipient may use your version of this file under either |
10 | * notice, a recipient may use your version of this file under either |
11 | * the MPL or the LGPL. |
11 | * the MPL or the LGPL. |
12 | * |
12 | * |
13 | * You should have received a copy of the LGPL along with this library |
13 | * You should have received a copy of the LGPL along with this library |
14 | * in the file COPYING-LGPL-2.1; if not, write to the Free Software |
14 | * in the file COPYING-LGPL-2.1; if not, write to the Free Software |
15 | * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
15 | * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA |
16 | * You should have received a copy of the MPL along with this library |
16 | * You should have received a copy of the MPL along with this library |
17 | * in the file COPYING-MPL-1.1 |
17 | * in the file COPYING-MPL-1.1 |
18 | * |
18 | * |
19 | * The contents of this file are subject to the Mozilla Public License |
19 | * The contents of this file are subject to the Mozilla Public License |
20 | * Version 1.1 (the "License"); you may not use this file except in |
20 | * Version 1.1 (the "License"); you may not use this file except in |
21 | * compliance with the License. You may obtain a copy of the License at |
21 | * compliance with the License. You may obtain a copy of the License at |
22 | * http://www.mozilla.org/MPL/ |
22 | * http://www.mozilla.org/MPL/ |
23 | * |
23 | * |
24 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY |
24 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY |
25 | * OF ANY KIND, either express or implied. See the LGPL or the MPL for |
25 | * OF ANY KIND, either express or implied. See the LGPL or the MPL for |
26 | * the specific language governing rights and limitations. |
26 | * the specific language governing rights and limitations. |
27 | * |
27 | * |
28 | * The Original Code is the cairo graphics library. |
28 | * The Original Code is the cairo graphics library. |
29 | * |
29 | * |
30 | * The Initial Developer of the Original Code is University of Southern |
30 | * The Initial Developer of the Original Code is University of Southern |
31 | * California. |
31 | * California. |
32 | * |
32 | * |
33 | * Contributor(s): |
33 | * Contributor(s): |
34 | * Owen Taylor |
34 | * Owen Taylor |
35 | */ |
35 | */ |
36 | 36 | ||
37 | #include "cairoint.h" |
37 | #include "cairoint.h" |
38 | #include "cairo-error-private.h" |
38 | #include "cairo-error-private.h" |
39 | 39 | ||
40 | /** |
40 | /** |
41 | * SECTION:cairo-font-options |
41 | * SECTION:cairo-font-options |
42 | * @Title: cairo_font_options_t |
42 | * @Title: cairo_font_options_t |
43 | * @Short_Description: How a font should be rendered |
43 | * @Short_Description: How a font should be rendered |
44 | * @See_Also: #cairo_scaled_font_t |
44 | * @See_Also: #cairo_scaled_font_t |
45 | * |
45 | * |
46 | * The font options specify how fonts should be rendered. Most of the |
46 | * The font options specify how fonts should be rendered. Most of the |
47 | * time the font options implied by a surface are just right and do not |
47 | * time the font options implied by a surface are just right and do not |
48 | * need any changes, but for pixel-based targets tweaking font options |
48 | * need any changes, but for pixel-based targets tweaking font options |
49 | * may result in superior output on a particular display. |
49 | * may result in superior output on a particular display. |
50 | */ |
50 | **/ |
51 | 51 | ||
52 | static const cairo_font_options_t _cairo_font_options_nil = { |
52 | static const cairo_font_options_t _cairo_font_options_nil = { |
53 | CAIRO_ANTIALIAS_DEFAULT, |
53 | CAIRO_ANTIALIAS_DEFAULT, |
54 | CAIRO_SUBPIXEL_ORDER_DEFAULT, |
54 | CAIRO_SUBPIXEL_ORDER_DEFAULT, |
55 | CAIRO_LCD_FILTER_DEFAULT, |
55 | CAIRO_LCD_FILTER_DEFAULT, |
56 | CAIRO_HINT_STYLE_DEFAULT, |
56 | CAIRO_HINT_STYLE_DEFAULT, |
57 | CAIRO_HINT_METRICS_DEFAULT |
57 | CAIRO_HINT_METRICS_DEFAULT, |
- | 58 | CAIRO_ROUND_GLYPH_POS_DEFAULT |
|
58 | }; |
59 | }; |
59 | 60 | ||
60 | /** |
61 | /** |
61 | * _cairo_font_options_init_default: |
62 | * _cairo_font_options_init_default: |
62 | * @options: a #cairo_font_options_t |
63 | * @options: a #cairo_font_options_t |
63 | * |
64 | * |
64 | * Initializes all fields of the font options object to default values. |
65 | * Initializes all fields of the font options object to default values. |
65 | **/ |
66 | **/ |
66 | void |
67 | void |
67 | _cairo_font_options_init_default (cairo_font_options_t *options) |
68 | _cairo_font_options_init_default (cairo_font_options_t *options) |
68 | { |
69 | { |
69 | options->antialias = CAIRO_ANTIALIAS_DEFAULT; |
70 | options->antialias = CAIRO_ANTIALIAS_DEFAULT; |
70 | options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; |
71 | options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT; |
71 | options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT; |
72 | options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT; |
72 | options->hint_style = CAIRO_HINT_STYLE_DEFAULT; |
73 | options->hint_style = CAIRO_HINT_STYLE_DEFAULT; |
73 | options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT; |
74 | options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT; |
- | 75 | options->round_glyph_positions = CAIRO_ROUND_GLYPH_POS_DEFAULT; |
|
74 | } |
76 | } |
75 | 77 | ||
76 | void |
78 | void |
77 | _cairo_font_options_init_copy (cairo_font_options_t *options, |
79 | _cairo_font_options_init_copy (cairo_font_options_t *options, |
78 | const cairo_font_options_t *other) |
80 | const cairo_font_options_t *other) |
79 | { |
81 | { |
80 | options->antialias = other->antialias; |
82 | options->antialias = other->antialias; |
81 | options->subpixel_order = other->subpixel_order; |
83 | options->subpixel_order = other->subpixel_order; |
82 | options->lcd_filter = other->lcd_filter; |
84 | options->lcd_filter = other->lcd_filter; |
83 | options->hint_style = other->hint_style; |
85 | options->hint_style = other->hint_style; |
84 | options->hint_metrics = other->hint_metrics; |
86 | options->hint_metrics = other->hint_metrics; |
- | 87 | options->round_glyph_positions = other->round_glyph_positions; |
|
85 | } |
88 | } |
86 | 89 | ||
87 | /** |
90 | /** |
88 | * cairo_font_options_create: |
91 | * cairo_font_options_create: |
89 | * |
92 | * |
90 | * Allocates a new font options object with all options initialized |
93 | * Allocates a new font options object with all options initialized |
91 | * to default values. |
94 | * to default values. |
92 | * |
95 | * |
93 | * Return value: a newly allocated #cairo_font_options_t. Free with |
96 | * Return value: a newly allocated #cairo_font_options_t. Free with |
94 | * cairo_font_options_destroy(). This function always returns a |
97 | * cairo_font_options_destroy(). This function always returns a |
95 | * valid pointer; if memory cannot be allocated, then a special |
98 | * valid pointer; if memory cannot be allocated, then a special |
96 | * error object is returned where all operations on the object do nothing. |
99 | * error object is returned where all operations on the object do nothing. |
97 | * You can check for this with cairo_font_options_status(). |
100 | * You can check for this with cairo_font_options_status(). |
- | 101 | * |
|
- | 102 | * Since: 1.0 |
|
98 | **/ |
103 | **/ |
99 | cairo_font_options_t * |
104 | cairo_font_options_t * |
100 | cairo_font_options_create (void) |
105 | cairo_font_options_create (void) |
101 | { |
106 | { |
102 | cairo_font_options_t *options; |
107 | cairo_font_options_t *options; |
103 | 108 | ||
104 | options = malloc (sizeof (cairo_font_options_t)); |
109 | options = malloc (sizeof (cairo_font_options_t)); |
105 | if (!options) { |
110 | if (!options) { |
106 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
111 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
107 | return (cairo_font_options_t *) &_cairo_font_options_nil; |
112 | return (cairo_font_options_t *) &_cairo_font_options_nil; |
108 | } |
113 | } |
109 | 114 | ||
110 | _cairo_font_options_init_default (options); |
115 | _cairo_font_options_init_default (options); |
111 | 116 | ||
112 | return options; |
117 | return options; |
113 | } |
118 | } |
114 | 119 | ||
115 | /** |
120 | /** |
116 | * cairo_font_options_copy: |
121 | * cairo_font_options_copy: |
117 | * @original: a #cairo_font_options_t |
122 | * @original: a #cairo_font_options_t |
118 | * |
123 | * |
119 | * Allocates a new font options object copying the option values from |
124 | * Allocates a new font options object copying the option values from |
120 | * @original. |
125 | * @original. |
121 | * |
126 | * |
122 | * Return value: a newly allocated #cairo_font_options_t. Free with |
127 | * Return value: a newly allocated #cairo_font_options_t. Free with |
123 | * cairo_font_options_destroy(). This function always returns a |
128 | * cairo_font_options_destroy(). This function always returns a |
124 | * valid pointer; if memory cannot be allocated, then a special |
129 | * valid pointer; if memory cannot be allocated, then a special |
125 | * error object is returned where all operations on the object do nothing. |
130 | * error object is returned where all operations on the object do nothing. |
126 | * You can check for this with cairo_font_options_status(). |
131 | * You can check for this with cairo_font_options_status(). |
- | 132 | * |
|
- | 133 | * Since: 1.0 |
|
127 | **/ |
134 | **/ |
128 | cairo_font_options_t * |
135 | cairo_font_options_t * |
129 | cairo_font_options_copy (const cairo_font_options_t *original) |
136 | cairo_font_options_copy (const cairo_font_options_t *original) |
130 | { |
137 | { |
131 | cairo_font_options_t *options; |
138 | cairo_font_options_t *options; |
132 | 139 | ||
133 | if (cairo_font_options_status ((cairo_font_options_t *) original)) |
140 | if (cairo_font_options_status ((cairo_font_options_t *) original)) |
134 | return (cairo_font_options_t *) &_cairo_font_options_nil; |
141 | return (cairo_font_options_t *) &_cairo_font_options_nil; |
135 | 142 | ||
136 | options = malloc (sizeof (cairo_font_options_t)); |
143 | options = malloc (sizeof (cairo_font_options_t)); |
137 | if (!options) { |
144 | if (!options) { |
138 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
145 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
139 | return (cairo_font_options_t *) &_cairo_font_options_nil; |
146 | return (cairo_font_options_t *) &_cairo_font_options_nil; |
140 | } |
147 | } |
141 | 148 | ||
142 | _cairo_font_options_init_copy (options, original); |
149 | _cairo_font_options_init_copy (options, original); |
143 | 150 | ||
144 | return options; |
151 | return options; |
145 | } |
152 | } |
146 | 153 | ||
147 | /** |
154 | /** |
148 | * cairo_font_options_destroy: |
155 | * cairo_font_options_destroy: |
149 | * @options: a #cairo_font_options_t |
156 | * @options: a #cairo_font_options_t |
150 | * |
157 | * |
151 | * Destroys a #cairo_font_options_t object created with |
158 | * Destroys a #cairo_font_options_t object created with |
152 | * cairo_font_options_create() or cairo_font_options_copy(). |
159 | * cairo_font_options_create() or cairo_font_options_copy(). |
- | 160 | * |
|
- | 161 | * Since: 1.0 |
|
153 | **/ |
162 | **/ |
154 | void |
163 | void |
155 | cairo_font_options_destroy (cairo_font_options_t *options) |
164 | cairo_font_options_destroy (cairo_font_options_t *options) |
156 | { |
165 | { |
157 | if (cairo_font_options_status (options)) |
166 | if (cairo_font_options_status (options)) |
158 | return; |
167 | return; |
159 | 168 | ||
160 | free (options); |
169 | free (options); |
161 | } |
170 | } |
162 | 171 | ||
163 | /** |
172 | /** |
164 | * cairo_font_options_status: |
173 | * cairo_font_options_status: |
165 | * @options: a #cairo_font_options_t |
174 | * @options: a #cairo_font_options_t |
166 | * |
175 | * |
167 | * Checks whether an error has previously occurred for this |
176 | * Checks whether an error has previously occurred for this |
168 | * font options object |
177 | * font options object |
169 | * |
178 | * |
170 | * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY |
179 | * Return value: %CAIRO_STATUS_SUCCESS or %CAIRO_STATUS_NO_MEMORY |
- | 180 | * |
|
- | 181 | * Since: 1.0 |
|
171 | **/ |
182 | **/ |
172 | cairo_status_t |
183 | cairo_status_t |
173 | cairo_font_options_status (cairo_font_options_t *options) |
184 | cairo_font_options_status (cairo_font_options_t *options) |
174 | { |
185 | { |
175 | if (options == NULL) |
186 | if (options == NULL) |
176 | return CAIRO_STATUS_NULL_POINTER; |
187 | return CAIRO_STATUS_NULL_POINTER; |
177 | else if (options == (cairo_font_options_t *) &_cairo_font_options_nil) |
188 | else if (options == (cairo_font_options_t *) &_cairo_font_options_nil) |
178 | return CAIRO_STATUS_NO_MEMORY; |
189 | return CAIRO_STATUS_NO_MEMORY; |
179 | else |
190 | else |
180 | return CAIRO_STATUS_SUCCESS; |
191 | return CAIRO_STATUS_SUCCESS; |
181 | } |
192 | } |
182 | slim_hidden_def (cairo_font_options_status); |
193 | slim_hidden_def (cairo_font_options_status); |
183 | 194 | ||
184 | /** |
195 | /** |
185 | * cairo_font_options_merge: |
196 | * cairo_font_options_merge: |
186 | * @options: a #cairo_font_options_t |
197 | * @options: a #cairo_font_options_t |
187 | * @other: another #cairo_font_options_t |
198 | * @other: another #cairo_font_options_t |
188 | * |
199 | * |
189 | * Merges non-default options from @other into @options, replacing |
200 | * Merges non-default options from @other into @options, replacing |
190 | * existing values. This operation can be thought of as somewhat |
201 | * existing values. This operation can be thought of as somewhat |
191 | * similar to compositing @other onto @options with the operation |
202 | * similar to compositing @other onto @options with the operation |
192 | * of %CAIRO_OPERATION_OVER. |
203 | * of %CAIRO_OPERATOR_OVER. |
- | 204 | * |
|
- | 205 | * Since: 1.0 |
|
193 | **/ |
206 | **/ |
194 | void |
207 | void |
195 | cairo_font_options_merge (cairo_font_options_t *options, |
208 | cairo_font_options_merge (cairo_font_options_t *options, |
196 | const cairo_font_options_t *other) |
209 | const cairo_font_options_t *other) |
197 | { |
210 | { |
198 | if (cairo_font_options_status (options)) |
211 | if (cairo_font_options_status (options)) |
199 | return; |
212 | return; |
200 | 213 | ||
201 | if (cairo_font_options_status ((cairo_font_options_t *) other)) |
214 | if (cairo_font_options_status ((cairo_font_options_t *) other)) |
202 | return; |
215 | return; |
203 | 216 | ||
204 | if (other->antialias != CAIRO_ANTIALIAS_DEFAULT) |
217 | if (other->antialias != CAIRO_ANTIALIAS_DEFAULT) |
205 | options->antialias = other->antialias; |
218 | options->antialias = other->antialias; |
206 | if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) |
219 | if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) |
207 | options->subpixel_order = other->subpixel_order; |
220 | options->subpixel_order = other->subpixel_order; |
208 | if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) |
221 | if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT) |
209 | options->lcd_filter = other->lcd_filter; |
222 | options->lcd_filter = other->lcd_filter; |
210 | if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT) |
223 | if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT) |
211 | options->hint_style = other->hint_style; |
224 | options->hint_style = other->hint_style; |
212 | if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT) |
225 | if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT) |
213 | options->hint_metrics = other->hint_metrics; |
226 | options->hint_metrics = other->hint_metrics; |
- | 227 | if (other->round_glyph_positions != CAIRO_ROUND_GLYPH_POS_DEFAULT) |
|
- | 228 | options->round_glyph_positions = other->round_glyph_positions; |
|
214 | } |
229 | } |
215 | slim_hidden_def (cairo_font_options_merge); |
230 | slim_hidden_def (cairo_font_options_merge); |
216 | 231 | ||
217 | /** |
232 | /** |
218 | * cairo_font_options_equal: |
233 | * cairo_font_options_equal: |
219 | * @options: a #cairo_font_options_t |
234 | * @options: a #cairo_font_options_t |
220 | * @other: another #cairo_font_options_t |
235 | * @other: another #cairo_font_options_t |
221 | * |
236 | * |
222 | * Compares two font options objects for equality. |
237 | * Compares two font options objects for equality. |
223 | * |
238 | * |
224 | * Return value: %TRUE if all fields of the two font options objects match. |
239 | * Return value: %TRUE if all fields of the two font options objects match. |
225 | * Note that this function will return %FALSE if either object is in |
240 | * Note that this function will return %FALSE if either object is in |
226 | * error. |
241 | * error. |
- | 242 | * |
|
- | 243 | * Since: 1.0 |
|
227 | **/ |
244 | **/ |
228 | cairo_bool_t |
245 | cairo_bool_t |
229 | cairo_font_options_equal (const cairo_font_options_t *options, |
246 | cairo_font_options_equal (const cairo_font_options_t *options, |
230 | const cairo_font_options_t *other) |
247 | const cairo_font_options_t *other) |
231 | { |
248 | { |
232 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
249 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
233 | return FALSE; |
250 | return FALSE; |
234 | if (cairo_font_options_status ((cairo_font_options_t *) other)) |
251 | if (cairo_font_options_status ((cairo_font_options_t *) other)) |
235 | return FALSE; |
252 | return FALSE; |
236 | 253 | ||
237 | if (options == other) |
254 | if (options == other) |
238 | return TRUE; |
255 | return TRUE; |
239 | 256 | ||
240 | return (options->antialias == other->antialias && |
257 | return (options->antialias == other->antialias && |
241 | options->subpixel_order == other->subpixel_order && |
258 | options->subpixel_order == other->subpixel_order && |
242 | options->lcd_filter == other->lcd_filter && |
259 | options->lcd_filter == other->lcd_filter && |
243 | options->hint_style == other->hint_style && |
260 | options->hint_style == other->hint_style && |
244 | options->hint_metrics == other->hint_metrics); |
261 | options->hint_metrics == other->hint_metrics && |
- | 262 | options->round_glyph_positions == other->round_glyph_positions); |
|
245 | } |
263 | } |
246 | slim_hidden_def (cairo_font_options_equal); |
264 | slim_hidden_def (cairo_font_options_equal); |
247 | 265 | ||
248 | /** |
266 | /** |
249 | * cairo_font_options_hash: |
267 | * cairo_font_options_hash: |
250 | * @options: a #cairo_font_options_t |
268 | * @options: a #cairo_font_options_t |
251 | * |
269 | * |
252 | * Compute a hash for the font options object; this value will |
270 | * Compute a hash for the font options object; this value will |
253 | * be useful when storing an object containing a #cairo_font_options_t |
271 | * be useful when storing an object containing a #cairo_font_options_t |
254 | * in a hash table. |
272 | * in a hash table. |
255 | * |
273 | * |
256 | * Return value: the hash value for the font options object. |
274 | * Return value: the hash value for the font options object. |
257 | * The return value can be cast to a 32-bit type if a |
275 | * The return value can be cast to a 32-bit type if a |
258 | * 32-bit hash value is needed. |
276 | * 32-bit hash value is needed. |
- | 277 | * |
|
- | 278 | * Since: 1.0 |
|
259 | **/ |
279 | **/ |
260 | unsigned long |
280 | unsigned long |
261 | cairo_font_options_hash (const cairo_font_options_t *options) |
281 | cairo_font_options_hash (const cairo_font_options_t *options) |
262 | { |
282 | { |
263 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
283 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
264 | options = &_cairo_font_options_nil; /* force default values */ |
284 | options = &_cairo_font_options_nil; /* force default values */ |
265 | 285 | ||
266 | return ((options->antialias) | |
286 | return ((options->antialias) | |
267 | (options->subpixel_order << 4) | |
287 | (options->subpixel_order << 4) | |
268 | (options->lcd_filter << 8) | |
288 | (options->lcd_filter << 8) | |
269 | (options->hint_style << 12) | |
289 | (options->hint_style << 12) | |
270 | (options->hint_metrics << 16)); |
290 | (options->hint_metrics << 16)); |
271 | } |
291 | } |
272 | slim_hidden_def (cairo_font_options_hash); |
292 | slim_hidden_def (cairo_font_options_hash); |
273 | 293 | ||
274 | /** |
294 | /** |
275 | * cairo_font_options_set_antialias: |
295 | * cairo_font_options_set_antialias: |
276 | * @options: a #cairo_font_options_t |
296 | * @options: a #cairo_font_options_t |
277 | * @antialias: the new antialiasing mode |
297 | * @antialias: the new antialiasing mode |
278 | * |
298 | * |
279 | * Sets the antialiasing mode for the font options object. This |
299 | * Sets the antialiasing mode for the font options object. This |
280 | * specifies the type of antialiasing to do when rendering text. |
300 | * specifies the type of antialiasing to do when rendering text. |
- | 301 | * |
|
- | 302 | * Since: 1.0 |
|
281 | **/ |
303 | **/ |
282 | void |
304 | void |
283 | cairo_font_options_set_antialias (cairo_font_options_t *options, |
305 | cairo_font_options_set_antialias (cairo_font_options_t *options, |
284 | cairo_antialias_t antialias) |
306 | cairo_antialias_t antialias) |
285 | { |
307 | { |
286 | if (cairo_font_options_status (options)) |
308 | if (cairo_font_options_status (options)) |
287 | return; |
309 | return; |
288 | 310 | ||
289 | options->antialias = antialias; |
311 | options->antialias = antialias; |
290 | } |
312 | } |
291 | slim_hidden_def (cairo_font_options_set_antialias); |
313 | slim_hidden_def (cairo_font_options_set_antialias); |
292 | 314 | ||
293 | /** |
315 | /** |
294 | * cairo_font_options_get_antialias: |
316 | * cairo_font_options_get_antialias: |
295 | * @options: a #cairo_font_options_t |
317 | * @options: a #cairo_font_options_t |
296 | * |
318 | * |
297 | * Gets the antialiasing mode for the font options object. |
319 | * Gets the antialiasing mode for the font options object. |
298 | * |
320 | * |
299 | * Return value: the antialiasing mode |
321 | * Return value: the antialiasing mode |
- | 322 | * |
|
- | 323 | * Since: 1.0 |
|
300 | **/ |
324 | **/ |
301 | cairo_antialias_t |
325 | cairo_antialias_t |
302 | cairo_font_options_get_antialias (const cairo_font_options_t *options) |
326 | cairo_font_options_get_antialias (const cairo_font_options_t *options) |
303 | { |
327 | { |
304 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
328 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
305 | return CAIRO_ANTIALIAS_DEFAULT; |
329 | return CAIRO_ANTIALIAS_DEFAULT; |
306 | 330 | ||
307 | return options->antialias; |
331 | return options->antialias; |
308 | } |
332 | } |
309 | 333 | ||
310 | /** |
334 | /** |
311 | * cairo_font_options_set_subpixel_order: |
335 | * cairo_font_options_set_subpixel_order: |
312 | * @options: a #cairo_font_options_t |
336 | * @options: a #cairo_font_options_t |
313 | * @subpixel_order: the new subpixel order |
337 | * @subpixel_order: the new subpixel order |
314 | * |
338 | * |
315 | * Sets the subpixel order for the font options object. The subpixel |
339 | * Sets the subpixel order for the font options object. The subpixel |
316 | * order specifies the order of color elements within each pixel on |
340 | * order specifies the order of color elements within each pixel on |
317 | * the display device when rendering with an antialiasing mode of |
341 | * the display device when rendering with an antialiasing mode of |
318 | * %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for |
342 | * %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for |
319 | * #cairo_subpixel_order_t for full details. |
343 | * #cairo_subpixel_order_t for full details. |
- | 344 | * |
|
- | 345 | * Since: 1.0 |
|
320 | **/ |
346 | **/ |
321 | void |
347 | void |
322 | cairo_font_options_set_subpixel_order (cairo_font_options_t *options, |
348 | cairo_font_options_set_subpixel_order (cairo_font_options_t *options, |
323 | cairo_subpixel_order_t subpixel_order) |
349 | cairo_subpixel_order_t subpixel_order) |
324 | { |
350 | { |
325 | if (cairo_font_options_status (options)) |
351 | if (cairo_font_options_status (options)) |
326 | return; |
352 | return; |
327 | 353 | ||
328 | options->subpixel_order = subpixel_order; |
354 | options->subpixel_order = subpixel_order; |
329 | } |
355 | } |
330 | slim_hidden_def (cairo_font_options_set_subpixel_order); |
356 | slim_hidden_def (cairo_font_options_set_subpixel_order); |
331 | 357 | ||
332 | /** |
358 | /** |
333 | * cairo_font_options_get_subpixel_order: |
359 | * cairo_font_options_get_subpixel_order: |
334 | * @options: a #cairo_font_options_t |
360 | * @options: a #cairo_font_options_t |
335 | * |
361 | * |
336 | * Gets the subpixel order for the font options object. |
362 | * Gets the subpixel order for the font options object. |
337 | * See the documentation for #cairo_subpixel_order_t for full details. |
363 | * See the documentation for #cairo_subpixel_order_t for full details. |
338 | * |
364 | * |
339 | * Return value: the subpixel order for the font options object |
365 | * Return value: the subpixel order for the font options object |
- | 366 | * |
|
- | 367 | * Since: 1.0 |
|
340 | **/ |
368 | **/ |
341 | cairo_subpixel_order_t |
369 | cairo_subpixel_order_t |
342 | cairo_font_options_get_subpixel_order (const cairo_font_options_t *options) |
370 | cairo_font_options_get_subpixel_order (const cairo_font_options_t *options) |
343 | { |
371 | { |
344 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
372 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
345 | return CAIRO_SUBPIXEL_ORDER_DEFAULT; |
373 | return CAIRO_SUBPIXEL_ORDER_DEFAULT; |
346 | 374 | ||
347 | return options->subpixel_order; |
375 | return options->subpixel_order; |
348 | } |
376 | } |
349 | 377 | ||
350 | /** |
378 | /** |
351 | * _cairo_font_options_set_lcd_filter: |
379 | * _cairo_font_options_set_lcd_filter: |
352 | * @options: a #cairo_font_options_t |
380 | * @options: a #cairo_font_options_t |
353 | * @lcd_filter: the new LCD filter |
381 | * @lcd_filter: the new LCD filter |
354 | * |
382 | * |
355 | * Sets the LCD filter for the font options object. The LCD filter |
383 | * Sets the LCD filter for the font options object. The LCD filter |
356 | * specifies how pixels are filtered when rendered with an antialiasing |
384 | * specifies how pixels are filtered when rendered with an antialiasing |
357 | * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for |
385 | * mode of %CAIRO_ANTIALIAS_SUBPIXEL. See the documentation for |
358 | * #cairo_lcd_filter_t for full details. |
386 | * #cairo_lcd_filter_t for full details. |
359 | * |
- | |
360 | * Since: 1.8 |
- | |
361 | **/ |
387 | **/ |
362 | void |
388 | void |
363 | _cairo_font_options_set_lcd_filter (cairo_font_options_t *options, |
389 | _cairo_font_options_set_lcd_filter (cairo_font_options_t *options, |
364 | cairo_lcd_filter_t lcd_filter) |
390 | cairo_lcd_filter_t lcd_filter) |
365 | { |
391 | { |
366 | if (cairo_font_options_status (options)) |
392 | if (cairo_font_options_status (options)) |
367 | return; |
393 | return; |
368 | 394 | ||
369 | options->lcd_filter = lcd_filter; |
395 | options->lcd_filter = lcd_filter; |
370 | } |
396 | } |
371 | 397 | ||
372 | /** |
398 | /** |
373 | * _cairo_font_options_get_lcd_filter: |
399 | * _cairo_font_options_get_lcd_filter: |
374 | * @options: a #cairo_font_options_t |
400 | * @options: a #cairo_font_options_t |
375 | * |
401 | * |
376 | * Gets the LCD filter for the font options object. |
402 | * Gets the LCD filter for the font options object. |
377 | * See the documentation for #cairo_lcd_filter_t for full details. |
403 | * See the documentation for #cairo_lcd_filter_t for full details. |
378 | * |
404 | * |
379 | * Return value: the LCD filter for the font options object |
405 | * Return value: the LCD filter for the font options object |
380 | * |
- | |
381 | * Since: 1.8 |
- | |
382 | **/ |
406 | **/ |
383 | cairo_lcd_filter_t |
407 | cairo_lcd_filter_t |
384 | _cairo_font_options_get_lcd_filter (const cairo_font_options_t *options) |
408 | _cairo_font_options_get_lcd_filter (const cairo_font_options_t *options) |
385 | { |
409 | { |
386 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
410 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
387 | return CAIRO_LCD_FILTER_DEFAULT; |
411 | return CAIRO_LCD_FILTER_DEFAULT; |
388 | 412 | ||
389 | return options->lcd_filter; |
413 | return options->lcd_filter; |
390 | } |
414 | } |
391 | 415 | ||
392 | /** |
416 | /** |
- | 417 | * _cairo_font_options_set_round_glyph_positions: |
|
- | 418 | * @options: a #cairo_font_options_t |
|
- | 419 | * @round: the new rounding value |
|
- | 420 | * |
|
- | 421 | * Sets the rounding options for the font options object. If rounding is set, a |
|
- | 422 | * glyph's position will be rounded to integer values. |
|
- | 423 | **/ |
|
- | 424 | void |
|
- | 425 | _cairo_font_options_set_round_glyph_positions (cairo_font_options_t *options, |
|
- | 426 | cairo_round_glyph_positions_t round) |
|
- | 427 | { |
|
- | 428 | if (cairo_font_options_status (options)) |
|
- | 429 | return; |
|
- | 430 | ||
- | 431 | options->round_glyph_positions = round; |
|
- | 432 | } |
|
- | 433 | ||
- | 434 | /** |
|
- | 435 | * _cairo_font_options_get_round_glyph_positions: |
|
- | 436 | * @options: a #cairo_font_options_t |
|
- | 437 | * |
|
- | 438 | * Gets the glyph position rounding option for the font options object. |
|
- | 439 | * |
|
- | 440 | * Return value: The round glyph posistions flag for the font options object. |
|
- | 441 | **/ |
|
- | 442 | cairo_round_glyph_positions_t |
|
- | 443 | _cairo_font_options_get_round_glyph_positions (const cairo_font_options_t *options) |
|
- | 444 | { |
|
- | 445 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
|
- | 446 | return CAIRO_ROUND_GLYPH_POS_DEFAULT; |
|
- | 447 | ||
- | 448 | return options->round_glyph_positions; |
|
- | 449 | } |
|
- | 450 | ||
- | 451 | /** |
|
393 | * cairo_font_options_set_hint_style: |
452 | * cairo_font_options_set_hint_style: |
394 | * @options: a #cairo_font_options_t |
453 | * @options: a #cairo_font_options_t |
395 | * @hint_style: the new hint style |
454 | * @hint_style: the new hint style |
396 | * |
455 | * |
397 | * Sets the hint style for font outlines for the font options object. |
456 | * Sets the hint style for font outlines for the font options object. |
398 | * This controls whether to fit font outlines to the pixel grid, |
457 | * This controls whether to fit font outlines to the pixel grid, |
399 | * and if so, whether to optimize for fidelity or contrast. |
458 | * and if so, whether to optimize for fidelity or contrast. |
400 | * See the documentation for #cairo_hint_style_t for full details. |
459 | * See the documentation for #cairo_hint_style_t for full details. |
- | 460 | * |
|
- | 461 | * Since: 1.0 |
|
401 | **/ |
462 | **/ |
402 | void |
463 | void |
403 | cairo_font_options_set_hint_style (cairo_font_options_t *options, |
464 | cairo_font_options_set_hint_style (cairo_font_options_t *options, |
404 | cairo_hint_style_t hint_style) |
465 | cairo_hint_style_t hint_style) |
405 | { |
466 | { |
406 | if (cairo_font_options_status (options)) |
467 | if (cairo_font_options_status (options)) |
407 | return; |
468 | return; |
408 | 469 | ||
409 | options->hint_style = hint_style; |
470 | options->hint_style = hint_style; |
410 | } |
471 | } |
411 | slim_hidden_def (cairo_font_options_set_hint_style); |
472 | slim_hidden_def (cairo_font_options_set_hint_style); |
412 | 473 | ||
413 | /** |
474 | /** |
414 | * cairo_font_options_get_hint_style: |
475 | * cairo_font_options_get_hint_style: |
415 | * @options: a #cairo_font_options_t |
476 | * @options: a #cairo_font_options_t |
416 | * |
477 | * |
417 | * Gets the hint style for font outlines for the font options object. |
478 | * Gets the hint style for font outlines for the font options object. |
418 | * See the documentation for #cairo_hint_style_t for full details. |
479 | * See the documentation for #cairo_hint_style_t for full details. |
419 | * |
480 | * |
420 | * Return value: the hint style for the font options object |
481 | * Return value: the hint style for the font options object |
- | 482 | * |
|
- | 483 | * Since: 1.0 |
|
421 | **/ |
484 | **/ |
422 | cairo_hint_style_t |
485 | cairo_hint_style_t |
423 | cairo_font_options_get_hint_style (const cairo_font_options_t *options) |
486 | cairo_font_options_get_hint_style (const cairo_font_options_t *options) |
424 | { |
487 | { |
425 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
488 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
426 | return CAIRO_HINT_STYLE_DEFAULT; |
489 | return CAIRO_HINT_STYLE_DEFAULT; |
427 | 490 | ||
428 | return options->hint_style; |
491 | return options->hint_style; |
429 | } |
492 | } |
430 | 493 | ||
431 | /** |
494 | /** |
432 | * cairo_font_options_set_hint_metrics: |
495 | * cairo_font_options_set_hint_metrics: |
433 | * @options: a #cairo_font_options_t |
496 | * @options: a #cairo_font_options_t |
434 | * @hint_metrics: the new metrics hinting mode |
497 | * @hint_metrics: the new metrics hinting mode |
435 | * |
498 | * |
436 | * Sets the metrics hinting mode for the font options object. This |
499 | * Sets the metrics hinting mode for the font options object. This |
437 | * controls whether metrics are quantized to integer values in |
500 | * controls whether metrics are quantized to integer values in |
438 | * device units. |
501 | * device units. |
439 | * See the documentation for #cairo_hint_metrics_t for full details. |
502 | * See the documentation for #cairo_hint_metrics_t for full details. |
- | 503 | * |
|
- | 504 | * Since: 1.0 |
|
440 | **/ |
505 | **/ |
441 | void |
506 | void |
442 | cairo_font_options_set_hint_metrics (cairo_font_options_t *options, |
507 | cairo_font_options_set_hint_metrics (cairo_font_options_t *options, |
443 | cairo_hint_metrics_t hint_metrics) |
508 | cairo_hint_metrics_t hint_metrics) |
444 | { |
509 | { |
445 | if (cairo_font_options_status (options)) |
510 | if (cairo_font_options_status (options)) |
446 | return; |
511 | return; |
447 | 512 | ||
448 | options->hint_metrics = hint_metrics; |
513 | options->hint_metrics = hint_metrics; |
449 | } |
514 | } |
450 | slim_hidden_def (cairo_font_options_set_hint_metrics); |
515 | slim_hidden_def (cairo_font_options_set_hint_metrics); |
451 | 516 | ||
452 | /** |
517 | /** |
453 | * cairo_font_options_get_hint_metrics: |
518 | * cairo_font_options_get_hint_metrics: |
454 | * @options: a #cairo_font_options_t |
519 | * @options: a #cairo_font_options_t |
455 | * |
520 | * |
456 | * Gets the metrics hinting mode for the font options object. |
521 | * Gets the metrics hinting mode for the font options object. |
457 | * See the documentation for #cairo_hint_metrics_t for full details. |
522 | * See the documentation for #cairo_hint_metrics_t for full details. |
458 | * |
523 | * |
459 | * Return value: the metrics hinting mode for the font options object |
524 | * Return value: the metrics hinting mode for the font options object |
- | 525 | * |
|
- | 526 | * Since: 1.0 |
|
460 | **/ |
527 | **/ |
461 | cairo_hint_metrics_t |
528 | cairo_hint_metrics_t |
462 | cairo_font_options_get_hint_metrics (const cairo_font_options_t *options) |
529 | cairo_font_options_get_hint_metrics (const cairo_font_options_t *options) |
463 | { |
530 | { |
464 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
531 | if (cairo_font_options_status ((cairo_font_options_t *) options)) |
465 | return CAIRO_HINT_METRICS_DEFAULT; |
532 | return CAIRO_HINT_METRICS_DEFAULT; |
466 | 533 | ||
467 | return options->hint_metrics; |
534 | return options->hint_metrics; |
468 | }><>><>><>><> |
535 | }><>><>><>><> |