summaryrefslogtreecommitdiff
path: root/source/fitz/font-impl.h
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/font-impl.h
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/font-impl.h')
-rw-r--r--source/fitz/font-impl.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/source/fitz/font-impl.h b/source/fitz/font-impl.h
new file mode 100644
index 00000000..b6015172
--- /dev/null
+++ b/source/fitz/font-impl.h
@@ -0,0 +1,50 @@
+#ifndef MUPDF_FITZ_FONT_IMPL_H
+#define MUPDF_FITZ_FONT_IMPL_H
+
+#include "mupdf/fitz/font.h"
+
+/* forward declaration for circular dependency */
+struct fz_device_s;
+struct fz_display_list_s;
+
+struct fz_font_s
+{
+ int refs;
+ char name[32];
+ fz_buffer *buffer;
+
+ fz_font_flags_t flags;
+
+ void *ft_face; /* has an FT_Face if used */
+ fz_hb_t hb;
+
+ fz_matrix t3matrix;
+ void *t3resources;
+ fz_buffer **t3procs; /* has 256 entries if used */
+ struct fz_display_list_s **t3lists; /* has 256 entries if used */
+ float *t3widths; /* has 256 entries if used */
+ unsigned short *t3flags; /* has 256 entries if used */
+ void *t3doc; /* a pdf_document for the callback */
+ void (*t3run)(fz_context *ctx, void *doc, void *resources, fz_buffer *contents, struct fz_device_s *dev, const fz_matrix *ctm, void *gstate, int nestedDepth);
+ void (*t3freeres)(fz_context *ctx, void *doc, void *resources);
+
+ fz_rect bbox; /* font bbox is used only for t3 fonts */
+
+ int glyph_count;
+
+ /* per glyph bounding box cache */
+ fz_rect *bbox_table;
+
+ /* substitute metrics */
+ int width_count;
+ short width_default; /* in 1000 units */
+ short *width_table; /* in 1000 units */
+
+ /* cached glyph metrics */
+ float *advance_cache;
+
+ /* cached encoding lookup */
+ uint16_t *encoding_cache[256];
+};
+
+#endif