summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-19 12:35:00 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 17:07:36 +0100
commit958f7ab1238b8242975d3ea774c26d23e090e70c (patch)
tree32957604564cf503181634ee03528d8c7fab6ec4 /util
parent87175334a574fa0f69679b1a0baeeb881eaa439b (diff)
[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
Diffstat (limited to 'util')
-rw-r--r--util/cairo-script/cairo-script-operators.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c
index a11c7c60..414922de 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -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);