mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 18:08:03 +02:00
Change return type of _cairo_scaled_glyph_lookup to allow UNSUPPORTED.
This allows graceful recovery when first requesting a path from a font that only supports bitmapped glyph. The changed return type is also pushed down into the scaled_glyph_init function of the cairo_scaled_font backend.
This commit is contained in:
parent
0e30fc4436
commit
d2045c1f74
4 changed files with 13 additions and 7 deletions
|
|
@ -471,7 +471,7 @@ _cairo_atsui_scaled_font_init_glyph_path (cairo_atsui_font_t *scaled_font,
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
static cairo_int_status_t
|
||||
_cairo_atsui_font_scaled_glyph_init (void *abstract_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph,
|
||||
cairo_scaled_glyph_info_t info)
|
||||
|
|
|
|||
|
|
@ -1734,7 +1734,7 @@ _cairo_ft_scaled_glyph_vertical_layout_bearing_fix (FT_GlyphSlot glyph)
|
|||
}
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
static cairo_int_status_t
|
||||
_cairo_ft_scaled_glyph_init (void *abstract_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph,
|
||||
cairo_scaled_glyph_info_t info)
|
||||
|
|
@ -1932,7 +1932,7 @@ _cairo_ft_scaled_glyph_init (void *abstract_font,
|
|||
status = _decompose_glyph_outline (face, &scaled_font->base.options,
|
||||
&path);
|
||||
else
|
||||
status = CAIRO_STATUS_NO_MEMORY;
|
||||
status = CAIRO_INT_STATUS_UNSUPPORTED;
|
||||
|
||||
if (status) {
|
||||
cairo_ft_scaled_font_unlock_face (abstract_font);
|
||||
|
|
|
|||
|
|
@ -1167,8 +1167,12 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
|
|||
* %CAIRO_SCALED_GLYPH_INFO_METRICS - glyph metrics and bounding box
|
||||
* %CAIRO_SCALED_GLYPH_INFO_SURFACE - surface holding glyph image
|
||||
* %CAIRO_SCALED_GLYPH_INFO_PATH - path holding glyph outline in device space
|
||||
*
|
||||
* If the desired info is not available, (for example, when trying to
|
||||
* get INFO_PATH with a bitmapped font), this function will return
|
||||
* CAIRO_INT_STATUS_UNSUPPORTED.
|
||||
**/
|
||||
cairo_status_t
|
||||
cairo_int_status_t
|
||||
_cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
|
||||
unsigned long index,
|
||||
cairo_scaled_glyph_info_t info,
|
||||
|
|
@ -1246,7 +1250,9 @@ _cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
|
|||
|
||||
CLEANUP:
|
||||
if (status) {
|
||||
_cairo_scaled_font_set_error (scaled_font, status);
|
||||
/* It's not an error for the backend to not support the info we want. */
|
||||
if (status != CAIRO_INT_STATUS_UNSUPPORTED)
|
||||
_cairo_scaled_font_set_error (scaled_font, status);
|
||||
*scaled_glyph_ret = NULL;
|
||||
} else {
|
||||
*scaled_glyph_ret = scaled_glyph;
|
||||
|
|
|
|||
|
|
@ -528,7 +528,7 @@ struct _cairo_scaled_font_backend {
|
|||
void
|
||||
(*fini) (void *scaled_font);
|
||||
|
||||
cairo_status_t
|
||||
cairo_int_status_t
|
||||
(*scaled_glyph_init) (void *scaled_font,
|
||||
cairo_scaled_glyph_t *scaled_glyph,
|
||||
cairo_scaled_glyph_info_t info);
|
||||
|
|
@ -1598,7 +1598,7 @@ _cairo_scaled_glyph_set_path (cairo_scaled_glyph_t *scaled_glyph,
|
|||
cairo_scaled_font_t *scaled_font,
|
||||
cairo_path_fixed_t *path);
|
||||
|
||||
cairo_private cairo_status_t
|
||||
cairo_private cairo_int_status_t
|
||||
_cairo_scaled_glyph_lookup (cairo_scaled_font_t *scaled_font,
|
||||
unsigned long index,
|
||||
cairo_scaled_glyph_info_t info,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue