diff options
author | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-03-25 17:11:25 +0000 |
---|---|---|
committer | Peter Breitenlohner <peb@mppmu.mpg.de> | 2009-03-25 17:11:25 +0000 |
commit | c3aa727616be1f519f319d40b5402bdd87d9d235 (patch) | |
tree | e3eef395462a4e82fa2ab346cd2dc04ac323cec5 /Build/source/texk | |
parent | 14fdf58582eb34614c899048041260830bf11319 (diff) |
new build system: more dvipng
git-svn-id: svn://tug.org/texlive/trunk@12516 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk')
27 files changed, 4626 insertions, 179 deletions
diff --git a/Build/source/texk/dvipng/ChangeLog.TL b/Build/source/texk/dvipng/ChangeLog.TL index 6aa463544ca..a81bf678d82 100644 --- a/Build/source/texk/dvipng/ChangeLog.TL +++ b/Build/source/texk/dvipng/ChangeLog.TL @@ -1,5 +1,15 @@ Changes for teTeX / TeX Live. +2009-03-25 Peter Breitenlohner <peb@mppmu.mpg.de> + + * color.c-1.12, dvipng.h-1.12, fontmap.c-1.12, + ft.c-1.12, misc.c-1.12, pk.c-1.12, set.c-1.12, + t1.c-1.12, tfm.c-1.12 (all new): Original files. + + * color.c, dvipng.h, fontmap.c, ft.c, misc.c, pk.c, set.c, + t1.c, tfm.c: "#if HAVE_ALLOCA_H" => "#ifdef HAVE_ALLOCA_H" + and similar, to avoid preprocessor warnings. + 2009-03-24 Peter Breitenlohner <peb@mppmu.mpg.de> * Imported release 1.12 from savannah.nongnu.org. diff --git a/Build/source/texk/dvipng/Makefile.am b/Build/source/texk/dvipng/Makefile.am index 77d6759f969..5c65a7fa2c3 100644 --- a/Build/source/texk/dvipng/Makefile.am +++ b/Build/source/texk/dvipng/Makefile.am @@ -26,7 +26,7 @@ # #************************************************************************ ## -ACLOCAL_AMFLAGS = -I ../../m4 +ACLOCAL_AMFLAGS = -I ../../m4 -I m4 INCLUDES = $(KPATHSEA_INCLUDES) $(FREETYPE2_INCLUDES) $(GD_INCLUDES) INCLUDES += $(T1LIB_INCLUDES) $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) @@ -50,6 +50,18 @@ dvipng_SOURCES = \ special.c \ vf.c +if have_t1 +dvipng_SOURCES += t1.c +endif have_t1 + +if have_ft2 +dvipng_SOURCES += ft.c sfd.c +endif have_ft2 + +if have_ft2_or_t1 +dvipng_SOURCES += enc.c fontmap.c tfm.c +endif have_ft2_or_t1 + dvipng_DEPENDENCIES = $(KPATHSEA_DEPEND) $(FREETYPE2_DEPEND) $(GD_DEPEND) dvipng_DEPENDENCIES += $(T1LIB_DEPEND) $(LIBPNG_DEPEND) $(ZLIB_DEPEND) @@ -71,6 +83,19 @@ LDADD += $(T1LIB_LIBS) $(LIBPNG_LIBS) $(ZLIB_LIBS) dist_man1_MANS = dvipng.1 +if have_gif + +install-exec-hook: + cd $(DESTDIR)/$(bindir) && rm -f dvigif && $(LN_S) dvipng dvigif + +install-data-hook: + cd $(DESTDIR)/$(man1dir) && rm -f dvigif.1 && $(LN_S) dvipng.1 dvigif.1 + +uninstall-hook: + rm -f $(DESTDIR)/$(bindir)/dvigif $(DESTDIR)/$(man1dir)/dvigif.1 + +endif have_gif + ## Not yet used ## EXTRA_DIST = \ @@ -81,18 +106,12 @@ EXTRA_DIST = \ dvipng.help \ dvipng.info \ dvipng.texi \ - enc.c \ - fontmap.c \ - ft.c \ install.texi \ macros.texi \ miktex.h \ miktex.mak \ readme.texi \ - sfd.c \ - t1.c \ - test_dvipng.tex \ - tfm.c + test_dvipng.tex EXTRA_DIST += \ dvipng.dvi.orig \ @@ -104,10 +123,19 @@ EXTRA_DIST += \ EXTRA_DIST += \ Makefile.in-$(DVIPNG_VERSION) \ aclocal.m4-$(DVIPNG_VERSION) \ + color.c-$(DVIPNG_VERSION) \ config.h.in-$(DVIPNG_VERSION) \ configure-$(DVIPNG_VERSION) \ configure.ac-$(DVIPNG_VERSION) \ - special.c-$(DVIPNG_VERSION) + dvipng.h-$(DVIPNG_VERSION) \ + fontmap.c-$(DVIPNG_VERSION) \ + ft.c-$(DVIPNG_VERSION) \ + misc.c-$(DVIPNG_VERSION) \ + pk.c-$(DVIPNG_VERSION) \ + set.c-$(DVIPNG_VERSION) \ + special.c-$(DVIPNG_VERSION) \ + t1.c-$(DVIPNG_VERSION) \ + tfm.c-$(DVIPNG_VERSION) ## Eventually use these macro files ## diff --git a/Build/source/texk/dvipng/Makefile.in b/Build/source/texk/dvipng/Makefile.in index bdf90ed5157..8810b572655 100644 --- a/Build/source/texk/dvipng/Makefile.in +++ b/Build/source/texk/dvipng/Makefile.in @@ -33,6 +33,9 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ bin_PROGRAMS = dvipng$(EXEEXT) +@have_t1_TRUE@am__append_1 = t1.c +@have_ft2_TRUE@am__append_2 = ft.c sfd.c +@have_ft2_or_t1_TRUE@am__append_3 = enc.c fontmap.c tfm.c subdir = . DIST_COMMON = README $(am__configure_deps) $(dist_man1_MANS) \ $(srcdir)/../../build-aux/config.guess \ @@ -72,10 +75,18 @@ CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) +am__dvipng_SOURCES_DIST = color.c commands.h draw.c dvi.c dvipng.c \ + dvipng.h font.c misc.c papersiz.c pk.c ppagelist.c set.c \ + special.c vf.c t1.c ft.c sfd.c enc.c fontmap.c tfm.c +@have_t1_TRUE@am__objects_1 = t1.$(OBJEXT) +@have_ft2_TRUE@am__objects_2 = ft.$(OBJEXT) sfd.$(OBJEXT) +@have_ft2_or_t1_TRUE@am__objects_3 = enc.$(OBJEXT) fontmap.$(OBJEXT) \ +@have_ft2_or_t1_TRUE@ tfm.$(OBJEXT) am_dvipng_OBJECTS = color.$(OBJEXT) draw.$(OBJEXT) dvi.$(OBJEXT) \ dvipng.$(OBJEXT) font.$(OBJEXT) misc.$(OBJEXT) \ papersiz.$(OBJEXT) pk.$(OBJEXT) ppagelist.$(OBJEXT) \ - set.$(OBJEXT) special.$(OBJEXT) vf.$(OBJEXT) + set.$(OBJEXT) special.$(OBJEXT) vf.$(OBJEXT) $(am__objects_1) \ + $(am__objects_2) $(am__objects_3) dvipng_OBJECTS = $(am_dvipng_OBJECTS) dvipng_LDADD = $(LDADD) am__DEPENDENCIES_1 = @@ -92,7 +103,7 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ $(LDFLAGS) -o $@ SOURCES = $(dvipng_SOURCES) -DIST_SOURCES = $(dvipng_SOURCES) +DIST_SOURCES = $(am__dvipng_SOURCES_DIST) man1dir = $(mandir)/man1 NROFF = nroff MANS = $(dist_man1_MANS) @@ -268,39 +279,30 @@ top_srcdir = @top_srcdir@ # All settings here are our fault, don't blame the dvipng maintainer for it. # #************************************************************************ -ACLOCAL_AMFLAGS = -I ../../m4 +ACLOCAL_AMFLAGS = -I ../../m4 -I m4 INCLUDES = $(KPATHSEA_INCLUDES) $(FREETYPE2_INCLUDES) $(GD_INCLUDES) \ $(T1LIB_INCLUDES) $(LIBPNG_INCLUDES) $(ZLIB_INCLUDES) AM_CPPFLAGS = -dvipng_SOURCES = \ - color.c \ - commands.h \ - draw.c \ - dvi.c \ - dvipng.c \ - dvipng.h \ - font.c \ - misc.c \ - papersiz.c \ - pk.c \ - ppagelist.c \ - set.c \ - special.c \ - vf.c - +dvipng_SOURCES = color.c commands.h draw.c dvi.c dvipng.c dvipng.h \ + font.c misc.c papersiz.c pk.c ppagelist.c set.c special.c vf.c \ + $(am__append_1) $(am__append_2) $(am__append_3) dvipng_DEPENDENCIES = $(KPATHSEA_DEPEND) $(FREETYPE2_DEPEND) \ $(GD_DEPEND) $(T1LIB_DEPEND) $(LIBPNG_DEPEND) $(ZLIB_DEPEND) LDADD = $(KPATHSEA_LIBS) $(FREETYPE2_LIBS) $(GD_LIBS) $(T1LIB_LIBS) \ $(LIBPNG_LIBS) $(ZLIB_LIBS) dist_man1_MANS = dvipng.1 EXTRA_DIST = ChangeLog.0 ChangeLog.TL RELEASE dvipng.dvi dvipng.help \ - dvipng.info dvipng.texi enc.c fontmap.c ft.c install.texi \ - macros.texi miktex.h miktex.mak readme.texi sfd.c t1.c \ - test_dvipng.tex tfm.c dvipng.dvi.orig dvipng.help.orig \ - dvipng.info.orig Makefile.in-$(DVIPNG_VERSION) \ - aclocal.m4-$(DVIPNG_VERSION) config.h.in-$(DVIPNG_VERSION) \ + dvipng.info dvipng.texi install.texi macros.texi miktex.h \ + miktex.mak readme.texi test_dvipng.tex dvipng.dvi.orig \ + dvipng.help.orig dvipng.info.orig \ + Makefile.in-$(DVIPNG_VERSION) aclocal.m4-$(DVIPNG_VERSION) \ + color.c-$(DVIPNG_VERSION) config.h.in-$(DVIPNG_VERSION) \ configure-$(DVIPNG_VERSION) configure.ac-$(DVIPNG_VERSION) \ - special.c-$(DVIPNG_VERSION) m4/gs-device.m4 m4/makeinfo.m4 \ + dvipng.h-$(DVIPNG_VERSION) fontmap.c-$(DVIPNG_VERSION) \ + ft.c-$(DVIPNG_VERSION) misc.c-$(DVIPNG_VERSION) \ + pk.c-$(DVIPNG_VERSION) set.c-$(DVIPNG_VERSION) \ + special.c-$(DVIPNG_VERSION) t1.c-$(DVIPNG_VERSION) \ + tfm.c-$(DVIPNG_VERSION) m4/gs-device.m4 m4/makeinfo.m4 \ Makefile.in.orig acinclude.m4.orig configure.ac.orig \ Makefile.am.demo Makefile.in.work configure.ac.demo \ configure.ac.work @@ -401,13 +403,19 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/draw.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvi.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dvipng.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fontmap.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/papersiz.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pk.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ppagelist.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/set.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sfd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/special.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/t1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vf.Po@am__quote@ .c.o: @@ -682,6 +690,9 @@ distclean-generic: maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." +@have_gif_FALSE@install-exec-hook: +@have_gif_FALSE@install-data-hook: +@have_gif_FALSE@uninstall-hook: clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am @@ -704,10 +715,14 @@ info: info-am info-am: install-data-am: install-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-data-hook install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am @@ -742,10 +757,13 @@ ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-man + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) uninstall-hook uninstall-man: uninstall-man1 -.MAKE: install-am install-strip +.MAKE: install-am install-data-am install-exec-am install-strip \ + uninstall-am .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool ctags dist \ @@ -754,15 +772,16 @@ uninstall-man: uninstall-man1 distclean-generic distclean-hdr distclean-libtool \ distclean-tags distcleancheck distdir distuninstallcheck dvi \ dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ - uninstall-am uninstall-binPROGRAMS uninstall-man \ + install-binPROGRAMS install-data install-data-am \ + install-data-hook install-dvi install-dvi-am install-exec \ + install-exec-am install-exec-hook install-html install-html-am \ + install-info install-info-am install-man install-man1 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS uninstall-hook uninstall-man \ uninstall-man1 @@ -772,6 +791,15 @@ uninstall-man: uninstall-man1 @T1LIB_RULE@ @LIBPNG_RULE@ @ZLIB_RULE@ + +@have_gif_TRUE@install-exec-hook: +@have_gif_TRUE@ cd $(DESTDIR)/$(bindir) && rm -f dvigif && $(LN_S) dvipng dvigif + +@have_gif_TRUE@install-data-hook: +@have_gif_TRUE@ cd $(DESTDIR)/$(man1dir) && rm -f dvigif.1 && $(LN_S) dvipng.1 dvigif.1 + +@have_gif_TRUE@uninstall-hook: +@have_gif_TRUE@ rm -f $(DESTDIR)/$(bindir)/dvigif $(DESTDIR)/$(man1dir)/dvigif.1 # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: diff --git a/Build/source/texk/dvipng/Makefile.in.work b/Build/source/texk/dvipng/Makefile.in.work index 158e92efb2a..0319f984460 100644 --- a/Build/source/texk/dvipng/Makefile.in.work +++ b/Build/source/texk/dvipng/Makefile.in.work @@ -1,28 +1,10 @@ #************************************************************************ -PACKAGE_STRING="@PACKAGE_STRING@" - CC = @CC@ CFLAGS = @CFLAGS@ -Wall CPPFLAGS = @CPPFLAGS@ -I. LN_S = @LN_S@ -LIBS = @LIBS@ -LDFLAGS = @LDFLAGS@ - -srcdir = @srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -infodir = @infodir@ -mandir = @mandir@ -DESTDIR= -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -MKINSTALLDIRS = $(srcdir)/mkinstalldirs - MAKEINFO=@MAKEINFO@ @MAKEINFO_MACROS@ INSTALL_INFO=@INSTALL_INFO@ TEX=tex @@ -31,12 +13,8 @@ TEXIHTML=texi2html DVIPS=dvips TEXIFILES = dvipng.texi readme.texi install.texi macros.texi dvipng.help -objects = set.o special.o vf.o @PSFONTS_O@ - all: dvipng docs -install: @INSTALL_BIN_TARGET@ @INSTALL_BIN_TARGET@-docs - ####################################### The program dvipng: $(objects) @@ -44,13 +22,6 @@ dvipng: $(objects) $(objects): dvipng.h commands.h config.h -install-dvipng: dvipng - -$(MKINSTALLDIRS) $(DESTDIR)$(bindir) - $(INSTALL) dvipng $(DESTDIR)$(bindir) - -install-dvigif: install-dvipng - (cd $(DESTDIR)$(bindir) && rm -f dvigif && $(LN_S) dvipng dvigif) - ####################################### The documentation docs: dvipng.dvi dvipng.info @@ -89,13 +60,6 @@ install-docs: docs $(INSTALL_DATA) $$x $(DESTDIR)$(infodir) ; \ done -$(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) dvipng.info - -$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man1 - $(INSTALL_DATA) $(srcdir)/dvipng.1 $(DESTDIR)$(mandir)/man1 - -install-dvipng-docs: install-docs - -install-dvigif-docs: install-docs - (cd $(DESTDIR)$(mandir)/man1 && rm -f dvigif.1 && $(LN_S) dvipng.1 dvigif.1) ####################################### The test @@ -106,18 +70,6 @@ test: test_dvipng.dvi dvipng test_dvipng.dvi: test_dvipng.tex latex $(srcdir)/test_dvipng.tex -####################################### The cleaning up - -clean: - rm -f *.o dvipng *.help *.info* *dvipng.dvi *.aux *.log - rm -f *dvipng.ps *.cp *.fn *.ky *~ \#*\# \ - *.tp *.vr *.pg *.toc *.tp *.bak *.cps *.kys *.tps \ - *.fns *.vrs *.pgs *.html *.tmp - -distclean: clean - rm -f Makefile - rm -f config.status config.log config.cache c-auto.h - ####################################### Maintainer targets INSTALL: install.texi diff --git a/Build/source/texk/dvipng/color.c b/Build/source/texk/dvipng/color.c index a4cf484ae82..5d3a23ab37b 100644 --- a/Build/source/texk/dvipng/color.c +++ b/Build/source/texk/dvipng/color.c @@ -23,7 +23,7 @@ ************************************************************************/ #include "dvipng.h" -#if HAVE_ALLOCA_H +#ifdef HAVE_ALLOCA_H # include <alloca.h> #endif diff --git a/Build/source/texk/dvipng/color.c-1.12 b/Build/source/texk/dvipng/color.c-1.12 new file mode 100644 index 00000000000..a4cf484ae82 --- /dev/null +++ b/Build/source/texk/dvipng/color.c-1.12 @@ -0,0 +1,436 @@ +/* color.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +/* + * Color. We delete and recreate the gdImage for each new page. This + * means that the stack must contain rgb value not color index. + * Besides, the current antialiasing implementation needs rgb anyway. +*/ + +struct colorname { + struct colorname *next; + char* color; + char name[1]; +} *colornamep=NULL,*xcp=NULL; + +char *colordef[]={"xcolor.sty","dvipsnam.def", + "svgnam.def","x11nam.def",NULL}; +char *xcpname=NULL; + +void initcolor() +{ + csp = 1; + cstack[0].red=255; + cstack[0].green=255; + cstack[0].blue=255; + cstack[1].red=0; + cstack[1].green=0; + cstack[1].blue=0; +} + +struct colorname * NewColor(char* prefix, int nprefix, + char* name, int nname, + char* model, int nmodel, + char* values, int nvalues) +{ + struct colorname *tmp = + malloc(sizeof(struct colorname)+3+nprefix+nname+nmodel+nvalues); + if (tmp==NULL) + Fatal("Cannot allocate space for color name"); + tmp->color=tmp->name+nprefix+nname+1; + strncpy(tmp->name,prefix,nprefix); + strncpy(tmp->name+nprefix,name,nname); + tmp->name[nprefix+nname]='\0'; + strncpy(tmp->color,model,nmodel); + tmp->color[nmodel]=' '; + strncpy(tmp->color+nmodel+1,values,nvalues); + tmp->color[nmodel+nvalues+1]='\0'; + model=tmp->color; + while(*model!='\0') { + if (*model==',') + *model=' '; + model++; + } + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR NAME:\t'%s' '%s'", + tmp->name,tmp->color)); + return(tmp); +} + +#define FINDWORD(s) while(s<max && \ + (*s=='{'||*s==' '||*s=='%'||*s=='\n'||*s==';')) s++ +#define FINDARG(s) while(s<max && *s!='{') s++; FINDWORD(s) +#define FINDMODELEND(s,n) n=0; while(s<max && *s!='}' && *s!='/') { s++; n++; } +#define FINDNAMEEND(s,n) n=0; while(s<max && *s!='}' && *s!=',') { s++; n++; } +#define FINDVALEND(s,n) n=0; while(s<max && *s!='}' && *s!='/' && *s!=';') { s++; n++; } +#define FINDLASTVALEND(s) while(s<max && *s!='}' && *s!=';') s++ +#define FINDPSNAMEEND(s,n) n=0; while(s<max && *s!='{') { s++; n++; } +#define BLANKCOMMAS(s) + +struct colorname* LoadColornameFile(char* filename) +{ + struct colorname *list=NULL,*tmp=NULL; + char *filepath,*pos,*max; + char *prefix="",*name,*values,*model; + int nprefix=0,nname,nvalues,nmodel; + struct filemmap fmmap; + + TEMPSTR(filepath,kpse_find_file(filename,kpse_tex_format,false)); + if (filepath == NULL) + return NULL; + DEBUG_PRINT(DEBUG_COLOR,("\n OPEN COLOR NAMES:\t'%s'", filepath)); + if (MmapFile(filepath,&fmmap)) return NULL; + pos=fmmap.data; + max=fmmap.data+fmmap.size; + while (pos<max && *pos!='\\') pos++; + while(pos+9<max && strncmp(pos,"\\endinput",9)!=0) { + if ((pos+20<max && strncmp(pos,"\\def\\colornameprefix",20)==0) + || (pos+32<max + && strncmp(pos,"\\providecommand*\\colornameprefix",32)==0)) { + DEBUG_PRINT(DEBUG_COLOR,("\n \t'%.20s'", pos)); + FINDARG(pos); + prefix=pos; + FINDNAMEEND(pos,nprefix); + DEBUG_PRINT(DEBUG_COLOR,("\n \tCOLOR PREFIX '%.*s'",nprefix,prefix)); + } else if (pos+17<max && strncmp(pos,"\\DefineNamedColor",17)==0) { + DEBUG_PRINT(DEBUG_COLOR,("\n \t'%.17s'", pos)); + model=NULL; + nname=nmodel=nvalues=0; + FINDARG(pos); /* skip first argument */ + FINDARG(pos); /* find second argument: color name */ + name=pos; + FINDNAMEEND(pos,nname); + FINDARG(pos); /* find third argument: color model */ + model=pos; + FINDMODELEND(pos,nmodel); + FINDARG(pos); /* find fourth argument: color values */ + values=pos; + FINDVALEND(pos,nvalues); + tmp=NewColor(prefix,nprefix,name,nname,model,nmodel,values,nvalues); + tmp->next=list; + list=tmp; + } else if ((pos+15<max && strncmp(pos,"\\definecolorset",15)==0) + || (pos+16<max && strncmp(pos,"\\preparecolorset",16)==0)) { + char *model; + DEBUG_PRINT(DEBUG_COLOR,("\n \t'%.15s'", pos)); + FINDARG(pos); /* find first argument: color model */ + model=pos; + FINDMODELEND(pos,nmodel); + FINDARG(pos); /* skip second argument */ + FINDARG(pos); /* skip third argument */ + FINDARG(pos); /* find fourth argument: names, values */ + while(pos<max && *pos!='}'){ + name=pos; + FINDNAMEEND(pos,nname); + pos++; + values=pos; + FINDVALEND(pos,nvalues); + FINDLASTVALEND(pos); + tmp=NewColor(prefix,nprefix,name,nname,model,nmodel,values,nvalues); + tmp->next=list; + list=tmp; + FINDWORD(pos); + } + } else { + pos++; + while (pos<max && *pos!='\\') pos++; + } + } + UnMmapFile(&fmmap); + return(list); +} + +void ClearXColorPrologue(void) +{ + struct colorname *next; + while (xcp) { + next=xcp->next; + free(xcp); + xcp=next; + } + if (xcpname!=NULL) { + free(xcpname); + xcpname=NULL; + } +} + +void ClearColorNames(void) +{ + struct colorname *next; + while (colornamep) { + next=colornamep->next; + free(colornamep); + colornamep=next; + } + ClearXColorPrologue(); +} + +void InitXColorPrologue(char* name) +{ + ClearXColorPrologue(); + xcpname=malloc(strlen(name)+1); + if (xcpname==NULL) + Fatal("cannot malloc memory for xcolor prologue name"); + strcpy(xcpname,name); +} + +struct colorname* LoadXColorPrologue(void) +{ + struct colorname *list=NULL,*tmp=NULL; + char *filepath,*pos,*max; + char *prefix="",*name,*values,*model; + int nprefix=0,nname,nvalues,nmodel; + struct filemmap fmmap; + + TEMPSTR(filepath,kpse_find_file(xcpname,kpse_program_text_format,false)); + if (filepath == NULL) + return NULL; + DEBUG_PRINT(DEBUG_COLOR,("\n OPEN XCOLOR PROLOGUE:\t'%s'", filepath)); + if (MmapFile(filepath,&fmmap)) return NULL; + pos=fmmap.data; + max=fmmap.data+fmmap.size; + while(pos<max) { + while (pos<max && *pos!='/') pos++; + if (*pos=='/') { + nname=nmodel=nvalues=0; + name=++pos; /* first argument: color name */ + FINDPSNAMEEND(pos,nname); + values=++pos; /* second argument: color values */ + FINDVALEND(pos,nvalues); + model=pos+3; /* third argument: color model, prefixed by 'XC' */ + while(pos<max && *pos!=' ' && *pos!='\n') pos++; + nmodel=pos-model; + tmp=NewColor(prefix,nprefix,name,nname,model,nmodel,values,nvalues); + tmp->next=list; + list=tmp; + } + } + UnMmapFile(&fmmap); + return(list); +} + +#define FTO255(a) ((int) (255*a+0.5)) +#define WARN_IF_FAILED(a,b) if (a==b) { page_flags |= PAGE_GAVE_WARN; \ + Warning("missing color-specification value, treated as zero"); } + +#define SKIPSPACES(s) while(s && *s==' ' && *s!='\0') s++ +#define NEXTFLOAT255(c) FTO255(strtod(c,&end)); WARN_IF_FAILED(c,end); c=end +#define NEXTFLOAT(c) strtod(c,&end); WARN_IF_FAILED(c,end); c=end +#define NEXTINT(c) strtol(c,&end,10); WARN_IF_FAILED(c,end); c=end +#define NEXTHEX(c) strtol(c,&end,16); WARN_IF_FAILED(c,end); c=end + +void stringrgb(char* color,int *r,int *g,int *b) +{ + char* end; + static int unloaded=1; + + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR SPEC:\t'%s' (",color)); + SKIPSPACES(color); + if (strcmp(color,"Black")==0) { + *r = *g = *b = 0; + } else if (strcmp(color,"White")==0) { + *r = *g = *b = 255; + } else if (strncmp(color,"gray ",5)==0) { + color+=5; + *r = *g = *b = NEXTFLOAT255(color); + } else if (strncmp(color,"rgb ",4)==0) { + color+=4; + *r = NEXTFLOAT255(color); + *g = NEXTFLOAT255(color); + *b = NEXTFLOAT255(color); + } else if (strncmp(color,"Gray ",5)==0) { + color+=5; + *r = *g = *b = NEXTINT(color); + } else if (strncmp(color,"RGB ",4)==0) { + color+=4; + *r = NEXTINT(color); + *g = NEXTINT(color); + *b = NEXTINT(color); + } else if (strncmp(color,"HTML ",5)==0) { + color+=5; + *b = NEXTHEX(color); + *r = *b/65536; + *g = *b/256; + *b -= *g*256; + *g -= *r*256; + } else if (strncmp(color,"cmy ",4)==0 + || strncmp(color,"cmyk ",5)==0) { + int c,m,y,k; + color+=3; + k=(*color=='k'); + if (k) + color++; + c = NEXTFLOAT255(color); + m = NEXTFLOAT255(color); + y = NEXTFLOAT255(color); + if (k) + k = NEXTFLOAT255(color); + *r = c+k<255 ? 255-(c+k) : 0; + *g = m+k<255 ? 255-(m+k) : 0; + *b = y+k<255 ? 255-(y+k) : 0; + } else if (strncmp(color,"hsb ",4)==0 + || strncmp(color,"HSB ",4)==0) { + /* The hsb and HSB models really need more presicion. + Use double and convert back*/ + double hu,sa,br,f,R,G,B; + int i; + if (*color=='h') { + color+=4; + hu = NEXTFLOAT(color); + sa = NEXTFLOAT(color); + br = NEXTFLOAT(color); + } else { + color+=4; + hu = (float)NEXTINT(color); hu /= 255; + sa = (float)NEXTINT(color); sa /= 255; + br = (float)NEXTINT(color); br /= 255; + } + i=6*hu; + f=6*hu-i; + switch(i) { + case 0: + R = br*(1-sa*0); G = br*(1-sa*(1-f)); B = br*(1-sa*1); break; + case 1: + R = br*(1-sa*f); G = br*(1-sa*0); B = br*(1-sa*1); break; + case 2: + R = br*(1-sa*1); G = br*(1-sa*0); B = br*(1-sa*(1-f)); break; + case 3: + R = br*(1-sa*1); G = br*(1-sa*f); B = br*(1-sa*0); break; + case 4: + R = br*(1-sa*(1-f)); G = br*(1-sa*1); B = br*(1-sa*0); break; + case 5: + R = br*(1-sa*0); G = br*(1-sa*1); B = br*(1-sa*f); break; + default: + R = br*(1-sa*0); G = br*(1-sa*1); B = br*(1-sa*1); + } + *r=FTO255(R); + *g=FTO255(G); + *b=FTO255(B); + } else { + /* Model not found, probably a color name */ + struct colorname *tmp; + + if (xcp==NULL && xcpname!=NULL) + xcp=LoadXColorPrologue(); + tmp=xcp; + while(tmp!=NULL && strcmp(color,tmp->name)!=0) + tmp=tmp->next; + if (tmp==NULL) { + if (colornamep==NULL) + colornamep=LoadColornameFile(colordef[0]); + tmp=colornamep; + while((tmp->next!=NULL || colordef[unloaded]!=NULL) + && strcmp(color,tmp->name)!=0) { + if (tmp->next==NULL) + tmp->next=LoadColornameFile(colordef[unloaded++]); + tmp=tmp->next; + } + } + if (strcmp(color,tmp->name)==0) { + /* Found: one-level recursion */ + DEBUG_PRINT(DEBUG_COLOR,("\n ---RECURSION--- ")) + stringrgb(tmp->color,r,g,b); + } else { + /* Not found, warn */ + page_flags |= PAGE_GAVE_WARN; + Warning("unimplemented color specification '%s'",color); + } + } + DEBUG_PRINT(DEBUG_COLOR,("%d %d %d) ",*r,*g,*b)) +} + +void background(char* p) +{ + stringrgb(p, &cstack[0].red, &cstack[0].green, &cstack[0].blue); + DEBUG_PRINT(DEBUG_COLOR,("\n BACKGROUND:\t(%d %d %d) ", + cstack[0].red, cstack[0].green, cstack[0].blue)); +} + +void pushcolor(char * p) +{ + if ( ++csp == STACK_SIZE ) + Fatal("out of color stack space") ; + stringrgb(p, &cstack[csp].red, &cstack[csp].green, &cstack[csp].blue); + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR PUSH:\t(%d %d %d) ", + cstack[csp].red, cstack[csp].green, cstack[csp].blue)) +} + +void popcolor() +{ + if (csp > 1) csp--; /* Last color is global */ + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR POP\t")) +} + +void resetcolorstack(char * p) +{ + if ( csp > 1 ) + Warning("global color change within nested colors"); + csp=0; + pushcolor(p) ; + DEBUG_PRINT(DEBUG_COLOR,("\n RESET COLOR:\tbottom of stack:")) +} + +void StoreColorStack(struct page_list *tpagep) +{ + int i=0; + + DEBUG_PRINT(DEBUG_COLOR,("\n STORE COLOR STACK:\t %d ", csp)); + tpagep->csp=csp; + while ( i <= csp ) { + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR STACK:\t %d (%d %d %d) ",i, + cstack[i].red, cstack[i].green, cstack[i].blue)); + tpagep->cstack[i].red = cstack[i].red; + tpagep->cstack[i].green = cstack[i].green; + tpagep->cstack[i].blue = cstack[i].blue; + i++; + } +} + +void ReadColorStack(struct page_list *tpagep) +{ + int i=0; + + DEBUG_PRINT(DEBUG_COLOR,("\n READ COLOR STACK:\t %d ", tpagep->csp)); + csp=tpagep->csp; + while ( i <= tpagep->csp ) { + DEBUG_PRINT(DEBUG_COLOR,("\n COLOR STACK:\t %d (%d %d %d) ",i, + cstack[i].red, cstack[i].green, cstack[i].blue)); + cstack[i].red = tpagep->cstack[i].red; + cstack[i].green = tpagep->cstack[i].green; + cstack[i].blue = tpagep->cstack[i].blue; + i++; + } +} + +void StoreBackgroundColor(struct page_list *tpagep) +{ + /* Background color changes affect the _whole_ page */ + tpagep->cstack[0].red = cstack[0].red; + tpagep->cstack[0].green = cstack[0].green; + tpagep->cstack[0].blue = cstack[0].blue; +} diff --git a/Build/source/texk/dvipng/config.h.in b/Build/source/texk/dvipng/config.h.in index 8f5f542dafd..771c509968d 100644 --- a/Build/source/texk/dvipng/config.h.in +++ b/Build/source/texk/dvipng/config.h.in @@ -58,6 +58,9 @@ /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO +/* Define to 1 if you have freetype2. */ +#undef HAVE_FT2 + /* Define to 1 if you have the `FT_Library_Version' function. */ #undef HAVE_FT_LIBRARY_VERSION @@ -97,6 +100,9 @@ /* Define to 1 if you have the <kpathsea/kpathsea.h> header file. */ #undef HAVE_KPATHSEA_KPATHSEA_H +/* Define to 1 if your kpathsea has kpse_enc_format. */ +#undef HAVE_KPSE_ENC_FORMATS + /* Define to 1 if you have the `gd' library (-lgd). */ #undef HAVE_LIBGD @@ -106,6 +112,9 @@ /* Define to 1 if you have the `png' library (-lpng). */ #undef HAVE_LIBPNG +/* Define to 1 if you have the `t1' library (-lt1). */ +#undef HAVE_LIBT1 + /* Define to 1 if you have the `z' library (-lz). */ #undef HAVE_LIBZ @@ -287,6 +296,11 @@ /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES +/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>, + <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +#undef _UINT64_T + /* Define to empty if `const' does not conform to ANSI C. */ #undef const @@ -296,6 +310,10 @@ #undef inline #endif +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef int64_t + /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc @@ -305,5 +323,9 @@ /* Define to `unsigned int' if <sys/types.h> does not define. */ #undef size_t +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +#undef uint64_t + /* Define as `fork' if `vfork' does not work. */ #undef vfork diff --git a/Build/source/texk/dvipng/configure b/Build/source/texk/dvipng/configure index 099c7b5ce65..216e5a07218 100755 --- a/Build/source/texk/dvipng/configure +++ b/Build/source/texk/dvipng/configure @@ -788,6 +788,14 @@ ac_includes_default="\ ac_subst_vars='LTLIBOBJS DVIPNG_VERSION +have_gif_FALSE +have_gif_TRUE +have_ft2_or_t1_FALSE +have_ft2_or_t1_TRUE +have_ft2_FALSE +have_ft2_TRUE +have_t1_FALSE +have_t1_TRUE FREETYPE2_RULE FREETYPE2_DEPEND FREETYPE2_LIBS @@ -4227,13 +4235,13 @@ if test "${lt_cv_nm_interface+set}" = set; then else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4230: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4238: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4233: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4241: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4236: output\"" >&5) + (eval echo "\"\$as_me:4244: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" @@ -5439,7 +5447,7 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5442 "configure"' > conftest.$ac_ext + echo '#line 5450 "configure"' > conftest.$ac_ext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? @@ -7486,11 +7494,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7489: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7497: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7493: \$? = $ac_status" >&5 + echo "$as_me:7501: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7825,11 +7833,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7828: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7836: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7832: \$? = $ac_status" >&5 + echo "$as_me:7840: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7930,11 +7938,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7933: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7941: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7937: \$? = $ac_status" >&5 + echo "$as_me:7945: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7985,11 +7993,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7988: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7996: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7992: \$? = $ac_status" >&5 + echo "$as_me:8000: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -10785,7 +10793,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10788 "configure" +#line 10796 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10881,7 +10889,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10884 "configure" +#line 10892 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14074,6 +14082,199 @@ _ACEOF fi + { $as_echo "$as_me:$LINENO: checking for int64_t" >&5 +$as_echo_n "checking for int64_t... " >&6; } +if test "${ac_cv_c_int64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_int64_t=no + for ac_type in 'int64_t' 'int' 'long int' \ + 'long long int' 'short int' 'signed char'; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(0 < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 1) + < ($ac_type) (((($ac_type) 1 << (64 - 2)) - 1) * 2 + 2))]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + case $ac_type in + int64_t) ac_cv_c_int64_t=yes ;; + *) ac_cv_c_int64_t=$ac_type ;; +esac + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_int64_t" != no && break + done +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_int64_t" >&5 +$as_echo "$ac_cv_c_int64_t" >&6; } + case $ac_cv_c_int64_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<_ACEOF +#define int64_t $ac_cv_c_int64_t +_ACEOF +;; + esac + + + { $as_echo "$as_me:$LINENO: checking for uint64_t" >&5 +$as_echo_n "checking for uint64_t... " >&6; } +if test "${ac_cv_c_uint64_t+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_cv_c_uint64_t=no + for ac_type in 'uint64_t' 'unsigned int' 'unsigned long int' \ + 'unsigned long long int' 'unsigned short int' 'unsigned char'; do + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ +static int test_array [1 - 2 * !(($ac_type) -1 >> (64 - 1) == 1)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + case $ac_type in + uint64_t) ac_cv_c_uint64_t=yes ;; + *) ac_cv_c_uint64_t=$ac_type ;; +esac + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + test "$ac_cv_c_uint64_t" != no && break + done +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_uint64_t" >&5 +$as_echo "$ac_cv_c_uint64_t" >&6; } + case $ac_cv_c_uint64_t in #( + no|yes) ;; #( + *) + +cat >>confdefs.h <<\_ACEOF +#define _UINT64_T 1 +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define uint64_t $ac_cv_c_uint64_t +_ACEOF +;; + esac + + # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:$LINENO: checking for working alloca.h" >&5 @@ -17740,6 +17941,7 @@ ${top_builddir}/../../libs/freetype2/ft2build.h: fi + kpse_save_CPPFLAGS=$CPPFLAGS kpse_save_LIBS=$LIBS @@ -18145,13 +18347,291 @@ $as_echo "$as_me: error: cannot find/use libkpathsea" >&2;} fi +{ $as_echo "$as_me:$LINENO: checking whether kpathsea declares the kpse_opentype_format" >&5 +$as_echo_n "checking whether kpathsea declares the kpse_opentype_format... " >&6; } +if test "${kpse_cv_have_opentype_format+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <kpathsea/kpathsea.h> +int +main () +{ +kpse_opentype_format + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + kpse_cv_have_opentype_format=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + kpse_cv_have_opentype_format=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $kpse_cv_have_opentype_format" >&5 +$as_echo "$kpse_cv_have_opentype_format" >&6; } +if test "x$kpse_cv_have_opentype_format" = xyes; then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_KPSE_ENC_FORMATS 1 +_ACEOF + +fi + + CPPFLAGS="$CPPFLAGS $T1LIB_INCLUDES" LIBS="$T1LIB_LIBS $LIBS" +{ $as_echo "$as_me:$LINENO: checking for T1_InitLib" >&5 +$as_echo_n "checking for T1_InitLib... " >&6; } +if test "${ac_cv_func_T1_InitLib+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define T1_InitLib to an innocuous variant, in case <limits.h> declares T1_InitLib. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define T1_InitLib innocuous_T1_InitLib + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char T1_InitLib (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef T1_InitLib + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char T1_InitLib (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_T1_InitLib || defined __stub___T1_InitLib +choke me +#endif + +int +main () +{ +return T1_InitLib (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_T1_InitLib=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_T1_InitLib=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_T1_InitLib" >&5 +$as_echo "$ac_cv_func_T1_InitLib" >&6; } +if test "x$ac_cv_func_T1_InitLib" = x""yes; then + have_ft2_or_t1=yes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_LIBT1 1 +_ACEOF + +else + have_ft2_or_t1=no +fi + + if test "x$ac_cv_func_T1_InitLib" = xyes; then + have_t1_TRUE= + have_t1_FALSE='#' +else + have_t1_TRUE='#' + have_t1_FALSE= +fi + CPPFLAGS="$CPPFLAGS $FREETYPE2_INCLUDES" LIBS="$FREETYPE2_LIBS $LIBS" +{ $as_echo "$as_me:$LINENO: checking for FT_Init_FreeType" >&5 +$as_echo_n "checking for FT_Init_FreeType... " >&6; } +if test "${ac_cv_func_FT_Init_FreeType+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define FT_Init_FreeType to an innocuous variant, in case <limits.h> declares FT_Init_FreeType. + For example, HP-UX 11i <limits.h> declares gettimeofday. */ +#define FT_Init_FreeType innocuous_FT_Init_FreeType + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char FT_Init_FreeType (); below. + Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + <limits.h> exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + +#undef FT_Init_FreeType + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char FT_Init_FreeType (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_FT_Init_FreeType || defined __stub___FT_Init_FreeType +choke me +#endif + +int +main () +{ +return FT_Init_FreeType (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_FT_Init_FreeType=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_FT_Init_FreeType=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_FT_Init_FreeType" >&5 +$as_echo "$ac_cv_func_FT_Init_FreeType" >&6; } +if test "x$ac_cv_func_FT_Init_FreeType" = x""yes; then + have_ft2_or_t1=yes + +cat >>confdefs.h <<\_ACEOF +#define HAVE_FT2 1 +_ACEOF + +fi + + if test "x$ac_cv_func_FT_Init_FreeType" = xyes; then + have_ft2_TRUE= + have_ft2_FALSE='#' +else + have_ft2_TRUE='#' + have_ft2_FALSE= +fi + + if test "x$have_ft2_or_t1" = xyes; then + have_ft2_or_t1_TRUE= + have_ft2_or_t1_FALSE='#' +else + have_ft2_or_t1_TRUE='#' + have_ft2_or_t1_FALSE= +fi + @@ -18569,10 +19049,20 @@ fi done + if test "x$ac_cv_func_gdImageGif" = xyes; then + have_gif_TRUE= + have_gif_FALSE='#' +else + have_gif_TRUE='#' + have_gif_FALSE= +fi + + CPPFLAGS=$kpse_save_CPPFLAGS LIBS=$kpse_save_LIBS + DVIPNG_VERSION=1.12 @@ -18594,9 +19084,9 @@ DVIPNG_VERSION=1.12 Your gd is new enough (>=2.0.28) to enable gif inclusion and output (dvigif): $ac_cv_func_gdImageGif - FreeType font rendering available: $ac_have_freetype2 - Support for subfonts (CJK-LaTeX): $ac_have_freetype2 - T1lib font rendering available: $ac_cv_lib_t1_T1_InitLib + FreeType font rendering available: $ac_cv_func_FT_Init_FreeType + Support for subfonts (CJK-LaTeX): $ac_cv_func_FT_Init_FreeType + T1lib font rendering available: $ac_cv_func_T1_InitLib " >&5 $as_echo " ** Configuration summary for $PACKAGE_STRING: @@ -18616,9 +19106,9 @@ $as_echo " Your gd is new enough (>=2.0.28) to enable gif inclusion and output (dvigif): $ac_cv_func_gdImageGif - FreeType font rendering available: $ac_have_freetype2 - Support for subfonts (CJK-LaTeX): $ac_have_freetype2 - T1lib font rendering available: $ac_cv_lib_t1_T1_InitLib + FreeType font rendering available: $ac_cv_func_FT_Init_FreeType + Support for subfonts (CJK-LaTeX): $ac_cv_func_FT_Init_FreeType + T1lib font rendering available: $ac_cv_func_T1_InitLib " >&6; } ac_config_headers="$ac_config_headers config.h" @@ -18745,6 +19235,34 @@ $as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi +if test -z "${have_t1_TRUE}" && test -z "${have_t1_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"have_t1\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"have_t1\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${have_ft2_TRUE}" && test -z "${have_ft2_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"have_ft2\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"have_ft2\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${have_ft2_or_t1_TRUE}" && test -z "${have_ft2_or_t1_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"have_ft2_or_t1\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"have_ft2_or_t1\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi +if test -z "${have_gif_TRUE}" && test -z "${have_gif_FALSE}"; then + { { $as_echo "$as_me:$LINENO: error: conditional \"have_gif\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"have_gif\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } +fi : ${CONFIG_STATUS=./config.status} ac_write_fail=0 diff --git a/Build/source/texk/dvipng/configure.ac b/Build/source/texk/dvipng/configure.ac index 1e68190b0e1..74f452faf70 100644 --- a/Build/source/texk/dvipng/configure.ac +++ b/Build/source/texk/dvipng/configure.ac @@ -62,6 +62,8 @@ dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_PID_T AC_TYPE_SIZE_T +AC_TYPE_INT64_T +AC_TYPE_UINT64_T dnl Checks for library functions. AC_FUNC_ALLOCA @@ -79,6 +81,10 @@ KPSE_T1LIB_FLAGS KPSE_GD_FLAGS KPSE_FREETYPE2_FLAGS +dnl We have to check properties of libraries, either installed (system) +dnl libraries or unistalled (possibly libtool) ones from the TL tree. +dnl Thus we can not use, e.g., AC_CHECK_LIB(LIB,FUNCTION) + dnl Checks for more libraries. KPSE_ADD_FLAGS([zlib]) AC_CHECK_FUNC([deflate], @@ -104,12 +110,27 @@ AC_CHECK_FUNC([kpse_set_progname], [Define to 1 if you have the `kpathsea' library (-lkpathsea).])], [AC_MSG_ERROR([cannot find/use libkpathsea])]) +dnl We need enc, cmap, and sfd formats. +dnl Introduced together with opentype format (Dec 2003). +KPSE_CHECK_KPSE_FORMAT([opentype], + [AC_DEFINE([HAVE_KPSE_ENC_FORMATS], 1, + [Define to 1 if your kpathsea has kpse_enc_format.])]) + KPSE_ADD_FLAGS([t1lib]) -dnl AC_CHECK_FUNC([T1_InitLib], -dnl [AC_DEFINE([HAVE_LIBT1], 1, -dnl [Define to 1 if you have the `t1' library (-lt1).])]) +AC_CHECK_FUNC([T1_InitLib], + [have_ft2_or_t1=yes + AC_DEFINE([HAVE_LIBT1], 1, + [Define to 1 if you have the `t1' library (-lt1).])], + [have_ft2_or_t1=no]) +AM_CONDITIONAL([have_t1], [test "x$ac_cv_func_T1_InitLib" = xyes]) KPSE_ADD_FLAGS([freetype2]) +AC_CHECK_FUNC([FT_Init_FreeType], + [have_ft2_or_t1=yes + AC_DEFINE([HAVE_FT2], 1, + [Define to 1 if you have freetype2.])]) +AM_CONDITIONAL([have_ft2], [test "x$ac_cv_func_FT_Init_FreeType" = xyes]) +AM_CONDITIONAL([have_ft2_or_t1], [test "x$have_ft2_or_t1" = xyes]) dnl Checks for more header files. AC_CHECK_HEADERS([gd.h png.h kpathsea/kpathsea.h], , @@ -119,8 +140,15 @@ AC_CHECK_HEADERS([t1lib.h]) dnl Checks for library functions. AC_CHECK_FUNCS([gdImageCreateTrueColor gdImageCreateFromJpeg gdImagePngEx gdImageCreateFromPngPtr gdImageGif FT_Library_Version]) +AM_CONDITIONAL([have_gif], [test "x$ac_cv_func_gdImageGif" = xyes]) + KPSE_RESTORE_FLAGS +dnl These are still missing: +dnl HAVE_FTIME +dnl HAVE_GETTIMEOFDAY +dnl HAVE_KPSE_ENC_FORMATS + DVIPNG_VERSION=dvipng_version AC_SUBST([DVIPNG_VERSION]) @@ -142,9 +170,9 @@ AC_MSG_RESULT([ Your gd is new enough (>=2.0.28) to enable gif inclusion and output (dvigif): $ac_cv_func_gdImageGif - FreeType font rendering available: $ac_have_freetype2 - Support for subfonts (CJK-LaTeX): $ac_have_freetype2 - T1lib font rendering available: $ac_cv_lib_t1_T1_InitLib + FreeType font rendering available: $ac_cv_func_FT_Init_FreeType + Support for subfonts (CJK-LaTeX): $ac_cv_func_FT_Init_FreeType + T1lib font rendering available: $ac_cv_func_T1_InitLib ]) AC_CONFIG_HEADER([config.h]) diff --git a/Build/source/texk/dvipng/configure.ac.work b/Build/source/texk/dvipng/configure.ac.work index 3553441b71b..7a0795f1592 100644 --- a/Build/source/texk/dvipng/configure.ac.work +++ b/Build/source/texk/dvipng/configure.ac.work @@ -40,61 +40,16 @@ AC_ARG_WITH(gs, # Checks for libraries. -AC_CHECK_LIB([t1], [T1_InitLib]) -PSFONTS_O="" -if test "$ac_cv_lib_t1_T1_InitLib" = yes; then - PSFONTS_O="t1.o" -fi -AC_SUBST(PSFONTS_O) - # Checks for header files. -AC_CHECK_FT2(,[CFLAGS="$FT2_CFLAGS $CFLAGS" - LIBS="$FT2_LIBS $LIBS" - PSFONTS_O="$PSFONTS_O sfd.o ft.o" - AC_DEFINE(HAVE_FT2, 1, [Define to 1 if you have freetype2]) - ac_have_freetype2="yes"], - [ac_have_freetype2="no"]) -if test -n "$PSFONTS_O"; then - PSFONTS_O="$PSFONTS_O enc.o fontmap.o tfm.o" -fi - # Checks for typedefs, structures, and compiler characteristics. -if test "$ac_cv_header_inttypes_h" = "yes"; then - # Sometimes we want to use gcc -ansi -pedantic as a portability test - # The typedef of int64_t is not in the system header file in that - # case. Then, #define int64_t as "long long", which is non-ansi, but - # is present in most modern compilers. Using a #define rather than a - # typedef can be a problem, but in dvipng int64_t is only used as - # typecast, and there are no problems. autoconf 2.13 equivalent: - # AC_CHECK_TYPE(int64_t, long long) - # AC_CHECK_TYPE(uint64_t, unsigned long long) - AC_CHECK_TYPE([int64_t],, - [AC_DEFINE_UNQUOTED([int64_t], [long long], - [Define to `long long' if - <inttypes.h> does not define it.])]) - AC_CHECK_TYPE([uint64_t],, - [AC_DEFINE_UNQUOTED([uint64_t], [unsigned long long], - [Define to `unsigned long long' if - <inttypes.h> does not define it.])]) -fi -AC_HAS_KPSE_ENC_FORMATS - - # Checks for library functions. if test "$enable_timing" = "yes"; then AC_CHECK_FUNCS([ftime gettimeofday]) fi -if test "$ac_cv_func_gdImageGif" = "yes"; then - INSTALL_BIN_TARGET="install-dvigif" -else - INSTALL_BIN_TARGET="install-dvipng" -fi -AC_SUBST(INSTALL_BIN_TARGET) - # Documentation-related checks AC_PATH_PROG(MAKEINFO, makeinfo, :) MAKEINFO_CHECK_MACROS(acronym env option) diff --git a/Build/source/texk/dvipng/dvipng.h b/Build/source/texk/dvipng/dvipng.h index da61b39ad53..40660433a70 100644 --- a/Build/source/texk/dvipng/dvipng.h +++ b/Build/source/texk/dvipng/dvipng.h @@ -478,11 +478,11 @@ EXTERN unsigned int debug INIT(0); /************************timing stuff*********************/ #ifdef TIMING -#if TIME_WITH_SYS_TIME +#ifdef TIME_WITH_SYS_TIME # include <sys/time.h> # include <time.h> #else -# if HAVE_SYS_TIME_H +# ifdef HAVE_SYS_TIME_H # include <sys/time.h> # else # include <time.h> diff --git a/Build/source/texk/dvipng/dvipng.h-1.12 b/Build/source/texk/dvipng/dvipng.h-1.12 new file mode 100644 index 00000000000..da61b39ad53 --- /dev/null +++ b/Build/source/texk/dvipng/dvipng.h-1.12 @@ -0,0 +1,581 @@ +/* dvipng.h */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#ifndef DVIPNG_H +#define DVIPNG_H +#include "config.h" + +#define STRSIZE 255 /* stringsize for file specifications */ + +#define FIRSTFNTCHAR 0 +#define LASTFNTCHAR 255 +#define NFNTCHARS LASTFNTCHAR+1 + +#define STACK_SIZE 100 /* DVI-stack size */ + +#define DEFAULT_GAMMA 1.0 + +/* Name of the program which is called to generate missing pk files */ +#define MAKETEXPK "mktexpk" + +#ifdef HAVE_INTTYPES_H +# include <inttypes.h> +#else /* HAVE_INTTYPES_H */ +# ifndef __sgi +/* IRIX has the following types typedef'd in sys/types.h already, + * i.e., _old_ IRIX systems; newer ones have a working inttypes.h */ +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; +#endif /* ! __sgi */ +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; +typedef long long int64_t; +typedef unsigned long long uint64_t; +#endif /* HAVE_INTTYPES_H */ + +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif + +#include <gd.h> + +#ifdef HAVE_KPATHSEA_KPATHSEA_H +# include <kpathsea/kpathsea.h> +#else +# error: kpathsea/kpathsea.h is missing from your system +#endif + +#ifdef HAVE_FT2 +#define HAVE_FT2_OR_LIBT1 +#include <ft2build.h> +#include FT_FREETYPE_H +#endif + +#ifdef HAVE_LIBT1 +#define HAVE_FT2_OR_LIBT1 +#include <t1lib.h> +#endif + +#ifdef HAVE_STDBOOL_H +# include <stdbool.h> +#else +# ifdef HAVE_KPATHSEA_KPATHSEA_H +/* boolean is an enum type from kpathsea/types.h loaded in + kpathsea/kpathsea.h, use it as fallback */ +# define bool boolean +# else +typedef int bool; +# define true (bool) 1 +# define false (bool) 0 +# endif +#endif + +#ifndef HAVE_VPRINTF +# ifdef HAVE_DOPRNT +# define vfprintf(stream, message, args) _doprnt(message, args, stream) +# else +# error: vfprintf AND _doprnt are missing!!! + /* If we have neither, should fall back to fprintf with fixed args. */ +# endif +#endif + +/* Autoconf may define malloc to rpl_malloc, if the system does not + * have a GNU Libc-compatible malloc (for which malloc(0) gives a + * valid pointer). We don't need that (yet) */ +#ifdef malloc +# undef malloc +#endif + + +/*************************************************************/ +/************************* protos.h ************************/ +/*************************************************************/ + +typedef int pixels; +typedef int32_t subpixels; +typedef int32_t dviunits; + +#define MM_TO_PXL(x) (int)(((x)*resolution*10)/254) +#define PT_TO_PXL(x) (int)((int32_t)((x)*resolution*100l)/7224) +#define PT_TO_DVI(x) (int32_t)((x)*65536l) + +/*#define PIXROUND(x,c) ((((double)x+(double)(c>>1))/(double)c)+0.5)*/ +/*#define PIXROUND(x,c) (((x)+c)/(c))*/ +/*#define PIXROUND(x,c) ((x+c-1)/(c))*/ +/*#define PIXROUND(x,c) ((x)/(c))*/ +/* integer round to the nearest number, not towards zero */ +#define PIXROUND(num,den) ((num)>0 ? ((num)+(den)/2)/(den) : -(((den)/2-(num))/(den))) + +#ifdef HAVE_ALLOCA_H +# include <alloca.h> +#elif defined _AIX +# define alloca __alloca +#endif +#define TEMPSTR(s,a) { char* tmp=a; \ + if (tmp!=NULL) {\ + s=alloca(strlen(tmp)+1);strcpy(s,tmp);free(tmp);\ + } else \ + s=NULL;} + +/*************************************************************************/ + + +/********************************************************/ +/*********************** dvi.h ************************/ +/********************************************************/ + +#define DVI_TYPE 0 +struct dvi_data { /* dvi entry */ + int type; /* This is a DVI */ + struct dvi_data *next; + uint32_t num, den, mag; /* PRE command parameters */ + int32_t conv; /* computed from num and den */ + /* divide dvi units (sp) with conv to get mf device resolution */ + /* divide further with shrinkfactor to get true resolution */ + char * name; /* full name of DVI file */ + char * outname; /* output filename (basename) */ + FILE * filep; /* file pointer */ + time_t mtime; /* modification time */ + struct font_num *fontnump; /* DVI font numbering */ + struct page_list *pagelistp; /* DVI page list */ +#define DVI_PREVIEW_LATEX_TIGHTPAGE 1 +#define DVI_PREVIEW_BOP_HOOK (1<<1) + uint32_t flags; /* Preview-latex flags */ +}; + +#define PAGE_POST INT32_MAX +#define PAGE_LASTPAGE INT32_MAX-1 +#define PAGE_MAXPAGE INT32_MAX-2 /* assume no pages out of this range */ +#define PAGE_FIRSTPAGE INT32_MIN +#define PAGE_MINPAGE INT32_MIN+1 /* assume no pages out of this range */ + +struct dvi_color { + int red,green,blue; +}; + +struct page_list { + struct page_list* next; + int offset; /* file offset to BOP */ + int32_t count[11]; /* 10 dvi counters + absolute pagenum in file */ + int csp; /* color stack pointer at BOP */ + struct dvi_color cstack[2]; /* color stack at BOP, may be longer */ +}; + + + + +struct dvi_data* DVIOpen(char*,char*); +void DVIClose(struct dvi_data*); +bool DVIReOpen(struct dvi_data*); +struct page_list*FindPage(struct dvi_data*, int32_t, bool); +struct page_list*NextPage(struct dvi_data*, struct page_list*); +struct page_list*PrevPage(struct dvi_data*, struct page_list*); +int SeekPage(struct dvi_data*, struct page_list*); +bool DVIFollowToggle(void); +unsigned char* DVIGetCommand(struct dvi_data*); +bool DVIIsNextPSSpecial(struct dvi_data*); +uint32_t CommandLength(unsigned char*); +void ClearPSHeaders(void); + +/********************************************************/ +/********************** misc.h ************************/ +/********************************************************/ + +struct filemmap { +#ifdef MIKTEX + HANDLE hFile; + HANDLE hMap; +#else /* MIKTEX */ + int fd; +#endif /* MIKTEX */ + char* data; + size_t size; +}; + +bool DecodeArgs(int, char *[]); +void DecodeString(char *); +bool MmapFile (char *filename,struct filemmap *fmmap); +void UnMmapFile(struct filemmap* fmmap); + +void Message(int, char *fmt, ...); +void Warning(char *fmt, ...); +void Fatal(char *fmt, ...); + +int32_t SNumRead(unsigned char*, register int); +uint32_t UNumRead(unsigned char*, register int); + +bool MmapFile (char *filename,struct filemmap *fmmap); +void UnMmapFile(struct filemmap* fmmap); + + +/********************************************************/ +/*********************** font.h ***********************/ +/********************************************************/ +struct encoding { + struct encoding* next; + char* name; + char* charname[257]; +}; + +struct subfont { + struct subfont* next; + char* name; + char* infix; + int encoding; + int32_t charindex[256]; +}; + +#ifdef HAVE_FT2_OR_LIBT1 +struct psfontmap { + struct psfontmap *next; + char *line,*psfile,*tfmname,*encname,*end; + struct encoding* encoding; +#ifdef HAVE_FT2 + FT_Matrix* ft_transformp; + FT_Matrix ft_transform; + struct subfont* subfont; +#endif +#ifdef HAVE_LIBT1 + T1_TMATRIX* t1_transformp; + T1_TMATRIX t1_transform; +#endif +}; +#endif + +#define FONT_TYPE_PK 1 +#define FONT_TYPE_VF 2 +#define FONT_TYPE_FT 3 +#define FONT_TYPE_T1 4 +struct char_entry { /* PK/FT/T1 Glyph/VF Macro */ + dviunits tfmw; /* TFM width */ + unsigned char *data; /* glyph data, either pixel data + * (0=transp, 255=max ink) or VF macro */ + uint32_t length; /* Length of PK data or VF macro */ + /* Only used in pixel fonts */ + pixels w,h; /* width and height in pixels */ + subpixels xOffset, yOffset; /* x offset and y offset in subpixels */ + /* Only used in PK fonts */ + unsigned char *pkdata; /* Points to beginning of PK data */ + unsigned char flag_byte; /* PK flagbyte */ +}; + +struct font_entry { /* font entry */ + int type; /* PK/VF/Type1 ... */ + struct font_entry *next; + uint32_t c, s, d; + uint8_t a, l; + char n[STRSIZE]; /* FNT_DEF command parameters */ + int dpi; /* computed from s and d */ + char name[STRSIZE]; /* full name of PK/VF file */ + struct filemmap fmmap; /* file memory map */ + uint32_t magnification; /* magnification read from font file */ + uint32_t designsize; /* design size read from font file */ + void * chr[NFNTCHARS]; /* character information */ +#ifdef HAVE_FT2 + FT_Face face; /* Freetype2 face */ +#endif +#ifdef HAVE_LIBT1 + int T1id; /* T1lib font id */ +#endif +#ifdef HAVE_FT2_OR_LIBT1 + struct psfontmap* psfontmap; /* Font transformation */ +#endif + struct font_num *vffontnump; /* VF local font numbering */ + int32_t defaultfont; /* VF default font number */ +}; + +struct font_num { /* Font number. Different for VF/DVI, and several + font_num can point to one font_entry */ + struct font_num *next; + int32_t k; + struct font_entry *fontp; +}; + +void CheckChecksum(uint32_t, uint32_t, const char*); +void InitPK (struct font_entry *newfontp); +void DonePK(struct font_entry *oldfontp); +void InitVF (struct font_entry *newfontp); +void DoneVF(struct font_entry *oldfontp); + +void FontDef(unsigned char*, void* /* dvi/vf */); +void ClearFonts(void); +void SetFntNum(int32_t, void* /* dvi/vf */); +void FreeFontNumP(struct font_num *hfontnump); + +#ifdef HAVE_FT2_OR_LIBT1 +char* copyword(char* orig); +struct psfontmap *NewPSFont(struct psfontmap* copyfrom); +void InitPSFontMap(void); +void ClearPSFontMap(void); +struct psfontmap* FindPSFontMap(char*); +struct encoding* FindEncoding(char*); +void ClearEncoding(void); +bool ReadTFM(struct font_entry *, char*); +#endif + +#ifdef HAVE_FT2 +bool InitFT(struct font_entry *); +void DoneFT(struct font_entry *tfontp); +void LoadFT(int32_t, struct char_entry *); +struct psfontmap* FindSubFont(struct psfontmap* entry, char* fontname); +void ClearSubfont(void); +#endif + +#ifdef HAVE_LIBT1 +bool InitT1(struct font_entry *); +void DoneT1(struct font_entry *tfontp); +void LoadT1(int32_t, struct char_entry *); +#endif + +/********************************************************/ +/********************* pplist.h ***********************/ +/********************************************************/ + +bool ParsePages(char*); +void FirstPage(int32_t,bool); +void LastPage(int32_t,bool); +void ClearPpList(void); +void Reverse(bool); +struct page_list* NextPPage(void* /* dvi */, struct page_list*); + + + + +#ifdef MAIN +#define EXTERN +#define INIT(x) =x +#else +#define EXTERN extern +#define INIT(x) +#endif + +/********************************************************/ +/********************** draw.h ************************/ +/********************************************************/ +#include "commands.h" + +void CreateImage(pixels width, pixels height); +void DestroyImage(void); +void DrawCommand(unsigned char*, void* /* dvi/vf */); +void DrawPages(void); +void WriteImage(char*, int); +void LoadPK(int32_t, register struct char_entry *); +int32_t SetChar(int32_t); +dviunits SetGlyph(int32_t c, int32_t hh,int32_t vv); +void Gamma(double gamma); +int32_t SetVF(int32_t); +int32_t SetRule(int32_t, int32_t, int32_t, int32_t); +void SetSpecial(char *, int32_t, int32_t); +void BeginVFMacro(struct font_entry*); +void EndVFMacro(void); + +/**************************************************/ +void handlepapersize(char*,int32_t*,int32_t*); + +void stringrgb(char* colorstring,int *r,int *g,int *b); +void background(char *); +void initcolor(void); +void popcolor(void); +void pushcolor(char *); +void resetcolorstack(char *); +void StoreColorStack(struct page_list *tpagep); +void ReadColorStack(struct page_list *tpagep); +void StoreBackgroundColor(struct page_list *tpagep); +void ClearColorNames(void); +void InitXColorPrologue(char* prologuename); + +/**********************************************************************/ +/************************* Global Variables *************************/ +/**********************************************************************/ + +#ifdef MAKETEXPK +#ifdef HAVE_LIBKPATHSEA +EXTERN bool makeTexPK INIT(MAKE_TEX_PK_BY_DEFAULT); +#else +EXTERN bool makeTexPK INIT(_TRUE); +#endif +#endif + +EXTERN uint32_t usermag INIT(0); /* user specified magstep */ +EXTERN struct font_entry *hfontptr INIT(NULL); /* font list pointer */ + +EXTERN struct internal_state { + struct font_entry* currentfont; +} current_state; + +#define BE_NONQUIET 1 +#define BE_VERBOSE (1<<1) +#define PARSE_STDIN (1<<2) +#define EXPAND_BBOX (1<<3) +#define TIGHT_BBOX (1<<4) +/* #define CACHE_IMAGES (1<<5) */ +#define FORCE_TRUECOLOR (1<<6) +#define USE_FREETYPE (1<<7) +#define USE_LIBT1 (1<<8) +#define REPORT_HEIGHT (1<<9) +#define REPORT_DEPTH (1<<10) +#define DVI_PAGENUM (1<<11) +#define MODE_PICKY (1<<12) +#define GIF_OUTPUT (1<<15) +#define MODE_STRICT (1<<16) +#define NO_GHOSTSCRIPT (1<<17) +#define NO_GSSAFER (1<<18) +#define BG_TRANSPARENT (1<<19) +#define BG_TRANSPARENT_ALPHA (1<<20) +#define FORCE_PALETTE (1<<22) +EXTERN uint32_t option_flags INIT(BE_NONQUIET | USE_FREETYPE | USE_LIBT1); + +#define PAGE_GAVE_WARN 1 +#define PAGE_PREVIEW_BOP (1<<1) +#define PAGE_TRUECOLOR (1<<2) +EXTERN uint32_t page_flags INIT(0); + + +#ifdef DEBUG +EXTERN unsigned int debug INIT(0); +#define DEBUG_PRINT(a,b) if (debug & a) { printf b; fflush(stdout); } +#define DEBUG_DVI 1 +#define DEBUG_VF (1<<1) +#define DEBUG_PK (1<<2) +#define DEBUG_TFM (1<<3) +#define DEBUG_GLYPH (1<<4) +#define DEBUG_FT (1<<5) +#define DEBUG_ENC (1<<6) +#define DEBUG_COLOR (1<<7) +#define DEBUG_GS (1<<8) +#define DEBUG_T1 (1<<9) +#define LASTDEBUG DEBUG_T1 +#define DEBUG_DEFAULT DEBUG_DVI +#else +#define DEBUG_PRINT(a,b) +#endif + +/************************timing stuff*********************/ +#ifdef TIMING +#if TIME_WITH_SYS_TIME +# include <sys/time.h> +# include <time.h> +#else +# if HAVE_SYS_TIME_H +# include <sys/time.h> +# else +# include <time.h> +# endif +#endif +EXTERN double timer INIT(0); +EXTERN double my_tic,my_toc INIT(0); +EXTERN int ndone INIT(0); /* number of pages converted */ +# ifdef HAVE_GETTIMEOFDAY +EXTERN struct timeval Tp; +# define TIC { gettimeofday(&Tp, NULL); \ + my_tic= Tp.tv_sec + Tp.tv_usec/1000000.0;} +# define TOC { gettimeofday(&Tp, NULL); \ + my_toc += Tp.tv_sec + Tp.tv_usec/1000000.0 - my_tic;} +# else +# ifdef HAVE_FTIME +EXTERN struct timeb timebuffer; +# define TIC() { ftime(&timebuffer); \ + my_tic= timebuffer.time + timebuffer.millitm/1000.0; +# define TOC() { ftime(&timebuffer); \ + my_toc += timebuffer.time + timebuffer.millitm/1000.0 - my_tic;} +# else +# define TIC() +# define TOC() +# endif +# endif +#endif /* TIMING */ + +EXTERN char* user_mfmode INIT(NULL); +EXTERN int user_bdpi INIT(0); +EXTERN int dpi INIT(100); + +#ifdef HAVE_GDIMAGEPNGEX +EXTERN int compression INIT(1); +#endif +#ifdef MIKTEX +#undef min +#undef max +#endif /* MIKTEX */ +# define max(x,y) if ((y)>(x)) x = y +# define min(x,y) if ((y)<(x)) x = y + +/* These are in pixels*/ +EXTERN int x_min INIT(0); +EXTERN int y_min INIT(0); +EXTERN int x_max INIT(0); +EXTERN int y_max INIT(0); + +/* Page size: default set by -T */ +EXTERN int x_width_def INIT(0); +EXTERN int y_width_def INIT(0); + +/* Offset: default set by -O and -T bbox */ +EXTERN int x_offset_def INIT(0); +EXTERN int y_offset_def INIT(0); + +/* Preview-latex's tightpage */ +EXTERN int x_width_tightpage INIT(0); +EXTERN int y_width_tightpage INIT(0); +EXTERN int x_offset_tightpage INIT(0); +EXTERN int y_offset_tightpage INIT(0); + +/* Paper size: set by -t, for cropmark purposes only */ +/* This has yet to be written */ +EXTERN int x_pwidth INIT(0); +EXTERN int y_pwidth INIT(0); + +/* The transparent border preview-latex desires */ +EXTERN int borderwidth INIT(0); + +/* fallback color for transparent background */ +EXTERN bool userbordercolor INIT(FALSE); /* if true, use user-supplied color */ +EXTERN struct dvi_color bordercolor; + + +EXTERN gdImagePtr page_imagep INIT(NULL); +EXTERN int32_t shrinkfactor INIT(4); + +EXTERN struct dvi_color cstack[STACK_SIZE]; +EXTERN int csp INIT(1); + +EXTERN struct font_entry* currentfont; +EXTERN struct dvi_data* dvi INIT(NULL); + +#ifdef HAVE_FT2 +EXTERN FT_Library libfreetype INIT(NULL); +#endif + +#ifdef HAVE_LIBT1 +EXTERN void* libt1 INIT(NULL); +#endif + +#define EXIT_FATAL EXIT_FAILURE+1 +EXTERN int exitcode INIT(EXIT_SUCCESS); + +#endif /* DVIPNG_H */ diff --git a/Build/source/texk/dvipng/fontmap.c b/Build/source/texk/dvipng/fontmap.c index 062374972a7..e06275f88d6 100644 --- a/Build/source/texk/dvipng/fontmap.c +++ b/Build/source/texk/dvipng/fontmap.c @@ -25,7 +25,7 @@ #include "dvipng.h" static struct filemmap psfont_mmap; -#if HAVE_FT2 +#ifdef HAVE_FT2 static struct filemmap ttfont_mmap; #endif static struct psfontmap *psfontmap=NULL; @@ -106,10 +106,10 @@ struct psfontmap *NewPSFont(struct psfontmap* copyfrom) newentry->psfile = copyword(copyfrom->psfile); newentry->encname = copyword(copyfrom->encname); newentry->encoding = copyfrom->encoding; -#if HAVE_LIBT1 +#ifdef HAVE_LIBT1 newentry->t1_transformp = copyfrom->t1_transformp; #endif -#if HAVE_FT2 +#ifdef HAVE_FT2 newentry->ft_transformp = copyfrom->ft_transformp; newentry->subfont = copyfrom->subfont; #endif @@ -120,10 +120,10 @@ struct psfontmap *NewPSFont(struct psfontmap* copyfrom) newentry->psfile = NULL; newentry->encname = NULL; newentry->encoding = NULL; -#if HAVE_LIBT1 +#ifdef HAVE_LIBT1 newentry->t1_transformp = NULL; #endif -#if HAVE_FT2 +#ifdef HAVE_FT2 newentry->ft_transformp = NULL; newentry->subfont = NULL; #endif @@ -249,14 +249,14 @@ void ReadPSFontMap(struct psfontmap *entry) } free(word); } -#if HAVE_FT2 +#ifdef HAVE_FT2 entry->ft_transformp=&(entry->ft_transform); entry->ft_transform.xx=(FT_Fixed)(cxx*0x10000); entry->ft_transform.xy=(FT_Fixed)(cxy*0x10000); entry->ft_transform.yx=0; entry->ft_transform.yy=0x10000; #endif -#if HAVE_LIBT1 +#ifdef HAVE_LIBT1 entry->t1_transformp=&(entry->t1_transform); entry->t1_transform.cxx=cxx; entry->t1_transform.cxy=cxy; diff --git a/Build/source/texk/dvipng/fontmap.c-1.12 b/Build/source/texk/dvipng/fontmap.c-1.12 new file mode 100644 index 00000000000..062374972a7 --- /dev/null +++ b/Build/source/texk/dvipng/fontmap.c-1.12 @@ -0,0 +1,340 @@ +/* fontmap.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" + +static struct filemmap psfont_mmap; +#if HAVE_FT2 +static struct filemmap ttfont_mmap; +#endif +static struct psfontmap *psfontmap=NULL; + +char* newword(char** buffer, char* end) +{ + char *word,*pos=*buffer; + + while(pos<end && *pos!=' ' && *pos!='\t' && *pos!='"') pos++; + if ((word=malloc(pos-*buffer+1))==NULL) + Fatal("cannot malloc space for string"); + strncpy(word,*buffer,pos-*buffer); + word[pos-*buffer]='\0'; + *buffer=pos; + return(word); +} + +char* copyword(char* orig) +{ + char *word; + + if (orig==NULL) + return(NULL); + if ((word=malloc(strlen(orig)+1))==NULL) + Fatal("cannot malloc space for string"); + strcpy(word,orig); + return(word); +} + +char* find_format(char* name) +{ + /* Cater for both new (first case) and old (second case) kpathsea */ + char* format = + kpse_find_file(name,kpse_fontmap_format,false); + + if (format==NULL) + format = kpse_find_file(name,kpse_dvips_config_format,false); + return(format); +} + +void InitPSFontMap(void) +{ + char* psfont_name=NULL; + /* Prefer ps2pk.map, fonts are present more often */ + psfont_name=find_format("ps2pk.map"); + if (psfont_name==NULL) + psfont_name=find_format("psfonts.map"); + if (psfont_name==NULL) { + Warning("cannot find ps2pk.map, nor psfonts.map"); + } else { + DEBUG_PRINT((DEBUG_FT|DEBUG_T1), + ("\n OPEN PSFONT MAP:\t'%s'", psfont_name)); + if (MmapFile(psfont_name,&psfont_mmap)) { + Warning("psfonts map %s could not be opened", psfont_name); + } + free(psfont_name); + } +#ifdef HAVE_FT2 + psfont_name=find_format("ttfonts.map"); + if (psfont_name!=NULL) { + DEBUG_PRINT(DEBUG_FT,("\n OPEN TTFONT MAP:\t'%s'", psfont_name)); + if (MmapFile(psfont_name,&ttfont_mmap)) { + Warning("ttfonts map %s could not be opened", psfont_name); + } + free(psfont_name); + } +#endif +} + +struct psfontmap *NewPSFont(struct psfontmap* copyfrom) +{ + struct psfontmap *newentry=NULL; + if ((newentry=malloc(sizeof(struct psfontmap)))==NULL) + Fatal("cannot malloc psfontmap space"); + if (copyfrom!=NULL) { + newentry->line = copyfrom->line; + newentry->tfmname = copyword(copyfrom->tfmname); + newentry->psfile = copyword(copyfrom->psfile); + newentry->encname = copyword(copyfrom->encname); + newentry->encoding = copyfrom->encoding; +#if HAVE_LIBT1 + newentry->t1_transformp = copyfrom->t1_transformp; +#endif +#if HAVE_FT2 + newentry->ft_transformp = copyfrom->ft_transformp; + newentry->subfont = copyfrom->subfont; +#endif + newentry->end = copyfrom->end; + } else { + newentry->line = NULL; + newentry->tfmname = NULL; + newentry->psfile = NULL; + newentry->encname = NULL; + newentry->encoding = NULL; +#if HAVE_LIBT1 + newentry->t1_transformp = NULL; +#endif +#if HAVE_FT2 + newentry->ft_transformp = NULL; + newentry->subfont = NULL; +#endif + newentry->end = NULL; + } + newentry->next=psfontmap; + psfontmap=newentry; + return(newentry); +} + +struct psfontmap *SearchPSFontMap(char* fontname, + struct filemmap* search_mmap) +{ + static char *pos=NULL,*end=NULL; + static struct filemmap* searching_mmap=NULL; + struct psfontmap *entry=NULL; + + if (pos==end && search_mmap!=searching_mmap) { + searching_mmap=search_mmap; + pos=searching_mmap->data; + end=searching_mmap->data+searching_mmap->size; + } + while(pos<end && (entry==NULL || strcmp(entry->tfmname,fontname)!=0)) { + while(pos < end + && (*pos=='\n' || *pos==' ' || *pos=='\t' + || *pos=='%' || *pos=='*' || *pos==';' || *pos=='#')) { + while(pos < end && *pos!='\n') pos++; /* skip comments/empty rows */ + pos++; + } + if (pos < end) { + entry=NewPSFont(NULL); + entry->line = pos; + /* skip <something and quoted entries */ + while(pos < end && (*pos=='<' || *pos=='"')) { + if (*pos=='<') + while(pos < end && *pos!=' ' && *pos!='\t') pos++; + else + while(pos < end && *pos!='"') pos++; + while(pos < end && (*pos==' ' || *pos=='\t')) pos++; + } + /* first word is font name */ + entry->tfmname = newword(&pos,end); + while(pos < end && *pos!='\n') pos++; + entry->end = pos; + } + pos++; + } + if (entry!=NULL && strcmp(entry->tfmname,fontname)!=0) + entry=NULL; + return(entry); +} + +void ClearPSFontMap(void) +{ + struct psfontmap *entry; + + while(psfontmap!=NULL) { + entry=psfontmap; + psfontmap=psfontmap->next; + free(entry->tfmname); + if (entry->psfile!=NULL) + free(entry->psfile); + if (entry->encname!=NULL) + free(entry->encname); + free(entry); + } + UnMmapFile(&psfont_mmap); +#ifdef HAVE_FT2 + UnMmapFile(&ttfont_mmap); +#endif +} + +void ReadPSFontMap(struct psfontmap *entry) +{ + char *pos,*end,*psname; + int nameno = 0; + + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("\n PSFONTMAP: %s ",entry->tfmname)); + pos=entry->line; + end=entry->end; + while(pos < end) { + if (*pos=='<') { /* filename follows */ + pos++; + if (pos<end && *pos=='<') { /* <<download.font */ + pos++; + entry->psfile = newword((char**)&pos,end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<%s ",entry->psfile)); + } else if (pos<end && *pos=='[') { /* <[encoding.file */ + pos++; + entry->encname = newword((char**)&pos,end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<[%s ",entry->encname)); + } else { /* <some.file */ + char* word =newword((char**)&pos,end); + if (strncmp(word+strlen(word)-4,".enc",4)==0) {/* <some.enc */ + entry->encname=word; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<[%s ",entry->encname)); + } else { /* <font */ + entry->psfile=word; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<%s ",entry->psfile)); + } + } + } else if (*pos=='"') { /* PS code: reencoding/tranformation exists */ + char *word; + double cxx=1.0,cxy=0.0; + pos++; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("\"")); + while(pos < end && *pos!='"') { + word=newword((char**)&pos,end); + while(pos < end && (*pos==' ' || *pos=='\t')) pos++; + if (pos+10<end && strncmp(pos,"ExtendFont",10)==0) { + cxx=strtod(word,NULL); + pos+=10; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("%f ExtendFont ",cxx)); + } else if (pos+9<end && strncmp(pos,"SlantFont",9)==0) { + pos+=9; + cxy=strtod(word,NULL); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("%f SlantFont ",cxy)); + } else if (pos+12<end && strncmp(pos,"ReEncodeFont",12)==0) { + pos+=12; + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("%s ReEncodeFont ",word)); + } else { + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("(?:%s) ",word)); + } + free(word); + } +#if HAVE_FT2 + entry->ft_transformp=&(entry->ft_transform); + entry->ft_transform.xx=(FT_Fixed)(cxx*0x10000); + entry->ft_transform.xy=(FT_Fixed)(cxy*0x10000); + entry->ft_transform.yx=0; + entry->ft_transform.yy=0x10000; +#endif +#if HAVE_LIBT1 + entry->t1_transformp=&(entry->t1_transform); + entry->t1_transform.cxx=cxx; + entry->t1_transform.cxy=cxy; + entry->t1_transform.cyx=0.0; + entry->t1_transform.cyy=1.0; +#endif + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("\" ")); + pos++; + } else { /* bare word */ + switch (++nameno) { + case 1: /* first word is tfmname and perhaps psname, NOT psfile */ + while(pos<end && *pos!=' ' && *pos!='\t') pos++; + psname=entry->tfmname; + break; + case 2: /* second word is psname, NOT psfile */ + psname = newword((char**)&pos,end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("(%s) ",psname)); + free(psname); + break; + case 3: /* third word is encoding */ + entry->encname = newword((char**)&pos,end); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),("<[%s ",entry->encname)); + break; + default: + while(pos<end && *pos!=' ' && *pos!='\t') pos++; + Warning("more than three bare words in font map entry"); + } + } + while(pos < end && (*pos==' ' || *pos=='\t')) pos++; + } + if (entry->psfile==NULL) { + /* No psfile-name given, use tfmname */ + entry->psfile=copyword(entry->tfmname); + DEBUG_PRINT((DEBUG_FT|DEBUG_T1),(" <%s ",entry->psfile)); + } + if (entry->encname!=NULL + && (entry->encoding=FindEncoding(entry->encname))==NULL) + Warning("unable to load font encoding '%s' for %s", + entry->encname,entry->tfmname); +} + + +struct psfontmap* FindPSFontMap(char* fontname) +{ + struct psfontmap *entry; + static struct filemmap* search_mmap_p=&psfont_mmap; + + entry=psfontmap; + while(entry!=NULL && strcmp(entry->tfmname,fontname)!=0) + entry=entry->next; + if(entry==NULL) { + entry=SearchPSFontMap(fontname,search_mmap_p); +#ifdef HAVE_FT2 + if(entry==NULL && search_mmap_p!=&ttfont_mmap) { + search_mmap_p=&ttfont_mmap; + entry=SearchPSFontMap(fontname,search_mmap_p); + } +#endif + } + if(entry==NULL) { + struct psfontmap* entry_subfont=NULL; + entry=psfontmap; + while(entry!=NULL && strcmp(entry->tfmname,fontname)!=0) { + while(entry!=NULL && strchr(entry->tfmname,'@')==NULL) + entry=entry->next; + if (entry!=NULL) { + entry_subfont=FindSubFont(entry,fontname); + if (entry_subfont!=NULL) + entry=entry_subfont; + else + entry=entry->next; + } + } + } + if (entry!=NULL && entry->psfile==NULL) + ReadPSFontMap(entry); + if (entry!=NULL && entry->encname!=NULL && entry->encoding==NULL) + /* Encoding given but it cannot be found. Unusable font */ + return(NULL); + return(entry); +} diff --git a/Build/source/texk/dvipng/ft.c b/Build/source/texk/dvipng/ft.c index c91ea2fd6ae..dceff74bf75 100644 --- a/Build/source/texk/dvipng/ft.c +++ b/Build/source/texk/dvipng/ft.c @@ -23,7 +23,7 @@ ************************************************************************/ #include "dvipng.h" -#if HAVE_ALLOCA_H +#ifdef HAVE_ALLOCA_H # include <alloca.h> #endif diff --git a/Build/source/texk/dvipng/ft.c-1.12 b/Build/source/texk/dvipng/ft.c-1.12 new file mode 100644 index 00000000000..c91ea2fd6ae --- /dev/null +++ b/Build/source/texk/dvipng/ft.c-1.12 @@ -0,0 +1,174 @@ +/* ft.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +void LoadFT(int32_t c, struct char_entry * ptr) +{ + FT_Bitmap bitmap; + FT_UInt glyph_i; + int i,j,k; + unsigned char* bit; + + DEBUG_PRINT(DEBUG_FT,("\n LOAD FT CHAR\t%d (%d)",c,ptr->tfmw)); + if (currentfont->psfontmap!=NULL + && currentfont->psfontmap->encoding != NULL) { + DEBUG_PRINT(DEBUG_FT,(" %s",currentfont->psfontmap->encoding->charname[c])); + glyph_i = FT_Get_Name_Index(currentfont->face, + currentfont->psfontmap->encoding->charname[c]); + } else if (currentfont->psfontmap!=NULL + && currentfont->psfontmap->subfont != NULL) { + glyph_i = FT_Get_Char_Index( currentfont->face, + currentfont->psfontmap->subfont->charindex[c] ); + DEBUG_PRINT(DEBUG_FT,(" 0x%X",currentfont->psfontmap->subfont->charindex[c])); + } else + glyph_i = FT_Get_Char_Index( currentfont->face, c ); + if (FT_Load_Glyph( currentfont->face, glyph_i, + FT_LOAD_RENDER | FT_LOAD_TARGET_LIGHT ) + /* On some configurations (with FreeType <= 2.1.7) the above + fails, while the below works */ + && FT_Load_Glyph( currentfont->face, glyph_i, + FT_LOAD_RENDER | FT_LOAD_NO_HINTING )) + Fatal("cannot load FT char %d",c); + ptr->xOffset = -currentfont->face->glyph->bitmap_left*shrinkfactor; + ptr->yOffset = (currentfont->face->glyph->bitmap_top-1)*shrinkfactor; + bitmap=currentfont->face->glyph->bitmap; + DEBUG_PRINT(DEBUG_FT,(" (%dx%d)",bitmap.width,bitmap.rows)); + + if ((ptr->data = calloc(bitmap.width*bitmap.rows,sizeof(char))) == NULL) + Fatal("unable to allocate image space for char %c", (char)c); + ptr->w = bitmap.width; + ptr->h = bitmap.rows; + +#define GREYLEVELS 16 + DEBUG_PRINT(DEBUG_GLYPH,("\nDRAW GLYPH %d\n", (int)c)); + bit=ptr->data; + for(i=0;i<bitmap.rows;i++) { + for(j=0;j<bitmap.width;j++) { + k=bitmap.buffer[i*bitmap.pitch+j]/(256/GREYLEVELS)*17; + /* k=(bitmap.buffer[i*bitmap.pitch+j]+1)/16; */ + /* k= k>0 ? k*16-1 : 0; */ + DEBUG_PRINT(DEBUG_GLYPH,("%3u ",k)); + bit[i*bitmap.width+j]=k; + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } +} + +bool InitFT(struct font_entry * tfontp) +{ + int error; + + if (libfreetype==NULL) { + if (FT_Init_FreeType( &libfreetype )) { + Warning("an error occured during freetype initialisation, disabling it"); + option_flags &= ~USE_FREETYPE; + return(false); + } +# ifdef DEBUG + else { + FT_Int amajor, aminor, apatch; + + DEBUG_PRINT(DEBUG_FT,("\n COMPILED WITH FREETYPE %d.%d.%d", + FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH)); +# ifdef HAVE_FT_LIBRARY_VERSION + FT_Library_Version( libfreetype, &amajor, &aminor, &apatch ); + DEBUG_PRINT(DEBUG_FT,("\n USING LIBFT %d.%d.%d", + amajor, aminor, apatch)); +# endif + } +# endif + } + DEBUG_PRINT((DEBUG_DVI|DEBUG_FT),("\n OPEN FT FONT:\t'%s'", tfontp->name)); + error = FT_New_Face( libfreetype, tfontp->name, 0, &tfontp->face ); + if (error == FT_Err_Unknown_File_Format) { + Warning("font file %s has unknown format", tfontp->name); + return(false); + } else if (error) { + Warning("font file %s could not be opened", tfontp->name); + return(false); + } + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (tfontp->psfontmap != NULL && tfontp->psfontmap->subfont != NULL) + error=FT_Select_Charmap(tfontp->face, tfontp->psfontmap->subfont->encoding); + else if (tfontp->psfontmap == NULL || tfontp->psfontmap->encoding == NULL) +#ifndef FT_ENCODING_ADOBE_CUSTOM +# define FT_ENCODING_ADOBE_CUSTOM ft_encoding_adobe_custom +# define FT_ENCODING_ADOBE_STANDARD ft_encoding_adobe_standard +#endif + error=FT_Select_Charmap(tfontp->face, FT_ENCODING_ADOBE_CUSTOM); + if (error) { + Warning("unable to set font encoding for %s", tfontp->name); + if(FT_Select_Charmap( tfontp->face, FT_ENCODING_ADOBE_STANDARD )) { + Warning("unable to set fallback font encoding for %s", tfontp->name); + return(false); + } + } + if (FT_Set_Char_Size( tfontp->face, /* handle to face object */ + 0, /* char_width in 1/64th of points */ + ((int64_t)tfontp->d*64*7200)/7227/65536, + /* char_height in 1/64th of _big_points, + not TeX points */ + tfontp->dpi/shrinkfactor, /* horizontal resolution */ + tfontp->dpi/shrinkfactor )) /* vertical resolution */ { + Warning("unable to set font size for %s", tfontp->name); + return(false); + } + if (tfontp->psfontmap!=NULL) + FT_Set_Transform(tfontp->face, tfontp->psfontmap->ft_transformp, NULL); + tfontp->type = FONT_TYPE_FT; + return(true); +} + + +void UnLoadFT(struct char_entry *ptr) +{ + if (ptr->data!=NULL) + free(ptr->data); + ptr->data=NULL; +} + + +void DoneFT(struct font_entry *tfontp) +{ + int c=0; + + int error = FT_Done_Face( tfontp->face ); + if (error) + Warning("font file %s could not be closed", tfontp->name); + while(c<NFNTCHARS) { + if (tfontp->chr[c]!=NULL) { + UnLoadFT((struct char_entry*)tfontp->chr[c]); + free(tfontp->chr[c]); + tfontp->chr[c]=NULL; + } + c++; + } + tfontp->name[0]='\0'; +} + + diff --git a/Build/source/texk/dvipng/misc.c b/Build/source/texk/dvipng/misc.c index 9debdeb1537..5db68ee8a08 100644 --- a/Build/source/texk/dvipng/misc.c +++ b/Build/source/texk/dvipng/misc.c @@ -195,7 +195,7 @@ bool DecodeArgs(int argc, char ** argv) } break ; case 't': /* specify paper format, only for cropmarks */ -#if HAVE_GDIMAGECREATETRUECOLOR +#ifdef HAVE_GDIMAGECREATETRUECOLOR /* Truecolor */ if (strncmp(p,"ruecolor",8)==0) { if (p[8] != '0') { diff --git a/Build/source/texk/dvipng/misc.c-1.12 b/Build/source/texk/dvipng/misc.c-1.12 new file mode 100644 index 00000000000..9debdeb1537 --- /dev/null +++ b/Build/source/texk/dvipng/misc.c-1.12 @@ -0,0 +1,836 @@ +/* misc.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#ifdef HAVE_LIBGEN_H +# include <libgen.h> +#else +#define basename xbasename +#endif +#include <fcntl.h> /* open/close */ +#ifndef MIKTEX +#include <sys/mman.h> +#endif +#include <sys/stat.h> + +static char *programname; + +/*-->DecodeArgs*/ +/*********************************************************************/ +/***************************** DecodeArgs ****************************/ +/*********************************************************************/ +bool DecodeArgs(int argc, char ** argv) +{ + int i; /* argument index for options */ + bool ppused=false; /* Flag when -pp is used */ + int32_t number; /* Temporary storage for numeric parameter */ + char *dviname=NULL; /* Name of dvi file */ + char *outname=NULL; /* Name of output file */ + + if (argv[0]) { +#ifdef HAVE_GDIMAGEGIF + programname=strrchr(argv[0],'/'); + if (programname!=NULL) + programname++; + else + programname=argv[0]; + if (strncmp(programname,"dvigif",6)==0) + option_flags |= GIF_OUTPUT; +#endif + programname=argv[0]; + Message(BE_NONQUIET,"This is %s",programname); + if (strcmp(basename(programname),PACKAGE_NAME)!=0) + Message(BE_NONQUIET," (%s)", PACKAGE_NAME); + Message(BE_NONQUIET," %s Copyright 2002-2008 Jan-Ake Larsson\n", + PACKAGE_VERSION); + } + + for (i=1; i<argc; i++) { + if (*argv[i]=='-') { + char *p=argv[i]+2 ; + char c=argv[i][1] ; + if (c=='-') { + p++; + c=argv[i][2]; + } + switch (c) { + case 'd': /* selects Debug output */ + if (*p>'9' && *p!='-') { + if (strncmp(p,"vinum",5)==0) { + if (p[5] != '0') { + option_flags |= DVI_PAGENUM; + Message(PARSE_STDIN,"DVI page number output on\n",p); + } else { + option_flags &= ~DVI_PAGENUM; + Message(PARSE_STDIN,"DVI page number output off\n"); + } + break; + } else if (strncmp(p,"epth",4)==0) { /* Depth reporting */ + if (p[4] != '0') { + option_flags |= REPORT_DEPTH; + Message(PARSE_STDIN,"Depth reporting on\n",p); + } else { + option_flags &= ~REPORT_DEPTH; + Message(PARSE_STDIN,"Depth reporting off\n"); + } + break; + } + goto DEFAULT; + } else { +#ifdef DEBUG + if (*p == 0 && argv[i+1]) + p = argv[i+1]; + debug = atoi(p); + if (debug > 0) { + if (p == argv[i+1]) i++; + } else + debug = DEBUG_DEFAULT; + Message(PARSE_STDIN,"Debug output enabled\n"); +#ifdef HAVE_LIBKPATHSEA + kpathsea_debug = debug / LASTDEBUG / 2 ; +#endif +#else + Warning("This instance of %s was compiled without the debug (-d) option", + programname); +#endif + break; + } + case 'o': /* Output file is specified */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + outname=p; + /* remove .png extension */ + Message(PARSE_STDIN,"Output file: %s\n", + outname); + break; +#ifdef MAKETEXPK + case 'M': + /* -M, -M1 => don't make font; -M0 => do. */ + makeTexPK = (*p == '0'); +#ifdef HAVE_LIBKPATHSEA + kpse_set_program_enabled (kpse_pk_format, makeTexPK, kpse_src_cmdline); +#endif + if (makeTexPK) + Message(PARSE_STDIN,"MakeTeXPK enabled\n"); + else + Message(PARSE_STDIN,"MakeTeXPK disabled\n"); + break; +#endif /* MAKETEXPK */ + case 'm': + if (strcmp(p,"ode") == 0 ) { + if (argv[i+1]) + user_mfmode = argv[++i] ; + Message(PARSE_STDIN,"MetaFont mode: %s\n",user_mfmode); + break; + } + goto DEFAULT; + case 'h': + if (strcmp(p,"elp") == 0 ) { + break; + } else if (strncmp(p,"eight",5) == 0 ) { /* Height reporting */ + if (p[5] != '0') { + option_flags |= REPORT_HEIGHT; + Message(PARSE_STDIN,"Height reporting on\n",p); + } else { + option_flags &= ~REPORT_HEIGHT; + Message(PARSE_STDIN,"Height reporting off\n"); + } + break; + } + goto DEFAULT; + case 'O' : /* Offset */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + handlepapersize(p, &x_offset_def, &y_offset_def) ; + Message(PARSE_STDIN,"Offset: (%d,%d)\n",x_offset_def,y_offset_def); + break ; + case 'e': + if (strncmp(p,"xpand-bbox",10) == 0 ) { + if (p[10] != '0') { + option_flags |= EXPAND_BBOX; + Message(PARSE_STDIN,"BBox expansion on\n",p); + } else { + option_flags &= ~EXPAND_BBOX; + Message(PARSE_STDIN,"BBox expansion off\n"); + } + break; + } + goto DEFAULT; + case 'T' : + if (*p == 0 && argv[i+1]) + p = argv[++i]; + if (strcmp(p,"bbox")==0) { + x_width_def=0; + y_width_def=0; + Message(PARSE_STDIN,"Pagesize: (bbox)\n"); + } else if (strcmp(p,"tight")==0) { + x_width_def=-1; + y_width_def=-1; + Message(PARSE_STDIN,"Pagesize: (tight bbox)\n"); + } else { + handlepapersize(p, &x_width_def, &y_width_def) ; + Message(PARSE_STDIN,"Pagesize: (%d,%d)\n", + x_width_def,y_width_def); + } + break ; + case 't': /* specify paper format, only for cropmarks */ +#if HAVE_GDIMAGECREATETRUECOLOR + /* Truecolor */ + if (strncmp(p,"ruecolor",8)==0) { + if (p[8] != '0') { + option_flags |= FORCE_TRUECOLOR; + Message(PARSE_STDIN,"Truecolor mode on\n",p); + } else { + option_flags &= ~FORCE_TRUECOLOR; + Message(PARSE_STDIN,"Truecolor mode off\n"); + } + } else +#endif +#ifdef HAVE_LIBT1 + if ( strncmp(p,"1lib",4) == 0 ) { /* -t1lib activation */ + if (p[4] != '0') { + option_flags |= USE_LIBT1; + Message(PARSE_STDIN,"t1lib rendering on\n",p); + } else { + option_flags &= ~USE_LIBT1; + Message(PARSE_STDIN,"t1lib rendering off\n"); + } + } else +#endif + + { /* cropmarks not implemented yet */ + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (strcmp(p,"a4")==0) { + handlepapersize("210mm,297mm",&x_pwidth,&y_pwidth); + } else if (strcmp(p,"letter")==0) { + handlepapersize("8.5in,11in",&x_pwidth,&y_pwidth); + } else if (strcmp(p,"legal")==0) { + handlepapersize("8.5in,14in",&x_pwidth,&y_pwidth); + } else if (strcmp(p,"executive")==0) { + handlepapersize("7.25in,10.5in",&x_pwidth,&y_pwidth); + } else + Fatal("papersize %s is not implemented",p); + Message(PARSE_STDIN,"Papersize: %s\n",p); + } + break; +/* case 'c': */ +/* if (strncmp(p,"acheimages",10)==0) { */ +/* if (p[10] != '0') { */ +/* option_flags |= CACHE_IMAGES; */ +/* Message(PARSE_STDIN,"Caching images\n",p); */ +/* } else { */ +/* option_flags &= ~CACHE_IMAGES; */ +/* Message(PARSE_STDIN,"Not caching images\n"); */ +/* } */ +/* break; */ +/* } */ +/* goto DEFAULT; */ + case 'b': + if ( *p == 'g' ) { /* -bg background color */ + p++; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (strncmp(p,"Transparent",11) == 0 ) + option_flags |= BG_TRANSPARENT_ALPHA; + else if (strncmp(p,"transparent",11) == 0 ) + option_flags |= BG_TRANSPARENT; + else + background(p); + if (option_flags & BG_TRANSPARENT) + Message(PARSE_STDIN,"Transp. background (fallback rgb %d,%d,%d)\n", + cstack[0].red,cstack[0].green,cstack[0].blue); + else + Message(PARSE_STDIN,"Background: rgb %d,%d,%d\n", + cstack[0].red,cstack[0].green,cstack[0].blue); + break; + } else if (strcmp(p, "dpi")==0) { + p+=3; + if (*p == 0 && argv[i+1]) + p = argv[++i]; + number = atoi(p); + if (number < 10 || number > 10000) + Warning("Bad --bdpi parameter, ignored"); + else { + user_bdpi=number; + Message(PARSE_STDIN,"Bdpi: %d\n",user_bdpi); + } + break; + } else if ( *p == 'd' ) { /* -bd border width */ + int tmpi; + char* tmps; + p++; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + tmpi = strtol(p, &tmps, 10); + if (p<tmps) { + borderwidth=tmpi; + Message(PARSE_STDIN,"Transp. border: %d dots\n",borderwidth); + } + if (*tmps) { + stringrgb(tmps, &bordercolor.red, &bordercolor.green, &bordercolor.blue); + userbordercolor=TRUE; + if (borderwidth==0) { + borderwidth=1; + Message(PARSE_STDIN,"Transp. border: %d dots\n",borderwidth); + } + Message(PARSE_STDIN,"Transp. border: rgb %d,%d,%d\n", + bordercolor.red, bordercolor.green, bordercolor.blue); + } + break; + } + goto DEFAULT; + case 'f': + if ( *p == 'g' ) { /* -fg foreground color */ + p++; + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + resetcolorstack(p); + Message(PARSE_STDIN,"Foreground: rgb %d,%d,%d\n", + cstack[1].red,cstack[1].green,cstack[1].blue); + break; +#ifdef HAVE_FT2 + } else if ( strncmp(p,"reetype",7) == 0 ) { /* -freetype activation */ + if (p[7] != '0') { + option_flags |= USE_FREETYPE; + Message(PARSE_STDIN,"FreeType rendering on\n",p); + } else { + option_flags &= ~USE_FREETYPE; + Message(PARSE_STDIN,"FreeType rendering off\n"); + } + break; +#endif + } else if (strcmp(p,"ollow") == 0 ) { + if (DVIFollowToggle()) + Message(PARSE_STDIN,"Follow mode on\n"); + else + Message(PARSE_STDIN,"Follow mode off\n"); + break; + } + goto DEFAULT; + case 'x' : case 'y' : + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + number = atoi(p); + if (number < 1 || number > 1000000) + Warning("Bad magnification parameter (-x or -y), ignored"); + else { + usermag=number; + Message(PARSE_STDIN,"Magstep: %d\n",usermag); + /*overridemag = (c == 'x' ? 1 : -1) ;*/ + } + break ; + case 'g' : + if (strncmp(p,"amma",4)==0) { /* --gamma correction */ + double gamma=0.0; + + p+=4; + if (*p == 0 && argv[i+1]) + p = argv[++i]; + if (p!=NULL) + gamma=atof(p); + if (gamma==0.0) { + Warning("Bad gamma value, default is %f",DEFAULT_GAMMA); + gamma=DEFAULT_GAMMA; + } + Gamma(gamma); + Message(PARSE_STDIN,"Gamma value is %s\n", gamma); + break; +#ifdef HAVE_GDIMAGEGIF + } else if (strncmp(p,"if",2)==0) { /* --gif output */ + option_flags |= GIF_OUTPUT; + Message(PARSE_STDIN,"GIF output\n"); + break; +#endif + } + goto DEFAULT; + case 'p' : + if (*p == 'p') { /* a -pp specifier for a page list */ + ppused=true; + p++ ; + if (*p == 0 && argv[i+1]) + p = argv[++i]; + Message(PARSE_STDIN,"Page list: %s\n",p); + if (ParsePages(p)) + Fatal("bad page list specifier (-pp)"); + } else if (strncmp(p,"ng",2)==0) { /* --png output */ + option_flags &= ~GIF_OUTPUT; + Message(PARSE_STDIN,"PNG output\n"); + } else if (strncmp(p,"icky",4)==0) { + if (p[4] != '0') { + option_flags |= MODE_PICKY; + Message(PARSE_STDIN,"No images output for pages with warnings\n",p); + } else { + option_flags &= ~MODE_PICKY; + Message(PARSE_STDIN,"Images output even for pages with warnings\n"); + } + } else if (strncmp(p,"alette",6)==0) { + if (p[6] != '0') { + option_flags |= FORCE_PALETTE; + Message(PARSE_STDIN,"Forcing 256-color PNG output\n",p); + } else { + option_flags &= ~FORCE_PALETTE; + Message(PARSE_STDIN,"Allows truecolor PNG output\n"); + } + } else { /* a -p specifier for first page */ + int32_t firstpage; + bool abspage=false; + + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (*p == '=') { + abspage=true; + p++ ; + } + if ((*p>='0'&&*p<='9') || (*p=='-' && *(p+1)>='0' && *(p+1)<='9')) { + firstpage = atoi(p); + FirstPage(firstpage,abspage); + Message(PARSE_STDIN,"First page: %d\n",firstpage); + } else + Warning("Bad firstpage (-p) parameter, ignored"); + } + break ; + case 's' : + if (strncmp(p,"trict",5)==0) { + if (p[5] != '0') { + option_flags |= MODE_STRICT; + Message(PARSE_STDIN,"Warnings are fatal\n",p); + } else { + option_flags &= ~MODE_STRICT; + Message(PARSE_STDIN,"Warnings are not fatal\n"); + } + } else + goto DEFAULT; + break ; + case 'n' : + if (strncmp(p,"oghostscript",12)==0) { + if (p[12] != '0') { + option_flags |= NO_GHOSTSCRIPT; + Message(PARSE_STDIN,"No GhostScript calls\n",p); + } else { + option_flags &= ~NO_GHOSTSCRIPT; + Message(PARSE_STDIN,"GhostScript calls made\n"); + } + } else if (strncmp(p,"ogssafer",8)==0) { + if (p[8] != '0') { + option_flags |= NO_GSSAFER; + Message(PARSE_STDIN,"GhostScript calls does not use -dSAFER\n",p); + } else { + option_flags &= ~NO_GSSAFER; + Message(PARSE_STDIN,"GhostScript calls use -dSAFER\n"); + } + } else + goto DEFAULT; + break ; + case 'l': + { + int32_t lastpage; + bool abspage=false; + + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + if (*p == '=') { + abspage=true; + p++ ; + } + if ((*p>='0'&&*p<='9') || (*p=='-' && *(p+1)>='0' && *(p+1)<='9')) { + lastpage = atoi(p); + LastPage(lastpage,abspage); + Message(PARSE_STDIN,"Last page: %d\n",lastpage); + } else + Warning("Bad lastpage (-l) parameter, ignored"); + } + break ; + case 'q': /* quiet operation */ + if (*p != '0') + option_flags &= (~BE_NONQUIET & ~BE_VERBOSE); + else + option_flags |= BE_NONQUIET; + break; + case 'r': /* process pages in reverse order */ + if (*p != '0') { + Message(PARSE_STDIN,"Reverse order\n"); + Reverse(true); + } else { + Message(PARSE_STDIN,"Normal order\n"); + Reverse(false); + } + break; + case 'v': /* verbatim mode */ + if (strcmp(p, "ersion")==0) { + if (strcmp(basename(programname),PACKAGE_NAME)!=0) + printf("%s (%s) %s\n",basename(programname), + PACKAGE_NAME,PACKAGE_VERSION); + else + puts(PACKAGE_STRING); +#ifdef HAVE_LIBKPATHSEA + puts (KPSEVERSION); +#endif +#ifdef HAVE_FT2 + printf("Compiled with Freetype %d.%d.%d\n", + FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); +# ifdef HAVE_FT_LIBRARY_VERSION + if (FT_Init_FreeType( &libfreetype )) + Warning("the Freetype library seems unusable"); + else { + FT_Int amajor, aminor, apatch; + + FT_Library_Version( libfreetype, &amajor, &aminor, &apatch ); + printf("Using libft %d.%d.%d\n",amajor, aminor, apatch); + FT_Done_FreeType(libfreetype); + } +# endif +#endif +#ifdef HAVE_LIBT1 + printf("Using t1lib %s\n", T1_GetLibIdent()); +#endif + puts ("Copyright (C) 2002-2008 Jan-Ake Larsson.\n\ +There is NO warranty. You may redistribute this software\n\ +under the terms of the GNU Lesser General Public License\n\ +version 3, see the COPYING file in the dvipng distribution\n\ +or <http://www.gnu.org/licenses/>."); + exit (EXIT_SUCCESS); + } + if (*p != '0') + option_flags |= BE_NONQUIET | BE_VERBOSE; + else + option_flags &= ~BE_VERBOSE; + break; + case 'D' : + if (*p == 0 && argv[i+1]) + p = argv[++i] ; + number = atoi(p); + if (number < 10 || number > 10000) + Warning("Bad resolution (-D) parameter, ignored") ; + else { + dpi=number; + Message(PARSE_STDIN,"Dpi: %d\n",dpi); + } + break; + case 'Q': /* quality (= shrinkfactor) */ + if (*p == 0 && argv[i+1]) + p = argv[++i]; + if (*p>='0'&&*p<='9') { + shrinkfactor = atoi(p); + Message(PARSE_STDIN,"Quality: %d\n",shrinkfactor); + } else { + Warning("Non-numeric quality (-Q) value, ignored"); + } + break; +#ifdef HAVE_GDIMAGEPNGEX + case 'z': + if (*p == 0 && argv[i+1]) + p = argv[++i]; + number = atoi(p); + if (number<1 || number>9) + Warning("Bad compression (-z) value, ignored"); + else { + compression=number; + Message(PARSE_STDIN,"Compression: %d\n",shrinkfactor); + } + break; +#endif + case '\0': + option_flags |= PARSE_STDIN; + break; + DEFAULT: default: + Warning("%s is not a valid option", argv[i]); + } + } else { + dviname=argv[i]; + } + } + if (dviname != NULL) { + if (dvi != NULL && dvi->filep != NULL) + DVIClose(dvi); + dvi=DVIOpen(dviname,outname); + } + + if (dvi==NULL) { + fprintf(stdout,"\nUsage: %s [OPTION]... FILENAME[.dvi]\n", programname); + fprintf(stdout,"Options are chosen to be similar to dvips' options where possible:\n"); +#ifdef DEBUG + fprintf(stdout," -d # Debug (# is the debug bitmap, 1 if not given)\n"); +#endif + fprintf(stdout," -D # Output resolution\n"); + fprintf(stdout," -l # Last page to be output\n"); + fprintf(stdout," -o f Output file, '%%d' is pagenumber\n"); + fprintf(stdout," -O c Image offset\n"); + fprintf(stdout," -p # First page to be output\n"); + fprintf(stdout," -pp #,#.. Page list to be output\n"); + fprintf(stdout," -q* Quiet operation\n"); + fprintf(stdout," -T c Image size (also accepts '-T bbox' and '-T tight')\n"); + fprintf(stdout," -v* Verbose operation\n"); + fprintf(stdout," - Interactive query of options\n"); + fprintf(stdout,"\nThese do not correspond to dvips options:\n"); + fprintf(stdout," -bd # Transparent border width in dots\n"); + fprintf(stdout," -bd s Transparent border fallback color (TeX-style color)\n"); + fprintf(stdout," -bg s Background color (TeX-style color or 'Transparent')\n"); + fprintf(stdout," --depth* Output the image depth on stdout\n"); + fprintf(stdout," --dvinum* Use TeX page numbers in output filenames\n"); + fprintf(stdout," -fg s Foreground color (TeX-style color)\n"); + fprintf(stdout," --follow* Wait for data at end-of-file\n"); +#ifdef HAVE_FT2 + fprintf(stdout," --freetype* FreeType font rendering (default on)\n"); +#endif + fprintf(stdout," --gamma # Control color interpolation\n"); +#ifdef HAVE_GDIMAGEGIF + fprintf(stdout," --gif Output GIF images (dvigif default)\n"); +#endif + fprintf(stdout," --height* Output the image height on stdout\n"); + fprintf(stdout," --noghostscript* Don't use ghostscript for PostScript specials\n"); + fprintf(stdout," --nogssafer* Don't use -dSAFER in ghostscript calls\n"); +#ifdef HAVE_GDIMAGECREATETRUECOLOR + fprintf(stdout," --palette* Force palette output\n"); +#endif + fprintf(stdout," --picky When a warning occurs, don't output image\n"); +#ifdef HAVE_GDIMAGEGIF + fprintf(stdout," --png Output PNG images (dvipng default)\n"); +#endif + fprintf(stdout," --strict When a warning occurs, exit\n"); +#ifdef HAVE_LIBT1 + fprintf(stdout," --t1lib* T1lib font rendering (default on)\n"); +#endif +#ifdef HAVE_GDIMAGECREATETRUECOLOR + fprintf(stdout," --truecolor* Truecolor output\n"); +#endif + fprintf(stdout," -Q # Quality (T1lib and PK subsampling)\n"); +#ifdef HAVE_GDIMAGEPNGEX + fprintf(stdout," -z # PNG compression level\n"); +#endif + + fprintf(stdout,"\n # = number f = file s = string * = suffix, '0' to turn off\n"); + fprintf(stdout," c = comma-separated dimension pair (e.g., 3.2in,-32.1cm)\n\n"); + /*#ifdef HAVE_LIBKPATHSEA + { + extern DllImport char *kpse_bug_address; + putc ('\n', stdout); + fputs (kpse_bug_address, stdout); + } + #endif*/ + if ((option_flags & PARSE_STDIN) == 0) { + exit(EXIT_SUCCESS); + } + } + if ((option_flags & PARSE_STDIN) == 0 && (!ppused)) + ParsePages("-"); + return((option_flags & PARSE_STDIN) != 0); +} + +void DecodeString(char *string) +{ +#define PARSEARGS 10 + char *strv[PARSEARGS]; + int strc=1; + strv[0]=NULL; /* No program name */ + + while (*string==' ' || *string=='\t' || *string=='\n') + string++; + while (*string!='\0') { + strv[strc++]=string; + if (*string!='\'') { + /* Normal split at whitespace */ + while (*string!=' ' && *string!='\t' && *string!='\n' && *string!='\0') + string++; + } else { + /* String delimiter found , so search for next */ + strv[strc-1]=++string; + while (*string!='\'' && *string!='\0') + string++; + } + if (*string!='\0') + *string++='\0'; + while (*string==' ' || *string=='\t' || *string=='\n') + string++; + } + if (strc>1) /* Nonempty */ + (void) DecodeArgs(strc,strv); +} + + + +uint32_t UNumRead(unsigned char* current, register int n) +{ + uint32_t x = (unsigned char) *(current)++; /* number being constructed */ + while(--n) + x = (x << 8) | *(current)++; + return(x); +} + +int32_t SNumRead(unsigned char* current, register int n) +{ + int32_t x = (signed char) *(current)++; /* number being constructed */ + while(--n) + x = (x << 8) | *(current)++; + return(x); +} + + +/**********************************************************************/ +/****************************** Fatal *******************************/ +/**********************************************************************/ +void Fatal (char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + fflush(stdout); + fprintf(stderr, "\n"); + fprintf(stderr, "%s: Fatal error, ", programname); + vfprintf(stderr, fmt, args); + + fprintf(stderr, "\n\n"); + va_end(args); + + ClearFonts(); +#ifdef HAVE_FT2 + if (libfreetype) + (void) FT_Done_FreeType(libfreetype); /* at this point, ignore error */ +#endif +#ifdef HAVE_LIBT1 + if (libt1) + (void) T1_CloseLib(); /* at this point, ignore error */ +#endif + exit(EXIT_FATAL); +} + +/*-->Warning*/ +/**********************************************************************/ +/***************************** Warning ******************************/ +/**********************************************************************/ +void Warning(char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + + if ( option_flags & BE_NONQUIET ) { + fflush(stdout); + fprintf(stderr, "%s warning: ", programname); + vfprintf(stderr, fmt, args); + fprintf(stderr, " "); + } + va_end(args); +} + +/*-->Message*/ +/**********************************************************************/ +/***************************** Message ******************************/ +/**********************************************************************/ +void Message(int activeflags, char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + if ( option_flags & activeflags ) { + vfprintf(stdout, fmt, args); + } + va_end(args); +} + + +bool MmapFile (char *filename,struct filemmap *fmmap) +{ +#ifndef MIKTEX + struct stat stat; +#endif + + DEBUG_PRINT(DEBUG_DVI,("\n OPEN FILE:\t'%s'", filename)); + fmmap->data=NULL; +#ifndef MIKTEX + if ((fmmap->fd = open(filename,O_RDONLY)) == -1) { + Warning("cannot open file <%s>", filename); + return(true); + } + fstat(fmmap->fd,&stat); + fmmap->size=stat.st_size; +# ifdef HAVE_MMAP + fmmap->data = mmap(NULL,fmmap->size, PROT_READ, MAP_SHARED,fmmap->fd,0); + if (fmmap->data == (char*)-1) { + Warning("cannot mmap file <%s>",filename); + fmmap->data=NULL; + close(fmmap->fd); + return(true); + } +# else /* HAVE_MMAP */ + fmmap->data = malloc(fmmap->size); + if (fmmap->data == NULL) { + Warning("cannot malloc space for <%s>",filename); + close(fmmap->fd); + return(true); + } + if (read(fmmap->fd,fmmap->data,fmmap->size)<fmmap->size) { + Warning("too little data in <%s>",filename); + free(fmmap->data); + fmmap->data=NULL; + close(fmmap->fd); + return(true); + } + close(fmmap->fd); +# endif /* HAVE_MMAP */ +#else /* MIKTEX */ + fmmap->hFile = CreateFile(filename, GENERIC_READ, FILE_SHARE_READ, 0, + OPEN_EXISTING, FILE_FLAG_RANDOM_ACCESS, 0); + if (fmmap->hFile == INVALID_HANDLE_VALUE) { + Warning("cannot open file <%s>", filename); + return(true); + } + fmmap->size = GetFileSize(fmmap->hFile, 0); + fmmap->hMap = CreateFileMapping(fmmap->hFile, 0, PAGE_READONLY, 0, 0, 0); + if (fmmap->hMap == 0) { + CloseHandle (fmmap->hFile); + Warning("cannot CreateFileMapping() file <%s>", filename); + return(true); + } + fmmap->data = MapViewOfFile(fmmap->hMap, FILE_MAP_READ, 0, 0, 0); + if (fmmap->data == NULL) { + Warning("cannot MapViewOfFile() file <%s>", filename); + CloseHandle (fmmap->hMap); + CloseHandle (fmmap->hFile); + return(true); + } +#endif /* MIKTEX */ + return(false); +} + +void UnMmapFile(struct filemmap* fmmap) +{ + if (fmmap->data!=NULL) { +#ifndef MIKTEX +# ifdef HAVE_MMAP + if (munmap(fmmap->data,fmmap->size)) + Warning("cannot munmap file at 0x%X",fmmap->data); + if (close(fmmap->fd)) + Warning("cannot close file descriptor %d",fmmap->fd); +# else /* HAVE_MMAP */ + free(fmmap->data); +# endif /* HAVE_MMAP */ +#else /* MIKTEX */ + UnmapViewOfFile (fmmap->data); + CloseHandle (fmmap->hMap); + CloseHandle (fmmap->hFile); +#endif /* MIKTEX */ + } + fmmap->data=NULL; +} diff --git a/Build/source/texk/dvipng/pk.c b/Build/source/texk/dvipng/pk.c index 471ba11d34b..f2d6eb0a70a 100644 --- a/Build/source/texk/dvipng/pk.c +++ b/Build/source/texk/dvipng/pk.c @@ -23,7 +23,7 @@ ************************************************************************/ #include "dvipng.h" -#if HAVE_ALLOCA_H +#ifdef HAVE_ALLOCA_H # include <alloca.h> #endif diff --git a/Build/source/texk/dvipng/pk.c-1.12 b/Build/source/texk/dvipng/pk.c-1.12 new file mode 100644 index 00000000000..471ba11d34b --- /dev/null +++ b/Build/source/texk/dvipng/pk.c-1.12 @@ -0,0 +1,407 @@ +/* pk.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +#define PK_POST 245 +#define PK_PRE 247 +#define PK_ID 89 + +unsigned char dyn_f; +int repeatcount; +int poshalf; + +unsigned char getnyb(unsigned char** pos) +{ + if (poshalf == 0) { + poshalf=1; + return(**pos / 16); + } else { + poshalf=0; + return(*(*pos)++ & 15); + } +} + +uint32_t pk_packed_num(unsigned char** pos) +{ + register int i; + uint32_t j; + + i = (int)getnyb(pos); + if (i == 0) { + do { + j = (uint32_t)getnyb(pos); + i++; + } while (j == 0); + while (i > 0) { + j = j * 16 + (uint32_t)getnyb(pos); + i--; + }; + return (j - 15 + (13 - dyn_f) * 16 + dyn_f); + } else if (i <= (int)dyn_f) { + return ((uint32_t)i); + } else if (i < 14) { + return ((i-(uint32_t)dyn_f - 1) * 16 + (uint32_t)getnyb(pos) + + dyn_f + 1); + } else { + if (i == 14) { + repeatcount = (int)pk_packed_num(pos); + } else { + repeatcount = 1; + } + return (pk_packed_num(pos)); /* tail end recursion !! */ + } +} + +unsigned char* skip_specials(unsigned char* pos) +{ + uint32_t i; + + while (*pos >= 240 && *pos != PK_POST) { + i=0; + switch (*pos++) { + case 243: + i = *pos++; + case 242: + i = 256 * i + *pos++; + case 241: + i = 256 * i + *pos++; + case 240: + i = 256 * i + *pos++; + DEBUG_PRINT(DEBUG_PK,("\n PK SPECIAL\t'%.*s' ",(int)i,pos)); + pos += i; + break; + case 244: +#ifdef DEBUG + { + uint32_t c; + c=UNumRead(pos,4); + DEBUG_PRINT(DEBUG_PK,("\n PK SPECIAL\t%d",c)); + } +#endif + pos += 4; + break; + case 245: + break; + case 246: + DEBUG_PRINT(DEBUG_PK,("\n PK\tNOP ")); + break; + case 247: case 248: case 249: case 250: + case 251: case 252: case 253: case 254: + case 255: + Fatal("unexpected PK flagbyte %d", (int)*pos); + } + } + return(pos); +} + + +void LoadPK(int32_t c, register struct char_entry * ptr) +{ + unsigned short shrunk_width,shrunk_height; + unsigned short width,height; + short xoffset,yoffset; + unsigned short i_offset,j_offset; + int i,j,k,n; + int count=0; + bool paint_switch; + unsigned char *pos,*buffer; + + DEBUG_PRINT(DEBUG_PK,("\n LOAD PK CHAR\t%d",c)); + pos=ptr->pkdata; + if ((ptr->flag_byte & 7) == 7) n=4; + else if ((ptr->flag_byte & 4) == 4) n=2; + else n=1; + dyn_f = ptr->flag_byte / 16; + paint_switch = ((ptr->flag_byte & 8) != 0); + /* + * Read character preamble + */ + if (n != 4) { + ptr->tfmw = UNumRead(pos, 3); + /* +n: vertical escapement not used */ + pos+=3+n; + } else { + ptr->tfmw = UNumRead(pos, 4); + /* +4: horizontal escapement not used */ + /* +n: vertical escapement not used */ + pos+=8+n; + } + DEBUG_PRINT(DEBUG_PK,(" %d",ptr->tfmw)); + ptr->tfmw = (dviunits) + ((int64_t) ptr->tfmw * currentfont->s / 0x100000 ); + DEBUG_PRINT(DEBUG_PK,(" (%d)",ptr->tfmw)); + + width = UNumRead(pos, n); + height = UNumRead(pos+=n, n); + DEBUG_PRINT(DEBUG_PK,(" %dx%d",width,height)); + + if (width > 0x7fff || height > 0x7fff) + Fatal("character %d too large in file %s", c, currentfont->name); + + /* + * Hotspot issues: Shrinking to the topleft corner rather than the + hotspot will displace glyphs a fraction of a pixel. We deal with + this in as follows: The glyph is shrunk to its hotspot by + offsetting the bitmap somewhat to put the hotspot in the lower + left corner of a "shrink square". Shrinking to the topleft corner + will then act as shrinking to the hotspot. This may enlarge the + bitmap somewhat, of course. (Also remember that the below + calculation of i/j_offset is in integer arithmetics.) + + There will still be a displacement from rounding the dvi + position, but vertically it will be equal for all glyphs on a + line, so we displace a whole line vertically by fractions of a + pixel. This is acceptible, IMHO. Sometime there will be support + for subpixel positioning, horizontally. Will do for now, I + suppose. + */ + xoffset = SNumRead(pos+=n, n); + i_offset = ( shrinkfactor - xoffset % shrinkfactor ) % shrinkfactor; + width += i_offset; + ptr->xOffset = xoffset+i_offset; + + yoffset = SNumRead(pos+=n, n); + j_offset = ( shrinkfactor - (yoffset-(shrinkfactor-1)) % shrinkfactor ) + % shrinkfactor; + height += j_offset; + ptr->yOffset = yoffset+j_offset; + + DEBUG_PRINT(DEBUG_PK,(" (%dx%d)",width,height)); + /* + Extra marginal so that we do not crop the image when shrinking. + */ + shrunk_width = (width + shrinkfactor - 1) / shrinkfactor; + shrunk_height = (height + shrinkfactor - 1) / shrinkfactor; + ptr->w = shrunk_width; + ptr->h = shrunk_height; + pos+=n; + buffer = alloca(shrunk_width*shrunk_height* + shrinkfactor*shrinkfactor*sizeof(char)); + (void)memset(buffer,0,shrunk_width*shrunk_height* + shrinkfactor*shrinkfactor*sizeof(char)); + DEBUG_PRINT(DEBUG_GLYPH,("\nDRAW GLYPH %d\n", (int)c)); + /* + Raster char + */ + if (dyn_f == 14) { /* get raster by bits */ + int bitweight = 0; + for (j = j_offset; j < (int) height; j++) { /* get all rows */ + for (i = i_offset; i < (int) width; i++) { /* get one row */ + bitweight /= 2; + if (bitweight == 0) { + count = *pos++; + bitweight = 128; + } + if (count & bitweight) { + buffer[i+j*width]=1; +#ifdef DEBUG + DEBUG_PRINT(DEBUG_GLYPH,("+")); + } else { + DEBUG_PRINT(DEBUG_GLYPH,(" ")); +#endif + } + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } + } else { /* get packed raster */ + poshalf=0; + repeatcount = 0; + for(i=i_offset, j=j_offset; j<height; ) { + count = pk_packed_num(&pos); + while (count > 0) { + if (i+count < width) { + if (paint_switch) + for(k=0;k<count;k++) { + buffer[k+i+j*width]=1; + DEBUG_PRINT(DEBUG_GLYPH,("*")); + } +#ifdef DEBUG + else for(k=0;k<count;k++) + DEBUG_PRINT(DEBUG_GLYPH,(" ")); +#endif + i += count; + count = 0; + } else { + if (paint_switch) + for(k=i;k<width;k++) { + buffer[k+j*width]=1; + DEBUG_PRINT(DEBUG_GLYPH,("#")); + } +#ifdef DEBUG + else for(k=i;k<width;k++) + DEBUG_PRINT(DEBUG_GLYPH,(" ")); +#endif + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + j++; + count -= width-i; + /* Repeat row(s) */ + for (;repeatcount>0; repeatcount--,j++) { + for (i = i_offset; i<width; i++) { + buffer[i+j*width]=buffer[i+(j-1)*width]; +#ifdef DEBUG + if (buffer[i+j*width]>0) { + DEBUG_PRINT(DEBUG_GLYPH,("=")); + } else { + DEBUG_PRINT(DEBUG_GLYPH,(" ")); + } +#endif + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } + i=i_offset; + } + } + paint_switch = 1 - paint_switch; + } + if (i>i_offset) + Fatal("wrong number of bits stored: char. %c, font %s", + (char)c, currentfont->name); + if (j>height) + Fatal("bad PK file %s, too many bits", currentfont->name); + } + /* + Shrink raster while doing antialiasing. (See above. The + single-glyph output seems better than what xdvi at 300 dpi, + shrinkfactor 3 produces.) + */ + if ((ptr->data = calloc(shrunk_width*shrunk_height,sizeof(char))) == NULL) + Fatal("unable to allocate image space for char %c", (char)c); + for (j = 0; j < (int) height; j++) { + for (i = 0; i < (int) width; i++) { + /* if (((i % shrinkfactor) == 0) && ((j % shrinkfactor) == 0)) + ptr->data[i/shrinkfactor+j/shrinkfactor*shrunk_width] = + buffer[i+j*width]; + else */ + ptr->data[i/shrinkfactor+j/shrinkfactor*shrunk_width] += + buffer[i+j*width]; + } + } + for (j = 0; j < shrunk_height; j++) { + for (i = 0; i < shrunk_width; i++) { + ptr->data[i+j*shrunk_width] = ptr->data[i+j*shrunk_width] + *255/shrinkfactor/shrinkfactor; + DEBUG_PRINT(DEBUG_GLYPH,("%3u ",ptr->data[i+j*shrunk_width])); + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } +} + +void InitPK(struct font_entry * tfontp) +{ + unsigned char* position; + struct char_entry *tcharptr; /* temporary char_entry pointer */ + uint32_t hppp, vppp, packet_length; + uint32_t c; + + DEBUG_PRINT((DEBUG_DVI|DEBUG_PK),("\n OPEN FONT:\t'%s'", tfontp->name)); + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (MmapFile(tfontp->name,&(tfontp->fmmap))) + Fatal("font file %s unusable", tfontp->name); + position=(unsigned char*)tfontp->fmmap.data; + if (tfontp->fmmap.size < 2 || tfontp->fmmap.size < 3+*(position+2)+16) + Fatal("PK file %s ends prematurely",tfontp->name); + if (*position++ != PK_PRE) + Fatal("unknown font format in file %s",tfontp->name); + if (*position++ != PK_ID) + Fatal( "wrong version %d of PK file %s (should be 89)", + (int)*(position-1),tfontp->name); + DEBUG_PRINT(DEBUG_PK,("\n PK_PRE:\t'%.*s'",(int)*position, position+1)); + position += *position + 1; + + tfontp->designsize = UNumRead(position, 4); + DEBUG_PRINT(DEBUG_PK,(" %d", tfontp->designsize)); + tfontp->type = FONT_TYPE_PK; + + c = UNumRead(position+4, 4); + DEBUG_PRINT(DEBUG_PK,(" %d", c)); + CheckChecksum (tfontp->c, c, tfontp->name); + + hppp = UNumRead(position+8, 4); + vppp = UNumRead(position+12, 4); + DEBUG_PRINT(DEBUG_PK,(" %d %d", hppp,vppp)); + if (hppp != vppp) + Warning("aspect ratio is %d:%d (should be 1:1)", hppp, vppp); + tfontp->magnification = (uint32_t)((uint64_t)hppp * 7227 * 5 / 65536l + 50)/100; + position+=16; + /* Read char definitions */ + position = skip_specials(position); + while (*position != PK_POST) { + DEBUG_PRINT(DEBUG_PK,("\n @%ld PK CHAR:\t%d", + (long)position - (long)tfontp->fmmap.data, *position)); + if ((tcharptr = malloc(sizeof(struct char_entry))) == NULL) + Fatal("cannot malloc space for char_entry"); + tcharptr->flag_byte = *position; + tcharptr->data = NULL; + tcharptr->tfmw = 0; + if ((*position & 7) == 7) { + packet_length = UNumRead(position+1,4); + c = UNumRead(position+5, 4); + position += 9; + } else if (*position & 4) { + packet_length = (*position & 3) * 65536l + + UNumRead(position+1, 2); + c = UNumRead(position+3, 1); + position += 4; + } else { + packet_length = (*position & 3) * 256 + + UNumRead(position+1, 1); + c = UNumRead(position+2, 1); + position += 3; + } + DEBUG_PRINT(DEBUG_PK,(" %d %d",packet_length,c)); + if (c > (LASTFNTCHAR)) + Fatal("PK font %s exceeds char numbering limit",tfontp->name); + tcharptr->length = packet_length; + tcharptr->pkdata = position; + tfontp->chr[c]=tcharptr; + position += packet_length; + position = skip_specials(position); + } +} + +void UnLoadPK(struct char_entry *ptr) +{ + if (ptr->data!=NULL) + free(ptr->data); + ptr->data=NULL; +} + +void DonePK(struct font_entry *tfontp) +{ + int c=FIRSTFNTCHAR; + + UnMmapFile(&(tfontp->fmmap)); + while(c<=LASTFNTCHAR) { + if (tfontp->chr[c]!=NULL) { + UnLoadPK((struct char_entry*)tfontp->chr[c]); + free(tfontp->chr[c]); + } + c++; + } + tfontp->name[0]='\0'; +} diff --git a/Build/source/texk/dvipng/set.c b/Build/source/texk/dvipng/set.c index 48e3ce742b6..0a9693fed0c 100644 --- a/Build/source/texk/dvipng/set.c +++ b/Build/source/texk/dvipng/set.c @@ -23,7 +23,7 @@ ************************************************************************/ #include "dvipng.h" -#if HAVE_ALLOCA_H +#ifdef HAVE_ALLOCA_H # include <alloca.h> #endif #include <math.h> diff --git a/Build/source/texk/dvipng/set.c-1.12 b/Build/source/texk/dvipng/set.c-1.12 new file mode 100644 index 00000000000..48e3ce742b6 --- /dev/null +++ b/Build/source/texk/dvipng/set.c-1.12 @@ -0,0 +1,300 @@ +/* set.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif +#include <math.h> + +#ifndef HAVE_GDIMAGECREATETRUECOLOR +#define gdImageColorAllocateAlpha(i,r,g,b,a) gdImageColorAllocate(i,r,g,b) +#define gdImageColorResolveAlpha(i,r,g,b,a) gdImageColorResolve(i,r,g,b) +#define gdImageAlpha(i,c) 0 +#define gdAlphaMax 127 +#endif +#ifndef HAVE_GDIMAGEPNGEX +#define gdImagePngEx(i,f,z) gdImagePng(i,f) +#endif + +/* Persistent color cache. Index is ink thickness, + 0=no ink, 127=total coverage */ +static int ColorCache[gdAlphaMax+1]; + +void CreateImage(pixels x_width,pixels y_width) +{ + if (page_imagep) + gdImageDestroy(page_imagep); + if (x_width <= 0) x_width=1; + if (y_width <= 0) y_width=1; +#ifdef HAVE_GDIMAGECREATETRUECOLOR + /* GIFs are 256-color */ + if ((option_flags & FORCE_TRUECOLOR + || page_flags & PAGE_TRUECOLOR) + && ~option_flags & GIF_OUTPUT + && ~option_flags & FORCE_PALETTE) + page_imagep=gdImageCreateTrueColor(x_width,y_width); + else +#endif + page_imagep=gdImageCreate(x_width,y_width); + /* Set bg color. GIFs cannot handle an alpha channel, resort to + transparent color index, set in WriteImage */ + ColorCache[0] + = gdImageColorAllocateAlpha(page_imagep, + cstack[0].red, + cstack[0].green, + cstack[0].blue, + (option_flags & BG_TRANSPARENT_ALPHA + && ~option_flags & GIF_OUTPUT) ? 127 : 0); + ColorCache[gdAlphaMax]=-1; +#ifdef HAVE_GDIMAGECREATETRUECOLOR + /* Alpha blending in libgd is only performed for truecolor images. + We need it for palette images also. Turn libgd alpha blending off + and calculate color blending where needed. We turn it back on + briefly for image inclusion. */ + gdImageAlphaBlending(page_imagep, 0); + if (option_flags & BG_TRANSPARENT_ALPHA) + gdImageSaveAlpha(page_imagep, 1); + if (page_imagep->trueColor) + /* Truecolor: there is no background color index, fill image instead. */ + gdImageFilledRectangle(page_imagep, 0, 0, + x_width-1, y_width-1, ColorCache[0]); +#endif +} + + +void ChangeColor(gdImagePtr imagep,int x1,int y1, + int x2,int y2,int color1,int color2) +/* In the given rectangle, change color1 to color2 */ +{ + int x,y; + for( y=y1; y<=y2; y++) { + for( x=x1; x<=x2; x++) { + if (gdImageGetPixel(imagep, x, y)==color1) + gdImageSetPixel(imagep, x, y, color2); + } + } +} + +void WriteImage(char *pngname, int pagenum) +{ + char* pos; + FILE* outfp=NULL; + + /* Set transparent background. Maybe alpha is not available or + perhaps we are producing GIFs, so test for BG_TRANSPARENT_ALPHA + too */ + if (option_flags & (BG_TRANSPARENT|BG_TRANSPARENT_ALPHA)) + gdImageColorTransparent(page_imagep,ColorCache[0]); + /* Transparent border */ + if (borderwidth>0) { + int Transparent; + pixels x_width,y_width; + + x_width=gdImageSX(page_imagep); + y_width=gdImageSY(page_imagep); + + /* Set ANOTHER bg color, transparent this time */ + /* No semi-transparency here, given the motivation for this code + * (box cursor visibility in Emacs) */ + if (userbordercolor) + Transparent = gdImageColorAllocate(page_imagep, + bordercolor.red, + bordercolor.green, + bordercolor.blue); + else + Transparent = gdImageColorAllocate(page_imagep, + gdImageRed(page_imagep,ColorCache[0]), + gdImageGreen(page_imagep,ColorCache[0]), + gdImageBlue(page_imagep,ColorCache[0])); + gdImageColorTransparent(page_imagep,Transparent); + ChangeColor(page_imagep,0,0,x_width-1,borderwidth-1, + ColorCache[0],Transparent); + ChangeColor(page_imagep,0,0,borderwidth-1,y_width-1, + ColorCache[0],Transparent); + ChangeColor(page_imagep,x_width-borderwidth,0,x_width-1,y_width-1, + ColorCache[0],Transparent); + ChangeColor(page_imagep,0,y_width-borderwidth,x_width-1,y_width-1, + ColorCache[0],Transparent); + } + + if ((pos=strchr(pngname,'%')) != NULL) { + if (strchr(++pos,'%')) + Fatal("too many %%s in output file name"); + if (*pos == 'd' + || (*pos=='0' && pos[1]>='1' && pos[1]<='9' && pos[2]=='d')) { + /* %d -> pagenumber, so add 9 string positions + since pagenumber max +-2^31 or +-2*10^9 */ + char* tempname = alloca(strlen(pngname)+9); + sprintf(tempname,pngname,pagenum); + pngname = tempname; + } else { + Fatal("unacceptible format spec in output file name"); + } + } +#ifdef HAVE_GDIMAGEGIF + if (option_flags & GIF_OUTPUT && (pos=strrchr(pngname,'.')) != NULL + && strcmp(pos,".png")==0) { + *(pos+1)='g'; + *(pos+2)='i'; + *(pos+3)='f'; + } +#endif + if ((outfp = fopen(pngname,"wb")) == NULL) + Fatal("cannot open output file %s",pngname); +#ifdef HAVE_GDIMAGEGIF + if (option_flags & GIF_OUTPUT) + gdImageGif(page_imagep,outfp); + else +#endif + gdImagePngEx(page_imagep,outfp,compression); + fclose(outfp); + DEBUG_PRINT(DEBUG_DVI,("\n WROTE: \t%s\n",pngname)); + DestroyImage(); +} + +void DestroyImage(void) +{ + gdImageDestroy(page_imagep); + page_imagep=NULL; +} + +static int gammatable[]= + {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19, + 20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59, + 60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79, + 80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99, + 100,101,102,103,104,105,106,107,108,109, + 110,111,112,113,114,115,116,117,118,119, + 120,121,122,123,124,125,126,127}; + +void Gamma(double gamma) +{ + int i=0; + + while (i<=gdAlphaMax) { + gammatable[i]=gdAlphaMax- + (int)(pow((gdAlphaMax-i)/((double)gdAlphaMax),gamma)*gdAlphaMax); + DEBUG_PRINT(DEBUG_GLYPH, + ("\n GAMMA GREYSCALE: %d -> %d ",i,gammatable[i])); + i++; + } +} + +dviunits SetGlyph(int32_t c, int32_t hh,int32_t vv) +/* gdImageChar can only do monochrome glyphs */ +{ + register struct char_entry *ptr; + int dst_alpha,dst_weight,tot_weight,alpha; + int x,y,pos=0; + int bgColor,pixelgrey,pixelcolor; + + if (c<0 || c>LASTFNTCHAR) { + Warning("glyph index too large (%d), skipping",c); + return(0); + } + ptr=currentfont->chr[c]; + if (ptr==NULL) { + Warning("unable to draw glyph %d, skipping",c); + return(0); + } + hh -= ptr->xOffset/shrinkfactor; + vv -= ptr->yOffset/shrinkfactor; + /* Initialize persistent color cache. Perhaps this should be in + color.c? */ + pixelcolor=gdImageColorResolve(page_imagep, + cstack[csp].red, + cstack[csp].green, + cstack[csp].blue); + if (ColorCache[gdAlphaMax]!=pixelcolor) { + for( x=1; x<gdAlphaMax; x++ ) + ColorCache[x]=-1; + ColorCache[gdAlphaMax]=pixelcolor; + } + for( y=0; y<ptr->h; y++) { + for( x=0; x<ptr->w; x++) { + if (ptr->data[pos]>0) { + pixelgrey=gammatable[(int)ptr->data[pos]/2]; + bgColor = gdImageGetPixel(page_imagep, hh + x, vv + y); + if (ColorCache[0]!=bgColor || ColorCache[pixelgrey]==-1) { + DEBUG_PRINT(DEBUG_GLYPH,("\n GAMMA GREYSCALE: %d -> %d ", + ptr->data[pos]/2,pixelgrey)); + alpha = gdAlphaMax-pixelgrey; + dst_alpha = gdImageAlpha(page_imagep,bgColor); + dst_weight = (gdAlphaMax - dst_alpha) * alpha / gdAlphaMax; + tot_weight = pixelgrey + dst_weight; + pixelcolor = gdImageColorResolveAlpha(page_imagep, + (cstack[csp].red*pixelgrey + + gdImageRed(page_imagep,bgColor)*dst_weight)/tot_weight, + (cstack[csp].green*pixelgrey + + gdImageGreen(page_imagep,bgColor)*dst_weight)/tot_weight, + (cstack[csp].blue*pixelgrey + + gdImageBlue(page_imagep,bgColor)*dst_weight)/tot_weight, + alpha*dst_alpha/gdAlphaMax); + if (ColorCache[0]==bgColor) + ColorCache[pixelgrey]=pixelcolor; + } else + pixelcolor=ColorCache[pixelgrey]; + gdImageSetPixel(page_imagep, hh + x, vv + y, pixelcolor); + } + pos++; + } + } + return(ptr->tfmw); +} + +dviunits SetRule(dviunits a, dviunits b, subpixels hh,subpixels vv) +{ + /* This routine will draw a \rule */ + int Color; + pixels width=0, height=0; + + if ( a > 0 && b > 0 ) { + /* Calculate width and height, round up */ + width = (b+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + height = (a+dvi->conv*shrinkfactor-1)/dvi->conv/shrinkfactor; + } + if (page_imagep != NULL) { + if ((height>0) && (width>0)) { + /* This code produces too dark rules. But what the hell. Grey + * rules look fuzzy. */ + Color = gdImageColorResolve(page_imagep, + cstack[csp].red, + cstack[csp].green, + cstack[csp].blue); + /* +1 and -1 are because the Rectangle coords include last pixels */ + gdImageFilledRectangle(page_imagep,hh,vv-height+1,hh+width-1,vv,Color); + DEBUG_PRINT(DEBUG_DVI,("\n RULE \t%dx%d at (%d,%d)", + width, height, hh, vv)); + } + } else { + /* The +1's are because things are cut _at_that_coordinate_. */ + min(x_min,hh); + min(y_min,vv-height+1); + max(x_max,hh+width); + max(y_max,vv+1); + } + return(b); +} diff --git a/Build/source/texk/dvipng/t1.c b/Build/source/texk/dvipng/t1.c index 3fadfac3f6c..85803a47bb2 100644 --- a/Build/source/texk/dvipng/t1.c +++ b/Build/source/texk/dvipng/t1.c @@ -23,7 +23,7 @@ ************************************************************************/ #include "dvipng.h" -#if HAVE_ALLOCA_H +#ifdef HAVE_ALLOCA_H # include <alloca.h> #endif diff --git a/Build/source/texk/dvipng/t1.c-1.12 b/Build/source/texk/dvipng/t1.c-1.12 new file mode 100644 index 00000000000..3fadfac3f6c --- /dev/null +++ b/Build/source/texk/dvipng/t1.c-1.12 @@ -0,0 +1,193 @@ +/* t1.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +void LoadT1(int32_t c, struct char_entry * ptr) +{ + GLYPH *glyph; + int original_width,original_height; + int i,j,k,width,height; + unsigned short shrunk_width,shrunk_height; + short xoffset,yoffset; + unsigned short i_offset,j_offset; + + DEBUG_PRINT(DEBUG_T1,("\n LOAD T1 CHAR\t%d",c)); + if ((glyph= + T1_SetChar(currentfont->T1id, c, + (float)currentfont->dpi*currentfont->d/65536/72.27, + currentfont->psfontmap==NULL ? NULL : currentfont->psfontmap->t1_transformp)) + ==NULL) + Fatal("cannot load T1 char %d",c); + + DEBUG_PRINT(DEBUG_T1,(" (%d)",ptr->tfmw)); + + original_width = glyph->metrics.rightSideBearing + - glyph->metrics.leftSideBearing; + original_height = glyph->metrics.ascent - glyph->metrics.descent; + DEBUG_PRINT(DEBUG_T1,(" %dx%d",original_width,original_height)); + + if (original_width > 0x7fff || original_height > 0x7fff) + Fatal("character %d too large in file %s", c, currentfont->name); + + /* + * Hotspot issues: Shrinking to the topleft corner rather than the + hotspot will displace glyphs a fraction of a pixel. We deal with + this in as follows: The glyph is shrunk to its hotspot by + offsetting the bitmap somewhat to put the hotspot in the lower + left corner of a "shrink square". Shrinking to the topleft corner + will then act as shrinking to the hotspot. This may enlarge the + bitmap somewhat, of course. (Also remember that the below + calculation of i/j_offset is in integer arithmetics.) + + There will still be a displacement from rounding the dvi + position, but vertically it will be equal for all glyphs on a + line, so we displace a whole line vertically by fractions of a + pixel. This is acceptible, IMHO. Sometime there will be support + for subpixel positioning, horizontally. Will do for now, I + suppose. + */ + xoffset = -glyph->metrics.leftSideBearing; + /* printf("xoffset: %d\n",xoffset); */ + i_offset = ( shrinkfactor - xoffset % shrinkfactor ) % shrinkfactor; + width = original_width+i_offset; + ptr->xOffset = xoffset+i_offset; + + yoffset = glyph->metrics.ascent-1; + /* printf("yoffset: %d\n",yoffset); */ + j_offset = ( shrinkfactor - (yoffset-(shrinkfactor-1)) % shrinkfactor ) + % shrinkfactor; + height = original_height+j_offset; + ptr->yOffset = yoffset+j_offset; + + DEBUG_PRINT(DEBUG_T1,(" (%dx%d)",width,height)); + /* + Extra marginal so that we do not crop the image when shrinking. + */ + shrunk_width = (width + shrinkfactor - 1) / shrinkfactor; + shrunk_height = (height + shrinkfactor - 1) / shrinkfactor; + ptr->w = shrunk_width; + ptr->h = shrunk_height; + + /* printf("(%d,%d) ",ptr->w,ptr->h); */ + DEBUG_PRINT(DEBUG_GLYPH,("\nDRAW GLYPH %d\n", (int)c)); + + /* + Shrink raster while doing antialiasing. + */ + if ((ptr->data = calloc(shrunk_width*shrunk_height,sizeof(char))) == NULL) + Fatal("unable to allocate image space for char %c", (char)c); + for (j = 0; j < original_height; j++) { + for (i = 0; i < (original_width+7)/8 ; i++) { + for (k = 0; k < 8 ; k++) { + DEBUG_PRINT(DEBUG_GLYPH, + ("%c", + (glyph->bits[i+j*((original_width+7)/8)] & (1<<k)) ? + 'x' : ' ')); + ptr->data[(i*8+k+i_offset)/shrinkfactor + +(j+j_offset)/shrinkfactor*shrunk_width] += + (glyph->bits[i+j*((original_width+7)/8)] & (1<<k) ? 1 : 0); + } + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } + for (j = 0; j < shrunk_height; j++) { + for (i = 0; i < shrunk_width; i++) { + ptr->data[i+j*shrunk_width] = ptr->data[i+j*shrunk_width] + *255/shrinkfactor/shrinkfactor; + DEBUG_PRINT(DEBUG_GLYPH,("%3u ",ptr->data[i+j*shrunk_width])); + } + DEBUG_PRINT(DEBUG_GLYPH,("|\n")); + } +} + +bool InitT1(struct font_entry * tfontp) +{ + if (libt1==NULL) { + if ((libt1=T1_InitLib( NO_LOGFILE | IGNORE_CONFIGFILE + | IGNORE_FONTDATABASE | T1_NO_AFM)) == NULL) { + Warning("an error occured during t1lib initialisation, disabling it"); + option_flags &= ~USE_LIBT1; + return(false); + } +# ifdef DEBUG + else + DEBUG_PRINT(DEBUG_T1,("\n T1LIB VERSION: %s", T1_GetLibIdent())); +# endif + } + + DEBUG_PRINT((DEBUG_DVI|DEBUG_T1),("\n OPEN T1 FONT:\t'%s'", tfontp->name)); + tfontp->T1id = T1_AddFont( tfontp->name ); + if (tfontp->T1id < 0) { + Warning("t1lib could not open font file %s", tfontp->name); + return(false); + } + if (T1_LoadFont(tfontp->T1id)) { + Warning("t1lib could not load font file %s", tfontp->name); + return(false); + } + Message(BE_VERBOSE,"<%s>", tfontp->name); + if (tfontp->psfontmap!=NULL && tfontp->psfontmap->encoding != NULL) { + DEBUG_PRINT(DEBUG_T1,("\n USE ENCODING:\t'%s'", tfontp->psfontmap->encoding->name)); + if (T1_ReencodeFont(tfontp->T1id,tfontp->psfontmap->encoding->charname)) { + Warning("unable to use font encoding '%s' for %s", + tfontp->psfontmap->encoding->name,tfontp->name); + return(false); + } + } + tfontp->type = FONT_TYPE_T1; + return(true); +} + + +void UnLoadT1(struct char_entry *ptr) +{ + if (ptr->data!=NULL) + free(ptr->data); + ptr->data=NULL; +} + + +void DoneT1(struct font_entry *tfontp) +{ + int c=0; + + int error = T1_DeleteFont( tfontp->T1id ); + if (error) + Warning("font file %s could not be closed", tfontp->name); + while(c<NFNTCHARS) { + if (tfontp->chr[c]!=NULL) { + UnLoadT1((struct char_entry*)tfontp->chr[c]); + free(tfontp->chr[c]); + tfontp->chr[c]=NULL; + } + c++; + } + tfontp->name[0]='\0'; +} + + diff --git a/Build/source/texk/dvipng/tfm.c b/Build/source/texk/dvipng/tfm.c index 9dde751f2f7..81b89d0f7d1 100644 --- a/Build/source/texk/dvipng/tfm.c +++ b/Build/source/texk/dvipng/tfm.c @@ -23,7 +23,7 @@ ************************************************************************/ #include "dvipng.h" -#if HAVE_ALLOCA_H +#ifdef HAVE_ALLOCA_H # include <alloca.h> #endif diff --git a/Build/source/texk/dvipng/tfm.c-1.12 b/Build/source/texk/dvipng/tfm.c-1.12 new file mode 100644 index 00000000000..9dde751f2f7 --- /dev/null +++ b/Build/source/texk/dvipng/tfm.c-1.12 @@ -0,0 +1,79 @@ +/* tfm.c */ + +/************************************************************************ + + Part of the dvipng distribution + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this program. If not, see + <http://www.gnu.org/licenses/>. + + Copyright (C) 2002-2008 Jan-Åke Larsson + +************************************************************************/ + +#include "dvipng.h" +#if HAVE_ALLOCA_H +# include <alloca.h> +#endif + +bool ReadTFM(struct font_entry * tfontp, char* tfmname) +{ + struct filemmap fmmap; + struct char_entry *tcharptr; + unsigned char *position; + int lh,bc,ec,nw, c; + dviunits* width; + + DEBUG_PRINT((DEBUG_DVI|DEBUG_FT|DEBUG_TFM), + ("\n OPEN METRICS:\t'%s'", tfmname)); + if (MmapFile(tfmname,&fmmap)) return(false); + position=(unsigned char*)fmmap.data; + lh = UNumRead(position+2,2); + bc = UNumRead(position+4,2); + ec = UNumRead(position+6,2); + nw = UNumRead(position+8,2); + DEBUG_PRINT(DEBUG_TFM,(" %d %d %d %d",lh,bc,ec,nw)); + width=alloca(nw*sizeof(dviunits)); + c=0; + position=position+24+(lh+ec-bc+1)*4; + while( c < nw ) { + width[c] = SNumRead(position,4); + c++; + position += 4; + } + + /* Read char widths */ + c=bc; + position=(unsigned char*)fmmap.data+24+lh*4; + while(c <= ec) { + DEBUG_PRINT(DEBUG_TFM,("\n@%ld TFM METRICS:\t", + (long)position - (long)fmmap.data)); + tcharptr=xmalloc(sizeof(struct char_entry)); + tcharptr->data=NULL; + tcharptr->tfmw=width[*position]; + DEBUG_PRINT(DEBUG_TFM,("%d [%d] %d",c,*position,tcharptr->tfmw)); + tcharptr->tfmw = (dviunits) + ((int64_t) tcharptr->tfmw * tfontp->s / (1 << 20)); + DEBUG_PRINT(DEBUG_TFM,(" (%d)",tcharptr->tfmw)); + if (c >= NFNTCHARS) /* Only positive for now */ + Fatal("tfm file %s exceeds char numbering limit",tfmname); + tfontp->chr[c] = tcharptr; + c++; + position += 4; + } + UnMmapFile(&fmmap); + return(true); +} + + diff --git a/Build/source/texk/xdvik/Makefile.in b/Build/source/texk/xdvik/Makefile.in new file mode 100644 index 00000000000..010233990dd --- /dev/null +++ b/Build/source/texk/xdvik/Makefile.in @@ -0,0 +1,560 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = . +DIST_COMMON = $(am__configure_deps) \ + $(srcdir)/../../build-aux/config.guess \ + $(srcdir)/../../build-aux/config.sub \ + $(srcdir)/../../build-aux/install-sh \ + $(srcdir)/../../build-aux/ltmain.sh \ + $(srcdir)/../../build-aux/missing $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/c-auto.in \ + $(top_srcdir)/configure ../../build-aux/config.guess \ + ../../build-aux/config.sub ../../build-aux/depcomp \ + ../../build-aux/install-sh ../../build-aux/ltmain.sh \ + ../../build-aux/missing ../../build-aux/texinfo.tex \ + ../../build-aux/ylwrap INSTALL +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../m4/kpse-common.m4 \ + $(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \ + $(top_srcdir)/../../m4/kpse-t1lib-flags.m4 \ + $(top_srcdir)/../../m4/libtool.m4 \ + $(top_srcdir)/../../m4/ltoptions.m4 \ + $(top_srcdir)/../../m4/ltsugar.m4 \ + $(top_srcdir)/../../m4/ltversion.m4 \ + $(top_srcdir)/../../m4/lt~obsolete.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = c-auto.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d $(distdir) \ + || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr $(distdir); }; } +DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +KPATHSEA_DEPEND = @KPATHSEA_DEPEND@ +KPATHSEA_INCLUDES = @KPATHSEA_INCLUDES@ +KPATHSEA_LIBS = @KPATHSEA_LIBS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +T1LIB_DEPEND = @T1LIB_DEPEND@ +T1LIB_INCLUDES = @T1LIB_INCLUDES@ +T1LIB_LIBS = @T1LIB_LIBS@ +VERSION = @VERSION@ +XDVIK_VERSION = @XDVIK_VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +ACLOCAL_AMFLAGS = -I ../../m4 +EXTRA_DIST = BUGS CHANGES ChangeLog.TL FAQ LESSTIF-BUGS README.t1fonts \ + README.t1mapper alloc-debug.h browser.c browser.h c-openmx.h \ + dl_list.c dl_list.h dvi-draw.c dvi-draw.h dvi-init.c \ + dvi-init.h dvi.h dvisel.c dvisel.h encodings.c encodings.h \ + events.c events.h exit-handlers.c exit-handlers.h filehist.c \ + filehist.h font-open.c font-open.h gf.c gui/Makefile.in \ + gui/Panner.c gui/Panner.h gui/PannerP.h gui/Tip.c gui/Tip.h \ + gui/TipP.h gui/help-window.c gui/help-window.h gui/mag.c \ + gui/mag.h gui/menu.c gui/menu.h gui/message-window.c \ + gui/message-window.h gui/pagesel.c gui/pagesel.h \ + gui/print-dialog.c gui/print-dialog.h gui/print-log.c \ + gui/print-log.h gui/search-dialog.c gui/search-dialog.h \ + gui/selection.c gui/selection.h gui/sfDir.c gui/sfDir.h \ + gui/sfDraw.c gui/sfDraw.h gui/sfPath.c gui/sfPath.h \ + gui/sfSelFile.c gui/sfSelFile.h gui/sfinternal.h \ + gui/statusline.c gui/statusline.h gui/topic-window.c \ + gui/topic-window.h gui/xaw_bitmaps.c gui/xaw_bitmaps.h \ + gui/xaw_menu.c gui/xaw_menu.h gui/xicon.c gui/xicon.h \ + gui/xlwradio.c gui/xlwradio.h gui/xlwradioP.h \ + gui/xm_colorsel.c gui/xm_colorsel.h gui/xm_filesel.c \ + gui/xm_menu.c gui/xm_menu.h gui/xm_prefs.c gui/xm_prefs.h \ + gui/xm_prefsP.h gui/xm_prefs_appearance.c \ + gui/xm_prefs_appearance.h gui/xm_prefs_fonts.c \ + gui/xm_prefs_fonts.h gui/xm_prefs_helpers.c \ + gui/xm_prefs_helpers.h gui/xm_prefs_page.c gui/xm_prefs_page.h \ + gui/xm_prefs_scroll.c gui/xm_prefs_scroll.h gui/xm_toolbar.c \ + gui/xm_toolbar.h hypertex.c hypertex.h image-magick.c \ + image-magick.h main.c mime.c mime.h mksedscript my-snprintf.c \ + my-snprintf.h my-vsnprintf.c my-vsnprintf.h pagehist.c \ + pagehist.h pixmaps/drag_horiz.xbm pixmaps/drag_horiz_mask.xbm \ + pixmaps/drag_omni.xbm pixmaps/drag_omni_mask.xbm \ + pixmaps/drag_vert.xbm pixmaps/drag_vert_mask.xbm \ + pixmaps/fist.xbm pixmaps/fist_mask.xbm pixmaps/hand.xbm \ + pixmaps/hand_mask.xbm pixmaps/magglass.xbm \ + pixmaps/magglass_mask.xbm pixmaps/time16.xbm \ + pixmaps/time16_mask.xbm pixmaps/toolbar.xpm \ + pixmaps/toolbar2.xpm pixmaps/xdvi16x16.xpm \ + pixmaps/xdvi32x32.xpm pixmaps/xdvi48x48.xpm pk.c \ + print-internal.c print-internal.h psdps.c psdps.h psgs.c \ + psgs.h psheader.txt psnews.c psnews.h read-mapfile.c \ + read-mapfile.h search-internal.c search-internal.h special.c \ + special.h squeeze.c string-utils.c string-utils.h \ + string_list.c string_list.h t1mapper t1mapper.1 \ + tests/Makefile.in tests/README tests/run_tests.c \ + tests/run_tests.h tests/test1.c tests/test_dl_list.c \ + tests/test_string_list.c tests/test_string_utils.c \ + tests/test_util.c texmf/XDvi texmf/xdvi.cfg texmf-alt/README \ + texmf-alt/charter2.map texmf-alt/lucida.map \ + texmf-alt/marvosym.map texmf-alt/xdvi.cfg \ + texmf-alt/xdvifont.map texmf-alt/xypic.map tfmload.c tfmload.h \ + translations.h util.c util.h version.h vf.c x_util.c x_util.h \ + xdvi-config.h xdvi-debug.h xdvi-search.el xdvi-sh.in xdvi.1.in \ + xdvi.c xdvi.h xdvi.icon xdvizilla xdvizilla.1 xserver-info.c \ + xserver-info.h Makefile.in-$(XDVIK_VERSION) \ + acconfig.h-$(XDVIK_VERSION) acinclude.m4-$(XDVIK_VERSION) \ + aclocal.m4-$(XDVIK_VERSION) configure.in-$(XDVIK_VERSION) \ + kpathsea.ac-$(XDVIK_VERSION) withenable.ac-$(XDVIK_VERSION) \ + Makefile.in.orig configure.in.orig gui/Makefile.in.orig \ + kpathsea.ac.orig tests/Makefile.in.orig withenable.ac.orig +all: c-auto.h + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ + cd $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) + +c-auto.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/c-auto.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status c-auto.h +$(srcdir)/c-auto.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f c-auto.h stamp-h1 + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool config.lt +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d $(distdir) || mkdir $(distdir) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r $(distdir) +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + unlzma -c $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && cd $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @cd $(distuninstallcheck_dir) \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-am +all-am: Makefile c-auto.h +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-hdr \ + distclean-libtool + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-exec-am: + +install-html: install-html-am + +install-info: install-info-am + +install-man: + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: all all-am am--refresh check check-am clean clean-generic \ + clean-libtool dist dist-all dist-bzip2 dist-gzip dist-lzma \ + dist-shar dist-tarZ dist-zip distcheck distclean \ + distclean-generic distclean-hdr distclean-libtool \ + distcleancheck distdir distuninstallcheck dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am uninstall uninstall-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: |