diff options
author | Tor Andersson <tor@ghostscript.com> | 2009-02-28 17:18:26 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2009-02-28 17:18:26 +0100 |
commit | 4ee4da1c6d2db727790dd72a60a7f29d43e802b9 (patch) | |
tree | 9dc62024ae86da5e5e9087cc18b8cd972d327917 | |
parent | c122f42c6fa567efb3bca38144bbd29357ff327a (diff) | |
download | mupdf-4ee4da1c6d2db727790dd72a60a7f29d43e802b9.tar.xz |
Move cmapdump and fontdump tools inside mupdf directory.
-rw-r--r-- | Jamfile | 7 | ||||
-rw-r--r-- | cmaps/Jamfile | 2 | ||||
-rw-r--r-- | fonts/Jamfile | 72 | ||||
-rw-r--r-- | include/mupdf/base14.h | 31 | ||||
-rw-r--r-- | mupdf/Jamfile | 4 | ||||
-rw-r--r-- | mupdf/cmapdump.c (renamed from cmapdump.c) | 6 | ||||
-rw-r--r-- | mupdf/fontdump.c (renamed from hexdump.c) | 14 | ||||
-rw-r--r-- | mupdf/pdf_fontfile.c | 139 | ||||
-rw-r--r-- | strdump.c | 91 |
9 files changed, 141 insertions, 225 deletions
@@ -13,13 +13,10 @@ HDRS = [ FDirName $(TOP) include ] ; SubInclude TOP fitz ; SubInclude TOP fitzdraw ; -Main hexdump : hexdump.c ; -Main cmapdump : cmapdump.c ; -LinkLibraries cmapdump : libfitz ; - -SubInclude TOP fonts ; SubInclude TOP cmaps ; +SubInclude TOP fonts ; SubInclude TOP mupdf ; SubInclude TOP apps ; + diff --git a/cmaps/Jamfile b/cmaps/Jamfile index 2d2e435a..e96c7093 100644 --- a/cmaps/Jamfile +++ b/cmaps/Jamfile @@ -2,6 +2,8 @@ # These CMaps come from http://www.adobe.com/devnet/font/#pcfi # +SubDir TOP cmaps ; + SubDir TOP cmaps chinese_s ; GenFile cmap_chinese_s.c : cmapdump Adobe-GB1-4 diff --git a/fonts/Jamfile b/fonts/Jamfile index ac3dee2a..03b4df6b 100644 --- a/fonts/Jamfile +++ b/fonts/Jamfile @@ -1,45 +1,43 @@ SubDir TOP fonts ; -if ! ( NOCJK in $(DEFINES) ) -{ - SubDir TOP fonts droid ; - GenFile font_cjk.c : hexdump DroidSansFallback.ttf ; - Library libfonts : font_cjk.c ; -} +GenFile font_misc.c : fontdump + Dingbats.cff + StandardSymL.cff + URWChanceryL-MediItal.cff + ; -SubDir TOP fonts ; +GenFile font_mono.c : fontdump + NimbusMonL-Regu.cff + NimbusMonL-ReguObli.cff + NimbusMonL-Bold.cff + NimbusMonL-BoldObli.cff + ; -GenFile font_dingbats.c : hexdump Dingbats.cff ; -GenFile font_symbol.c : hexdump StandardSymL.cff ; -GenFile font_script.c : hexdump URWChanceryL-MediItal.cff ; -GenFile font_mono_r.c : hexdump NimbusMonL-Regu.cff ; -GenFile font_mono_i.c : hexdump NimbusMonL-ReguObli.cff ; -GenFile font_mono_b.c : hexdump NimbusMonL-Bold.cff ; -GenFile font_mono_bi.c : hexdump NimbusMonL-BoldObli.cff ; -GenFile font_serif_r.c : hexdump NimbusRomNo9L-Regu.cff ; -GenFile font_serif_ri.c : hexdump NimbusRomNo9L-ReguItal.cff ; -GenFile font_serif_b.c : hexdump NimbusRomNo9L-Medi.cff ; -GenFile font_serif_bi.c : hexdump NimbusRomNo9L-MediItal.cff ; -GenFile font_sans_b.c : hexdump NimbusSanL-Bold.cff ; -GenFile font_sans_bi.c : hexdump NimbusSanL-BoldItal.cff ; -GenFile font_sans_r.c : hexdump NimbusSanL-Regu.cff ; -GenFile font_sans_ri.c : hexdump NimbusSanL-ReguItal.cff ; +GenFile font_serif.c : fontdump + NimbusRomNo9L-Regu.cff + NimbusRomNo9L-ReguItal.cff + NimbusRomNo9L-Medi.cff + NimbusRomNo9L-MediItal.cff + ; + +GenFile font_sans.c : fontdump + NimbusSanL-Bold.cff + NimbusSanL-BoldItal.cff + NimbusSanL-Regu.cff + NimbusSanL-ReguItal.cff + ; Library libfonts : - font_dingbats.c - font_symbol.c - font_script.c - font_mono_r.c - font_mono_i.c - font_mono_b.c - font_mono_bi.c - font_serif_r.c - font_serif_ri.c - font_serif_b.c - font_serif_bi.c - font_sans_b.c - font_sans_bi.c - font_sans_r.c - font_sans_ri.c + font_misc.c + font_mono.c + font_serif.c + font_sans.c ; +if ! ( NOCJK in $(DEFINES) ) +{ + SubDir TOP fonts droid ; + GenFile font_cjk.c : fontdump DroidSansFallback.ttf ; + Library libfonts : font_cjk.c ; +} + diff --git a/include/mupdf/base14.h b/include/mupdf/base14.h deleted file mode 100644 index ea9d489c..00000000 --- a/include/mupdf/base14.h +++ /dev/null @@ -1,31 +0,0 @@ -extern const unsigned char fonts_Dingbats_cff[]; -extern const unsigned int fonts_Dingbats_cff_len; -extern const unsigned char fonts_NimbusMonL_Bold_cff[]; -extern const unsigned int fonts_NimbusMonL_Bold_cff_len; -extern const unsigned char fonts_NimbusMonL_BoldObli_cff[]; -extern const unsigned int fonts_NimbusMonL_BoldObli_cff_len; -extern const unsigned char fonts_NimbusMonL_Regu_cff[]; -extern const unsigned int fonts_NimbusMonL_Regu_cff_len; -extern const unsigned char fonts_NimbusMonL_ReguObli_cff[]; -extern const unsigned int fonts_NimbusMonL_ReguObli_cff_len; -extern const unsigned char fonts_NimbusRomNo9L_Medi_cff[]; -extern const unsigned int fonts_NimbusRomNo9L_Medi_cff_len; -extern const unsigned char fonts_NimbusRomNo9L_MediItal_cff[]; -extern const unsigned int fonts_NimbusRomNo9L_MediItal_cff_len; -extern const unsigned char fonts_NimbusRomNo9L_Regu_cff[]; -extern const unsigned int fonts_NimbusRomNo9L_Regu_cff_len; -extern const unsigned char fonts_NimbusRomNo9L_ReguItal_cff[]; -extern const unsigned int fonts_NimbusRomNo9L_ReguItal_cff_len; -extern const unsigned char fonts_NimbusSanL_Bold_cff[]; -extern const unsigned int fonts_NimbusSanL_Bold_cff_len; -extern const unsigned char fonts_NimbusSanL_BoldItal_cff[]; -extern const unsigned int fonts_NimbusSanL_BoldItal_cff_len; -extern const unsigned char fonts_NimbusSanL_Regu_cff[]; -extern const unsigned int fonts_NimbusSanL_Regu_cff_len; -extern const unsigned char fonts_NimbusSanL_ReguItal_cff[]; -extern const unsigned int fonts_NimbusSanL_ReguItal_cff_len; -extern const unsigned char fonts_StandardSymL_cff[]; -extern const unsigned int fonts_StandardSymL_cff_len; -extern const unsigned char fonts_URWChanceryL_MediItal_cff[]; -extern const unsigned int fonts_URWChanceryL_MediItal_cff_len; - diff --git a/mupdf/Jamfile b/mupdf/Jamfile index e8f02310..f95799b5 100644 --- a/mupdf/Jamfile +++ b/mupdf/Jamfile @@ -1,5 +1,9 @@ SubDir TOP mupdf ; +Main fontdump : fontdump.c ; +Main cmapdump : cmapdump.c ; +LinkLibraries cmapdump : libfitz ; + Library libmupdf : # syntax layer diff --git a/cmapdump.c b/mupdf/cmapdump.c index f6c5cb2e..3566d5d3 100644 --- a/cmapdump.c +++ b/mupdf/cmapdump.c @@ -6,9 +6,9 @@ #include "fitz.h" #include "mupdf.h" -#include "mupdf/pdf_lex.c" -#include "mupdf/pdf_cmap.c" -#include "mupdf/pdf_cmap_parse.c" +#include "../mupdf/pdf_lex.c" +#include "../mupdf/pdf_cmap.c" +#include "../mupdf/pdf_cmap_parse.c" char * flagtoname(int flag) diff --git a/hexdump.c b/mupdf/fontdump.c index 0af0ee43..06cd2e0a 100644 --- a/hexdump.c +++ b/mupdf/fontdump.c @@ -28,6 +28,7 @@ main(int argc, char **argv) FILE *fo; FILE *fi; char name[256]; + char *basename; char *p; int i, len; @@ -53,7 +54,14 @@ main(int argc, char **argv) return 1; } - strcpy(name, argv[i]); + basename = strrchr(argv[i], '/'); + if (!basename) + basename = strrchr(argv[i], '\\'); + if (basename) + basename++; + else + basename = argv[i]; + strcpy(name, basename); p = name; while (*p) { @@ -62,12 +70,12 @@ main(int argc, char **argv) p ++; } - fprintf(fo, "const unsigned char %s[] = {\n", name); + fprintf(fo, "const unsigned char pdf_font_%s_buf[] = {\n", name); len = hexdump(fo, fi); fprintf(fo, "};\n"); - fprintf(fo, "const unsigned int %s_len = %d;\n", name, len); + fprintf(fo, "const unsigned int pdf_font_%s_len = %d;\n", name, len); fclose(fi); } diff --git a/mupdf/pdf_fontfile.c b/mupdf/pdf_fontfile.c index 3c0ecb37..ef1e5d67 100644 --- a/mupdf/pdf_fontfile.c +++ b/mupdf/pdf_fontfile.c @@ -1,7 +1,41 @@ #include "fitz.h" #include "mupdf.h" -#include "mupdf/base14.h" +extern const unsigned char pdf_font_Dingbats_cff_buf[]; +extern const unsigned int pdf_font_Dingbats_cff_len; +extern const unsigned char pdf_font_NimbusMonL_Bold_cff_buf[]; +extern const unsigned int pdf_font_NimbusMonL_Bold_cff_len; +extern const unsigned char pdf_font_NimbusMonL_BoldObli_cff_buf[]; +extern const unsigned int pdf_font_NimbusMonL_BoldObli_cff_len; +extern const unsigned char pdf_font_NimbusMonL_Regu_cff_buf[]; +extern const unsigned int pdf_font_NimbusMonL_Regu_cff_len; +extern const unsigned char pdf_font_NimbusMonL_ReguObli_cff_buf[]; +extern const unsigned int pdf_font_NimbusMonL_ReguObli_cff_len; +extern const unsigned char pdf_font_NimbusRomNo9L_Medi_cff_buf[]; +extern const unsigned int pdf_font_NimbusRomNo9L_Medi_cff_len; +extern const unsigned char pdf_font_NimbusRomNo9L_MediItal_cff_buf[]; +extern const unsigned int pdf_font_NimbusRomNo9L_MediItal_cff_len; +extern const unsigned char pdf_font_NimbusRomNo9L_Regu_cff_buf[]; +extern const unsigned int pdf_font_NimbusRomNo9L_Regu_cff_len; +extern const unsigned char pdf_font_NimbusRomNo9L_ReguItal_cff_buf[]; +extern const unsigned int pdf_font_NimbusRomNo9L_ReguItal_cff_len; +extern const unsigned char pdf_font_NimbusSanL_Bold_cff_buf[]; +extern const unsigned int pdf_font_NimbusSanL_Bold_cff_len; +extern const unsigned char pdf_font_NimbusSanL_BoldItal_cff_buf[]; +extern const unsigned int pdf_font_NimbusSanL_BoldItal_cff_len; +extern const unsigned char pdf_font_NimbusSanL_Regu_cff_buf[]; +extern const unsigned int pdf_font_NimbusSanL_Regu_cff_len; +extern const unsigned char pdf_font_NimbusSanL_ReguItal_cff_buf[]; +extern const unsigned int pdf_font_NimbusSanL_ReguItal_cff_len; +extern const unsigned char pdf_font_StandardSymL_cff_buf[]; +extern const unsigned int pdf_font_StandardSymL_cff_len; +extern const unsigned char pdf_font_URWChanceryL_MediItal_cff_buf[]; +extern const unsigned int pdf_font_URWChanceryL_MediItal_cff_len; + +#ifndef NOCJK +extern const unsigned char pdf_font_DroidSansFallback_ttf_buf[]; +extern const unsigned int pdf_font_DroidSansFallback_ttf_len; +#endif enum { @@ -19,63 +53,58 @@ enum enum { CNS, GB, Japan, Korea }; enum { MINCHO, GOTHIC }; -#ifndef NOCJK -extern const unsigned char fonts_droid_DroidSansFallback_ttf[]; -extern const unsigned int fonts_droid_DroidSansFallback_ttf_len; -#endif - static const struct { const char *name; const unsigned char *cff; const unsigned int *len; } basefonts[] = { - { "Courier", - fonts_NimbusMonL_Regu_cff, - &fonts_NimbusMonL_Regu_cff_len }, - { "Courier-Bold", - fonts_NimbusMonL_Bold_cff, - &fonts_NimbusMonL_Bold_cff_len }, - { "Courier-Oblique", - fonts_NimbusMonL_ReguObli_cff, - &fonts_NimbusMonL_ReguObli_cff_len }, - { "Courier-BoldOblique", - fonts_NimbusMonL_BoldObli_cff, - &fonts_NimbusMonL_BoldObli_cff_len }, - { "Helvetica", - fonts_NimbusSanL_Regu_cff, - &fonts_NimbusSanL_Regu_cff_len }, - { "Helvetica-Bold", - fonts_NimbusSanL_Bold_cff, - &fonts_NimbusSanL_Bold_cff_len }, - { "Helvetica-Oblique", - fonts_NimbusSanL_ReguItal_cff, - &fonts_NimbusSanL_ReguItal_cff_len }, - { "Helvetica-BoldOblique", - fonts_NimbusSanL_BoldItal_cff, - &fonts_NimbusSanL_BoldItal_cff_len }, - { "Times-Roman", - fonts_NimbusRomNo9L_Regu_cff, - &fonts_NimbusRomNo9L_Regu_cff_len }, - { "Times-Bold", - fonts_NimbusRomNo9L_Medi_cff, - &fonts_NimbusRomNo9L_Medi_cff_len }, - { "Times-Italic", - fonts_NimbusRomNo9L_ReguItal_cff, - &fonts_NimbusRomNo9L_ReguItal_cff_len }, - { "Times-BoldItalic", - fonts_NimbusRomNo9L_MediItal_cff, - &fonts_NimbusRomNo9L_MediItal_cff_len }, - { "Symbol", - fonts_StandardSymL_cff, - &fonts_StandardSymL_cff_len }, - { "ZapfDingbats", - fonts_Dingbats_cff, - &fonts_Dingbats_cff_len }, - { "Chancery", - fonts_URWChanceryL_MediItal_cff, - &fonts_URWChanceryL_MediItal_cff_len }, - { 0, 0, 0 } + { "Courier", + pdf_font_NimbusMonL_Regu_cff_buf, + &pdf_font_NimbusMonL_Regu_cff_len }, + { "Courier-Bold", + pdf_font_NimbusMonL_Bold_cff_buf, + &pdf_font_NimbusMonL_Bold_cff_len }, + { "Courier-Oblique", + pdf_font_NimbusMonL_ReguObli_cff_buf, + &pdf_font_NimbusMonL_ReguObli_cff_len }, + { "Courier-BoldOblique", + pdf_font_NimbusMonL_BoldObli_cff_buf, + &pdf_font_NimbusMonL_BoldObli_cff_len }, + { "Helvetica", + pdf_font_NimbusSanL_Regu_cff_buf, + &pdf_font_NimbusSanL_Regu_cff_len }, + { "Helvetica-Bold", + pdf_font_NimbusSanL_Bold_cff_buf, + &pdf_font_NimbusSanL_Bold_cff_len }, + { "Helvetica-Oblique", + pdf_font_NimbusSanL_ReguItal_cff_buf, + &pdf_font_NimbusSanL_ReguItal_cff_len }, + { "Helvetica-BoldOblique", + pdf_font_NimbusSanL_BoldItal_cff_buf, + &pdf_font_NimbusSanL_BoldItal_cff_len }, + { "Times-Roman", + pdf_font_NimbusRomNo9L_Regu_cff_buf, + &pdf_font_NimbusRomNo9L_Regu_cff_len }, + { "Times-Bold", + pdf_font_NimbusRomNo9L_Medi_cff_buf, + &pdf_font_NimbusRomNo9L_Medi_cff_len }, + { "Times-Italic", + pdf_font_NimbusRomNo9L_ReguItal_cff_buf, + &pdf_font_NimbusRomNo9L_ReguItal_cff_len }, + { "Times-BoldItalic", + pdf_font_NimbusRomNo9L_MediItal_cff_buf, + &pdf_font_NimbusRomNo9L_MediItal_cff_len }, + { "Symbol", + pdf_font_StandardSymL_cff_buf, + &pdf_font_StandardSymL_cff_len }, + { "ZapfDingbats", + pdf_font_Dingbats_cff_buf, + &pdf_font_Dingbats_cff_len }, + { "Chancery", + pdf_font_URWChanceryL_MediItal_cff_buf, + &pdf_font_URWChanceryL_MediItal_cff_len }, + { 0, 0, 0 } }; fz_error * @@ -111,12 +140,12 @@ loadsystemcidfont(pdf_fontdesc *font, int csi, int kind) #ifndef NOCJK fz_error *error; /* We only have one builtin fallback font, we'd really like - * to have one for each combination of CSI and Kind + * to have one for each combination of CSI and Kind. */ pdf_logfont("loading builtin CJK font\n"); error = fz_newfontfrombuffer(&font->font, - (unsigned char *)fonts_droid_DroidSansFallback_ttf, - fonts_droid_DroidSansFallback_ttf_len, 0); + (unsigned char *)pdf_font_DroidSansFallback_ttf_buf, + pdf_font_DroidSansFallback_ttf_len, 0); if (error) return fz_rethrow(error, "cannot load builtin CJK font"); font->font->ftsubstitute = 1; /* substitute font */ diff --git a/strdump.c b/strdump.c deleted file mode 100644 index d8a83807..00000000 --- a/strdump.c +++ /dev/null @@ -1,91 +0,0 @@ -/* strdump.c -- similar to hexdump but with ascii strings */ - -#include <stdio.h> -#include <string.h> - -int -strdump(FILE *fo, FILE *fi) -{ - int c, n; - - n = 0; - fputs("\"", fo); - c = fgetc(fi); - while (c != -1) - { - if (c == '\n' || c == '\r') - fputs("\\n\"\n\"", fo); - else - putc(c, fo); - c = fgetc(fi); - n ++; - } - fputs("\"\n", fo); - return n; -} - - -int -main(int argc, char **argv) -{ - FILE *fo; - FILE *fi; - char name[256]; - char *realname; - char *p; - int i, len; - - if (argc < 3) - { - fprintf(stderr, "usage: hexdump output.c input.dat\n"); - return 1; - } - - fo = fopen(argv[1], "wb"); - if (!fo) - { - fprintf(stderr, "hexdump: could not open output file\n"); - return 1; - } - - for (i = 2; i < argc; i++) - { - fi = fopen(argv[i], "rb"); - if (!fi) - { - fprintf(stderr, "hexdump: could not open input file\n"); - return 1; - } - - realname = strrchr(argv[i], '/'); - if (!realname) - realname = strrchr(argv[i], '\\'); - if (realname) - realname ++; - else - realname = argv[i]; - - strcpy(name, argv[i]); - p = name; - while (*p) - { - if ((*p == '/') || (*p == '.') || (*p == '\\') || (*p == '-')) - *p = '_'; - p ++; - } - - fprintf(fo, "const char %s_name[] = \"%s\";\n", name, realname); - fprintf(fo, "const char %s_buf[] = {\n", name); - - len = strdump(fo, fi); - - fprintf(fo, "};\n"); - fprintf(fo, "const int %s_len = %d;\n", name, len); - fprintf(fo, "\n"); - - fclose(fi); - } - - return 0; -} - |