mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-07 16:00:24 +01:00
[cairo-ft-font] Remove erroneous cached font faces.
Only return a font face from the cache if it is not in an error condition. Otherwise unlink the bad font face from the cache and construct a new one.
This commit is contained in:
parent
f382c3e110
commit
c175cf7b83
1 changed files with 11 additions and 4 deletions
|
|
@ -2221,17 +2221,24 @@ static cairo_font_face_t *
|
|||
_cairo_ft_font_face_create (cairo_ft_unscaled_font_t *unscaled,
|
||||
cairo_ft_options_t *ft_options)
|
||||
{
|
||||
cairo_ft_font_face_t *font_face;
|
||||
cairo_ft_font_face_t *font_face, **prev_font_face;
|
||||
|
||||
/* Looked for an existing matching font face */
|
||||
for (font_face = unscaled->faces;
|
||||
for (font_face = unscaled->faces, prev_font_face = &unscaled->faces;
|
||||
font_face;
|
||||
font_face = font_face->next)
|
||||
prev_font_face = &font_face->next, font_face = font_face->next)
|
||||
{
|
||||
if (font_face->ft_options.load_flags == ft_options->load_flags &&
|
||||
font_face->ft_options.extra_flags == ft_options->extra_flags &&
|
||||
cairo_font_options_equal (&font_face->ft_options.base, &ft_options->base))
|
||||
return cairo_font_face_reference (&font_face->base);
|
||||
{
|
||||
if (! font_face->base.status)
|
||||
return cairo_font_face_reference (&font_face->base);
|
||||
|
||||
/* The font_face has been left in an error state, abandon it. */
|
||||
*prev_font_face = font_face->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* No match found, create a new one */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue