diff options
author | Tor Andersson <tor@ghostscript.com> | 2009-02-28 16:26:56 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2009-02-28 16:26:56 +0100 |
commit | de55e619b33ef2e59fdabdb060add37b2da76aa4 (patch) | |
tree | 3965a5cacc03356113066b68b59c45076c3b4b1d /include | |
parent | f744dace3f0f91b8505979bf244453c9ec713b4b (diff) | |
download | mupdf-de55e619b33ef2e59fdabdb060add37b2da76aa4.tar.xz |
Pre-compile the standard CMaps into c-structs instead of parsing them at runtime.
Diffstat (limited to 'include')
-rw-r--r-- | include/fitz.h | 5 | ||||
-rw-r--r-- | include/mupdf.h | 17 | ||||
-rw-r--r-- | include/mupdf/rsrc.h | 46 |
3 files changed, 42 insertions, 26 deletions
diff --git a/include/fitz.h b/include/fitz.h index 47e7eeb8..f9705740 100644 --- a/include/fitz.h +++ b/include/fitz.h @@ -1,6 +1,4 @@ -#ifdef _FITZ_H_ -#error "fitz.h must only be included once" -#endif +#ifndef _FITZ_H_ #define _FITZ_H_ #include "fitz-base.h" @@ -8,3 +6,4 @@ #include "fitz-world.h" #include "fitz-draw.h" +#endif diff --git a/include/mupdf.h b/include/mupdf.h index 86b9a6c9..07acde71 100644 --- a/include/mupdf.h +++ b/include/mupdf.h @@ -1,18 +1,8 @@ -#ifdef _MUPDF_H_ -#error "mupdf.h must only be included once" -#endif +#ifndef _MUPDF_H_ #define _MUPDF_H_ -#ifndef _FITZ_BASE_H_ -#error "fitz-base.h must be included before mupdf.h" -#endif - -#ifndef _FITZ_STREAM_H_ -#error "fitz-stream.h must be included before mupdf.h" -#endif - -#ifndef _FITZ_WORLD_H_ -#error "fitz-world.h must be included before mupdf.h" +#ifndef _FITZ_H_ +#error "fitz.h must be included before mupdf.h" #endif void pdf_logxref(char *fmt, ...); @@ -29,3 +19,4 @@ void pdf_logpage(char *fmt, ...); #include "mupdf/annot.h" #include "mupdf/page.h" +#endif diff --git a/include/mupdf/rsrc.h b/include/mupdf/rsrc.h index 738919b4..f4e7717c 100644 --- a/include/mupdf/rsrc.h +++ b/include/mupdf/rsrc.h @@ -147,16 +147,43 @@ fz_error *pdf_loadtile(fz_image *image, fz_pixmap *tile); */ typedef struct pdf_cmap_s pdf_cmap; +typedef struct pdf_range_s pdf_range; -struct pdf_cmapentry_s +enum { PDF_CMAP_SINGLE, PDF_CMAP_RANGE, PDF_CMAP_TABLE, PDF_CMAP_MULTI }; + +struct pdf_range_s { - const char *name; - const char *buf; - const int *len; - pdf_cmap *cmap; + int low; + int high; + int flag; /* what kind of lookup is this (single, range, table, multi) */ + int offset; /* either range-delta or table-index */ }; -extern struct pdf_cmapentry_s pdf_cmaptable[]; /* list of builtin system cmaps */ +struct pdf_cmap_s +{ + int refs; + char cmapname[32]; + + char usecmapname[32]; + pdf_cmap *usecmap; + + int wmode; + + int ncspace; + struct { + int n; + unsigned lo; + unsigned hi; + } cspace[40]; + + int rlen, rcap; + pdf_range *ranges; + + int tlen, tcap; + int *table; +}; + +extern pdf_cmap *pdf_cmaptable[]; /* list of builtin system cmaps */ fz_error *pdf_newcmap(pdf_cmap **cmapp); pdf_cmap *pdf_keepcmap(pdf_cmap *cmap); @@ -164,12 +191,11 @@ void pdf_dropcmap(pdf_cmap *cmap); void pdf_debugcmap(pdf_cmap *cmap); int pdf_getwmode(pdf_cmap *cmap); -pdf_cmap *fz_getusecmap(pdf_cmap *cmap); -void fz_setwmode(pdf_cmap *cmap, int wmode); -void fz_setusecmap(pdf_cmap *cmap, pdf_cmap *usecmap); +pdf_cmap *pdf_getusecmap(pdf_cmap *cmap); +void pdf_setwmode(pdf_cmap *cmap, int wmode); +void pdf_setusecmap(pdf_cmap *cmap, pdf_cmap *usecmap); fz_error *pdf_addcodespace(pdf_cmap *cmap, unsigned lo, unsigned hi, int n); - fz_error *pdf_maprangetotable(pdf_cmap *cmap, int low, int *map, int len); fz_error *pdf_maprangetorange(pdf_cmap *cmap, int srclo, int srchi, int dstlo); fz_error *pdf_maponetomany(pdf_cmap *cmap, int one, int *many, int len); |