summaryrefslogtreecommitdiff
path: root/source/fitz/stext-device.c
diff options
context:
space:
mode:
authorRobin Watts <Robin.Watts@artifex.com>2016-09-28 16:46:10 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-05 19:37:11 +0100
commit9e88b088ea2ddcb6f85584750eb3c989af101905 (patch)
tree19db41ec596cc347fd1b77389821135f8e934e84 /source/fitz/stext-device.c
parent14109acf198d9371a4e2cb09ea4a125af67d441d (diff)
downloadmupdf-9e88b088ea2ddcb6f85584750eb3c989af101905.tar.xz
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.
Diffstat (limited to 'source/fitz/stext-device.c')
-rw-r--r--source/fitz/stext-device.c18
1 files changed, 10 insertions, 8 deletions
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;