Rev 1892 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1892 | Rev 3959 | ||
---|---|---|---|
Line 47... | Line 47... | ||
47 | * |
47 | * |
48 | * The user-font feature allows the cairo user to provide drawings for glyphs |
48 | * The user-font feature allows the cairo user to provide drawings for glyphs |
49 | * in a font. This is most useful in implementing fonts in non-standard |
49 | * in a font. This is most useful in implementing fonts in non-standard |
50 | * formats, like SVG fonts and Flash fonts, but can also be used by games and |
50 | * formats, like SVG fonts and Flash fonts, but can also be used by games and |
51 | * other application to draw "funky" fonts. |
51 | * other application to draw "funky" fonts. |
52 | */ |
52 | **/ |
Line 53... | Line 53... | ||
53 | 53 | ||
54 | /** |
54 | /** |
55 | * CAIRO_HAS_USER_FONT: |
55 | * CAIRO_HAS_USER_FONT: |
56 | * |
56 | * |
57 | * Defined if the user font backend is available. |
57 | * Defined if the user font backend is available. |
58 | * This macro can be used to conditionally compile backend-specific code. |
58 | * This macro can be used to conditionally compile backend-specific code. |
59 | * The user font backend is always built in versions of cairo that support |
59 | * The user font backend is always built in versions of cairo that support |
60 | * this feature (1.8 and later). |
60 | * this feature (1.8 and later). |
61 | * |
61 | * |
62 | * @Since: 1.8 |
62 | * Since: 1.8 |
Line 63... | Line 63... | ||
63 | */ |
63 | **/ |
64 | 64 | ||
65 | typedef struct _cairo_user_scaled_font_methods { |
65 | typedef struct _cairo_user_scaled_font_methods { |
66 | cairo_user_scaled_font_init_func_t init; |
66 | cairo_user_scaled_font_init_func_t init; |
Line 156... | Line 156... | ||
156 | if (!_cairo_matrix_is_scale_0 (&scaled_font->base.scale)) { |
156 | if (!_cairo_matrix_is_scale_0 (&scaled_font->base.scale)) { |
157 | cr = _cairo_user_scaled_font_create_recording_context (scaled_font, recording_surface); |
157 | cr = _cairo_user_scaled_font_create_recording_context (scaled_font, recording_surface); |
158 | status = face->scaled_font_methods.render_glyph ((cairo_scaled_font_t *)scaled_font, |
158 | status = face->scaled_font_methods.render_glyph ((cairo_scaled_font_t *)scaled_font, |
159 | _cairo_scaled_glyph_index(scaled_glyph), |
159 | _cairo_scaled_glyph_index(scaled_glyph), |
160 | cr, &extents); |
160 | cr, &extents); |
161 | if (status == CAIRO_STATUS_SUCCESS) |
161 | if (status == CAIRO_INT_STATUS_SUCCESS) |
162 | status = cairo_status (cr); |
162 | status = cairo_status (cr); |
Line 163... | Line 163... | ||
163 | 163 | ||
Line 164... | Line 164... | ||
164 | cairo_destroy (cr); |
164 | cairo_destroy (cr); |
Line 227... | Line 227... | ||
227 | _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.y); |
227 | _cairo_fixed_integer_floor (scaled_glyph->bbox.p1.y); |
Line 228... | Line 228... | ||
228 | 228 | ||
229 | switch (scaled_font->base.options.antialias) { |
229 | switch (scaled_font->base.options.antialias) { |
230 | default: |
230 | default: |
- | 231 | case CAIRO_ANTIALIAS_DEFAULT: |
|
- | 232 | case CAIRO_ANTIALIAS_FAST: |
|
231 | case CAIRO_ANTIALIAS_DEFAULT: |
233 | case CAIRO_ANTIALIAS_GOOD: |
232 | case CAIRO_ANTIALIAS_GRAY: format = CAIRO_FORMAT_A8; break; |
234 | case CAIRO_ANTIALIAS_GRAY: format = CAIRO_FORMAT_A8; break; |
- | 235 | case CAIRO_ANTIALIAS_NONE: format = CAIRO_FORMAT_A1; break; |
|
233 | case CAIRO_ANTIALIAS_NONE: format = CAIRO_FORMAT_A1; break; |
236 | case CAIRO_ANTIALIAS_BEST: |
234 | case CAIRO_ANTIALIAS_SUBPIXEL: format = CAIRO_FORMAT_ARGB32; break; |
237 | case CAIRO_ANTIALIAS_SUBPIXEL: format = CAIRO_FORMAT_ARGB32; break; |
235 | } |
238 | } |
Line 236... | Line 239... | ||
236 | surface = cairo_image_surface_create (format, width, height); |
239 | surface = cairo_image_surface_create (format, width, height); |
Line 326... | Line 329... | ||
326 | status = face->scaled_font_methods.text_to_glyphs (&scaled_font->base, |
329 | status = face->scaled_font_methods.text_to_glyphs (&scaled_font->base, |
327 | utf8, utf8_len, |
330 | utf8, utf8_len, |
328 | glyphs, num_glyphs, |
331 | glyphs, num_glyphs, |
329 | clusters, num_clusters, cluster_flags); |
332 | clusters, num_clusters, cluster_flags); |
Line 330... | Line 333... | ||
330 | 333 | ||
331 | if (status != CAIRO_STATUS_SUCCESS && |
334 | if (status != CAIRO_INT_STATUS_SUCCESS && |
332 | status != CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED) |
335 | status != CAIRO_INT_STATUS_USER_FONT_NOT_IMPLEMENTED) |
Line 333... | Line 336... | ||
333 | return status; |
336 | return status; |
- | 337 | ||
334 | 338 | if (status == CAIRO_INT_STATUS_USER_FONT_NOT_IMPLEMENTED || |
|
335 | if (status == CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED || *num_glyphs < 0) { |
339 | *num_glyphs < 0) { |
336 | if (orig_glyphs != *glyphs) { |
340 | if (orig_glyphs != *glyphs) { |
337 | cairo_glyph_free (*glyphs); |
341 | cairo_glyph_free (*glyphs); |
338 | *glyphs = orig_glyphs; |
342 | *glyphs = orig_glyphs; |