summaryrefslogtreecommitdiff
path: root/include/mupdf/fitz/font.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 /include/mupdf/fitz/font.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 'include/mupdf/fitz/font.h')
-rw-r--r--include/mupdf/fitz/font.h58
1 files changed, 18 insertions, 40 deletions
diff --git a/include/mupdf/fitz/font.h b/include/mupdf/fitz/font.h
index 2547e7a0..69959908 100644
--- a/include/mupdf/fitz/font.h
+++ b/include/mupdf/fitz/font.h
@@ -6,6 +6,9 @@
#include "mupdf/fitz/math.h"
#include "mupdf/fitz/buffer.h"
+/* forward declaration for circular dependency */
+struct fz_device_s;
+
/*
An abstract font handle. Currently there are no public API functions
for handling these.
@@ -20,16 +23,11 @@ typedef struct fz_font_s fz_font;
char *ft_error_string(int err);
-/* forward declaration for circular dependency */
-struct fz_device_s;
-struct fz_display_list_s;
+/* common CJK font collections */
+enum { FZ_ADOBE_CNS_1, FZ_ADOBE_GB_1, FZ_ADOBE_JAPAN_1, FZ_ADOBE_KOREA_1 };
-struct fz_font_s
+typedef struct
{
- int refs;
- char name[32];
- fz_buffer *buffer;
-
unsigned int is_mono : 1;
unsigned int is_serif : 1;
unsigned int is_bold : 1;
@@ -43,42 +41,22 @@ struct fz_font_s
unsigned int has_opentype : 1; /* has opentype shaping tables */
unsigned int invalid_bbox : 1;
unsigned int use_glyph_bbox : 1;
+} fz_font_flags_t;
- void *ft_face; /* has an FT_Face if used */
- void *hb_font; /* hb_font for shaping */
- void (*hb_destroy)(void *); /* Destructor for hb_font */
+fz_font_flags_t *fz_font_flags(fz_font *font);
- 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;
+typedef struct
+{
+ void *font; /* hb_font for shaping */
+ void (*destroy)(void *); /* Destructor for hb_font */
+} fz_hb_t;
- /* cached encoding lookup */
- uint16_t *encoding_cache[256];
-};
+fz_hb_t *fz_font_hb(fz_font *font);
-/* common CJK font collections */
-enum { FZ_ADOBE_CNS_1, FZ_ADOBE_GB_1, FZ_ADOBE_JAPAN_1, FZ_ADOBE_KOREA_1 };
+const char *fz_font_name(fz_font *font);
+void *fz_font_ft_face(fz_font *font);
+fz_buffer **fz_font_t3_procs(fz_font *font);
+fz_rect *fz_font_bbox(fz_font *font);
void fz_new_font_context(fz_context *ctx);
fz_font_context *fz_keep_font_context(fz_context *ctx);