From e54eda8832ef70dfae37d4200bd56bd2dee6118e Mon Sep 17 00:00:00 2001 From: Peter Breitenlohner Date: Fri, 5 Jul 2013 13:19:04 +0000 Subject: dvipdfm-x: Continue merging dvipdfmx and xdvipdfmx git-svn-id: svn://tug.org/texlive/trunk@31095 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 10 + Build/source/texk/dvipdfm-x/Makefile.am | 21 +- Build/source/texk/dvipdfm-x/Makefile.in | 379 +++++------ Build/source/texk/dvipdfm-x/cff.h | 165 +++++ Build/source/texk/dvipdfm-x/spc_color.c | 192 ++++++ Build/source/texk/dvipdfm-x/spc_html.c | 950 +++++++++++++++++++++++++++ Build/source/texk/dvipdfm-x/spc_util.c | 820 +++++++++++++++++++++++ Build/source/texk/dvipdfm-x/spc_util.h | 47 ++ Build/source/texk/dvipdfm-x/src/cff.c | 103 +-- Build/source/texk/dvipdfm-x/src/cff.h | 146 ---- Build/source/texk/dvipdfm-x/src/cidtype0.c | 4 +- Build/source/texk/dvipdfm-x/src/cidtype2.c | 2 +- Build/source/texk/dvipdfm-x/src/dvi.c | 47 +- Build/source/texk/dvipdfm-x/src/dvi.h | 6 +- Build/source/texk/dvipdfm-x/src/dvipdfmx.c | 6 +- Build/source/texk/dvipdfm-x/src/fontmap.c | 46 +- Build/source/texk/dvipdfm-x/src/pdfcolor.c | 13 +- Build/source/texk/dvipdfm-x/src/pdfcolor.h | 9 +- Build/source/texk/dvipdfm-x/src/spc_color.c | 191 ------ Build/source/texk/dvipdfm-x/src/spc_html.c | 943 -------------------------- Build/source/texk/dvipdfm-x/src/spc_util.c | 791 ---------------------- Build/source/texk/dvipdfm-x/src/spc_util.h | 43 -- Build/source/texk/dvipdfm-x/src/truetype.c | 2 +- Build/source/texk/dvipdfm-x/src/tt_aux.c | 13 +- Build/source/texk/dvipdfm-x/src/tt_aux.h | 2 +- Build/source/texk/dvipdfm-x/src/tt_glyf.c | 670 ------------------- Build/source/texk/dvipdfm-x/src/type0.c | 677 ------------------- Build/source/texk/dvipdfm-x/src/type1c.c | 22 +- Build/source/texk/dvipdfm-x/tt_glyf.c | 673 +++++++++++++++++++ Build/source/texk/dvipdfm-x/type0.c | 691 +++++++++++++++++++ Build/source/texk/dvipdfm-x/xsrc/cff.c | 91 +-- Build/source/texk/dvipdfm-x/xsrc/cff.h | 156 ----- Build/source/texk/dvipdfm-x/xsrc/dvi.c | 8 +- Build/source/texk/dvipdfm-x/xsrc/dvi.h | 2 + Build/source/texk/dvipdfm-x/xsrc/dvipdfmx.c | 6 +- Build/source/texk/dvipdfm-x/xsrc/fontmap.c | 2 +- Build/source/texk/dvipdfm-x/xsrc/pdfcolor.c | 4 +- Build/source/texk/dvipdfm-x/xsrc/pdfcolor.h | 5 + Build/source/texk/dvipdfm-x/xsrc/spc_color.c | 192 ------ Build/source/texk/dvipdfm-x/xsrc/spc_html.c | 944 -------------------------- Build/source/texk/dvipdfm-x/xsrc/spc_util.c | 796 ---------------------- Build/source/texk/dvipdfm-x/xsrc/spc_util.h | 44 -- Build/source/texk/dvipdfm-x/xsrc/tt_glyf.c | 673 ------------------- Build/source/texk/dvipdfm-x/xsrc/type0.c | 687 ------------------- Build/source/texk/dvipdfm-x/xsrc/type1c.c | 6 + 45 files changed, 3975 insertions(+), 7325 deletions(-) create mode 100644 Build/source/texk/dvipdfm-x/cff.h create mode 100644 Build/source/texk/dvipdfm-x/spc_color.c create mode 100644 Build/source/texk/dvipdfm-x/spc_html.c create mode 100644 Build/source/texk/dvipdfm-x/spc_util.c create mode 100644 Build/source/texk/dvipdfm-x/spc_util.h delete mode 100644 Build/source/texk/dvipdfm-x/src/cff.h delete mode 100644 Build/source/texk/dvipdfm-x/src/spc_color.c delete mode 100644 Build/source/texk/dvipdfm-x/src/spc_html.c delete mode 100644 Build/source/texk/dvipdfm-x/src/spc_util.c delete mode 100644 Build/source/texk/dvipdfm-x/src/spc_util.h delete mode 100644 Build/source/texk/dvipdfm-x/src/tt_glyf.c delete mode 100644 Build/source/texk/dvipdfm-x/src/type0.c create mode 100644 Build/source/texk/dvipdfm-x/tt_glyf.c create mode 100644 Build/source/texk/dvipdfm-x/type0.c delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/cff.h delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/spc_color.c delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/spc_html.c delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/spc_util.c delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/spc_util.h delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/tt_glyf.c delete mode 100644 Build/source/texk/dvipdfm-x/xsrc/type0.c (limited to 'Build/source/texk') diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 4e7c2aef904..baaad496b6b 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,13 @@ +2013-07-05 Peter Breitenlohner + + * Removed diffs between src/ and xsrc/ version of these files + and moved them to the top-level: cff.h, spc_color.c, + spc_html.c, spc_util.[ch], tt_glyf.c, type0.c. + + * Reduced dvipdfmx/xdvipdfmx diffs in these files: + cff.c, dvi.[ch], cidtype0.c, cidtype2.c, dvipdfmx.c, fontmap.c, + pdfcolor.[ch], truetype.c, tt_aux.[ch], type1c.c. + 2013-07-03 Peter Breitenlohner * Removed diffs between src/ and xsrc/ version of these files diff --git a/Build/source/texk/dvipdfm-x/Makefile.am b/Build/source/texk/dvipdfm-x/Makefile.am index 89f25406904..960499db6e5 100644 --- a/Build/source/texk/dvipdfm-x/Makefile.am +++ b/Build/source/texk/dvipdfm-x/Makefile.am @@ -34,6 +34,7 @@ common_sources = \ agl.c \ agl.h \ bmpimage.h \ + cff.h \ cff_dict.h \ cff_limits.h \ cff_stdstr.h \ @@ -94,13 +95,17 @@ common_sources = \ pst_obj.c \ pst_obj.h \ sfnt.h \ + spc_color.c \ spc_color.h \ spc_dvips.h \ + spc_html.c \ spc_html.h \ spc_misc.c \ spc_misc.h \ spc_pdfm.h \ spc_tpic.h \ + spc_util.c \ + spc_util.h \ specials.h \ subfont.c \ subfont.h \ @@ -112,11 +117,13 @@ common_sources = \ tfm.h \ truetype.h \ tt_cmap.h \ + tt_glyf.c \ tt_glyf.h \ tt_gsub.c \ tt_gsub.h \ tt_post.h \ tt_table.h \ + type0.c \ type0.h \ type1.h \ type1c.h \ @@ -129,7 +136,6 @@ common_sources = \ dvipdfmx_sources = \ src/bmpimage.c \ src/cff.c \ - src/cff.h \ src/cff_dict.c \ src/cidtype0.c \ src/cidtype2.c \ @@ -160,23 +166,17 @@ dvipdfmx_sources = \ src/pdfximage.h \ src/pngimage.c \ src/sfnt.c \ - src/spc_color.c \ src/spc_dvips.c \ - src/spc_html.c \ src/spc_pdfm.c \ src/spc_tpic.c \ - src/spc_util.c \ - src/spc_util.h \ src/specials.c \ src/tfm.c \ src/truetype.c \ src/tt_aux.c \ src/tt_aux.h \ src/tt_cmap.c \ - src/tt_glyf.c \ src/tt_post.c \ src/tt_table.c \ - src/type0.c \ src/type1.c \ src/type1c.c \ src/xbb.c @@ -184,7 +184,6 @@ dvipdfmx_sources = \ xdvipdfmx_sources = \ xsrc/bmpimage.c \ xsrc/cff.c \ - xsrc/cff.h \ xsrc/cff_dict.c \ xsrc/cidtype0.c \ xsrc/cidtype2.c \ @@ -214,13 +213,9 @@ xdvipdfmx_sources = \ xsrc/pdfximage.h \ xsrc/pngimage.c \ xsrc/sfnt.c \ - xsrc/spc_color.c \ xsrc/spc_dvips.c \ - xsrc/spc_html.c \ xsrc/spc_pdfm.c \ xsrc/spc_tpic.c \ - xsrc/spc_util.c \ - xsrc/spc_util.h \ spc_xtx.c \ spc_xtx.h \ xsrc/specials.c \ @@ -229,10 +224,8 @@ xdvipdfmx_sources = \ xsrc/tt_aux.c \ xsrc/tt_aux.h \ xsrc/tt_cmap.c \ - xsrc/tt_glyf.c \ xsrc/tt_post.c \ xsrc/tt_table.c \ - xsrc/type0.c \ xsrc/type1.c \ xsrc/type1c.c \ xsrc/xbb.c diff --git a/Build/source/texk/dvipdfm-x/Makefile.in b/Build/source/texk/dvipdfm-x/Makefile.in index 75134507004..6dedbb942f2 100644 --- a/Build/source/texk/dvipdfm-x/Makefile.in +++ b/Build/source/texk/dvipdfm-x/Makefile.in @@ -164,10 +164,12 @@ am__objects_1 = dvipdfmx-agl.$(OBJEXT) dvipdfmx-cid.$(OBJEXT) \ dvipdfmx-pdfencoding.$(OBJEXT) dvipdfmx-pdffont.$(OBJEXT) \ dvipdfmx-pdfresource.$(OBJEXT) dvipdfmx-pkfont.$(OBJEXT) \ dvipdfmx-pst.$(OBJEXT) dvipdfmx-pst_obj.$(OBJEXT) \ - dvipdfmx-spc_misc.$(OBJEXT) dvipdfmx-subfont.$(OBJEXT) \ - dvipdfmx-t1_char.$(OBJEXT) dvipdfmx-t1_load.$(OBJEXT) \ - dvipdfmx-tt_gsub.$(OBJEXT) dvipdfmx-unicode.$(OBJEXT) \ - dvipdfmx-vf.$(OBJEXT) + dvipdfmx-spc_color.$(OBJEXT) dvipdfmx-spc_html.$(OBJEXT) \ + dvipdfmx-spc_misc.$(OBJEXT) dvipdfmx-spc_util.$(OBJEXT) \ + dvipdfmx-subfont.$(OBJEXT) dvipdfmx-t1_char.$(OBJEXT) \ + dvipdfmx-t1_load.$(OBJEXT) dvipdfmx-tt_glyf.$(OBJEXT) \ + dvipdfmx-tt_gsub.$(OBJEXT) dvipdfmx-type0.$(OBJEXT) \ + dvipdfmx-unicode.$(OBJEXT) dvipdfmx-vf.$(OBJEXT) am__dirstamp = $(am__leading_dot)dirstamp am__objects_2 = src/dvipdfmx-bmpimage.$(OBJEXT) \ src/dvipdfmx-cff.$(OBJEXT) src/dvipdfmx-cff_dict.$(OBJEXT) \ @@ -183,17 +185,13 @@ am__objects_2 = src/dvipdfmx-bmpimage.$(OBJEXT) \ src/dvipdfmx-pdfparse.$(OBJEXT) \ src/dvipdfmx-pdfximage.$(OBJEXT) \ src/dvipdfmx-pngimage.$(OBJEXT) src/dvipdfmx-sfnt.$(OBJEXT) \ - src/dvipdfmx-spc_color.$(OBJEXT) \ src/dvipdfmx-spc_dvips.$(OBJEXT) \ - src/dvipdfmx-spc_html.$(OBJEXT) \ src/dvipdfmx-spc_pdfm.$(OBJEXT) \ src/dvipdfmx-spc_tpic.$(OBJEXT) \ - src/dvipdfmx-spc_util.$(OBJEXT) \ src/dvipdfmx-specials.$(OBJEXT) src/dvipdfmx-tfm.$(OBJEXT) \ src/dvipdfmx-truetype.$(OBJEXT) src/dvipdfmx-tt_aux.$(OBJEXT) \ - src/dvipdfmx-tt_cmap.$(OBJEXT) src/dvipdfmx-tt_glyf.$(OBJEXT) \ - src/dvipdfmx-tt_post.$(OBJEXT) src/dvipdfmx-tt_table.$(OBJEXT) \ - src/dvipdfmx-type0.$(OBJEXT) src/dvipdfmx-type1.$(OBJEXT) \ + src/dvipdfmx-tt_cmap.$(OBJEXT) src/dvipdfmx-tt_post.$(OBJEXT) \ + src/dvipdfmx-tt_table.$(OBJEXT) src/dvipdfmx-type1.$(OBJEXT) \ src/dvipdfmx-type1c.$(OBJEXT) src/dvipdfmx-xbb.$(OBJEXT) nodist_dvipdfmx_OBJECTS = $(am__objects_1) $(am__objects_2) dvipdfmx_OBJECTS = $(nodist_dvipdfmx_OBJECTS) @@ -211,10 +209,12 @@ am__objects_3 = xdvipdfmx-agl.$(OBJEXT) xdvipdfmx-cid.$(OBJEXT) \ xdvipdfmx-pdfencoding.$(OBJEXT) xdvipdfmx-pdffont.$(OBJEXT) \ xdvipdfmx-pdfresource.$(OBJEXT) xdvipdfmx-pkfont.$(OBJEXT) \ xdvipdfmx-pst.$(OBJEXT) xdvipdfmx-pst_obj.$(OBJEXT) \ - xdvipdfmx-spc_misc.$(OBJEXT) xdvipdfmx-subfont.$(OBJEXT) \ - xdvipdfmx-t1_char.$(OBJEXT) xdvipdfmx-t1_load.$(OBJEXT) \ - xdvipdfmx-tt_gsub.$(OBJEXT) xdvipdfmx-unicode.$(OBJEXT) \ - xdvipdfmx-vf.$(OBJEXT) + xdvipdfmx-spc_color.$(OBJEXT) xdvipdfmx-spc_html.$(OBJEXT) \ + xdvipdfmx-spc_misc.$(OBJEXT) xdvipdfmx-spc_util.$(OBJEXT) \ + xdvipdfmx-subfont.$(OBJEXT) xdvipdfmx-t1_char.$(OBJEXT) \ + xdvipdfmx-t1_load.$(OBJEXT) xdvipdfmx-tt_glyf.$(OBJEXT) \ + xdvipdfmx-tt_gsub.$(OBJEXT) xdvipdfmx-type0.$(OBJEXT) \ + xdvipdfmx-unicode.$(OBJEXT) xdvipdfmx-vf.$(OBJEXT) am__objects_4 = xsrc/xdvipdfmx-bmpimage.$(OBJEXT) \ xsrc/xdvipdfmx-cff.$(OBJEXT) xsrc/xdvipdfmx-cff_dict.$(OBJEXT) \ xsrc/xdvipdfmx-cidtype0.$(OBJEXT) \ @@ -234,21 +234,17 @@ am__objects_4 = xsrc/xdvipdfmx-bmpimage.$(OBJEXT) \ xsrc/xdvipdfmx-pdfximage.$(OBJEXT) \ xsrc/xdvipdfmx-pngimage.$(OBJEXT) \ xsrc/xdvipdfmx-sfnt.$(OBJEXT) \ - xsrc/xdvipdfmx-spc_color.$(OBJEXT) \ xsrc/xdvipdfmx-spc_dvips.$(OBJEXT) \ - xsrc/xdvipdfmx-spc_html.$(OBJEXT) \ xsrc/xdvipdfmx-spc_pdfm.$(OBJEXT) \ - xsrc/xdvipdfmx-spc_tpic.$(OBJEXT) \ - xsrc/xdvipdfmx-spc_util.$(OBJEXT) xdvipdfmx-spc_xtx.$(OBJEXT) \ + xsrc/xdvipdfmx-spc_tpic.$(OBJEXT) xdvipdfmx-spc_xtx.$(OBJEXT) \ xsrc/xdvipdfmx-specials.$(OBJEXT) xsrc/xdvipdfmx-tfm.$(OBJEXT) \ xsrc/xdvipdfmx-truetype.$(OBJEXT) \ xsrc/xdvipdfmx-tt_aux.$(OBJEXT) \ xsrc/xdvipdfmx-tt_cmap.$(OBJEXT) \ - xsrc/xdvipdfmx-tt_glyf.$(OBJEXT) \ xsrc/xdvipdfmx-tt_post.$(OBJEXT) \ xsrc/xdvipdfmx-tt_table.$(OBJEXT) \ - xsrc/xdvipdfmx-type0.$(OBJEXT) xsrc/xdvipdfmx-type1.$(OBJEXT) \ - xsrc/xdvipdfmx-type1c.$(OBJEXT) xsrc/xdvipdfmx-xbb.$(OBJEXT) + xsrc/xdvipdfmx-type1.$(OBJEXT) xsrc/xdvipdfmx-type1c.$(OBJEXT) \ + xsrc/xdvipdfmx-xbb.$(OBJEXT) nodist_xdvipdfmx_OBJECTS = $(am__objects_3) $(am__objects_4) xdvipdfmx_OBJECTS = $(nodist_xdvipdfmx_OBJECTS) am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ @@ -688,6 +684,7 @@ common_sources = \ agl.c \ agl.h \ bmpimage.h \ + cff.h \ cff_dict.h \ cff_limits.h \ cff_stdstr.h \ @@ -748,13 +745,17 @@ common_sources = \ pst_obj.c \ pst_obj.h \ sfnt.h \ + spc_color.c \ spc_color.h \ spc_dvips.h \ + spc_html.c \ spc_html.h \ spc_misc.c \ spc_misc.h \ spc_pdfm.h \ spc_tpic.h \ + spc_util.c \ + spc_util.h \ specials.h \ subfont.c \ subfont.h \ @@ -766,11 +767,13 @@ common_sources = \ tfm.h \ truetype.h \ tt_cmap.h \ + tt_glyf.c \ tt_glyf.h \ tt_gsub.c \ tt_gsub.h \ tt_post.h \ tt_table.h \ + type0.c \ type0.h \ type1.h \ type1c.h \ @@ -783,7 +786,6 @@ common_sources = \ dvipdfmx_sources = \ src/bmpimage.c \ src/cff.c \ - src/cff.h \ src/cff_dict.c \ src/cidtype0.c \ src/cidtype2.c \ @@ -814,23 +816,17 @@ dvipdfmx_sources = \ src/pdfximage.h \ src/pngimage.c \ src/sfnt.c \ - src/spc_color.c \ src/spc_dvips.c \ - src/spc_html.c \ src/spc_pdfm.c \ src/spc_tpic.c \ - src/spc_util.c \ - src/spc_util.h \ src/specials.c \ src/tfm.c \ src/truetype.c \ src/tt_aux.c \ src/tt_aux.h \ src/tt_cmap.c \ - src/tt_glyf.c \ src/tt_post.c \ src/tt_table.c \ - src/type0.c \ src/type1.c \ src/type1c.c \ src/xbb.c @@ -838,7 +834,6 @@ dvipdfmx_sources = \ xdvipdfmx_sources = \ xsrc/bmpimage.c \ xsrc/cff.c \ - xsrc/cff.h \ xsrc/cff_dict.c \ xsrc/cidtype0.c \ xsrc/cidtype2.c \ @@ -868,13 +863,9 @@ xdvipdfmx_sources = \ xsrc/pdfximage.h \ xsrc/pngimage.c \ xsrc/sfnt.c \ - xsrc/spc_color.c \ xsrc/spc_dvips.c \ - xsrc/spc_html.c \ xsrc/spc_pdfm.c \ xsrc/spc_tpic.c \ - xsrc/spc_util.c \ - xsrc/spc_util.h \ spc_xtx.c \ spc_xtx.h \ xsrc/specials.c \ @@ -883,10 +874,8 @@ xdvipdfmx_sources = \ xsrc/tt_aux.c \ xsrc/tt_aux.h \ xsrc/tt_cmap.c \ - xsrc/tt_glyf.c \ xsrc/tt_post.c \ xsrc/tt_table.c \ - xsrc/type0.c \ xsrc/type1.c \ xsrc/type1c.c \ xsrc/xbb.c @@ -1078,18 +1067,12 @@ src/dvipdfmx-pngimage.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-sfnt.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) -src/dvipdfmx-spc_color.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-spc_dvips.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) -src/dvipdfmx-spc_html.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-spc_pdfm.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-spc_tpic.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) -src/dvipdfmx-spc_util.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-specials.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-tfm.$(OBJEXT): src/$(am__dirstamp) \ @@ -1100,14 +1083,10 @@ src/dvipdfmx-tt_aux.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-tt_cmap.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) -src/dvipdfmx-tt_glyf.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-tt_post.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-tt_table.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) -src/dvipdfmx-type0.$(OBJEXT): src/$(am__dirstamp) \ - src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-type1.$(OBJEXT): src/$(am__dirstamp) \ src/$(DEPDIR)/$(am__dirstamp) src/dvipdfmx-type1c.$(OBJEXT): src/$(am__dirstamp) \ @@ -1168,18 +1147,12 @@ xsrc/xdvipdfmx-pngimage.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-sfnt.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) -xsrc/xdvipdfmx-spc_color.$(OBJEXT): xsrc/$(am__dirstamp) \ - xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-spc_dvips.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) -xsrc/xdvipdfmx-spc_html.$(OBJEXT): xsrc/$(am__dirstamp) \ - xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-spc_pdfm.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-spc_tpic.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) -xsrc/xdvipdfmx-spc_util.$(OBJEXT): xsrc/$(am__dirstamp) \ - xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-specials.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-tfm.$(OBJEXT): xsrc/$(am__dirstamp) \ @@ -1190,14 +1163,10 @@ xsrc/xdvipdfmx-tt_aux.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-tt_cmap.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) -xsrc/xdvipdfmx-tt_glyf.$(OBJEXT): xsrc/$(am__dirstamp) \ - xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-tt_post.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-tt_table.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) -xsrc/xdvipdfmx-type0.$(OBJEXT): xsrc/$(am__dirstamp) \ - xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-type1.$(OBJEXT): xsrc/$(am__dirstamp) \ xsrc/$(DEPDIR)/$(am__dirstamp) xsrc/xdvipdfmx-type1c.$(OBJEXT): xsrc/$(am__dirstamp) \ @@ -1275,11 +1244,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-pkfont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-pst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-pst_obj.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-spc_color.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-spc_html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-spc_misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-spc_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-subfont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-t1_char.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-t1_load.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-tt_glyf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-tt_gsub.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-type0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-unicode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipdfmx-vf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-agl.Po@am__quote@ @@ -1304,12 +1278,17 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-pkfont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-pst.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-pst_obj.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-spc_color.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-spc_html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-spc_misc.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-spc_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-spc_xtx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-subfont.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-t1_char.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-t1_load.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-tt_glyf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-tt_gsub.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-type0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-unicode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xdvipdfmx-vf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-bmpimage.Po@am__quote@ @@ -1334,21 +1313,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-pdfximage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-pngimage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-sfnt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-spc_color.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-spc_dvips.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-spc_html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-spc_pdfm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-spc_tpic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-spc_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-specials.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-tfm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-truetype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-tt_aux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-tt_cmap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-tt_glyf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-tt_post.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-tt_table.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-type0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-type1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-type1c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/dvipdfmx-xbb.Po@am__quote@ @@ -1374,21 +1348,16 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-pdfximage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-pngimage.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-sfnt.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-spc_dvips.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-spc_pdfm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-spc_tpic.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-specials.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-tfm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-truetype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-tt_aux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-tt_cmap.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-tt_post.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-tt_table.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-type0.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-type1.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-type1c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@xsrc/$(DEPDIR)/xdvipdfmx-xbb.Po@am__quote@ @@ -1739,6 +1708,34 @@ dvipdfmx-pst_obj.obj: pst_obj.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-pst_obj.obj `if test -f 'pst_obj.c'; then $(CYGPATH_W) 'pst_obj.c'; else $(CYGPATH_W) '$(srcdir)/pst_obj.c'; fi` +dvipdfmx-spc_color.o: spc_color.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_color.o -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_color.Tpo -c -o dvipdfmx-spc_color.o `test -f 'spc_color.c' || echo '$(srcdir)/'`spc_color.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_color.Tpo $(DEPDIR)/dvipdfmx-spc_color.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_color.c' object='dvipdfmx-spc_color.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_color.o `test -f 'spc_color.c' || echo '$(srcdir)/'`spc_color.c + +dvipdfmx-spc_color.obj: spc_color.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_color.obj -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_color.Tpo -c -o dvipdfmx-spc_color.obj `if test -f 'spc_color.c'; then $(CYGPATH_W) 'spc_color.c'; else $(CYGPATH_W) '$(srcdir)/spc_color.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_color.Tpo $(DEPDIR)/dvipdfmx-spc_color.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_color.c' object='dvipdfmx-spc_color.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_color.obj `if test -f 'spc_color.c'; then $(CYGPATH_W) 'spc_color.c'; else $(CYGPATH_W) '$(srcdir)/spc_color.c'; fi` + +dvipdfmx-spc_html.o: spc_html.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_html.o -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_html.Tpo -c -o dvipdfmx-spc_html.o `test -f 'spc_html.c' || echo '$(srcdir)/'`spc_html.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_html.Tpo $(DEPDIR)/dvipdfmx-spc_html.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_html.c' object='dvipdfmx-spc_html.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_html.o `test -f 'spc_html.c' || echo '$(srcdir)/'`spc_html.c + +dvipdfmx-spc_html.obj: spc_html.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_html.obj -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_html.Tpo -c -o dvipdfmx-spc_html.obj `if test -f 'spc_html.c'; then $(CYGPATH_W) 'spc_html.c'; else $(CYGPATH_W) '$(srcdir)/spc_html.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_html.Tpo $(DEPDIR)/dvipdfmx-spc_html.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_html.c' object='dvipdfmx-spc_html.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_html.obj `if test -f 'spc_html.c'; then $(CYGPATH_W) 'spc_html.c'; else $(CYGPATH_W) '$(srcdir)/spc_html.c'; fi` + dvipdfmx-spc_misc.o: spc_misc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_misc.o -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_misc.Tpo -c -o dvipdfmx-spc_misc.o `test -f 'spc_misc.c' || echo '$(srcdir)/'`spc_misc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_misc.Tpo $(DEPDIR)/dvipdfmx-spc_misc.Po @@ -1753,6 +1750,20 @@ dvipdfmx-spc_misc.obj: spc_misc.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_misc.obj `if test -f 'spc_misc.c'; then $(CYGPATH_W) 'spc_misc.c'; else $(CYGPATH_W) '$(srcdir)/spc_misc.c'; fi` +dvipdfmx-spc_util.o: spc_util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_util.o -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_util.Tpo -c -o dvipdfmx-spc_util.o `test -f 'spc_util.c' || echo '$(srcdir)/'`spc_util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_util.Tpo $(DEPDIR)/dvipdfmx-spc_util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_util.c' object='dvipdfmx-spc_util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_util.o `test -f 'spc_util.c' || echo '$(srcdir)/'`spc_util.c + +dvipdfmx-spc_util.obj: spc_util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-spc_util.obj -MD -MP -MF $(DEPDIR)/dvipdfmx-spc_util.Tpo -c -o dvipdfmx-spc_util.obj `if test -f 'spc_util.c'; then $(CYGPATH_W) 'spc_util.c'; else $(CYGPATH_W) '$(srcdir)/spc_util.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-spc_util.Tpo $(DEPDIR)/dvipdfmx-spc_util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_util.c' object='dvipdfmx-spc_util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-spc_util.obj `if test -f 'spc_util.c'; then $(CYGPATH_W) 'spc_util.c'; else $(CYGPATH_W) '$(srcdir)/spc_util.c'; fi` + dvipdfmx-subfont.o: subfont.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-subfont.o -MD -MP -MF $(DEPDIR)/dvipdfmx-subfont.Tpo -c -o dvipdfmx-subfont.o `test -f 'subfont.c' || echo '$(srcdir)/'`subfont.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-subfont.Tpo $(DEPDIR)/dvipdfmx-subfont.Po @@ -1795,6 +1806,20 @@ dvipdfmx-t1_load.obj: t1_load.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-t1_load.obj `if test -f 't1_load.c'; then $(CYGPATH_W) 't1_load.c'; else $(CYGPATH_W) '$(srcdir)/t1_load.c'; fi` +dvipdfmx-tt_glyf.o: tt_glyf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-tt_glyf.o -MD -MP -MF $(DEPDIR)/dvipdfmx-tt_glyf.Tpo -c -o dvipdfmx-tt_glyf.o `test -f 'tt_glyf.c' || echo '$(srcdir)/'`tt_glyf.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-tt_glyf.Tpo $(DEPDIR)/dvipdfmx-tt_glyf.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tt_glyf.c' object='dvipdfmx-tt_glyf.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-tt_glyf.o `test -f 'tt_glyf.c' || echo '$(srcdir)/'`tt_glyf.c + +dvipdfmx-tt_glyf.obj: tt_glyf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-tt_glyf.obj -MD -MP -MF $(DEPDIR)/dvipdfmx-tt_glyf.Tpo -c -o dvipdfmx-tt_glyf.obj `if test -f 'tt_glyf.c'; then $(CYGPATH_W) 'tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/tt_glyf.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-tt_glyf.Tpo $(DEPDIR)/dvipdfmx-tt_glyf.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tt_glyf.c' object='dvipdfmx-tt_glyf.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-tt_glyf.obj `if test -f 'tt_glyf.c'; then $(CYGPATH_W) 'tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/tt_glyf.c'; fi` + dvipdfmx-tt_gsub.o: tt_gsub.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-tt_gsub.o -MD -MP -MF $(DEPDIR)/dvipdfmx-tt_gsub.Tpo -c -o dvipdfmx-tt_gsub.o `test -f 'tt_gsub.c' || echo '$(srcdir)/'`tt_gsub.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-tt_gsub.Tpo $(DEPDIR)/dvipdfmx-tt_gsub.Po @@ -1809,6 +1834,20 @@ dvipdfmx-tt_gsub.obj: tt_gsub.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-tt_gsub.obj `if test -f 'tt_gsub.c'; then $(CYGPATH_W) 'tt_gsub.c'; else $(CYGPATH_W) '$(srcdir)/tt_gsub.c'; fi` +dvipdfmx-type0.o: type0.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-type0.o -MD -MP -MF $(DEPDIR)/dvipdfmx-type0.Tpo -c -o dvipdfmx-type0.o `test -f 'type0.c' || echo '$(srcdir)/'`type0.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-type0.Tpo $(DEPDIR)/dvipdfmx-type0.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='type0.c' object='dvipdfmx-type0.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-type0.o `test -f 'type0.c' || echo '$(srcdir)/'`type0.c + +dvipdfmx-type0.obj: type0.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-type0.obj -MD -MP -MF $(DEPDIR)/dvipdfmx-type0.Tpo -c -o dvipdfmx-type0.obj `if test -f 'type0.c'; then $(CYGPATH_W) 'type0.c'; else $(CYGPATH_W) '$(srcdir)/type0.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-type0.Tpo $(DEPDIR)/dvipdfmx-type0.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='type0.c' object='dvipdfmx-type0.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o dvipdfmx-type0.obj `if test -f 'type0.c'; then $(CYGPATH_W) 'type0.c'; else $(CYGPATH_W) '$(srcdir)/type0.c'; fi` + dvipdfmx-unicode.o: unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT dvipdfmx-unicode.o -MD -MP -MF $(DEPDIR)/dvipdfmx-unicode.Tpo -c -o dvipdfmx-unicode.o `test -f 'unicode.c' || echo '$(srcdir)/'`unicode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/dvipdfmx-unicode.Tpo $(DEPDIR)/dvipdfmx-unicode.Po @@ -2145,20 +2184,6 @@ src/dvipdfmx-sfnt.obj: src/sfnt.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-sfnt.obj `if test -f 'src/sfnt.c'; then $(CYGPATH_W) 'src/sfnt.c'; else $(CYGPATH_W) '$(srcdir)/src/sfnt.c'; fi` -src/dvipdfmx-spc_color.o: src/spc_color.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_color.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_color.Tpo -c -o src/dvipdfmx-spc_color.o `test -f 'src/spc_color.c' || echo '$(srcdir)/'`src/spc_color.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_color.Tpo src/$(DEPDIR)/dvipdfmx-spc_color.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spc_color.c' object='src/dvipdfmx-spc_color.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_color.o `test -f 'src/spc_color.c' || echo '$(srcdir)/'`src/spc_color.c - -src/dvipdfmx-spc_color.obj: src/spc_color.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_color.obj -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_color.Tpo -c -o src/dvipdfmx-spc_color.obj `if test -f 'src/spc_color.c'; then $(CYGPATH_W) 'src/spc_color.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_color.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_color.Tpo src/$(DEPDIR)/dvipdfmx-spc_color.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spc_color.c' object='src/dvipdfmx-spc_color.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_color.obj `if test -f 'src/spc_color.c'; then $(CYGPATH_W) 'src/spc_color.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_color.c'; fi` - src/dvipdfmx-spc_dvips.o: src/spc_dvips.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_dvips.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_dvips.Tpo -c -o src/dvipdfmx-spc_dvips.o `test -f 'src/spc_dvips.c' || echo '$(srcdir)/'`src/spc_dvips.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_dvips.Tpo src/$(DEPDIR)/dvipdfmx-spc_dvips.Po @@ -2173,20 +2198,6 @@ src/dvipdfmx-spc_dvips.obj: src/spc_dvips.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_dvips.obj `if test -f 'src/spc_dvips.c'; then $(CYGPATH_W) 'src/spc_dvips.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_dvips.c'; fi` -src/dvipdfmx-spc_html.o: src/spc_html.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_html.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_html.Tpo -c -o src/dvipdfmx-spc_html.o `test -f 'src/spc_html.c' || echo '$(srcdir)/'`src/spc_html.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_html.Tpo src/$(DEPDIR)/dvipdfmx-spc_html.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spc_html.c' object='src/dvipdfmx-spc_html.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_html.o `test -f 'src/spc_html.c' || echo '$(srcdir)/'`src/spc_html.c - -src/dvipdfmx-spc_html.obj: src/spc_html.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_html.obj -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_html.Tpo -c -o src/dvipdfmx-spc_html.obj `if test -f 'src/spc_html.c'; then $(CYGPATH_W) 'src/spc_html.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_html.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_html.Tpo src/$(DEPDIR)/dvipdfmx-spc_html.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spc_html.c' object='src/dvipdfmx-spc_html.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_html.obj `if test -f 'src/spc_html.c'; then $(CYGPATH_W) 'src/spc_html.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_html.c'; fi` - src/dvipdfmx-spc_pdfm.o: src/spc_pdfm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_pdfm.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_pdfm.Tpo -c -o src/dvipdfmx-spc_pdfm.o `test -f 'src/spc_pdfm.c' || echo '$(srcdir)/'`src/spc_pdfm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_pdfm.Tpo src/$(DEPDIR)/dvipdfmx-spc_pdfm.Po @@ -2215,20 +2226,6 @@ src/dvipdfmx-spc_tpic.obj: src/spc_tpic.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_tpic.obj `if test -f 'src/spc_tpic.c'; then $(CYGPATH_W) 'src/spc_tpic.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_tpic.c'; fi` -src/dvipdfmx-spc_util.o: src/spc_util.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_util.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_util.Tpo -c -o src/dvipdfmx-spc_util.o `test -f 'src/spc_util.c' || echo '$(srcdir)/'`src/spc_util.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_util.Tpo src/$(DEPDIR)/dvipdfmx-spc_util.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spc_util.c' object='src/dvipdfmx-spc_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_util.o `test -f 'src/spc_util.c' || echo '$(srcdir)/'`src/spc_util.c - -src/dvipdfmx-spc_util.obj: src/spc_util.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-spc_util.obj -MD -MP -MF src/$(DEPDIR)/dvipdfmx-spc_util.Tpo -c -o src/dvipdfmx-spc_util.obj `if test -f 'src/spc_util.c'; then $(CYGPATH_W) 'src/spc_util.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_util.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-spc_util.Tpo src/$(DEPDIR)/dvipdfmx-spc_util.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/spc_util.c' object='src/dvipdfmx-spc_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-spc_util.obj `if test -f 'src/spc_util.c'; then $(CYGPATH_W) 'src/spc_util.c'; else $(CYGPATH_W) '$(srcdir)/src/spc_util.c'; fi` - src/dvipdfmx-specials.o: src/specials.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-specials.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-specials.Tpo -c -o src/dvipdfmx-specials.o `test -f 'src/specials.c' || echo '$(srcdir)/'`src/specials.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-specials.Tpo src/$(DEPDIR)/dvipdfmx-specials.Po @@ -2299,20 +2296,6 @@ src/dvipdfmx-tt_cmap.obj: src/tt_cmap.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-tt_cmap.obj `if test -f 'src/tt_cmap.c'; then $(CYGPATH_W) 'src/tt_cmap.c'; else $(CYGPATH_W) '$(srcdir)/src/tt_cmap.c'; fi` -src/dvipdfmx-tt_glyf.o: src/tt_glyf.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-tt_glyf.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-tt_glyf.Tpo -c -o src/dvipdfmx-tt_glyf.o `test -f 'src/tt_glyf.c' || echo '$(srcdir)/'`src/tt_glyf.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-tt_glyf.Tpo src/$(DEPDIR)/dvipdfmx-tt_glyf.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/tt_glyf.c' object='src/dvipdfmx-tt_glyf.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-tt_glyf.o `test -f 'src/tt_glyf.c' || echo '$(srcdir)/'`src/tt_glyf.c - -src/dvipdfmx-tt_glyf.obj: src/tt_glyf.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-tt_glyf.obj -MD -MP -MF src/$(DEPDIR)/dvipdfmx-tt_glyf.Tpo -c -o src/dvipdfmx-tt_glyf.obj `if test -f 'src/tt_glyf.c'; then $(CYGPATH_W) 'src/tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/src/tt_glyf.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-tt_glyf.Tpo src/$(DEPDIR)/dvipdfmx-tt_glyf.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/tt_glyf.c' object='src/dvipdfmx-tt_glyf.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-tt_glyf.obj `if test -f 'src/tt_glyf.c'; then $(CYGPATH_W) 'src/tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/src/tt_glyf.c'; fi` - src/dvipdfmx-tt_post.o: src/tt_post.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-tt_post.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-tt_post.Tpo -c -o src/dvipdfmx-tt_post.o `test -f 'src/tt_post.c' || echo '$(srcdir)/'`src/tt_post.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-tt_post.Tpo src/$(DEPDIR)/dvipdfmx-tt_post.Po @@ -2341,20 +2324,6 @@ src/dvipdfmx-tt_table.obj: src/tt_table.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-tt_table.obj `if test -f 'src/tt_table.c'; then $(CYGPATH_W) 'src/tt_table.c'; else $(CYGPATH_W) '$(srcdir)/src/tt_table.c'; fi` -src/dvipdfmx-type0.o: src/type0.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-type0.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-type0.Tpo -c -o src/dvipdfmx-type0.o `test -f 'src/type0.c' || echo '$(srcdir)/'`src/type0.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-type0.Tpo src/$(DEPDIR)/dvipdfmx-type0.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/type0.c' object='src/dvipdfmx-type0.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-type0.o `test -f 'src/type0.c' || echo '$(srcdir)/'`src/type0.c - -src/dvipdfmx-type0.obj: src/type0.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-type0.obj -MD -MP -MF src/$(DEPDIR)/dvipdfmx-type0.Tpo -c -o src/dvipdfmx-type0.obj `if test -f 'src/type0.c'; then $(CYGPATH_W) 'src/type0.c'; else $(CYGPATH_W) '$(srcdir)/src/type0.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-type0.Tpo src/$(DEPDIR)/dvipdfmx-type0.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/type0.c' object='src/dvipdfmx-type0.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/dvipdfmx-type0.obj `if test -f 'src/type0.c'; then $(CYGPATH_W) 'src/type0.c'; else $(CYGPATH_W) '$(srcdir)/src/type0.c'; fi` - src/dvipdfmx-type1.o: src/type1.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(dvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/dvipdfmx-type1.o -MD -MP -MF src/$(DEPDIR)/dvipdfmx-type1.Tpo -c -o src/dvipdfmx-type1.o `test -f 'src/type1.c' || echo '$(srcdir)/'`src/type1.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/$(DEPDIR)/dvipdfmx-type1.Tpo src/$(DEPDIR)/dvipdfmx-type1.Po @@ -2705,6 +2674,34 @@ xdvipdfmx-pst_obj.obj: pst_obj.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-pst_obj.obj `if test -f 'pst_obj.c'; then $(CYGPATH_W) 'pst_obj.c'; else $(CYGPATH_W) '$(srcdir)/pst_obj.c'; fi` +xdvipdfmx-spc_color.o: spc_color.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_color.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_color.Tpo -c -o xdvipdfmx-spc_color.o `test -f 'spc_color.c' || echo '$(srcdir)/'`spc_color.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_color.Tpo $(DEPDIR)/xdvipdfmx-spc_color.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_color.c' object='xdvipdfmx-spc_color.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_color.o `test -f 'spc_color.c' || echo '$(srcdir)/'`spc_color.c + +xdvipdfmx-spc_color.obj: spc_color.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_color.obj -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_color.Tpo -c -o xdvipdfmx-spc_color.obj `if test -f 'spc_color.c'; then $(CYGPATH_W) 'spc_color.c'; else $(CYGPATH_W) '$(srcdir)/spc_color.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_color.Tpo $(DEPDIR)/xdvipdfmx-spc_color.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_color.c' object='xdvipdfmx-spc_color.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_color.obj `if test -f 'spc_color.c'; then $(CYGPATH_W) 'spc_color.c'; else $(CYGPATH_W) '$(srcdir)/spc_color.c'; fi` + +xdvipdfmx-spc_html.o: spc_html.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_html.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_html.Tpo -c -o xdvipdfmx-spc_html.o `test -f 'spc_html.c' || echo '$(srcdir)/'`spc_html.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_html.Tpo $(DEPDIR)/xdvipdfmx-spc_html.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_html.c' object='xdvipdfmx-spc_html.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_html.o `test -f 'spc_html.c' || echo '$(srcdir)/'`spc_html.c + +xdvipdfmx-spc_html.obj: spc_html.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_html.obj -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_html.Tpo -c -o xdvipdfmx-spc_html.obj `if test -f 'spc_html.c'; then $(CYGPATH_W) 'spc_html.c'; else $(CYGPATH_W) '$(srcdir)/spc_html.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_html.Tpo $(DEPDIR)/xdvipdfmx-spc_html.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_html.c' object='xdvipdfmx-spc_html.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_html.obj `if test -f 'spc_html.c'; then $(CYGPATH_W) 'spc_html.c'; else $(CYGPATH_W) '$(srcdir)/spc_html.c'; fi` + xdvipdfmx-spc_misc.o: spc_misc.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_misc.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_misc.Tpo -c -o xdvipdfmx-spc_misc.o `test -f 'spc_misc.c' || echo '$(srcdir)/'`spc_misc.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_misc.Tpo $(DEPDIR)/xdvipdfmx-spc_misc.Po @@ -2719,6 +2716,20 @@ xdvipdfmx-spc_misc.obj: spc_misc.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_misc.obj `if test -f 'spc_misc.c'; then $(CYGPATH_W) 'spc_misc.c'; else $(CYGPATH_W) '$(srcdir)/spc_misc.c'; fi` +xdvipdfmx-spc_util.o: spc_util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_util.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_util.Tpo -c -o xdvipdfmx-spc_util.o `test -f 'spc_util.c' || echo '$(srcdir)/'`spc_util.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_util.Tpo $(DEPDIR)/xdvipdfmx-spc_util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_util.c' object='xdvipdfmx-spc_util.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_util.o `test -f 'spc_util.c' || echo '$(srcdir)/'`spc_util.c + +xdvipdfmx-spc_util.obj: spc_util.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_util.obj -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_util.Tpo -c -o xdvipdfmx-spc_util.obj `if test -f 'spc_util.c'; then $(CYGPATH_W) 'spc_util.c'; else $(CYGPATH_W) '$(srcdir)/spc_util.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_util.Tpo $(DEPDIR)/xdvipdfmx-spc_util.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='spc_util.c' object='xdvipdfmx-spc_util.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-spc_util.obj `if test -f 'spc_util.c'; then $(CYGPATH_W) 'spc_util.c'; else $(CYGPATH_W) '$(srcdir)/spc_util.c'; fi` + xdvipdfmx-subfont.o: subfont.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-subfont.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-subfont.Tpo -c -o xdvipdfmx-subfont.o `test -f 'subfont.c' || echo '$(srcdir)/'`subfont.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-subfont.Tpo $(DEPDIR)/xdvipdfmx-subfont.Po @@ -2761,6 +2772,20 @@ xdvipdfmx-t1_load.obj: t1_load.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-t1_load.obj `if test -f 't1_load.c'; then $(CYGPATH_W) 't1_load.c'; else $(CYGPATH_W) '$(srcdir)/t1_load.c'; fi` +xdvipdfmx-tt_glyf.o: tt_glyf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-tt_glyf.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-tt_glyf.Tpo -c -o xdvipdfmx-tt_glyf.o `test -f 'tt_glyf.c' || echo '$(srcdir)/'`tt_glyf.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-tt_glyf.Tpo $(DEPDIR)/xdvipdfmx-tt_glyf.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tt_glyf.c' object='xdvipdfmx-tt_glyf.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-tt_glyf.o `test -f 'tt_glyf.c' || echo '$(srcdir)/'`tt_glyf.c + +xdvipdfmx-tt_glyf.obj: tt_glyf.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-tt_glyf.obj -MD -MP -MF $(DEPDIR)/xdvipdfmx-tt_glyf.Tpo -c -o xdvipdfmx-tt_glyf.obj `if test -f 'tt_glyf.c'; then $(CYGPATH_W) 'tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/tt_glyf.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-tt_glyf.Tpo $(DEPDIR)/xdvipdfmx-tt_glyf.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='tt_glyf.c' object='xdvipdfmx-tt_glyf.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-tt_glyf.obj `if test -f 'tt_glyf.c'; then $(CYGPATH_W) 'tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/tt_glyf.c'; fi` + xdvipdfmx-tt_gsub.o: tt_gsub.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-tt_gsub.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-tt_gsub.Tpo -c -o xdvipdfmx-tt_gsub.o `test -f 'tt_gsub.c' || echo '$(srcdir)/'`tt_gsub.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-tt_gsub.Tpo $(DEPDIR)/xdvipdfmx-tt_gsub.Po @@ -2775,6 +2800,20 @@ xdvipdfmx-tt_gsub.obj: tt_gsub.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-tt_gsub.obj `if test -f 'tt_gsub.c'; then $(CYGPATH_W) 'tt_gsub.c'; else $(CYGPATH_W) '$(srcdir)/tt_gsub.c'; fi` +xdvipdfmx-type0.o: type0.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-type0.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-type0.Tpo -c -o xdvipdfmx-type0.o `test -f 'type0.c' || echo '$(srcdir)/'`type0.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-type0.Tpo $(DEPDIR)/xdvipdfmx-type0.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='type0.c' object='xdvipdfmx-type0.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-type0.o `test -f 'type0.c' || echo '$(srcdir)/'`type0.c + +xdvipdfmx-type0.obj: type0.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-type0.obj -MD -MP -MF $(DEPDIR)/xdvipdfmx-type0.Tpo -c -o xdvipdfmx-type0.obj `if test -f 'type0.c'; then $(CYGPATH_W) 'type0.c'; else $(CYGPATH_W) '$(srcdir)/type0.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-type0.Tpo $(DEPDIR)/xdvipdfmx-type0.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='type0.c' object='xdvipdfmx-type0.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xdvipdfmx-type0.obj `if test -f 'type0.c'; then $(CYGPATH_W) 'type0.c'; else $(CYGPATH_W) '$(srcdir)/type0.c'; fi` + xdvipdfmx-unicode.o: unicode.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-unicode.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-unicode.Tpo -c -o xdvipdfmx-unicode.o `test -f 'unicode.c' || echo '$(srcdir)/'`unicode.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-unicode.Tpo $(DEPDIR)/xdvipdfmx-unicode.Po @@ -3111,20 +3150,6 @@ xsrc/xdvipdfmx-sfnt.obj: xsrc/sfnt.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-sfnt.obj `if test -f 'xsrc/sfnt.c'; then $(CYGPATH_W) 'xsrc/sfnt.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/sfnt.c'; fi` -xsrc/xdvipdfmx-spc_color.o: xsrc/spc_color.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_color.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Tpo -c -o xsrc/xdvipdfmx-spc_color.o `test -f 'xsrc/spc_color.c' || echo '$(srcdir)/'`xsrc/spc_color.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/spc_color.c' object='xsrc/xdvipdfmx-spc_color.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_color.o `test -f 'xsrc/spc_color.c' || echo '$(srcdir)/'`xsrc/spc_color.c - -xsrc/xdvipdfmx-spc_color.obj: xsrc/spc_color.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_color.obj -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Tpo -c -o xsrc/xdvipdfmx-spc_color.obj `if test -f 'xsrc/spc_color.c'; then $(CYGPATH_W) 'xsrc/spc_color.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_color.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_color.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/spc_color.c' object='xsrc/xdvipdfmx-spc_color.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_color.obj `if test -f 'xsrc/spc_color.c'; then $(CYGPATH_W) 'xsrc/spc_color.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_color.c'; fi` - xsrc/xdvipdfmx-spc_dvips.o: xsrc/spc_dvips.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_dvips.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_dvips.Tpo -c -o xsrc/xdvipdfmx-spc_dvips.o `test -f 'xsrc/spc_dvips.c' || echo '$(srcdir)/'`xsrc/spc_dvips.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_dvips.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_dvips.Po @@ -3139,20 +3164,6 @@ xsrc/xdvipdfmx-spc_dvips.obj: xsrc/spc_dvips.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_dvips.obj `if test -f 'xsrc/spc_dvips.c'; then $(CYGPATH_W) 'xsrc/spc_dvips.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_dvips.c'; fi` -xsrc/xdvipdfmx-spc_html.o: xsrc/spc_html.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_html.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Tpo -c -o xsrc/xdvipdfmx-spc_html.o `test -f 'xsrc/spc_html.c' || echo '$(srcdir)/'`xsrc/spc_html.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/spc_html.c' object='xsrc/xdvipdfmx-spc_html.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_html.o `test -f 'xsrc/spc_html.c' || echo '$(srcdir)/'`xsrc/spc_html.c - -xsrc/xdvipdfmx-spc_html.obj: xsrc/spc_html.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_html.obj -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Tpo -c -o xsrc/xdvipdfmx-spc_html.obj `if test -f 'xsrc/spc_html.c'; then $(CYGPATH_W) 'xsrc/spc_html.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_html.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_html.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/spc_html.c' object='xsrc/xdvipdfmx-spc_html.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_html.obj `if test -f 'xsrc/spc_html.c'; then $(CYGPATH_W) 'xsrc/spc_html.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_html.c'; fi` - xsrc/xdvipdfmx-spc_pdfm.o: xsrc/spc_pdfm.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_pdfm.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_pdfm.Tpo -c -o xsrc/xdvipdfmx-spc_pdfm.o `test -f 'xsrc/spc_pdfm.c' || echo '$(srcdir)/'`xsrc/spc_pdfm.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_pdfm.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_pdfm.Po @@ -3181,20 +3192,6 @@ xsrc/xdvipdfmx-spc_tpic.obj: xsrc/spc_tpic.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_tpic.obj `if test -f 'xsrc/spc_tpic.c'; then $(CYGPATH_W) 'xsrc/spc_tpic.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_tpic.c'; fi` -xsrc/xdvipdfmx-spc_util.o: xsrc/spc_util.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_util.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Tpo -c -o xsrc/xdvipdfmx-spc_util.o `test -f 'xsrc/spc_util.c' || echo '$(srcdir)/'`xsrc/spc_util.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/spc_util.c' object='xsrc/xdvipdfmx-spc_util.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_util.o `test -f 'xsrc/spc_util.c' || echo '$(srcdir)/'`xsrc/spc_util.c - -xsrc/xdvipdfmx-spc_util.obj: xsrc/spc_util.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-spc_util.obj -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Tpo -c -o xsrc/xdvipdfmx-spc_util.obj `if test -f 'xsrc/spc_util.c'; then $(CYGPATH_W) 'xsrc/spc_util.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_util.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Tpo xsrc/$(DEPDIR)/xdvipdfmx-spc_util.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/spc_util.c' object='xsrc/xdvipdfmx-spc_util.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-spc_util.obj `if test -f 'xsrc/spc_util.c'; then $(CYGPATH_W) 'xsrc/spc_util.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/spc_util.c'; fi` - xdvipdfmx-spc_xtx.o: spc_xtx.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xdvipdfmx-spc_xtx.o -MD -MP -MF $(DEPDIR)/xdvipdfmx-spc_xtx.Tpo -c -o xdvipdfmx-spc_xtx.o `test -f 'spc_xtx.c' || echo '$(srcdir)/'`spc_xtx.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xdvipdfmx-spc_xtx.Tpo $(DEPDIR)/xdvipdfmx-spc_xtx.Po @@ -3279,20 +3276,6 @@ xsrc/xdvipdfmx-tt_cmap.obj: xsrc/tt_cmap.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-tt_cmap.obj `if test -f 'xsrc/tt_cmap.c'; then $(CYGPATH_W) 'xsrc/tt_cmap.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/tt_cmap.c'; fi` -xsrc/xdvipdfmx-tt_glyf.o: xsrc/tt_glyf.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-tt_glyf.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Tpo -c -o xsrc/xdvipdfmx-tt_glyf.o `test -f 'xsrc/tt_glyf.c' || echo '$(srcdir)/'`xsrc/tt_glyf.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Tpo xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/tt_glyf.c' object='xsrc/xdvipdfmx-tt_glyf.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-tt_glyf.o `test -f 'xsrc/tt_glyf.c' || echo '$(srcdir)/'`xsrc/tt_glyf.c - -xsrc/xdvipdfmx-tt_glyf.obj: xsrc/tt_glyf.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-tt_glyf.obj -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Tpo -c -o xsrc/xdvipdfmx-tt_glyf.obj `if test -f 'xsrc/tt_glyf.c'; then $(CYGPATH_W) 'xsrc/tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/tt_glyf.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Tpo xsrc/$(DEPDIR)/xdvipdfmx-tt_glyf.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/tt_glyf.c' object='xsrc/xdvipdfmx-tt_glyf.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-tt_glyf.obj `if test -f 'xsrc/tt_glyf.c'; then $(CYGPATH_W) 'xsrc/tt_glyf.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/tt_glyf.c'; fi` - xsrc/xdvipdfmx-tt_post.o: xsrc/tt_post.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-tt_post.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-tt_post.Tpo -c -o xsrc/xdvipdfmx-tt_post.o `test -f 'xsrc/tt_post.c' || echo '$(srcdir)/'`xsrc/tt_post.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-tt_post.Tpo xsrc/$(DEPDIR)/xdvipdfmx-tt_post.Po @@ -3321,20 +3304,6 @@ xsrc/xdvipdfmx-tt_table.obj: xsrc/tt_table.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-tt_table.obj `if test -f 'xsrc/tt_table.c'; then $(CYGPATH_W) 'xsrc/tt_table.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/tt_table.c'; fi` -xsrc/xdvipdfmx-type0.o: xsrc/type0.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-type0.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-type0.Tpo -c -o xsrc/xdvipdfmx-type0.o `test -f 'xsrc/type0.c' || echo '$(srcdir)/'`xsrc/type0.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-type0.Tpo xsrc/$(DEPDIR)/xdvipdfmx-type0.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/type0.c' object='xsrc/xdvipdfmx-type0.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-type0.o `test -f 'xsrc/type0.c' || echo '$(srcdir)/'`xsrc/type0.c - -xsrc/xdvipdfmx-type0.obj: xsrc/type0.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-type0.obj -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-type0.Tpo -c -o xsrc/xdvipdfmx-type0.obj `if test -f 'xsrc/type0.c'; then $(CYGPATH_W) 'xsrc/type0.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/type0.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-type0.Tpo xsrc/$(DEPDIR)/xdvipdfmx-type0.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='xsrc/type0.c' object='xsrc/xdvipdfmx-type0.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xsrc/xdvipdfmx-type0.obj `if test -f 'xsrc/type0.c'; then $(CYGPATH_W) 'xsrc/type0.c'; else $(CYGPATH_W) '$(srcdir)/xsrc/type0.c'; fi` - xsrc/xdvipdfmx-type1.o: xsrc/type1.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(xdvipdfmx_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xsrc/xdvipdfmx-type1.o -MD -MP -MF xsrc/$(DEPDIR)/xdvipdfmx-type1.Tpo -c -o xsrc/xdvipdfmx-type1.o `test -f 'xsrc/type1.c' || echo '$(srcdir)/'`xsrc/type1.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) xsrc/$(DEPDIR)/xdvipdfmx-type1.Tpo xsrc/$(DEPDIR)/xdvipdfmx-type1.Po diff --git a/Build/source/texk/dvipdfm-x/cff.h b/Build/source/texk/dvipdfm-x/cff.h new file mode 100644 index 00000000000..e7598b9ff48 --- /dev/null +++ b/Build/source/texk/dvipdfm-x/cff.h @@ -0,0 +1,165 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +#ifndef _CFF_H_ +#define _CFF_H_ + +#include "mfileio.h" +#include "cff_types.h" + +#ifdef XETEX +#include "sfnt.h" +#endif + +/* Flag */ +#define FONTTYPE_CIDFONT (1 << 0) +#define FONTTYPE_FONT (1 << 1) +#define FONTTYPE_MMASTER (1 << 2) + +#define ENCODING_STANDARD (1 << 3) +#define ENCODING_EXPERT (1 << 4) + +#define CHARSETS_ISOADOBE (1 << 5) +#define CHARSETS_EXPERT (1 << 6) +#define CHARSETS_EXPSUB (1 << 7) + +#define HAVE_STANDARD_ENCODING (ENCODING_STANDARD|ENCODING_EXPERT) +#define HAVE_STANDARD_CHARSETS \ + (CHARSETS_ISOADOBE|CHARSETS_EXPERT|CHARSETS_EXPSUB) + +#define CFF_STRING_NOTDEF 65535 + +typedef struct +{ + char *fontname; /* FontName */ + + /* - CFF structure - */ + cff_header header; /* CFF Header */ + cff_index *name; /* Name INDEX */ + cff_dict *topdict; /* Top DICT (single) */ + cff_index *string; /* String INDEX */ + cff_index *gsubr; /* Global Subr INDEX */ + cff_encoding *encoding; /* Encodings */ + cff_charsets *charsets; /* Charsets */ + cff_fdselect *fdselect; /* FDSelect, CIDFont only */ + cff_index *cstrings; /* CharStrings */ + cff_dict **fdarray; /* CIDFont only */ + cff_dict **private; /* per-Font DICT */ + cff_index **subrs; /* Local Subr INDEX, per-Private DICT */ + + /* -- extra data -- */ + l_offset offset; /* non-zero for OpenType or PostScript wrapped */ + l_offset gsubr_offset; + card16 num_glyphs; /* number of glyphs (CharString INDEX count) */ + card8 num_fds; /* number of Font DICT */ + + /* Updated String INDEX. + * Please fix this. We should separate input and output. + */ + cff_index *_string; + +#ifdef XETEX + unsigned short *ft_to_gid; + sfnt *sfont; +#else + FILE *stream; +#endif + + int filter; /* not used, ASCII Hex filter if needed */ + + int index; /* CFF fontset index */ + int flag; /* Flag: see above */ +} cff_font; + +#ifdef XETEX +extern cff_font *cff_open (sfnt *sfont, long offset, int idx); +#define cff_seek_set(c, p) sfnt_seek_set (((c)->sfont), ((c)->offset) + (p)); +#else +extern cff_font *cff_open (FILE *file, long offset, int idx); +#define cff_seek_set(c, p) seek_absolute (((c)->stream), ((c)->offset) + (p)); +#endif + +extern void cff_close (cff_font *cff); + +/* CFF Header */ +extern long cff_put_header (cff_font *cff, card8 *dest, long destlen); + +/* CFF INDEX */ +extern cff_index *cff_get_index (cff_font *cff); +extern cff_index *cff_get_index_header (cff_font *cff); +extern void cff_release_index (cff_index *idx); +extern cff_index *cff_new_index (card16 count); +extern long cff_index_size (cff_index *idx); +extern long cff_pack_index (cff_index *idx, card8 *dest, long destlen); + +/* Name INDEX */ +extern char *cff_get_name (cff_font *cff); +extern long cff_set_name (cff_font *cff, char *name); + +/* Global and Local Subrs INDEX */ +extern long cff_read_subrs (cff_font *cff); + +/* Encoding */ +extern long cff_read_encoding (cff_font *cff); +extern long cff_pack_encoding (cff_font *cff, card8 *dest, long destlen); +extern card16 cff_encoding_lookup (cff_font *cff, card8 code); +extern void cff_release_encoding (cff_encoding *encoding); + +/* Charsets */ +extern long cff_read_charsets (cff_font *cff); +extern long cff_pack_charsets (cff_font *cff, card8 *dest, long destlen); + +/* Returns GID of PS name "glyph" */ +extern card16 cff_glyph_lookup (cff_font *cff, const char *glyph); +/* Returns GID of glyph with SID/CID "cid" */ +extern card16 cff_charsets_lookup (cff_font *cff, card16 cid); +extern void cff_release_charsets (cff_charsets *charset); +/* Returns SID or CID */ +extern card16 cff_charsets_lookup_inverse (cff_font *cff, card16 gid); + +/* FDSelect */ +extern long cff_read_fdselect (cff_font *cff); +extern long cff_pack_fdselect (cff_font *cff, card8 *dest, long destlen); +extern card8 cff_fdselect_lookup (cff_font *cff, card16 gid); +extern void cff_release_fdselect (cff_fdselect *fdselect); + +/* Font DICT(s) */ +extern long cff_read_fdarray (cff_font *cff); + +/* Private DICT(s) */ +extern long cff_read_private (cff_font *cff); + +#ifdef XETEX +extern unsigned short* cff_get_ft_to_gid(cff_font *cff); +#endif + +/* String */ +extern int cff_match_string (cff_font *cff, const char *str, s_SID sid); +extern char *cff_get_string (cff_font *cff, s_SID id); +extern long cff_get_sid (cff_font *cff, const char *str); +extern long cff_get_seac_sid (cff_font *cff, const char *str); +extern s_SID cff_add_string (cff_font *cff, const char *str, int unique); +extern void cff_update_string (cff_font *cff); + +#define cff_is_stdstr(s) (cff_get_sid(NULL, (s)) >= 0) + +#endif /* _CFF_H_ */ diff --git a/Build/source/texk/dvipdfm-x/spc_color.c b/Build/source/texk/dvipdfm-x/spc_color.c new file mode 100644 index 00000000000..3af4a71a3a6 --- /dev/null +++ b/Build/source/texk/dvipdfm-x/spc_color.c @@ -0,0 +1,192 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + Copyright (C) 1998, 1999 by Mark A. Wicks + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "system.h" +#include "mem.h" +#include "error.h" +#include "dpxutil.h" + +#include "pdfdev.h" +#include "pdfcolor.h" + +#include "specials.h" + +#include "spc_util.h" +#include "spc_color.h" + + +/* Color stack is actually placed into pdfcolor.c. + * The reason why we need to place stack there is + * that we must reinstall color after grestore and + * other operations that can change current color + * implicitely. + */ + +static int +spc_handler_color_push (struct spc_env *spe, struct spc_arg *args) +{ + int error; + pdf_color colorspec; + + error = spc_util_read_colorspec(spe, &colorspec, args, 1); + if (!error) { + pdf_color_push(&colorspec, &colorspec); + } + + return error; +} + +static int +spc_handler_color_pop (struct spc_env *spe, struct spc_arg *args) +{ + pdf_color_pop(); + + return 0; +} + +/* Invoked by the special command "color rgb .625 0 0". + * DVIPS clears the color stack, and then saves and sets the given color. + */ +static int +spc_handler_color_default (struct spc_env *spe, struct spc_arg *args) +{ + int error; + pdf_color colorspec; + + error = spc_util_read_colorspec(spe, &colorspec, args, 1); + if (!error) { + pdf_color_set_default(&colorspec); + pdf_color_clear_stack(); /* the default color is saved on color_stack */ + pdf_color_push(&colorspec, &colorspec); + } + + return error; +} + + +/* This is from color special? */ +#include "pdfdoc.h" + +static int +spc_handler_background (struct spc_env *spe, struct spc_arg *args) +{ + int error; + pdf_color colorspec; + + error = spc_util_read_colorspec(spe, &colorspec, args, 1); + if (!error) + pdf_doc_set_bgcolor(&colorspec); + + return error; +} + + +#ifndef ISBLANK +#define ISBLANK(c) ((c) == ' ' || (c) == '\t' || (c) == '\v') +#endif +static void +skip_blank (const char **pp, const char *endptr) +{ + const char *p = *pp; + for ( ; p < endptr && ISBLANK(*p); p++); + *pp = p; +} + +int +spc_color_check_special (const char *buf, long len) +{ + int r = 0; + const char *p, *endptr; + char *q; + + p = buf; + endptr = p + len; + + skip_blank(&p, endptr); + q = parse_c_ident(&p, endptr); + if (!q) + return 0; + else if (!strcmp(q, "color")) + r = 1; + else if (!strcmp(q, "background")) { + r = 1; + } + RELEASE(q); + + return r; +} + +int +spc_color_setup_handler (struct spc_handler *sph, + struct spc_env *spe, struct spc_arg *ap) +{ + const char *p; + char *q; + + ASSERT(sph && spe && ap); + + skip_blank(&ap->curptr, ap->endptr); + q = parse_c_ident(&ap->curptr, ap->endptr); + if (!q) + return -1; + skip_blank(&ap->curptr, ap->endptr); + + if (!strcmp(q, "background")) { + ap->command = "background"; + sph->exec = &spc_handler_background; + RELEASE(q); + } else if (!strcmp(q, "color")) { /* color */ + RELEASE(q); + p = ap->curptr; + + q = parse_c_ident(&p, ap->endptr); + if (!q) + return -1; + else if (!strcmp(q, "push")) { + ap->command = "push"; + sph->exec = &spc_handler_color_push; + ap->curptr = p; + } else if (!strcmp(q, "pop")) { + ap->command = "pop"; + sph->exec = &spc_handler_color_pop; + ap->curptr = p; + } else { /* cmyk, rgb, ... */ + ap->command = ""; + sph->exec = &spc_handler_color_default; + } + RELEASE(q); + } else { + spc_warn(spe, "Not color/background special?"); + RELEASE(q); + return -1; + } + + skip_blank(&ap->curptr, ap->endptr); + return 0; +} + diff --git a/Build/source/texk/dvipdfm-x/spc_html.c b/Build/source/texk/dvipdfm-x/spc_html.c new file mode 100644 index 00000000000..8b27656b900 --- /dev/null +++ b/Build/source/texk/dvipdfm-x/spc_html.c @@ -0,0 +1,950 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + Copyright (C) 1998, 1999 by Mark A. Wicks + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "system.h" +#include "mem.h" +#include "error.h" +#include "dpxutil.h" + +#include "pdfdraw.h" +#include "pdfdev.h" +#include "pdfximage.h" + +#include "pdfdoc.h" + +#include "specials.h" +#include "spc_util.h" + +#include "spc_html.h" + + +#define ENABLE_HTML_IMG_SUPPORT 1 +#define ENABLE_HTML_SVG_TRANSFORM 1 +#define ENABLE_HTML_SVG_OPACITY 1 + +/* _FIXME_ + * Please rewrite this or remove html special support + */ + +#define ANCHOR_TYPE_HREF 0 +#define ANCHOR_TYPE_NAME 1 + +struct spc_html_ +{ + struct { + long extensions; + } opts; + + pdf_obj *link_dict; + char *baseurl; + int pending_type; +}; + +static struct spc_html_ _html_state = { + { 0 }, + NULL, NULL, -1 +}; + + +#ifdef ENABLE_HTML_SVG_TRANSFORM +static int cvt_a_to_tmatrix (pdf_tmatrix *M, const char *ptr, const char **nextptr); +#endif /* ENABLE_HTML_SVG_TRANSFORM */ + +#define \ +downcasify(s) \ +if ((s)) { \ + char *_p = (char *) (s); \ + while (*(_p) != 0) { \ + if (*(_p) >= 'A' && *(_p) <= 'Z') { \ + *(_p) = (*(_p) - 'A') + 'a'; \ + } \ + _p++; \ + } \ +} + +static int +parse_key_val (const char **pp, const char *endptr, char **kp, char **vp) +{ + const char *q, *p; + char *k, *v; + int n, error = 0; + + for (p = *pp ; p < endptr && isspace(*p); p++); +#if 0 + while (!error && p < endptr && + ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z')) + ) { +#endif + k = v = NULL; + for (q = p, n = 0; + p < endptr && + ((*p >= 'a' && *p <= 'z') || + (*p >= 'A' && *p <= 'Z') || + (*p >= '0' && *p <= '9') || + *p == '-' || *p == ':' + ); n++, p++); + if (n == 0) { +#if 0 + break; +#else + *kp = *vp = NULL; + return -1; +#endif + } + k = NEW(n + 1, char); + memcpy(k, q, n); k[n] = '\0'; + if (p + 2 >= endptr || p[0] != '=' || (p[1] != '\"' && p[1] != '\'')) { + RELEASE(k); k = NULL; + *pp = p; + error = -1; + } else { + char qchr = p[1]; + p += 2; /* skip '="' */ + for (q = p, n = 0; p < endptr && *p != qchr; p++, n++); + if (p == endptr || *p != qchr) + error = -1; + else { + v = NEW(n + 1, char); + memcpy(v, q, n); v[n] = '\0'; +#if 0 + pdf_add_dict(t->attr, + pdf_new_name(k), + pdf_new_string(v, n)); + RELEASE(v); +#endif + p++; + } + } +#if 0 + RELEASE(k); + if (!error) + for ( ; p < endptr && isspace(*p); p++); + } +#endif + + *kp = k; *vp = v; *pp = p; + return error; +} + +#define HTML_TAG_NAME_MAX 127 +#define HTML_TAG_TYPE_EMPTY 1 +#define HTML_TAG_TYPE_OPEN 1 +#define HTML_TAG_TYPE_CLOSE 2 + +static int +read_html_tag (char *name, pdf_obj *attr, int *type, const char **pp, const char *endptr) +{ + const char *p = *pp; + int n = 0, error = 0; + + for ( ; p < endptr && isspace(*p); p++); + if (p >= endptr || *p != '<') + return -1; + + *type = HTML_TAG_TYPE_OPEN; + for (++p; p < endptr && isspace(*p); p++); + if (p < endptr && *p == '/') { + *type = HTML_TAG_TYPE_CLOSE; + for (++p; p < endptr && isspace(*p); p++); + } + +#define ISDELIM(c) ((c) == '>' || (c) == '/' || isspace(c)) + for (n = 0; p < endptr && n < HTML_TAG_NAME_MAX && !ISDELIM(*p); n++, p++) { + name[n] = *p; + } + name[n] = '\0'; + if (n == 0 || p == endptr || !ISDELIM(*p)) { + *pp = p; + return -1; + } + + for ( ; p < endptr && isspace(*p); p++); + while (p < endptr && !error && *p != '/' && *p != '>') { + char *kp = NULL, *vp = NULL; + error = parse_key_val(&p, endptr, &kp, &vp); + if (!error) { + downcasify(kp); + pdf_add_dict(attr, + pdf_new_name(kp), + pdf_new_string(vp, strlen(vp) + 1)); /* include trailing NULL here!!! */ + RELEASE(kp); + RELEASE(vp); + } + for ( ; p < endptr && isspace(*p); p++); + } + if (error) { + *pp = p; + return error; + } + + if (p < endptr && *p == '/') { + *type = HTML_TAG_TYPE_EMPTY; + for (++p; p < endptr && isspace(*p); p++); + } + if (p == endptr || *p != '>') { + *pp = p; + return -1; + } + p++; + + downcasify(name); + *pp = p; + return 0; +} + + +static int +spc_handler_html__init (struct spc_env *spe, struct spc_arg *ap, void *dp) +{ + struct spc_html_ *sd = dp; + + sd->link_dict = NULL; + sd->baseurl = NULL; + sd->pending_type = -1; + + return 0; +} + +static int +spc_handler_html__clean (struct spc_env *spe, struct spc_arg *ap, void *dp) +{ + struct spc_html_ *sd = dp; + + if (sd->baseurl) + RELEASE(sd->baseurl); + + if (sd->pending_type >= 0 || sd->link_dict) + spc_warn(spe, "Unclosed html anchor found."); + + if (sd->link_dict) + pdf_release_obj(sd->link_dict); + + sd->pending_type = -1; + sd->baseurl = NULL; + sd->link_dict = NULL; + + return 0; +} + + +static int +spc_handler_html__bophook (struct spc_env *spe, struct spc_arg *ap, void *dp) +{ + struct spc_html_ *sd = dp; + + if (sd->pending_type >= 0) { + spc_warn(spe, "...html anchor continues from previous page processed..."); + } + + return 0; +} + +static int +spc_handler_html__eophook (struct spc_env *spe, struct spc_arg *ap, void *dp) +{ + struct spc_html_ *sd = dp; + + if (sd->pending_type >= 0) { + spc_warn(spe, "Unclosed html anchor at end-of-page!"); + } + + return 0; +} + + +static char * +fqurl (const char *baseurl, const char *name) +{ + char *q; + int len = 0; + + len = strlen(name); + if (baseurl) + len += strlen(baseurl) + 1; /* we may want to add '/' */ + + q = NEW(len + 1, char); + *q = '\0'; + if (baseurl && baseurl[0]) { + char *p; + strcpy(q, baseurl); + p = q + strlen(q) - 1; + if (*p == '/') + *p = '\0'; + if (name[0] && name[0] != '/') + strcat(q, "/"); + } + strcat(q, name); + + return q; +} + +static int +html_open_link (struct spc_env *spe, const char *name, struct spc_html_ *sd) +{ + pdf_obj *color; + char *url; + + ASSERT( name ); + ASSERT( sd->link_dict == NULL ); /* Should be checked somewhere else */ + + sd->link_dict = pdf_new_dict(); + pdf_add_dict(sd->link_dict, + pdf_new_name("Type"), pdf_new_name ("Annot")); + pdf_add_dict(sd->link_dict, + pdf_new_name("Subtype"), pdf_new_name ("Link")); + + color = pdf_new_array (); + pdf_add_array(color, pdf_new_number(0.0)); + pdf_add_array(color, pdf_new_number(0.0)); + pdf_add_array(color, pdf_new_number(1.0)); + pdf_add_dict(sd->link_dict, pdf_new_name("C"), color); + + url = fqurl(sd->baseurl, name); + if (url[0] == '#') { + /* url++; causes memory leak in RELEASE(url) */ + pdf_add_dict(sd->link_dict, + pdf_new_name("Dest"), + pdf_new_string(url+1, strlen(url+1))); + } else { /* Assume this is URL */ + pdf_obj *action = pdf_new_dict(); + pdf_add_dict(action, + pdf_new_name("Type"), + pdf_new_name("Action")); + pdf_add_dict(action, + pdf_new_name("S"), + pdf_new_name("URI")); + pdf_add_dict(action, + pdf_new_name("URI"), + pdf_new_string(url, strlen(url))); + pdf_add_dict(sd->link_dict, + pdf_new_name("A"), + pdf_link_obj(action)); + pdf_release_obj(action); + } + RELEASE(url); + + spc_begin_annot(spe, sd->link_dict); + + sd->pending_type = ANCHOR_TYPE_HREF; + + return 0; +} + +static int +html_open_dest (struct spc_env *spe, const char *name, struct spc_html_ *sd) +{ + int error; + pdf_obj *array, *page_ref; + pdf_coord cp; + + cp.x = spe->x_user; cp.y = spe->y_user; + pdf_dev_transform(&cp, NULL); + + page_ref = pdf_doc_this_page_ref(); + ASSERT( page_ref ); /* Otherwise must be bug */ + + array = pdf_new_array(); + pdf_add_array(array, page_ref); + pdf_add_array(array, pdf_new_name("XYZ")); + pdf_add_array(array, pdf_new_null()); + pdf_add_array(array, pdf_new_number(cp.y + 24.0)); + pdf_add_array(array, pdf_new_null()); + + error = pdf_doc_add_names("Dests", + name, strlen(name), + array); + + if (error) + spc_warn(spe, "Failed to add named destination: %s", name); + + sd->pending_type = ANCHOR_TYPE_NAME; + + return error; +} + +#define ANCHOR_STARTED(s) ((s)->pending_type >= 0 || (s)->link_dict) + +static int +spc_html__anchor_open (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) +{ + pdf_obj *href, *name; + int error = 0; + + if (ANCHOR_STARTED(sd)) { + spc_warn(spe, "Nested html anchors found!"); + return -1; + } + + href = pdf_lookup_dict(attr, "href"); + name = pdf_lookup_dict(attr, "name"); + if (href && name) { + spc_warn(spe, "Sorry, you can't have both \"href\" and \"name\" in anchor tag..."); + error = -1; + } else if (href) { + error = html_open_link(spe, pdf_string_value(href), sd); + } else if (name) { /* name */ + error = html_open_dest(spe, pdf_string_value(name), sd); + } else { + spc_warn(spe, "You should have \"href\" or \"name\" in anchor tag!"); + error = -1; + } + + return error; +} + +static int +spc_html__anchor_close (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) +{ + int error = 0; + + switch (sd->pending_type) { + case ANCHOR_TYPE_HREF: + if (sd->link_dict) { + spc_end_annot(spe); + pdf_release_obj(sd->link_dict); + sd->link_dict = NULL; + sd->pending_type = -1; + } else { + spc_warn(spe, "Closing html anchor (link) without starting!"); + error = -1; + } + break; + case ANCHOR_TYPE_NAME: + sd->pending_type = -1; + break; + default: + spc_warn(spe, "No corresponding opening tag for html anchor."); + error = -1; + break; + } + + return error; +} + +static int +spc_html__base_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) +{ + pdf_obj *href; + char *vp; + + href = pdf_lookup_dict(attr, "href"); + if (!href) { + spc_warn(spe, "\"href\" not found for \"base\" tag!"); + return -1; + } + + vp = (char *) pdf_string_value(href); + if (sd->baseurl) { + spc_warn(spe, "\"baseurl\" changed: \"%s\" --> \"%s\"", sd->baseurl, vp); + RELEASE(sd->baseurl); + } + sd->baseurl = NEW(strlen(vp) + 1, char); + strcpy(sd->baseurl, vp); + + return 0; +} + + +#ifdef ENABLE_HTML_IMG_SUPPORT +/* This isn't completed. + * Please think about placement of images. + */ +static double +atopt (const char *a) +{ + char *q; + const char *p = a; + double v, u = 1.0; + const char *_ukeys[] = { +#define K_UNIT__PT 0 +#define K_UNIT__IN 1 +#define K_UNIT__CM 2 +#define K_UNIT__MM 3 +#define K_UNIT__BP 4 + "pt", "in", "cm", "mm", "bp", +#define K_UNIT__PX 5 + "px", + NULL + }; + int k; + + q = parse_float_decimal(&p, p + strlen(p)); + if (!q) { + WARN("Invalid length value: %s (%c)", a, *p); + return 0.0; + } + + v = atof(q); + RELEASE(q); + + q = parse_c_ident(&p, p + strlen(p)); + if (q) { + for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++); + switch (k) { + case K_UNIT__PT: u *= 72.0 / 72.27; break; + case K_UNIT__IN: u *= 72.0; break; + case K_UNIT__CM: u *= 72.0 / 2.54 ; break; + case K_UNIT__MM: u *= 72.0 / 25.4 ; break; + case K_UNIT__BP: u *= 1.0 ; break; + case K_UNIT__PX: u *= 1.0 ; break; /* 72dpi */ + default: + WARN("Unknown unit of measure: %s", q); + break; + } + RELEASE(q); + } + + return v * u; +} + + +#ifdef ENABLE_HTML_SVG_OPACITY +/* Replicated from spc_tpic */ +static pdf_obj * +create_xgstate (double a /* alpha */, int f_ais /* alpha is shape */) +{ + pdf_obj *dict; + + dict = pdf_new_dict(); + pdf_add_dict(dict, + pdf_new_name("Type"), + pdf_new_name("ExtGState")); + if (f_ais) { + pdf_add_dict(dict, + pdf_new_name("AIS"), + pdf_new_boolean(1)); + } + pdf_add_dict(dict, + pdf_new_name("ca"), + pdf_new_number(a)); + + return dict; +} + +static int +check_resourcestatus (const char *category, const char *resname) +{ + pdf_obj *dict1, *dict2; + + dict1 = pdf_doc_current_page_resources(); + if (!dict1) + return 0; + + dict2 = pdf_lookup_dict(dict1, category); + if (dict2 && + pdf_obj_typeof(dict2) == PDF_DICT) { + if (pdf_lookup_dict(dict2, resname)) + return 1; + } + return 0; +} +#endif /* ENABLE_HTML_SVG_OPACITY */ + +static int +spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) +{ + pdf_obj *src, *obj; + transform_info ti; + int id, error = 0; +#ifdef ENABLE_HTML_SVG_OPACITY + double alpha = 1.0; /* meaning fully opaque */ +#endif /* ENABLE_HTML_SVG_OPACITY */ +#ifdef ENABLE_HTML_SVG_TRANSFORM + pdf_tmatrix M, M1; + + pdf_setmatrix(&M, 1.0, 0.0, 0.0, 1.0, spe->x_user, spe->y_user); +#endif /* ENABLE_HTML_SVG_TRANSFORM */ + + spc_warn(spe, "html \"img\" tag found (not completed, plese don't use!)."); + + src = pdf_lookup_dict(attr, "src"); + if (!src) { + spc_warn(spe, "\"src\" attribute not found for \"img\" tag!"); + return -1; + } + + transform_info_clear(&ti); + obj = pdf_lookup_dict(attr, "width"); + if (obj) { + ti.width = atopt(pdf_string_value(obj)); + ti.flags |= INFO_HAS_WIDTH; + } + obj = pdf_lookup_dict(attr, "height"); + if (obj) { + ti.height = atopt(pdf_string_value(obj)); + ti.flags |= INFO_HAS_HEIGHT; + } + +#ifdef ENABLE_HTML_SVG_OPACITY + obj = pdf_lookup_dict(attr, "svg:opacity"); + if (obj) { + alpha = atof(pdf_string_value(obj)); + if (alpha < 0.0 || alpha > 1.0) { + spc_warn(spe, "Invalid opacity value: %s", pdf_string_value(obj)); + alpha = 1.0; + } + } +#endif /* ENABLE_HTML_SVG_OPCAITY */ + +#ifdef ENABLE_HTML_SVG_TRANSFORM + obj = pdf_lookup_dict(attr, "svg:transform"); + if (obj) { + const char *p = pdf_string_value(obj); + pdf_tmatrix N; + for ( ; *p && isspace(*p); p++); + while (*p && !error) { + pdf_setmatrix(&N, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); + error = cvt_a_to_tmatrix(&N, p, &p); + if (!error) { + N.f = -N.f; + pdf_concatmatrix(&M, &N); + for ( ; *p && isspace(*p); p++); + if (*p == ',') + for (++p; *p && isspace(*p); p++); + } + } + } +#endif /* ENABLE_HTML_SVG_TRANSFORM */ + + if (error) { + spc_warn(spe, "Error in html \"img\" tag attribute."); + return error; + } + + id = pdf_ximage_findresource(pdf_string_value(src), 0, NULL); + if (id < 0) { + spc_warn(spe, "Could not find/load image: %s", pdf_string_value(src)); + error = -1; + } else { +#if defined(ENABLE_HTML_SVG_TRANSFORM) || defined(ENABLE_HTML_SVG_OPACITY) + { + char *res_name; + pdf_rect r; + + graphics_mode(); + + pdf_dev_gsave(); + +#ifdef ENABLE_HTML_SVG_OPACITY + { + pdf_obj *dict; + int a = round(100.0 * alpha); + if (a != 0) { + res_name = NEW(strlen("_Tps_a100_") + 1, char); + sprintf(res_name, "_Tps_a%03d_", a); /* Not Tps prefix but... */ + if (!check_resourcestatus("ExtGState", res_name)) { + dict = create_xgstate(round_at(0.01 * a, 0.01), 0); + pdf_doc_add_page_resource("ExtGState", + res_name, pdf_ref_obj(dict)); + pdf_release_obj(dict); + } + pdf_doc_add_page_content(" /", 2); /* op: */ + pdf_doc_add_page_content(res_name, strlen(res_name)); /* op: */ + pdf_doc_add_page_content(" gs", 3); /* op: gs */ + RELEASE(res_name); + } + } +#endif /* ENABLE_HTML_SVG_OPACITY */ + +#ifdef XETEX + pdf_dev_concat(&M); + + pdf_ximage_scale_image(id, &M1, &r, &ti); + pdf_dev_concat(&M1); +#else + pdf_ximage_scale_image(id, &M1, &r, &ti); + pdf_concatmatrix(&M, &M1); + pdf_dev_concat(&M); +#endif + + pdf_dev_rectclip(r.llx, r.lly, r.urx - r.llx, r.ury - r.lly); + + res_name = pdf_ximage_get_resname(id); + pdf_doc_add_page_content(" /", 2); /* op: */ + pdf_doc_add_page_content(res_name, strlen(res_name)); /* op: */ + pdf_doc_add_page_content(" Do", 3); /* op: Do */ + + pdf_dev_grestore(); + + pdf_doc_add_page_resource("XObject", + res_name, + pdf_ximage_get_reference(id)); + } +#else + pdf_dev_put_image(id, &ti, spe->x_user, spe->y_user); +#endif /* ENABLE_HTML_SVG_XXX */ + } + + return error; +} +#else +static int +spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) +{ + spc_warn(spe, "IMG tag not yet supported yet..."); + return -1; +} +#endif /* ENABLE_HTML_IMG_SUPPORT */ + + +static int +spc_handler_html_default (struct spc_env *spe, struct spc_arg *ap) +{ + struct spc_html_ *sd = &_html_state; + char name[HTML_TAG_NAME_MAX + 1]; + pdf_obj *attr; + int error = 0, type = HTML_TAG_TYPE_OPEN; + + if (ap->curptr >= ap->endptr) + return 0; + + attr = pdf_new_dict(); + error = read_html_tag(name, attr, &type, &ap->curptr, ap->endptr); + if (error) { + pdf_release_obj(attr); + return error; + } + if (!strcmp(name, "a")) { + switch (type) { + case HTML_TAG_TYPE_OPEN: + error = spc_html__anchor_open (spe, attr, sd); + break; + case HTML_TAG_TYPE_CLOSE: + error = spc_html__anchor_close(spe, attr, sd); + break; + default: + spc_warn(spe, "Empty html anchor tag???"); + error = -1; + break; + } + } else if (!strcmp(name, "base")) { + if (type == HTML_TAG_TYPE_CLOSE) { + spc_warn(spe, "Close tag for \"base\"???"); + error = -1; + } else { /* treat "open" same as "empty" */ + error = spc_html__base_empty(spe, attr, sd); + } + } else if (!strcmp(name, "img")) { + if (type == HTML_TAG_TYPE_CLOSE) { + spc_warn(spe, "Close tag for \"img\"???"); + error = -1; + } else { /* treat "open" same as "empty" */ + error = spc_html__img_empty(spe, attr, sd); + } + } + pdf_release_obj(attr); + + for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); + + return error; +} + + +#ifdef ENABLE_HTML_SVG_TRANSFORM +/* translate wsp* '(' wsp* number (comma-wsp number)? wsp* ')' */ +static int +cvt_a_to_tmatrix (pdf_tmatrix *M, const char *ptr, const char **nextptr) +{ + char *q; + const char *p = ptr; + int n; + double v[6]; + static const char *_tkeys[] = { +#define K_TRNS__MATRIX 0 + "matrix", /* a b c d e f */ +#define K_TRNS__TRANSLATE 1 + "translate", /* tx [ty] : dflt. tf = 0 */ +#define K_TRNS__SCALE 2 + "scale", /* sx [sy] : dflt. sy = sx */ +#define K_TRNS__ROTATE 3 + "rotate", /* ang [cx cy] : dflt. cx, cy = 0 */ +#define K_TRNS__SKEWX 4 +#define K_TRNS__SKEWY 5 + "skewX", /* ang */ + "skewY", /* ang */ + NULL + }; + int k; + + for ( ; *p && isspace(*p); p++); + + q = parse_c_ident(&p, p + strlen(p)); + if (!q) + return -1; + /* parsed transformation key */ + for (k = 0; _tkeys[k] && strcmp(q, _tkeys[k]); k++); + RELEASE(q); + + /* handle args */ + for ( ; *p && isspace(*p); p++); + if (*p != '(' || *(p + 1) == 0) + return -1; + for (++p; *p && isspace(*p); p++); + for (n = 0; n < 6 && *p && *p != ')'; n++) { + q = parse_float_decimal(&p, p + strlen(p)); + if (!q) + break; + else { + v[n] = atof(q); + if (*p == ',') + p++; + for ( ; *p && isspace(*p); p++); + if (*p == ',') + for (++p; *p && isspace(*p); p++); + RELEASE(q); + } + } + if (*p != ')') + return -1; + p++; + + switch (k) { + case K_TRNS__MATRIX: + if (n != 6) + return -1; + M->a = v[0]; M->c = v[1]; + M->b = v[2]; M->d = v[3]; + M->e = v[4]; M->f = v[5]; + break; + case K_TRNS__TRANSLATE: + if (n != 1 && n != 2) + return -1; + M->a = M->d = 1.0; + M->c = M->b = 0.0; + M->e = v[0]; M->f = (n == 2) ? v[1] : 0.0; + break; + case K_TRNS__SCALE: + if (n != 1 && n != 2) + return -1; + M->a = v[0]; M->d = (n == 2) ? v[1] : v[0]; + M->c = M->b = 0.0; + M->e = M->f = 0.0; + break; + case K_TRNS__ROTATE: + if (n != 1 && n != 3) + return -1; + M->a = cos(v[0] * M_PI / 180.0); + M->c = sin(v[0] * M_PI / 180.0); + M->b = -M->c; M->d = M->a; + M->e = (n == 3) ? v[1] : 0.0; + M->f = (n == 3) ? v[2] : 0.0; + break; + case K_TRNS__SKEWX: + if (n != 1) + return -1; + M->a = M->d = 1.0; + M->c = 0.0; + M->b = tan(v[0] * M_PI / 180.0); + break; + case K_TRNS__SKEWY: + if (n != 1) + return -1; + M->a = M->d = 1.0; + M->c = tan(v[0] * M_PI / 180.0); + M->b = 0.0; + break; + } + + if (nextptr) + *nextptr = p; + return 0; +} +#endif /* ENABLE_HTML_SVG_TRANSFORM */ + +int +spc_html_at_begin_document (void) +{ + struct spc_html_ *sd = &_html_state; + return spc_handler_html__init(NULL, NULL, sd); +} + +int +spc_html_at_begin_page (void) +{ + struct spc_html_ *sd = &_html_state; + return spc_handler_html__bophook(NULL, NULL, sd); +} + +int +spc_html_at_end_page (void) +{ + struct spc_html_ *sd = &_html_state; + return spc_handler_html__eophook(NULL, NULL, sd); +} + +int +spc_html_at_end_document (void) +{ + struct spc_html_ *sd = &_html_state; + return spc_handler_html__clean(NULL, NULL, sd); +} + + +int +spc_html_check_special (const char *buffer, long size) +{ + const char *p, *endptr; + + p = buffer; + endptr = p + size; + + for ( ; p < endptr && isspace(*p); p++); + size = (long) (endptr - p); + if (size >= strlen("html:") && + !memcmp(p, "html:", strlen("html:"))) { + return 1; + } + + return 0; +} + + +int +spc_html_setup_handler (struct spc_handler *sph, + struct spc_env *spe, struct spc_arg *ap) +{ + ASSERT(sph && spe && ap); + + for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); + if (ap->curptr + strlen("html:") > ap->endptr || + memcmp(ap->curptr, "html:", strlen("html:"))) { + return -1; + } + + ap->command = ""; + + sph->key = "html:"; + sph->exec = &spc_handler_html_default; + + ap->curptr += strlen("html:"); + for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); + + return 0; +} + diff --git a/Build/source/texk/dvipdfm-x/spc_util.c b/Build/source/texk/dvipdfm-x/spc_util.c new file mode 100644 index 00000000000..29bdaeb769a --- /dev/null +++ b/Build/source/texk/dvipdfm-x/spc_util.c @@ -0,0 +1,820 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2007-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + Copyright (C) 1998, 1999 by Mark A. Wicks + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "system.h" +#include "mem.h" +#include "error.h" +#include "dpxutil.h" + +#include "pdfdev.h" +#include "pdfparse.h" +#include "pdfcolor.h" +#include "pdfdraw.h" + +#include "specials.h" + +#include "spc_util.h" + + +#ifndef ISBLANK +#define ISBLANK(c) ((c) == ' ' || (c) == '\t') +#endif +static void +skip_blank (const char **pp, const char *endptr) +{ + const char *p = *pp; + for ( ; p < endptr && ISBLANK(*p); p++); + *pp = p; +} + + +/* From pdfcolor.c */ +static int pdf_color_namedcolor (pdf_color *color, const char *colorname); + +#ifndef XETEX +static +#endif +int +spc_util_read_numbers (double *values, int num_values, + struct spc_env *spe, struct spc_arg *args) +{ + int count; + char *q; + + skip_blank(&args->curptr, args->endptr); + for (count = 0; + count < num_values && + args->curptr < args->endptr; ) { + q = parse_float_decimal(&args->curptr, args->endptr); + if (!q) + break; + else { + values[count] = atof(q); + RELEASE(q); + skip_blank(&args->curptr, args->endptr); + count++; + } + } + + return count; +} + +static void +rgb_color_from_hsv (pdf_color *color, double h, double s, double v) +{ + double r, g, b; + ASSERT( color ); + r = g = b = v; + if (s != 0.0) { + double h6, f, v1, v2, v3; + int i; + h6 = h * 6; /* 360 / 60 */ + i = (int) h6; + f = h6 - i; + v1 = v * (1 - s); + v2 = v * (1 - s * f); + v3 = v * (1 - s * (1 - f)); + switch (i) { + case 0: r = v ; g = v3; b = v1; break; + case 1: r = v2; g = v ; b = v1; break; + case 2: r = v1; g = v ; b = v3; break; + case 3: r = v1; g = v2; b = v ; break; + case 4: r = v3; g = v1; b = v ; break; + case 5: r = v ; g = v1; b = v2; break; + case 6: r = v ; g = v1; b = v2; break; + } + } + pdf_color_rgbcolor(color, r, g, b); +} + +static int +spc_read_color_color (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) +{ + char *q; + double cv[4]; + int nc; + int error = 0; + + q = parse_c_ident(&ap->curptr, ap->endptr); + if (!q) { + spc_warn(spe, "No valid color specified?"); + return -1; + } + skip_blank(&ap->curptr, ap->endptr); + + if (!strcmp(q, "rgb")) { /* Handle rgb color */ + nc = spc_util_read_numbers(cv, 3, spe, ap); + if (nc != 3) { + spc_warn(spe, "Invalid value for RGB color specification."); + error = -1; + } else { + pdf_color_rgbcolor(colorspec, cv[0], cv[1], cv[2]); + } + } else if (!strcmp(q, "cmyk")) { /* Handle cmyk color */ + nc = spc_util_read_numbers(cv, 4, spe, ap); + if (nc != 4) { + spc_warn(spe, "Invalid value for CMYK color specification."); + error = -1; + } else { + pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); + } + } else if (!strcmp(q, "gray")) { /* Handle gray */ + nc = spc_util_read_numbers(cv, 1, spe, ap); + if (nc != 1) { + spc_warn(spe, "Invalid value for gray color specification."); + error = -1; + } else { + pdf_color_graycolor(colorspec, cv[0]); + } + } else if (!strcmp(q, "hsb")) { + nc = spc_util_read_numbers(cv, 3, spe, ap); + if (nc != 3) { + spc_warn(spe, "Invalid value for HSB color specification."); + error = -1; + } else { + rgb_color_from_hsv(colorspec, cv[0], cv[1], cv[2]); + spc_warn(spe, "HSB color converted to RGB: hsb: <%g, %g, %g> ==> rgb: <%g, %g, %g>", + cv[0], cv[1], cv[2], + colorspec->values[0], colorspec->values[1], colorspec->values[2]); + } + } else { /* Must be a "named" color */ + error = pdf_color_namedcolor(colorspec, q); + if (error) + spc_warn(spe, "Unrecognized color name: %s", q); + } + RELEASE(q); + + return error; +} + +#ifndef XETEX +/* Argument for this is PDF_Number or PDF_Array. + * But we ignore that since we don't want to add + * dependency to pdfxxx and @foo can not be + * allowed for color specification. "pdf" here + * means pdf: special syntax. + */ +static int +spc_read_color_pdf (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) +{ + double cv[4]; /* at most four */ + int nc, isarry = 0; + int error = 0; + char *q; + + skip_blank(&ap->curptr, ap->endptr); + + if (ap->curptr[0] == '[') { + ap->curptr++; skip_blank(&ap->curptr, ap->endptr); + isarry = 1; + } + + nc = spc_util_read_numbers(cv, 4, spe, ap); + switch (nc) { + case 1: + pdf_color_graycolor(colorspec, cv[0]); + break; + case 3: + pdf_color_rgbcolor (colorspec, cv[0], cv[1], cv[2]); + break; + case 4: + pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); + break; + default: + /* Try to read the color names defined in dvipsname.def */ + q = parse_c_ident(&ap->curptr, ap->endptr); + if (!q) { + spc_warn(spe, "No valid color specified?"); + return -1; + } + error = pdf_color_namedcolor(colorspec, q); + if (error) + spc_warn(spe, "Unrecognized color name: %s, keep the current color", q); + RELEASE(q); + break; + } + + if (isarry) { + skip_blank(&ap->curptr, ap->endptr); + if (ap->curptr >= ap->endptr || ap->curptr[0] != ']') { + spc_warn(spe, "Unbalanced '[' and ']' in color specification."); + error = -1; + } else { + ap->curptr++; + } + } + + return error; +} +#endif + +/* This is for reading *single* color specification. */ +int +spc_util_read_colorspec (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap, int syntax) +{ + ASSERT(colorspec && spe && ap); + + skip_blank(&ap->curptr, ap->endptr); + if (ap->curptr >= ap->endptr) { + return -1; + } + + if (syntax) + return spc_read_color_color(spe, colorspec, ap); + else +#ifdef XETEX + return -1; +#else + return spc_read_color_pdf(spe, colorspec, ap); +#endif +} + +#ifndef XETEX +int +spc_util_read_pdfcolor (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap, pdf_color *defaultcolor) +{ + int error = 0; + + ASSERT(colorspec && spe && ap); + + skip_blank(&ap->curptr, ap->endptr); + if (ap->curptr >= ap->endptr) { + return -1; + } + error = spc_read_color_pdf(spe, colorspec, ap); + if (error < 0 && defaultcolor) { + pdf_color_copycolor(colorspec, defaultcolor); + error = 0; + } + return error; +} +#endif + +/* This need to allow 'true' prefix for unit and + * length value must be divided by current magnification. + */ +static int +spc_util_read_length (struct spc_env *spe, double *vp /* ret. */, struct spc_arg *ap) +{ + char *q; + double v, u = 1.0; + const char *ukeys[] = { +#define K_UNIT__PT 0 +#define K_UNIT__IN 1 +#define K_UNIT__CM 2 +#define K_UNIT__MM 3 +#define K_UNIT__BP 4 + "pt", "in", "cm", "mm", "bp", NULL + }; + int k, error = 0; + + q = parse_float_decimal(&ap->curptr, ap->endptr); + if (!q) + return -1; + + v = atof(q); + RELEASE(q); + + skip_white(&ap->curptr, ap->endptr); + q = parse_c_ident(&ap->curptr, ap->endptr); + if (q) { + char *qq = q; + if (strlen(q) >= strlen("true") && + !memcmp(q, "true", strlen("true"))) { + u /= spe->mag != 0.0 ? spe->mag : 1.0; /* inverse magnify */ + q += strlen("true"); + + if (!*q) { + RELEASE(qq); + skip_white(&ap->curptr, ap->endptr); + qq = q = parse_c_ident(&ap->curptr, ap->endptr); + } + } + + if (q) { + for (k = 0; ukeys[k] && strcmp(ukeys[k], q); k++); + switch (k) { + case K_UNIT__PT: u *= 72.0 / 72.27; break; + case K_UNIT__IN: u *= 72.0; break; + case K_UNIT__CM: u *= 72.0 / 2.54 ; break; + case K_UNIT__MM: u *= 72.0 / 25.4 ; break; + case K_UNIT__BP: u *= 1.0 ; break; + default: + spc_warn(spe, "Unknown unit of measure: %s", q); + error = -1; + break; + } + RELEASE(qq); + } + else { + spc_warn(spe, "Missing unit of measure after \"true\""); + error = -1; + } + } + + *vp = v * u; + return error; +} + + +/* + * Compute a transformation matrix + * transformations are applied in the following + * order: scaling, rotate, displacement. + */ +static void +make_transmatrix (pdf_tmatrix *M, + double xoffset, double yoffset, + double xscale, double yscale, + double rotate) +{ + double c, s; + + c = cos(rotate); + s = sin(rotate); + + M->a = xscale * c; M->b = xscale * s; + M->c = -yscale * s; M->d = yscale * c; + M->e = xoffset; M->f = yoffset; +} + +static int +spc_read_dimtrns_dvips (struct spc_env *spe, transform_info *t, struct spc_arg *ap) +{ + static const char *_dtkeys[] = { +#define K_TRN__HOFFSET 0 +#define K_TRN__VOFFSET 1 + "hoffset", "voffset", +#define K_DIM__HSIZE 2 +#define K_DIM__VSIZE 3 + "hsize", "vsize", +#define K_TRN__HSCALE 4 +#define K_TRN__VSCALE 5 + "hscale", "vscale", +#define K_TRN__ANGLE 6 + "angle", +#define K__CLIP 7 + "clip", +#define K_DIM__LLX 8 +#define K_DIM__LLY 9 +#define K_DIM__URX 10 +#define K_DIM__URY 11 + "llx", "lly", "urx", "ury", +#define K_DIM__RWI 12 +#define K_DIM__RHI 13 + "rwi", "rhi", + NULL + }; + double xoffset, yoffset, xscale, yscale, rotate; + int error = 0; + + xoffset = yoffset = rotate = 0.0; xscale = yscale = 1.0; + + skip_blank(&ap->curptr, ap->endptr); + while (!error && ap->curptr < ap->endptr) { + char *kp, *vp; + int k; + + kp = parse_c_ident(&ap->curptr, ap->endptr); + if (!kp) + break; + + for (k = 0; _dtkeys[k] && strcmp(kp, _dtkeys[k]); k++); + if (!_dtkeys[k]) { + spc_warn(spe, "Unrecognized dimension/transformation key: %s", kp); + error = -1; + RELEASE(kp); + break; + } + + skip_blank(&ap->curptr, ap->endptr); + if (k == K__CLIP) { + t->flags |= INFO_DO_CLIP; + RELEASE(kp); + continue; /* not key-value */ + } + + if (ap->curptr < ap->endptr && ap->curptr[0] == '=') { + ap->curptr++; + skip_blank(&ap->curptr, ap->endptr); + } + + vp = NULL; + if (ap->curptr[0] == '\'' || ap->curptr[0] == '\"') { + char qchr = ap->curptr[0]; + ap->curptr++; + skip_blank(&ap->curptr, ap->endptr); + vp = parse_float_decimal(&ap->curptr, ap->endptr); + skip_blank(&ap->curptr, ap->endptr); + if (vp && qchr != ap->curptr[0]) { + spc_warn(spe, "Syntax error in dimension/transformation specification."); + error = -1; + RELEASE(vp); vp = NULL; + } + ap->curptr++; + } else { + vp = parse_float_decimal(&ap->curptr, ap->endptr); + } + if (!error && !vp) { + spc_warn(spe, "Missing value for dimension/transformation: %s", kp); + error = -1; + } + RELEASE(kp); + if (!vp || error) { + break; + } + + switch (k) { + case K_TRN__HOFFSET: + xoffset = atof(vp); + break; + case K_TRN__VOFFSET: + yoffset = atof(vp); + break; + case K_DIM__HSIZE: + t->width = atof(vp); + t->flags |= INFO_HAS_WIDTH; + break; + case K_DIM__VSIZE: + t->height = atof(vp); + t->flags |= INFO_HAS_HEIGHT; + break; + case K_TRN__HSCALE: + xscale = atof(vp) / 100.0; + break; + case K_TRN__VSCALE: + yscale = atof(vp) / 100.0; + break; + case K_TRN__ANGLE: + rotate = M_PI * atof(vp) / 180.0; + break; + case K_DIM__LLX: + t->bbox.llx = atof(vp); + t->flags |= INFO_HAS_USER_BBOX; + break; + case K_DIM__LLY: + t->bbox.lly = atof(vp); + t->flags |= INFO_HAS_USER_BBOX; + break; + case K_DIM__URX: + t->bbox.urx = atof(vp); + t->flags |= INFO_HAS_USER_BBOX; + break; + case K_DIM__URY: + t->bbox.ury = atof(vp); + t->flags |= INFO_HAS_USER_BBOX; + break; + case K_DIM__RWI: + t->width = atof(vp) / 10.0; + t->flags |= INFO_HAS_WIDTH; + break; + case K_DIM__RHI: + t->height = atof(vp) / 10.0; + t->flags |= INFO_HAS_HEIGHT; + break; + } + skip_blank(&ap->curptr, ap->endptr); + RELEASE(vp); + } + make_transmatrix(&(t->matrix), xoffset, yoffset, xscale, yscale, rotate); + + return error; +} + + +static int +spc_read_dimtrns_pdfm (struct spc_env *spe, transform_info *p, struct spc_arg *ap, long *page_no) +{ + int has_scale, has_xscale, has_yscale, has_rotate, has_matrix; + const char *_dtkeys[] = { +#define K_DIM__WIDTH 0 +#define K_DIM__HEIGHT 1 +#define K_DIM__DEPTH 2 + "width", "height", "depth", +#define K_TRN__SCALE 3 +#define K_TRN__XSCALE 4 +#define K_TRN__YSCALE 5 +#define K_TRN__ROTATE 6 + "scale", "xscale", "yscale", "rotate", /* See "Dvipdfmx User's Manual", p.5 */ +#define K_TRN__BBOX 7 + "bbox", /* See "Dvipdfmx User's Manual", p.5 */ +#define K_TRN__MATRIX 8 + "matrix", +#undef K__CLIP +#define K__CLIP 9 + "clip", +#define K__PAGE 10 + "page", +#define K__HIDE 11 + "hide", + NULL + }; + double xscale, yscale, rotate; + int error = 0; + + has_xscale = has_yscale = has_scale = has_rotate = has_matrix = 0; + xscale = yscale = 1.0; rotate = 0.0; + p->flags |= INFO_DO_CLIP; /* default: do clipping */ + p->flags &= ~INFO_DO_HIDE; /* default: do clipping */ + + skip_blank(&ap->curptr, ap->endptr); + + while (!error && ap->curptr < ap->endptr) { + char *kp, *vp; + int k; + + kp = parse_c_ident(&ap->curptr, ap->endptr); + if (!kp) + break; + + skip_blank(&ap->curptr, ap->endptr); + for (k = 0; _dtkeys[k] && strcmp(_dtkeys[k], kp); k++); + switch (k) { + case K_DIM__WIDTH: + error = spc_util_read_length(spe, &p->width , ap); + p->flags |= INFO_HAS_WIDTH; + break; + case K_DIM__HEIGHT: + error = spc_util_read_length(spe, &p->height, ap); + p->flags |= INFO_HAS_HEIGHT; + break; + case K_DIM__DEPTH: + error = spc_util_read_length(spe, &p->depth , ap); + p->flags |= INFO_HAS_HEIGHT; + break; + case K_TRN__SCALE: + vp = parse_float_decimal(&ap->curptr, ap->endptr); + if (!vp) + error = -1; + else { + xscale = yscale = atof(vp); + has_scale = 1; + RELEASE(vp); + } + break; + case K_TRN__XSCALE: + vp = parse_float_decimal(&ap->curptr, ap->endptr); + if (!vp) + error = -1; + else { + xscale = atof(vp); + has_xscale = 1; + RELEASE(vp); + } + break; + case K_TRN__YSCALE: + vp = parse_float_decimal(&ap->curptr, ap->endptr); + if (!vp) + error = -1; + else { + yscale = atof(vp); + has_yscale = 1; + RELEASE(vp); + } + break; + case K_TRN__ROTATE: + vp = parse_float_decimal(&ap->curptr, ap->endptr); + if (!vp) + error = -1; + else { + rotate = M_PI * atof(vp) / 180.0; + has_rotate = 1; + RELEASE(vp); + } + break; + case K_TRN__BBOX: + { + double v[4]; + if (spc_util_read_numbers(v, 4, spe, ap) != 4) + error = -1; + else { + p->bbox.llx = v[0]; + p->bbox.lly = v[1]; + p->bbox.urx = v[2]; + p->bbox.ury = v[3]; + p->flags |= INFO_HAS_USER_BBOX; + } + } + break; + case K_TRN__MATRIX: + { + double v[6]; + if (spc_util_read_numbers(v, 6, spe, ap) != 6) + error = -1; + else { + pdf_setmatrix(&(p->matrix), v[0], v[1], v[2], v[3], v[4], v[5]); + has_matrix = 1; + } + } + break; + case K__CLIP: + vp = parse_float_decimal(&ap->curptr, ap->endptr); + if (!vp) + error = -1; + else { + if (atof(vp)) + p->flags |= INFO_DO_CLIP; + else + p->flags &= ~INFO_DO_CLIP; + RELEASE(vp); + } + break; + case K__PAGE: + { + double page; + if (page_no && spc_util_read_numbers(&page, 1, spe, ap) == 1) + *page_no = (long) page; + else + error = -1; + } + break; + case K__HIDE: + p->flags |= INFO_DO_HIDE; + break; + default: + error = -1; + break; + } + if (error) + spc_warn(spe, "Unrecognized key or invalid value for dimension/transformation: %s", kp); + else + skip_blank(&ap->curptr, ap->endptr); + RELEASE(kp); + } + + if (!error) { + /* Check consistency */ + if (has_xscale && (p->flags & INFO_HAS_WIDTH)) { + spc_warn(spe, "Can't supply both width and xscale. Ignore xscale."); + xscale = 1.0; + } else if (has_yscale && + (p->flags & INFO_HAS_HEIGHT)) { + spc_warn(spe, "Can't supply both height/depth and yscale. Ignore yscale."); + yscale = 1.0; + } else if (has_scale && + (has_xscale || has_yscale)) { + spc_warn(spe, "Can't supply overall scale along with axis scales."); + error = -1; + } else if (has_matrix && + (has_scale || has_xscale || has_yscale || has_rotate)) { + spc_warn(spe, "Can't supply transform matrix along with scales or rotate. Ignore scales and rotate."); + } + } + + if (!has_matrix) { + make_transmatrix(&(p->matrix), 0.0, 0.0, xscale, yscale, rotate); + } + + if (!(p->flags & INFO_HAS_USER_BBOX)) { + p->flags &= ~INFO_DO_CLIP; /* no clipping needed */ + } + + return error; +} + +int +spc_util_read_dimtrns (struct spc_env *spe, transform_info *ti, struct spc_arg *args, long *page_no, int syntax) +{ + ASSERT(ti && spe && args); + + if (syntax) { + ASSERT(!page_no); + return spc_read_dimtrns_dvips(spe, ti, args); + } else { + return spc_read_dimtrns_pdfm (spe, ti, args, page_no); + } + + return -1; +} + + +/* Color names */ +#ifdef rgb +#undef rgb +#endif +#ifdef cmyk +#undef cmyk +#endif +#define gray(g) {1, {g}} +#define rgb8(r,g,b) {3, {((r)/255.0), ((g)/255.0), ((b)/255.0), 0.0}} +#define cmyk(c,m,y,k) {4, {(c), (m), (y), (k)}} + +static struct colordef_ +{ + const char *key; + pdf_color color; +} colordefs[] = { + {"GreenYellow", cmyk(0.15, 0.00, 0.69, 0.00)}, + {"Yellow", cmyk(0.00, 0.00, 1.00, 0.00)}, + {"Goldenrod", cmyk(0.00, 0.10, 0.84, 0.00)}, + {"Dandelion", cmyk(0.00, 0.29, 0.84, 0.00)}, + {"Apricot", cmyk(0.00, 0.32, 0.52, 0.00)}, + {"Peach", cmyk(0.00, 0.50, 0.70, 0.00)}, + {"Melon", cmyk(0.00, 0.46, 0.50, 0.00)}, + {"YellowOrange", cmyk(0.00, 0.42, 1.00, 0.00)}, + {"Orange", cmyk(0.00, 0.61, 0.87, 0.00)}, + {"BurntOrange", cmyk(0.00, 0.51, 1.00, 0.00)}, + {"Bittersweet", cmyk(0.00, 0.75, 1.00, 0.24)}, + {"RedOrange", cmyk(0.00, 0.77, 0.87, 0.00)}, + {"Mahogany", cmyk(0.00, 0.85, 0.87, 0.35)}, + {"Maroon", cmyk(0.00, 0.87, 0.68, 0.32)}, + {"BrickRed", cmyk(0.00, 0.89, 0.94, 0.28)}, + {"Red", cmyk(0.00, 1.00, 1.00, 0.00)}, + {"OrangeRed", cmyk(0.00, 1.00, 0.50, 0.00)}, + {"RubineRed", cmyk(0.00, 1.00, 0.13, 0.00)}, + {"WildStrawberry", cmyk(0.00, 0.96, 0.39, 0.00)}, + {"Salmon", cmyk(0.00, 0.53, 0.38, 0.00)}, + {"CarnationPink", cmyk(0.00, 0.63, 0.00, 0.00)}, + {"Magenta", cmyk(0.00, 1.00, 0.00, 0.00)}, + {"VioletRed", cmyk(0.00, 0.81, 0.00, 0.00)}, + {"Rhodamine", cmyk(0.00, 0.82, 0.00, 0.00)}, + {"Mulberry", cmyk(0.34, 0.90, 0.00, 0.02)}, + {"RedViolet", cmyk(0.07, 0.90, 0.00, 0.34)}, + {"Fuchsia", cmyk(0.47, 0.91, 0.00, 0.08)}, + {"Lavender", cmyk(0.00, 0.48, 0.00, 0.00)}, + {"Thistle", cmyk(0.12, 0.59, 0.00, 0.00)}, + {"Orchid", cmyk(0.32, 0.64, 0.00, 0.00)}, + {"DarkOrchid", cmyk(0.40, 0.80, 0.20, 0.00)}, + {"Purple", cmyk(0.45, 0.86, 0.00, 0.00)}, + {"Plum", cmyk(0.50, 1.00, 0.00, 0.00)}, + {"Violet", cmyk(0.79, 0.88, 0.00, 0.00)}, + {"RoyalPurple", cmyk(0.75, 0.90, 0.00, 0.00)}, + {"BlueViolet", cmyk(0.86, 0.91, 0.00, 0.04)}, + {"Periwinkle", cmyk(0.57, 0.55, 0.00, 0.00)}, + {"CadetBlue", cmyk(0.62, 0.57, 0.23, 0.00)}, + {"CornflowerBlue", cmyk(0.65, 0.13, 0.00, 0.00)}, + {"MidnightBlue", cmyk(0.98, 0.13, 0.00, 0.43)}, + {"NavyBlue", cmyk(0.94, 0.54, 0.00, 0.00)}, + {"RoyalBlue", cmyk(1.00, 0.50, 0.00, 0.00)}, + {"Blue", cmyk(1.00, 1.00, 0.00, 0.00)}, + {"Cerulean", cmyk(0.94, 0.11, 0.00, 0.00)}, + {"Cyan", cmyk(1.00, 0.00, 0.00, 0.00)}, + {"ProcessBlue", cmyk(0.96, 0.00, 0.00, 0.00)}, + {"SkyBlue", cmyk(0.62, 0.00, 0.12, 0.00)}, + {"Turquoise", cmyk(0.85, 0.00, 0.20, 0.00)}, + {"TealBlue", cmyk(0.86, 0.00, 0.34, 0.02)}, + {"Aquamarine", cmyk(0.82, 0.00, 0.30, 0.00)}, + {"BlueGreen", cmyk(0.85, 0.00, 0.33, 0.00)}, + {"Emerald", cmyk(1.00, 0.00, 0.50, 0.00)}, + {"JungleGreen", cmyk(0.99, 0.00, 0.52, 0.00)}, + {"SeaGreen", cmyk(0.69, 0.00, 0.50, 0.00)}, + {"Green", cmyk(1.00, 0.00, 1.00, 0.00)}, + {"ForestGreen", cmyk(0.91, 0.00, 0.88, 0.12)}, + {"PineGreen", cmyk(0.92, 0.00, 0.59, 0.25)}, + {"LimeGreen", cmyk(0.50, 0.00, 1.00, 0.00)}, + {"YellowGreen", cmyk(0.44, 0.00, 0.74, 0.00)}, + {"SpringGreen", cmyk(0.26, 0.00, 0.76, 0.00)}, + {"OliveGreen", cmyk(0.64, 0.00, 0.95, 0.40)}, + {"RawSienna", cmyk(0.00, 0.72, 1.00, 0.45)}, + {"Sepia", cmyk(0.00, 0.83, 1.00, 0.70)}, + {"Brown", cmyk(0.00, 0.81, 1.00, 0.60)}, + {"Tan", cmyk(0.14, 0.42, 0.56, 0.00)}, + /* Adobe Reader 7 and 8 had problem when gray and cmyk black colors + * are mixed. No problem with Previewer.app. + * It happens when \usepackage[dvipdfm]{graphicx} and then called + * \usepackage{color} without dvipdfm option. */ + {"Gray", gray(0.5)}, + {"Black", gray(0.0)}, + {"White", gray(1.0)}, + {NULL} +}; + + +static int +pdf_color_namedcolor (pdf_color *color, const char *name) +{ + int i; + for (i = 0; colordefs[i].key; i++) { + if (!strcmp(colordefs[i].key, name)) { + pdf_color_copycolor(color, &colordefs[i].color); + return 0; + } + } + return -1; +} + diff --git a/Build/source/texk/dvipdfm-x/spc_util.h b/Build/source/texk/dvipdfm-x/spc_util.h new file mode 100644 index 00000000000..b15c486ce02 --- /dev/null +++ b/Build/source/texk/dvipdfm-x/spc_util.h @@ -0,0 +1,47 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + Copyright (C) 1998, 1999 by Mark A. Wicks + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +#ifndef _SPC_UTIL_H_ +#define _SPC_UTIL_H_ + +#include "pdfcolor.h" +#include "pdfdev.h" + +#include "specials.h" + +/* syntax 1: ((rgb|cmyk|hsb|gray) colorvalues)|colorname + * syntax 0: pdf_number|pdf_array + * + * This is for reading *single* color specification. + */ +extern int spc_util_read_colorspec (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *args, int syntax); +extern int spc_util_read_dimtrns (struct spc_env *spe, transform_info *dimtrns, struct spc_arg *args, long *page, int syntax); + +#ifdef XETEX +extern int spc_util_read_numbers (double *values, int num_values, struct spc_env *spe, struct spc_arg *args); +#else +extern int spc_util_read_pdfcolor (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *args, pdf_color *defaultcolor); +#endif + +#endif /* _SPC_UTIL_H_ */ diff --git a/Build/source/texk/dvipdfm-x/src/cff.c b/Build/source/texk/dvipdfm-x/src/cff.c index 0e0fe7131d3..b5e78f5791a 100644 --- a/Build/source/texk/dvipdfm-x/src/cff.c +++ b/Build/source/texk/dvipdfm-x/src/cff.c @@ -42,24 +42,34 @@ #define CFF_DEBUG 5 #define CFF_DEBUG_STR "CFF" -static unsigned long get_unsigned (FILE *stream, int n) +#ifdef XETEX +#define SFNT_OR_FILE sfnt +#define SFONT_OR_STREAM sfont +#define get_card8(s) sfnt_get_byte((s)) +#define get_card16(s) sfnt_get_ushort((s)) +#else +#define SFNT_OR_FILE FILE +#define SFONT_OR_STREAM stream +#define get_card8(s) get_unsigned_byte((s)) +#define get_card16(s) get_unsigned_pair((s)) +#endif + +static unsigned long get_unsigned (SFNT_OR_FILE *SFONT_OR_STREAM, int n) { unsigned long v = 0; while (n-- > 0) - v = v*0x100u + get_unsigned_byte(stream); + v = v*0x100u + get_card8(SFONT_OR_STREAM); return v; } #define get_offset(s, n) get_unsigned((s), (n)) -#define get_card8(s) get_unsigned_byte((s)) -#define get_card16(s) get_unsigned_pair((s)) /* * Read Header, Name INDEX, Top DICT INDEX, and String INDEX. */ -cff_font *cff_open(FILE *stream, long offset, int n) +cff_font *cff_open(SFNT_OR_FILE *SFONT_OR_STREAM, long offset, int n) { cff_font *cff; cff_index *idx; @@ -68,7 +78,7 @@ cff_font *cff_open(FILE *stream, long offset, int n) cff->fontname = NULL; cff->index = n; - cff->stream = stream; + cff->SFONT_OR_STREAM = SFONT_OR_STREAM; cff->offset = offset; cff->filter = 0; /* not used */ cff->flag = 0; @@ -88,10 +98,10 @@ cff_font *cff_open(FILE *stream, long offset, int n) cff->_string = NULL; cff_seek_set(cff, 0); - cff->header.major = get_card8(cff->stream); - cff->header.minor = get_card8(cff->stream); - cff->header.hdr_size = get_card8(cff->stream); - cff->header.offsize = get_card8(cff->stream); + cff->header.major = get_card8(cff->SFONT_OR_STREAM); + cff->header.minor = get_card8(cff->SFONT_OR_STREAM); + cff->header.hdr_size = get_card8(cff->SFONT_OR_STREAM); + cff->header.offsize = get_card8(cff->SFONT_OR_STREAM); if (cff->header.offsize < 1 || cff->header.offsize > 4) ERROR("invalid offsize data"); @@ -150,7 +160,7 @@ cff_font *cff_open(FILE *stream, long offset, int n) /* Number of glyphs */ offset = (long) cff_dict_get(cff->topdict, "CharStrings", 0); cff_seek_set(cff, offset); - cff->num_glyphs = get_card16(cff->stream); + cff->num_glyphs = get_card16(cff->SFONT_OR_STREAM); /* Check for font type */ if (cff_dict_known(cff->topdict, "ROS")) { @@ -187,6 +197,10 @@ cff_font *cff_open(FILE *stream, long offset, int n) cff_seek_set(cff, cff->gsubr_offset); /* seek back to GSubr */ +#ifdef XETEX + cff->ft_to_gid = NULL; +#endif + return cff; } @@ -225,6 +239,12 @@ cff_close (cff_font *cff) } if (cff->_string) cff_release_index(cff->_string); + +#ifdef XETEX + if (cff->ft_to_gid) + RELEASE(cff->ft_to_gid); +#endif + RELEASE(cff); } @@ -297,15 +317,15 @@ cff_get_index_header (cff_font *cff) idx = NEW(1, cff_index); - idx->count = count = get_card16(cff->stream); + idx->count = count = get_card16(cff->SFONT_OR_STREAM); if (count > 0) { - idx->offsize = get_card8(cff->stream); + idx->offsize = get_card8(cff->SFONT_OR_STREAM); if (idx->offsize < 1 || idx->offsize > 4) ERROR("invalid offsize data"); idx->offset = NEW(count+1, l_offset); for (i=0;ioffset)[i] = get_offset(cff->stream, idx->offsize); + (idx->offset)[i] = get_offset(cff->SFONT_OR_STREAM, idx->offsize); } if (idx->offset[0] != 1) @@ -330,15 +350,15 @@ cff_get_index (cff_font *cff) idx = NEW(1, cff_index); - idx->count = count = get_card16(cff->stream); + idx->count = count = get_card16(cff->SFONT_OR_STREAM); if (count > 0) { - idx->offsize = get_card8(cff->stream); + idx->offsize = get_card8(cff->SFONT_OR_STREAM); if (idx->offsize < 1 || idx->offsize > 4) ERROR("invalid offsize data"); idx->offset = NEW(count + 1, l_offset); for (i = 0 ; i < count + 1; i++) { - idx->offset[i] = get_offset(cff->stream, idx->offsize); + idx->offset[i] = get_offset(cff->SFONT_OR_STREAM, idx->offsize); } if (idx->offset[0] != 1) @@ -648,27 +668,27 @@ long cff_read_encoding (cff_font *cff) cff_seek_set(cff, offset); cff->encoding = encoding = NEW(1, cff_encoding); - encoding->format = get_card8(cff->stream); + encoding->format = get_card8(cff->SFONT_OR_STREAM); length = 1; switch (encoding->format & (~0x80)) { case 0: - encoding->num_entries = get_card8(cff->stream); + encoding->num_entries = get_card8(cff->SFONT_OR_STREAM); (encoding->data).codes = NEW(encoding->num_entries, card8); for (i=0;i<(encoding->num_entries);i++) { - (encoding->data).codes[i] = get_card8(cff->stream); + (encoding->data).codes[i] = get_card8(cff->SFONT_OR_STREAM); } length += encoding->num_entries + 1; break; case 1: { cff_range1 *ranges; - encoding->num_entries = get_card8(cff->stream); + encoding->num_entries = get_card8(cff->SFONT_OR_STREAM); encoding->data.range1 = ranges = NEW(encoding->num_entries, cff_range1); for (i=0;i<(encoding->num_entries);i++) { - ranges[i].first = get_card8(cff->stream); - ranges[i].n_left = get_card8(cff->stream); + ranges[i].first = get_card8(cff->SFONT_OR_STREAM); + ranges[i].n_left = get_card8(cff->SFONT_OR_STREAM); } length += (encoding->num_entries) * 2 + 1; } @@ -682,11 +702,11 @@ long cff_read_encoding (cff_font *cff) /* Supplementary data */ if ((encoding->format) & 0x80) { cff_map *map; - encoding->num_supps = get_card8(cff->stream); + encoding->num_supps = get_card8(cff->SFONT_OR_STREAM); encoding->supp = map = NEW(encoding->num_supps, cff_map); for (i=0;i<(encoding->num_supps);i++) { - map[i].code = get_card8(cff->stream); - map[i].glyph = get_card16(cff->stream); /* SID */ + map[i].code = get_card8(cff->SFONT_OR_STREAM); + map[i].glyph = get_card16(cff->SFONT_OR_STREAM); /* SID */ } length += (encoding->num_supps) * 3 + 1; } else { @@ -864,7 +884,7 @@ long cff_read_charsets (cff_font *cff) cff_seek_set(cff, offset); cff->charsets = charset = NEW(1, cff_charsets); - charset->format = get_card8(cff->stream); + charset->format = get_card8(cff->SFONT_OR_STREAM); charset->num_entries = 0; count = cff->num_glyphs - 1; @@ -877,7 +897,7 @@ long cff_read_charsets (cff_font *cff) charset->data.glyphs = NEW(charset->num_entries, s_SID); length += (charset->num_entries) * 2; for (i=0;i<(charset->num_entries);i++) { - charset->data.glyphs[i] = get_card16(cff->stream); + charset->data.glyphs[i] = get_card16(cff->SFONT_OR_STREAM); } count = 0; break; @@ -886,8 +906,8 @@ long cff_read_charsets (cff_font *cff) cff_range1 *ranges = NULL; while (count > 0 && charset->num_entries < cff->num_glyphs) { ranges = RENEW(ranges, charset->num_entries + 1, cff_range1); - ranges[charset->num_entries].first = get_card16(cff->stream); - ranges[charset->num_entries].n_left = get_card8(cff->stream); + ranges[charset->num_entries].first = get_card16(cff->SFONT_OR_STREAM); + ranges[charset->num_entries].n_left = get_card8(cff->SFONT_OR_STREAM); count -= ranges[charset->num_entries].n_left + 1; /* no-overrap */ charset->num_entries += 1; charset->data.range1 = ranges; @@ -900,8 +920,8 @@ long cff_read_charsets (cff_font *cff) cff_range2 *ranges = NULL; while (count > 0 && charset->num_entries < cff->num_glyphs) { ranges = RENEW(ranges, charset->num_entries + 1, cff_range2); - ranges[charset->num_entries].first = get_card16(cff->stream); - ranges[charset->num_entries].n_left = get_card16(cff->stream); + ranges[charset->num_entries].first = get_card16(cff->SFONT_OR_STREAM); + ranges[charset->num_entries].n_left = get_card16(cff->SFONT_OR_STREAM); count -= ranges[charset->num_entries].n_left + 1; /* non-overrapping */ charset->num_entries += 1; } @@ -1194,7 +1214,7 @@ long cff_read_fdselect (cff_font *cff) offset = (long) cff_dict_get(cff->topdict, "FDSelect", 0); cff_seek_set(cff, offset); cff->fdselect = fdsel = NEW(1, cff_fdselect); - fdsel->format = get_card8(cff->stream); + fdsel->format = get_card8(cff->SFONT_OR_STREAM); length = 1; @@ -1203,22 +1223,22 @@ long cff_read_fdselect (cff_font *cff) fdsel->num_entries = cff->num_glyphs; (fdsel->data).fds = NEW(fdsel->num_entries, card8); for (i=0;i<(fdsel->num_entries);i++) { - (fdsel->data).fds[i] = get_card8(cff->stream); + (fdsel->data).fds[i] = get_card8(cff->SFONT_OR_STREAM); } length += fdsel->num_entries; break; case 3: { cff_range3 *ranges; - fdsel->num_entries = get_card16(cff->stream); + fdsel->num_entries = get_card16(cff->SFONT_OR_STREAM); fdsel->data.ranges = ranges = NEW(fdsel->num_entries, cff_range3); for (i=0;i<(fdsel->num_entries);i++) { - ranges[i].first = get_card16(cff->stream); - ranges[i].fd = get_card8(cff->stream); + ranges[i].first = get_card16(cff->SFONT_OR_STREAM); + ranges[i].fd = get_card8(cff->SFONT_OR_STREAM); } if (ranges[0].first != 0) ERROR("Range not starting with 0."); - if (cff->num_glyphs != get_card16(cff->stream)) + if (cff->num_glyphs != get_card16(cff->SFONT_OR_STREAM)) ERROR("Sentinel value mismatched with number of glyphs."); length += (fdsel->num_entries) * 3 + 4; } @@ -1472,3 +1492,10 @@ long cff_read_private (cff_font *cff) return len; } + +#ifdef XETEX +unsigned short* cff_get_ft_to_gid(cff_font *cff) +{ + return cff->ft_to_gid; +} +#endif diff --git a/Build/source/texk/dvipdfm-x/src/cff.h b/Build/source/texk/dvipdfm-x/src/cff.h deleted file mode 100644 index 685defb9d72..00000000000 --- a/Build/source/texk/dvipdfm-x/src/cff.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifndef _CFF_H_ -#define _CFF_H_ - -#include "mfileio.h" -#include "cff_types.h" - -/* Flag */ -#define FONTTYPE_CIDFONT (1 << 0) -#define FONTTYPE_FONT (1 << 1) -#define FONTTYPE_MMASTER (1 << 2) - -#define ENCODING_STANDARD (1 << 3) -#define ENCODING_EXPERT (1 << 4) - -#define CHARSETS_ISOADOBE (1 << 5) -#define CHARSETS_EXPERT (1 << 6) -#define CHARSETS_EXPSUB (1 << 7) - -#define HAVE_STANDARD_ENCODING (ENCODING_STANDARD|ENCODING_EXPERT) -#define HAVE_STANDARD_CHARSETS \ - (CHARSETS_ISOADOBE|CHARSETS_EXPERT|CHARSETS_EXPSUB) - -#define CFF_STRING_NOTDEF 65535 - -typedef struct -{ - char *fontname; /* FontName */ - - /* - CFF structure - */ - cff_header header; /* CFF Header */ - cff_index *name; /* Name INDEX */ - cff_dict *topdict; /* Top DICT (single) */ - cff_index *string; /* String INDEX */ - cff_index *gsubr; /* Global Subr INDEX */ - cff_encoding *encoding; /* Encodings */ - cff_charsets *charsets; /* Charsets */ - cff_fdselect *fdselect; /* FDSelect, CIDFont only */ - cff_index *cstrings; /* CharStrings */ - cff_dict **fdarray; /* CIDFont only */ - cff_dict **private; /* per-Font DICT */ - cff_index **subrs; /* Local Subr INDEX, per-Private DICT */ - - /* -- extra data -- */ - l_offset offset; /* non-zero for OpenType or PostScript wrapped */ - l_offset gsubr_offset; - card16 num_glyphs; /* number of glyphs (CharString INDEX count) */ - card8 num_fds; /* number of Font DICT */ - - /* Updated String INDEX. - * Please fix this. We should separate input and output. - */ - cff_index *_string; - - FILE *stream; - int filter; /* not used, ASCII Hex filter if needed */ - - int index; /* CFF fontset index */ - int flag; /* Flag: see above */ -} cff_font; - -extern cff_font *cff_open (FILE *file, long offset, int idx); -extern void cff_close (cff_font *cff); - -#define cff_seek_set(c, p) seek_absolute (((c)->stream), ((c)->offset) + (p)); - -/* CFF Header */ -extern long cff_put_header (cff_font *cff, card8 *dest, long destlen); - -/* CFF INDEX */ -extern cff_index *cff_get_index (cff_font *cff); -extern cff_index *cff_get_index_header (cff_font *cff); -extern void cff_release_index (cff_index *idx); -extern cff_index *cff_new_index (card16 count); -extern long cff_index_size (cff_index *idx); -extern long cff_pack_index (cff_index *idx, card8 *dest, long destlen); - -/* Name INDEX */ -extern char *cff_get_name (cff_font *cff); -extern long cff_set_name (cff_font *cff, char *name); - -/* Global and Local Subrs INDEX */ -extern long cff_read_subrs (cff_font *cff); - -/* Encoding */ -extern long cff_read_encoding (cff_font *cff); -extern long cff_pack_encoding (cff_font *cff, card8 *dest, long destlen); -extern card16 cff_encoding_lookup (cff_font *cff, card8 code); -extern void cff_release_encoding (cff_encoding *encoding); - -/* Charsets */ -extern long cff_read_charsets (cff_font *cff); -extern long cff_pack_charsets (cff_font *cff, card8 *dest, long destlen); - -/* Returns GID of PS name "glyph" */ -extern card16 cff_glyph_lookup (cff_font *cff, const char *glyph); -/* Returns GID of glyph with SID/CID "cid" */ -extern card16 cff_charsets_lookup (cff_font *cff, card16 cid); -extern void cff_release_charsets (cff_charsets *charset); -/* Returns SID or CID */ -extern card16 cff_charsets_lookup_inverse (cff_font *cff, card16 gid); - -/* FDSelect */ -extern long cff_read_fdselect (cff_font *cff); -extern long cff_pack_fdselect (cff_font *cff, card8 *dest, long destlen); -extern card8 cff_fdselect_lookup (cff_font *cff, card16 gid); -extern void cff_release_fdselect (cff_fdselect *fdselect); - -/* Font DICT(s) */ -extern long cff_read_fdarray (cff_font *cff); - -/* Private DICT(s) */ -extern long cff_read_private (cff_font *cff); - -/* String */ -extern int cff_match_string (cff_font *cff, const char *str, s_SID sid); -extern char *cff_get_string (cff_font *cff, s_SID id); -extern long cff_get_sid (cff_font *cff, const char *str); -extern long cff_get_seac_sid (cff_font *cff, const char *str); -extern s_SID cff_add_string (cff_font *cff, const char *str, int unique); -extern void cff_update_string (cff_font *cff); - -#define cff_is_stdstr(s) (cff_get_sid(NULL, (s)) >= 0) - -#endif /* _CFF_H_ */ diff --git a/Build/source/texk/dvipdfm-x/src/cidtype0.c b/Build/source/texk/dvipdfm-x/src/cidtype0.c index db64c93bcc8..00b24f2aee1 100644 --- a/Build/source/texk/dvipdfm-x/src/cidtype0.c +++ b/Build/source/texk/dvipdfm-x/src/cidtype0.c @@ -833,7 +833,7 @@ CIDFont_type0_open (CIDFont *font, const char *name, /* getting font info. from TrueType tables */ if ((font->descriptor - = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0)) == NULL) + = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0, NULL)) == NULL) ERROR("Could not obtain necessary font info."); if (opt->embed) { @@ -1245,7 +1245,7 @@ CIDFont_type0_t1copen (CIDFont *font, const char *name, /* getting font info. from TrueType tables */ if ((font->descriptor - = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0)) == NULL) + = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0, NULL)) == NULL) ERROR("Could not obtain necessary font info."); if (opt->embed) { diff --git a/Build/source/texk/dvipdfm-x/src/cidtype2.c b/Build/source/texk/dvipdfm-x/src/cidtype2.c index ea20dae76f9..7fc87ecd8d0 100644 --- a/Build/source/texk/dvipdfm-x/src/cidtype2.c +++ b/Build/source/texk/dvipdfm-x/src/cidtype2.c @@ -1086,7 +1086,7 @@ CIDFont_type2_open (CIDFont *font, const char *name, pdf_new_name("Subtype"), pdf_new_name("CIDFontType2")); - font->descriptor = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0); + font->descriptor = tt_get_fontdesc(sfont, &(opt->embed), opt->stemv, 0, NULL); if (!font->descriptor) { ERROR("Could not obtain necessary font info."); } diff --git a/Build/source/texk/dvipdfm-x/src/dvi.c b/Build/source/texk/dvipdfm-x/src/dvi.c index acb8e5ee611..9e18d63e73c 100644 --- a/Build/source/texk/dvipdfm-x/src/dvi.c +++ b/Build/source/texk/dvipdfm-x/src/dvi.c @@ -31,6 +31,11 @@ #include #include +#ifdef WIN32 +#include +#include +#endif + #include "system.h" #include "mem.h" #include "error.h" @@ -54,6 +59,11 @@ #include "dvi.h" +#ifdef XETEX +#include "pdfximage.h" +#include FT_ADVANCES_H +#endif + #define DVI_STACK_DEPTH_MAX 256u #define TEX_FONTS_ALLOC_SIZE 16u #define VF_NESTING_MAX 16u @@ -92,6 +102,7 @@ static double dev_origin_x = 72.0, dev_origin_y = 770.0; #define PHYSICAL 1 #define VIRTUAL 2 #define SUBFONT 3 +#define NATIVE 4 #define DVI 1 #define VF 2 @@ -105,6 +116,14 @@ static struct loaded_font int tfm_id; spt_t size; int source; /* Source is either DVI or VF */ +#ifdef XETEX + unsigned long rgba_color; + FT_Face ft_face; + int layout_dir; + float extend; + float slant; + float embolden; +#endif } *loaded_fonts = NULL; static int num_loaded_fonts = 0, max_loaded_fonts = 0; @@ -125,8 +144,26 @@ static struct font_def char *font_name; int font_id; /* index of _loaded_ font in loaded_fonts array */ int used; +#ifdef XETEX + int native; /* boolean */ + unsigned long rgba_color; /* only used for native fonts in XeTeX */ + int layout_dir; /* 1 = vertical, 0 = horizontal */ + int extend; + int slant; + int embolden; +#endif } *def_fonts = NULL; +#ifdef XETEX +#define XDV_FLAG_VERTICAL 0x0100 +#define XDV_FLAG_COLORED 0x0200 +#define XDV_FLAG_FEATURES 0x0400 +#define XDV_FLAG_VARIATIONS 0x0800 +#define XDV_FLAG_EXTEND 0x1000 +#define XDV_FLAG_SLANT 0x2000 +#define XDV_FLAG_EMBOLDEN 0x4000 +#endif + static int num_def_fonts = 0, max_def_fonts = 0; static int compute_boxes = 0, link_annot = 1; static int verbose = 0; @@ -1419,7 +1456,7 @@ do_dir (void) * the dvi file is here. */ void -dvi_do_page (unsigned n, +dvi_do_page (long n, double paper_width, double paper_height, double hmargin, double vmargin) { @@ -1576,6 +1613,12 @@ dvi_do_page (unsigned n, } } +#ifdef WIN32 +#define STR_CMP strcasecmp +#else +#define STR_CMP strcmp +#endif + double dvi_init (const char *dvi_filename, double mag) { @@ -1876,7 +1919,7 @@ scan_special (double *wd, double *ht, double *xo, double *yo, char *lm, void -dvi_scan_specials (unsigned page_no, +dvi_scan_specials (long page_no, double *page_width, double *page_height, double *x_offset, double *y_offset, char *landscape, unsigned *minorversion, diff --git a/Build/source/texk/dvipdfm-x/src/dvi.h b/Build/source/texk/dvipdfm-x/src/dvi.h index 1e9636f8195..f827bcafeaf 100644 --- a/Build/source/texk/dvipdfm-x/src/dvi.h +++ b/Build/source/texk/dvipdfm-x/src/dvi.h @@ -37,7 +37,7 @@ extern double dvi_init (const char *dvi_filename, double mag); extern void dvi_close (void); /* Closes data structures created by dvi_open */ extern double dvi_tell_mag (void); -#if 0 +#ifdef XETEX extern double dvi_unit_size (void); #endif extern double dvi_dev_xpos (void); @@ -67,10 +67,10 @@ extern void dvi_z (SIGNED_QUAD ch); extern void dvi_z0 (void); extern void dvi_dir (UNSIGNED_BYTE dir); -extern void dvi_do_page (unsigned page_no, +extern void dvi_do_page (long page_no, double paper_width, double paper_height, double x_offset, double y_offset); -extern void dvi_scan_specials (unsigned page_no, +extern void dvi_scan_specials (long page_no, double *width, double *height, double *x_offset, double *y_offset, char *landscape, unsigned *minorversion, diff --git a/Build/source/texk/dvipdfm-x/src/dvipdfmx.c b/Build/source/texk/dvipdfm-x/src/dvipdfmx.c index d2eb97330ba..9cbfeef9145 100644 --- a/Build/source/texk/dvipdfm-x/src/dvipdfmx.c +++ b/Build/source/texk/dvipdfm-x/src/dvipdfmx.c @@ -818,7 +818,7 @@ do_mps_pages (void) mps_do_page(fp); MFCLOSE(fp); } else { - int i, page_no, step, page_count = 0; + long i, page_no, step, page_count = 0; char *filename; /* Process filename.1, filename.2,... */ filename = NEW(strlen(dvi_filename) + 16 + 1, char); @@ -829,10 +829,10 @@ do_mps_pages (void) step = (page_ranges[i].first <= page_ranges[i].last) ? 1 : -1; page_no = page_ranges[i].first; for (;;) { - sprintf(filename, "%s.%d", dvi_filename, page_no + 1); + sprintf(filename, "%s.%ld", dvi_filename, page_no + 1); fp = MFOPEN(filename, FOPEN_RBIN_MODE); if (fp) { - MESG("[%d<%s>", page_no + 1, filename); + MESG("[%ld<%s>", page_no + 1, filename); mps_do_page(fp); page_count++; MESG("]"); diff --git a/Build/source/texk/dvipdfm-x/src/fontmap.c b/Build/source/texk/dvipdfm-x/src/fontmap.c index 1dc567fcf01..f256b173ce5 100644 --- a/Build/source/texk/dvipdfm-x/src/fontmap.c +++ b/Build/source/texk/dvipdfm-x/src/fontmap.c @@ -40,11 +40,6 @@ #ifdef XETEX #include "ft2build.h" #include FT_FREETYPE_H -#if 0 && defined(XETEX_MAC) -#include -#include -#include FT_MAC_H -#endif #endif /* CIDFont */ @@ -91,7 +86,6 @@ pdf_init_fontmap_record (fontmap_rec *mrec) #ifdef XETEX mrec->opt.ft_face = NULL; - mrec->opt.glyph_widths = NULL; #endif } @@ -117,10 +111,6 @@ pdf_clear_fontmap_record (fontmap_rec *mrec) RELEASE(mrec->opt.otl_tags); if (mrec->opt.charcoll) RELEASE(mrec->opt.charcoll); -#ifdef XETEX - if (mrec->opt.glyph_widths) - RELEASE(mrec->opt.glyph_widths); -#endif pdf_init_fontmap_record(mrec); } @@ -165,7 +155,6 @@ pdf_copy_fontmap_record (fontmap_rec *dst, const fontmap_rec *src) #ifdef XETEX dst->opt.ft_face = src->opt.ft_face; - dst->opt.glyph_widths = src->opt.glyph_widths; #endif } @@ -1082,7 +1071,6 @@ pdf_insert_native_fontmap_record (const char *name, const char *path, int index, mrec->font_name = (path != NULL) ? mstrdup(path) : NULL; mrec->opt.index = index; mrec->opt.ft_face = face; - mrec->opt.glyph_widths = NULL; if (layout_dir != 0) mrec->opt.flags |= FONTMAP_OPT_VERT; @@ -1176,46 +1164,14 @@ pdf_load_native_font (const char *ps_name, error = pdf_load_native_font_from_path(ps_name, layout_dir, extend, slant, embolden); } else { -/* re-enable this if we decided not to ship XeTeX 0.9999 in TeX Live 2013 */ -#if 0 && defined(XETEX_MAC) - CFStringRef theName = CFStringCreateWithCStringNoCopy(kCFAllocatorDefault, - ps_name, kCFStringEncodingASCII, kCFAllocatorNull); - ATSFontRef fontRef = ATSFontFindFromPostScriptName(theName, kATSOptionFlagsDefault); - CFRelease(theName); - if (fontRef != 0) { - CFStringRef atsName = NULL; - OSStatus status = ATSFontGetName(fontRef, kATSOptionFlagsDefault, &atsName); - if (status == noErr) { - int bufferSize = CFStringGetLength(atsName) * 4 + 1; - char* fontName = NEW(bufferSize, char); - if (CFStringGetCString(atsName, fontName, bufferSize, kCFStringEncodingUTF8)) { - FT_Long index; - UInt8 path[PATH_MAX + 1]; - FT_Error ftErr = FT_GetFilePath_From_Mac_ATS_Name(fontName, path, PATH_MAX, &index); - if (ftErr == 0) { - FT_Face face; - ftErr = FT_New_Face(ftLib, (char*)path, index, &face); - if (ftErr == 0) { - error = pdf_insert_native_fontmap_record(ps_name, NULL, index, face, - layout_dir, extend, slant, embolden); - } - } - } - RELEASE(fontName); - } - if (atsName != NULL) - CFRelease(atsName); - } -#else ERROR("Loading fonts by font name is not supported: %s", ps_name); -#endif /* XETEX_MAC */ } return error; } #endif /* XETEX */ -#if 0 +#if 0 /* tfm_name="dmjhira10", map_name="dmj@DNP@10", sfd_name="DNP" * --> sub_id="hira" * Test if tfm_name can be really considered as subfont. diff --git a/Build/source/texk/dvipdfm-x/src/pdfcolor.c b/Build/source/texk/dvipdfm-x/src/pdfcolor.c index 7749ce6638a..693998a45d6 100644 --- a/Build/source/texk/dvipdfm-x/src/pdfcolor.c +++ b/Build/source/texk/dvipdfm-x/src/pdfcolor.c @@ -239,6 +239,17 @@ pdf_color_is_valid (const pdf_color *color) } /* Dvipdfm special */ +pdf_color default_color = { + 1, + {0.0, 0.0, 0.0, 0.0} +}; + +void +pdf_color_set_default (const pdf_color *color) +{ + pdf_color_copycolor(&default_color, color); +} + #define DEV_COLOR_STACK_MAX 128 static struct { @@ -1104,7 +1115,7 @@ iccp_load_profile (const char *ident, return cspc_id; } -#if 0 +#ifdef XETEX #define WBUF_SIZE 4096 static unsigned char wbuf[WBUF_SIZE]; diff --git a/Build/source/texk/dvipdfm-x/src/pdfcolor.h b/Build/source/texk/dvipdfm-x/src/pdfcolor.h index 65d897e7c66..5c21ad45888 100644 --- a/Build/source/texk/dvipdfm-x/src/pdfcolor.h +++ b/Build/source/texk/dvipdfm-x/src/pdfcolor.h @@ -86,19 +86,26 @@ extern pdf_obj *pdf_get_colorspace_reference (int cspc_id); #if 0 extern int pdf_get_colorspace_num_components (int cspc_id); extern int pdf_get_colorspace_subtype (int cspc_id); +#endif +#ifdef XETEX /* Not working */ extern int pdf_colorspace_load_ICCBased (const char *ident, const char *profile_filename); #endif -/* Color specials & color stack +/* Color special * See remark in spc_color.c. */ +#ifndef XETEX extern void pdf_color_set (pdf_color *sc, pdf_color *fc); +#endif +extern void pdf_color_set_default (const pdf_color *color); extern void pdf_color_push (pdf_color *sc, pdf_color *fc); extern void pdf_color_pop (void); +/* Color stack + */ extern void pdf_color_clear_stack (void); extern void pdf_color_get_current (pdf_color **sc, pdf_color **fc); diff --git a/Build/source/texk/dvipdfm-x/src/spc_color.c b/Build/source/texk/dvipdfm-x/src/spc_color.c deleted file mode 100644 index 94d3a0bd206..00000000000 --- a/Build/source/texk/dvipdfm-x/src/spc_color.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "pdfdev.h" -#include "pdfcolor.h" - -#include "specials.h" - -#include "spc_util.h" -#include "spc_color.h" - - -/* Color stack is actually placed into pdfcolor.c. - * The reason why we need to place stack there is - * that we must reinstall color after grestore and - * other operations that can change current color - * implicitely. - */ - -static int -spc_handler_color_push (struct spc_env *spe, struct spc_arg *args) -{ - int error; - pdf_color colorspec; - - error = spc_util_read_colorspec(spe, &colorspec, args); - if (!error) { - pdf_color_push(&colorspec, &colorspec); - } - - return error; -} - -static int -spc_handler_color_pop (struct spc_env *spe, struct spc_arg *args) -{ - pdf_color_pop(); - - return 0; -} - -/* Invoked by the special command "color rgb .625 0 0". - * DVIPS clears the color stack, and then saves and sets the given color. - */ -static int -spc_handler_color_default (struct spc_env *spe, struct spc_arg *args) -{ - int error; - pdf_color colorspec; - - error = spc_util_read_colorspec(spe, &colorspec, args); - if (!error) { - pdf_color_clear_stack(); - pdf_color_set(&colorspec, &colorspec); - } - - return error; -} - - -/* This is from color special? */ -#include "pdfdoc.h" - -static int -spc_handler_background (struct spc_env *spe, struct spc_arg *args) -{ - int error; - pdf_color colorspec; - - error = spc_util_read_colorspec(spe, &colorspec, args); - if (!error) - pdf_doc_set_bgcolor(&colorspec); - - return error; -} - - -#ifndef ISBLANK -#define ISBLANK(c) ((c) == ' ' || (c) == '\t' || (c) == '\v') -#endif -static void -skip_blank (const char **pp, const char *endptr) -{ - const char *p = *pp; - for ( ; p < endptr && ISBLANK(*p); p++); - *pp = p; -} - -int -spc_color_check_special (const char *buf, long len) -{ - int r = 0; - const char *p, *endptr; - char *q; - - p = buf; - endptr = p + len; - - skip_blank(&p, endptr); - q = parse_c_ident(&p, endptr); - if (!q) - return 0; - else if (!strcmp(q, "color")) - r = 1; - else if (!strcmp(q, "background")) { - r = 1; - } - RELEASE(q); - - return r; -} - -int -spc_color_setup_handler (struct spc_handler *sph, - struct spc_env *spe, struct spc_arg *ap) -{ - const char *p; - char *q; - - ASSERT(sph && spe && ap); - - skip_blank(&ap->curptr, ap->endptr); - q = parse_c_ident(&ap->curptr, ap->endptr); - if (!q) - return -1; - skip_blank(&ap->curptr, ap->endptr); - - if (!strcmp(q, "background")) { - ap->command = "background"; - sph->exec = &spc_handler_background; - RELEASE(q); - } else if (!strcmp(q, "color")) { /* color */ - RELEASE(q); - p = ap->curptr; - - q = parse_c_ident(&p, ap->endptr); - if (!q) - return -1; - else if (!strcmp(q, "push")) { - ap->command = "push"; - sph->exec = &spc_handler_color_push; - ap->curptr = p; - } else if (!strcmp(q, "pop")) { - ap->command = "pop"; - sph->exec = &spc_handler_color_pop; - ap->curptr = p; - } else { /* cmyk, rgb, ... */ - ap->command = ""; - sph->exec = &spc_handler_color_default; - } - RELEASE(q); - } else { - spc_warn(spe, "Not color/background special?"); - RELEASE(q); - return -1; - } - - skip_blank(&ap->curptr, ap->endptr); - return 0; -} - diff --git a/Build/source/texk/dvipdfm-x/src/spc_html.c b/Build/source/texk/dvipdfm-x/src/spc_html.c deleted file mode 100644 index 779f3ffb0d7..00000000000 --- a/Build/source/texk/dvipdfm-x/src/spc_html.c +++ /dev/null @@ -1,943 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "pdfdraw.h" -#include "pdfdev.h" -#include "pdfximage.h" - -#include "pdfdoc.h" - -#include "specials.h" -#include "spc_util.h" - -#include "spc_html.h" - - -#define ENABLE_HTML_IMG_SUPPORT 1 -#define ENABLE_HTML_SVG_TRANSFORM 1 -#define ENABLE_HTML_SVG_OPACITY 1 - -/* _FIXME_ - * Please rewrite this or remove html special support - */ - -#define ANCHOR_TYPE_HREF 0 -#define ANCHOR_TYPE_NAME 1 - -struct spc_html_ -{ - struct { - long extensions; - } opts; - - pdf_obj *link_dict; - char *baseurl; - int pending_type; -}; - -static struct spc_html_ _html_state = { - { 0 }, - NULL, NULL, -1 -}; - - -#ifdef ENABLE_HTML_SVG_TRANSFORM -static int cvt_a_to_tmatrix (pdf_tmatrix *M, const char *ptr, const char **nextptr); -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - -#define \ -downcasify(s) \ -if ((s)) { \ - char *_p = (char *) (s); \ - while (*(_p) != 0) { \ - if (*(_p) >= 'A' && *(_p) <= 'Z') { \ - *(_p) = (*(_p) - 'A') + 'a'; \ - } \ - _p++; \ - } \ -} - -static int -parse_key_val (const char **pp, const char *endptr, char **kp, char **vp) -{ - const char *q, *p; - char *k, *v; - int n, error = 0; - - for (p = *pp ; p < endptr && isspace(*p); p++); -#if 0 - while (!error && p < endptr && - ((*p >= 'a' && *p <= 'z') || - (*p >= 'A' && *p <= 'Z')) - ) { -#endif - k = v = NULL; - for (q = p, n = 0; - p < endptr && - ((*p >= 'a' && *p <= 'z') || - (*p >= 'A' && *p <= 'Z') || - (*p >= '0' && *p <= '9') || - *p == '-' || *p == ':' - ); n++, p++); - if (n == 0) { -#if 0 - break; -#else - *kp = *vp = NULL; - return -1; -#endif - } - k = NEW(n + 1, char); - memcpy(k, q, n); k[n] = '\0'; - if (p + 2 >= endptr || p[0] != '=' || (p[1] != '\"' && p[1] != '\'')) { - RELEASE(k); k = NULL; - *pp = p; - error = -1; - } else { - char qchr = p[1]; - p += 2; /* skip '="' */ - for (q = p, n = 0; p < endptr && *p != qchr; p++, n++); - if (p == endptr || *p != qchr) - error = -1; - else { - v = NEW(n + 1, char); - memcpy(v, q, n); v[n] = '\0'; -#if 0 - pdf_add_dict(t->attr, - pdf_new_name(k), - pdf_new_string(v, n)); - RELEASE(v); -#endif - p++; - } - } -#if 0 - RELEASE(k); - if (!error) - for ( ; p < endptr && isspace(*p); p++); - } -#endif - - *kp = k; *vp = v; *pp = p; - return error; -} - -#define HTML_TAG_NAME_MAX 127 -#define HTML_TAG_TYPE_EMPTY 1 -#define HTML_TAG_TYPE_OPEN 1 -#define HTML_TAG_TYPE_CLOSE 2 - -static int -read_html_tag (char *name, pdf_obj *attr, int *type, const char **pp, const char *endptr) -{ - const char *p = *pp; - int n = 0, error = 0; - - for ( ; p < endptr && isspace(*p); p++); - if (p >= endptr || *p != '<') - return -1; - - *type = HTML_TAG_TYPE_OPEN; - for (++p; p < endptr && isspace(*p); p++); - if (p < endptr && *p == '/') { - *type = HTML_TAG_TYPE_CLOSE; - for (++p; p < endptr && isspace(*p); p++); - } - -#define ISDELIM(c) ((c) == '>' || (c) == '/' || isspace(c)) - for (n = 0; p < endptr && n < HTML_TAG_NAME_MAX && !ISDELIM(*p); n++, p++) { - name[n] = *p; - } - name[n] = '\0'; - if (n == 0 || p == endptr || !ISDELIM(*p)) { - *pp = p; - return -1; - } - - for ( ; p < endptr && isspace(*p); p++); - while (p < endptr && !error && *p != '/' && *p != '>') { - char *kp = NULL, *vp = NULL; - error = parse_key_val(&p, endptr, &kp, &vp); - if (!error) { - downcasify(kp); - pdf_add_dict(attr, - pdf_new_name(kp), - pdf_new_string(vp, strlen(vp) + 1)); /* include trailing NULL here!!! */ - RELEASE(kp); - RELEASE(vp); - } - for ( ; p < endptr && isspace(*p); p++); - } - if (error) { - *pp = p; - return error; - } - - if (p < endptr && *p == '/') { - *type = HTML_TAG_TYPE_EMPTY; - for (++p; p < endptr && isspace(*p); p++); - } - if (p == endptr || *p != '>') { - *pp = p; - return -1; - } - p++; - - downcasify(name); - *pp = p; - return 0; -} - - -static int -spc_handler_html__init (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - sd->link_dict = NULL; - sd->baseurl = NULL; - sd->pending_type = -1; - - return 0; -} - -static int -spc_handler_html__clean (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - if (sd->baseurl) - RELEASE(sd->baseurl); - - if (sd->pending_type >= 0 || sd->link_dict) - spc_warn(spe, "Unclosed html anchor found."); - - if (sd->link_dict) - pdf_release_obj(sd->link_dict); - - sd->pending_type = -1; - sd->baseurl = NULL; - sd->link_dict = NULL; - - return 0; -} - - -static int -spc_handler_html__bophook (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - if (sd->pending_type >= 0) { - spc_warn(spe, "...html anchor continues from previous page processed..."); - } - - return 0; -} - -static int -spc_handler_html__eophook (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - if (sd->pending_type >= 0) { - spc_warn(spe, "Unclosed html anchor at end-of-page!"); - } - - return 0; -} - - -static char * -fqurl (const char *baseurl, const char *name) -{ - char *q; - int len = 0; - - len = strlen(name); - if (baseurl) - len += strlen(baseurl) + 1; /* we may want to add '/' */ - - q = NEW(len + 1, char); - *q = '\0'; - if (baseurl && baseurl[0]) { - char *p; - strcpy(q, baseurl); - p = q + strlen(q) - 1; - if (*p == '/') - *p = '\0'; - if (name[0] && name[0] != '/') - strcat(q, "/"); - } - strcat(q, name); - - return q; -} - -static int -html_open_link (struct spc_env *spe, const char *name, struct spc_html_ *sd) -{ - pdf_obj *color; - char *url; - - ASSERT( name ); - ASSERT( sd->link_dict == NULL ); /* Should be checked somewhere else */ - - sd->link_dict = pdf_new_dict(); - pdf_add_dict(sd->link_dict, - pdf_new_name("Type"), pdf_new_name ("Annot")); - pdf_add_dict(sd->link_dict, - pdf_new_name("Subtype"), pdf_new_name ("Link")); - - color = pdf_new_array (); - pdf_add_array(color, pdf_new_number(0.0)); - pdf_add_array(color, pdf_new_number(0.0)); - pdf_add_array(color, pdf_new_number(1.0)); - pdf_add_dict(sd->link_dict, pdf_new_name("C"), color); - - url = fqurl(sd->baseurl, name); - if (url[0] == '#') { - /* url++; causes memory leak in RELEASE(url) */ - pdf_add_dict(sd->link_dict, - pdf_new_name("Dest"), - pdf_new_string(url+1, strlen(url+1))); - } else { /* Assume this is URL */ - pdf_obj *action = pdf_new_dict(); - pdf_add_dict(action, - pdf_new_name("Type"), - pdf_new_name("Action")); - pdf_add_dict(action, - pdf_new_name("S"), - pdf_new_name("URI")); - pdf_add_dict(action, - pdf_new_name("URI"), - pdf_new_string(url, strlen(url))); - pdf_add_dict(sd->link_dict, - pdf_new_name("A"), - pdf_link_obj(action)); - pdf_release_obj(action); - } - RELEASE(url); - - spc_begin_annot(spe, sd->link_dict); - - sd->pending_type = ANCHOR_TYPE_HREF; - - return 0; -} - -static int -html_open_dest (struct spc_env *spe, const char *name, struct spc_html_ *sd) -{ - int error; - pdf_obj *array, *page_ref; - pdf_coord cp; - - cp.x = spe->x_user; cp.y = spe->y_user; - pdf_dev_transform(&cp, NULL); - - page_ref = pdf_doc_this_page_ref(); - ASSERT( page_ref ); /* Otherwise must be bug */ - - array = pdf_new_array(); - pdf_add_array(array, page_ref); - pdf_add_array(array, pdf_new_name("XYZ")); - pdf_add_array(array, pdf_new_null()); - pdf_add_array(array, pdf_new_number(cp.y + 24.0)); - pdf_add_array(array, pdf_new_null()); - - error = pdf_doc_add_names("Dests", - name, strlen(name), - array); - - if (error) - spc_warn(spe, "Failed to add named destination: %s", name); - - sd->pending_type = ANCHOR_TYPE_NAME; - - return error; -} - -#define ANCHOR_STARTED(s) ((s)->pending_type >= 0 || (s)->link_dict) - -static int -spc_html__anchor_open (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - pdf_obj *href, *name; - int error = 0; - - if (ANCHOR_STARTED(sd)) { - spc_warn(spe, "Nested html anchors found!"); - return -1; - } - - href = pdf_lookup_dict(attr, "href"); - name = pdf_lookup_dict(attr, "name"); - if (href && name) { - spc_warn(spe, "Sorry, you can't have both \"href\" and \"name\" in anchor tag..."); - error = -1; - } else if (href) { - error = html_open_link(spe, pdf_string_value(href), sd); - } else if (name) { /* name */ - error = html_open_dest(spe, pdf_string_value(name), sd); - } else { - spc_warn(spe, "You should have \"href\" or \"name\" in anchor tag!"); - error = -1; - } - - return error; -} - -static int -spc_html__anchor_close (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - int error = 0; - - switch (sd->pending_type) { - case ANCHOR_TYPE_HREF: - if (sd->link_dict) { - spc_end_annot(spe); - pdf_release_obj(sd->link_dict); - sd->link_dict = NULL; - sd->pending_type = -1; - } else { - spc_warn(spe, "Closing html anchor (link) without starting!"); - error = -1; - } - break; - case ANCHOR_TYPE_NAME: - sd->pending_type = -1; - break; - default: - spc_warn(spe, "No corresponding opening tag for html anchor."); - error = -1; - break; - } - - return error; -} - -static int -spc_html__base_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - pdf_obj *href; - char *vp; - - href = pdf_lookup_dict(attr, "href"); - if (!href) { - spc_warn(spe, "\"href\" not found for \"base\" tag!"); - return -1; - } - - vp = (char *) pdf_string_value(href); - if (sd->baseurl) { - spc_warn(spe, "\"baseurl\" changed: \"%s\" --> \"%s\"", sd->baseurl, vp); - RELEASE(sd->baseurl); - } - sd->baseurl = NEW(strlen(vp) + 1, char); - strcpy(sd->baseurl, vp); - - return 0; -} - - -#ifdef ENABLE_HTML_IMG_SUPPORT -/* This isn't completed. - * Please think about placement of images. - */ -static double -atopt (const char *a) -{ - char *q; - const char *p = a; - double v, u = 1.0; - const char *_ukeys[] = { -#define K_UNIT__PT 0 -#define K_UNIT__IN 1 -#define K_UNIT__CM 2 -#define K_UNIT__MM 3 -#define K_UNIT__BP 4 - "pt", "in", "cm", "mm", "bp", -#define K_UNIT__PX 5 - "px", - NULL - }; - int k; - - q = parse_float_decimal(&p, p + strlen(p)); - if (!q) { - WARN("Invalid length value: %s (%c)", a, *p); - return 0.0; - } - - v = atof(q); - RELEASE(q); - - q = parse_c_ident(&p, p + strlen(p)); - if (q) { - for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++); - switch (k) { - case K_UNIT__PT: u *= 72.0 / 72.27; break; - case K_UNIT__IN: u *= 72.0; break; - case K_UNIT__CM: u *= 72.0 / 2.54 ; break; - case K_UNIT__MM: u *= 72.0 / 25.4 ; break; - case K_UNIT__BP: u *= 1.0 ; break; - case K_UNIT__PX: u *= 1.0 ; break; /* 72dpi */ - default: - WARN("Unknown unit of measure: %s", q); - break; - } - RELEASE(q); - } - - return v * u; -} - - -#ifdef ENABLE_HTML_SVG_OPACITY -/* Replicated from spc_tpic */ -static pdf_obj * -create_xgstate (double a /* alpha */, int f_ais /* alpha is shape */) -{ - pdf_obj *dict; - - dict = pdf_new_dict(); - pdf_add_dict(dict, - pdf_new_name("Type"), - pdf_new_name("ExtGState")); - if (f_ais) { - pdf_add_dict(dict, - pdf_new_name("AIS"), - pdf_new_boolean(1)); - } - pdf_add_dict(dict, - pdf_new_name("ca"), - pdf_new_number(a)); - - return dict; -} - -static int -check_resourcestatus (const char *category, const char *resname) -{ - pdf_obj *dict1, *dict2; - - dict1 = pdf_doc_current_page_resources(); - if (!dict1) - return 0; - - dict2 = pdf_lookup_dict(dict1, category); - if (dict2 && - pdf_obj_typeof(dict2) == PDF_DICT) { - if (pdf_lookup_dict(dict2, resname)) - return 1; - } - return 0; -} -#endif /* ENABLE_HTML_SVG_OPACITY */ - -static int -spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - pdf_obj *src, *obj; - transform_info ti; - int id, error = 0; -#ifdef ENABLE_HTML_SVG_OPACITY - double alpha = 1.0; /* meaning fully opaque */ -#endif /* ENABLE_HTML_SVG_OPACITY */ -#ifdef ENABLE_HTML_SVG_TRANSFORM - pdf_tmatrix M, M1; - - pdf_setmatrix(&M, 1.0, 0.0, 0.0, 1.0, spe->x_user, spe->y_user); -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - - spc_warn(spe, "html \"img\" tag found (not completed, plese don't use!)."); - - src = pdf_lookup_dict(attr, "src"); - if (!src) { - spc_warn(spe, "\"src\" attribute not found for \"img\" tag!"); - return -1; - } - - transform_info_clear(&ti); - obj = pdf_lookup_dict(attr, "width"); - if (obj) { - ti.width = atopt(pdf_string_value(obj)); - ti.flags |= INFO_HAS_WIDTH; - } - obj = pdf_lookup_dict(attr, "height"); - if (obj) { - ti.height = atopt(pdf_string_value(obj)); - ti.flags |= INFO_HAS_HEIGHT; - } - -#ifdef ENABLE_HTML_SVG_OPACITY - obj = pdf_lookup_dict(attr, "svg:opacity"); - if (obj) { - alpha = atof(pdf_string_value(obj)); - if (alpha < 0.0 || alpha > 1.0) { - spc_warn(spe, "Invalid opacity value: %s", pdf_string_value(obj)); - alpha = 1.0; - } - } -#endif /* ENABLE_HTML_SVG_OPCAITY */ - -#ifdef ENABLE_HTML_SVG_TRANSFORM - obj = pdf_lookup_dict(attr, "svg:transform"); - if (obj) { - const char *p = pdf_string_value(obj); - pdf_tmatrix N; - for ( ; *p && isspace(*p); p++); - while (*p && !error) { - pdf_setmatrix(&N, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - error = cvt_a_to_tmatrix(&N, p, &p); - if (!error) { - N.f = -N.f; - pdf_concatmatrix(&M, &N); - for ( ; *p && isspace(*p); p++); - if (*p == ',') - for (++p; *p && isspace(*p); p++); - } - } - } -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - - if (error) { - spc_warn(spe, "Error in html \"img\" tag attribute."); - return error; - } - - id = pdf_ximage_findresource(pdf_string_value(src), 0, NULL); - if (id < 0) { - spc_warn(spe, "Could not find/load image: %s", pdf_string_value(src)); - error = -1; - } else { -#if defined(ENABLE_HTML_SVG_TRANSFORM) || defined(ENABLE_HTML_SVG_OPACITY) - { - char *res_name; - pdf_rect r; - - graphics_mode(); - - pdf_dev_gsave(); - -#ifdef ENABLE_HTML_SVG_OPACITY - { - pdf_obj *dict; - int a = round(100.0 * alpha); - if (a != 0) { - res_name = NEW(strlen("_Tps_a100_") + 1, char); - sprintf(res_name, "_Tps_a%03d_", a); /* Not Tps prefix but... */ - if (!check_resourcestatus("ExtGState", res_name)) { - dict = create_xgstate(round_at(0.01 * a, 0.01), 0); - pdf_doc_add_page_resource("ExtGState", - res_name, pdf_ref_obj(dict)); - pdf_release_obj(dict); - } - pdf_doc_add_page_content(" /", 2); /* op: */ - pdf_doc_add_page_content(res_name, strlen(res_name)); /* op: */ - pdf_doc_add_page_content(" gs", 3); /* op: gs */ - RELEASE(res_name); - } - } -#endif /* ENABLE_HTML_SVG_OPACITY */ - - pdf_ximage_scale_image(id, &M1, &r, &ti); - pdf_concatmatrix(&M, &M1); - pdf_dev_concat(&M); - - pdf_dev_rectclip(r.llx, r.lly, r.urx - r.llx, r.ury - r.lly); - - res_name = pdf_ximage_get_resname(id); - pdf_doc_add_page_content(" /", 2); /* op: */ - pdf_doc_add_page_content(res_name, strlen(res_name)); /* op: */ - pdf_doc_add_page_content(" Do", 3); /* op: Do */ - - pdf_dev_grestore(); - - pdf_doc_add_page_resource("XObject", - res_name, - pdf_ximage_get_reference(id)); - } -#else - pdf_dev_put_image(id, &ti, spe->x_user, spe->y_user); -#endif /* ENABLE_HTML_SVG_XXX */ - } - - return error; -} -#else -static int -spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - spc_warn(spe, "IMG tag not yet supported yet..."); - return -1; -} -#endif /* ENABLE_HTML_IMG_SUPPORT */ - - -static int -spc_handler_html_default (struct spc_env *spe, struct spc_arg *ap) -{ - struct spc_html_ *sd = &_html_state; - char name[HTML_TAG_NAME_MAX + 1]; - pdf_obj *attr; - int error = 0, type = HTML_TAG_TYPE_OPEN; - - if (ap->curptr >= ap->endptr) - return 0; - - attr = pdf_new_dict(); - error = read_html_tag(name, attr, &type, &ap->curptr, ap->endptr); - if (error) { - pdf_release_obj(attr); - return error; - } - if (!strcmp(name, "a")) { - switch (type) { - case HTML_TAG_TYPE_OPEN: - error = spc_html__anchor_open (spe, attr, sd); - break; - case HTML_TAG_TYPE_CLOSE: - error = spc_html__anchor_close(spe, attr, sd); - break; - default: - spc_warn(spe, "Empty html anchor tag???"); - error = -1; - break; - } - } else if (!strcmp(name, "base")) { - if (type == HTML_TAG_TYPE_CLOSE) { - spc_warn(spe, "Close tag for \"base\"???"); - error = -1; - } else { /* treat "open" same as "empty" */ - error = spc_html__base_empty(spe, attr, sd); - } - } else if (!strcmp(name, "img")) { - if (type == HTML_TAG_TYPE_CLOSE) { - spc_warn(spe, "Close tag for \"img\"???"); - error = -1; - } else { /* treat "open" same as "empty" */ - error = spc_html__img_empty(spe, attr, sd); - } - } - pdf_release_obj(attr); - - for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); - - return error; -} - - -#ifdef ENABLE_HTML_SVG_TRANSFORM -/* translate wsp* '(' wsp* number (comma-wsp number)? wsp* ')' */ -static int -cvt_a_to_tmatrix (pdf_tmatrix *M, const char *ptr, const char **nextptr) -{ - char *q; - const char *p = ptr; - int n; - double v[6]; - static const char *_tkeys[] = { -#define K_TRNS__MATRIX 0 - "matrix", /* a b c d e f */ -#define K_TRNS__TRANSLATE 1 - "translate", /* tx [ty] : dflt. tf = 0 */ -#define K_TRNS__SCALE 2 - "scale", /* sx [sy] : dflt. sy = sx */ -#define K_TRNS__ROTATE 3 - "rotate", /* ang [cx cy] : dflt. cx, cy = 0 */ -#define K_TRNS__SKEWX 4 -#define K_TRNS__SKEWY 5 - "skewX", /* ang */ - "skewY", /* ang */ - NULL - }; - int k; - - for ( ; *p && isspace(*p); p++); - - q = parse_c_ident(&p, p + strlen(p)); - if (!q) - return -1; - /* parsed transformation key */ - for (k = 0; _tkeys[k] && strcmp(q, _tkeys[k]); k++); - RELEASE(q); - - /* handle args */ - for ( ; *p && isspace(*p); p++); - if (*p != '(' || *(p + 1) == 0) - return -1; - for (++p; *p && isspace(*p); p++); - for (n = 0; n < 6 && *p && *p != ')'; n++) { - q = parse_float_decimal(&p, p + strlen(p)); - if (!q) - break; - else { - v[n] = atof(q); - if (*p == ',') - p++; - for ( ; *p && isspace(*p); p++); - if (*p == ',') - for (++p; *p && isspace(*p); p++); - RELEASE(q); - } - } - if (*p != ')') - return -1; - p++; - - switch (k) { - case K_TRNS__MATRIX: - if (n != 6) - return -1; - M->a = v[0]; M->c = v[1]; - M->b = v[2]; M->d = v[3]; - M->e = v[4]; M->f = v[5]; - break; - case K_TRNS__TRANSLATE: - if (n != 1 && n != 2) - return -1; - M->a = M->d = 1.0; - M->c = M->b = 0.0; - M->e = v[0]; M->f = (n == 2) ? v[1] : 0.0; - break; - case K_TRNS__SCALE: - if (n != 1 && n != 2) - return -1; - M->a = v[0]; M->d = (n == 2) ? v[1] : v[0]; - M->c = M->b = 0.0; - M->e = M->f = 0.0; - break; - case K_TRNS__ROTATE: - if (n != 1 && n != 3) - return -1; - M->a = cos(v[0] * M_PI / 180.0); - M->c = sin(v[0] * M_PI / 180.0); - M->b = -M->c; M->d = M->a; - M->e = (n == 3) ? v[1] : 0.0; - M->f = (n == 3) ? v[2] : 0.0; - break; - case K_TRNS__SKEWX: - if (n != 1) - return -1; - M->a = M->d = 1.0; - M->c = 0.0; - M->b = tan(v[0] * M_PI / 180.0); - break; - case K_TRNS__SKEWY: - if (n != 1) - return -1; - M->a = M->d = 1.0; - M->c = tan(v[0] * M_PI / 180.0); - M->b = 0.0; - break; - } - - if (nextptr) - *nextptr = p; - return 0; -} -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - -int -spc_html_at_begin_document (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__init(NULL, NULL, sd); -} - -int -spc_html_at_begin_page (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__bophook(NULL, NULL, sd); -} - -int -spc_html_at_end_page (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__eophook(NULL, NULL, sd); -} - -int -spc_html_at_end_document (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__clean(NULL, NULL, sd); -} - - -int -spc_html_check_special (const char *buffer, long size) -{ - const char *p, *endptr; - - p = buffer; - endptr = p + size; - - for ( ; p < endptr && isspace(*p); p++); - size = (long) (endptr - p); - if (size >= strlen("html:") && - !memcmp(p, "html:", strlen("html:"))) { - return 1; - } - - return 0; -} - - -int -spc_html_setup_handler (struct spc_handler *sph, - struct spc_env *spe, struct spc_arg *ap) -{ - ASSERT(sph && spe && ap); - - for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); - if (ap->curptr + strlen("html:") > ap->endptr || - memcmp(ap->curptr, "html:", strlen("html:"))) { - return -1; - } - - ap->command = ""; - - sph->key = "html:"; - sph->exec = &spc_handler_html_default; - - ap->curptr += strlen("html:"); - for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); - - return 0; -} - diff --git a/Build/source/texk/dvipdfm-x/src/spc_util.c b/Build/source/texk/dvipdfm-x/src/spc_util.c deleted file mode 100644 index 5bd3834e988..00000000000 --- a/Build/source/texk/dvipdfm-x/src/spc_util.c +++ /dev/null @@ -1,791 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2007-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "pdfdev.h" -#include "pdfparse.h" -#include "pdfcolor.h" -#include "pdfdraw.h" - -#include "specials.h" - -#include "spc_util.h" - - -#ifndef ISBLANK -#define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -static void -skip_blank (const char **pp, const char *endptr) -{ - const char *p = *pp; - for ( ; p < endptr && ISBLANK(*p); p++); - *pp = p; -} - - -/* From pdfcolor.c */ -static int pdf_color_namedcolor (pdf_color *color, const char *colorname); - -static int -spc_util_read_numbers (double *values, int num_values, - struct spc_env *spe, struct spc_arg *args) -{ - int count; - char *q; - - skip_blank(&args->curptr, args->endptr); - for (count = 0; - count < num_values && - args->curptr < args->endptr; ) { - q = parse_float_decimal(&args->curptr, args->endptr); - if (!q) - break; - else { - values[count] = atof(q); - RELEASE(q); - skip_blank(&args->curptr, args->endptr); - count++; - } - } - - return count; -} - -static void -rgb_color_from_hsv (pdf_color *color, double h, double s, double v) -{ - double r, g, b; - ASSERT( color ); - r = g = b = v; - if (s != 0.0) { - double h6, f, v1, v2, v3; - int i; - h6 = h * 6; /* 360 / 60 */ - i = (int) h6; - f = h6 - i; - v1 = v * (1 - s); - v2 = v * (1 - s * f); - v3 = v * (1 - s * (1 - f)); - switch (i) { - case 0: r = v ; g = v3; b = v1; break; - case 1: r = v2; g = v ; b = v1; break; - case 2: r = v1; g = v ; b = v3; break; - case 3: r = v1; g = v2; b = v ; break; - case 4: r = v3; g = v1; b = v ; break; - case 5: r = v ; g = v1; b = v2; break; - case 6: r = v ; g = v1; b = v2; break; - } - } - pdf_color_rgbcolor(color, r, g, b); -} - -static int -spc_read_color_color (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) -{ - char *q; - double cv[4]; - int nc; - int error = 0; - - q = parse_c_ident(&ap->curptr, ap->endptr); - if (!q) { - spc_warn(spe, "No valid color specified?"); - return -1; - } - skip_blank(&ap->curptr, ap->endptr); - - if (!strcmp(q, "rgb")) { /* Handle rgb color */ - nc = spc_util_read_numbers(cv, 3, spe, ap); - if (nc != 3) { - spc_warn(spe, "Invalid value for RGB color specification."); - error = -1; - } else { - pdf_color_rgbcolor(colorspec, cv[0], cv[1], cv[2]); - } - } else if (!strcmp(q, "cmyk")) { /* Handle cmyk color */ - nc = spc_util_read_numbers(cv, 4, spe, ap); - if (nc != 4) { - spc_warn(spe, "Invalid value for CMYK color specification."); - error = -1; - } else { - pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); - } - } else if (!strcmp(q, "gray")) { /* Handle gray */ - nc = spc_util_read_numbers(cv, 1, spe, ap); - if (nc != 1) { - spc_warn(spe, "Invalid value for gray color specification."); - error = -1; - } else { - pdf_color_graycolor(colorspec, cv[0]); - } - } else if (!strcmp(q, "hsb")) { - nc = spc_util_read_numbers(cv, 3, spe, ap); - if (nc != 3) { - spc_warn(spe, "Invalid value for HSB color specification."); - error = -1; - } else { - rgb_color_from_hsv(colorspec, cv[0], cv[1], cv[2]); - spc_warn(spe, "HSB color converted to RGB: hsb: <%g, %g, %g> ==> rgb: <%g, %g, %g>", - cv[0], cv[1], cv[2], - colorspec->values[0], colorspec->values[1], colorspec->values[2]); - } - } else { /* Must be a "named" color */ - error = pdf_color_namedcolor(colorspec, q); - if (error) - spc_warn(spe, "Unrecognized color name: %s", q); - } - RELEASE(q); - - return error; -} - -/* Argumaent for this is PDF_Number or PDF_Array. - * But we ignore that since we don't want to add - * dependency to pdfxxx and @foo can not be - * allowed for color specification. "pdf" here - * means pdf: special syntax. - */ -static int -spc_read_color_pdf (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) -{ - double cv[4]; /* at most four */ - int nc, isarry = 0; - int error = 0; - char *q; - - skip_blank(&ap->curptr, ap->endptr); - - if (ap->curptr[0] == '[') { - ap->curptr++; skip_blank(&ap->curptr, ap->endptr); - isarry = 1; - } - - nc = spc_util_read_numbers(cv, 4, spe, ap); - switch (nc) { - case 1: - pdf_color_graycolor(colorspec, cv[0]); - break; - case 3: - pdf_color_rgbcolor (colorspec, cv[0], cv[1], cv[2]); - break; - case 4: - pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); - break; - default: - /* Try to read the color names defined in dvipsname.def */ - q = parse_c_ident(&ap->curptr, ap->endptr); - if (q) { - error = pdf_color_namedcolor(colorspec, q); - if (error) - spc_warn(spe, "Unrecognized color name: %s, keep the current color", q); - RELEASE(q); - } else { - error = -1; - } - break; - } - - if (isarry) { - skip_blank(&ap->curptr, ap->endptr); - if (ap->curptr >= ap->endptr || ap->curptr[0] != ']') { - spc_warn(spe, "Unbalanced '[' and ']' in color specification."); - error = -1; - } else { - ap->curptr++; - } - } - - return error; -} - - -/* This is for reading *single* color specification. */ -int -spc_util_read_colorspec (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) -{ - ASSERT(colorspec && spe && ap); - - skip_blank(&ap->curptr, ap->endptr); - if (ap->curptr >= ap->endptr) { - return -1; - } - return spc_read_color_color(spe, colorspec, ap); -} - -int -spc_util_read_pdfcolor (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap, pdf_color *defaultcolor) -{ - int error = 0; - - ASSERT(colorspec && spe && ap); - - skip_blank(&ap->curptr, ap->endptr); - if (ap->curptr >= ap->endptr) { - return -1; - } - error = spc_read_color_pdf(spe, colorspec, ap); - if (error < 0 && defaultcolor) { - pdf_color_copycolor(colorspec, defaultcolor); - error = 0; - } - return error; -} - -/* This need to allow 'true' prefix for unit and - * length value must be divided by current magnification. - */ -int -spc_util_read_length (struct spc_env *spe, double *vp /* ret. */, struct spc_arg *ap) -{ - char *q; - double v, u = 1.0; - const char *ukeys[] = { -#define K_UNIT__PT 0 -#define K_UNIT__IN 1 -#define K_UNIT__CM 2 -#define K_UNIT__MM 3 -#define K_UNIT__BP 4 - "pt", "in", "cm", "mm", "bp", NULL - }; - int k, error = 0; - - q = parse_float_decimal(&ap->curptr, ap->endptr); - if (!q) - return -1; - - v = atof(q); - RELEASE(q); - - q = parse_c_ident(&ap->curptr, ap->endptr); - if (q) { - if (strlen(q) > strlen("true") && - !memcmp(q, "true", strlen("true"))) { - u /= spe->mag != 0.0 ? spe->mag : 1.0; /* inverse magnify */ - q += strlen("true"); - } - for (k = 0; ukeys[k] && strcmp(ukeys[k], q); k++); - switch (k) { - case K_UNIT__PT: u *= 72.0 / 72.27; break; - case K_UNIT__IN: u *= 72.0; break; - case K_UNIT__CM: u *= 72.0 / 2.54 ; break; - case K_UNIT__MM: u *= 72.0 / 25.4 ; break; - case K_UNIT__BP: u *= 1.0 ; break; - default: - spc_warn(spe, "Unknown unit of measure: %s", q); - error = -1; - break; - } - RELEASE(q); - } - - *vp = v * u; - return error; -} - - -/* - * Compute a transformation matrix - * transformations are applied in the following - * order: scaling, rotate, displacement. - */ -static void -make_transmatrix (pdf_tmatrix *M, - double xoffset, double yoffset, - double xscale, double yscale, - double rotate) -{ - double c, s; - - c = cos(rotate); - s = sin(rotate); - - M->a = xscale * c; M->b = xscale * s; - M->c = -yscale * s; M->d = yscale * c; - M->e = xoffset; M->f = yoffset; -} - -static int -spc_read_dimtrns_dvips (struct spc_env *spe, transform_info *t, struct spc_arg *ap) -{ - static const char *_dtkeys[] = { -#define K_TRN__HOFFSET 0 -#define K_TRN__VOFFSET 1 - "hoffset", "voffset", -#define K_DIM__HSIZE 2 -#define K_DIM__VSIZE 3 - "hsize", "vsize", -#define K_TRN__HSCALE 4 -#define K_TRN__VSCALE 5 - "hscale", "vscale", -#define K_TRN__ANGLE 6 - "angle", -#define K__CLIP 7 - "clip", -#define K_DIM__LLX 8 -#define K_DIM__LLY 9 -#define K_DIM__URX 10 -#define K_DIM__URY 11 - "llx", "lly", "urx", "ury", -#define K_DIM__RWI 12 -#define K_DIM__RHI 13 - "rwi", "rhi", - NULL - }; - double xoffset, yoffset, xscale, yscale, rotate; - int error = 0; - - xoffset = yoffset = rotate = 0.0; xscale = yscale = 1.0; - - skip_blank(&ap->curptr, ap->endptr); - while (!error && ap->curptr < ap->endptr) { - char *kp, *vp; - int k; - - kp = parse_c_ident(&ap->curptr, ap->endptr); - if (!kp) - break; - - for (k = 0; _dtkeys[k] && strcmp(kp, _dtkeys[k]); k++); - if (!_dtkeys[k]) { - spc_warn(spe, "Unrecognized dimension/transformation key: %s", kp); - error = -1; - RELEASE(kp); - break; - } - - skip_blank(&ap->curptr, ap->endptr); - if (k == K__CLIP) { - t->flags |= INFO_DO_CLIP; - RELEASE(kp); - continue; /* not key-value */ - } - - if (ap->curptr < ap->endptr && ap->curptr[0] == '=') { - ap->curptr++; - skip_blank(&ap->curptr, ap->endptr); - } - - vp = NULL; - if (ap->curptr[0] == '\'' || ap->curptr[0] == '\"') { - char qchr = ap->curptr[0]; - ap->curptr++; - skip_blank(&ap->curptr, ap->endptr); - vp = parse_float_decimal(&ap->curptr, ap->endptr); - skip_blank(&ap->curptr, ap->endptr); - if (vp && qchr != ap->curptr[0]) { - spc_warn(spe, "Syntax error in dimension/transformation specification."); - error = -1; - RELEASE(vp); vp = NULL; - } - ap->curptr++; - } else { - vp = parse_float_decimal(&ap->curptr, ap->endptr); - } - if (!error && !vp) { - spc_warn(spe, "Missing value for dimension/transformation: %s", kp); - error = -1; - } - RELEASE(kp); - if (!vp || error) { - break; - } - - switch (k) { - case K_TRN__HOFFSET: - xoffset = atof(vp); - break; - case K_TRN__VOFFSET: - yoffset = atof(vp); - break; - case K_DIM__HSIZE: - t->width = atof(vp); - t->flags |= INFO_HAS_WIDTH; - break; - case K_DIM__VSIZE: - t->height = atof(vp); - t->flags |= INFO_HAS_HEIGHT; - break; - case K_TRN__HSCALE: - xscale = atof(vp) / 100.0; - break; - case K_TRN__VSCALE: - yscale = atof(vp) / 100.0; - break; - case K_TRN__ANGLE: - rotate = M_PI * atof(vp) / 180.0; - break; - case K_DIM__LLX: - t->bbox.llx = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__LLY: - t->bbox.lly = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__URX: - t->bbox.urx = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__URY: - t->bbox.ury = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__RWI: - t->width = atof(vp) / 10.0; - t->flags |= INFO_HAS_WIDTH; - break; - case K_DIM__RHI: - t->height = atof(vp) / 10.0; - t->flags |= INFO_HAS_HEIGHT; - break; - } - skip_blank(&ap->curptr, ap->endptr); - RELEASE(vp); - } - make_transmatrix(&(t->matrix), xoffset, yoffset, xscale, yscale, rotate); - - return error; -} - - -static int -spc_read_dimtrns_pdfm (struct spc_env *spe, transform_info *p, struct spc_arg *ap, long *page_no) -{ - int has_scale, has_xscale, has_yscale, has_rotate, has_matrix; - const char *_dtkeys[] = { -#define K_DIM__WIDTH 0 -#define K_DIM__HEIGHT 1 -#define K_DIM__DEPTH 2 - "width", "height", "depth", -#define K_TRN__SCALE 3 -#define K_TRN__XSCALE 4 -#define K_TRN__YSCALE 5 -#define K_TRN__ROTATE 6 - "scale", "xscale", "yscale", "rotate", /* See "Dvipdfmx User's Manual", p.5 */ -#define K_TRN__BBOX 7 - "bbox", -#define K_TRN__MATRIX 8 - "matrix", -#undef K__CLIP -#define K__CLIP 9 - "clip", -#define K__PAGE 10 - "page", -#define K__HIDE 11 - "hide", - NULL - }; - double xscale, yscale, rotate; - int error = 0; - - has_xscale = has_yscale = has_scale = has_rotate = has_matrix = 0; - xscale = yscale = 1.0; rotate = 0.0; - p->flags |= INFO_DO_CLIP; /* default: do clipping */ - p->flags &= ~INFO_DO_HIDE; /* default: do clipping */ - - skip_blank(&ap->curptr, ap->endptr); - - while (!error && ap->curptr < ap->endptr) { - char *kp, *vp; - int k; - - kp = parse_c_ident(&ap->curptr, ap->endptr); - if (!kp) - break; - - skip_blank(&ap->curptr, ap->endptr); - for (k = 0; _dtkeys[k] && strcmp(_dtkeys[k], kp); k++); - switch (k) { - case K_DIM__WIDTH: - error = spc_util_read_length(spe, &p->width , ap); - p->flags |= INFO_HAS_WIDTH; - break; - case K_DIM__HEIGHT: - error = spc_util_read_length(spe, &p->height, ap); - p->flags |= INFO_HAS_HEIGHT; - break; - case K_DIM__DEPTH: - error = spc_util_read_length(spe, &p->depth , ap); - p->flags |= INFO_HAS_HEIGHT; - break; - case K_TRN__SCALE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - xscale = yscale = atof(vp); - has_scale = 1; - RELEASE(vp); - } - break; - case K_TRN__XSCALE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - xscale = atof(vp); - has_xscale = 1; - RELEASE(vp); - } - break; - case K_TRN__YSCALE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - yscale = atof(vp); - has_yscale = 1; - RELEASE(vp); - } - break; - case K_TRN__ROTATE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - rotate = M_PI * atof(vp) / 180.0; - has_rotate = 1; - RELEASE(vp); - } - break; - case K_TRN__BBOX: - { - double v[4]; - if (spc_util_read_numbers(v, 4, spe, ap) != 4) - error = -1; - else { - p->bbox.llx = v[0]; - p->bbox.lly = v[1]; - p->bbox.urx = v[2]; - p->bbox.ury = v[3]; - p->flags |= INFO_HAS_USER_BBOX; - } - } - break; - case K_TRN__MATRIX: - { - double v[6]; - if (spc_util_read_numbers(v, 6, spe, ap) != 6) - error = -1; - else { - pdf_setmatrix(&(p->matrix), v[0], v[1], v[2], v[3], v[4], v[5]); - has_matrix = 1; - } - } - break; - case K__CLIP: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - if (atof(vp)) - p->flags |= INFO_DO_CLIP; - else - p->flags &= ~INFO_DO_CLIP; - RELEASE(vp); - } - break; - case K__PAGE: - { - double page; - if (page_no && spc_util_read_numbers(&page, 1, spe, ap) == 1) - *page_no = (long) page; - else - error = -1; - } - break; - case K__HIDE: - p->flags |= INFO_DO_HIDE; - break; - default: - error = -1; - break; - } - if (error) - spc_warn(spe, "Unrecognized key or invalid value for dimension/transformation: %s", kp); - else - skip_blank(&ap->curptr, ap->endptr); - RELEASE(kp); - } - - if (!error) { - /* Check consistency */ - if (has_xscale && (p->flags & INFO_HAS_WIDTH)) { - spc_warn(spe, "Can't supply both width and xscale. Ignore xscale."); - xscale = 1.0; - } else if (has_yscale && - (p->flags & INFO_HAS_HEIGHT)) { - spc_warn(spe, "Can't supply both height/depth and yscale. Ignore yscale."); - yscale = 1.0; - } else if (has_scale && - (has_xscale || has_yscale)) { - spc_warn(spe, "Can't supply overall scale along with axis scales."); - error = -1; - } else if (has_matrix && - (has_scale || has_xscale || has_yscale || has_rotate)) { - spc_warn(spe, "Can't supply transform matrix along with scales or rotate. Ignore scales and rotate."); - } - } - - if (!has_matrix) { - make_transmatrix(&(p->matrix), 0.0, 0.0, xscale, yscale, rotate); - } - - if (!(p->flags & INFO_HAS_USER_BBOX)) { - p->flags &= ~INFO_DO_CLIP; /* no clipping needed */ - } - - return error; -} - -int -spc_util_read_dimtrns (struct spc_env *spe, transform_info *ti, struct spc_arg *args, long *page_no, int syntax) -{ - ASSERT(ti && spe && args); - - if (syntax) { - ASSERT(!page_no); - return spc_read_dimtrns_dvips(spe, ti, args); - } else { - return spc_read_dimtrns_pdfm (spe, ti, args, page_no); - } - - return -1; -} - - -/* Color names */ -#ifdef rgb -#undef rgb -#endif -#ifdef cmyk -#undef cmyk -#endif -#define gray(g) {1, {g}} -#define rgb8(r,g,b) {3, {((r)/255.0), ((g)/255.0), ((b)/255.0), 0.0}} -#define cmyk(c,m,y,k) {4, {(c), (m), (y), (k)}} - -static struct colordef_ -{ - const char *key; - pdf_color color; -} colordefs[] = { - {"GreenYellow", cmyk(0.15, 0.00, 0.69, 0.00)}, - {"Yellow", cmyk(0.00, 0.00, 1.00, 0.00)}, - {"Goldenrod", cmyk(0.00, 0.10, 0.84, 0.00)}, - {"Dandelion", cmyk(0.00, 0.29, 0.84, 0.00)}, - {"Apricot", cmyk(0.00, 0.32, 0.52, 0.00)}, - {"Peach", cmyk(0.00, 0.50, 0.70, 0.00)}, - {"Melon", cmyk(0.00, 0.46, 0.50, 0.00)}, - {"YellowOrange", cmyk(0.00, 0.42, 1.00, 0.00)}, - {"Orange", cmyk(0.00, 0.61, 0.87, 0.00)}, - {"BurntOrange", cmyk(0.00, 0.51, 1.00, 0.00)}, - {"Bittersweet", cmyk(0.00, 0.75, 1.00, 0.24)}, - {"RedOrange", cmyk(0.00, 0.77, 0.87, 0.00)}, - {"Mahogany", cmyk(0.00, 0.85, 0.87, 0.35)}, - {"Maroon", cmyk(0.00, 0.87, 0.68, 0.32)}, - {"BrickRed", cmyk(0.00, 0.89, 0.94, 0.28)}, - {"Red", cmyk(0.00, 1.00, 1.00, 0.00)}, - {"OrangeRed", cmyk(0.00, 1.00, 0.50, 0.00)}, - {"RubineRed", cmyk(0.00, 1.00, 0.13, 0.00)}, - {"WildStrawberry", cmyk(0.00, 0.96, 0.39, 0.00)}, - {"Salmon", cmyk(0.00, 0.53, 0.38, 0.00)}, - {"CarnationPink", cmyk(0.00, 0.63, 0.00, 0.00)}, - {"Magenta", cmyk(0.00, 1.00, 0.00, 0.00)}, - {"VioletRed", cmyk(0.00, 0.81, 0.00, 0.00)}, - {"Rhodamine", cmyk(0.00, 0.82, 0.00, 0.00)}, - {"Mulberry", cmyk(0.34, 0.90, 0.00, 0.02)}, - {"RedViolet", cmyk(0.07, 0.90, 0.00, 0.34)}, - {"Fuchsia", cmyk(0.47, 0.91, 0.00, 0.08)}, - {"Lavender", cmyk(0.00, 0.48, 0.00, 0.00)}, - {"Thistle", cmyk(0.12, 0.59, 0.00, 0.00)}, - {"Orchid", cmyk(0.32, 0.64, 0.00, 0.00)}, - {"DarkOrchid", cmyk(0.40, 0.80, 0.20, 0.00)}, - {"Purple", cmyk(0.45, 0.86, 0.00, 0.00)}, - {"Plum", cmyk(0.50, 1.00, 0.00, 0.00)}, - {"Violet", cmyk(0.79, 0.88, 0.00, 0.00)}, - {"RoyalPurple", cmyk(0.75, 0.90, 0.00, 0.00)}, - {"BlueViolet", cmyk(0.86, 0.91, 0.00, 0.04)}, - {"Periwinkle", cmyk(0.57, 0.55, 0.00, 0.00)}, - {"CadetBlue", cmyk(0.62, 0.57, 0.23, 0.00)}, - {"CornflowerBlue", cmyk(0.65, 0.13, 0.00, 0.00)}, - {"MidnightBlue", cmyk(0.98, 0.13, 0.00, 0.43)}, - {"NavyBlue", cmyk(0.94, 0.54, 0.00, 0.00)}, - {"RoyalBlue", cmyk(1.00, 0.50, 0.00, 0.00)}, - {"Blue", cmyk(1.00, 1.00, 0.00, 0.00)}, - {"Cerulean", cmyk(0.94, 0.11, 0.00, 0.00)}, - {"Cyan", cmyk(1.00, 0.00, 0.00, 0.00)}, - {"ProcessBlue", cmyk(0.96, 0.00, 0.00, 0.00)}, - {"SkyBlue", cmyk(0.62, 0.00, 0.12, 0.00)}, - {"Turquoise", cmyk(0.85, 0.00, 0.20, 0.00)}, - {"TealBlue", cmyk(0.86, 0.00, 0.34, 0.02)}, - {"Aquamarine", cmyk(0.82, 0.00, 0.30, 0.00)}, - {"BlueGreen", cmyk(0.85, 0.00, 0.33, 0.00)}, - {"Emerald", cmyk(1.00, 0.00, 0.50, 0.00)}, - {"JungleGreen", cmyk(0.99, 0.00, 0.52, 0.00)}, - {"SeaGreen", cmyk(0.69, 0.00, 0.50, 0.00)}, - {"Green", cmyk(1.00, 0.00, 1.00, 0.00)}, - {"ForestGreen", cmyk(0.91, 0.00, 0.88, 0.12)}, - {"PineGreen", cmyk(0.92, 0.00, 0.59, 0.25)}, - {"LimeGreen", cmyk(0.50, 0.00, 1.00, 0.00)}, - {"YellowGreen", cmyk(0.44, 0.00, 0.74, 0.00)}, - {"SpringGreen", cmyk(0.26, 0.00, 0.76, 0.00)}, - {"OliveGreen", cmyk(0.64, 0.00, 0.95, 0.40)}, - {"RawSienna", cmyk(0.00, 0.72, 1.00, 0.45)}, - {"Sepia", cmyk(0.00, 0.83, 1.00, 0.70)}, - {"Brown", cmyk(0.00, 0.81, 1.00, 0.60)}, - {"Tan", cmyk(0.14, 0.42, 0.56, 0.00)}, - /* Adobe Reader 7 and 8 had problem when gray and cmyk black colors - * are mixed. No problem with Previewer.app. - * It happens when \usepackage[dvipdfm]{graphicx} and then called - * \usepackage{color} without dvipdfm option. */ - {"Gray", gray(0.5)}, - {"Black", gray(0.0)}, - {"White", gray(1.0)}, - {NULL} -}; - - -static int -pdf_color_namedcolor (pdf_color *color, const char *name) -{ - int i; - for (i = 0; colordefs[i].key; i++) { - if (!strcmp(colordefs[i].key, name)) { - pdf_color_copycolor(color, &colordefs[i].color); - return 0; - } - } - return -1; -} - diff --git a/Build/source/texk/dvipdfm-x/src/spc_util.h b/Build/source/texk/dvipdfm-x/src/spc_util.h deleted file mode 100644 index c7251069210..00000000000 --- a/Build/source/texk/dvipdfm-x/src/spc_util.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifndef _SPC_UTIL_H_ -#define _SPC_UTIL_H_ - -#include "pdfcolor.h" -#include "pdfdev.h" - -#include "specials.h" - -/* syntax 1: ((rgb|cmyk|hsb|gray) colorvalues)|colorname - * syntax 0: pdf_number|pdf_array - * - * This is for reading *single* color specification. - */ -extern int spc_util_read_colorspec (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *args); -extern int spc_util_read_pdfcolor (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *args, pdf_color *defaultcolor); -extern int spc_util_read_dimtrns (struct spc_env *spe, transform_info *dimtrns, struct spc_arg *args, long *page, int syntax); -extern int spc_util_read_length (struct spc_env *spe, double *length, struct spc_arg *ap); - -#endif /* _SPC_UTIL_H_ */ diff --git a/Build/source/texk/dvipdfm-x/src/truetype.c b/Build/source/texk/dvipdfm-x/src/truetype.c index 225c0b793d4..36ff3304419 100644 --- a/Build/source/texk/dvipdfm-x/src/truetype.c +++ b/Build/source/texk/dvipdfm-x/src/truetype.c @@ -123,7 +123,7 @@ pdf_font_open_truetype (pdf_font *font) { pdf_obj *tmp; - tmp = tt_get_fontdesc(sfont, &embedding, -1, 1); + tmp = tt_get_fontdesc(sfont, &embedding, -1, 1, NULL); if (!tmp) { ERROR("Could not obtain necessary font info."); sfnt_close(sfont); diff --git a/Build/source/texk/dvipdfm-x/src/tt_aux.c b/Build/source/texk/dvipdfm-x/src/tt_aux.c index 09e92efefe3..ccbf4fd2528 100644 --- a/Build/source/texk/dvipdfm-x/src/tt_aux.c +++ b/Build/source/texk/dvipdfm-x/src/tt_aux.c @@ -40,7 +40,13 @@ ULONG ttc_read_offset (sfnt *sfont, int ttc_idx) { ULONG offset = 0, num_dirs = 0; - if (sfont == NULL || sfont->stream == NULL) + if (sfont == NULL || +#ifdef XETEX + sfont->ft_face == NULL +#else + sfont->stream == NULL +#endif + ) ERROR("file not opened"); if (sfont->type != SFNT_TYPE_TTC) @@ -128,7 +134,7 @@ ULONG ttc_read_offset (sfnt *sfont, int ttc_idx) #define ALLCAP (1 << 16) /* All-cap font */ #define SMALLCAP (1 << 17) /* Small-cap font */ #define FORCEBOLD (1 << 18) /* Force bold at small text sizes */ -pdf_obj *tt_get_fontdesc (sfnt *sfont, int *embed, int stemv, int type) +pdf_obj *tt_get_fontdesc (sfnt *sfont, int *embed, int stemv, int type, const char* fontname) { pdf_obj *descriptor = NULL; pdf_obj *bbox = NULL; @@ -263,7 +269,8 @@ pdf_obj *tt_get_fontdesc (sfnt *sfont, int *embed, int stemv, int type) } RELEASE(head); - RELEASE(os2); + if (os2) + RELEASE(os2); tt_release_post_table(post); return descriptor; diff --git a/Build/source/texk/dvipdfm-x/src/tt_aux.h b/Build/source/texk/dvipdfm-x/src/tt_aux.h index fafef4e196a..5f8cc5f03a0 100644 --- a/Build/source/texk/dvipdfm-x/src/tt_aux.h +++ b/Build/source/texk/dvipdfm-x/src/tt_aux.h @@ -30,6 +30,6 @@ extern ULONG ttc_read_offset (sfnt *sfont, int ttc_idx); /* FontDescriptor */ -extern pdf_obj *tt_get_fontdesc (sfnt *sfont, int *embed, int stemv, int type); +extern pdf_obj *tt_get_fontdesc (sfnt *sfont, int *embed, int stemv, int type, const char* fontname); #endif /* _TT_AUX_H_ */ diff --git a/Build/source/texk/dvipdfm-x/src/tt_glyf.c b/Build/source/texk/dvipdfm-x/src/tt_glyf.c deleted file mode 100644 index c01b7309a68..00000000000 --- a/Build/source/texk/dvipdfm-x/src/tt_glyf.c +++ /dev/null @@ -1,670 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -/* - * Subsetting glyf, updating loca, hmtx, ... - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "sfnt.h" -#include "tt_table.h" -#include "tt_glyf.h" - -#define NUM_GLYPH_LIMIT 65534 -#define TABLE_DATA_ALLOC_SIZE 40960 -#define GLYPH_ARRAY_ALLOC_SIZE 256 - -static USHORT -find_empty_slot (struct tt_glyphs *g) -{ - USHORT gid; - - ASSERT(g); - - for (gid = 0; gid < NUM_GLYPH_LIMIT; gid++) { - if (!(g->used_slot[gid/8] & (1 << (7 - (gid % 8))))) - break; - } - if (gid == NUM_GLYPH_LIMIT) - ERROR("No empty glyph slot available."); - - return gid; -} - -USHORT -tt_find_glyph (struct tt_glyphs *g, USHORT gid) -{ - USHORT idx, new_gid = 0; - - ASSERT(g); - - for (idx = 0; idx < g->num_glyphs; idx++) { - if (gid == g->gd[idx].ogid) { - new_gid = g->gd[idx].gid; - break; - } - } - - return new_gid; -} - -USHORT -tt_get_index (struct tt_glyphs *g, USHORT gid) -{ - USHORT idx; - - ASSERT(g); - - for (idx = 0; idx < g->num_glyphs; idx++) { - if (gid == g->gd[idx].gid) - break; - } - if (idx == g->num_glyphs) - idx = 0; - - return idx; -} - -USHORT -tt_add_glyph (struct tt_glyphs *g, USHORT gid, USHORT new_gid) -{ - ASSERT(g); - - if (g->used_slot[new_gid/8] & (1 << (7 - (new_gid % 8)))) { - WARN("Slot %u already used.", new_gid); - } else { - if (g->num_glyphs+1 >= NUM_GLYPH_LIMIT) - ERROR("Too many glyphs."); - - if (g->num_glyphs >= g->max_glyphs) { - g->max_glyphs += GLYPH_ARRAY_ALLOC_SIZE; - g->gd = RENEW(g->gd, g->max_glyphs, struct tt_glyph_desc); - } - g->gd[g->num_glyphs].gid = new_gid; - g->gd[g->num_glyphs].ogid = gid; - g->gd[g->num_glyphs].length = 0; - g->gd[g->num_glyphs].data = NULL; - g->used_slot[new_gid/8] |= (1 << (7 - (new_gid % 8))); - g->num_glyphs += 1; - } - - if (new_gid > g->last_gid) { - g->last_gid = new_gid; - } - - return new_gid; -} - -/* - * Initialization - */ -struct tt_glyphs * -tt_build_init (void) -{ - struct tt_glyphs *g; - - g = NEW(1, struct tt_glyphs); - - g->num_glyphs = 0; - g->max_glyphs = 0; - g->last_gid = 0; - g->emsize = 1; - g->default_advh = 0; - g->default_tsb = 0; - g->gd = NULL; - g->used_slot = NEW(8192, unsigned char); - memset(g->used_slot, 0, 8192); - tt_add_glyph(g, 0, 0); - - return g; -} - -void -tt_build_finish (struct tt_glyphs *g) -{ - if (g) { - if (g->gd) { - USHORT idx; - for (idx = 0; idx < g->num_glyphs; idx++) { - if (g->gd[idx].data) - RELEASE(g->gd[idx].data); - } - RELEASE(g->gd); - } - if (g->used_slot) - RELEASE(g->used_slot); - RELEASE(g); - } -} - -static int CDECL -glyf_cmp (const void *v1, const void *v2) -{ - int cmp = 0; - const struct tt_glyph_desc *sv1, *sv2; - - sv1 = (const struct tt_glyph_desc *) v1; - sv2 = (const struct tt_glyph_desc *) v2; - - if (sv1->gid == sv2->gid) - cmp = 0; - else if (sv1->gid < sv2->gid) - cmp = -1; - else - cmp = 1; - - return cmp; -} - -/* - * TrueType outline data. - */ -#define ARG_1_AND_2_ARE_WORDS (1 << 0) -#define ARGS_ARE_XY_VALUES (1 << 1) -#define ROUND_XY_TO_GRID (1 << 2) -#define WE_HAVE_A_SCALE (1 << 3) -#define RESERVED (1 << 4) -#define MORE_COMPONENT (1 << 5) -#define WE_HAVE_AN_X_AND_Y_SCALE (1 << 6) -#define WE_HAVE_A_TWO_BY_TWO (1 << 7) -#define WE_HAVE_INSTRUCTIONS (1 << 8) -#define USE_MY_METRICS (1 << 9) - -int -tt_build_tables (sfnt *sfont, struct tt_glyphs *g) -{ - char *hmtx_table_data = NULL, *loca_table_data = NULL; - char *glyf_table_data = NULL; - ULONG hmtx_table_size, loca_table_size, glyf_table_size; - /* some information available from other TrueType table */ - struct tt_head_table *head = NULL; - struct tt_hhea_table *hhea = NULL; - struct tt_maxp_table *maxp = NULL; - struct tt_longMetrics *hmtx, *vmtx = NULL; - struct tt_os2__table *os2; - /* temp */ - ULONG *location, offset; - long i; - USHORT *w_stat; /* Estimate most frequently appeared width */ - - ASSERT(g); - - if (sfont == NULL || -#ifdef XETEX - sfont->ft_face == NULL -#else - sfont->stream == NULL -#endif - ) - ERROR("File not opened."); - - if (sfont->type != SFNT_TYPE_TRUETYPE && - sfont->type != SFNT_TYPE_TTC && - sfont->type != SFNT_TYPE_DFONT) - ERROR("Invalid font type"); - - if (g->num_glyphs > NUM_GLYPH_LIMIT) - ERROR("Too many glyphs."); - - /* - * Read head, hhea, maxp, loca: - * - * unitsPerEm --> head - * numHMetrics --> hhea - * indexToLocFormat --> head - * numGlyphs --> maxp - */ - head = tt_read_head_table(sfont); - hhea = tt_read_hhea_table(sfont); - maxp = tt_read_maxp_table(sfont); - - if (hhea->metricDataFormat != 0) - ERROR("Unknown metricDataFormat."); - - g->emsize = head->unitsPerEm; - - sfnt_locate_table(sfont, "hmtx"); - hmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, hhea->numOfLongHorMetrics, hhea->numOfExSideBearings); - - os2 = tt_read_os2__table(sfont); - g->default_advh = os2->sTypoAscender - os2->sTypoDescender; - g->default_tsb = g->default_advh - os2->sTypoAscender; - - if (sfnt_find_table_pos(sfont, "vmtx") > 0) { - struct tt_vhea_table *vhea; - vhea = tt_read_vhea_table(sfont); - sfnt_locate_table(sfont, "vmtx"); - vmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, vhea->numOfLongVerMetrics, vhea->numOfExSideBearings); - RELEASE(vhea); - } else { - vmtx = NULL; - } - - sfnt_locate_table(sfont, "loca"); - location = NEW(maxp->numGlyphs + 1, ULONG); - if (head->indexToLocFormat == 0) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = 2*((ULONG) sfnt_get_ushort(sfont)); - } else if (head->indexToLocFormat == 1) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = sfnt_get_ulong(sfont); - } else { - ERROR("Unknown IndexToLocFormat."); - } - - w_stat = NEW(g->emsize+2, USHORT); - memset(w_stat, 0, sizeof(USHORT)*(g->emsize+2)); - /* - * Read glyf table. - */ - offset = sfnt_locate_table(sfont, "glyf"); - /* - * The num_glyphs may grow when composite glyph is found. - * A component of glyph refered by a composite glyph is appended - * to used_glyphs if it is not already registered in used_glyphs. - * Glyph programs of composite glyphs are modified so that it - * correctly refer to new gid of their components. - */ - for (i = 0; i < NUM_GLYPH_LIMIT; i++) { - USHORT gid; /* old gid */ - ULONG loc, len; - BYTE *p, *endptr; - SHORT number_of_contours; - - if (i >= g->num_glyphs) /* finished */ - break; - - gid = g->gd[i].ogid; - if (gid >= maxp->numGlyphs) - ERROR("Invalid glyph index (gid %u)", gid); - - loc = location[gid]; - len = location[gid+1] - loc; - g->gd[i].advw = hmtx[gid].advance; - g->gd[i].lsb = hmtx[gid].sideBearing; - if (vmtx) { - g->gd[i].advh = vmtx[gid].advance; - g->gd[i].tsb = vmtx[gid].sideBearing; - } else { - g->gd[i].advh = g->default_advh; - g->gd[i].tsb = g->default_tsb; - } - g->gd[i].length = len; - g->gd[i].data = NULL; - if (g->gd[i].advw <= g->emsize) { - w_stat[g->gd[i].advw] += 1; - } else { - w_stat[g->emsize+1] += 1; /* larger than em */ - } - - if (len == 0) { /* Does not contains any data. */ - continue; - } else if (len < 10) { - ERROR("Invalid TrueType glyph data (gid %u).", gid); - } - - g->gd[i].data = p = NEW(len, BYTE); - endptr = p + len; - - sfnt_seek_set(sfont, offset+loc); - number_of_contours = sfnt_get_short(sfont); - p += sfnt_put_short(p, number_of_contours); - - /* BoundingBox: FWord x 4 */ - g->gd[i].llx = sfnt_get_short(sfont); - g->gd[i].lly = sfnt_get_short(sfont); - g->gd[i].urx = sfnt_get_short(sfont); - g->gd[i].ury = sfnt_get_short(sfont); - /* _FIXME_ */ -#if 1 - if (!vmtx) /* vertOriginY == sTypeAscender */ - g->gd[i].tsb = g->default_advh - g->default_tsb - g->gd[i].ury; -#endif - p += sfnt_put_short(p, g->gd[i].llx); - p += sfnt_put_short(p, g->gd[i].lly); - p += sfnt_put_short(p, g->gd[i].urx); - p += sfnt_put_short(p, g->gd[i].ury); - - /* Read evrything else. */ - sfnt_read(p, len - 10, sfont); - /* - * Fix GIDs of composite glyphs. - */ - if (number_of_contours < 0) { - USHORT flags, cgid, new_gid; /* flag, gid of a component */ - do { - if (p >= endptr) - ERROR("Invalid TrueType glyph data (gid %u): %u bytes", gid, len); - /* - * Flags and gid of component glyph are both USHORT. - */ - flags = ((*p) << 8)| *(p+1); - p += 2; - cgid = ((*p) << 8)| *(p+1); - if (cgid >= maxp->numGlyphs) { - ERROR("Invalid gid (%u > %u) in composite glyph %u.", cgid, maxp->numGlyphs, gid); - } - new_gid = tt_find_glyph(g, cgid); - if (new_gid == 0) { - new_gid = tt_add_glyph(g, cgid, find_empty_slot(g)); - } - p += sfnt_put_ushort(p, new_gid); - /* - * Just skip remaining part. - */ - p += (flags & ARG_1_AND_2_ARE_WORDS) ? 4 : 2; - if (flags & WE_HAVE_A_SCALE) /* F2Dot14 */ - p += 2; - else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) /* F2Dot14 x 2 */ - p += 4; - else if (flags & WE_HAVE_A_TWO_BY_TWO) /* F2Dot14 x 4 */ - p += 8; - } while (flags & MORE_COMPONENT); - /* - * TrueType instructions comes here: - * length_of_instruction (ushort) - * instruction (byte * length_of_instruction) - */ - } - } - RELEASE(location); - RELEASE(hmtx); - if (vmtx) - RELEASE(vmtx); - - { - int max_count = -1; - - g->dw = g->gd[0].advw; - for (i = 0; i < g->emsize + 1; i++) { - if (w_stat[i] > max_count) { - max_count = w_stat[i]; - g->dw = i; - } - } - } - RELEASE(w_stat); - - qsort(g->gd, g->num_glyphs, sizeof(struct tt_glyph_desc), glyf_cmp); - { - USHORT prev, last_advw; - char *p, *q; - int padlen, num_hm_known; - - glyf_table_size = 0UL; - num_hm_known = 0; - last_advw = g->gd[g->num_glyphs - 1].advw; - for (i = g->num_glyphs - 1; i >= 0; i--) { - padlen = (g->gd[i].length % 4) ? (4 - (g->gd[i].length % 4)) : 0; - glyf_table_size += g->gd[i].length + padlen; - if (!num_hm_known && last_advw != g->gd[i].advw) { - hhea->numOfLongHorMetrics = g->gd[i].gid + 2; - num_hm_known = 1; - } - } - /* All advance widths are same. */ - if (!num_hm_known) { - hhea->numOfLongHorMetrics = 1; - } - hmtx_table_size = hhea->numOfLongHorMetrics * 2 + (g->last_gid + 1) * 2; - - /* - * Choosing short format does not always give good result - * when compressed. Sometimes increases size. - */ - if (glyf_table_size < 0x20000UL) { - head->indexToLocFormat = 0; - loca_table_size = (g->last_gid + 2)*2; - } else { - head->indexToLocFormat = 1; - loca_table_size = (g->last_gid + 2)*4; - } - - hmtx_table_data = p = NEW(hmtx_table_size, char); - loca_table_data = q = NEW(loca_table_size, char); - glyf_table_data = NEW(glyf_table_size, char); - - offset = 0UL; prev = 0; - for (i = 0; i < g->num_glyphs; i++) { - long gap, j; - gap = (long) g->gd[i].gid - prev - 1; - for (j = 1; j <= gap; j++) { - if (prev + j == hhea->numOfLongHorMetrics - 1) { - p += sfnt_put_ushort(p, last_advw); - } else if (prev + j < hhea->numOfLongHorMetrics) { - p += sfnt_put_ushort(p, 0); - } - p += sfnt_put_short (p, 0); - if (head->indexToLocFormat == 0) { - q += sfnt_put_ushort(q, (USHORT) (offset/2)); - } else { - q += sfnt_put_ulong(q, offset); - } - } - padlen = (g->gd[i].length % 4) ? (4 - (g->gd[i].length % 4)) : 0; - if (g->gd[i].gid < hhea->numOfLongHorMetrics) { - p += sfnt_put_ushort(p, g->gd[i].advw); - } - p += sfnt_put_short (p, g->gd[i].lsb); - if (head->indexToLocFormat == 0) { - q += sfnt_put_ushort(q, (USHORT) (offset/2)); - } else { - q += sfnt_put_ulong(q, offset); - } - memset(glyf_table_data + offset, 0, g->gd[i].length + padlen); - memcpy(glyf_table_data + offset, g->gd[i].data, g->gd[i].length); - offset += g->gd[i].length + padlen; - prev = g->gd[i].gid; - /* free data here since it consume much memory */ - RELEASE(g->gd[i].data); - g->gd[i].length = 0; g->gd[i].data = NULL; - } - if (head->indexToLocFormat == 0) { - q += sfnt_put_ushort(q, (USHORT) (offset/2)); - } else { - q += sfnt_put_ulong(q, offset); - } - - sfnt_set_table(sfont, "hmtx", (char *) hmtx_table_data, hmtx_table_size); - sfnt_set_table(sfont, "loca", (char *) loca_table_data, loca_table_size); - sfnt_set_table(sfont, "glyf", (char *) glyf_table_data, glyf_table_size); - } - - head->checkSumAdjustment = 0; - maxp->numGlyphs = g->last_gid + 1; - - /* TODO */ - sfnt_set_table(sfont, "maxp", tt_pack_maxp_table(maxp), TT_MAXP_TABLE_SIZE); - sfnt_set_table(sfont, "hhea", tt_pack_hhea_table(hhea), TT_HHEA_TABLE_SIZE); - sfnt_set_table(sfont, "head", tt_pack_head_table(head), TT_HEAD_TABLE_SIZE); - RELEASE(maxp); - RELEASE(hhea); - RELEASE(head); - RELEASE(os2); - - return 0; -} - -int -tt_get_metrics (sfnt *sfont, struct tt_glyphs *g) -{ - struct tt_head_table *head = NULL; - struct tt_hhea_table *hhea = NULL; - struct tt_maxp_table *maxp = NULL; - struct tt_longMetrics *hmtx, *vmtx = NULL; - struct tt_os2__table *os2; - /* temp */ - ULONG *location, offset; - long i; - USHORT *w_stat; - - ASSERT(g); - - if (sfont == NULL || -#ifdef XETEX - sfont->ft_face == NULL -#else - sfont->stream == NULL -#endif - ) - ERROR("File not opened."); - - if (sfont->type != SFNT_TYPE_TRUETYPE && - sfont->type != SFNT_TYPE_TTC && - sfont->type != SFNT_TYPE_DFONT) - ERROR("Invalid font type"); - - /* - * Read head, hhea, maxp, loca: - * - * unitsPerEm --> head - * numHMetrics --> hhea - * indexToLocFormat --> head - * numGlyphs --> maxp - */ - head = tt_read_head_table(sfont); - hhea = tt_read_hhea_table(sfont); - maxp = tt_read_maxp_table(sfont); - - if (hhea->metricDataFormat != 0) - ERROR("Unknown metricDataFormat."); - - g->emsize = head->unitsPerEm; - - sfnt_locate_table(sfont, "hmtx"); - hmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, hhea->numOfLongHorMetrics, hhea->numOfExSideBearings); - - os2 = tt_read_os2__table(sfont); - g->default_advh = os2->sTypoAscender - os2->sTypoDescender; - g->default_tsb = g->default_advh - os2->sTypoAscender; - - if (sfnt_find_table_pos(sfont, "vmtx") > 0) { - struct tt_vhea_table *vhea; - vhea = tt_read_vhea_table(sfont); - sfnt_locate_table(sfont, "vmtx"); - vmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, vhea->numOfLongVerMetrics, vhea->numOfExSideBearings); - RELEASE(vhea); - } else { - vmtx = NULL; - } - - sfnt_locate_table(sfont, "loca"); - location = NEW(maxp->numGlyphs + 1, ULONG); - if (head->indexToLocFormat == 0) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = 2*((ULONG) sfnt_get_ushort(sfont)); - } else if (head->indexToLocFormat == 1) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = sfnt_get_ulong(sfont); - } else { - ERROR("Unknown IndexToLocFormat."); - } - - w_stat = NEW(g->emsize+2, USHORT); - memset(w_stat, 0, sizeof(USHORT)*(g->emsize+2)); - /* - * Read glyf table. - */ - offset = sfnt_locate_table(sfont, "glyf"); - for (i = 0; i < g->num_glyphs; i++) { - USHORT gid; /* old gid */ - ULONG loc, len; - - gid = g->gd[i].ogid; - if (gid >= maxp->numGlyphs) - ERROR("Invalid glyph index (gid %u)", gid); - - loc = location[gid]; - len = location[gid+1] - loc; - g->gd[i].advw = hmtx[gid].advance; - g->gd[i].lsb = hmtx[gid].sideBearing; - if (vmtx) { - g->gd[i].advh = vmtx[gid].advance; - g->gd[i].tsb = vmtx[gid].sideBearing; - } else { - g->gd[i].advh = g->default_advh; - g->gd[i].tsb = g->default_tsb; - } - g->gd[i].length = len; - g->gd[i].data = NULL; - - if (g->gd[i].advw <= g->emsize) { - w_stat[g->gd[i].advw] += 1; - } else { - w_stat[g->emsize+1] += 1; /* larger than em */ - } - - if (len == 0) { /* Does not contains any data. */ - continue; - } else if (len < 10) { - ERROR("Invalid TrueType glyph data (gid %u).", gid); - } - - sfnt_seek_set(sfont, offset+loc); - (void) sfnt_get_short(sfont); - - /* BoundingBox: FWord x 4 */ - g->gd[i].llx = sfnt_get_short(sfont); - g->gd[i].lly = sfnt_get_short(sfont); - g->gd[i].urx = sfnt_get_short(sfont); - g->gd[i].ury = sfnt_get_short(sfont); - /* _FIXME_ */ -#if 1 - if (!vmtx) /* vertOriginY == sTypeAscender */ - g->gd[i].tsb = g->default_advh - g->default_tsb - g->gd[i].ury; -#endif - } - RELEASE(location); - RELEASE(hmtx); - RELEASE(maxp); - RELEASE(hhea); - RELEASE(head); - RELEASE(os2); - - if (vmtx) - RELEASE(vmtx); - - { - int max_count = -1; - - g->dw = g->gd[0].advw; - for (i = 0; i < g->emsize + 1; i++) { - if (w_stat[i] > max_count) { - max_count = w_stat[i]; - g->dw = i; - } - } - } - RELEASE(w_stat); - - - return 0; -} diff --git a/Build/source/texk/dvipdfm-x/src/type0.c b/Build/source/texk/dvipdfm-x/src/type0.c deleted file mode 100644 index b2b95898649..00000000000 --- a/Build/source/texk/dvipdfm-x/src/type0.c +++ /dev/null @@ -1,677 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -/* - * Type0 font support: - * - * TODO: - * - * Composite font (multiple descendants) - not supported in PDF - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxfile.h" - -#include "pdfobj.h" -#include "fontmap.h" - -#include "cmap.h" -#include "cid.h" - -#include "type0.h" - - -#define TYPE0FONT_DEBUG_STR "Type0" -#define TYPE0FONT_DEBUG 3 - -static int __verbose = 0; - -static pdf_obj *pdf_read_ToUnicode_file (const char *cmap_name); - -void -Type0Font_set_verbose(void) -{ - __verbose++; -} - -/* - * used_chars: - * - * Single bit is used for each CIDs since used_chars can be reused as a - * stream content of CIDSet by doing so. See, cid.h for add_to_used() and - * is_used(). - */ - -static char * -new_used_chars2(void) -{ - char *used_chars; - - used_chars = NEW(8192, char); - memset(used_chars, 0, 8192); - - return used_chars; -} - -#define FLAG_NONE 0 -#define FLAG_USED_CHARS_SHARED (1 << 0) - -struct Type0Font { - char *fontname; /* BaseFont */ - char *encoding; /* "Identity-H" or "Identity-V" (not ID) */ - char *used_chars; /* Used chars (CIDs) */ - - /* - * Type0 only - */ - CIDFont *descendant; /* Only single descendant is allowed. */ - int flags; - int wmode; - - /* - * PDF Font Resource - */ - pdf_obj *indirect; - pdf_obj *fontdict; - pdf_obj *descriptor; /* MUST BE NULL */ -}; - -static void -Type0Font_init_font_struct (Type0Font *font) -{ - ASSERT(font); - - font->fontname = NULL; - font->fontdict = NULL; - font->indirect = NULL; - font->descriptor = NULL; - font->encoding = NULL; - font->used_chars = NULL; - font->descendant = NULL; - font->wmode = -1; - font->flags = FLAG_NONE; - - return; -} - -static void -Type0Font_clean (Type0Font *font) -{ - if (font) { - if (font->fontdict) - ERROR("%s: Object not flushed.", TYPE0FONT_DEBUG_STR); - if (font->indirect) - ERROR("%s: Object not flushed.", TYPE0FONT_DEBUG_STR); - if (font->descriptor) - ERROR("%s: FontDescriptor unexpected for Type0 font.", TYPE0FONT_DEBUG_STR); - if (!(font->flags & FLAG_USED_CHARS_SHARED) && font->used_chars) - RELEASE(font->used_chars); - if (font->encoding) - RELEASE(font->encoding); - if (font->fontname) - RELEASE(font->fontname); - font->fontdict = NULL; - font->indirect = NULL; - font->descriptor = NULL; - font->used_chars = NULL; - font->encoding = NULL; - font->fontname = NULL; - } -} - -/* PLEASE FIX THIS */ -#include "tt_cmap.h" - -static void -add_ToUnicode (Type0Font *font) -{ - pdf_obj *tounicode; - CIDFont *cidfont; - CIDSysInfo *csi; - char *cmap_name, *fontname; - - /* - * ToUnicode CMap: - * - * ToUnicode CMaps are usually not required for standard character - * collections such as Adobe-Japan1. Identity-H is used for UCS - * ordering CID-keyed fonts. External resource must be loaded for - * others. - */ - - cidfont = font->descendant; - if (!cidfont) { - ERROR("%s: No descendant CID-keyed font.", TYPE0FONT_DEBUG_STR); - return; - } - - if (CIDFont_is_ACCFont(cidfont)) { - /* No need to embed ToUnicode */ - return; - } else if (CIDFont_is_UCSFont(cidfont)) { - /* - * Old version of dvipdfmx mistakenly used Adobe-Identity as Unicode. - */ - tounicode = pdf_read_ToUnicode_file("Adobe-Identity-UCS2"); - if (!tounicode) { /* This should work */ - tounicode = pdf_new_name("Identity-H"); - } - pdf_add_dict(font->fontdict, pdf_new_name("ToUnicode"), tounicode); - return; - } - - tounicode = NULL; - csi = CIDFont_get_CIDSysInfo(cidfont); - fontname = CIDFont_get_fontname(cidfont); - if (CIDFont_get_embedding(cidfont)) { - fontname += 7; /* FIXME */ - } - - if (!strcmp(csi->registry, "Adobe") && - !strcmp(csi->ordering, "Identity")) { - switch (CIDFont_get_subtype(cidfont)) { - case CIDFONT_TYPE2: - /* PLEASE FIX THIS */ - tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont), - CIDFont_get_opt_index(cidfont), - Type0Font_get_usedchars(font)); - break; - default: - if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) { /* FIXME */ - tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont), - CIDFont_get_opt_index(cidfont), - Type0Font_get_usedchars(font)); - } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) { /* FIXME */ - /* Font loader will create ToUnicode and set. */ - return; - } else { - cmap_name = NEW(strlen(fontname) + 7, char); - sprintf(cmap_name, "%s-UTF16", fontname); - tounicode = pdf_read_ToUnicode_file(cmap_name); - if (!tounicode) { - sprintf(cmap_name, "%s-UCS2", fontname); - tounicode = pdf_read_ToUnicode_file(cmap_name); - } - RELEASE(cmap_name); - } - break; - } - } else { - cmap_name = NEW(strlen(csi->registry)+strlen(csi->ordering)+8, char); - sprintf(cmap_name, "%s-%s-UTF16", csi->registry, csi->ordering); - tounicode = pdf_read_ToUnicode_file(cmap_name); - if (!tounicode) { - sprintf(cmap_name, "%s-%s-UCS2", csi->registry, csi->ordering); - tounicode = pdf_read_ToUnicode_file(cmap_name); - } - RELEASE(cmap_name); - } - - if (tounicode) { - pdf_add_dict(font->fontdict, - pdf_new_name("ToUnicode"), tounicode); - } else { - WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname); - } - - return; -} - -void -Type0Font_set_ToUnicode (Type0Font *font, pdf_obj *cmap_ref) -{ - ASSERT(font); - - pdf_add_dict(font->fontdict, - pdf_new_name("ToUnicode"), cmap_ref); -} - -static void -Type0Font_dofont (Type0Font *font) -{ - if (!font || !font->indirect) - return; - - if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) { /* FIXME */ - add_ToUnicode(font); - } -} - -static void -Type0Font_flush (Type0Font *font) -{ - if (font) { - if (font->fontdict) - pdf_release_obj(font->fontdict); - font->fontdict = NULL; - if (font->indirect) - pdf_release_obj(font->indirect); - font->indirect = NULL; - if (font->descriptor) - ERROR("%s: FontDescriptor unexpected for Type0 font.", TYPE0FONT_DEBUG_STR); - font->descriptor = NULL; - } -} - -int -Type0Font_get_wmode (Type0Font *font) -{ - ASSERT(font); - - return font->wmode; -} - -#if 0 -char * -Type0Font_get_encoding (Type0Font *font) -{ - ASSERT(font); - - return font->encoding; -} -#endif - -char * -Type0Font_get_usedchars (Type0Font *font) -{ - ASSERT(font); - - return font->used_chars; -} - -pdf_obj * -Type0Font_get_resource (Type0Font *font) -{ - ASSERT(font); - - /* - * This looks somewhat strange. - */ - if (!font->indirect) { - pdf_obj *array; - - array = pdf_new_array(); - pdf_add_array(array, CIDFont_get_resource(font->descendant)); - pdf_add_dict(font->fontdict, pdf_new_name("DescendantFonts"), array); - font->indirect = pdf_ref_obj(font->fontdict); - } - - return pdf_link_obj(font->indirect); -} - -/******************************** CACHE ********************************/ - -#define CHECK_ID(n) do {\ - if ((n) < 0 || (n) >= __cache.count)\ - ERROR("%s: Invalid ID %d", TYPE0FONT_DEBUG_STR, (n));\ -} while (0) - -#define CACHE_ALLOC_SIZE 16u - -static struct font_cache { - int count; - int capacity; - Type0Font *fonts; -} __cache = { - 0, 0, NULL -}; - -void -Type0Font_cache_init (void) -{ - if (__cache.fonts) - ERROR("%s: Already initialized.", TYPE0FONT_DEBUG_STR); - __cache.count = 0; - __cache.capacity = 0; - __cache.fonts = NULL; -} - -Type0Font * -Type0Font_cache_get (int id) -{ - CHECK_ID(id); - - return &__cache.fonts[id]; -} - -int -Type0Font_cache_find (const char *map_name, int cmap_id, fontmap_opt *fmap_opt) -{ - int font_id = -1; - Type0Font *font; - CIDFont *cidfont; - CMap *cmap; - CIDSysInfo *csi; - char *fontname = NULL; - int cid_id = -1, parent_id = -1, wmode = 0; - int pdf_ver; - - pdf_ver = pdf_get_version(); - if (!map_name || cmap_id < 0 || pdf_ver < 2) - return -1; - - /* - * Encoding is Identity-H or Identity-V according as thier WMode value. - * - * We do not use match against the map_name since fonts (TrueType) covers - * characters across multiple character collection (eg, Adobe-Japan1 and - * Adobe-Japan2) must be splited into multiple CID-keyed fonts. - */ - - cmap = CMap_cache_get(cmap_id); - csi = (CMap_is_Identity(cmap)) ? NULL : CMap_get_CIDSysInfo(cmap) ; - - cid_id = CIDFont_cache_find(map_name, csi, fmap_opt); - - if (cid_id < 0) - return -1; - - /* - * The descendant CID-keyed font has already been registerd. - * If CID-keyed font with ID = cid_id is new font, then create new parent - * Type 0 font. Otherwise, there already exists parent Type 0 font and - * then we find him and return his ID. We must check against their WMode. - */ - - cidfont = CIDFont_cache_get(cid_id); - wmode = CMap_get_wmode(cmap); - - /* Does CID-keyed font already have parent ? */ - parent_id = CIDFont_get_parent_id(cidfont, wmode); - if (parent_id >= 0) - return parent_id; /* If so, we don't need new one. */ - - /* - * CIDFont does not have parent or his parent's WMode does not matched with - * wmode. Create new Type0 font. - */ - - if (__cache.count >= __cache.capacity) { - __cache.capacity += CACHE_ALLOC_SIZE; - __cache.fonts = RENEW(__cache.fonts, __cache.capacity, struct Type0Font); - } - font_id = __cache.count; - font = &__cache.fonts[font_id]; - - Type0Font_init_font_struct(font); - - /* - * All CJK double-byte characters are mapped so that resulting - * character codes coincide with CIDs of given character collection. - * So, the Encoding is always Identity-H for horizontal fonts or - * Identity-V for vertical fonts. - */ - if (wmode) { - font->encoding = NEW(strlen("Identity-V")+1, char); - strcpy(font->encoding, "Identity-V"); - } else { - font->encoding = NEW(strlen("Identity-H")+1, char); - strcpy(font->encoding, "Identity-H"); - } - font->wmode = wmode; - - /* - * Now we start font dictionary. - */ - font->fontdict = pdf_new_dict(); - pdf_add_dict(font->fontdict, pdf_new_name ("Type"), pdf_new_name ("Font")); - pdf_add_dict(font->fontdict, pdf_new_name ("Subtype"), pdf_new_name ("Type0")); - - /* - * Type0 font does not have FontDescriptor because it is not a simple font. - * Instead, DescendantFonts appears here. - * - * Up to PDF version 1.5, Type0 font must have single descendant font which - * is a CID-keyed font. Future PDF spec. will allow multiple desecendant - * fonts. - */ - font->descendant = cidfont; - CIDFont_attach_parent(cidfont, font_id, wmode); - - /* - * PostScript Font name: - * - * Type0 font's fontname is usually descendant CID-keyed font's font name - * appended by -ENCODING. - */ - fontname = CIDFont_get_fontname(cidfont); - - if (__verbose) { - if (CIDFont_get_embedding(cidfont) && strlen(fontname) > 7) - MESG("(CID:%s)", fontname+7); /* skip XXXXXX+ */ - else - MESG("(CID:%s)", fontname); - } - - /* - * The difference between CID-keyed font and TrueType font appears here. - * - * Glyph substitution for vertical writing is done in CMap mapping process - * for CID-keyed fonts. But we must rely on OpenType layout table in the - * case of TrueType fonts. So, we must use different used_chars for each - * horizontal and vertical fonts in that case. - * - * In most PDF file, encoding name is not appended to fontname for Type0 - * fonts having CIDFontType 2 font as their descendant. - */ - - font->used_chars = NULL; - font->flags = FLAG_NONE; - - switch (CIDFont_get_subtype(cidfont)) { - case CIDFONT_TYPE0: - font->fontname = NEW(strlen(fontname)+strlen(font->encoding)+2, char); - sprintf(font->fontname, "%s-%s", fontname, font->encoding); - pdf_add_dict(font->fontdict, - pdf_new_name("BaseFont"), pdf_new_name(font->fontname)); - /* - * Need used_chars to write W, W2. - */ - if ((parent_id = CIDFont_get_parent_id(cidfont, wmode ? 0 : 1)) < 0) - font->used_chars = new_used_chars2(); - else { - /* Don't allocate new one. */ - font->used_chars = Type0Font_get_usedchars(Type0Font_cache_get(parent_id)); - font->flags |= FLAG_USED_CHARS_SHARED; - } - break; - case CIDFONT_TYPE2: - /* - * TrueType: - * - * Use different used_chars for H and V. - */ - pdf_add_dict(font->fontdict, - pdf_new_name("BaseFont"), pdf_new_name(fontname)); - font->used_chars = new_used_chars2(); - break; - default: - ERROR("Unrecognized CIDFont Type"); - break; - } - - pdf_add_dict(font->fontdict, - pdf_new_name("Encoding"), pdf_new_name(font->encoding)); - - __cache.count++; - - return font_id; -} - -void -Type0Font_cache_close (void) -{ - int font_id; - - /* - * This need to be fixed. - * - * CIDFont_cache_close() before Type0Font_release because of used_chars. - * ToUnicode support want descendant CIDFont's CSI and fontname. - */ - if (__cache.fonts) { - for (font_id = 0; font_id < __cache.count; font_id++) - Type0Font_dofont(&__cache.fonts[font_id]); - } - CIDFont_cache_close(); - if (__cache.fonts) { - for (font_id = 0; font_id < __cache.count; font_id++) { - Type0Font_flush(&__cache.fonts[font_id]); - Type0Font_clean(&__cache.fonts[font_id]); - } - RELEASE(__cache.fonts); - } - __cache.fonts = NULL; - __cache.count = 0; - __cache.capacity = 0; -} - - -/************************************************************************/ - -int -pdf_font_findfont0 (const char *font_name, int cmap_id, fontmap_opt *fmap_opt) -{ - return Type0Font_cache_find(font_name, cmap_id, fmap_opt); -} - -/******************************** COMPAT ********************************/ - -#ifndef WITHOUT_COMPAT - -#include "cmap_read.h" -#include "cmap_write.h" -#include "pdfresource.h" -#include "pdfencoding.h" - -static pdf_obj * -create_dummy_CMap (void) -{ - pdf_obj *stream; - char buf[32]; - int i, n; - -#define CMAP_PART0 "\ -%!PS-Adobe-3.0 Resource-CMap\n\ -%%DocumentNeededResources: ProcSet (CIDInit)\n\ -%%IncludeResource: ProcSet (CIDInit)\n\ -%%BeginResource: CMap (Adobe-Identity-UCS2)\n\ -%%Title: (Adobe-Identity-UCS2 Adobe UCS2 0)\n\ -%%Version: 1.0\n\ -%%Copyright:\n\ -%% ---\n\ -%%EndComments\n\n\ -" -#define CMAP_PART1 "\ -/CIDInit /ProcSet findresource begin\n\ -\n\ -12 dict begin\n\nbegincmap\n\n\ -/CIDSystemInfo 3 dict dup begin\n\ - /Registry (Adobe) def\n\ - /Ordering (UCS2) def\n\ - /Supplement 0 def\n\ -end def\n\n\ -/CMapName /Adobe-Identity-UCS2 def\n\ -/CMapVersion 1.0 def\n\ -/CMapType 2 def\n\n\ -2 begincodespacerange\n\ -<0000> \n\ -endcodespacerange\n\ -" -#define CMAP_PART3 "\ -endcmap\n\n\ -CMapName currentdict /CMap defineresource pop\n\n\ -end\nend\n\n\ -%%EndResource\n\ -%%EOF\n\ -" - - stream = pdf_new_stream(STREAM_COMPRESS); - pdf_add_stream(stream, CMAP_PART0, strlen(CMAP_PART0)); - pdf_add_stream(stream, CMAP_PART1, strlen(CMAP_PART1)); - pdf_add_stream(stream, "\n100 beginbfrange\n", strlen("\n100 beginbfrange\n")); - for (i = 0; i < 0x64; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); - - pdf_add_stream(stream, "\n100 beginbfrange\n", strlen("\n100 beginbfrange\n")); - for (i = 0x64; i < 0xc8; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); - - pdf_add_stream(stream, "\n48 beginbfrange\n", strlen("\n48 beginbfrange\n")); - for (i = 0xc8; i <= 0xd7; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - for (i = 0xe0; i <= 0xff; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); - - pdf_add_stream(stream, CMAP_PART3, strlen(CMAP_PART3)); - - return stream; -} - -static pdf_obj * -pdf_read_ToUnicode_file (const char *cmap_name) -{ - pdf_obj *stream; - long res_id = -1; - - ASSERT(cmap_name); - - res_id = pdf_findresource("CMap", cmap_name); - if (res_id < 0) { - if (!strcmp(cmap_name, "Adobe-Identity-UCS2")) - stream = create_dummy_CMap(); - else { - stream = pdf_load_ToUnicode_stream(cmap_name); - } - if (stream) { - res_id = pdf_defineresource("CMap", - cmap_name, - stream, PDF_RES_FLUSH_IMMEDIATE); - } - } - - return (res_id < 0 ? NULL : pdf_get_resource_reference(res_id)); -} -#endif /* !WITHOUT_COMPAT */ diff --git a/Build/source/texk/dvipdfm-x/src/type1c.c b/Build/source/texk/dvipdfm-x/src/type1c.c index 1bfbbb18730..89c0866e287 100644 --- a/Build/source/texk/dvipdfm-x/src/type1c.c +++ b/Build/source/texk/dvipdfm-x/src/type1c.c @@ -69,7 +69,10 @@ int pdf_font_open_type1c (pdf_font *font) { - char *ident, *fontname; + char *fontname; +#ifndef XETEX + char *ident; +#endif FILE *fp = NULL; sfnt *sfont; cff_font *cffont; @@ -79,14 +82,23 @@ pdf_font_open_type1c (pdf_font *font) ASSERT(font); - ident = pdf_font_get_ident (font); +#ifndef XETEX + ident = +#endif + pdf_font_get_ident (font); encoding_id = pdf_font_get_encoding(font); +#ifdef XETEX + sfont = sfnt_open(pdf_font_get_ft_face(font), SFNT_TYPE_POSTSCRIPT); + if (!sfont) + return -1; +#else fp = DPXFOPEN(ident, DPX_RES_TYPE_OTFONT); if (!fp) return -1; sfont = sfnt_open(fp); +#endif if (!sfont || sfont->type != SFNT_TYPE_POSTSCRIPT || sfnt_read_table_directory(sfont, 0) < 0) { @@ -138,7 +150,7 @@ pdf_font_open_type1c (pdf_font *font) * Create font descriptor from OpenType tables. * We can also use CFF TOP DICT/Private DICT for this. */ - tmp = tt_get_fontdesc(sfont, &embedding, -1, 1); + tmp = tt_get_fontdesc(sfont, &embedding, -1, 1, NULL); if (!tmp) { ERROR("Could not obtain neccesary font info from OpenType table."); return -1; @@ -277,12 +289,16 @@ pdf_font_load_type1c (pdf_font *font) descriptor = pdf_font_get_descriptor(font); encoding_id = pdf_font_get_encoding (font); +#ifdef XETEX + sfont = sfnt_open(pdf_font_get_ft_face(font), SFNT_TYPE_POSTSCRIPT); +#else fp = DPXFOPEN(ident, DPX_RES_TYPE_OTFONT); if (!fp) { ERROR("Could not open OpenType font: %s", ident); } sfont = sfnt_open(fp); +#endif if (!sfont) { ERROR("Could not open OpenType font: %s", ident); } diff --git a/Build/source/texk/dvipdfm-x/tt_glyf.c b/Build/source/texk/dvipdfm-x/tt_glyf.c new file mode 100644 index 00000000000..da0c3aa2d09 --- /dev/null +++ b/Build/source/texk/dvipdfm-x/tt_glyf.c @@ -0,0 +1,673 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +/* + * Subsetting glyf, updating loca, hmtx, ... + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "system.h" +#include "mem.h" +#include "error.h" +#include "dpxutil.h" + +#include "sfnt.h" +#include "tt_table.h" +#include "tt_glyf.h" + +#define NUM_GLYPH_LIMIT 65534 +#define TABLE_DATA_ALLOC_SIZE 40960 +#define GLYPH_ARRAY_ALLOC_SIZE 256 + +static USHORT +find_empty_slot (struct tt_glyphs *g) +{ + USHORT gid; + + ASSERT(g); + + for (gid = 0; gid < NUM_GLYPH_LIMIT; gid++) { + if (!(g->used_slot[gid/8] & (1 << (7 - (gid % 8))))) + break; + } + if (gid == NUM_GLYPH_LIMIT) + ERROR("No empty glyph slot available."); + + return gid; +} + +USHORT +tt_find_glyph (struct tt_glyphs *g, USHORT gid) +{ + USHORT idx, new_gid = 0; + + ASSERT(g); + + for (idx = 0; idx < g->num_glyphs; idx++) { + if (gid == g->gd[idx].ogid) { + new_gid = g->gd[idx].gid; + break; + } + } + + return new_gid; +} + +USHORT +tt_get_index (struct tt_glyphs *g, USHORT gid) +{ + USHORT idx; + + ASSERT(g); + + for (idx = 0; idx < g->num_glyphs; idx++) { + if (gid == g->gd[idx].gid) + break; + } + if (idx == g->num_glyphs) + idx = 0; + + return idx; +} + +USHORT +tt_add_glyph (struct tt_glyphs *g, USHORT gid, USHORT new_gid) +{ + ASSERT(g); + + if (g->used_slot[new_gid/8] & (1 << (7 - (new_gid % 8)))) { + WARN("Slot %u already used.", new_gid); + } else { + if (g->num_glyphs+1 >= NUM_GLYPH_LIMIT) + ERROR("Too many glyphs."); + + if (g->num_glyphs >= g->max_glyphs) { + g->max_glyphs += GLYPH_ARRAY_ALLOC_SIZE; + g->gd = RENEW(g->gd, g->max_glyphs, struct tt_glyph_desc); + } + g->gd[g->num_glyphs].gid = new_gid; + g->gd[g->num_glyphs].ogid = gid; + g->gd[g->num_glyphs].length = 0; + g->gd[g->num_glyphs].data = NULL; + g->used_slot[new_gid/8] |= (1 << (7 - (new_gid % 8))); + g->num_glyphs += 1; + } + + if (new_gid > g->last_gid) { + g->last_gid = new_gid; + } + + return new_gid; +} + +/* + * Initialization + */ +struct tt_glyphs * +tt_build_init (void) +{ + struct tt_glyphs *g; + + g = NEW(1, struct tt_glyphs); + + g->num_glyphs = 0; + g->max_glyphs = 0; + g->last_gid = 0; + g->emsize = 1; + g->default_advh = 0; + g->default_tsb = 0; + g->gd = NULL; + g->used_slot = NEW(8192, unsigned char); + memset(g->used_slot, 0, 8192); + tt_add_glyph(g, 0, 0); + + return g; +} + +void +tt_build_finish (struct tt_glyphs *g) +{ + if (g) { + if (g->gd) { + USHORT idx; + for (idx = 0; idx < g->num_glyphs; idx++) { + if (g->gd[idx].data) + RELEASE(g->gd[idx].data); + } + RELEASE(g->gd); + } + if (g->used_slot) + RELEASE(g->used_slot); + RELEASE(g); + } +} + +static int CDECL +glyf_cmp (const void *v1, const void *v2) +{ + int cmp = 0; + const struct tt_glyph_desc *sv1, *sv2; + + sv1 = (const struct tt_glyph_desc *) v1; + sv2 = (const struct tt_glyph_desc *) v2; + + if (sv1->gid == sv2->gid) + cmp = 0; + else if (sv1->gid < sv2->gid) + cmp = -1; + else + cmp = 1; + + return cmp; +} + +/* + * TrueType outline data. + */ +#define ARG_1_AND_2_ARE_WORDS (1 << 0) +#define ARGS_ARE_XY_VALUES (1 << 1) +#define ROUND_XY_TO_GRID (1 << 2) +#define WE_HAVE_A_SCALE (1 << 3) +#define RESERVED (1 << 4) +#define MORE_COMPONENT (1 << 5) +#define WE_HAVE_AN_X_AND_Y_SCALE (1 << 6) +#define WE_HAVE_A_TWO_BY_TWO (1 << 7) +#define WE_HAVE_INSTRUCTIONS (1 << 8) +#define USE_MY_METRICS (1 << 9) + +int +tt_build_tables (sfnt *sfont, struct tt_glyphs *g) +{ + char *hmtx_table_data = NULL, *loca_table_data = NULL; + char *glyf_table_data = NULL; + ULONG hmtx_table_size, loca_table_size, glyf_table_size; + /* some information available from other TrueType table */ + struct tt_head_table *head = NULL; + struct tt_hhea_table *hhea = NULL; + struct tt_maxp_table *maxp = NULL; + struct tt_longMetrics *hmtx, *vmtx = NULL; + struct tt_os2__table *os2; + /* temp */ + ULONG *location, offset; + long i; + USHORT *w_stat; /* Estimate most frequently appeared width */ + + ASSERT(g); + + if (sfont == NULL || +#ifdef XETEX + sfont->ft_face == NULL +#else + sfont->stream == NULL +#endif + ) + ERROR("File not opened."); + + if (sfont->type != SFNT_TYPE_TRUETYPE && + sfont->type != SFNT_TYPE_TTC && + sfont->type != SFNT_TYPE_DFONT) + ERROR("Invalid font type"); + + if (g->num_glyphs > NUM_GLYPH_LIMIT) + ERROR("Too many glyphs."); + + /* + * Read head, hhea, maxp, loca: + * + * unitsPerEm --> head + * numHMetrics --> hhea + * indexToLocFormat --> head + * numGlyphs --> maxp + */ + head = tt_read_head_table(sfont); + hhea = tt_read_hhea_table(sfont); + maxp = tt_read_maxp_table(sfont); + + if (hhea->metricDataFormat != 0) + ERROR("Unknown metricDataFormat."); + + g->emsize = head->unitsPerEm; + + sfnt_locate_table(sfont, "hmtx"); + hmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, hhea->numOfLongHorMetrics, hhea->numOfExSideBearings); + + os2 = tt_read_os2__table(sfont); + if (os2) { + g->default_advh = os2->sTypoAscender - os2->sTypoDescender; + g->default_tsb = g->default_advh - os2->sTypoAscender; + } + + if (sfnt_find_table_pos(sfont, "vmtx") > 0) { + struct tt_vhea_table *vhea; + vhea = tt_read_vhea_table(sfont); + sfnt_locate_table(sfont, "vmtx"); + vmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, vhea->numOfLongVerMetrics, vhea->numOfExSideBearings); + RELEASE(vhea); + } else { + vmtx = NULL; + } + + sfnt_locate_table(sfont, "loca"); + location = NEW(maxp->numGlyphs + 1, ULONG); + if (head->indexToLocFormat == 0) { + for (i = 0; i <= maxp->numGlyphs; i++) + location[i] = 2*((ULONG) sfnt_get_ushort(sfont)); + } else if (head->indexToLocFormat == 1) { + for (i = 0; i <= maxp->numGlyphs; i++) + location[i] = sfnt_get_ulong(sfont); + } else { + ERROR("Unknown IndexToLocFormat."); + } + + w_stat = NEW(g->emsize+2, USHORT); + memset(w_stat, 0, sizeof(USHORT)*(g->emsize+2)); + /* + * Read glyf table. + */ + offset = sfnt_locate_table(sfont, "glyf"); + /* + * The num_glyphs may grow when composite glyph is found. + * A component of glyph refered by a composite glyph is appended + * to used_glyphs if it is not already registered in used_glyphs. + * Glyph programs of composite glyphs are modified so that it + * correctly refer to new gid of their components. + */ + for (i = 0; i < NUM_GLYPH_LIMIT; i++) { + USHORT gid; /* old gid */ + ULONG loc, len; + BYTE *p, *endptr; + SHORT number_of_contours; + + if (i >= g->num_glyphs) /* finished */ + break; + + gid = g->gd[i].ogid; + if (gid >= maxp->numGlyphs) + ERROR("Invalid glyph index (gid %u)", gid); + + loc = location[gid]; + len = location[gid+1] - loc; + g->gd[i].advw = hmtx[gid].advance; + g->gd[i].lsb = hmtx[gid].sideBearing; + if (vmtx) { + g->gd[i].advh = vmtx[gid].advance; + g->gd[i].tsb = vmtx[gid].sideBearing; + } else { + g->gd[i].advh = g->default_advh; + g->gd[i].tsb = g->default_tsb; + } + g->gd[i].length = len; + g->gd[i].data = NULL; + if (g->gd[i].advw <= g->emsize) { + w_stat[g->gd[i].advw] += 1; + } else { + w_stat[g->emsize+1] += 1; /* larger than em */ + } + + if (len == 0) { /* Does not contains any data. */ + continue; + } else if (len < 10) { + ERROR("Invalid TrueType glyph data (gid %u).", gid); + } + + g->gd[i].data = p = NEW(len, BYTE); + endptr = p + len; + + sfnt_seek_set(sfont, offset+loc); + number_of_contours = sfnt_get_short(sfont); + p += sfnt_put_short(p, number_of_contours); + + /* BoundingBox: FWord x 4 */ + g->gd[i].llx = sfnt_get_short(sfont); + g->gd[i].lly = sfnt_get_short(sfont); + g->gd[i].urx = sfnt_get_short(sfont); + g->gd[i].ury = sfnt_get_short(sfont); + /* _FIXME_ */ +#if 1 + if (!vmtx) /* vertOriginY == sTypeAscender */ + g->gd[i].tsb = g->default_advh - g->default_tsb - g->gd[i].ury; +#endif + p += sfnt_put_short(p, g->gd[i].llx); + p += sfnt_put_short(p, g->gd[i].lly); + p += sfnt_put_short(p, g->gd[i].urx); + p += sfnt_put_short(p, g->gd[i].ury); + + /* Read evrything else. */ + sfnt_read(p, len - 10, sfont); + /* + * Fix GIDs of composite glyphs. + */ + if (number_of_contours < 0) { + USHORT flags, cgid, new_gid; /* flag, gid of a component */ + do { + if (p >= endptr) + ERROR("Invalid TrueType glyph data (gid %u): %u bytes", gid, len); + /* + * Flags and gid of component glyph are both USHORT. + */ + flags = ((*p) << 8)| *(p+1); + p += 2; + cgid = ((*p) << 8)| *(p+1); + if (cgid >= maxp->numGlyphs) { + ERROR("Invalid gid (%u > %u) in composite glyph %u.", cgid, maxp->numGlyphs, gid); + } + new_gid = tt_find_glyph(g, cgid); + if (new_gid == 0) { + new_gid = tt_add_glyph(g, cgid, find_empty_slot(g)); + } + p += sfnt_put_ushort(p, new_gid); + /* + * Just skip remaining part. + */ + p += (flags & ARG_1_AND_2_ARE_WORDS) ? 4 : 2; + if (flags & WE_HAVE_A_SCALE) /* F2Dot14 */ + p += 2; + else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) /* F2Dot14 x 2 */ + p += 4; + else if (flags & WE_HAVE_A_TWO_BY_TWO) /* F2Dot14 x 4 */ + p += 8; + } while (flags & MORE_COMPONENT); + /* + * TrueType instructions comes here: + * length_of_instruction (ushort) + * instruction (byte * length_of_instruction) + */ + } + } + RELEASE(location); + RELEASE(hmtx); + if (vmtx) + RELEASE(vmtx); + + { + int max_count = -1; + + g->dw = g->gd[0].advw; + for (i = 0; i < g->emsize + 1; i++) { + if (w_stat[i] > max_count) { + max_count = w_stat[i]; + g->dw = i; + } + } + } + RELEASE(w_stat); + + qsort(g->gd, g->num_glyphs, sizeof(struct tt_glyph_desc), glyf_cmp); + { + USHORT prev, last_advw; + char *p, *q; + int padlen, num_hm_known; + + glyf_table_size = 0UL; + num_hm_known = 0; + last_advw = g->gd[g->num_glyphs - 1].advw; + for (i = g->num_glyphs - 1; i >= 0; i--) { + padlen = (g->gd[i].length % 4) ? (4 - (g->gd[i].length % 4)) : 0; + glyf_table_size += g->gd[i].length + padlen; + if (!num_hm_known && last_advw != g->gd[i].advw) { + hhea->numOfLongHorMetrics = g->gd[i].gid + 2; + num_hm_known = 1; + } + } + /* All advance widths are same. */ + if (!num_hm_known) { + hhea->numOfLongHorMetrics = 1; + } + hmtx_table_size = hhea->numOfLongHorMetrics * 2 + (g->last_gid + 1) * 2; + + /* + * Choosing short format does not always give good result + * when compressed. Sometimes increases size. + */ + if (glyf_table_size < 0x20000UL) { + head->indexToLocFormat = 0; + loca_table_size = (g->last_gid + 2)*2; + } else { + head->indexToLocFormat = 1; + loca_table_size = (g->last_gid + 2)*4; + } + + hmtx_table_data = p = NEW(hmtx_table_size, char); + loca_table_data = q = NEW(loca_table_size, char); + glyf_table_data = NEW(glyf_table_size, char); + + offset = 0UL; prev = 0; + for (i = 0; i < g->num_glyphs; i++) { + long gap, j; + gap = (long) g->gd[i].gid - prev - 1; + for (j = 1; j <= gap; j++) { + if (prev + j == hhea->numOfLongHorMetrics - 1) { + p += sfnt_put_ushort(p, last_advw); + } else if (prev + j < hhea->numOfLongHorMetrics) { + p += sfnt_put_ushort(p, 0); + } + p += sfnt_put_short (p, 0); + if (head->indexToLocFormat == 0) { + q += sfnt_put_ushort(q, (USHORT) (offset/2)); + } else { + q += sfnt_put_ulong(q, offset); + } + } + padlen = (g->gd[i].length % 4) ? (4 - (g->gd[i].length % 4)) : 0; + if (g->gd[i].gid < hhea->numOfLongHorMetrics) { + p += sfnt_put_ushort(p, g->gd[i].advw); + } + p += sfnt_put_short (p, g->gd[i].lsb); + if (head->indexToLocFormat == 0) { + q += sfnt_put_ushort(q, (USHORT) (offset/2)); + } else { + q += sfnt_put_ulong(q, offset); + } + memset(glyf_table_data + offset, 0, g->gd[i].length + padlen); + memcpy(glyf_table_data + offset, g->gd[i].data, g->gd[i].length); + offset += g->gd[i].length + padlen; + prev = g->gd[i].gid; + /* free data here since it consume much memory */ + RELEASE(g->gd[i].data); + g->gd[i].length = 0; g->gd[i].data = NULL; + } + if (head->indexToLocFormat == 0) { + q += sfnt_put_ushort(q, (USHORT) (offset/2)); + } else { + q += sfnt_put_ulong(q, offset); + } + + sfnt_set_table(sfont, "hmtx", (char *) hmtx_table_data, hmtx_table_size); + sfnt_set_table(sfont, "loca", (char *) loca_table_data, loca_table_size); + sfnt_set_table(sfont, "glyf", (char *) glyf_table_data, glyf_table_size); + } + + head->checkSumAdjustment = 0; + maxp->numGlyphs = g->last_gid + 1; + + /* TODO */ + sfnt_set_table(sfont, "maxp", tt_pack_maxp_table(maxp), TT_MAXP_TABLE_SIZE); + sfnt_set_table(sfont, "hhea", tt_pack_hhea_table(hhea), TT_HHEA_TABLE_SIZE); + sfnt_set_table(sfont, "head", tt_pack_head_table(head), TT_HEAD_TABLE_SIZE); + RELEASE(maxp); + RELEASE(hhea); + RELEASE(head); + if (os2) + RELEASE(os2); + + return 0; +} + +int +tt_get_metrics (sfnt *sfont, struct tt_glyphs *g) +{ + struct tt_head_table *head = NULL; + struct tt_hhea_table *hhea = NULL; + struct tt_maxp_table *maxp = NULL; + struct tt_longMetrics *hmtx, *vmtx = NULL; + struct tt_os2__table *os2; + /* temp */ + ULONG *location, offset; + long i; + USHORT *w_stat; + + ASSERT(g); + + if (sfont == NULL || +#ifdef XETEX + sfont->ft_face == NULL +#else + sfont->stream == NULL +#endif + ) + ERROR("File not opened."); + + if (sfont->type != SFNT_TYPE_TRUETYPE && + sfont->type != SFNT_TYPE_TTC && + sfont->type != SFNT_TYPE_DFONT) + ERROR("Invalid font type"); + + /* + * Read head, hhea, maxp, loca: + * + * unitsPerEm --> head + * numHMetrics --> hhea + * indexToLocFormat --> head + * numGlyphs --> maxp + */ + head = tt_read_head_table(sfont); + hhea = tt_read_hhea_table(sfont); + maxp = tt_read_maxp_table(sfont); + + if (hhea->metricDataFormat != 0) + ERROR("Unknown metricDataFormat."); + + g->emsize = head->unitsPerEm; + + sfnt_locate_table(sfont, "hmtx"); + hmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, hhea->numOfLongHorMetrics, hhea->numOfExSideBearings); + + os2 = tt_read_os2__table(sfont); + g->default_advh = os2->sTypoAscender - os2->sTypoDescender; + g->default_tsb = g->default_advh - os2->sTypoAscender; + + if (sfnt_find_table_pos(sfont, "vmtx") > 0) { + struct tt_vhea_table *vhea; + vhea = tt_read_vhea_table(sfont); + sfnt_locate_table(sfont, "vmtx"); + vmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, vhea->numOfLongVerMetrics, vhea->numOfExSideBearings); + RELEASE(vhea); + } else { + vmtx = NULL; + } + + sfnt_locate_table(sfont, "loca"); + location = NEW(maxp->numGlyphs + 1, ULONG); + if (head->indexToLocFormat == 0) { + for (i = 0; i <= maxp->numGlyphs; i++) + location[i] = 2*((ULONG) sfnt_get_ushort(sfont)); + } else if (head->indexToLocFormat == 1) { + for (i = 0; i <= maxp->numGlyphs; i++) + location[i] = sfnt_get_ulong(sfont); + } else { + ERROR("Unknown IndexToLocFormat."); + } + + w_stat = NEW(g->emsize+2, USHORT); + memset(w_stat, 0, sizeof(USHORT)*(g->emsize+2)); + /* + * Read glyf table. + */ + offset = sfnt_locate_table(sfont, "glyf"); + for (i = 0; i < g->num_glyphs; i++) { + USHORT gid; /* old gid */ + ULONG loc, len; + + gid = g->gd[i].ogid; + if (gid >= maxp->numGlyphs) + ERROR("Invalid glyph index (gid %u)", gid); + + loc = location[gid]; + len = location[gid+1] - loc; + g->gd[i].advw = hmtx[gid].advance; + g->gd[i].lsb = hmtx[gid].sideBearing; + if (vmtx) { + g->gd[i].advh = vmtx[gid].advance; + g->gd[i].tsb = vmtx[gid].sideBearing; + } else { + g->gd[i].advh = g->default_advh; + g->gd[i].tsb = g->default_tsb; + } + g->gd[i].length = len; + g->gd[i].data = NULL; + + if (g->gd[i].advw <= g->emsize) { + w_stat[g->gd[i].advw] += 1; + } else { + w_stat[g->emsize+1] += 1; /* larger than em */ + } + + if (len == 0) { /* Does not contains any data. */ + continue; + } else if (len < 10) { + ERROR("Invalid TrueType glyph data (gid %u).", gid); + } + + sfnt_seek_set(sfont, offset+loc); + (void) sfnt_get_short(sfont); + + /* BoundingBox: FWord x 4 */ + g->gd[i].llx = sfnt_get_short(sfont); + g->gd[i].lly = sfnt_get_short(sfont); + g->gd[i].urx = sfnt_get_short(sfont); + g->gd[i].ury = sfnt_get_short(sfont); + /* _FIXME_ */ +#if 1 + if (!vmtx) /* vertOriginY == sTypeAscender */ + g->gd[i].tsb = g->default_advh - g->default_tsb - g->gd[i].ury; +#endif + } + RELEASE(location); + RELEASE(hmtx); + RELEASE(maxp); + RELEASE(hhea); + RELEASE(head); + RELEASE(os2); + + if (vmtx) + RELEASE(vmtx); + + { + int max_count = -1; + + g->dw = g->gd[0].advw; + for (i = 0; i < g->emsize + 1; i++) { + if (w_stat[i] > max_count) { + max_count = w_stat[i]; + g->dw = i; + } + } + } + RELEASE(w_stat); + + + return 0; +} diff --git a/Build/source/texk/dvipdfm-x/type0.c b/Build/source/texk/dvipdfm-x/type0.c new file mode 100644 index 00000000000..a9069e77ef3 --- /dev/null +++ b/Build/source/texk/dvipdfm-x/type0.c @@ -0,0 +1,691 @@ +/* + + This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. + + Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, + the dvipdfmx project team. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. +*/ + +/* + * Type0 font support: + * + * TODO: + * + * Composite font (multiple descendants) - not supported in PDF + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include + +#include "system.h" +#include "mem.h" +#include "error.h" +#include "dpxfile.h" + +#include "pdfobj.h" +#include "fontmap.h" + +#include "cmap.h" +#include "cid.h" + +#include "type0.h" + + +#define TYPE0FONT_DEBUG_STR "Type0" +#define TYPE0FONT_DEBUG 3 + +static int __verbose = 0; + +static pdf_obj *pdf_read_ToUnicode_file (const char *cmap_name); + +void +Type0Font_set_verbose(void) +{ + __verbose++; +} + +/* + * used_chars: + * + * Single bit is used for each CIDs since used_chars can be reused as a + * stream content of CIDSet by doing so. See, cid.h for add_to_used() and + * is_used(). + */ + +static char * +new_used_chars2(void) +{ + char *used_chars; + + used_chars = NEW(8192, char); + memset(used_chars, 0, 8192); + + return used_chars; +} + +#define FLAG_NONE 0 +#define FLAG_USED_CHARS_SHARED (1 << 0) + +struct Type0Font { + char *fontname; /* BaseFont */ + char *encoding; /* "Identity-H" or "Identity-V" (not ID) */ + char *used_chars; /* Used chars (CIDs) */ + + /* + * Type0 only + */ + CIDFont *descendant; /* Only single descendant is allowed. */ + int flags; + int wmode; + + /* + * PDF Font Resource + */ + pdf_obj *indirect; + pdf_obj *fontdict; + pdf_obj *descriptor; /* MUST BE NULL */ +}; + +static void +Type0Font_init_font_struct (Type0Font *font) +{ + ASSERT(font); + + font->fontname = NULL; + font->fontdict = NULL; + font->indirect = NULL; + font->descriptor = NULL; + font->encoding = NULL; + font->used_chars = NULL; + font->descendant = NULL; + font->wmode = -1; + font->flags = FLAG_NONE; + + return; +} + +static void +Type0Font_clean (Type0Font *font) +{ + if (font) { + if (font->fontdict) + ERROR("%s: Object not flushed.", TYPE0FONT_DEBUG_STR); + if (font->indirect) + ERROR("%s: Object not flushed.", TYPE0FONT_DEBUG_STR); + if (font->descriptor) + ERROR("%s: FontDescriptor unexpected for Type0 font.", TYPE0FONT_DEBUG_STR); + if (!(font->flags & FLAG_USED_CHARS_SHARED) && font->used_chars) + RELEASE(font->used_chars); + if (font->encoding) + RELEASE(font->encoding); + if (font->fontname) + RELEASE(font->fontname); + font->fontdict = NULL; + font->indirect = NULL; + font->descriptor = NULL; + font->used_chars = NULL; + font->encoding = NULL; + font->fontname = NULL; + } +} + +/* PLEASE FIX THIS */ +#include "tt_cmap.h" + +static void +add_ToUnicode (Type0Font *font) +{ + pdf_obj *tounicode; + CIDFont *cidfont; + CIDSysInfo *csi; + char *cmap_name, *fontname; + + /* + * ToUnicode CMap: + * + * ToUnicode CMaps are usually not required for standard character + * collections such as Adobe-Japan1. Identity-H is used for UCS + * ordering CID-keyed fonts. External resource must be loaded for + * others. + */ + + cidfont = font->descendant; + if (!cidfont) { + ERROR("%s: No descendant CID-keyed font.", TYPE0FONT_DEBUG_STR); + return; + } + + if (CIDFont_is_ACCFont(cidfont)) { + /* No need to embed ToUnicode */ + return; + } else if (CIDFont_is_UCSFont(cidfont)) { + /* + * Old version of dvipdfmx mistakenly used Adobe-Identity as Unicode. + */ + tounicode = pdf_read_ToUnicode_file("Adobe-Identity-UCS2"); + if (!tounicode) { /* This should work */ + tounicode = pdf_new_name("Identity-H"); + } + pdf_add_dict(font->fontdict, pdf_new_name("ToUnicode"), tounicode); + return; + } + + tounicode = NULL; + csi = CIDFont_get_CIDSysInfo(cidfont); + fontname = CIDFont_get_fontname(cidfont); + if (CIDFont_get_embedding(cidfont)) { + fontname += 7; /* FIXME */ + } + + if (!strcmp(csi->registry, "Adobe") && + !strcmp(csi->ordering, "Identity")) { + switch (CIDFont_get_subtype(cidfont)) { + case CIDFONT_TYPE2: + /* PLEASE FIX THIS */ + tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont), + CIDFont_get_opt_index(cidfont), +#ifdef XETEX + CIDFont_get_ft_face(cidfont), +#endif + Type0Font_get_usedchars(font)); + break; + default: + if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) { /* FIXME */ + tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont), + CIDFont_get_opt_index(cidfont), +#ifdef XETEX + CIDFont_get_ft_face(cidfont), +#endif + Type0Font_get_usedchars(font)); + } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) { /* FIXME */ + /* Font loader will create ToUnicode and set. */ + return; + } else { + cmap_name = NEW(strlen(fontname) + 7, char); + sprintf(cmap_name, "%s-UTF16", fontname); + tounicode = pdf_read_ToUnicode_file(cmap_name); + if (!tounicode) { + sprintf(cmap_name, "%s-UCS2", fontname); + tounicode = pdf_read_ToUnicode_file(cmap_name); + } + RELEASE(cmap_name); + } + break; + } + } else { + cmap_name = NEW(strlen(csi->registry)+strlen(csi->ordering)+8, char); + sprintf(cmap_name, "%s-%s-UTF16", csi->registry, csi->ordering); + tounicode = pdf_read_ToUnicode_file(cmap_name); + if (!tounicode) { + sprintf(cmap_name, "%s-%s-UCS2", csi->registry, csi->ordering); + tounicode = pdf_read_ToUnicode_file(cmap_name); + } + RELEASE(cmap_name); + } + + if (tounicode) { + pdf_add_dict(font->fontdict, + pdf_new_name("ToUnicode"), tounicode); + } else { + WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname); + } + + return; +} + +void +Type0Font_set_ToUnicode (Type0Font *font, pdf_obj *cmap_ref) +{ + ASSERT(font); + + pdf_add_dict(font->fontdict, + pdf_new_name("ToUnicode"), cmap_ref); +} + +static void +Type0Font_dofont (Type0Font *font) +{ + if (!font || !font->indirect) + return; + + if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) { /* FIXME */ + add_ToUnicode(font); + } +} + +static void +Type0Font_flush (Type0Font *font) +{ + if (font) { + if (font->fontdict) + pdf_release_obj(font->fontdict); + font->fontdict = NULL; + if (font->indirect) + pdf_release_obj(font->indirect); + font->indirect = NULL; + if (font->descriptor) + ERROR("%s: FontDescriptor unexpected for Type0 font.", TYPE0FONT_DEBUG_STR); + font->descriptor = NULL; + } +} + +int +Type0Font_get_wmode (Type0Font *font) +{ + ASSERT(font); + + return font->wmode; +} + +#if 0 +char * +Type0Font_get_encoding (Type0Font *font) +{ + ASSERT(font); + + return font->encoding; +} +#endif + +char * +Type0Font_get_usedchars (Type0Font *font) +{ + ASSERT(font); + + return font->used_chars; +} + +pdf_obj * +Type0Font_get_resource (Type0Font *font) +{ + ASSERT(font); + + /* + * This looks somewhat strange. + */ + if (!font->indirect) { + pdf_obj *array; + + array = pdf_new_array(); + pdf_add_array(array, CIDFont_get_resource(font->descendant)); + pdf_add_dict(font->fontdict, pdf_new_name("DescendantFonts"), array); + font->indirect = pdf_ref_obj(font->fontdict); + } + + return pdf_link_obj(font->indirect); +} + +/******************************** CACHE ********************************/ + +#define CHECK_ID(n) do {\ + if ((n) < 0 || (n) >= __cache.count)\ + ERROR("%s: Invalid ID %d", TYPE0FONT_DEBUG_STR, (n));\ +} while (0) + +#define CACHE_ALLOC_SIZE 16u + +static struct font_cache { + int count; + int capacity; + Type0Font *fonts; +} __cache = { + 0, 0, NULL +}; + +void +Type0Font_cache_init (void) +{ + if (__cache.fonts) + ERROR("%s: Already initialized.", TYPE0FONT_DEBUG_STR); + __cache.count = 0; + __cache.capacity = 0; + __cache.fonts = NULL; +} + +Type0Font * +Type0Font_cache_get (int id) +{ + CHECK_ID(id); + + return &__cache.fonts[id]; +} + +#ifdef XETEX +unsigned short* +Type0Font_get_ft_to_gid(int id) +{ + return CIDFont_get_ft_to_gid(Type0Font_cache_get(id)->descendant); +} +#endif + +int +Type0Font_cache_find (const char *map_name, int cmap_id, fontmap_opt *fmap_opt) +{ + int font_id = -1; + Type0Font *font; + CIDFont *cidfont; + CMap *cmap; + CIDSysInfo *csi; + char *fontname = NULL; + int cid_id = -1, parent_id = -1, wmode = 0; + int pdf_ver; + + pdf_ver = pdf_get_version(); + if (!map_name || cmap_id < 0 || pdf_ver < 2) + return -1; + + /* + * Encoding is Identity-H or Identity-V according as thier WMode value. + * + * We do not use match against the map_name since fonts (TrueType) covers + * characters across multiple character collection (eg, Adobe-Japan1 and + * Adobe-Japan2) must be splited into multiple CID-keyed fonts. + */ + + cmap = CMap_cache_get(cmap_id); + csi = (CMap_is_Identity(cmap)) ? NULL : CMap_get_CIDSysInfo(cmap) ; + + cid_id = CIDFont_cache_find(map_name, csi, fmap_opt); + + if (cid_id < 0) + return -1; + + /* + * The descendant CID-keyed font has already been registerd. + * If CID-keyed font with ID = cid_id is new font, then create new parent + * Type 0 font. Otherwise, there already exists parent Type 0 font and + * then we find him and return his ID. We must check against their WMode. + */ + + cidfont = CIDFont_cache_get(cid_id); + wmode = CMap_get_wmode(cmap); + + /* Does CID-keyed font already have parent ? */ + parent_id = CIDFont_get_parent_id(cidfont, wmode); + if (parent_id >= 0) + return parent_id; /* If so, we don't need new one. */ + + /* + * CIDFont does not have parent or his parent's WMode does not matched with + * wmode. Create new Type0 font. + */ + + if (__cache.count >= __cache.capacity) { + __cache.capacity += CACHE_ALLOC_SIZE; + __cache.fonts = RENEW(__cache.fonts, __cache.capacity, struct Type0Font); + } + font_id = __cache.count; + font = &__cache.fonts[font_id]; + + Type0Font_init_font_struct(font); + + /* + * All CJK double-byte characters are mapped so that resulting + * character codes coincide with CIDs of given character collection. + * So, the Encoding is always Identity-H for horizontal fonts or + * Identity-V for vertical fonts. + */ + if (wmode) { + font->encoding = NEW(strlen("Identity-V")+1, char); + strcpy(font->encoding, "Identity-V"); + } else { + font->encoding = NEW(strlen("Identity-H")+1, char); + strcpy(font->encoding, "Identity-H"); + } + font->wmode = wmode; + + /* + * Now we start font dictionary. + */ + font->fontdict = pdf_new_dict(); + pdf_add_dict(font->fontdict, pdf_new_name ("Type"), pdf_new_name ("Font")); + pdf_add_dict(font->fontdict, pdf_new_name ("Subtype"), pdf_new_name ("Type0")); + + /* + * Type0 font does not have FontDescriptor because it is not a simple font. + * Instead, DescendantFonts appears here. + * + * Up to PDF version 1.5, Type0 font must have single descendant font which + * is a CID-keyed font. Future PDF spec. will allow multiple desecendant + * fonts. + */ + font->descendant = cidfont; + CIDFont_attach_parent(cidfont, font_id, wmode); + + /* + * PostScript Font name: + * + * Type0 font's fontname is usually descendant CID-keyed font's font name + * appended by -ENCODING. + */ + fontname = CIDFont_get_fontname(cidfont); + + if (__verbose) { + if (CIDFont_get_embedding(cidfont) && strlen(fontname) > 7) + MESG("(CID:%s)", fontname+7); /* skip XXXXXX+ */ + else + MESG("(CID:%s)", fontname); + } + + /* + * The difference between CID-keyed font and TrueType font appears here. + * + * Glyph substitution for vertical writing is done in CMap mapping process + * for CID-keyed fonts. But we must rely on OpenType layout table in the + * case of TrueType fonts. So, we must use different used_chars for each + * horizontal and vertical fonts in that case. + * + * In most PDF file, encoding name is not appended to fontname for Type0 + * fonts having CIDFontType 2 font as their descendant. + */ + + font->used_chars = NULL; + font->flags = FLAG_NONE; + + switch (CIDFont_get_subtype(cidfont)) { + case CIDFONT_TYPE0: + font->fontname = NEW(strlen(fontname)+strlen(font->encoding)+2, char); + sprintf(font->fontname, "%s-%s", fontname, font->encoding); + pdf_add_dict(font->fontdict, + pdf_new_name("BaseFont"), pdf_new_name(font->fontname)); + /* + * Need used_chars to write W, W2. + */ + if ((parent_id = CIDFont_get_parent_id(cidfont, wmode ? 0 : 1)) < 0) + font->used_chars = new_used_chars2(); + else { + /* Don't allocate new one. */ + font->used_chars = Type0Font_get_usedchars(Type0Font_cache_get(parent_id)); + font->flags |= FLAG_USED_CHARS_SHARED; + } + break; + case CIDFONT_TYPE2: + /* + * TrueType: + * + * Use different used_chars for H and V. + */ + pdf_add_dict(font->fontdict, + pdf_new_name("BaseFont"), pdf_new_name(fontname)); + font->used_chars = new_used_chars2(); + break; + default: + ERROR("Unrecognized CIDFont Type"); + break; + } + + pdf_add_dict(font->fontdict, + pdf_new_name("Encoding"), pdf_new_name(font->encoding)); + + __cache.count++; + + return font_id; +} + +void +Type0Font_cache_close (void) +{ + int font_id; + + /* + * This need to be fixed. + * + * CIDFont_cache_close() before Type0Font_release because of used_chars. + * ToUnicode support want descendant CIDFont's CSI and fontname. + */ + if (__cache.fonts) { + for (font_id = 0; font_id < __cache.count; font_id++) + Type0Font_dofont(&__cache.fonts[font_id]); + } + CIDFont_cache_close(); + if (__cache.fonts) { + for (font_id = 0; font_id < __cache.count; font_id++) { + Type0Font_flush(&__cache.fonts[font_id]); + Type0Font_clean(&__cache.fonts[font_id]); + } + RELEASE(__cache.fonts); + } + __cache.fonts = NULL; + __cache.count = 0; + __cache.capacity = 0; +} + + +/************************************************************************/ + +int +pdf_font_findfont0 (const char *font_name, int cmap_id, fontmap_opt *fmap_opt) +{ + return Type0Font_cache_find(font_name, cmap_id, fmap_opt); +} + +/******************************** COMPAT ********************************/ + +#ifndef WITHOUT_COMPAT + +#include "cmap_read.h" +#include "cmap_write.h" +#include "pdfresource.h" +#include "pdfencoding.h" + +static pdf_obj * +create_dummy_CMap (void) +{ + pdf_obj *stream; + char buf[32]; + int i, n; + +#define CMAP_PART0 "\ +%!PS-Adobe-3.0 Resource-CMap\n\ +%%DocumentNeededResources: ProcSet (CIDInit)\n\ +%%IncludeResource: ProcSet (CIDInit)\n\ +%%BeginResource: CMap (Adobe-Identity-UCS2)\n\ +%%Title: (Adobe-Identity-UCS2 Adobe UCS2 0)\n\ +%%Version: 1.0\n\ +%%Copyright:\n\ +%% ---\n\ +%%EndComments\n\n\ +" +#define CMAP_PART1 "\ +/CIDInit /ProcSet findresource begin\n\ +\n\ +12 dict begin\n\nbegincmap\n\n\ +/CIDSystemInfo 3 dict dup begin\n\ + /Registry (Adobe) def\n\ + /Ordering (UCS2) def\n\ + /Supplement 0 def\n\ +end def\n\n\ +/CMapName /Adobe-Identity-UCS2 def\n\ +/CMapVersion 1.0 def\n\ +/CMapType 2 def\n\n\ +2 begincodespacerange\n\ +<0000> \n\ +endcodespacerange\n\ +" +#define CMAP_PART3 "\ +endcmap\n\n\ +CMapName currentdict /CMap defineresource pop\n\n\ +end\nend\n\n\ +%%EndResource\n\ +%%EOF\n\ +" + + stream = pdf_new_stream(STREAM_COMPRESS); + pdf_add_stream(stream, CMAP_PART0, strlen(CMAP_PART0)); + pdf_add_stream(stream, CMAP_PART1, strlen(CMAP_PART1)); + pdf_add_stream(stream, "\n100 beginbfrange\n", strlen("\n100 beginbfrange\n")); + for (i = 0; i < 0x64; i++) { + n = sprintf(buf, + "<%02X00> <%02XFF> <%02X00>\n", i, i, i); + pdf_add_stream(stream, buf, n); + } + pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); + + pdf_add_stream(stream, "\n100 beginbfrange\n", strlen("\n100 beginbfrange\n")); + for (i = 0x64; i < 0xc8; i++) { + n = sprintf(buf, + "<%02X00> <%02XFF> <%02X00>\n", i, i, i); + pdf_add_stream(stream, buf, n); + } + pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); + + pdf_add_stream(stream, "\n48 beginbfrange\n", strlen("\n48 beginbfrange\n")); + for (i = 0xc8; i <= 0xd7; i++) { + n = sprintf(buf, + "<%02X00> <%02XFF> <%02X00>\n", i, i, i); + pdf_add_stream(stream, buf, n); + } + for (i = 0xe0; i <= 0xff; i++) { + n = sprintf(buf, + "<%02X00> <%02XFF> <%02X00>\n", i, i, i); + pdf_add_stream(stream, buf, n); + } + pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); + + pdf_add_stream(stream, CMAP_PART3, strlen(CMAP_PART3)); + + return stream; +} + +static pdf_obj * +pdf_read_ToUnicode_file (const char *cmap_name) +{ + pdf_obj *stream; + long res_id = -1; + + ASSERT(cmap_name); + + res_id = pdf_findresource("CMap", cmap_name); + if (res_id < 0) { + if (!strcmp(cmap_name, "Adobe-Identity-UCS2")) + stream = create_dummy_CMap(); + else { + stream = pdf_load_ToUnicode_stream(cmap_name); + } + if (stream) { + res_id = pdf_defineresource("CMap", + cmap_name, + stream, PDF_RES_FLUSH_IMMEDIATE); + } + } + + return (res_id < 0 ? NULL : pdf_get_resource_reference(res_id)); +} +#endif /* !WITHOUT_COMPAT */ diff --git a/Build/source/texk/dvipdfm-x/xsrc/cff.c b/Build/source/texk/dvipdfm-x/xsrc/cff.c index 72db0e07f62..082d3d873e9 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/cff.c +++ b/Build/source/texk/dvipdfm-x/xsrc/cff.c @@ -42,24 +42,34 @@ #define CFF_DEBUG 5 #define CFF_DEBUG_STR "CFF" -static unsigned long get_unsigned (sfnt *sfont, int n) +#ifdef XETEX +#define SFNT_OR_FILE sfnt +#define SFONT_OR_STREAM sfont +#define get_card8(s) sfnt_get_byte((s)) +#define get_card16(s) sfnt_get_ushort((s)) +#else +#define SFNT_OR_FILE FILE +#define SFONT_OR_STREAM stream +#define get_card8(s) get_unsigned_byte((s)) +#define get_card16(s) get_unsigned_pair((s)) +#endif + +static unsigned long get_unsigned (SFNT_OR_FILE *SFONT_OR_STREAM, int n) { unsigned long v = 0; while (n-- > 0) - v = v*0x100u + sfnt_get_byte(sfont); + v = v*0x100u + get_card8(SFONT_OR_STREAM); return v; } #define get_offset(s, n) get_unsigned((s), (n)) -#define get_card8(s) sfnt_get_byte((s)) -#define get_card16(s) sfnt_get_ushort((s)) /* * Read Header, Name INDEX, Top DICT INDEX, and String INDEX. */ -cff_font *cff_open(sfnt *sfont, long offset, int n) +cff_font *cff_open(SFNT_OR_FILE *SFONT_OR_STREAM, long offset, int n) { cff_font *cff; cff_index *idx; @@ -68,7 +78,7 @@ cff_font *cff_open(sfnt *sfont, long offset, int n) cff->fontname = NULL; cff->index = n; - cff->sfont = sfont; + cff->SFONT_OR_STREAM = SFONT_OR_STREAM; cff->offset = offset; cff->filter = 0; /* not used */ cff->flag = 0; @@ -88,10 +98,10 @@ cff_font *cff_open(sfnt *sfont, long offset, int n) cff->_string = NULL; cff_seek_set(cff, 0); - cff->header.major = get_card8(cff->sfont); - cff->header.minor = get_card8(cff->sfont); - cff->header.hdr_size = get_card8(cff->sfont); - cff->header.offsize = get_card8(cff->sfont); + cff->header.major = get_card8(cff->SFONT_OR_STREAM); + cff->header.minor = get_card8(cff->SFONT_OR_STREAM); + cff->header.hdr_size = get_card8(cff->SFONT_OR_STREAM); + cff->header.offsize = get_card8(cff->SFONT_OR_STREAM); if (cff->header.offsize < 1 || cff->header.offsize > 4) ERROR("invalid offsize data"); @@ -150,7 +160,7 @@ cff_font *cff_open(sfnt *sfont, long offset, int n) /* Number of glyphs */ offset = (long) cff_dict_get(cff->topdict, "CharStrings", 0); cff_seek_set(cff, offset); - cff->num_glyphs = get_card16(cff->sfont); + cff->num_glyphs = get_card16(cff->SFONT_OR_STREAM); /* Check for font type */ if (cff_dict_known(cff->topdict, "ROS")) { @@ -229,9 +239,12 @@ cff_close (cff_font *cff) } if (cff->_string) cff_release_index(cff->_string); + #ifdef XETEX - if (cff->ft_to_gid) RELEASE(cff->ft_to_gid); + if (cff->ft_to_gid) + RELEASE(cff->ft_to_gid); #endif + RELEASE(cff); } @@ -304,15 +317,15 @@ cff_get_index_header (cff_font *cff) idx = NEW(1, cff_index); - idx->count = count = get_card16(cff->sfont); + idx->count = count = get_card16(cff->SFONT_OR_STREAM); if (count > 0) { - idx->offsize = get_card8(cff->sfont); + idx->offsize = get_card8(cff->SFONT_OR_STREAM); if (idx->offsize < 1 || idx->offsize > 4) ERROR("invalid offsize data"); idx->offset = NEW(count+1, l_offset); for (i=0;ioffset)[i] = get_offset(cff->sfont, idx->offsize); + (idx->offset)[i] = get_offset(cff->SFONT_OR_STREAM, idx->offsize); } if (idx->offset[0] != 1) @@ -337,15 +350,15 @@ cff_get_index (cff_font *cff) idx = NEW(1, cff_index); - idx->count = count = get_card16(cff->sfont); + idx->count = count = get_card16(cff->SFONT_OR_STREAM); if (count > 0) { - idx->offsize = get_card8(cff->sfont); + idx->offsize = get_card8(cff->SFONT_OR_STREAM); if (idx->offsize < 1 || idx->offsize > 4) ERROR("invalid offsize data"); idx->offset = NEW(count + 1, l_offset); for (i = 0 ; i < count + 1; i++) { - idx->offset[i] = get_offset(cff->sfont, idx->offsize); + idx->offset[i] = get_offset(cff->SFONT_OR_STREAM, idx->offsize); } if (idx->offset[0] != 1) @@ -655,27 +668,27 @@ long cff_read_encoding (cff_font *cff) cff_seek_set(cff, offset); cff->encoding = encoding = NEW(1, cff_encoding); - encoding->format = get_card8(cff->sfont); + encoding->format = get_card8(cff->SFONT_OR_STREAM); length = 1; switch (encoding->format & (~0x80)) { case 0: - encoding->num_entries = get_card8(cff->sfont); + encoding->num_entries = get_card8(cff->SFONT_OR_STREAM); (encoding->data).codes = NEW(encoding->num_entries, card8); for (i=0;i<(encoding->num_entries);i++) { - (encoding->data).codes[i] = get_card8(cff->sfont); + (encoding->data).codes[i] = get_card8(cff->SFONT_OR_STREAM); } length += encoding->num_entries + 1; break; case 1: { cff_range1 *ranges; - encoding->num_entries = get_card8(cff->sfont); + encoding->num_entries = get_card8(cff->SFONT_OR_STREAM); encoding->data.range1 = ranges = NEW(encoding->num_entries, cff_range1); for (i=0;i<(encoding->num_entries);i++) { - ranges[i].first = get_card8(cff->sfont); - ranges[i].n_left = get_card8(cff->sfont); + ranges[i].first = get_card8(cff->SFONT_OR_STREAM); + ranges[i].n_left = get_card8(cff->SFONT_OR_STREAM); } length += (encoding->num_entries) * 2 + 1; } @@ -689,11 +702,11 @@ long cff_read_encoding (cff_font *cff) /* Supplementary data */ if ((encoding->format) & 0x80) { cff_map *map; - encoding->num_supps = get_card8(cff->sfont); + encoding->num_supps = get_card8(cff->SFONT_OR_STREAM); encoding->supp = map = NEW(encoding->num_supps, cff_map); for (i=0;i<(encoding->num_supps);i++) { - map[i].code = get_card8(cff->sfont); - map[i].glyph = get_card16(cff->sfont); /* SID */ + map[i].code = get_card8(cff->SFONT_OR_STREAM); + map[i].glyph = get_card16(cff->SFONT_OR_STREAM); /* SID */ } length += (encoding->num_supps) * 3 + 1; } else { @@ -871,7 +884,7 @@ long cff_read_charsets (cff_font *cff) cff_seek_set(cff, offset); cff->charsets = charset = NEW(1, cff_charsets); - charset->format = get_card8(cff->sfont); + charset->format = get_card8(cff->SFONT_OR_STREAM); charset->num_entries = 0; count = cff->num_glyphs - 1; @@ -884,7 +897,7 @@ long cff_read_charsets (cff_font *cff) charset->data.glyphs = NEW(charset->num_entries, s_SID); length += (charset->num_entries) * 2; for (i=0;i<(charset->num_entries);i++) { - charset->data.glyphs[i] = get_card16(cff->sfont); + charset->data.glyphs[i] = get_card16(cff->SFONT_OR_STREAM); } count = 0; break; @@ -893,8 +906,8 @@ long cff_read_charsets (cff_font *cff) cff_range1 *ranges = NULL; while (count > 0 && charset->num_entries < cff->num_glyphs) { ranges = RENEW(ranges, charset->num_entries + 1, cff_range1); - ranges[charset->num_entries].first = get_card16(cff->sfont); - ranges[charset->num_entries].n_left = get_card8(cff->sfont); + ranges[charset->num_entries].first = get_card16(cff->SFONT_OR_STREAM); + ranges[charset->num_entries].n_left = get_card8(cff->SFONT_OR_STREAM); count -= ranges[charset->num_entries].n_left + 1; /* no-overrap */ charset->num_entries += 1; charset->data.range1 = ranges; @@ -907,8 +920,8 @@ long cff_read_charsets (cff_font *cff) cff_range2 *ranges = NULL; while (count > 0 && charset->num_entries < cff->num_glyphs) { ranges = RENEW(ranges, charset->num_entries + 1, cff_range2); - ranges[charset->num_entries].first = get_card16(cff->sfont); - ranges[charset->num_entries].n_left = get_card16(cff->sfont); + ranges[charset->num_entries].first = get_card16(cff->SFONT_OR_STREAM); + ranges[charset->num_entries].n_left = get_card16(cff->SFONT_OR_STREAM); count -= ranges[charset->num_entries].n_left + 1; /* non-overrapping */ charset->num_entries += 1; } @@ -1201,7 +1214,7 @@ long cff_read_fdselect (cff_font *cff) offset = (long) cff_dict_get(cff->topdict, "FDSelect", 0); cff_seek_set(cff, offset); cff->fdselect = fdsel = NEW(1, cff_fdselect); - fdsel->format = get_card8(cff->sfont); + fdsel->format = get_card8(cff->SFONT_OR_STREAM); length = 1; @@ -1210,22 +1223,22 @@ long cff_read_fdselect (cff_font *cff) fdsel->num_entries = cff->num_glyphs; (fdsel->data).fds = NEW(fdsel->num_entries, card8); for (i=0;i<(fdsel->num_entries);i++) { - (fdsel->data).fds[i] = get_card8(cff->sfont); + (fdsel->data).fds[i] = get_card8(cff->SFONT_OR_STREAM); } length += fdsel->num_entries; break; case 3: { cff_range3 *ranges; - fdsel->num_entries = get_card16(cff->sfont); + fdsel->num_entries = get_card16(cff->SFONT_OR_STREAM); fdsel->data.ranges = ranges = NEW(fdsel->num_entries, cff_range3); for (i=0;i<(fdsel->num_entries);i++) { - ranges[i].first = get_card16(cff->sfont); - ranges[i].fd = get_card8(cff->sfont); + ranges[i].first = get_card16(cff->SFONT_OR_STREAM); + ranges[i].fd = get_card8(cff->SFONT_OR_STREAM); } if (ranges[0].first != 0) ERROR("Range not starting with 0."); - if (cff->num_glyphs != get_card16(cff->sfont)) + if (cff->num_glyphs != get_card16(cff->SFONT_OR_STREAM)) ERROR("Sentinel value mismatched with number of glyphs."); length += (fdsel->num_entries) * 3 + 4; } diff --git a/Build/source/texk/dvipdfm-x/xsrc/cff.h b/Build/source/texk/dvipdfm-x/xsrc/cff.h deleted file mode 100644 index 9772d6d2a31..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/cff.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifndef _CFF_H_ -#define _CFF_H_ - -#include "mfileio.h" -#include "cff_types.h" - -#include "sfnt.h" - -/* Flag */ -#define FONTTYPE_CIDFONT (1 << 0) -#define FONTTYPE_FONT (1 << 1) -#define FONTTYPE_MMASTER (1 << 2) - -#define ENCODING_STANDARD (1 << 3) -#define ENCODING_EXPERT (1 << 4) - -#define CHARSETS_ISOADOBE (1 << 5) -#define CHARSETS_EXPERT (1 << 6) -#define CHARSETS_EXPSUB (1 << 7) - -#define HAVE_STANDARD_ENCODING (ENCODING_STANDARD|ENCODING_EXPERT) -#define HAVE_STANDARD_CHARSETS \ - (CHARSETS_ISOADOBE|CHARSETS_EXPERT|CHARSETS_EXPSUB) - -#define CFF_STRING_NOTDEF 65535 - -typedef struct -{ - char *fontname; /* FontName */ - - /* - CFF structure - */ - cff_header header; /* CFF Header */ - cff_index *name; /* Name INDEX */ - cff_dict *topdict; /* Top DICT (single) */ - cff_index *string; /* String INDEX */ - cff_index *gsubr; /* Global Subr INDEX */ - cff_encoding *encoding; /* Encodings */ - cff_charsets *charsets; /* Charsets */ - cff_fdselect *fdselect; /* FDSelect, CIDFont only */ - cff_index *cstrings; /* CharStrings */ - cff_dict **fdarray; /* CIDFont only */ - cff_dict **private; /* per-Font DICT */ - cff_index **subrs; /* Local Subr INDEX, per-Private DICT */ - - /* -- extra data -- */ - l_offset offset; /* non-zero for OpenType or PostScript wrapped */ - l_offset gsubr_offset; - card16 num_glyphs; /* number of glyphs (CharString INDEX count) */ - card8 num_fds; /* number of Font DICT */ - - /* Updated String INDEX. - * Please fix this. We should separate input and output. - */ - cff_index *_string; - -#ifdef XETEX - unsigned short *ft_to_gid; -#endif - - sfnt *sfont; - int filter; /* not used, ASCII Hex filter if needed */ - - int index; /* CFF fontset index */ - int flag; /* Flag: see above */ -} cff_font; - -extern cff_font *cff_open (sfnt *sfont, long offset, int idx); -extern void cff_close (cff_font *cff); - -#define cff_seek_set(c, p) sfnt_seek_set (((c)->sfont), ((c)->offset) + (p)); - -/* CFF Header */ -extern long cff_put_header (cff_font *cff, card8 *dest, long destlen); - -/* CFF INDEX */ -extern cff_index *cff_get_index (cff_font *cff); -extern cff_index *cff_get_index_header (cff_font *cff); -extern void cff_release_index (cff_index *idx); -extern cff_index *cff_new_index (card16 count); -extern long cff_index_size (cff_index *idx); -extern long cff_pack_index (cff_index *idx, card8 *dest, long destlen); - -/* Name INDEX */ -extern char *cff_get_name (cff_font *cff); -extern long cff_set_name (cff_font *cff, char *name); - -/* Global and Local Subrs INDEX */ -extern long cff_read_subrs (cff_font *cff); - -/* Encoding */ -extern long cff_read_encoding (cff_font *cff); -extern long cff_pack_encoding (cff_font *cff, card8 *dest, long destlen); -extern card16 cff_encoding_lookup (cff_font *cff, card8 code); -extern void cff_release_encoding (cff_encoding *encoding); - -/* Charsets */ -extern long cff_read_charsets (cff_font *cff); -extern long cff_pack_charsets (cff_font *cff, card8 *dest, long destlen); - -/* Returns GID of PS name "glyph" */ -extern card16 cff_glyph_lookup (cff_font *cff, const char *glyph); -/* Returns GID of glyph with SID/CID "cid" */ -extern card16 cff_charsets_lookup (cff_font *cff, card16 cid); -extern void cff_release_charsets (cff_charsets *charset); -/* Returns SID or CID */ -extern card16 cff_charsets_lookup_inverse (cff_font *cff, card16 gid); - -/* FDSelect */ -extern long cff_read_fdselect (cff_font *cff); -extern long cff_pack_fdselect (cff_font *cff, card8 *dest, long destlen); -extern card8 cff_fdselect_lookup (cff_font *cff, card16 gid); -extern void cff_release_fdselect (cff_fdselect *fdselect); - -/* Font DICT(s) */ -extern long cff_read_fdarray (cff_font *cff); - -/* Private DICT(s) */ -extern long cff_read_private (cff_font *cff); - -#ifdef XETEX -extern unsigned short* cff_get_ft_to_gid(cff_font *cff); -#endif - -/* String */ -extern int cff_match_string (cff_font *cff, const char *str, s_SID sid); -extern char *cff_get_string (cff_font *cff, s_SID id); -extern long cff_get_sid (cff_font *cff, const char *str); -extern long cff_get_seac_sid (cff_font *cff, const char *str); -extern s_SID cff_add_string (cff_font *cff, const char *str, int unique); -extern void cff_update_string (cff_font *cff); - -#define cff_is_stdstr(s) (cff_get_sid(NULL, (s)) >= 0) - -#endif /* _CFF_H_ */ diff --git a/Build/source/texk/dvipdfm-x/xsrc/dvi.c b/Build/source/texk/dvipdfm-x/xsrc/dvi.c index f7efc9a6a2a..0db3adf96b3 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/dvi.c +++ b/Build/source/texk/dvipdfm-x/xsrc/dvi.c @@ -104,9 +104,7 @@ double get_origin (int x) #define PHYSICAL 1 #define VIRTUAL 2 #define SUBFONT 3 -#ifdef XETEX #define NATIVE 4 -#endif #define DVI 1 #define VF 2 @@ -163,9 +161,9 @@ static struct font_def #define XDV_FLAG_COLORED 0x0200 #define XDV_FLAG_FEATURES 0x0400 #define XDV_FLAG_VARIATIONS 0x0800 -#define XDV_FLAG_EXTEND 0x1000 -#define XDV_FLAG_SLANT 0x2000 -#define XDV_FLAG_EMBOLDEN 0x4000 +#define XDV_FLAG_EXTEND 0x1000 +#define XDV_FLAG_SLANT 0x2000 +#define XDV_FLAG_EMBOLDEN 0x4000 #endif static int num_def_fonts = 0, max_def_fonts = 0; diff --git a/Build/source/texk/dvipdfm-x/xsrc/dvi.h b/Build/source/texk/dvipdfm-x/xsrc/dvi.h index 9801309730f..8f6f7e07e59 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/dvi.h +++ b/Build/source/texk/dvipdfm-x/xsrc/dvi.h @@ -43,7 +43,9 @@ extern double dvi_init (char *dvi_filename, double mag); /* may append .dvi or extern void dvi_close (void); /* Closes data structures created by dvi_open */ extern double dvi_tell_mag (void); +#ifdef XETEX extern double dvi_unit_size (void); +#endif extern double dvi_dev_xpos (void); extern double dvi_dev_ypos (void); extern unsigned dvi_npages (void); diff --git a/Build/source/texk/dvipdfm-x/xsrc/dvipdfmx.c b/Build/source/texk/dvipdfm-x/xsrc/dvipdfmx.c index d2d775d7f74..b8656256df1 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/dvipdfmx.c +++ b/Build/source/texk/dvipdfm-x/xsrc/dvipdfmx.c @@ -795,7 +795,7 @@ do_mps_pages (void) mps_do_page(fp); MFCLOSE(fp); } else { - int i, page_no, step, page_count = 0; + long i, page_no, step, page_count = 0; char *filename; /* Process filename.1, filename.2,... */ filename = NEW(strlen(dvi_filename) + 16 + 1, char); @@ -806,10 +806,10 @@ do_mps_pages (void) step = (page_ranges[i].first <= page_ranges[i].last) ? 1 : -1; page_no = page_ranges[i].first; for (;;) { - sprintf(filename, "%s.%d", dvi_filename, page_no + 1); + sprintf(filename, "%s.%ld", dvi_filename, page_no + 1); fp = MFOPEN(filename, FOPEN_RBIN_MODE); if (fp) { - MESG("[%d<%s>", page_no + 1, filename); + MESG("[%ld<%s>", page_no + 1, filename); mps_do_page(fp); page_count++; MESG("]"); diff --git a/Build/source/texk/dvipdfm-x/xsrc/fontmap.c b/Build/source/texk/dvipdfm-x/xsrc/fontmap.c index 0f220255165..082220a21b2 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/fontmap.c +++ b/Build/source/texk/dvipdfm-x/xsrc/fontmap.c @@ -1156,7 +1156,7 @@ pdf_load_native_font (const char *ps_name, } #endif /* XETEX */ -#if 0 +#if 0 /* tfm_name="dmjhira10", map_name="dmj@DNP@10", sfd_name="DNP" * --> sub_id="hira" * Test if tfm_name can be really considered as subfont. diff --git a/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.c b/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.c index 373a38f5c0a..22adf8428be 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.c +++ b/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.c @@ -1121,6 +1121,7 @@ iccp_load_profile (const char *ident, return cspc_id; } +#ifdef XETEX #define WBUF_SIZE 4096 static unsigned char wbuf[WBUF_SIZE]; @@ -1289,6 +1290,7 @@ pdf_colorspace_load_ICCBased (const char *ident, const char *filename) return cspc_id; } +#endif typedef struct { char *ident; @@ -1497,7 +1499,7 @@ pdf_get_colorspace_subtype (int cspc_id) return colorspace->subtype; } -#endif /* 0 */ +#endif void pdf_init_colors (void) diff --git a/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.h b/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.h index 1d5e0f19116..ef7947c4753 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.h +++ b/Build/source/texk/dvipdfm-x/xsrc/pdfcolor.h @@ -80,13 +80,18 @@ extern int pdf_get_colorspace_num_components (int cspc_id); extern int pdf_get_colorspace_subtype (int cspc_id); #endif +#ifdef XETEX /* Not working */ extern int pdf_colorspace_load_ICCBased (const char *ident, const char *profile_filename); +#endif /* Color special * See remark in spc_color.c. */ +#ifndef XETEX +extern void pdf_color_set (pdf_color *sc, pdf_color *fc); +#endif extern void pdf_color_set_default (const pdf_color *color); extern void pdf_color_push (pdf_color *sc, pdf_color *fc); extern void pdf_color_pop (void); diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_color.c b/Build/source/texk/dvipdfm-x/xsrc/spc_color.c deleted file mode 100644 index b625bf7ba8d..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_color.c +++ /dev/null @@ -1,192 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "pdfdev.h" -#include "pdfcolor.h" - -#include "specials.h" - -#include "spc_util.h" -#include "spc_color.h" - - -/* Color stack is actually placed into pdfcolor.c. - * The reason why we need to place stack there is - * that we must reinstall color after grestore and - * other operations that can change current color - * implicitely. - */ - -static int -spc_handler_color_push (struct spc_env *spe, struct spc_arg *args) -{ - int error; - pdf_color colorspec; - - error = spc_util_read_colorspec(spe, &colorspec, args, 1); - if (!error) { - pdf_color_push(&colorspec, &colorspec); - } - - return error; -} - -static int -spc_handler_color_pop (struct spc_env *spe, struct spc_arg *args) -{ - pdf_color_pop(); - - return 0; -} - -/* Invoked by the special command "color rgb .625 0 0". - * DVIPS clears the color stack, and then saves and sets the given color. - */ -static int -spc_handler_color_default (struct spc_env *spe, struct spc_arg *args) -{ - int error; - pdf_color colorspec; - - error = spc_util_read_colorspec(spe, &colorspec, args, 1); - if (!error) { - pdf_color_set_default(&colorspec); - pdf_color_clear_stack(); /* the default color is saved on color_stack */ - pdf_color_push(&colorspec, &colorspec); - } - - return error; -} - - -/* This is from color special? */ -#include "pdfdoc.h" - -static int -spc_handler_background (struct spc_env *spe, struct spc_arg *args) -{ - int error; - pdf_color colorspec; - - error = spc_util_read_colorspec(spe, &colorspec, args, 1); - if (!error) - pdf_doc_set_bgcolor(&colorspec); - - return error; -} - - -#ifndef ISBLANK -#define ISBLANK(c) ((c) == ' ' || (c) == '\t' || (c) == '\v') -#endif -static void -skip_blank (const char **pp, const char *endptr) -{ - const char *p = *pp; - for ( ; p < endptr && ISBLANK(*p); p++); - *pp = p; -} - -int -spc_color_check_special (const char *buf, long len) -{ - int r = 0; - char *q; - const char *p, *endptr; - - p = buf; - endptr = p + len; - - skip_blank(&p, endptr); - q = parse_c_ident(&p, endptr); - if (!q) - return 0; - else if (!strcmp(q, "color")) - r = 1; - else if (!strcmp(q, "background")) { - r = 1; - } - RELEASE(q); - - return r; -} - -int -spc_color_setup_handler (struct spc_handler *sph, - struct spc_env *spe, struct spc_arg *ap) -{ - const char *p; - char *q; - - ASSERT(sph && spe && ap); - - skip_blank(&ap->curptr, ap->endptr); - q = parse_c_ident(&ap->curptr, ap->endptr); - if (!q) - return -1; - skip_blank(&ap->curptr, ap->endptr); - - if (!strcmp(q, "background")) { - ap->command = "background"; - sph->exec = &spc_handler_background; - RELEASE(q); - } else if (!strcmp(q, "color")) { /* color */ - RELEASE(q); - p = ap->curptr; - - q = parse_c_ident(&p, ap->endptr); - if (!q) - return -1; - else if (!strcmp(q, "push")) { - ap->command = "push"; - sph->exec = &spc_handler_color_push; - ap->curptr = p; - } else if (!strcmp(q, "pop")) { - ap->command = "pop"; - sph->exec = &spc_handler_color_pop; - ap->curptr = p; - } else { /* cmyk, rgb, ... */ - ap->command = ""; - sph->exec = &spc_handler_color_default; - } - RELEASE(q); - } else { - spc_warn(spe, "Not color/background special?"); - RELEASE(q); - return -1; - } - - skip_blank(&ap->curptr, ap->endptr); - return 0; -} - diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_html.c b/Build/source/texk/dvipdfm-x/xsrc/spc_html.c deleted file mode 100644 index 5c0d933ce3c..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_html.c +++ /dev/null @@ -1,944 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "pdfdraw.h" -#include "pdfdev.h" -#include "pdfximage.h" - -#include "pdfdoc.h" - -#include "specials.h" -#include "spc_util.h" - -#include "spc_html.h" - - -#define ENABLE_HTML_IMG_SUPPORT 1 -#define ENABLE_HTML_SVG_TRANSFORM 1 -#define ENABLE_HTML_SVG_OPACITY 1 - -/* _FIXME_ - * Please rewrite this or remove html special support - */ - -#define ANCHOR_TYPE_HREF 0 -#define ANCHOR_TYPE_NAME 1 - -struct spc_html_ -{ - struct { - long extensions; - } opts; - - pdf_obj *link_dict; - char *baseurl; - int pending_type; -}; - -static struct spc_html_ _html_state = { - { 0 }, - NULL, NULL, -1 -}; - - -#ifdef ENABLE_HTML_SVG_TRANSFORM -static int cvt_a_to_tmatrix (pdf_tmatrix *M, const char *ptr, const char **nextptr); -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - -#define \ -downcasify(s) \ -if ((s)) { \ - char *_p = (char *) (s); \ - while (*(_p) != 0) { \ - if (*(_p) >= 'A' && *(_p) <= 'Z') { \ - *(_p) = (*(_p) - 'A') + 'a'; \ - } \ - _p++; \ - } \ -} - -static int -parse_key_val (const char **pp, const char *endptr, char **kp, char **vp) -{ - const char *q, *p; - char *k, *v; - int n, error = 0; - - for (p = *pp ; p < endptr && isspace(*p); p++); -#if 0 - while (!error && p < endptr && - ((*p >= 'a' && *p <= 'z') || - (*p >= 'A' && *p <= 'Z')) - ) { -#endif - k = v = NULL; - for (q = p, n = 0; - p < endptr && - ((*p >= 'a' && *p <= 'z') || - (*p >= 'A' && *p <= 'Z') || - (*p >= '0' && *p <= '9') || - *p == '-' || *p == ':' - ); n++, p++); - if (n == 0) { -#if 0 - break; -#else - *kp = *vp = NULL; - return -1; -#endif - } - k = NEW(n + 1, char); - memcpy(k, q, n); k[n] = '\0'; - if (p + 2 >= endptr || p[0] != '=' || (p[1] != '\"' && p[1] != '\'')) { - RELEASE(k); k = NULL; - *pp = p; - error = -1; - } else { - char qchr = p[1]; - p += 2; /* skip '="' */ - for (q = p, n = 0; p < endptr && *p != qchr; p++, n++); - if (p == endptr || *p != qchr) - error = -1; - else { - v = NEW(n + 1, char); - memcpy(v, q, n); v[n] = '\0'; -#if 0 - pdf_add_dict(t->attr, - pdf_new_name(k), - pdf_new_string(v, n)); - RELEASE(v); -#endif - p++; - } - } -#if 0 - RELEASE(k); - if (!error) - for ( ; p < endptr && isspace(*p); p++); - } -#endif - - *kp = k; *vp = v; *pp = p; - return error; -} - -#define HTML_TAG_NAME_MAX 127 -#define HTML_TAG_TYPE_EMPTY 1 -#define HTML_TAG_TYPE_OPEN 1 -#define HTML_TAG_TYPE_CLOSE 2 - -static int -read_html_tag (char *name, pdf_obj *attr, int *type, const char **pp, const char *endptr) -{ - const char *p = *pp; - int n = 0, error = 0; - - for ( ; p < endptr && isspace(*p); p++); - if (p >= endptr || *p != '<') - return -1; - - *type = HTML_TAG_TYPE_OPEN; - for (++p; p < endptr && isspace(*p); p++); - if (p < endptr && *p == '/') { - *type = HTML_TAG_TYPE_CLOSE; - for (++p; p < endptr && isspace(*p); p++); - } - -#define ISDELIM(c) ((c) == '>' || (c) == '/' || isspace(c)) - for (n = 0; p < endptr && n < HTML_TAG_NAME_MAX && !ISDELIM(*p); n++, p++) { - name[n] = *p; - } - name[n] = '\0'; - if (n == 0 || p == endptr || !ISDELIM(*p)) { - *pp = p; - return -1; - } - - for ( ; p < endptr && isspace(*p); p++); - while (p < endptr && !error && *p != '/' && *p != '>') { - char *kp = NULL, *vp = NULL; - error = parse_key_val(&p, endptr, &kp, &vp); - if (!error) { - downcasify(kp); - pdf_add_dict(attr, - pdf_new_name(kp), - pdf_new_string(vp, strlen(vp) + 1)); /* include trailing NULL here!!! */ - RELEASE(kp); - RELEASE(vp); - } - for ( ; p < endptr && isspace(*p); p++); - } - if (error) { - *pp = p; - return error; - } - - if (p < endptr && *p == '/') { - *type = HTML_TAG_TYPE_EMPTY; - for (++p; p < endptr && isspace(*p); p++); - } - if (p == endptr || *p != '>') { - *pp = p; - return -1; - } - p++; - - downcasify(name); - *pp = p; - return 0; -} - - -static int -spc_handler_html__init (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - sd->link_dict = NULL; - sd->baseurl = NULL; - sd->pending_type = -1; - - return 0; -} - -static int -spc_handler_html__clean (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - if (sd->baseurl) - RELEASE(sd->baseurl); - - if (sd->pending_type >= 0 || sd->link_dict) - spc_warn(spe, "Unclosed html anchor found."); - - if (sd->link_dict) - pdf_release_obj(sd->link_dict); - - sd->pending_type = -1; - sd->baseurl = NULL; - sd->link_dict = NULL; - - return 0; -} - - -static int -spc_handler_html__bophook (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - if (sd->pending_type >= 0) { - spc_warn(spe, "...html anchor continues from previous page processed..."); - } - - return 0; -} - -static int -spc_handler_html__eophook (struct spc_env *spe, struct spc_arg *ap, void *dp) -{ - struct spc_html_ *sd = dp; - - if (sd->pending_type >= 0) { - spc_warn(spe, "Unclosed html anchor at end-of-page!"); - } - - return 0; -} - - -static char * -fqurl (const char *baseurl, const char *name) -{ - char *q; - int len = 0; - - len = strlen(name); - if (baseurl) - len += strlen(baseurl) + 1; /* we may want to add '/' */ - - q = NEW(len + 1, char); - *q = '\0'; - if (baseurl && baseurl[0]) { - char *p; - strcpy(q, baseurl); - p = q + strlen(q) - 1; - if (*p == '/') - *p = '\0'; - if (name[0] && name[0] != '/') - strcat(q, "/"); - } - strcat(q, name); - - return q; -} - -static int -html_open_link (struct spc_env *spe, const char *name, struct spc_html_ *sd) -{ - pdf_obj *color; - char *url; - - ASSERT( name ); - ASSERT( sd->link_dict == NULL ); /* Should be checked somewhere else */ - - sd->link_dict = pdf_new_dict(); - pdf_add_dict(sd->link_dict, - pdf_new_name("Type"), pdf_new_name ("Annot")); - pdf_add_dict(sd->link_dict, - pdf_new_name("Subtype"), pdf_new_name ("Link")); - - color = pdf_new_array (); - pdf_add_array(color, pdf_new_number(0.0)); - pdf_add_array(color, pdf_new_number(0.0)); - pdf_add_array(color, pdf_new_number(1.0)); - pdf_add_dict(sd->link_dict, pdf_new_name("C"), color); - - url = fqurl(sd->baseurl, name); - if (url[0] == '#') { - /* url++; causes memory leak in RELEASE(url) */ - pdf_add_dict(sd->link_dict, - pdf_new_name("Dest"), - pdf_new_string(url+1, strlen(url+1))); - } else { /* Assume this is URL */ - pdf_obj *action = pdf_new_dict(); - pdf_add_dict(action, - pdf_new_name("Type"), - pdf_new_name("Action")); - pdf_add_dict(action, - pdf_new_name("S"), - pdf_new_name("URI")); - pdf_add_dict(action, - pdf_new_name("URI"), - pdf_new_string(url, strlen(url))); - pdf_add_dict(sd->link_dict, - pdf_new_name("A"), - pdf_link_obj(action)); - pdf_release_obj(action); - } - RELEASE(url); - - spc_begin_annot(spe, sd->link_dict); - - sd->pending_type = ANCHOR_TYPE_HREF; - - return 0; -} - -static int -html_open_dest (struct spc_env *spe, const char *name, struct spc_html_ *sd) -{ - int error; - pdf_obj *array, *page_ref; - pdf_coord cp; - - cp.x = spe->x_user; cp.y = spe->y_user; - pdf_dev_transform(&cp, NULL); - - page_ref = pdf_doc_this_page_ref(); - ASSERT( page_ref ); /* Otherwise must be bug */ - - array = pdf_new_array(); - pdf_add_array(array, page_ref); - pdf_add_array(array, pdf_new_name("XYZ")); - pdf_add_array(array, pdf_new_null()); - pdf_add_array(array, pdf_new_number(cp.y + 24.0)); - pdf_add_array(array, pdf_new_null()); - - error = pdf_doc_add_names("Dests", - name, strlen(name), - array); - - if (error) - spc_warn(spe, "Failed to add named destination: %s", name); - - sd->pending_type = ANCHOR_TYPE_NAME; - - return error; -} - -#define ANCHOR_STARTED(s) ((s)->pending_type >= 0 || (s)->link_dict) - -static int -spc_html__anchor_open (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - pdf_obj *href, *name; - int error = 0; - - if (ANCHOR_STARTED(sd)) { - spc_warn(spe, "Nested html anchors found!"); - return -1; - } - - href = pdf_lookup_dict(attr, "href"); - name = pdf_lookup_dict(attr, "name"); - if (href && name) { - spc_warn(spe, "Sorry, you can't have both \"href\" and \"name\" in anchor tag..."); - error = -1; - } else if (href) { - error = html_open_link(spe, pdf_string_value(href), sd); - } else if (name) { /* name */ - error = html_open_dest(spe, pdf_string_value(name), sd); - } else { - spc_warn(spe, "You should have \"href\" or \"name\" in anchor tag!"); - error = -1; - } - - return error; -} - -static int -spc_html__anchor_close (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - int error = 0; - - switch (sd->pending_type) { - case ANCHOR_TYPE_HREF: - if (sd->link_dict) { - spc_end_annot(spe); - pdf_release_obj(sd->link_dict); - sd->link_dict = NULL; - sd->pending_type = -1; - } else { - spc_warn(spe, "Closing html anchor (link) without starting!"); - error = -1; - } - break; - case ANCHOR_TYPE_NAME: - sd->pending_type = -1; - break; - default: - spc_warn(spe, "No corresponding opening tag for html anchor."); - error = -1; - break; - } - - return error; -} - -static int -spc_html__base_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - pdf_obj *href; - char *vp; - - href = pdf_lookup_dict(attr, "href"); - if (!href) { - spc_warn(spe, "\"href\" not found for \"base\" tag!"); - return -1; - } - - vp = (char *) pdf_string_value(href); - if (sd->baseurl) { - spc_warn(spe, "\"baseurl\" changed: \"%s\" --> \"%s\"", sd->baseurl, vp); - RELEASE(sd->baseurl); - } - sd->baseurl = NEW(strlen(vp) + 1, char); - strcpy(sd->baseurl, vp); - - return 0; -} - - -#ifdef ENABLE_HTML_IMG_SUPPORT -/* This isn't completed. - * Please think about placement of images. - */ -static double -atopt (const char *a) -{ - char *q; - const char *p = a; - double v, u = 1.0; - const char *_ukeys[] = { -#define K_UNIT__PT 0 -#define K_UNIT__IN 1 -#define K_UNIT__CM 2 -#define K_UNIT__MM 3 -#define K_UNIT__BP 4 - "pt", "in", "cm", "mm", "bp", -#define K_UNIT__PX 5 - "px", - NULL - }; - int k; - - q = parse_float_decimal(&p, p + strlen(p)); - if (!q) { - WARN("Invalid length value: %s (%c)", a, *p); - return 0.0; - } - - v = atof(q); - RELEASE(q); - - q = parse_c_ident(&p, p + strlen(p)); - if (q) { - for (k = 0; _ukeys[k] && strcmp(_ukeys[k], q); k++); - switch (k) { - case K_UNIT__PT: u *= 72.0 / 72.27; break; - case K_UNIT__IN: u *= 72.0; break; - case K_UNIT__CM: u *= 72.0 / 2.54 ; break; - case K_UNIT__MM: u *= 72.0 / 25.4 ; break; - case K_UNIT__BP: u *= 1.0 ; break; - case K_UNIT__PX: u *= 1.0 ; break; /* 72dpi */ - default: - WARN("Unknown unit of measure: %s", q); - break; - } - RELEASE(q); - } - - return v * u; -} - - -#ifdef ENABLE_HTML_SVG_OPACITY -/* Replicated from spc_tpic */ -static pdf_obj * -create_xgstate (double a /* alpha */, int f_ais /* alpha is shape */) -{ - pdf_obj *dict; - - dict = pdf_new_dict(); - pdf_add_dict(dict, - pdf_new_name("Type"), - pdf_new_name("ExtGState")); - if (f_ais) { - pdf_add_dict(dict, - pdf_new_name("AIS"), - pdf_new_boolean(1)); - } - pdf_add_dict(dict, - pdf_new_name("ca"), - pdf_new_number(a)); - - return dict; -} - -static int -check_resourcestatus (const char *category, const char *resname) -{ - pdf_obj *dict1, *dict2; - - dict1 = pdf_doc_current_page_resources(); - if (!dict1) - return 0; - - dict2 = pdf_lookup_dict(dict1, category); - if (dict2 && - pdf_obj_typeof(dict2) == PDF_DICT) { - if (pdf_lookup_dict(dict2, resname)) - return 1; - } - return 0; -} -#endif /* ENABLE_HTML_SVG_OPACITY */ - -static int -spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - pdf_obj *src, *obj; - transform_info ti; - int id, error = 0; -#ifdef ENABLE_HTML_SVG_OPACITY - double alpha = 1.0; /* meaning fully opaque */ -#endif /* ENABLE_HTML_SVG_OPACITY */ -#ifdef ENABLE_HTML_SVG_TRANSFORM - pdf_tmatrix M; - - pdf_setmatrix(&M, 1.0, 0.0, 0.0, 1.0, spe->x_user, spe->y_user); -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - - spc_warn(spe, "html \"img\" tag found (not completed, plese don't use!)."); - - src = pdf_lookup_dict(attr, "src"); - if (!src) { - spc_warn(spe, "\"src\" attribute not found for \"img\" tag!"); - return -1; - } - - transform_info_clear(&ti); - obj = pdf_lookup_dict(attr, "width"); - if (obj) { - ti.width = atopt(pdf_string_value(obj)); - ti.flags |= INFO_HAS_WIDTH; - } - obj = pdf_lookup_dict(attr, "height"); - if (obj) { - ti.height = atopt(pdf_string_value(obj)); - ti.flags |= INFO_HAS_HEIGHT; - } - -#ifdef ENABLE_HTML_SVG_OPACITY - obj = pdf_lookup_dict(attr, "svg:opacity"); - if (obj) { - alpha = atof(pdf_string_value(obj)); - if (alpha < 0.0 || alpha > 1.0) { - spc_warn(spe, "Invalid opacity value: %s", pdf_string_value(obj)); - alpha = 1.0; - } - } -#endif /* ENABLE_HTML_SVG_OPCAITY */ - -#ifdef ENABLE_HTML_SVG_TRANSFORM - obj = pdf_lookup_dict(attr, "svg:transform"); - if (obj) { - const char *p = pdf_string_value(obj); - pdf_tmatrix N; - for ( ; *p && isspace(*p); p++); - while (*p && !error) { - pdf_setmatrix(&N, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - error = cvt_a_to_tmatrix(&N, p, &p); - if (!error) { - N.f = -N.f; - pdf_concatmatrix(&M, &N); - for ( ; *p && isspace(*p); p++); - if (*p == ',') - for (++p; *p && isspace(*p); p++); - } - } - } -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - - if (error) { - spc_warn(spe, "Error in html \"img\" tag attribute."); - return error; - } - - id = pdf_ximage_findresource(pdf_string_value(src), 0, NULL); - if (id < 0) { - spc_warn(spe, "Could not find/load image: %s", pdf_string_value(src)); - error = -1; - } else { -#if defined(ENABLE_HTML_SVG_TRANSFORM) || defined(ENABLE_HTML_SVG_OPACITY) - { - char *res_name; - pdf_rect r; - - graphics_mode(); - - pdf_dev_gsave(); - -#ifdef ENABLE_HTML_SVG_OPACITY - { - pdf_obj *dict; - int a = round(100.0 * alpha); - if (a != 0) { - res_name = NEW(strlen("_Tps_a100_") + 1, char); - sprintf(res_name, "_Tps_a%03d_", a); /* Not Tps prefix but... */ - if (!check_resourcestatus("ExtGState", res_name)) { - dict = create_xgstate(round_at(0.01 * a, 0.01), 0); - pdf_doc_add_page_resource("ExtGState", - res_name, pdf_ref_obj(dict)); - pdf_release_obj(dict); - } - pdf_doc_add_page_content(" /", 2); - pdf_doc_add_page_content(res_name, strlen(res_name)); - pdf_doc_add_page_content(" gs", 3); - RELEASE(res_name); - } - } -#endif /* ENABLE_HTML_SVG_OPACITY */ - - pdf_dev_concat(&M); - - pdf_ximage_scale_image(id, &M, &r, &ti); - pdf_dev_concat(&M); - - pdf_dev_rectclip(r.llx, r.lly, r.urx - r.llx, r.ury - r.lly); - - res_name = pdf_ximage_get_resname(id); - pdf_doc_add_page_content(" /", 2); - pdf_doc_add_page_content(res_name, strlen(res_name)); - pdf_doc_add_page_content(" Do", 3); - - pdf_dev_grestore(); - - pdf_doc_add_page_resource("XObject", - res_name, - pdf_ximage_get_reference(id)); - } -#else - pdf_dev_put_image(id, &ti, spe->x_user, spe->y_user); -#endif /* ENABLE_HTML_SVG_XXX */ - } - - return error; -} -#else -static int -spc_html__img_empty (struct spc_env *spe, pdf_obj *attr, struct spc_html_ *sd) -{ - spc_warn(spe, "IMG tag not yet supported yet..."); - return -1; -} -#endif /* ENABLE_HTML_IMG_SUPPORT */ - - -static int -spc_handler_html_default (struct spc_env *spe, struct spc_arg *ap) -{ - struct spc_html_ *sd = &_html_state; - char name[HTML_TAG_NAME_MAX + 1]; - pdf_obj *attr; - int error = 0, type = HTML_TAG_TYPE_OPEN; - - if (ap->curptr >= ap->endptr) - return 0; - - attr = pdf_new_dict(); - error = read_html_tag(name, attr, &type, &ap->curptr, ap->endptr); - if (error) { - pdf_release_obj(attr); - return error; - } - if (!strcmp(name, "a")) { - switch (type) { - case HTML_TAG_TYPE_OPEN: - error = spc_html__anchor_open (spe, attr, sd); - break; - case HTML_TAG_TYPE_CLOSE: - error = spc_html__anchor_close(spe, attr, sd); - break; - default: - spc_warn(spe, "Empty html anchor tag???"); - error = -1; - break; - } - } else if (!strcmp(name, "base")) { - if (type == HTML_TAG_TYPE_CLOSE) { - spc_warn(spe, "Close tag for \"base\"???"); - error = -1; - } else { /* treat "open" same as "empty" */ - error = spc_html__base_empty(spe, attr, sd); - } - } else if (!strcmp(name, "img")) { - if (type == HTML_TAG_TYPE_CLOSE) { - spc_warn(spe, "Close tag for \"img\"???"); - error = -1; - } else { /* treat "open" same as "empty" */ - error = spc_html__img_empty(spe, attr, sd); - } - } - pdf_release_obj(attr); - - for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); - - return error; -} - - -#ifdef ENABLE_HTML_SVG_TRANSFORM -/* translate wsp* '(' wsp* number (comma-wsp number)? wsp* ')' */ -static int -cvt_a_to_tmatrix (pdf_tmatrix *M, const char *ptr, const char **nextptr) -{ - char *q; - const char *p = ptr; - int n; - double v[6]; - static const char *_tkeys[] = { -#define K_TRNS__MATRIX 0 - "matrix", /* a b c d e f */ -#define K_TRNS__TRANSLATE 1 - "translate", /* tx [ty] : dflt. tf = 0 */ -#define K_TRNS__SCALE 2 - "scale", /* sx [sy] : dflt. sy = sx */ -#define K_TRNS__ROTATE 3 - "rotate", /* ang [cx cy] : dflt. cx, cy = 0 */ -#define K_TRNS__SKEWX 4 -#define K_TRNS__SKEWY 5 - "skewX", /* ang */ - "skewY", /* ang */ - NULL - }; - int k; - - for ( ; *p && isspace(*p); p++); - - q = parse_c_ident(&p, p + strlen(p)); - if (!q) - return -1; - /* parsed transformation key */ - for (k = 0; _tkeys[k] && strcmp(q, _tkeys[k]); k++); - RELEASE(q); - - /* handle args */ - for ( ; *p && isspace(*p); p++); - if (*p != '(' || *(p + 1) == 0) - return -1; - for (++p; *p && isspace(*p); p++); - for (n = 0; n < 6 && *p && *p != ')'; n++) { - q = parse_float_decimal(&p, p + strlen(p)); - if (!q) - break; - else { - v[n] = atof(q); - if (*p == ',') - p++; - for ( ; *p && isspace(*p); p++); - if (*p == ',') - for (++p; *p && isspace(*p); p++); - RELEASE(q); - } - } - if (*p != ')') - return -1; - p++; - - switch (k) { - case K_TRNS__MATRIX: - if (n != 6) - return -1; - M->a = v[0]; M->c = v[1]; - M->b = v[2]; M->d = v[3]; - M->e = v[4]; M->f = v[5]; - break; - case K_TRNS__TRANSLATE: - if (n != 1 && n != 2) - return -1; - M->a = M->d = 1.0; - M->c = M->b = 0.0; - M->e = v[0]; M->f = (n == 2) ? v[1] : 0.0; - break; - case K_TRNS__SCALE: - if (n != 1 && n != 2) - return -1; - M->a = v[0]; M->d = (n == 2) ? v[1] : v[0]; - M->c = M->b = 0.0; - M->e = M->f = 0.0; - break; - case K_TRNS__ROTATE: - if (n != 1 && n != 3) - return -1; - M->a = cos(v[0] * M_PI / 180.0); - M->c = sin(v[0] * M_PI / 180.0); - M->b = -M->c; M->d = M->a; - M->e = (n == 3) ? v[1] : 0.0; - M->f = (n == 3) ? v[2] : 0.0; - break; - case K_TRNS__SKEWX: - if (n != 1) - return -1; - M->a = M->d = 1.0; - M->c = 0.0; - M->b = tan(v[0] * M_PI / 180.0); - break; - case K_TRNS__SKEWY: - if (n != 1) - return -1; - M->a = M->d = 1.0; - M->c = tan(v[0] * M_PI / 180.0); - M->b = 0.0; - break; - } - - if (nextptr) - *nextptr = p; - return 0; -} -#endif /* ENABLE_HTML_SVG_TRANSFORM */ - -int -spc_html_at_begin_document (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__init(NULL, NULL, sd); -} - -int -spc_html_at_begin_page (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__bophook(NULL, NULL, sd); -} - -int -spc_html_at_end_page (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__eophook(NULL, NULL, sd); -} - -int -spc_html_at_end_document (void) -{ - struct spc_html_ *sd = &_html_state; - return spc_handler_html__clean(NULL, NULL, sd); -} - - -int -spc_html_check_special (const char *buffer, long size) -{ - const char *p, *endptr; - - p = buffer; - endptr = p + size; - - for ( ; p < endptr && isspace(*p); p++); - size = (long) (endptr - p); - if (size >= strlen("html:") && - !memcmp(p, "html:", strlen("html:"))) { - return 1; - } - - return 0; -} - - -int -spc_html_setup_handler (struct spc_handler *sph, - struct spc_env *spe, struct spc_arg *ap) -{ - ASSERT(sph && spe && ap); - - for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); - if (ap->curptr + strlen("html:") > ap->endptr || - memcmp(ap->curptr, "html:", strlen("html:"))) { - return -1; - } - - ap->command = ""; - - sph->key = "html:"; - sph->exec = &spc_handler_html_default; - - ap->curptr += strlen("html:"); - for ( ; ap->curptr < ap->endptr && isspace(ap->curptr[0]); ap->curptr++); - - return 0; -} - diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_util.c b/Build/source/texk/dvipdfm-x/xsrc/spc_util.c deleted file mode 100644 index be50644cd41..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_util.c +++ /dev/null @@ -1,796 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2007-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "pdfdev.h" -#include "pdfparse.h" -#include "pdfcolor.h" -#include "pdfdraw.h" - -#include "specials.h" - -#include "spc_util.h" - - -#ifndef ISBLANK -#define ISBLANK(c) ((c) == ' ' || (c) == '\t') -#endif -static void -skip_blank (const char **pp, const char *endptr) -{ - const char *p = *pp; - for ( ; p < endptr && ISBLANK(*p); p++); - *pp = p; -} - - -/* From pdfcolor.c */ -static int pdf_color_namedcolor (pdf_color *color, const char *colorname); - -int -spc_util_read_numbers (double *values, int num_values, - struct spc_env *spe, struct spc_arg *args) -{ - int count; - char *q; - - skip_blank(&args->curptr, args->endptr); - for (count = 0; - count < num_values && - args->curptr < args->endptr; ) { - q = parse_float_decimal(&args->curptr, args->endptr); - if (!q) - break; - else { - values[count] = atof(q); - RELEASE(q); - skip_blank(&args->curptr, args->endptr); - count++; - } - } - - return count; -} - -static void -rgb_color_from_hsv (pdf_color *color, double h, double s, double v) -{ - double r, g, b; - ASSERT( color ); - r = g = b = v; - if (s != 0.0) { - double h6, f, v1, v2, v3; - int i; - h6 = h * 6; /* 360 / 60 */ - i = (int) h6; - f = h6 - i; - v1 = v * (1 - s); - v2 = v * (1 - s * f); - v3 = v * (1 - s * (1 - f)); - switch (i) { - case 0: r = v ; g = v3; b = v1; break; - case 1: r = v2; g = v ; b = v1; break; - case 2: r = v1; g = v ; b = v3; break; - case 3: r = v1; g = v2; b = v ; break; - case 4: r = v3; g = v1; b = v ; break; - case 5: r = v ; g = v1; b = v2; break; - case 6: r = v ; g = v1; b = v2; break; - } - } - pdf_color_rgbcolor(color, r, g, b); -} - -static int -spc_read_color_color (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) -{ - char *q; - double cv[4]; - int nc; - int error = 0; - - q = parse_c_ident(&ap->curptr, ap->endptr); - if (!q) { - spc_warn(spe, "No valid color specified?"); - return -1; - } - skip_blank(&ap->curptr, ap->endptr); - - if (!strcmp(q, "rgb")) { /* Handle rgb color */ - nc = spc_util_read_numbers(cv, 3, spe, ap); - if (nc != 3) { - spc_warn(spe, "Invalid value for RGB color specification."); - error = -1; - } else { - pdf_color_rgbcolor(colorspec, cv[0], cv[1], cv[2]); - } - } else if (!strcmp(q, "cmyk")) { /* Handle cmyk color */ - nc = spc_util_read_numbers(cv, 4, spe, ap); - if (nc != 4) { - spc_warn(spe, "Invalid value for CMYK color specification."); - error = -1; - } else { - pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); - } - } else if (!strcmp(q, "gray")) { /* Handle gray */ - nc = spc_util_read_numbers(cv, 1, spe, ap); - if (nc != 1) { - spc_warn(spe, "Invalid value for gray color specification."); - error = -1; - } else { - pdf_color_graycolor(colorspec, cv[0]); - } - } else if (!strcmp(q, "hsb")) { - nc = spc_util_read_numbers(cv, 3, spe, ap); - if (nc != 3) { - spc_warn(spe, "Invalid value for HSB color specification."); - error = -1; - } else { - rgb_color_from_hsv(colorspec, cv[0], cv[1], cv[2]); - spc_warn(spe, "HSB color converted to RGB: hsb: <%g, %g, %g> ==> rgb: <%g, %g, %g>", - cv[0], cv[1], cv[2], - colorspec->values[0], colorspec->values[1], colorspec->values[2]); - } - } else { /* Must be a "named" color */ - error = pdf_color_namedcolor(colorspec, q); - if (error) - spc_warn(spe, "Unrecognized color name: %s", q); - } - RELEASE(q); - - return error; -} - -/* Argumaent for this is PDF_Number or PDF_Array. - * But we ignore that since we don't want to add - * dependency to pdfxxx and @foo can not be - * allowed for color specification. "pdf" here - * means pdf: special syntax. - */ -static int -spc_read_color_pdf (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap) -{ - double cv[4]; /* at most four */ - int nc, isarry = 0; - int error = 0; - char *q; - - skip_blank(&ap->curptr, ap->endptr); - - if (ap->curptr[0] == '[') { - ap->curptr++; skip_blank(&ap->curptr, ap->endptr); - isarry = 1; - } - - nc = spc_util_read_numbers(cv, 4, spe, ap); - switch (nc) { - case 1: - pdf_color_graycolor(colorspec, cv[0]); - break; - case 3: - pdf_color_rgbcolor (colorspec, cv[0], cv[1], cv[2]); - break; - case 4: - pdf_color_cmykcolor(colorspec, cv[0], cv[1], cv[2], cv[3]); - break; - default: - /* Try to read the color names defined in dvipsname.def */ - q = parse_c_ident(&ap->curptr, ap->endptr); - if (!q) { - spc_warn(spe, "No valid color specified?"); - return -1; - } - error = pdf_color_namedcolor(colorspec, q); - if (error) - spc_warn(spe, "Unrecognized color name: %s", q); - RELEASE(q); - break; - } - - if (!error && isarry) { - skip_blank(&ap->curptr, ap->endptr); - if (ap->curptr >= ap->endptr || ap->curptr[0] != ']') { - spc_warn(spe, "Unbalanced '[' and ']' in color specification."); - error = -1; - } else { - ap->curptr++; - } - } - - return error; -} - - -/* This is for reading *single* color specification. */ -int -spc_util_read_colorspec (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *ap, int syntax) -{ - int error = 0; - - ASSERT(colorspec && spe && ap); - - skip_blank(&ap->curptr, ap->endptr); - if (ap->curptr >= ap->endptr) { - return -1; - } - - if (syntax) - error = spc_read_color_color(spe, colorspec, ap); - else - error = spc_read_color_pdf(spe, colorspec, ap); - - skip_blank(&ap->curptr, ap->endptr); - - return error; -} - - -/* This need to allow 'true' prefix for unit and - * length value must be divided by current magnification. - */ -int -spc_util_read_length (struct spc_env *spe, double *vp /* ret. */, struct spc_arg *ap) -{ - char *q; - double v, u = 1.0; - const char *ukeys[] = { -#define K_UNIT__PT 0 -#define K_UNIT__IN 1 -#define K_UNIT__CM 2 -#define K_UNIT__MM 3 -#define K_UNIT__BP 4 - "pt", "in", "cm", "mm", "bp", NULL - }; - int k, error = 0; - - q = parse_float_decimal(&ap->curptr, ap->endptr); - if (!q) - return -1; - - v = atof(q); - RELEASE(q); - - skip_white(&ap->curptr, ap->endptr); - q = parse_c_ident(&ap->curptr, ap->endptr); - if (q) { - char *qq = q; - if (strlen(q) >= strlen("true") && - !memcmp(q, "true", strlen("true"))) { - u /= spe->mag != 0.0 ? spe->mag : 1.0; /* inverse magnify */ - q += strlen("true"); - } - if (strlen(q) == 0) { - RELEASE(qq); - skip_white(&ap->curptr, ap->endptr); - qq = q = parse_c_ident(&ap->curptr, ap->endptr); - } - if (q) { - for (k = 0; ukeys[k] && strcmp(ukeys[k], q); k++); - switch (k) { - case K_UNIT__PT: u *= 72.0 / 72.27; break; - case K_UNIT__IN: u *= 72.0; break; - case K_UNIT__CM: u *= 72.0 / 2.54 ; break; - case K_UNIT__MM: u *= 72.0 / 25.4 ; break; - case K_UNIT__BP: u *= 1.0 ; break; - default: - spc_warn(spe, "Unknown unit of measure: %s", q); - error = -1; - break; - } - RELEASE(qq); - } - else { - spc_warn(spe, "Missing unit of measure after \"true\""); - error = -1; - } - } - - *vp = v * u; - return error; -} - - -/* - * Compute a transformation matrix - * transformations are applied in the following - * order: scaling, rotate, displacement. - */ -static void -make_transmatrix (pdf_tmatrix *M, - double xoffset, double yoffset, - double xscale, double yscale, - double rotate) -{ - double c, s; - - c = cos(rotate); - s = sin(rotate); - - M->a = xscale * c; M->b = xscale * s; - M->c = -yscale * s; M->d = yscale * c; - M->e = xoffset; M->f = yoffset; -} - -static int -spc_read_dimtrns_dvips (struct spc_env *spe, transform_info *t, struct spc_arg *ap) -{ - static const char *_dtkeys[] = { -#define K_TRN__HOFFSET 0 -#define K_TRN__VOFFSET 1 - "hoffset", "voffset", -#define K_DIM__HSIZE 2 -#define K_DIM__VSIZE 3 - "hsize", "vsize", -#define K_TRN__HSCALE 4 -#define K_TRN__VSCALE 5 - "hscale", "vscale", -#define K_TRN__ANGLE 6 - "angle", -#define K__CLIP 7 - "clip", -#define K_DIM__LLX 8 -#define K_DIM__LLY 9 -#define K_DIM__URX 10 -#define K_DIM__URY 11 - "llx", "lly", "urx", "ury", -#define K_DIM__RWI 12 -#define K_DIM__RHI 13 - "rwi", "rhi", - NULL - }; - double xoffset, yoffset, xscale, yscale, rotate; - int error = 0; - - xoffset = yoffset = rotate = 0.0; xscale = yscale = 1.0; - - skip_blank(&ap->curptr, ap->endptr); - while (!error && ap->curptr < ap->endptr) { - char *kp, *vp; - int k; - - kp = parse_c_ident(&ap->curptr, ap->endptr); - if (!kp) - break; - - for (k = 0; _dtkeys[k] && strcmp(kp, _dtkeys[k]); k++); - if (!_dtkeys[k]) { - spc_warn(spe, "Unrecognized dimension/transformation key: %s", kp); - error = -1; - RELEASE(kp); - break; - } - - skip_blank(&ap->curptr, ap->endptr); - if (k == K__CLIP) { - t->flags |= INFO_DO_CLIP; - RELEASE(kp); - continue; /* not key-value */ - } - - if (ap->curptr < ap->endptr && ap->curptr[0] == '=') { - ap->curptr++; - skip_blank(&ap->curptr, ap->endptr); - } - - vp = NULL; - if (ap->curptr[0] == '\'' || ap->curptr[0] == '\"') { - char qchr = ap->curptr[0]; - ap->curptr++; - skip_blank(&ap->curptr, ap->endptr); - vp = parse_float_decimal(&ap->curptr, ap->endptr); - skip_blank(&ap->curptr, ap->endptr); - if (vp && qchr != ap->curptr[0]) { - spc_warn(spe, "Syntax error in dimension/transformation specification."); - error = -1; - RELEASE(vp); vp = NULL; - } - ap->curptr++; - } else { - vp = parse_float_decimal(&ap->curptr, ap->endptr); - } - if (!error && !vp) { - spc_warn(spe, "Missing value for dimension/transformation: %s", kp); - error = -1; - } - RELEASE(kp); - if (!vp || error) { - break; - } - - switch (k) { - case K_TRN__HOFFSET: - xoffset = atof(vp); - break; - case K_TRN__VOFFSET: - yoffset = atof(vp); - break; - case K_DIM__HSIZE: - t->width = atof(vp); - t->flags |= INFO_HAS_WIDTH; - break; - case K_DIM__VSIZE: - t->height = atof(vp); - t->flags |= INFO_HAS_HEIGHT; - break; - case K_TRN__HSCALE: - xscale = atof(vp) / 100.0; - break; - case K_TRN__VSCALE: - yscale = atof(vp) / 100.0; - break; - case K_TRN__ANGLE: - rotate = M_PI * atof(vp) / 180.0; - break; - case K_DIM__LLX: - t->bbox.llx = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__LLY: - t->bbox.lly = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__URX: - t->bbox.urx = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__URY: - t->bbox.ury = atof(vp); - t->flags |= INFO_HAS_USER_BBOX; - break; - case K_DIM__RWI: - t->width = atof(vp) / 10.0; - t->flags |= INFO_HAS_WIDTH; - break; - case K_DIM__RHI: - t->height = atof(vp) / 10.0; - t->flags |= INFO_HAS_HEIGHT; - break; - } - skip_blank(&ap->curptr, ap->endptr); - RELEASE(vp); - } - make_transmatrix(&(t->matrix), xoffset, yoffset, xscale, yscale, rotate); - - return error; -} - - -static int -spc_read_dimtrns_pdfm (struct spc_env *spe, transform_info *p, struct spc_arg *ap, long *page_no) -{ - int has_scale, has_xscale, has_yscale, has_rotate, has_matrix; - const char *_dtkeys[] = { -#define K_DIM__WIDTH 0 -#define K_DIM__HEIGHT 1 -#define K_DIM__DEPTH 2 - "width", "height", "depth", -#define K_TRN__SCALE 3 -#define K_TRN__XSCALE 4 -#define K_TRN__YSCALE 5 -#define K_TRN__ROTATE 6 - "scale", "xscale", "yscale", "rotate", -#define K_TRN__BBOX 7 - "bbox", /* See "Dvipdfmx User's Manual", p.5 */ -#define K_TRN__MATRIX 8 - "matrix", -#undef K__CLIP -#define K__CLIP 9 - "clip", -#define K__PAGE 10 - "page", -#define K__HIDE 11 - "hide", - NULL - }; - double xscale, yscale, rotate; - int error = 0; - - has_xscale = has_yscale = has_scale = has_rotate = has_matrix = 0; - xscale = yscale = 1.0; rotate = 0.0; - p->flags |= INFO_DO_CLIP; /* default: do clipping */ - p->flags &= ~INFO_DO_HIDE; /* default: do clipping */ - - skip_blank(&ap->curptr, ap->endptr); - - while (!error && ap->curptr < ap->endptr) { - char *kp, *vp; - int k; - - kp = parse_c_ident(&ap->curptr, ap->endptr); - if (!kp) - break; - - skip_blank(&ap->curptr, ap->endptr); - for (k = 0; _dtkeys[k] && strcmp(_dtkeys[k], kp); k++); - switch (k) { - case K_DIM__WIDTH: - error = spc_util_read_length(spe, &p->width , ap); - p->flags |= INFO_HAS_WIDTH; - break; - case K_DIM__HEIGHT: - error = spc_util_read_length(spe, &p->height, ap); - p->flags |= INFO_HAS_HEIGHT; - break; - case K_DIM__DEPTH: - error = spc_util_read_length(spe, &p->depth , ap); - p->flags |= INFO_HAS_HEIGHT; - break; - case K_TRN__SCALE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - xscale = yscale = atof(vp); - has_scale = 1; - RELEASE(vp); - } - break; - case K_TRN__XSCALE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - xscale = atof(vp); - has_xscale = 1; - RELEASE(vp); - } - break; - case K_TRN__YSCALE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - yscale = atof(vp); - has_yscale = 1; - RELEASE(vp); - } - break; - case K_TRN__ROTATE: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - rotate = M_PI * atof(vp) / 180.0; - has_rotate = 1; - RELEASE(vp); - } - break; - case K_TRN__BBOX: - { - double v[4]; - if (spc_util_read_numbers(v, 4, spe, ap) != 4) - error = -1; - else { - p->bbox.llx = v[0]; - p->bbox.lly = v[1]; - p->bbox.urx = v[2]; - p->bbox.ury = v[3]; - p->flags |= INFO_HAS_USER_BBOX; - } - } - break; - case K_TRN__MATRIX: - { - double v[6]; - if (spc_util_read_numbers(v, 6, spe, ap) != 6) - error = -1; - else { - pdf_setmatrix(&(p->matrix), v[0], v[1], v[2], v[3], v[4], v[5]); - has_matrix = 1; - } - } - break; - case K__CLIP: - vp = parse_float_decimal(&ap->curptr, ap->endptr); - if (!vp) - error = -1; - else { - if (atof(vp)) - p->flags |= INFO_DO_CLIP; - else - p->flags &= ~INFO_DO_CLIP; - RELEASE(vp); - } - break; - case K__PAGE: - { - double page; - if (page_no && spc_util_read_numbers(&page, 1, spe, ap) == 1) - *page_no = (long) page; - else - error = -1; - } - break; - case K__HIDE: - p->flags |= INFO_DO_HIDE; - break; - default: - error = -1; - break; - } - if (error) - spc_warn(spe, "Unrecognized key or invalid value for dimension/transformation: %s", kp); - else - skip_blank(&ap->curptr, ap->endptr); - RELEASE(kp); - } - - if (!error) { - /* Check consistency */ - if (has_xscale && (p->flags & INFO_HAS_WIDTH)) { - spc_warn(spe, "Can't supply both width and xscale. Ignore xscale."); - xscale = 1.0; - } else if (has_yscale && - (p->flags & INFO_HAS_HEIGHT)) { - spc_warn(spe, "Can't supply both height/depth and yscale. Ignore yscale."); - yscale = 1.0; - } else if (has_scale && - (has_xscale || has_yscale)) { - spc_warn(spe, "Can't supply overall scale along with axis scales."); - error = -1; - } else if (has_matrix && - (has_scale || has_xscale || has_yscale || has_rotate)) { - spc_warn(spe, "Can't supply transform matrix along with scales or rotate. Ignore scales and rotate."); - } - } - - if (!has_matrix) { - make_transmatrix(&(p->matrix), 0.0, 0.0, xscale, yscale, rotate); - } - - if (!(p->flags & INFO_HAS_USER_BBOX)) { - p->flags &= ~INFO_DO_CLIP; /* no clipping needed */ - } - - return error; -} - -int -spc_util_read_dimtrns (struct spc_env *spe, transform_info *ti, struct spc_arg *args, long *page_no, int syntax) -{ - ASSERT(ti && spe && args); - - if (syntax) { - ASSERT(!page_no); - return spc_read_dimtrns_dvips(spe, ti, args); - } else { - return spc_read_dimtrns_pdfm (spe, ti, args, page_no); - } - - return -1; -} - - -/* Color names */ -#ifdef rgb -#undef rgb -#endif -#ifdef cmyk -#undef cmyk -#endif -#define gray(g) {1, {g}} -#define rgb8(r,g,b) {3, {((r)/255.0), ((g)/255.0), ((b)/255.0), 0.0}} -#define cmyk(c,m,y,k) {4, {(c), (m), (y), (k)}} - -static struct colordef_ -{ - const char *key; - pdf_color color; -} colordefs[] = { - {"GreenYellow", cmyk(0.15, 0.00, 0.69, 0.00)}, - {"Yellow", cmyk(0.00, 0.00, 1.00, 0.00)}, - {"Goldenrod", cmyk(0.00, 0.10, 0.84, 0.00)}, - {"Dandelion", cmyk(0.00, 0.29, 0.84, 0.00)}, - {"Apricot", cmyk(0.00, 0.32, 0.52, 0.00)}, - {"Peach", cmyk(0.00, 0.50, 0.70, 0.00)}, - {"Melon", cmyk(0.00, 0.46, 0.50, 0.00)}, - {"YellowOrange", cmyk(0.00, 0.42, 1.00, 0.00)}, - {"Orange", cmyk(0.00, 0.61, 0.87, 0.00)}, - {"BurntOrange", cmyk(0.00, 0.51, 1.00, 0.00)}, - {"Bittersweet", cmyk(0.00, 0.75, 1.00, 0.24)}, - {"RedOrange", cmyk(0.00, 0.77, 0.87, 0.00)}, - {"Mahogany", cmyk(0.00, 0.85, 0.87, 0.35)}, - {"Maroon", cmyk(0.00, 0.87, 0.68, 0.32)}, - {"BrickRed", cmyk(0.00, 0.89, 0.94, 0.28)}, - {"Red", cmyk(0.00, 1.00, 1.00, 0.00)}, - {"OrangeRed", cmyk(0.00, 1.00, 0.50, 0.00)}, - {"RubineRed", cmyk(0.00, 1.00, 0.13, 0.00)}, - {"WildStrawberry", cmyk(0.00, 0.96, 0.39, 0.00)}, - {"Salmon", cmyk(0.00, 0.53, 0.38, 0.00)}, - {"CarnationPink", cmyk(0.00, 0.63, 0.00, 0.00)}, - {"Magenta", cmyk(0.00, 1.00, 0.00, 0.00)}, - {"VioletRed", cmyk(0.00, 0.81, 0.00, 0.00)}, - {"Rhodamine", cmyk(0.00, 0.82, 0.00, 0.00)}, - {"Mulberry", cmyk(0.34, 0.90, 0.00, 0.02)}, - {"RedViolet", cmyk(0.07, 0.90, 0.00, 0.34)}, - {"Fuchsia", cmyk(0.47, 0.91, 0.00, 0.08)}, - {"Lavender", cmyk(0.00, 0.48, 0.00, 0.00)}, - {"Thistle", cmyk(0.12, 0.59, 0.00, 0.00)}, - {"Orchid", cmyk(0.32, 0.64, 0.00, 0.00)}, - {"DarkOrchid", cmyk(0.40, 0.80, 0.20, 0.00)}, - {"Purple", cmyk(0.45, 0.86, 0.00, 0.00)}, - {"Plum", cmyk(0.50, 1.00, 0.00, 0.00)}, - {"Violet", cmyk(0.79, 0.88, 0.00, 0.00)}, - {"RoyalPurple", cmyk(0.75, 0.90, 0.00, 0.00)}, - {"BlueViolet", cmyk(0.86, 0.91, 0.00, 0.04)}, - {"Periwinkle", cmyk(0.57, 0.55, 0.00, 0.00)}, - {"CadetBlue", cmyk(0.62, 0.57, 0.23, 0.00)}, - {"CornflowerBlue", cmyk(0.65, 0.13, 0.00, 0.00)}, - {"MidnightBlue", cmyk(0.98, 0.13, 0.00, 0.43)}, - {"NavyBlue", cmyk(0.94, 0.54, 0.00, 0.00)}, - {"RoyalBlue", cmyk(1.00, 0.50, 0.00, 0.00)}, - {"Blue", cmyk(1.00, 1.00, 0.00, 0.00)}, - {"Cerulean", cmyk(0.94, 0.11, 0.00, 0.00)}, - {"Cyan", cmyk(1.00, 0.00, 0.00, 0.00)}, - {"ProcessBlue", cmyk(0.96, 0.00, 0.00, 0.00)}, - {"SkyBlue", cmyk(0.62, 0.00, 0.12, 0.00)}, - {"Turquoise", cmyk(0.85, 0.00, 0.20, 0.00)}, - {"TealBlue", cmyk(0.86, 0.00, 0.34, 0.02)}, - {"Aquamarine", cmyk(0.82, 0.00, 0.30, 0.00)}, - {"BlueGreen", cmyk(0.85, 0.00, 0.33, 0.00)}, - {"Emerald", cmyk(1.00, 0.00, 0.50, 0.00)}, - {"JungleGreen", cmyk(0.99, 0.00, 0.52, 0.00)}, - {"SeaGreen", cmyk(0.69, 0.00, 0.50, 0.00)}, - {"Green", cmyk(1.00, 0.00, 1.00, 0.00)}, - {"ForestGreen", cmyk(0.91, 0.00, 0.88, 0.12)}, - {"PineGreen", cmyk(0.92, 0.00, 0.59, 0.25)}, - {"LimeGreen", cmyk(0.50, 0.00, 1.00, 0.00)}, - {"YellowGreen", cmyk(0.44, 0.00, 0.74, 0.00)}, - {"SpringGreen", cmyk(0.26, 0.00, 0.76, 0.00)}, - {"OliveGreen", cmyk(0.64, 0.00, 0.95, 0.40)}, - {"RawSienna", cmyk(0.00, 0.72, 1.00, 0.45)}, - {"Sepia", cmyk(0.00, 0.83, 1.00, 0.70)}, - {"Brown", cmyk(0.00, 0.81, 1.00, 0.60)}, - {"Tan", cmyk(0.14, 0.42, 0.56, 0.00)}, - /* Adobe Reader 7 and 8 had problem when gray and cmyk black colors - * are mixed. No problem with Previewer.app. - * It happens when \usepackage[dvipdfm]{graphicx} and then called - * \usepackage{color} without dvipdfm option. */ - {"Gray", gray(0.5)}, - {"Black", gray(0.0)}, - {"White", gray(1.0)}, - {NULL} -}; - - -static int -pdf_color_namedcolor (pdf_color *color, const char *name) -{ - int i; - for (i = 0; colordefs[i].key; i++) { - if (!strcmp(colordefs[i].key, name)) { - pdf_color_copycolor(color, &colordefs[i].color); - return 0; - } - } - return -1; -} - diff --git a/Build/source/texk/dvipdfm-x/xsrc/spc_util.h b/Build/source/texk/dvipdfm-x/xsrc/spc_util.h deleted file mode 100644 index db5b16cf245..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/spc_util.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - Copyright (C) 1998, 1999 by Mark A. Wicks - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -#ifndef _SPC_UTIL_H_ -#define _SPC_UTIL_H_ - -#include "pdfcolor.h" -#include "pdfdev.h" - -#include "specials.h" - -/* syntax 1: ((rgb|cmyk|hsb|gray) colorvalues)|colorname - * syntax 0: pdf_number|pdf_array - * - * This is for reading *single* color specification. - */ -extern int spc_util_read_colorspec (struct spc_env *spe, pdf_color *colorspec, struct spc_arg *args, int syntax); -extern int spc_util_read_dimtrns (struct spc_env *spe, transform_info *dimtrns, struct spc_arg *args, long *page, int syntax); -extern int spc_util_read_length (struct spc_env *spe, double *length, struct spc_arg *ap); - -extern int spc_util_read_numbers (double *values, int num_values, struct spc_env *spe, struct spc_arg *args); - -#endif /* _SPC_UTIL_H_ */ diff --git a/Build/source/texk/dvipdfm-x/xsrc/tt_glyf.c b/Build/source/texk/dvipdfm-x/xsrc/tt_glyf.c deleted file mode 100644 index da0c3aa2d09..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/tt_glyf.c +++ /dev/null @@ -1,673 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -/* - * Subsetting glyf, updating loca, hmtx, ... - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxutil.h" - -#include "sfnt.h" -#include "tt_table.h" -#include "tt_glyf.h" - -#define NUM_GLYPH_LIMIT 65534 -#define TABLE_DATA_ALLOC_SIZE 40960 -#define GLYPH_ARRAY_ALLOC_SIZE 256 - -static USHORT -find_empty_slot (struct tt_glyphs *g) -{ - USHORT gid; - - ASSERT(g); - - for (gid = 0; gid < NUM_GLYPH_LIMIT; gid++) { - if (!(g->used_slot[gid/8] & (1 << (7 - (gid % 8))))) - break; - } - if (gid == NUM_GLYPH_LIMIT) - ERROR("No empty glyph slot available."); - - return gid; -} - -USHORT -tt_find_glyph (struct tt_glyphs *g, USHORT gid) -{ - USHORT idx, new_gid = 0; - - ASSERT(g); - - for (idx = 0; idx < g->num_glyphs; idx++) { - if (gid == g->gd[idx].ogid) { - new_gid = g->gd[idx].gid; - break; - } - } - - return new_gid; -} - -USHORT -tt_get_index (struct tt_glyphs *g, USHORT gid) -{ - USHORT idx; - - ASSERT(g); - - for (idx = 0; idx < g->num_glyphs; idx++) { - if (gid == g->gd[idx].gid) - break; - } - if (idx == g->num_glyphs) - idx = 0; - - return idx; -} - -USHORT -tt_add_glyph (struct tt_glyphs *g, USHORT gid, USHORT new_gid) -{ - ASSERT(g); - - if (g->used_slot[new_gid/8] & (1 << (7 - (new_gid % 8)))) { - WARN("Slot %u already used.", new_gid); - } else { - if (g->num_glyphs+1 >= NUM_GLYPH_LIMIT) - ERROR("Too many glyphs."); - - if (g->num_glyphs >= g->max_glyphs) { - g->max_glyphs += GLYPH_ARRAY_ALLOC_SIZE; - g->gd = RENEW(g->gd, g->max_glyphs, struct tt_glyph_desc); - } - g->gd[g->num_glyphs].gid = new_gid; - g->gd[g->num_glyphs].ogid = gid; - g->gd[g->num_glyphs].length = 0; - g->gd[g->num_glyphs].data = NULL; - g->used_slot[new_gid/8] |= (1 << (7 - (new_gid % 8))); - g->num_glyphs += 1; - } - - if (new_gid > g->last_gid) { - g->last_gid = new_gid; - } - - return new_gid; -} - -/* - * Initialization - */ -struct tt_glyphs * -tt_build_init (void) -{ - struct tt_glyphs *g; - - g = NEW(1, struct tt_glyphs); - - g->num_glyphs = 0; - g->max_glyphs = 0; - g->last_gid = 0; - g->emsize = 1; - g->default_advh = 0; - g->default_tsb = 0; - g->gd = NULL; - g->used_slot = NEW(8192, unsigned char); - memset(g->used_slot, 0, 8192); - tt_add_glyph(g, 0, 0); - - return g; -} - -void -tt_build_finish (struct tt_glyphs *g) -{ - if (g) { - if (g->gd) { - USHORT idx; - for (idx = 0; idx < g->num_glyphs; idx++) { - if (g->gd[idx].data) - RELEASE(g->gd[idx].data); - } - RELEASE(g->gd); - } - if (g->used_slot) - RELEASE(g->used_slot); - RELEASE(g); - } -} - -static int CDECL -glyf_cmp (const void *v1, const void *v2) -{ - int cmp = 0; - const struct tt_glyph_desc *sv1, *sv2; - - sv1 = (const struct tt_glyph_desc *) v1; - sv2 = (const struct tt_glyph_desc *) v2; - - if (sv1->gid == sv2->gid) - cmp = 0; - else if (sv1->gid < sv2->gid) - cmp = -1; - else - cmp = 1; - - return cmp; -} - -/* - * TrueType outline data. - */ -#define ARG_1_AND_2_ARE_WORDS (1 << 0) -#define ARGS_ARE_XY_VALUES (1 << 1) -#define ROUND_XY_TO_GRID (1 << 2) -#define WE_HAVE_A_SCALE (1 << 3) -#define RESERVED (1 << 4) -#define MORE_COMPONENT (1 << 5) -#define WE_HAVE_AN_X_AND_Y_SCALE (1 << 6) -#define WE_HAVE_A_TWO_BY_TWO (1 << 7) -#define WE_HAVE_INSTRUCTIONS (1 << 8) -#define USE_MY_METRICS (1 << 9) - -int -tt_build_tables (sfnt *sfont, struct tt_glyphs *g) -{ - char *hmtx_table_data = NULL, *loca_table_data = NULL; - char *glyf_table_data = NULL; - ULONG hmtx_table_size, loca_table_size, glyf_table_size; - /* some information available from other TrueType table */ - struct tt_head_table *head = NULL; - struct tt_hhea_table *hhea = NULL; - struct tt_maxp_table *maxp = NULL; - struct tt_longMetrics *hmtx, *vmtx = NULL; - struct tt_os2__table *os2; - /* temp */ - ULONG *location, offset; - long i; - USHORT *w_stat; /* Estimate most frequently appeared width */ - - ASSERT(g); - - if (sfont == NULL || -#ifdef XETEX - sfont->ft_face == NULL -#else - sfont->stream == NULL -#endif - ) - ERROR("File not opened."); - - if (sfont->type != SFNT_TYPE_TRUETYPE && - sfont->type != SFNT_TYPE_TTC && - sfont->type != SFNT_TYPE_DFONT) - ERROR("Invalid font type"); - - if (g->num_glyphs > NUM_GLYPH_LIMIT) - ERROR("Too many glyphs."); - - /* - * Read head, hhea, maxp, loca: - * - * unitsPerEm --> head - * numHMetrics --> hhea - * indexToLocFormat --> head - * numGlyphs --> maxp - */ - head = tt_read_head_table(sfont); - hhea = tt_read_hhea_table(sfont); - maxp = tt_read_maxp_table(sfont); - - if (hhea->metricDataFormat != 0) - ERROR("Unknown metricDataFormat."); - - g->emsize = head->unitsPerEm; - - sfnt_locate_table(sfont, "hmtx"); - hmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, hhea->numOfLongHorMetrics, hhea->numOfExSideBearings); - - os2 = tt_read_os2__table(sfont); - if (os2) { - g->default_advh = os2->sTypoAscender - os2->sTypoDescender; - g->default_tsb = g->default_advh - os2->sTypoAscender; - } - - if (sfnt_find_table_pos(sfont, "vmtx") > 0) { - struct tt_vhea_table *vhea; - vhea = tt_read_vhea_table(sfont); - sfnt_locate_table(sfont, "vmtx"); - vmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, vhea->numOfLongVerMetrics, vhea->numOfExSideBearings); - RELEASE(vhea); - } else { - vmtx = NULL; - } - - sfnt_locate_table(sfont, "loca"); - location = NEW(maxp->numGlyphs + 1, ULONG); - if (head->indexToLocFormat == 0) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = 2*((ULONG) sfnt_get_ushort(sfont)); - } else if (head->indexToLocFormat == 1) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = sfnt_get_ulong(sfont); - } else { - ERROR("Unknown IndexToLocFormat."); - } - - w_stat = NEW(g->emsize+2, USHORT); - memset(w_stat, 0, sizeof(USHORT)*(g->emsize+2)); - /* - * Read glyf table. - */ - offset = sfnt_locate_table(sfont, "glyf"); - /* - * The num_glyphs may grow when composite glyph is found. - * A component of glyph refered by a composite glyph is appended - * to used_glyphs if it is not already registered in used_glyphs. - * Glyph programs of composite glyphs are modified so that it - * correctly refer to new gid of their components. - */ - for (i = 0; i < NUM_GLYPH_LIMIT; i++) { - USHORT gid; /* old gid */ - ULONG loc, len; - BYTE *p, *endptr; - SHORT number_of_contours; - - if (i >= g->num_glyphs) /* finished */ - break; - - gid = g->gd[i].ogid; - if (gid >= maxp->numGlyphs) - ERROR("Invalid glyph index (gid %u)", gid); - - loc = location[gid]; - len = location[gid+1] - loc; - g->gd[i].advw = hmtx[gid].advance; - g->gd[i].lsb = hmtx[gid].sideBearing; - if (vmtx) { - g->gd[i].advh = vmtx[gid].advance; - g->gd[i].tsb = vmtx[gid].sideBearing; - } else { - g->gd[i].advh = g->default_advh; - g->gd[i].tsb = g->default_tsb; - } - g->gd[i].length = len; - g->gd[i].data = NULL; - if (g->gd[i].advw <= g->emsize) { - w_stat[g->gd[i].advw] += 1; - } else { - w_stat[g->emsize+1] += 1; /* larger than em */ - } - - if (len == 0) { /* Does not contains any data. */ - continue; - } else if (len < 10) { - ERROR("Invalid TrueType glyph data (gid %u).", gid); - } - - g->gd[i].data = p = NEW(len, BYTE); - endptr = p + len; - - sfnt_seek_set(sfont, offset+loc); - number_of_contours = sfnt_get_short(sfont); - p += sfnt_put_short(p, number_of_contours); - - /* BoundingBox: FWord x 4 */ - g->gd[i].llx = sfnt_get_short(sfont); - g->gd[i].lly = sfnt_get_short(sfont); - g->gd[i].urx = sfnt_get_short(sfont); - g->gd[i].ury = sfnt_get_short(sfont); - /* _FIXME_ */ -#if 1 - if (!vmtx) /* vertOriginY == sTypeAscender */ - g->gd[i].tsb = g->default_advh - g->default_tsb - g->gd[i].ury; -#endif - p += sfnt_put_short(p, g->gd[i].llx); - p += sfnt_put_short(p, g->gd[i].lly); - p += sfnt_put_short(p, g->gd[i].urx); - p += sfnt_put_short(p, g->gd[i].ury); - - /* Read evrything else. */ - sfnt_read(p, len - 10, sfont); - /* - * Fix GIDs of composite glyphs. - */ - if (number_of_contours < 0) { - USHORT flags, cgid, new_gid; /* flag, gid of a component */ - do { - if (p >= endptr) - ERROR("Invalid TrueType glyph data (gid %u): %u bytes", gid, len); - /* - * Flags and gid of component glyph are both USHORT. - */ - flags = ((*p) << 8)| *(p+1); - p += 2; - cgid = ((*p) << 8)| *(p+1); - if (cgid >= maxp->numGlyphs) { - ERROR("Invalid gid (%u > %u) in composite glyph %u.", cgid, maxp->numGlyphs, gid); - } - new_gid = tt_find_glyph(g, cgid); - if (new_gid == 0) { - new_gid = tt_add_glyph(g, cgid, find_empty_slot(g)); - } - p += sfnt_put_ushort(p, new_gid); - /* - * Just skip remaining part. - */ - p += (flags & ARG_1_AND_2_ARE_WORDS) ? 4 : 2; - if (flags & WE_HAVE_A_SCALE) /* F2Dot14 */ - p += 2; - else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) /* F2Dot14 x 2 */ - p += 4; - else if (flags & WE_HAVE_A_TWO_BY_TWO) /* F2Dot14 x 4 */ - p += 8; - } while (flags & MORE_COMPONENT); - /* - * TrueType instructions comes here: - * length_of_instruction (ushort) - * instruction (byte * length_of_instruction) - */ - } - } - RELEASE(location); - RELEASE(hmtx); - if (vmtx) - RELEASE(vmtx); - - { - int max_count = -1; - - g->dw = g->gd[0].advw; - for (i = 0; i < g->emsize + 1; i++) { - if (w_stat[i] > max_count) { - max_count = w_stat[i]; - g->dw = i; - } - } - } - RELEASE(w_stat); - - qsort(g->gd, g->num_glyphs, sizeof(struct tt_glyph_desc), glyf_cmp); - { - USHORT prev, last_advw; - char *p, *q; - int padlen, num_hm_known; - - glyf_table_size = 0UL; - num_hm_known = 0; - last_advw = g->gd[g->num_glyphs - 1].advw; - for (i = g->num_glyphs - 1; i >= 0; i--) { - padlen = (g->gd[i].length % 4) ? (4 - (g->gd[i].length % 4)) : 0; - glyf_table_size += g->gd[i].length + padlen; - if (!num_hm_known && last_advw != g->gd[i].advw) { - hhea->numOfLongHorMetrics = g->gd[i].gid + 2; - num_hm_known = 1; - } - } - /* All advance widths are same. */ - if (!num_hm_known) { - hhea->numOfLongHorMetrics = 1; - } - hmtx_table_size = hhea->numOfLongHorMetrics * 2 + (g->last_gid + 1) * 2; - - /* - * Choosing short format does not always give good result - * when compressed. Sometimes increases size. - */ - if (glyf_table_size < 0x20000UL) { - head->indexToLocFormat = 0; - loca_table_size = (g->last_gid + 2)*2; - } else { - head->indexToLocFormat = 1; - loca_table_size = (g->last_gid + 2)*4; - } - - hmtx_table_data = p = NEW(hmtx_table_size, char); - loca_table_data = q = NEW(loca_table_size, char); - glyf_table_data = NEW(glyf_table_size, char); - - offset = 0UL; prev = 0; - for (i = 0; i < g->num_glyphs; i++) { - long gap, j; - gap = (long) g->gd[i].gid - prev - 1; - for (j = 1; j <= gap; j++) { - if (prev + j == hhea->numOfLongHorMetrics - 1) { - p += sfnt_put_ushort(p, last_advw); - } else if (prev + j < hhea->numOfLongHorMetrics) { - p += sfnt_put_ushort(p, 0); - } - p += sfnt_put_short (p, 0); - if (head->indexToLocFormat == 0) { - q += sfnt_put_ushort(q, (USHORT) (offset/2)); - } else { - q += sfnt_put_ulong(q, offset); - } - } - padlen = (g->gd[i].length % 4) ? (4 - (g->gd[i].length % 4)) : 0; - if (g->gd[i].gid < hhea->numOfLongHorMetrics) { - p += sfnt_put_ushort(p, g->gd[i].advw); - } - p += sfnt_put_short (p, g->gd[i].lsb); - if (head->indexToLocFormat == 0) { - q += sfnt_put_ushort(q, (USHORT) (offset/2)); - } else { - q += sfnt_put_ulong(q, offset); - } - memset(glyf_table_data + offset, 0, g->gd[i].length + padlen); - memcpy(glyf_table_data + offset, g->gd[i].data, g->gd[i].length); - offset += g->gd[i].length + padlen; - prev = g->gd[i].gid; - /* free data here since it consume much memory */ - RELEASE(g->gd[i].data); - g->gd[i].length = 0; g->gd[i].data = NULL; - } - if (head->indexToLocFormat == 0) { - q += sfnt_put_ushort(q, (USHORT) (offset/2)); - } else { - q += sfnt_put_ulong(q, offset); - } - - sfnt_set_table(sfont, "hmtx", (char *) hmtx_table_data, hmtx_table_size); - sfnt_set_table(sfont, "loca", (char *) loca_table_data, loca_table_size); - sfnt_set_table(sfont, "glyf", (char *) glyf_table_data, glyf_table_size); - } - - head->checkSumAdjustment = 0; - maxp->numGlyphs = g->last_gid + 1; - - /* TODO */ - sfnt_set_table(sfont, "maxp", tt_pack_maxp_table(maxp), TT_MAXP_TABLE_SIZE); - sfnt_set_table(sfont, "hhea", tt_pack_hhea_table(hhea), TT_HHEA_TABLE_SIZE); - sfnt_set_table(sfont, "head", tt_pack_head_table(head), TT_HEAD_TABLE_SIZE); - RELEASE(maxp); - RELEASE(hhea); - RELEASE(head); - if (os2) - RELEASE(os2); - - return 0; -} - -int -tt_get_metrics (sfnt *sfont, struct tt_glyphs *g) -{ - struct tt_head_table *head = NULL; - struct tt_hhea_table *hhea = NULL; - struct tt_maxp_table *maxp = NULL; - struct tt_longMetrics *hmtx, *vmtx = NULL; - struct tt_os2__table *os2; - /* temp */ - ULONG *location, offset; - long i; - USHORT *w_stat; - - ASSERT(g); - - if (sfont == NULL || -#ifdef XETEX - sfont->ft_face == NULL -#else - sfont->stream == NULL -#endif - ) - ERROR("File not opened."); - - if (sfont->type != SFNT_TYPE_TRUETYPE && - sfont->type != SFNT_TYPE_TTC && - sfont->type != SFNT_TYPE_DFONT) - ERROR("Invalid font type"); - - /* - * Read head, hhea, maxp, loca: - * - * unitsPerEm --> head - * numHMetrics --> hhea - * indexToLocFormat --> head - * numGlyphs --> maxp - */ - head = tt_read_head_table(sfont); - hhea = tt_read_hhea_table(sfont); - maxp = tt_read_maxp_table(sfont); - - if (hhea->metricDataFormat != 0) - ERROR("Unknown metricDataFormat."); - - g->emsize = head->unitsPerEm; - - sfnt_locate_table(sfont, "hmtx"); - hmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, hhea->numOfLongHorMetrics, hhea->numOfExSideBearings); - - os2 = tt_read_os2__table(sfont); - g->default_advh = os2->sTypoAscender - os2->sTypoDescender; - g->default_tsb = g->default_advh - os2->sTypoAscender; - - if (sfnt_find_table_pos(sfont, "vmtx") > 0) { - struct tt_vhea_table *vhea; - vhea = tt_read_vhea_table(sfont); - sfnt_locate_table(sfont, "vmtx"); - vmtx = tt_read_longMetrics(sfont, maxp->numGlyphs, vhea->numOfLongVerMetrics, vhea->numOfExSideBearings); - RELEASE(vhea); - } else { - vmtx = NULL; - } - - sfnt_locate_table(sfont, "loca"); - location = NEW(maxp->numGlyphs + 1, ULONG); - if (head->indexToLocFormat == 0) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = 2*((ULONG) sfnt_get_ushort(sfont)); - } else if (head->indexToLocFormat == 1) { - for (i = 0; i <= maxp->numGlyphs; i++) - location[i] = sfnt_get_ulong(sfont); - } else { - ERROR("Unknown IndexToLocFormat."); - } - - w_stat = NEW(g->emsize+2, USHORT); - memset(w_stat, 0, sizeof(USHORT)*(g->emsize+2)); - /* - * Read glyf table. - */ - offset = sfnt_locate_table(sfont, "glyf"); - for (i = 0; i < g->num_glyphs; i++) { - USHORT gid; /* old gid */ - ULONG loc, len; - - gid = g->gd[i].ogid; - if (gid >= maxp->numGlyphs) - ERROR("Invalid glyph index (gid %u)", gid); - - loc = location[gid]; - len = location[gid+1] - loc; - g->gd[i].advw = hmtx[gid].advance; - g->gd[i].lsb = hmtx[gid].sideBearing; - if (vmtx) { - g->gd[i].advh = vmtx[gid].advance; - g->gd[i].tsb = vmtx[gid].sideBearing; - } else { - g->gd[i].advh = g->default_advh; - g->gd[i].tsb = g->default_tsb; - } - g->gd[i].length = len; - g->gd[i].data = NULL; - - if (g->gd[i].advw <= g->emsize) { - w_stat[g->gd[i].advw] += 1; - } else { - w_stat[g->emsize+1] += 1; /* larger than em */ - } - - if (len == 0) { /* Does not contains any data. */ - continue; - } else if (len < 10) { - ERROR("Invalid TrueType glyph data (gid %u).", gid); - } - - sfnt_seek_set(sfont, offset+loc); - (void) sfnt_get_short(sfont); - - /* BoundingBox: FWord x 4 */ - g->gd[i].llx = sfnt_get_short(sfont); - g->gd[i].lly = sfnt_get_short(sfont); - g->gd[i].urx = sfnt_get_short(sfont); - g->gd[i].ury = sfnt_get_short(sfont); - /* _FIXME_ */ -#if 1 - if (!vmtx) /* vertOriginY == sTypeAscender */ - g->gd[i].tsb = g->default_advh - g->default_tsb - g->gd[i].ury; -#endif - } - RELEASE(location); - RELEASE(hmtx); - RELEASE(maxp); - RELEASE(hhea); - RELEASE(head); - RELEASE(os2); - - if (vmtx) - RELEASE(vmtx); - - { - int max_count = -1; - - g->dw = g->gd[0].advw; - for (i = 0; i < g->emsize + 1; i++) { - if (w_stat[i] > max_count) { - max_count = w_stat[i]; - g->dw = i; - } - } - } - RELEASE(w_stat); - - - return 0; -} diff --git a/Build/source/texk/dvipdfm-x/xsrc/type0.c b/Build/source/texk/dvipdfm-x/xsrc/type0.c deleted file mode 100644 index 1a004fb9f7e..00000000000 --- a/Build/source/texk/dvipdfm-x/xsrc/type0.c +++ /dev/null @@ -1,687 +0,0 @@ -/* - - This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - - Copyright (C) 2002-2012 by Jin-Hwan Cho and Shunsaku Hirata, - the dvipdfmx project team. - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -*/ - -/* - * Type0 font support: - * - * TODO: - * - * Composite font (multiple descendants) - not supported in PDF - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -#include "system.h" -#include "mem.h" -#include "error.h" -#include "dpxfile.h" - -#include "pdfobj.h" -#include "fontmap.h" - -#include "cmap.h" -#include "cid.h" - -#include "type0.h" - - -#define TYPE0FONT_DEBUG_STR "Type0" -#define TYPE0FONT_DEBUG 3 - -static int __verbose = 0; - -static pdf_obj *pdf_read_ToUnicode_file (const char *cmap_name); - -void -Type0Font_set_verbose(void) -{ - __verbose++; -} - -/* - * used_chars: - * - * Single bit is used for each CIDs since used_chars can be reused as a - * stream content of CIDSet by doing so. See, cid.h for add_to_used() and - * is_used(). - */ - -static char * -new_used_chars2(void) -{ - char *used_chars; - - used_chars = NEW(8192, char); - memset(used_chars, 0, 8192); - - return used_chars; -} - -#define FLAG_NONE 0 -#define FLAG_USED_CHARS_SHARED (1 << 0) - -struct Type0Font { - char *fontname; /* BaseFont */ - char *encoding; /* "Identity-H" or "Identity-V" (not ID) */ - char *used_chars; /* Used chars (CIDs) */ - - /* - * Type0 only - */ - CIDFont *descendant; /* Only single descendant is allowed. */ - int flags; - int wmode; - - /* - * PDF Font Resource - */ - pdf_obj *indirect; - pdf_obj *fontdict; - pdf_obj *descriptor; /* MUST BE NULL */ -}; - -static void -Type0Font_init_font_struct (Type0Font *font) -{ - ASSERT(font); - - font->fontname = NULL; - font->fontdict = NULL; - font->indirect = NULL; - font->descriptor = NULL; - font->encoding = NULL; - font->used_chars = NULL; - font->descendant = NULL; - font->wmode = -1; - font->flags = FLAG_NONE; - - return; -} - -static void -Type0Font_clean (Type0Font *font) -{ - if (font) { - if (font->fontdict) - ERROR("%s: Object not flushed.", TYPE0FONT_DEBUG_STR); - if (font->indirect) - ERROR("%s: Object not flushed.", TYPE0FONT_DEBUG_STR); - if (font->descriptor) - ERROR("%s: FontDescriptor unexpected for Type0 font.", TYPE0FONT_DEBUG_STR); - if (!(font->flags & FLAG_USED_CHARS_SHARED) && font->used_chars) - RELEASE(font->used_chars); - if (font->encoding) - RELEASE(font->encoding); - if (font->fontname) - RELEASE(font->fontname); - font->fontdict = NULL; - font->indirect = NULL; - font->descriptor = NULL; - font->used_chars = NULL; - font->encoding = NULL; - font->fontname = NULL; - } -} - -/* PLEASE FIX THIS */ -#include "tt_cmap.h" - -static void -add_ToUnicode (Type0Font *font) -{ - pdf_obj *tounicode; - CIDFont *cidfont; - CIDSysInfo *csi; - char *cmap_name, *fontname; - - /* - * ToUnicode CMap: - * - * ToUnicode CMaps are usually not required for standard character - * collections such as Adobe-Japan1. Identity-H is used for UCS - * ordering CID-keyed fonts. External resource must be loaded for - * others. - */ - - cidfont = font->descendant; - if (!cidfont) { - ERROR("%s: No descendant CID-keyed font.", TYPE0FONT_DEBUG_STR); - return; - } - - if (CIDFont_is_ACCFont(cidfont)) { - /* No need to embed ToUnicode */ - return; - } else if (CIDFont_is_UCSFont(cidfont)) { - /* - * Old version of dvipdfmx mistakenly used Adobe-Identity as Unicode. - */ - tounicode = pdf_read_ToUnicode_file("Adobe-Identity-UCS2"); - if (!tounicode) { /* This should work */ - tounicode = pdf_new_name("Identity-H"); - } - pdf_add_dict(font->fontdict, pdf_new_name("ToUnicode"), tounicode); - return; - } - - tounicode = NULL; - csi = CIDFont_get_CIDSysInfo(cidfont); - fontname = CIDFont_get_fontname(cidfont); - if (CIDFont_get_embedding(cidfont)) { - fontname += 7; /* FIXME */ - } - - if (!strcmp(csi->registry, "Adobe") && - !strcmp(csi->ordering, "Identity")) { - switch (CIDFont_get_subtype(cidfont)) { - case CIDFONT_TYPE2: - /* PLEASE FIX THIS */ - tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont), - CIDFont_get_opt_index(cidfont), - CIDFont_get_ft_face(cidfont), - Type0Font_get_usedchars(font)); - break; - default: - if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1C)) { /* FIXME */ - tounicode = otf_create_ToUnicode_stream(CIDFont_get_ident(cidfont), - CIDFont_get_opt_index(cidfont), - CIDFont_get_ft_face(cidfont), - Type0Font_get_usedchars(font)); - } else if (CIDFont_get_flag(cidfont, CIDFONT_FLAG_TYPE1)) { /* FIXME */ - /* Font loader will create ToUnicode and set. */ - return; - } else { - cmap_name = NEW(strlen(fontname) + 7, char); - sprintf(cmap_name, "%s-UTF16", fontname); - tounicode = pdf_read_ToUnicode_file(cmap_name); - if (!tounicode) { - sprintf(cmap_name, "%s-UCS2", fontname); - tounicode = pdf_read_ToUnicode_file(cmap_name); - } - RELEASE(cmap_name); - } - break; - } - } else { - cmap_name = NEW(strlen(csi->registry)+strlen(csi->ordering)+8, char); - sprintf(cmap_name, "%s-%s-UTF16", csi->registry, csi->ordering); - tounicode = pdf_read_ToUnicode_file(cmap_name); - if (!tounicode) { - sprintf(cmap_name, "%s-%s-UCS2", csi->registry, csi->ordering); - tounicode = pdf_read_ToUnicode_file(cmap_name); - } - RELEASE(cmap_name); - } - - if (tounicode) { - pdf_add_dict(font->fontdict, - pdf_new_name("ToUnicode"), tounicode); - } else { - WARN("Failed to load ToUnicode CMap for font \"%s\"", fontname); - } - - return; -} - -void -Type0Font_set_ToUnicode (Type0Font *font, pdf_obj *cmap_ref) -{ - ASSERT(font); - - pdf_add_dict(font->fontdict, - pdf_new_name("ToUnicode"), cmap_ref); -} - -static void -Type0Font_dofont (Type0Font *font) -{ - if (!font || !font->indirect) - return; - - if (!pdf_lookup_dict(font->fontdict, "ToUnicode")) { /* FIXME */ - add_ToUnicode(font); - } -} - -static void -Type0Font_flush (Type0Font *font) -{ - if (font) { - if (font->fontdict) - pdf_release_obj(font->fontdict); - font->fontdict = NULL; - if (font->indirect) - pdf_release_obj(font->indirect); - font->indirect = NULL; - if (font->descriptor) - ERROR("%s: FontDescriptor unexpected for Type0 font.", TYPE0FONT_DEBUG_STR); - font->descriptor = NULL; - } -} - -int -Type0Font_get_wmode (Type0Font *font) -{ - ASSERT(font); - - return font->wmode; -} - -#if 0 -char * -Type0Font_get_encoding (Type0Font *font) -{ - ASSERT(font); - - return font->encoding; -} -#endif /* 0 */ - -char * -Type0Font_get_usedchars (Type0Font *font) -{ - ASSERT(font); - - return font->used_chars; -} - -pdf_obj * -Type0Font_get_resource (Type0Font *font) -{ - ASSERT(font); - - /* - * This looks somewhat strange. - */ - if (!font->indirect) { - pdf_obj *array; - - array = pdf_new_array(); - pdf_add_array(array, CIDFont_get_resource(font->descendant)); - pdf_add_dict(font->fontdict, pdf_new_name("DescendantFonts"), array); - font->indirect = pdf_ref_obj(font->fontdict); - } - - return pdf_link_obj(font->indirect); -} - -/******************************** CACHE ********************************/ - -#define CHECK_ID(n) do {\ - if ((n) < 0 || (n) >= __cache.count)\ - ERROR("%s: Invalid ID %d", TYPE0FONT_DEBUG_STR, (n));\ -} while (0) - -#define CACHE_ALLOC_SIZE 16u - -static struct font_cache { - int count; - int capacity; - Type0Font *fonts; -} __cache = { - 0, 0, NULL -}; - -void -Type0Font_cache_init (void) -{ - if (__cache.fonts) - ERROR("%s: Already initialized.", TYPE0FONT_DEBUG_STR); - __cache.count = 0; - __cache.capacity = 0; - __cache.fonts = NULL; -} - -Type0Font * -Type0Font_cache_get (int id) -{ - CHECK_ID(id); - - return &__cache.fonts[id]; -} - -#ifdef XETEX -unsigned short* -Type0Font_get_ft_to_gid(int id) -{ - return CIDFont_get_ft_to_gid(Type0Font_cache_get(id)->descendant); -} -#endif - -int -Type0Font_cache_find (const char *map_name, int cmap_id, fontmap_opt *fmap_opt) -{ - int font_id = -1; - Type0Font *font; - CIDFont *cidfont; - CMap *cmap; - CIDSysInfo *csi; - char *fontname = NULL; - int cid_id = -1, parent_id = -1, wmode = 0; - int pdf_ver; - - pdf_ver = pdf_get_version(); - if (!map_name || cmap_id < 0 || pdf_ver < 2) - return -1; - - /* - * Encoding is Identity-H or Identity-V according as thier WMode value. - * - * We do not use match against the map_name since fonts (TrueType) covers - * characters across multiple character collection (eg, Adobe-Japan1 and - * Adobe-Japan2) must be splited into multiple CID-keyed fonts. - */ - - cmap = CMap_cache_get(cmap_id); - csi = (CMap_is_Identity(cmap)) ? NULL : CMap_get_CIDSysInfo(cmap) ; - - cid_id = CIDFont_cache_find(map_name, csi, fmap_opt); - - if (cid_id < 0) - return -1; - - /* - * The descendant CID-keyed font has already been registerd. - * If CID-keyed font with ID = cid_id is new font, then create new parent - * Type 0 font. Otherwise, there already exists parent Type 0 font and - * then we find him and return his ID. We must check against their WMode. - */ - - cidfont = CIDFont_cache_get(cid_id); - wmode = CMap_get_wmode(cmap); - - /* Does CID-keyed font already have parent ? */ - parent_id = CIDFont_get_parent_id(cidfont, wmode); - if (parent_id >= 0) - return parent_id; /* If so, we don't need new one. */ - - /* - * CIDFont does not have parent or his parent's WMode does not matched with - * wmode. Create new Type0 font. - */ - - if (__cache.count >= __cache.capacity) { - __cache.capacity += CACHE_ALLOC_SIZE; - __cache.fonts = RENEW(__cache.fonts, __cache.capacity, struct Type0Font); - } - font_id = __cache.count; - font = &__cache.fonts[font_id]; - - Type0Font_init_font_struct(font); - - /* - * All CJK double-byte characters are mapped so that resulting - * character codes coincide with CIDs of given character collection. - * So, the Encoding is always Identity-H for horizontal fonts or - * Identity-V for vertical fonts. - */ - if (wmode) { - font->encoding = NEW(strlen("Identity-V")+1, char); - strcpy(font->encoding, "Identity-V"); - } else { - font->encoding = NEW(strlen("Identity-H")+1, char); - strcpy(font->encoding, "Identity-H"); - } - font->wmode = wmode; - - /* - * Now we start font dictionary. - */ - font->fontdict = pdf_new_dict(); - pdf_add_dict(font->fontdict, pdf_new_name ("Type"), pdf_new_name ("Font")); - pdf_add_dict(font->fontdict, pdf_new_name ("Subtype"), pdf_new_name ("Type0")); - - /* - * Type0 font does not have FontDescriptor because it is not a simple font. - * Instead, DescendantFonts appears here. - * - * Up to PDF version 1.5, Type0 font must have single descendant font which - * is a CID-keyed font. Future PDF spec. will allow multiple desecendant - * fonts. - */ - font->descendant = cidfont; - CIDFont_attach_parent(cidfont, font_id, wmode); - - /* - * PostScript Font name: - * - * Type0 font's fontname is usually descendant CID-keyed font's font name - * appended by -ENCODING. - */ - fontname = CIDFont_get_fontname(cidfont); - - if (__verbose) { - if (CIDFont_get_embedding(cidfont) && strlen(fontname) > 7) - MESG("(CID:%s)", fontname+7); /* skip XXXXXX+ */ - else - MESG("(CID:%s)", fontname); - } - - /* - * The difference between CID-keyed font and TrueType font appears here. - * - * Glyph substitution for vertical writing is done in CMap mapping process - * for CID-keyed fonts. But we must rely on OpenType layout table in the - * case of TrueType fonts. So, we must use different used_chars for each - * horizontal and vertical fonts in that case. - * - * In most PDF file, encoding name is not appended to fontname for Type0 - * fonts having CIDFontType 2 font as their descendant. - */ - - font->used_chars = NULL; - font->flags = FLAG_NONE; - - switch (CIDFont_get_subtype(cidfont)) { - case CIDFONT_TYPE0: - font->fontname = NEW(strlen(fontname)+strlen(font->encoding)+2, char); - sprintf(font->fontname, "%s-%s", fontname, font->encoding); - pdf_add_dict(font->fontdict, - pdf_new_name("BaseFont"), pdf_new_name(font->fontname)); - /* - * Need used_chars to write W, W2. - */ - if ((parent_id = CIDFont_get_parent_id(cidfont, wmode ? 0 : 1)) < 0) - font->used_chars = new_used_chars2(); - else { - /* Don't allocate new one. */ - font->used_chars = Type0Font_get_usedchars(Type0Font_cache_get(parent_id)); - font->flags |= FLAG_USED_CHARS_SHARED; - } - break; - case CIDFONT_TYPE2: - /* - * TrueType: - * - * Use different used_chars for H and V. - */ - pdf_add_dict(font->fontdict, - pdf_new_name("BaseFont"), pdf_new_name(fontname)); - font->used_chars = new_used_chars2(); - break; - default: - ERROR("Unrecognized CIDFont Type"); - break; - } - - pdf_add_dict(font->fontdict, - pdf_new_name("Encoding"), pdf_new_name(font->encoding)); - - __cache.count++; - - return font_id; -} - -void -Type0Font_cache_close (void) -{ - int font_id; - - /* - * This need to be fixed. - * - * CIDFont_cache_close() before Type0Font_release because of used_chars. - * ToUnicode support want descendant CIDFont's CSI and fontname. - */ - if (__cache.fonts) { - for (font_id = 0; font_id < __cache.count; font_id++) - Type0Font_dofont(&__cache.fonts[font_id]); - } - CIDFont_cache_close(); - if (__cache.fonts) { - for (font_id = 0; font_id < __cache.count; font_id++) { - Type0Font_flush(&__cache.fonts[font_id]); - Type0Font_clean(&__cache.fonts[font_id]); - } - RELEASE(__cache.fonts); - } - __cache.fonts = NULL; - __cache.count = 0; - __cache.capacity = 0; -} - - -/************************************************************************/ - -int -pdf_font_findfont0 (const char *font_name, int cmap_id, fontmap_opt *fmap_opt) -{ - return Type0Font_cache_find(font_name, cmap_id, fmap_opt); -} - -/******************************** COMPAT ********************************/ - -#ifndef WITHOUT_COMPAT - -#include "cmap_read.h" -#include "cmap_write.h" -#include "pdfresource.h" -#include "pdfencoding.h" - -static pdf_obj * -create_dummy_CMap (void) -{ - pdf_obj *stream; - char buf[32]; - int i, n; - -#define CMAP_PART0 "\ -%!PS-Adobe-3.0 Resource-CMap\n\ -%%DocumentNeededResources: ProcSet (CIDInit)\n\ -%%IncludeResource: ProcSet (CIDInit)\n\ -%%BeginResource: CMap (Adobe-Identity-UCS2)\n\ -%%Title: (Adobe-Identity-UCS2 Adobe UCS2 0)\n\ -%%Version: 1.0\n\ -%%Copyright:\n\ -%% ---\n\ -%%EndComments\n\n\ -" -#define CMAP_PART1 "\ -/CIDInit /ProcSet findresource begin\n\ -\n\ -12 dict begin\n\nbegincmap\n\n\ -/CIDSystemInfo 3 dict dup begin\n\ - /Registry (Adobe) def\n\ - /Ordering (UCS2) def\n\ - /Supplement 0 def\n\ -end def\n\n\ -/CMapName /Adobe-Identity-UCS2 def\n\ -/CMapVersion 1.0 def\n\ -/CMapType 2 def\n\n\ -2 begincodespacerange\n\ -<0000> \n\ -endcodespacerange\n\ -" -#define CMAP_PART3 "\ -endcmap\n\n\ -CMapName currentdict /CMap defineresource pop\n\n\ -end\nend\n\n\ -%%EndResource\n\ -%%EOF\n\ -" - - stream = pdf_new_stream(STREAM_COMPRESS); - pdf_add_stream(stream, CMAP_PART0, strlen(CMAP_PART0)); - pdf_add_stream(stream, CMAP_PART1, strlen(CMAP_PART1)); - pdf_add_stream(stream, "\n100 beginbfrange\n", strlen("\n100 beginbfrange\n")); - for (i = 0; i < 0x64; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); - - pdf_add_stream(stream, "\n100 beginbfrange\n", strlen("\n100 beginbfrange\n")); - for (i = 0x64; i < 0xc8; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); - - pdf_add_stream(stream, "\n48 beginbfrange\n", strlen("\n48 beginbfrange\n")); - for (i = 0xc8; i <= 0xd7; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - for (i = 0xe0; i <= 0xff; i++) { - n = sprintf(buf, - "<%02X00> <%02XFF> <%02X00>\n", i, i, i); - pdf_add_stream(stream, buf, n); - } - pdf_add_stream(stream, "endbfrange\n\n", strlen("endbfrange\n\n")); - - pdf_add_stream(stream, CMAP_PART3, strlen(CMAP_PART3)); - - return stream; -} - -static pdf_obj * -pdf_read_ToUnicode_file (const char *cmap_name) -{ - pdf_obj *stream; - long res_id = -1; - - ASSERT(cmap_name); - - res_id = pdf_findresource("CMap", cmap_name); - if (res_id < 0) { - if (!strcmp(cmap_name, "Adobe-Identity-UCS2")) - stream = create_dummy_CMap(); - else { - stream = pdf_load_ToUnicode_stream(cmap_name); - } - if (stream) { - res_id = pdf_defineresource("CMap", - cmap_name, - stream, PDF_RES_FLUSH_IMMEDIATE); - } - } - - return (res_id < 0 ? NULL : pdf_get_resource_reference(res_id)); -} -#endif /* !WITHOUT_COMPAT */ diff --git a/Build/source/texk/dvipdfm-x/xsrc/type1c.c b/Build/source/texk/dvipdfm-x/xsrc/type1c.c index 1fd55fb8de6..7a51b8f15c4 100644 --- a/Build/source/texk/dvipdfm-x/xsrc/type1c.c +++ b/Build/source/texk/dvipdfm-x/xsrc/type1c.c @@ -70,6 +70,9 @@ int pdf_font_open_type1c (pdf_font *font) { char *fontname; +#ifndef XETEX + char *ident; +#endif FILE *fp = NULL; sfnt *sfont; cff_font *cffont; @@ -79,6 +82,9 @@ pdf_font_open_type1c (pdf_font *font) ASSERT(font); +#ifndef XETEX + ident = +#endif pdf_font_get_ident (font); encoding_id = pdf_font_get_encoding(font); -- cgit v1.2.3