diff options
author | Adrian Johnson <ajohnson@redneon.com> | 2017-05-28 09:07:54 +0930 |
---|---|---|
committer | Adrian Johnson <ajohnson@redneon.com> | 2017-05-28 09:12:56 +0930 |
commit | 0fd0fd0ae9ad8cfb177bb844091de98c0235917e (patch) | |
tree | 1570ecf38862c45b9fedb2c8b796102a2c3d5383 /src/cairo-truetype-subset.c | |
parent | 9d44136ef8e2a1ad2c6631beb4bbdaeed7a2dad8 (diff) | |
download | cairo-0fd0fd0ae9ad8cfb177bb844091de98c0235917e.tar.gz |
subsetting: support variable fonts
If the font is a non default variant, fallback to creating a font from
the outlines.
Diffstat (limited to 'src/cairo-truetype-subset.c')
-rw-r--r-- | src/cairo-truetype-subset.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c index afd396e1b..62902cf7a 100644 --- a/src/cairo-truetype-subset.c +++ b/src/cairo-truetype-subset.c @@ -138,6 +138,7 @@ _cairo_truetype_font_create (cairo_scaled_font_subset_t *scaled_font_subset, cairo_truetype_font_t **font_return) { cairo_status_t status; + cairo_bool_t is_synthetic; cairo_truetype_font_t *font; const cairo_scaled_font_backend_t *backend; tt_head_t head; @@ -158,9 +159,15 @@ _cairo_truetype_font_create (cairo_scaled_font_subset_t *scaled_font_subset, * return CAIRO_INT_STATUS_UNSUPPORTED; */ - /* We need to use a fallback font generated from the synthesized outlines. */ - if (backend->is_synthetic && backend->is_synthetic (scaled_font_subset->scaled_font)) - return CAIRO_INT_STATUS_UNSUPPORTED; + /* We need to use a fallback font if this font differs from the glyf outlines. */ + if (backend->is_synthetic) { + status = backend->is_synthetic (scaled_font_subset->scaled_font, &is_synthetic); + if (unlikely (status)) + return status; + + if (is_synthetic) + return CAIRO_INT_STATUS_UNSUPPORTED; + } size = sizeof (tt_head_t); status = backend->load_truetype_table (scaled_font_subset->scaled_font, |