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/stext-device.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source/fitz/stext-device.c') diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c index 909d0a46..88a9f669 100644 --- a/source/fitz/stext-device.c +++ b/source/fitz/stext-device.c @@ -784,7 +784,9 @@ static void fz_stext_extract(fz_context *ctx, fz_stext_device *dev, fz_text_span *span, const fz_matrix *ctm, fz_stext_style *style) { fz_font *font = span->font; - FT_Face face = font->ft_face; + FT_Face face = fz_font_ft_face(font); + fz_buffer **t3procs = fz_font_t3_procs(font); + fz_rect *bbox = fz_font_bbox(font); fz_matrix tm = span->trm; fz_matrix trm; float adv; @@ -800,26 +802,26 @@ fz_stext_extract(fz_context *ctx, fz_stext_device *dev, fz_text_span *span, cons if (style->wmode == 0) { - if (font->ft_face) + if (face) { fz_lock(ctx, FZ_LOCK_FREETYPE); - err = FT_Set_Char_Size(font->ft_face, 64, 64, 72, 72); + err = FT_Set_Char_Size(face, 64, 64, 72, 72); if (err) fz_warn(ctx, "freetype set character size: %s", ft_error_string(err)); ascender = (float)face->ascender / face->units_per_EM; descender = (float)face->descender / face->units_per_EM; fz_unlock(ctx, FZ_LOCK_FREETYPE); } - else if (font->t3procs && !fz_is_empty_rect(&font->bbox)) + else if (t3procs && !fz_is_empty_rect(bbox)) { - ascender = font->bbox.y1; - descender = font->bbox.y0; + ascender = bbox->y1; + descender = bbox->y0; } } else { - ascender = font->bbox.x1; - descender = font->bbox.x0; + ascender = bbox->x1; + descender = bbox->x0; } style->ascender = ascender; style->descender = descender; -- cgit v1.2.3