mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 04:58:04 +02:00
[script] Support running on cairo-1.8
Pre 1.9 the application had to pass a resolved font to cairo -- so do so in the interpreter if the cairo version is less than 1.9
This commit is contained in:
parent
87175334a5
commit
958f7ab123
1 changed files with 15 additions and 3 deletions
|
|
@ -1854,7 +1854,7 @@ _ft_create_for_pattern (csi_t *ctx,
|
|||
struct _ft_face_data *data;
|
||||
csi_list_t *link;
|
||||
cairo_font_face_t *font_face;
|
||||
FcPattern *pattern;
|
||||
FcPattern *pattern, *resolved;
|
||||
csi_status_t status;
|
||||
struct mmap_vec vec;
|
||||
void *bytes;
|
||||
|
|
@ -1881,8 +1881,20 @@ _ft_create_for_pattern (csi_t *ctx,
|
|||
if (bytes != tmpl.bytes)
|
||||
_csi_free (ctx, bytes);
|
||||
|
||||
font_face = cairo_ft_font_face_create_for_pattern (pattern);
|
||||
FcPatternDestroy (pattern);
|
||||
resolved = pattern;
|
||||
if (cairo_version () < CAIRO_VERSION_ENCODE (1, 9, 0)) {
|
||||
/* prior to 1.9, you needed to pass a resolved pattern */
|
||||
resolved = FcFontMatch (NULL, pattern, NULL);
|
||||
if (_csi_unlikely (resolved == NULL)) {
|
||||
FcPatternDestroy (resolved);
|
||||
return _csi_error (CSI_STATUS_NO_MEMORY);
|
||||
}
|
||||
}
|
||||
|
||||
font_face = cairo_ft_font_face_create_for_pattern (resolved);
|
||||
FcPatternDestroy (resolved);
|
||||
if (resolved != pattern)
|
||||
FcPatternDestroy (pattern);
|
||||
|
||||
data = _csi_slab_alloc (ctx, sizeof (*data));
|
||||
ctx->_faces = _csi_list_prepend (ctx->_faces, &data->blob.list);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue