mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-05 02:58:02 +02:00
[ft] Restore the ability to lazily resolve patterns.
I broke the ability for the ft font backend to resolve patterns whilst fixing the font creation to propagate the error status from fontconfig (be27e8). By adjusting the sequence of error checks we do not confuse the absence of a match with a fatal error and thereby restoring the lazy pattern resolution whilst ensuring error propagation.
This commit is contained in:
parent
a352fd4602
commit
d6f6ec9082
1 changed files with 17 additions and 15 deletions
|
|
@ -482,24 +482,26 @@ _cairo_ft_unscaled_font_create_for_pattern (FcPattern *pattern,
|
|||
FcResult ret;
|
||||
|
||||
ret = FcPatternGetFTFace (pattern, FC_FT_FACE, 0, &font_face);
|
||||
switch ((int) ret) {
|
||||
case FcResultMatch:
|
||||
if (ret == FcResultMatch)
|
||||
goto DONE;
|
||||
if (ret == FcResultOutOfMemory)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
ret = FcPatternGetString (pattern, FC_FILE, 0, (FcChar8 **) &filename);
|
||||
if (ret == FcResultOutOfMemory)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
if (ret == FcResultMatch) {
|
||||
/* If FC_INDEX is not set, we just use 0 */
|
||||
ret = FcPatternGetInteger (pattern, FC_INDEX, 0, &id);
|
||||
if (ret == FcResultOutOfMemory)
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
|
||||
goto DONE;
|
||||
case FcResultOutOfMemory:
|
||||
break;
|
||||
default:
|
||||
if (FcPatternGetString (pattern, FC_FILE, 0,
|
||||
(FcChar8 **) &filename) == FcResultMatch)
|
||||
{
|
||||
/* If FC_INDEX is not set, we just use 0 */
|
||||
if (FcPatternGetInteger (pattern,
|
||||
FC_INDEX, 0, &id) != FcResultOutOfMemory)
|
||||
goto DONE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return _cairo_error (CAIRO_STATUS_NO_MEMORY);
|
||||
/* The pattern contains neither a face nor a filename, resolve it later. */
|
||||
*out = NULL;
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
|
||||
DONE:
|
||||
return _cairo_ft_unscaled_font_create_internal (font_face != NULL,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue