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/fitz/draw-glyph.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'source/fitz/draw-glyph.c') diff --git a/source/fitz/draw-glyph.c b/source/fitz/draw-glyph.c index dbaace9e..93bd62b3 100644 --- a/source/fitz/draw-glyph.c +++ b/source/fitz/draw-glyph.c @@ -175,7 +175,7 @@ fz_subpixel_adjust(fz_context *ctx, fz_matrix *ctm, fz_matrix *subpix_ctm, unsig fz_glyph * fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *stroke, const fz_irect *scissor) { - if (font->ft_face) + if (fz_font_ft_face(font)) { fz_matrix subpix_trm; unsigned char qe, qf; @@ -191,7 +191,7 @@ fz_render_stroked_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, fz_pixmap * fz_render_stroked_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm, const fz_matrix *ctm, const fz_stroke_state *stroke, const fz_irect *scissor) { - if (font->ft_face) + if (fz_font_ft_face(font)) { fz_matrix subpix_trm; unsigned char qe, qf; @@ -252,6 +252,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo int do_cache, locked, caching; fz_glyph_cache_entry *entry; unsigned hash; + int is_ft_font = !!fz_font_ft_face(font); fz_var(locked); fz_var(caching); @@ -266,7 +267,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo } else { - if (font->ft_face) + if (is_ft_font) return NULL; subpix_scissor.x0 = scissor->x0 - floorf(ctm->e); subpix_scissor.y0 = scissor->y0 - floorf(ctm->f); @@ -307,11 +308,11 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo fz_try(ctx) { - if (font->ft_face) + if (is_ft_font) { val = fz_render_ft_glyph(ctx, font, gid, &subpix_ctm, key.aa); } - else if (font->t3procs) + else if (fz_font_t3_procs(font)) { /* We drop the glyphcache here, and execute the t3 * glyph code. The danger here is that some other @@ -339,7 +340,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, fz_colo /* If we throw an exception whilst caching, * just ignore the exception and carry on. */ caching = 1; - if (!font->ft_face) + if (!is_ft_font) { /* We had to unlock. Someone else might * have rendered in the meantime */ @@ -413,6 +414,7 @@ fz_render_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, unsigned char qe, qf; fz_matrix subpix_ctm; float size = fz_subpixel_adjust(ctx, ctm, &subpix_ctm, &qe, &qf); + int is_ft_font = !!fz_font_ft_face(font); if (size <= MAX_GLYPH_SIZE) { @@ -420,17 +422,17 @@ fz_render_glyph_pixmap(fz_context *ctx, fz_font *font, int gid, fz_matrix *ctm, } else { - if (font->ft_face) + if (is_ft_font) return NULL; } fz_try(ctx) { - if (font->ft_face) + if (is_ft_font) { val = fz_render_ft_glyph_pixmap(ctx, font, gid, &subpix_ctm, fz_text_aa_level(ctx)); } - else if (font->t3procs) + else if (fz_font_t3_procs(font)) { val = fz_render_t3_glyph_pixmap(ctx, font, gid, &subpix_ctm, NULL, scissor); } -- cgit v1.2.3