From 9e88b088ea2ddcb6f85584750eb3c989af101905 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Wed, 28 Sep 2016 16:46:10 +0100 Subject: Move fz_font definition to be private. Move the definition of fz_font to be in a private header file rather than in the public API. Add accessors for specific parts of the structure and use them as appropriate. The font flags, and the harfbuzz records remain public. This means that only 3 files now need access to the font implementation (font.c, pdf-font.c and pdf-type3.c). This may be able to be improved further in future. --- source/html/html-font.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'source/html/html-font.c') diff --git a/source/html/html-font.c b/source/html/html-font.c index 3b8f7c72..01ec10f5 100644 --- a/source/html/html-font.c +++ b/source/html/html-font.c @@ -19,7 +19,7 @@ fz_load_html_default_font(fz_context *ctx, fz_html_font_set *set, const char *fa if (!data) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot load html font: %s", real_family); set->fonts[idx] = fz_new_font_from_memory(ctx, NULL, data, size, 0, 1); - set->fonts[idx]->is_serif = !is_sans; + fz_font_flags(set->fonts[idx])->is_serif = !is_sans; } return set->fonts[idx]; } @@ -60,10 +60,11 @@ fz_load_html_font(fz_context *ctx, fz_html_font_set *set, const char *family, in if (data) { fz_font *font = fz_new_font_from_memory(ctx, NULL, data, size, 0, 0); - if (is_bold && !font->is_bold) - font->fake_bold = 1; - if (is_italic && !font->is_italic) - font->fake_italic = 1; + fz_font_flags_t *flags = fz_font_flags(font); + if (is_bold && !flags->is_bold) + flags->fake_bold = 1; + if (is_italic && !flags->is_italic) + flags->fake_italic = 1; fz_add_html_font_face(ctx, set, family, is_bold, is_italic, "", font); fz_drop_font(ctx, font); return font; -- cgit v1.2.3