mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-06 21:20:25 +01:00
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.
This commit is contained in:
parent
9862c38fc7
commit
7f0029c31e
5 changed files with 29 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue