mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 00:38:06 +02:00
Change scaled_font_subsets_callback to have return type of void.
The return of status from this callback was misleading. The function actually calling the callback was also a hash table callback function, which itself is void---so any status value returned was being lost. Instead, we now stash any errors that occur during the fallback into surface->status.
This commit is contained in:
parent
f500cef19f
commit
e2c03d51da
3 changed files with 26 additions and 31 deletions
|
|
@ -211,7 +211,7 @@ _cairo_ps_surface_emit_header (cairo_ps_surface_t *surface)
|
|||
}
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
static void
|
||||
_cairo_ps_surface_emit_glyph (cairo_ps_surface_t *surface,
|
||||
cairo_scaled_font_t *scaled_font,
|
||||
unsigned long scaled_font_glyph_index,
|
||||
|
|
@ -220,9 +220,6 @@ _cairo_ps_surface_emit_glyph (cairo_ps_surface_t *surface,
|
|||
cairo_scaled_glyph_t *scaled_glyph;
|
||||
cairo_status_t status;
|
||||
|
||||
_cairo_output_stream_printf (surface->final_stream,
|
||||
"\t\t{ %% %d\n", subset_glyph_index);
|
||||
|
||||
status = _cairo_scaled_glyph_lookup (scaled_font,
|
||||
scaled_font_glyph_index,
|
||||
CAIRO_SCALED_GLYPH_INFO_METRICS|
|
||||
|
|
@ -238,13 +235,16 @@ _cairo_ps_surface_emit_glyph (cairo_ps_surface_t *surface,
|
|||
CAIRO_SCALED_GLYPH_INFO_SURFACE,
|
||||
&scaled_glyph);
|
||||
if (status) {
|
||||
_cairo_output_stream_printf (surface->final_stream, "\t\t}\n");
|
||||
return status;
|
||||
_cairo_surface_set_error (&surface->base, status);
|
||||
return;
|
||||
}
|
||||
|
||||
/* XXX: Need to actually use the image not the path if that's all
|
||||
* we could get... */
|
||||
|
||||
_cairo_output_stream_printf (surface->final_stream,
|
||||
"\t\t{ %% %d\n", subset_glyph_index);
|
||||
|
||||
_cairo_output_stream_printf (surface->final_stream,
|
||||
"%f %f %f %f 0 0 setcachedevice\n",
|
||||
_cairo_fixed_to_double (scaled_glyph->bbox.p1.x),
|
||||
|
|
@ -265,10 +265,9 @@ _cairo_ps_surface_emit_glyph (cairo_ps_surface_t *surface,
|
|||
|
||||
_cairo_output_stream_printf (surface->final_stream,
|
||||
"\t\t}\n");
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
static void
|
||||
_cairo_ps_surface_emit_font_subset (cairo_scaled_font_subset_t *font_subset,
|
||||
void *closure)
|
||||
{
|
||||
|
|
@ -303,22 +302,23 @@ _cairo_ps_surface_emit_font_subset (cairo_scaled_font_subset_t *font_subset,
|
|||
"\t\texch get exec\n"
|
||||
"\t}\n"
|
||||
">> definefont pop\n");
|
||||
|
||||
return _cairo_output_stream_get_status (surface->final_stream);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static cairo_status_t
|
||||
_cairo_ps_surface_emit_font_subsets (cairo_ps_surface_t *surface)
|
||||
{
|
||||
cairo_status_t status;
|
||||
|
||||
_cairo_output_stream_printf (surface->final_stream,
|
||||
"%% _cairo_ps_surface_emit_font_subsets\n");
|
||||
|
||||
_cairo_scaled_font_subsets_foreach (surface->font_subsets,
|
||||
_cairo_ps_surface_emit_font_subset,
|
||||
surface);
|
||||
status = _cairo_scaled_font_subsets_foreach (surface->font_subsets,
|
||||
_cairo_ps_surface_emit_font_subset,
|
||||
surface);
|
||||
_cairo_scaled_font_subsets_destroy (surface->font_subsets);
|
||||
surface->font_subsets = NULL;
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@ _cairo_scaled_font_subsets_map_glyph (cairo_scaled_font_subsets_t *font_subsets,
|
|||
unsigned int *subset_id_ret,
|
||||
unsigned int *subset_glyph_index_ret);
|
||||
|
||||
typedef cairo_status_t
|
||||
typedef void
|
||||
(*cairo_scaled_font_subset_callback_func_t) (cairo_scaled_font_subset_t *font_subset,
|
||||
void *closure);
|
||||
|
||||
|
|
|
|||
|
|
@ -545,7 +545,7 @@ _cairo_svg_path_close_path (void *closure)
|
|||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
static void
|
||||
_cairo_svg_document_emit_glyph (cairo_svg_document_t *document,
|
||||
cairo_scaled_font_t *scaled_font,
|
||||
unsigned long scaled_font_glyph_index,
|
||||
|
|
@ -572,8 +572,10 @@ _cairo_svg_document_emit_glyph (cairo_svg_document_t *document,
|
|||
CAIRO_SCALED_GLYPH_INFO_METRICS|
|
||||
CAIRO_SCALED_GLYPH_INFO_SURFACE,
|
||||
&scaled_glyph);
|
||||
if (status)
|
||||
return status;
|
||||
if (status) {
|
||||
_cairo_surface_set_error (document->owner, status);
|
||||
return;
|
||||
}
|
||||
|
||||
info.document = document;
|
||||
info.path = xmlBufferCreate ();
|
||||
|
|
@ -597,28 +599,21 @@ _cairo_svg_document_emit_glyph (cairo_svg_document_t *document,
|
|||
xmlSetProp (child, CC2XML ("style"), CC2XML ("stroke: none;"));
|
||||
|
||||
xmlBufferFree (info.path);
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static cairo_status_t
|
||||
static void
|
||||
_cairo_svg_document_emit_font_subset (cairo_scaled_font_subset_t *font_subset,
|
||||
void *closure)
|
||||
{
|
||||
cairo_svg_document_t *document = closure;
|
||||
cairo_status_t status;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < font_subset->num_glyphs; i++) {
|
||||
status = _cairo_svg_document_emit_glyph (document,
|
||||
font_subset->scaled_font,
|
||||
font_subset->glyphs[i],
|
||||
font_subset->font_id, i);
|
||||
if (status)
|
||||
return status;
|
||||
_cairo_svg_document_emit_glyph (document,
|
||||
font_subset->scaled_font,
|
||||
font_subset->glyphs[i],
|
||||
font_subset->font_id, i);
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue