summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Johnson <ajohnson@redneon.com>2010-11-22 22:46:54 +1030
committerAdrian Johnson <ajohnson@redneon.com>2010-11-23 00:13:24 +1030
commit7f0029c31e15dfd34f57bdeca18f27e9e7b8f9aa (patch)
tree938c9f43154eb1d43f7c0ffdaf2e1aba51fac0b1
parent9862c38fc71c6dcd444da3b079e5404cd14594c3 (diff)
Use fallback font for synthetic fonts
If the font has been synthesized we can't use the native subsetters as the outlines won't be the same. Instead force the use of the fallback subsetters so the synthesized outlines will used to generate the font.
-rw-r--r--src/cairo-cff-subset.c4
-rw-r--r--src/cairo-ft-font.c14
-rw-r--r--src/cairo-truetype-subset.c4
-rw-r--r--src/cairo-type1-subset.c5
-rw-r--r--src/cairoint.h3
5 files changed, 29 insertions, 1 deletions
diff --git a/src/cairo-cff-subset.c b/src/cairo-cff-subset.c
index f2ec37426..a01d55eb5 100644
--- a/src/cairo-cff-subset.c
+++ b/src/cairo-cff-subset.c
@@ -1906,6 +1906,10 @@ _cairo_cff_font_create (cairo_scaled_font_subset_t *scaled_font_subset,
if (!backend->load_truetype_table)
return CAIRO_INT_STATUS_UNSUPPORTED;
+ /* We need to use a fallback font generated from the synthesized outlines. */
+ if (backend->is_synthetic (scaled_font_subset->scaled_font))
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
data_length = 0;
status = backend->load_truetype_table( scaled_font_subset->scaled_font,
TT_TAG_CFF, 0, NULL, &data_length);
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 67eb2758e..054da2523 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
@@ -2418,6 +2418,17 @@ _cairo_ft_index_to_ucs4(void *abstract_font,
return CAIRO_STATUS_SUCCESS;
}
+static cairo_bool_t
+_cairo_ft_is_synthetic (void *abstract_font)
+{
+ cairo_ft_scaled_font_t *scaled_font = abstract_font;
+
+ if (scaled_font->ft_options.extra_flags & CAIRO_FT_OPTIONS_EMBOLDEN)
+ return TRUE;
+ else
+ return FALSE;
+}
+
static const cairo_scaled_font_backend_t _cairo_ft_scaled_font_backend = {
CAIRO_FONT_TYPE_FT,
_cairo_ft_scaled_font_fini,
@@ -2426,7 +2437,8 @@ static const cairo_scaled_font_backend_t _cairo_ft_scaled_font_backend = {
_cairo_ft_ucs4_to_index,
NULL, /* show_glyphs */
_cairo_ft_load_truetype_table,
- _cairo_ft_index_to_ucs4
+ _cairo_ft_index_to_ucs4,
+ _cairo_ft_is_synthetic
};
/* #cairo_ft_font_face_t */
diff --git a/src/cairo-truetype-subset.c b/src/cairo-truetype-subset.c
index 55f97b004..7777996a8 100644
--- a/src/cairo-truetype-subset.c
+++ b/src/cairo-truetype-subset.c
@@ -156,6 +156,10 @@ _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 (scaled_font_subset->scaled_font))
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
size = sizeof (tt_head_t);
status = backend->load_truetype_table (scaled_font_subset->scaled_font,
TT_TAG_head, 0,
diff --git a/src/cairo-type1-subset.c b/src/cairo-type1-subset.c
index f619d7401..e0b1bf8a2 100644
--- a/src/cairo-type1-subset.c
+++ b/src/cairo-type1-subset.c
@@ -1151,6 +1151,11 @@ _cairo_type1_subset_init (cairo_type1_subset_t *type1_subset,
if (_cairo_ft_scaled_font_is_vertical (scaled_font_subset->scaled_font))
return CAIRO_INT_STATUS_UNSUPPORTED;
+ /* We need to use a fallback font generated from the synthesized outlines. */
+ if (scaled_font_subset->scaled_font->backend->is_synthetic &&
+ scaled_font_subset->scaled_font->backend->is_synthetic (scaled_font_subset->scaled_font))
+ return CAIRO_INT_STATUS_UNSUPPORTED;
+
unscaled_font = _cairo_ft_scaled_font_get_unscaled_font (scaled_font_subset->scaled_font);
status = _cairo_type1_font_subset_init (&font, unscaled_font, scaled_font_subset, hex_encode);
diff --git a/src/cairoint.h b/src/cairoint.h
index e2946cf84..5a435618f 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -515,6 +515,9 @@ struct _cairo_scaled_font_backend {
(*index_to_ucs4)(void *scaled_font,
unsigned long index,
uint32_t *ucs4);
+
+ cairo_warn cairo_bool_t
+ (*is_synthetic)(void *scaled_font);
};
struct _cairo_font_face_backend {