diff options
Diffstat (limited to 'Build/source/texk/cjkutils/hbf2gf')
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/Makefile.am | 71 | ||||
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/Makefile.in | 602 | ||||
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/Makefile.in.orig | 67 | ||||
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/c-auto.in | 183 | ||||
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/hbf2gf.c | 2302 | ||||
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/hbf2gf.scn | 56 | ||||
-rw-r--r-- | Build/source/texk/cjkutils/hbf2gf/hbf2gf.tex | 2970 |
7 files changed, 6190 insertions, 61 deletions
diff --git a/Build/source/texk/cjkutils/hbf2gf/Makefile.am b/Build/source/texk/cjkutils/hbf2gf/Makefile.am new file mode 100644 index 00000000000..13d48d724fd --- /dev/null +++ b/Build/source/texk/cjkutils/hbf2gf/Makefile.am @@ -0,0 +1,71 @@ +## +INCLUDES = $(KPATHSEA_INCLUDES) +AM_CPPFLAGS = -Dunix -DHAVE_LIBKPATHSEA $(XX_CPPFLAGS) +AM_CFLAGS = $(XX_CFLAGS) + +bin_PROGRAMS = hbf2gf + +hbf2gf_SOURCES = \ + hbf.c \ + hbf.h \ + hbf2gf.c + +CWEB_SRC = hbf2gf.w +CWEB_TEX = hbf2gf.tex hbf2gf.idx hbf2gf.scn +CWEB_DVI = hbf2gf.dvi + +hbf2gf_DEPENDENCIES = $(KPATHSEA_DEPEND) + +LDADD = $(KPATHSEA_LIBS) + +## Rebuild libkpathsea +@KPATHSEA_RULE@ + +dist_man1_MANS = hbf2gf.1 + +EXTRA_DIST = $(CWEB_SRC) $(CWEB_TEX) $(CWEB_DVI) cfg + +CLEANFILES = hbf2gf.log hbf2gf.toc + +hbf2gf.dvi: hbf2gf.tex hbf2gf.idx hbf2gf.scn + TEXINPUTS=.:$(srcdir):$$TEXINPUTS $(TEX) hbf2gf.tex + +# Running cweave in order to create hbf2gf.tex generates in addition +# hbf2gf.idx and hbf2gf.scn; we must rerun cweave when they are not +# up to date (even if hbf2gf.tex is up to date). Thus the sub-make. +# +hbf2gf.tex hbf2gf.idx hbf2gf.scn: hbf2gf.w + $(MAKE) $(AM_MAKEFLAGS) do-cweave +do-cweave: hbf2gf.w .FORCE + $(CWEAVE) +ai $< +.PHONY: do-cweave .FORCE + +if do_cweb +all-local: hbf2gf.dvi +hbf2gf.c: hbf2gf.w + $(CTANGLE) $< +else +all-local: +endif + +## Not yet used +## +EXTRA_DIST += \ + emdir.c \ + emdir.h \ + emtexdir.c \ + emtexdir.h \ + hbf2gf.def + +## Eventually delete these files +## +EXTRA_DIST += \ + Makefile.in.orig \ + c-auto.in \ + config.guess \ + config.sub \ + configure \ + configure.ac \ + install-sh \ + mkinstalldirs + diff --git a/Build/source/texk/cjkutils/hbf2gf/Makefile.in b/Build/source/texk/cjkutils/hbf2gf/Makefile.in index 3f8feab638a..ec8758f8135 100644 --- a/Build/source/texk/cjkutils/hbf2gf/Makefile.in +++ b/Build/source/texk/cjkutils/hbf2gf/Makefile.in @@ -1,67 +1,575 @@ +# Makefile.in generated by automake 1.10.2 from Makefile.am. # @configure_input@ -# Makefile for hbf2gf -- wl@gnu.org -# Heavy modifications for TeX Live / teTeX by Thomas Esser, te@tug.org. -kpse_include ../make/paths.mk -kpse_include ../make/common.mk -kpse_include ../make/programs.mk -kpse_include ../make/texi.mk +# 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. -prog_cflags = @no_strdup@ -Dunix -DHAVE_LIBKPATHSEA +# 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. -CTANGLE = ../../web2c/ctangle -CWEAVE = ../../web2c/cweave -TEX = tex +@SET_MAKE@ -.SUFFIXES: .dvi .tex .w -objects = hbf2gf.o hbf.o +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@ +bin_PROGRAMS = hbf2gf$(EXEEXT) +subdir = hbf2gf +DIST_COMMON = $(dist_man1_MANS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/c-auto.in config.guess \ + config.sub install-sh mkinstalldirs +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/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) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = c-auto.h +CONFIG_CLEAN_FILES = +am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" +binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +PROGRAMS = $(bin_PROGRAMS) +am_hbf2gf_OBJECTS = hbf.$(OBJEXT) hbf2gf.$(OBJEXT) +hbf2gf_OBJECTS = $(am_hbf2gf_OBJECTS) +hbf2gf_LDADD = $(LDADD) +am__DEPENDENCIES_1 = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/../../build-aux/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(hbf2gf_SOURCES) +DIST_SOURCES = $(hbf2gf_SOURCES) +man1dir = $(mandir)/man1 +NROFF = nroff +MANS = $(dist_man1_MANS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CTANGLE = @CTANGLE@ +CWEAVE = @CWEAVE@ +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@ +TEX = @TEX@ +VERSION = @VERSION@ +XX_CFLAGS = @XX_CFLAGS@ +XX_CPPFLAGS = @XX_CPPFLAGS@ +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@ +INCLUDES = $(KPATHSEA_INCLUDES) +AM_CPPFLAGS = -Dunix -DHAVE_LIBKPATHSEA $(XX_CPPFLAGS) +AM_CFLAGS = $(XX_CFLAGS) +hbf2gf_SOURCES = \ + hbf.c \ + hbf.h \ + hbf2gf.c -program = hbf2gf -programs = $(program) +CWEB_SRC = hbf2gf.w +CWEB_TEX = hbf2gf.tex hbf2gf.idx hbf2gf.scn +CWEB_DVI = hbf2gf.dvi +hbf2gf_DEPENDENCIES = $(KPATHSEA_DEPEND) +LDADD = $(KPATHSEA_LIBS) +dist_man1_MANS = hbf2gf.1 +EXTRA_DIST = $(CWEB_SRC) $(CWEB_TEX) $(CWEB_DVI) cfg emdir.c emdir.h \ + emtexdir.c emtexdir.h hbf2gf.def Makefile.in.orig c-auto.in \ + config.guess config.sub configure configure.ac install-sh \ + mkinstalldirs +CLEANFILES = hbf2gf.log hbf2gf.toc +all: c-auto.h + $(MAKE) $(AM_MAKEFLAGS) all-am -default all: $(programs) +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign hbf2gf/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign hbf2gf/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; -hbf2gf.c: hbf2gf.w $(CTANGLE) - $(CTANGLE) $(srcdir)/hbf2gf.w +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -hbf2gf.tex: hbf2gf.w $(CWEAVE) - $(CWEAVE) +ai $(srcdir)/hbf2gf.w +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -hbf2gf.dvi: hbf2gf.tex - $(TEX) hbf2gf.tex +c-auto.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi -documentation: hbf2gf.dvi +stamp-h1: $(srcdir)/c-auto.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status hbf2gf/c-auto.h +$(srcdir)/c-auto.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_srcdir) && $(AUTOHEADER) + rm -f stamp-h1 + touch $@ -$(program): $(objects) - $(kpathsea_link) $(objects) $(LOADLIBES) +distclean-hdr: + -rm -f c-auto.h stamp-h1 +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + if test -f $$p \ + || test -f $$p1 \ + ; then \ + f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ + else :; fi; \ + done -$(CTANGLE): - cd ../../web2c; $(MAKE) ctangle +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ + done -$(CWEAVE): - cd ../../web2c; $(MAKE) cweave +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +hbf2gf$(EXEEXT): $(hbf2gf_OBJECTS) $(hbf2gf_DEPENDENCIES) + @rm -f hbf2gf$(EXEEXT) + $(LINK) $(hbf2gf_OBJECTS) $(hbf2gf_LDADD) $(LIBS) -install: install-exec install-data -uninstall: uninstall-exec uninstall-data -install-exec: all - $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) - for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done -uninstall-exec: - for p in $(programs); do $(RM) $(bindir)/$$p; done +mostlyclean-compile: + -rm -f *.$(OBJEXT) -install-data: - $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir) - $(INSTALL_DATA) $(srcdir)/$(program).1 $(man1dir)/$(program).$(manext) -uninstall-data: - $(RM) $(man1dir)/$(program).$(manext) +distclean-compile: + -rm -f *.tab.c -kpse_include ../make/dist.mk -kpse_include ../make/clean.mk +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hbf.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hbf2gf.Po@am__quote@ -distclean:: - $(RM) hbf2gf.c c-auto.h Makefile +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< -kpse_include ../make/rdepend.mk -kpse_include depend.mk +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` -kpathsea_parent = ../.. +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man1: $(dist_man1_MANS) + @$(NORMAL_INSTALL) + test -z "$(man1dir)" || $(MKDIR_P) "$(DESTDIR)$(man1dir)" + @list='$(dist_man1_MANS)'; \ + for i in $$list; do \ + if test -f $$i; then file=$$i; \ + else file=$(srcdir)/$$i; fi; \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst"; \ + done +uninstall-man1: + @$(NORMAL_UNINSTALL) + @list='$(dist_man1_MANS)'; \ + for i in $$list; do \ + ext=`echo $$i | sed -e 's/^.*\\.//'`; \ + case "$$ext" in \ + 1*) ;; \ + *) ext='1' ;; \ + esac; \ + inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ + inst=`echo $$inst | sed -e 's/^.*\///'`; \ + inst=`echo $$inst | sed '$(transform)'`.$$ext; \ + echo " rm -f '$(DESTDIR)$(man1dir)/$$inst'"; \ + rm -f "$(DESTDIR)$(man1dir)/$$inst"; \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) c-auto.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) c-auto.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + list='$(SOURCES) $(HEADERS) c-auto.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @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 +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(MANS) c-auto.h all-local +installdirs: + for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +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: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +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-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-info: install-info-am + +install-man: install-man1 + +install-pdf: install-pdf-am + +install-ps: install-ps-am + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS uninstall-man + +uninstall-man: uninstall-man1 + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \ + clean-binPROGRAMS clean-generic clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-hdr \ + distclean-libtool distclean-tags distdir 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 uninstall-man1 + + +@KPATHSEA_RULE@ + +hbf2gf.dvi: hbf2gf.tex hbf2gf.idx hbf2gf.scn + TEXINPUTS=.:$(srcdir):$$TEXINPUTS $(TEX) hbf2gf.tex + +# Running cweave in order to create hbf2gf.tex generates in addition +# hbf2gf.idx and hbf2gf.scn; we must rerun cweave when they are not +# up to date (even if hbf2gf.tex is up to date). Thus the sub-make. +# +hbf2gf.tex hbf2gf.idx hbf2gf.scn: hbf2gf.w + $(MAKE) $(AM_MAKEFLAGS) do-cweave +do-cweave: hbf2gf.w .FORCE + $(CWEAVE) +ai $< +.PHONY: do-cweave .FORCE + +@do_cweb_TRUE@all-local: hbf2gf.dvi +@do_cweb_TRUE@hbf2gf.c: hbf2gf.w +@do_cweb_TRUE@ $(CTANGLE) $< +@do_cweb_FALSE@all-local: +# 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/cjkutils/hbf2gf/Makefile.in.orig b/Build/source/texk/cjkutils/hbf2gf/Makefile.in.orig new file mode 100644 index 00000000000..3f8feab638a --- /dev/null +++ b/Build/source/texk/cjkutils/hbf2gf/Makefile.in.orig @@ -0,0 +1,67 @@ +# @configure_input@ +# Makefile for hbf2gf -- wl@gnu.org +# Heavy modifications for TeX Live / teTeX by Thomas Esser, te@tug.org. + +kpse_include ../make/paths.mk +kpse_include ../make/common.mk +kpse_include ../make/programs.mk +kpse_include ../make/texi.mk + +prog_cflags = @no_strdup@ -Dunix -DHAVE_LIBKPATHSEA + +CTANGLE = ../../web2c/ctangle +CWEAVE = ../../web2c/cweave +TEX = tex + +.SUFFIXES: .dvi .tex .w +objects = hbf2gf.o hbf.o + +program = hbf2gf +programs = $(program) + +default all: $(programs) + +hbf2gf.c: hbf2gf.w $(CTANGLE) + $(CTANGLE) $(srcdir)/hbf2gf.w + +hbf2gf.tex: hbf2gf.w $(CWEAVE) + $(CWEAVE) +ai $(srcdir)/hbf2gf.w + +hbf2gf.dvi: hbf2gf.tex + $(TEX) hbf2gf.tex + +documentation: hbf2gf.dvi + +$(program): $(objects) + $(kpathsea_link) $(objects) $(LOADLIBES) + +$(CTANGLE): + cd ../../web2c; $(MAKE) ctangle + +$(CWEAVE): + cd ../../web2c; $(MAKE) cweave + +install: install-exec install-data +uninstall: uninstall-exec uninstall-data +install-exec: all + $(SHELL) $(top_srcdir)/../mkinstalldirs $(bindir) + for p in $(programs); do $(INSTALL_LIBTOOL_PROG) $$p $(bindir); done +uninstall-exec: + for p in $(programs); do $(RM) $(bindir)/$$p; done + +install-data: + $(SHELL) $(top_srcdir)/../mkinstalldirs $(man1dir) + $(INSTALL_DATA) $(srcdir)/$(program).1 $(man1dir)/$(program).$(manext) +uninstall-data: + $(RM) $(man1dir)/$(program).$(manext) + +kpse_include ../make/dist.mk +kpse_include ../make/clean.mk + +distclean:: + $(RM) hbf2gf.c c-auto.h Makefile + +kpse_include ../make/rdepend.mk +kpse_include depend.mk + +kpathsea_parent = ../.. diff --git a/Build/source/texk/cjkutils/hbf2gf/c-auto.in b/Build/source/texk/cjkutils/hbf2gf/c-auto.in index cab13cf027b..2cf146ccb52 100644 --- a/Build/source/texk/cjkutils/hbf2gf/c-auto.in +++ b/Build/source/texk/cjkutils/hbf2gf/c-auto.in @@ -1,28 +1,183 @@ -/* hbf2gf/c-auto.in. Generated automatically from configure.in by autoheader. */ +/* hbf2gf/c-auto.in. Generated from configure.ac by autoheader. */ -/* Define to empty if the keyword does not work. */ -#undef const +/* Define to 1 if the `closedir' function returns void instead of `int'. */ +#undef CLOSEDIR_VOID + +/* Define to 1 if you have the <assert.h> header file. */ +#undef HAVE_ASSERT_H + +/* Define to 1 if you have the `bcmp' function. */ +#undef HAVE_BCMP + +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY -/* Define if you don't have vprintf but do have _doprnt. */ +/* Define to 1 if you have the `bzero' function. */ +#undef HAVE_BZERO + +/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'. + */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the <dlfcn.h> header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT -/* Define if you have the vprintf function. */ -#undef HAVE_VPRINTF +/* Define to 1 if you have the <float.h> header file. */ +#undef HAVE_FLOAT_H -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#undef HAVE_FSEEKO -/* Define if your <sys/time.h> declares struct tm. */ -#undef TM_IN_SYS_TIME +/* Define to 1 if you have the `getcwd' function. */ +#undef HAVE_GETCWD + +/* Define to 1 if you have the `getwd' function. */ +#undef HAVE_GETWD + +/* Define to 1 if you have the `index' function. */ +#undef HAVE_INDEX + +/* Define to 1 if you have the <inttypes.h> header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the <limits.h> header file. */ +#undef HAVE_LIMITS_H + +/* Define to 1 if you have the `memcmp' function. */ +#undef HAVE_MEMCMP -/* Define if you have the strdup function. */ +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the <memory.h> header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */ +#undef HAVE_NDIR_H + +/* Define to 1 if you are using GNU libc or otherwise have global variables + `program_invocation_name' and `program_invocation_short_name'. */ +#undef HAVE_PROGRAM_INVOCATION_NAME + +/* Define to 1 if your compiler understands prototypes. */ +#undef HAVE_PROTOTYPES + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the <pwd.h> header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the `rindex' function. */ +#undef HAVE_RINDEX + +/* Define to 1 if you have the <stdint.h> header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the <stdlib.h> header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP -/* Define if you have the strstr function. */ +/* Define to 1 if you have the <strings.h> header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the <string.h> header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR -/* Define if you have the strtol function. */ +/* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL -/* Define if you have the strtoul function. */ +/* Define to 1 if you have the `strtoul' function. */ #undef HAVE_STRTOUL + +/* Define to 1 if `st_mtim' is member of `struct stat'. */ +#undef HAVE_STRUCT_STAT_ST_MTIM + +/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_DIR_H + +/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'. + */ +#undef HAVE_SYS_NDIR_H + +/* Define to 1 if you have the <sys/param.h> header file. */ +#undef HAVE_SYS_PARAM_H + +/* Define to 1 if you have the <sys/stat.h> header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the <sys/types.h> header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the <unistd.h> header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `vprintf' function. */ +#undef HAVE_VPRINTF + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if your <sys/time.h> declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Version number of package */ +#undef VERSION + +/* Number of bits in a file offset, on hosts where this is settable. */ +#undef _FILE_OFFSET_BITS + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#undef _LARGEFILE_SOURCE + +/* Define for large files, on AIX-style hosts. */ +#undef _LARGE_FILES + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +#undef inline +#endif diff --git a/Build/source/texk/cjkutils/hbf2gf/hbf2gf.c b/Build/source/texk/cjkutils/hbf2gf/hbf2gf.c new file mode 100644 index 00000000000..d800c048a29 --- /dev/null +++ b/Build/source/texk/cjkutils/hbf2gf/hbf2gf.c @@ -0,0 +1,2302 @@ +#define banner \ +"hbf2gf (CJK ver. 4.7.0)" \ + \ + +#define TRUE 1 +#define FALSE 0 \ + +#define STRING_LENGTH 255 \ + +#define FILE_NAME_LENGTH 1024 \ + \ + +#define VERSION \ +"\n" \ +"Copyright (C) 1996-1999 Werner Lemberg.\n" \ +"There is NO warranty. You may redistribute this software\n" \ +"under the terms of the GNU General Public License\n" \ +"and the HBF library copyright.\n" \ +"\n" \ +"For more information about these matters, see the files\n" \ +"named COPYING and hbf.c.\n" \ +"\n" \ + +#define USAGE \ +"\n" \ +"Usage: hbf2gf [-q] configuration_file[.cfg]\n" \ +" hbf2gf [options] font_name x_resolution [y_scale | y_resolution]\n" \ +" hbf2gf -t [-q] font_name\n" \ +"\n" \ +" Convert a font in HBF format to TeX's GF resp. PK format.\n" \ +"\n" \ +" -q be silent\n" \ +" -p don't produce a PL file\n" \ +" -g don't produce a GF file\n" \ +" -n use no resolution in extension (only `.gf')\n" \ +" -t test for font_name (returns 0 on success)\n" \ +" --help print this message and exit\n" \ +" --version print version number and exit\n" \ +"\n" \ + +#define GF_ID 131 +#define PRE 247 \ + +#define header " hbf2gf output " \ + +#define BOC 67 +#define BOC1 68 +#define EOC 69 \ + +#define _2_16 65536.0 +#define _2_20 1048576.0 \ + +#define XXX1 239 +#define XXX2 240 +#define XXX3 241 +#define XXX4 242 \ + +#define YYY 243 \ + +#define POST 248 \ + +#define CHAR_LOC 245 +#define CHAR_LOC0 246 \ + +#define POSTPOST 249 +#define POSTPOST_ID 223 \ + +#define BLACK 1 +#define WHITE 0 \ + +#define PIXEL_MAXVAL 255 +#define SCALE 4096 +#define HALFSCALE 2048 \ + +#define MAX_CHAR_SIZE 1023 \ + +#define PAINT_(x) (x) +#define PAINT1 64 +#define PAINT2 65 +#define PAINT3 66 \ + +#define SKIP0 70 +#define SKIP1 71 +#define SKIP2 72 +#define SKIP3 73 \ + +#define NEW_ROW_(x) ((x) +74) \ + +#define NOOP 244 \ + +#define EXTENSION_LENGTH 8 \ + +#define GFTOPK_NAME "gftopk" +#define PLTOTF_NAME "pltotf" +#define OVP2OVF_NAME "ovp2ovf" \ + +#define PRINTER_MIN_RES_X 50 +#define PRINTER_MIN_RES_Y 50 \ + +#define VALID_SUBCODE 1 \ + +/*4:*/ +#line 193 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*10:*/ +#line 413 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#include <ctype.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <time.h> +#ifdef TM_IN_SYS_TIME +#include <sys/time.h> +#endif +#include "hbf.h" + + + +/*:10*//*69:*/ +#line 2483 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#if defined(HAVE_LIBKPATHSEA) +#ifdef VERY_OLD_KPATHSEA +#include "kpathsea/proginit.h" +#include "kpathsea/progname.h" +#include "kpathsea/tex-glyph.h" +#else +#include "kpathsea/kpathsea.h" +#endif + +#elif defined(HAVE_EMTEXDIR) +#include "emtexdir.h" + +#elif defined(HAVE_MIKTEX) +#include "miktex.h" +#endif + +/*:69*/ +#line 194 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*11:*/ +#line 431 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_file(void); + + +/*:11*//*13:*/ +#line 493 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_pre(void); + + +/*:13*//*16:*/ +#line 581 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_data(void); + + +/*:16*//*20:*/ +#line 692 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_post(void); + + +/*:20*//*25:*/ +#line 836 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void fputl(long,FILE*); + + +/*:25*//*29:*/ +#line 999 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void make_pixel_array(void); + + +/*:29*//*36:*/ +#line 1227 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef __GNUC__ +__inline__ +#endif +void read_row(unsigned char*); + + +/*:36*//*39:*/ +#line 1279 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef __GNUC__ +__inline__ +#endif +void write_row(unsigned char*); + + +/*:39*//*41:*/ +#line 1334 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_coding(void); + + +/*:41*//*45:*/ +#line 1495 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_pl(void); + + +/*:45*//*47:*/ +#line 1592 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_ovp(void); + + +/*:47*//*50:*/ +#line 1737 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_job(void); + + +/*:50*//*54:*/ +#line 1986 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void read_config(void); + + +/*:54*//*64:*/ +#line 2317 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +int fsearch(char*); + + +/*:64*//*67:*/ +#line 2457 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void config_error(char*); + + +/*:67*//*71:*/ +#line 2517 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char*TeX_search_version(void); + + +/*:71*//*74:*/ +#line 2552 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef HAVE_EMTEXDIR +extern int setup_list(struct emtex_dir*,char*,const char*,unsigned); +int dir_setup(struct emtex_dir*,const char*,const char*,unsigned); +char*file_find(char*,struct emtex_dir*); +#endif + + +/*:74*//*79:*/ +#line 2649 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char*TeX_search_cfg_file(char*); +char*TeX_search_hbf_file(char*); + + +/*:79*/ +#line 195 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*2:*/ +#line 129 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +int nmb_files= -1; +int unicode= FALSE; + +int testing= FALSE; + +int mf_like= FALSE; +int file_number= 0; + +double x_resolution= 0.0; +double y_scale= 1.0; + +int pk_files= TRUE; +int tfm_files= TRUE; +int long_extension= TRUE; +int quiet= FALSE; + +char config_file[FILE_NAME_LENGTH+4+1]; + +char output_name[STRING_LENGTH+1]; + +FILE*config,*out; +HBF*hbf; + +#ifdef msdos +#define WRITE_BIN "wb" +#define WRITE_TXT "wt" +#define READ_BIN "rb" +#define READ_TXT "rt" +#else +#define WRITE_BIN "w" +#define WRITE_TXT "w" +#define READ_BIN "r" +#define READ_TXT "r" +#endif + +int end_of_file= FALSE; + + +/*:2*//*15:*/ +#line 540 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +long char_adr[256]; +long*char_adr_p; + +int pk_offset_x; + + +double tfm_offset_x; +int pk_offset_y; + +double tfm_offset_y; + +int input_size_x; +int input_size_y; +const char*font_encoding; +int pk_width; +int pk_output_size_x; + +double tfm_output_size_x; +int pk_output_size_y; +double tfm_output_size_y; + +double design_size= 10.0; +double target_size_x; +double target_size_y; +double magstep_x; +double magstep_y; +double slant; +int rotation; + +double mag_x; +double mag_y; + +int empty_char; +int last_char; + +int dot_count; + + + +/*:15*//*19:*/ +#line 669 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char coding[STRING_LENGTH+1]; +char comment[STRING_LENGTH+1]; + +unsigned long checksum; + +long pk_total_min_x; +long pk_total_max_x; +long pk_total_min_y; +long pk_total_max_y; + +int dpi_x; +int dpi_y; +double ppp_x; +double ppp_y; + + +/*:19*//*27:*/ +#line 876 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +HBF_CHAR code; +const unsigned char*bitmap; + +unsigned char*bP; + +unsigned char out_char[MAX_CHAR_SIZE*MAX_CHAR_SIZE+1]; + +unsigned char*out_char_p; + +unsigned char pixelrow[MAX_CHAR_SIZE]; +unsigned char temp_pixelrow[MAX_CHAR_SIZE]; +unsigned char new_pixelrow[MAX_CHAR_SIZE+1]; + +int curr_row; + +long grayrow[MAX_CHAR_SIZE]; + +long s_mag_x,s_mag_y,s_slant; + + +/*:27*//*38:*/ +#line 1274 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +int threshold= 128; + + +/*:38*//*49:*/ +#line 1726 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char job_extension[EXTENSION_LENGTH+1]; +char rm_command[STRING_LENGTH+1]; +char cp_command[STRING_LENGTH+1]; +char pk_directory[STRING_LENGTH+1]; +char tfm_directory[STRING_LENGTH+1]; + +int ofm_file= FALSE; + + +/*:49*//*53:*/ +#line 1981 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char Buffer[STRING_LENGTH+1]; + + +/*:53*//*58:*/ +#line 2099 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +int offset_x; +int offset_y; + +HBF_CHAR user_min_char; +int have_min_char= FALSE; + +/*:58*//*60:*/ +#line 2256 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +HBF_CHAR min_char,max_char; + + +/*:60*//*62:*/ +#line 2283 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char b2_codes[256]; +unsigned char min_2_byte,max_2_byte; +int nmb_2_bytes= 0; + + +/*:62*//*70:*/ +#line 2501 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#if defined(HAVE_LIBKPATHSEA) +#ifdef KPSEDLL + +extern KPSEDLL char*kpathsea_version_string; +#else +extern DllImport char*kpathsea_version_string; +#endif +#elif defined(HAVE_EMTEXDIR) +char emtex_version_string[]= "emTeXdir"; +#elif !defined(HAVE_MIKTEX) +char no_version_string[]= "no search library"; +#endif + + +/*:70*//*73:*/ +#line 2545 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef HAVE_EMTEXDIR +struct emtex_dir cfg_path,hbf_path; +#endif + + +/*:73*//*76:*/ +#line 2591 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char name_buffer[FILE_NAME_LENGTH+1]; + + +/*:76*/ +#line 196 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + + +int main(argc,argv) +int argc; +char*argv[]; + +{char*p; + +/*78:*/ +#line 2613 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#if defined(HAVE_LIBKPATHSEA) +#ifdef OLD_KPATHSEA +kpse_set_progname(argv[0]); +#else +kpse_set_program_name(argv[0],"hbf2gf"); +#endif + +#ifdef VERY_OLD_KPATHSEA +kpse_init_prog("HBF2GF",300,"cx",true,"cmr10"); +#else +kpse_init_prog("HBF2GF",300,"cx","cmr10"); +#endif + +#elif defined(HAVE_EMTEXDIR) +if(!dir_setup(&cfg_path,"HBFCFG",NULL,EDS_BANG)) +{fprintf(stderr, +"Couldn't setup search path for configuration files\n"); +exit(1); +} +if(!dir_setup(&hbf_path,"HBFONTS",NULL,EDS_BANG)) +{fprintf(stderr, +"Couldn't setup search path for HBF header files\n"); +exit(1); +} +#endif + + +/*:78*/ +#line 205 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +/*7:*/ +#line 312 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +if(argc==2) +{if(strcmp(argv[1],"--help")==0) +/*6:*/ +#line 293 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{printf(USAGE); +exit(0); +} + + +/*:6*/ +#line 315 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +else if(strcmp(argv[1],"--version")==0) +/*5:*/ +#line 266 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{printf("\n"); +printf(banner); +printf(" (%s)\n",TeX_search_version()); +printf(VERSION); +exit(0); +} + + +/*:5*/ +#line 317 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} + +while(argc> 1) +{p= argv[1]; +if(p[0]!='-') +break; +if(p[1]=='p') +tfm_files= FALSE; +else if(p[1]=='g') +pk_files= FALSE; +else if(p[1]=='n') +long_extension= FALSE; +else if(p[1]=='q') +quiet= TRUE; +else if(p[1]=='t') +testing= TRUE; + +argv++; +argc--; +} + +if(testing) +{if(argc!=2) +{fprintf(stderr,"Need exactly one parameter for `-t' option.\n"); +fprintf(stderr,"Try `hbf2gf --help' for more information.\n"); +exit(1); +} +} +else if(argc<2||argc> 4) +{fprintf(stderr,"Invalid number of parameters.\n"); +fprintf(stderr,"Try `hbf2gf --help' for more information.\n"); +exit(1); +} + + +/*:7*/ +#line 207 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +if(!quiet) +printf("\n%s\n\n",banner); + +strncpy(config_file,argv[1],FILE_NAME_LENGTH); +config_file[FILE_NAME_LENGTH]= '\0'; + +if(argc> 2||testing) +{int l= strlen(config_file); + +if(l> 2) +config_file[l-2]= '\0'; + +else +{if(!quiet) +printf("`%s' can't be a subfont created by hbf2gf\n", +config_file); +exit(2); +} + +mf_like= TRUE; +} + +read_config(); + +if(mf_like) +/*8:*/ +#line 357 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{if(unicode) +file_number= (int)strtol(&argv[1][strlen(argv[1])-2], +(char**)NULL,16); +else +file_number= atoi(&argv[1][strlen(argv[1])-2]); + +x_resolution= atof(argv[2]); +if(x_resolution<PRINTER_MIN_RES_X) +{fprintf(stderr,"Invalid horizontal resolution\n"); +exit(1); +} + +if(argc> 3) +{y_scale= atof(argv[3]); +if(y_scale<0.01) +{fprintf(stderr, +"Invalid vertical scaling factor or resolution\n"); +exit(1); +} +if(y_scale> 10.0) +y_scale= (double)x_resolution/y_scale; +} +} + + +/*:8*/ +#line 234 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +/*28:*/ +#line 908 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{int col,offset; + +if(rotation) +{int tmp; + + +tmp= input_size_x; +input_size_x= input_size_y; +input_size_y= tmp; +} + +if(mf_like) +{target_size_x= design_size*(x_resolution/dpi_x); +target_size_y= design_size*(x_resolution*y_scale/dpi_y); +} +else +target_size_x= target_size_y= design_size; +magstep_x= target_size_x/design_size; +magstep_y= target_size_y/design_size; + +pk_offset_x= offset_x*magstep_x+0.5; +pk_offset_y= offset_y*magstep_y+0.5; +tfm_offset_x= offset_x/(dpi_x/72.27)/design_size; +tfm_offset_y= offset_y/(dpi_y/72.27)/design_size; + +pk_width= input_size_x*mag_x*magstep_x+0.5; +pk_output_size_x= input_size_x*mag_x*magstep_x+ +input_size_y*mag_y*magstep_y*slant+0.5; +pk_output_size_y= input_size_y*mag_y*magstep_y+0.5; +tfm_output_size_x= input_size_x*mag_x/ +(dpi_x/72.27)/design_size; +tfm_output_size_y= input_size_y*mag_y/ +(dpi_y/72.27)/design_size; +if(pk_output_size_x> MAX_CHAR_SIZE) +{fprintf(stderr,"Output character box width too big\n"); +exit(1); +} +if(pk_output_size_y> MAX_CHAR_SIZE) +{fprintf(stderr,"Output character box height too big\n"); +exit(1); +} + +for(col= 0;col<input_size_x;++col) +grayrow[col]= HALFSCALE; + +if(!mf_like) +code= (min_char&0xFF00)+min_2_byte; +else +{if((file_number<(unicode?0:1))||(file_number>=0x100)) +{fprintf(stderr,"Invalid subfile number\n"); +exit(1); +} + +if(unicode) +{offset= 0; +code= file_number*0x100; +} +else +{offset= (file_number-1)*256%nmb_2_bytes; +code= (min_char&0xFF00)+min_2_byte+ +(file_number-1)*256/nmb_2_bytes*0x100; +} + +while(offset--) +while(!b2_codes[code++&0xFF]) + +; + +if(code> max_char) +{fprintf(stderr,"Invalid subfile number\n"); +exit(1); +} +} + +s_mag_x= mag_x*magstep_x*SCALE; +s_mag_y= mag_y*magstep_y*SCALE; +s_slant= slant*SCALE; +} + + +/*:28*/ +#line 236 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +/*9:*/ +#line 392 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{int j,max_numb; + +if(!mf_like) +{file_number= (unicode==TRUE?(min_char>>8):1); +if(nmb_files==-1) +max_numb= (unicode==TRUE?0x100:100); +else +max_numb= nmb_files; +} +else +max_numb= 1; + +for(j= 0;(j<max_numb)&&!end_of_file;file_number++,j++) +write_file(); + +nmb_files= j; +} + + +/*:9*/ +#line 238 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +if(tfm_files) +write_pl(); +if(ofm_file) +write_ovp(); +if(!mf_like) +write_job(); + +hbfClose(hbf); + +exit(0); +return 0; +} + + +/*:4*//*12:*/ +#line 439 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_file(void) +{char output_file[FILE_NAME_LENGTH+1]; + + +if(pk_files) +{if(mf_like) +{if(unicode) +sprintf(output_file,"%s%02x.%.0igf", +output_name,file_number, +long_extension?(int)(x_resolution+0.5):0); +else +sprintf(output_file,"%s%02i.%.0igf", +output_name,file_number, +long_extension?(int)(x_resolution+0.5):0); +} +else +{if(unicode) +sprintf(output_file,"%s%02x.gf",output_name,file_number); +else +sprintf(output_file,"%s%02i.gf",output_name,file_number); +} +if(!(out= fopen(output_file,WRITE_BIN))) +{fprintf(stderr,"Couldn't open `%s'\n",output_file); +exit(1); +} +if(!quiet) +printf("Writing `%s' ",output_file); + +write_pre(); +write_data(); +write_post(); +fclose(out); + +if(!quiet) +printf("\n"); +} +else +write_data(); +} + + +/*:12*//*14:*/ +#line 500 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_pre(void) +{char out_s[40],s[20]; +time_t secs_now; +struct tm*time_now; + + +strcpy(out_s,header); + +secs_now= time(NULL); +time_now= localtime(&secs_now); +strftime(s,20,"%Y.%m.%d:%H.%M",time_now); +strcat(out_s,s); + +fputc(PRE,out); +fputc(GF_ID,out); +fputc(strlen(out_s),out); +fputs(out_s,out); +} + + +/*:14*//*17:*/ +#line 586 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_data(void) +{dot_count= 0; +char_adr_p= char_adr; + +for(last_char= 0;(last_char<256)&&!end_of_file;last_char++) +/*18:*/ +#line 611 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{if(dot_count++%10==0) +if(pk_files&&!quiet) +{printf("."); +fflush(stdout); +} + +empty_char= FALSE; +make_pixel_array(); +if(end_of_file) +return; + +if(pk_files) +{*char_adr_p= ftell(out); +char_adr_p++; + +if(empty_char) +{fputc(BOC1,out); +fputc((unsigned char)last_char,out); +fputc(0,out); +fputc(0,out); +fputc(0,out); +fputc(0,out); +fputc(EOC,out); +} +else +{fputc(BOC,out); +fputl(last_char,out); +fputl(-1L,out); +fputl(pk_offset_x,out); +fputl(pk_output_size_x+pk_offset_x,out); +fputl(pk_offset_y,out); +fputl(pk_output_size_y+pk_offset_y,out); + +write_coding(); + +fputc(EOC,out); +} +} +} + + +/*:18*/ +#line 592 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} + + +/*:17*//*21:*/ +#line 697 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_post(void) +{long special_adr; +long post_adr; + +long designsize= design_size*_2_20; + +int pk_dx; +long tfm_width; + +int i; +long temp; + + +ppp_x= dpi_x/72.27*magstep_x; +ppp_y= dpi_y/72.27*magstep_y; + +pk_total_min_x= pk_offset_x; +pk_total_max_x= pk_output_size_x+2*pk_offset_x; +pk_total_min_y= pk_offset_y; +pk_total_max_y= pk_output_size_y+pk_offset_y; + +pk_dx= pk_width+2*pk_offset_x; +tfm_width= (tfm_output_size_x+2*tfm_offset_x)*_2_20; + + +/*22:*/ +#line 743 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +special_adr= ftell(out); + +if(*coding) +{fputc(XXX1,out); +fputc(strlen(coding),out); +fputs(coding,out); +} + +if(*comment) +{fputc(XXX1,out); +fputc(strlen(comment),out); +fputs(comment,out); +} + + +/*:22*/ +#line 723 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*23:*/ +#line 772 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +post_adr= ftell(out); +fputc(POST,out); +fputl(special_adr,out); + +fputl(designsize,out); +fputl(checksum,out); +fputl(ppp_x*_2_16,out); +fputl(ppp_y*_2_16,out); +fputl(pk_total_min_x,out); +fputl(pk_total_max_x,out); +fputl(pk_total_min_y,out); +fputl(pk_total_max_y,out); + +char_adr_p= char_adr; + +if(pk_dx<256) +{for(i= 0;i<last_char;i++) +{fputc(CHAR_LOC0,out); +fputc(i,out); +fputc(pk_dx,out); +fputl(tfm_width,out); +fputl(*char_adr_p++,out); +} +} +else +{for(i= 0;i<last_char;i++) +{fputc(CHAR_LOC,out); +fputc(i,out); +fputl(pk_dx*_2_16,out); +fputl(0,out); +fputl(tfm_width,out); +fputl(*char_adr_p++,out); +} +} + + +/*:23*/ +#line 724 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*24:*/ +#line 823 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +fputc(POSTPOST,out); +fputl(post_adr,out); +fputc(GF_ID,out); +temp= ftell(out); +i= (int)(temp%4)+4; +while(i--) +fputc(POSTPOST_ID,out); + + +/*:24*/ +#line 725 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} + + +/*:21*//*26:*/ +#line 841 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void fputl(num,f) +long num; +FILE*f; + +{fputc(num>>24,f); +fputc(num>>16,f); +fputc(num>>8,f); +fputc(num,f); +} + + +/*:26*//*30:*/ +#line 1004 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void make_pixel_array(void) +{unsigned char*prP; +unsigned char*temp_prP; +unsigned char*new_prP; +long*grP; + +register unsigned char*xP; +register unsigned char*nxP; + +register int row,col; +int rows_read= 0; +register int need_to_read_row= 1; + +long frac_row_to_fill= SCALE; +long frac_row_left= s_mag_y; + +int no_code= FALSE; + + +prP= pixelrow; +temp_prP= temp_pixelrow; +new_prP= new_pixelrow; +grP= grayrow; +out_char_p= out_char; + +again: +if(b2_codes[code&0xFF]) +{if(pk_files) +{bitmap= hbfGetBitmap(hbf,code); +bP= (unsigned char*)bitmap; + + +if(!bitmap) +empty_char= TRUE; +else +/*31:*/ +#line 1063 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{if(pk_output_size_y==input_size_y) +temp_prP= prP; + +curr_row= input_size_y-1; +for(row= 0;row<pk_output_size_y;++row) +{/*32:*/ +#line 1077 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +if(pk_output_size_y==input_size_y) + +read_row(prP); +else +{while(frac_row_left<frac_row_to_fill) +{if(need_to_read_row) +if(rows_read<input_size_y) +{read_row(prP); +++rows_read; +} + +for(col= 0,xP= prP;col<input_size_x;++col,++xP) +grP[col]+= frac_row_left*(*xP); + +frac_row_to_fill-= frac_row_left; +frac_row_left= s_mag_y; +need_to_read_row= 1; +} + +/*33:*/ +#line 1104 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +if(need_to_read_row) +if(rows_read<input_size_y) +{read_row(prP); +++rows_read; +need_to_read_row= 0; +} + +for(col= 0,xP= prP,nxP= temp_prP; +col<input_size_x;++col,++xP,++nxP) +{register long g; + + +g= grP[col]+frac_row_to_fill*(*xP); +g/= SCALE; +if(g> PIXEL_MAXVAL) +g= PIXEL_MAXVAL; + +*nxP= g; +grP[col]= HALFSCALE; +} + +frac_row_left-= frac_row_to_fill; +if(frac_row_left==0) +{frac_row_left= s_mag_y; +need_to_read_row= 1; +} +frac_row_to_fill= SCALE; + + +/*:33*/ +#line 1097 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} + + +/*:32*/ +#line 1069 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*34:*/ +#line 1145 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +if(pk_width==input_size_x&&s_slant==0) + +write_row(temp_prP); +else +{register long g= HALFSCALE; +register long frac_col_to_fill= SCALE; +register long frac_col_left; +register int need_col= 0; + + +nxP= new_prP; + +frac_col_left= (pk_output_size_y-row)*s_slant; +while(frac_col_left>=frac_col_to_fill) +{*(nxP++)= 0; +frac_col_left-= frac_col_to_fill; +} + +if(frac_col_left> 0) +frac_col_to_fill-= frac_col_left; + +for(col= 0,xP= temp_prP;col<input_size_x;++col,++xP) +{frac_col_left= s_mag_x; +while(frac_col_left>=frac_col_to_fill) +{if(need_col) +{++nxP; +g= HALFSCALE; +} + +g+= frac_col_to_fill*(*xP); +g/= SCALE; +if(g> PIXEL_MAXVAL) +g= PIXEL_MAXVAL; + +*nxP= g; +frac_col_left-= frac_col_to_fill; +frac_col_to_fill= SCALE; +need_col= 1; +} + +if(frac_col_left> 0) +{if(need_col) +{++nxP; +g= HALFSCALE; +need_col= 0; +} + +g+= frac_col_left*(*xP); +frac_col_to_fill-= frac_col_left; +} +} + +/*35:*/ +#line 1203 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +if(frac_col_to_fill> 0) +{--xP; +g+= frac_col_to_fill*(*xP); +} + +if(!need_col) +{g/= SCALE; +if(g> PIXEL_MAXVAL) +g= PIXEL_MAXVAL; +*nxP= g; +} + +*(++nxP)= 0; + +write_row(new_prP); + + +/*:35*/ +#line 1198 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} + + +/*:34*/ +#line 1071 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} +} + + +/*:31*/ +#line 1040 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +} +} +else +no_code= TRUE; + +if((code&0xFF)==max_2_byte) +code+= 0xFF-(max_2_byte-min_2_byte); +if(code>=max_char) +{end_of_file= TRUE; +return; +} + +code++; + +if(no_code) +{no_code= FALSE; +goto again; +} +} + + +/*:30*//*37:*/ +#line 1235 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef __GNUC__ +__inline__ +#endif +void read_row(pixelrow) +unsigned char*pixelrow; + +{register int col,bitshift,offset; +register unsigned char*xP; +register unsigned char item= 0; + +if(rotation) +{bitshift= 7-(curr_row%8); +offset= (input_size_y+7)/8; +bP= (unsigned char*)bitmap+curr_row/8; +for(col= 0,xP= pixelrow;col<input_size_x;++col,++xP) +{*xP= ((*bP>>bitshift)&1)==1?PIXEL_MAXVAL:0; +bP+= offset; +} +curr_row--; +} +else +{bitshift= -1; +for(col= 0,xP= pixelrow;col<input_size_x;++col,++xP) +{if(bitshift==-1) +{item= *(bP++); +bitshift= 7; +} +*xP= ((item>>bitshift)&1)==1?PIXEL_MAXVAL:0; +--bitshift; +} +} +} + + +/*:37*//*40:*/ +#line 1287 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef __GNUC__ +__inline__ +#endif +void write_row(pixelrow) +unsigned char*pixelrow; + +{register int col; +register unsigned char*xP; + +for(col= 0,xP= pixelrow;col<pk_output_size_x;++col,++xP) +*(out_char_p++)= (*xP>=threshold)?1:0; + +} + + +/*:40*//*42:*/ +#line 1342 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_coding(void) +{register int count,skip; +register unsigned char paint; +register int x,y; +register unsigned char*cp; + +x= 0; +y= 0; +cp= out_char+y*pk_output_size_x+x; +count= skip= 0; +paint= WHITE; +goto start; + +while(y<pk_output_size_y) +{/*43:*/ +#line 1366 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +count= 0; +x= 0; +cp= out_char+y*pk_output_size_x+x; + +while(x<pk_output_size_x) +{if(*cp==paint) +count++; +else +{if(skip==0) +{if(count<=164) +fputc(NEW_ROW_(count),out); +else +{fputc(SKIP0,out); + +if(count<256) +{fputc(PAINT1,out); +fputc(count,out); +} +else +{fputc(PAINT2,out); +fputc(count>>8,out); +fputc(count&0xFF,out); +} +} +} +else +{if(skip==1) +fputc(SKIP0,out); +else +{if(skip<256) +{fputc(SKIP1,out); +fputc(skip,out); +} +else +{fputc(SKIP2,out); +fputc(skip>>8,out); +fputc(skip&0xFF,out); +} +} +skip= 0; +if(count<64) +fputc(PAINT_(count),out); +else if(count<256) +{fputc(PAINT1,out); +fputc(count,out); +} +else +{fputc(PAINT2,out); +fputc(count>>8,out); +fputc(count&0xFF,out); +} +} +count= 0; +paint= BLACK; +break; +} +x++; +cp++; +} +if(x>=pk_output_size_x) +{skip++; +y++; +continue; +} + + +/*:43*/ +#line 1357 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +start: +/*44:*/ +#line 1434 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +while(x<pk_output_size_x) +{if(*cp==paint) +count++; +else +{if(count<64) +fputc(PAINT_(count),out); +else if(count<256) +{fputc(PAINT1,out); +fputc(count,out); +} +else +{fputc(PAINT2,out); +fputc(count>>8,out); +fputc(count&0xFF,out); +} +count= 1; +paint= BLACK-paint; +} +x++; +cp++; +} +if(paint==BLACK) +{if(count<64) +fputc(PAINT_(count),out); +else if(count<256) +{fputc(PAINT1,out); +fputc(count,out); +} +else +{fputc(PAINT2,out); +fputc(count>>8,out); +fputc(count&0xFF,out); +} +paint= WHITE; +} + + + +/*:44*/ +#line 1359 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +y++; +} +} + + +/*:42*//*46:*/ +#line 1500 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_pl(void) +{int i,pos; +char output_file[FILE_NAME_LENGTH+1]; +long t,sc; +char*s; +char tfm_header[]= "Created by hbf2gf"; + +file_number--; + +if(mf_like) +{if(unicode) +sprintf(output_file,"%s%02x.pl",output_name,file_number); +else +sprintf(output_file,"%s%02i.pl",output_name,file_number); +} +else +sprintf(output_file,"%s.pl",output_name); + +if(!(out= fopen(output_file,WRITE_TXT))) +{fprintf(stderr,"Couldn't open `%s'\n",output_file); +exit(1); +} +if(!quiet) +printf("\nWriting `%s'\n",output_file); + +fprintf(out, +"\n(FAMILY %s%d)" +"\n(CODINGSCHEME CJK-%s)", +output_name,file_number,font_encoding); + +fprintf(out, +"\n(DESIGNSIZE R %.6f)" +"\n(COMMENT DESIGNSIZE IS IN POINTS)" +"\n(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)" +"\n(CHECKSUM O %lo)" +"\n(FONTDIMEN" +"\n (SLANT R %.6f)" +"\n (SPACE R 0.0)" +"\n (STRETCH R 0.0)" +"\n (SHRINK R 0.0)" +"\n (XHEIGHT R 1.0)" +"\n (QUAD R 1.0)" +"\n (EXTRASPACE R 0.0)" +"\n )",design_size,checksum,slant); + +s= tfm_header; +i= strlen(s); +t= ((long)i)<<24; +sc= 16; +pos= 18; + +fprintf(out,"\n"); +while(i> 0) +{t|= ((long)(*(unsigned char*)s++))<<sc; +sc-= 8; +if(sc<0) +{fprintf(out,"\n(HEADER D %d O %lo)",pos,t); +t= 0; +sc= 24; +pos++; +} +i--; +} +if(t) +fprintf(out,"\n(HEADER D %d O %lo)",pos,t); +fprintf(out,"\n"); + +for(i= 0;i<256;i++) +{fprintf(out, +"\n(CHARACTER O %o" +"\n (CHARWD R %.6f)" +"\n (CHARHT R %.6f)" +"\n (CHARDP R %.6f)" +"\n (CHARIC R %.6f)" +"\n )", +i, +tfm_output_size_x+2*tfm_offset_x, +tfm_output_size_y+tfm_offset_y, +-tfm_offset_y, +slant*(tfm_output_size_y+tfm_offset_y)); +} + +fclose(out); +} + + + +/*:46*//*48:*/ +#line 1597 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_ovp(void) +{int c,i,nmb_subfonts,remainder,count,pos; +char output_file[FILE_NAME_LENGTH+1]; +long t,sc; +char*s; +char ofm_header[]= "Created by hbf2gf"; + +nmb_subfonts= ((max_char-(min_char&0xFF00))/256*nmb_2_bytes) +/256+1; +remainder= ((max_char-(min_char&0xFF00))/256*nmb_2_bytes) +%256; + + +for(count= 0;count<(max_char&0xFF);count++) +if(b2_codes[count]) +remainder++; +if(remainder>=256) +nmb_subfonts++; + +sprintf(output_file,"%s.ovp",output_name); + +if(!(out= fopen(output_file,WRITE_TXT))) +{fprintf(stderr,"Couldn't open `%s'\n",output_file); +exit(1); +} +if(!quiet) +printf("\nWriting `%s'\n",output_file); + +fprintf(out, +"\n(VTITLE Omega virtual font created by hbf2gf)" +"\n(DESIGNSIZE R %.6f)" +"\n(COMMENT DESIGNSIZE IS IN POINTS)" +"\n(COMMENT OTHER SIZES ARE MULTIPLES OF DESIGNSIZE)" +"\n(CHECKSUM O %lo)" +"\n(FONTDIMEN" +"\n (SLANT R %.6f)" +"\n (SPACE R 0.0)" +"\n (STRETCH R 0.0)" +"\n (SHRINK R 0.0)" +"\n (XHEIGHT R 1.0)" +"\n (QUAD R 1.0)" +"\n (EXTRASPACE R 0.0)" +"\n )",design_size,checksum,slant); + +s= ofm_header; +i= strlen(s); +t= ((long)i)<<24; +sc= 16; +pos= 18; + +fprintf(out,"\n"); +while(i> 0) +{t|= ((long)(*(unsigned char*)s++))<<sc; +sc-= 8; +if(sc<0) +{fprintf(out,"\n(HEADER D %d O %lo)",pos,t); +t= 0; +sc= 24; +pos++; +} +i--; +} +if(t) +fprintf(out,"\n(HEADER D %d O %lo)",pos,t); +fprintf(out,"\n"); + +for(i= 0;i<nmb_subfonts;i++) +{fprintf(out, +"\n(MAPFONT D %i" +"\n (FONTNAME %s%02i)" +"\n (FONTCHECKSUM O %lo)" +"\n (FONTAT R 1.0)" +"\n (FONTDSIZE R %.6f)" +"\n )",i,output_name,i+1,checksum,design_size); +} + +for(c= min_char,i= 0,count= 0;c<=max_char;c++) +{if(b2_codes[c&0xFF]==VALID_SUBCODE) +{fprintf(out, +"\n(CHARACTER O %o" +"\n (CHARWD R %.6f)" +"\n (CHARHT R %.6f)" +"\n (CHARDP R %.6f)" +"\n (CHARIC R %.6f)" +"\n (MAP" +"\n (SELECTFONT D %i)" +"\n (SETCHAR O %o)" +"\n )" +"\n )", +c, +tfm_output_size_x+2*tfm_offset_x, +tfm_output_size_y+tfm_offset_y, +-tfm_offset_y, +slant*(tfm_output_size_y+tfm_offset_y), +i, +count); + +count++; +if(count==256) +{count= 0; +i++; +} +} +else +continue; +} + +fclose(out); +} + + + +/*:48*//*51:*/ +#line 1742 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void write_job(void) +{FILE*out; +int i,j; +char buffer[FILE_NAME_LENGTH+1]; + + +strcpy(buffer,output_name); +strcat(buffer,job_extension); +if(!(out= fopen(buffer,WRITE_TXT))) +{fprintf(stderr,"Couldn't open `%s'\n",buffer); +exit(1); +} +if(!quiet) +printf("\nWriting `%s'\n",buffer); + +if(pk_files) +{if(unicode) +{for(i= (min_char>>8),j= 0;j<nmb_files;i++,j++) +fprintf(out, +"%s %s%02x.gf %s%s%02x.%.0ipk\n" +"%s %s%02x.gf\n", +GFTOPK_NAME,output_name,i, +pk_directory,output_name,i, +long_extension?(int)(dpi_x*magstep_x+0.5):0, +rm_command,output_name,i); +} +else +{for(i= 1;i<=nmb_files;i++) +fprintf(out, +"%s %s%02i.gf %s%s%02i.%.0ipk\n" +"%s %s%02i.gf\n", +GFTOPK_NAME,output_name,i, +pk_directory,output_name,i, +long_extension?(int)(dpi_x*magstep_x+0.5):0, +rm_command,output_name,i); +} +} + +if(tfm_files) +{fprintf(out, +"\n" +"%s %s.pl %s.tfm\n" +"%s %s.pl\n" +"\n", +PLTOTF_NAME,output_name,output_name, +rm_command,output_name); + +if(unicode) +{for(i= (min_char>>8),j= 0;j<nmb_files;i++,j++) +fprintf(out, +"%s %s.tfm %s%s%02x.tfm\n", +cp_command,output_name, +tfm_directory,output_name,i); +} +else +{for(i= 1;i<=nmb_files;i++) +fprintf(out, +"%s %s.tfm %s%s%02i.tfm\n", +cp_command,output_name, +tfm_directory,output_name,i); +} + +fprintf(out, +"\n" +"%s %s.tfm", +rm_command,output_name); +} + +if(ofm_file) +{fprintf(out, +"\n" +"%s %s.ovp %s.ovf %s.ofm\n" +"%s %s.ovp\n" +"\n", +OVP2OVF_NAME,output_name,output_name,output_name, +rm_command,output_name); +} + +fclose(out); +} + + + +/*:51*//*55:*/ +#line 1994 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void read_config(void) +{HBF_BBOX*boxp; +char*real_config_file; + + +/*56:*/ +#line 2046 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{int i,lastext= -1; + +for(i= 0;config_file[i];i++) +if(config_file[i]=='.') +lastext= i; +else if(config_file[i]=='/'|| +config_file[i]==':'|| +config_file[i]=='\\') +lastext= -1; + +if(lastext==-1) +strcat(config_file,".cfg"); +} + + +/*:56*/ +#line 2000 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +real_config_file= TeX_search_cfg_file(config_file); +if(!real_config_file) +{if(mf_like) +{if(!quiet) +printf("Couldn't find `%s'\n",config_file); +exit(2); +} +else +{fprintf(stderr,"Couldn't find `%s'\n",config_file); +exit(1); +} +} + +if(!(config= fopen(real_config_file,READ_TXT))) +{if(!testing) +{fprintf(stderr,"Couldn't open `%s'\n",config_file); +exit(1); +} +else +{if(!quiet) +fprintf(stderr,"Couldn't find or open `%s'\n",config_file); +exit(2); +} +} + +if(testing) +{if(!quiet) +printf("%s\n",real_config_file); +exit(0); +} + +/*57:*/ +#line 2063 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{char hbf_header[STRING_LENGTH+1]; +char*real_hbf_header; + +if(!fsearch("hbf_header")) +config_error("hbf_header"); +else +strcpy(hbf_header,Buffer); + +real_hbf_header= TeX_search_hbf_file(hbf_header); +if(!real_hbf_header) +{fprintf(stderr,"Couldn't find `%s'\n",hbf_header); +exit(1); +} + +hbfDebug= 1; + + +if(!(hbf= hbfOpen(real_hbf_header))) +exit(1); + +hbfDebug= 0; + +boxp= hbfBitmapBBox(hbf); +input_size_x= boxp->hbf_height; +input_size_y= boxp->hbf_width; +font_encoding= hbfProperty(hbf,"HBF_CODE_SCHEME"); + +if(!fsearch("output_name")) +config_error("output_name"); +else +strcpy(output_name,Buffer); +} + + +/*:57*/ +#line 2033 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*59:*/ +#line 2107 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{if(fsearch("nmb_files")) +nmb_files= atoi(Buffer); +if(fsearch("unicode")) +if(Buffer[0]=='y'||Buffer[0]=='Y') +unicode= TRUE; +if(fsearch("min_char")) +{user_min_char= strtoul(Buffer,(char**)NULL,0); +have_min_char= TRUE; +} + +if(!mf_like) +{if(fsearch("pk_files")) +if(Buffer[0]=='n'||Buffer[0]=='N') +pk_files= FALSE; +if(fsearch("tfm_files")) +if(Buffer[0]=='n'||Buffer[0]=='N') +tfm_files= FALSE; +if(fsearch("ofm_file")) +if(Buffer[0]=='y'||Buffer[0]=='Y') +ofm_file= TRUE; +if(fsearch("long_extension")) +if(Buffer[0]=='n'||Buffer[0]=='N') +long_extension= FALSE; +} + +if(fsearch("slant")) +slant= atof(Buffer); +if(slant<0.0||slant> 1.0) +{fprintf(stderr,"Invalid slant\n"); +exit(1); +} +if(fsearch("rotation")) +if(Buffer[0]=='y'||Buffer[0]=='Y') +rotation= TRUE; + +if(fsearch("mag_x")) +mag_x= atof(Buffer); +if(fsearch("mag_y")) +mag_y= atof(Buffer); +if(!mag_x&&!mag_y) +{mag_x= 1.0; +mag_y= 1.0; +} +if(mag_x&&!mag_y) +mag_y= mag_x; +if(mag_y&&!mag_x) +mag_x= mag_y; +if(mag_x<=0.0) +{fprintf(stderr,"Invalid horizontal magnification\n"); +exit(1); +} +if(mag_y<=0.0) +{fprintf(stderr,"Invalid vertical magnification\n"); +exit(1); +} + +if(fsearch("dpi_x")) +dpi_x= atoi(Buffer); +if(fsearch("dpi_y")) +dpi_y= atoi(Buffer); +if(!dpi_x&&!dpi_y) +{dpi_x= 300; +dpi_y= 300; +} +if(dpi_x&&!dpi_y) +dpi_y= dpi_x; +if(dpi_y&&!dpi_x) +dpi_x= dpi_y; +if(dpi_x<=PRINTER_MIN_RES_X) +{fprintf(stderr,"Invalid horizontal printer resolution\n"); +exit(1); +} +if(dpi_y<=PRINTER_MIN_RES_Y) +{fprintf(stderr,"Invalid vertical printer resolution\n"); +exit(1); +} + +if(fsearch("design_size")) +design_size= atof(Buffer); + +if(fsearch("x_offset")) +offset_x= atoi(Buffer); +else +offset_x= rotation?0:(boxp->hbf_xDisplacement*mag_x+0.5); +if(fsearch("y_offset")) +offset_y= atoi(Buffer); +else +offset_y= rotation?0:(boxp->hbf_yDisplacement*mag_y+0.5); +if(!fsearch("comment")) +comment[0]= '\0'; +else +strcpy(comment,Buffer); + +if(fsearch("threshold")) +threshold= atoi(Buffer); +if(threshold<=0||threshold>=255) +{fprintf(stderr,"Invalid threshold\n"); +exit(1); +} + +if(!fsearch("checksum")) +checksum= 0; +else +checksum= strtoul(Buffer,(char**)NULL,0); + +if(!fsearch("coding")) +coding[0]= '\0'; +else +strcpy(coding,Buffer); + +if(!fsearch("pk_directory")) +pk_directory[0]= '\0'; +else +strcpy(pk_directory,Buffer); + +if(!fsearch("tfm_directory")) +tfm_directory[0]= '\0'; +else +strcpy(tfm_directory,Buffer); + +if(fsearch("rm_command")) +strcpy(rm_command,Buffer); +else +strcpy(rm_command,"rm"); + +if(fsearch("cp_command")) +strcpy(cp_command,Buffer); +else +strcpy(cp_command,"cp"); + +if(!fsearch("job_extension")) +job_extension[0]= '\0'; +else +{strncpy(job_extension,Buffer,EXTENSION_LENGTH); +job_extension[EXTENSION_LENGTH]= '\0'; +} +} + + +/*:59*/ +#line 2034 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +/*61:*/ +#line 2261 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{const void*cp; +HBF_CHAR dummy; + +cp= hbfGetCodeRange(hbf,NULL,&min_char,&max_char); +for(;cp!=NULL;cp= hbfGetCodeRange(hbf,cp,&dummy,&max_char)) +; + +if(have_min_char) +min_char= user_min_char; +} + + +/*:61*/ +#line 2036 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +/*63:*/ +#line 2290 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{const void*b2r; +unsigned char dummy; +int i; + +for(i= 0;i<256;i++) +b2_codes[i]= 0; + +b2r= hbfGetByte2Range(hbf,NULL,&min_2_byte,&max_2_byte); +dummy= min_2_byte; +for(;b2r!=NULL;b2r= hbfGetByte2Range(hbf,b2r,&dummy,&max_2_byte)) +{for(i= dummy;i<=max_2_byte;i++) +b2_codes[i]= VALID_SUBCODE; +} + +for(i= 0;i<256;i++) +if(b2_codes[i]==VALID_SUBCODE) +nmb_2_bytes++; +} + + +/*:63*/ +#line 2037 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + + +fclose(config); +} + + +/*:55*//*65:*/ +#line 2322 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +int fsearch(search_string) +char*search_string; + +{char*P,p; +char temp_buffer[STRING_LENGTH+1]; +char env_name[STRING_LENGTH+1]; +char*env_p; +char*env_value; +char*Buf_p; +int Ch,ch,old_ch= '\n'; +int count= STRING_LENGTH; + +rewind(config); + +do +{P= search_string; +p= tolower(*P); +Ch= fgetc(config); +ch= tolower(Ch); +while(!(ch==p&&old_ch=='\n')&&Ch!=EOF) + + +{old_ch= ch; +Ch= fgetc(config); +ch= tolower(Ch); +} + +for(;;) +{if(*(++P)=='\0') +if((Ch= fgetc(config))==' '||Ch=='\t') + +goto success; +Ch= fgetc(config); +if(tolower(Ch)!=tolower(*P)) +break; +} +} +while(Ch!=EOF); + +return 0; + +success: +P= temp_buffer; + +while((Ch= fgetc(config))==' '||Ch=='\t') + +; +while(Ch!='\n'&&--count> 0&&Ch!=EOF) +{*P++= Ch; +Ch= fgetc(config); +} +*P= '\0'; + +if(*temp_buffer) +/*66:*/ +#line 2402 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +{P= temp_buffer; +Buf_p= Buffer; +count= STRING_LENGTH-1; + +while(*P&&count> 0) +{env_p= env_name; + +if(*P=='$') +{P++; +if(*P=='$') +{*(Buf_p++)= *(P++); +count--; +continue; +} +while(*P=='{') +P++; +if(!(isalpha(*P)||*P=='_')) +{fprintf(stderr, +"Invalid environment variable name in configuration file\n"); +exit(1); +} +*(env_p++)= *(P++); +while(*P) +{if(isalnum(*P)||*P=='_') +*(env_p++)= *(P++); +else +{while(*P=='}') +P++; +*env_p= '\0'; +break; +} +} + +env_value= getenv(env_name); +if(env_value) +{while(*env_value&&count> 0) +{*(Buf_p++)= *(env_value++); +count--; +} +} +} +else +{*(Buf_p++)= *(P++); +count--; +} +} +*Buf_p= '\0'; +} + + +/*:66*/ +#line 2377 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +else +*Buffer= '\0'; + +return(*Buffer)?1:0; +} + + +/*:65*//*68:*/ +#line 2462 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +void config_error(message) +char*message; + +{fprintf(stderr,"Couldn't find `%s' entry in configuration file\n", +message); +exit(1); +} + + + +/*:68*//*72:*/ +#line 2522 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char*TeX_search_version(void) +{ +#if defined(HAVE_LIBKPATHSEA) +return kpathsea_version_string; +#elif defined(HAVE_EMTEXDIR) +return emtex_version_string; +#elif defined(HAVE_MIKTEX) +char buf[200]; + +strcpy(buf,"MiKTeX "); +miktex_get_miktex_version_string_ex(buf+7,sizeof(buf)-7); + +return buf; +#else +return no_version_string; +#endif +} + + +/*:72*//*75:*/ +#line 2564 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#ifdef HAVE_EMTEXDIR +int dir_setup(ed,env,dir,flags) +struct emtex_dir*ed; +const char*env; +const char*dir; +unsigned flags; + +{const char*val; +char path[260]; + +ed->alloc= 0; +ed->used= 0; +ed->list= NULL; + +if(env!=NULL&&(val= getenv(env))!=NULL) +return setup_list(ed,path,val,flags); +else +fprintf(stderr, +"Environment variable `%s' not set; use current directory\n", +env); + +return TRUE; +} + + +/*:75*//*77:*/ +#line 2596 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +char*file_find(name,list) +char*name; +struct emtex_dir*list; + +{if(emtex_dir_find(name_buffer,sizeof(name_buffer),list,name,EDF_CWD)) +return name_buffer; + +return NULL; +} +#endif + + +/*:77*//*80:*/ +#line 2655 "../../../../tex-live-2009test-1.4/texk/cjkutils/hbf2gf/hbf2gf.w" + +#if defined(HAVE_LIBKPATHSEA) +char*TeX_search_cfg_file(name) +char*name; + +{ +#ifdef OLD_KPATHSEA +return kpse_find_file(name,kpse_dvips_config_format,TRUE); +#else +return kpse_find_file(name,kpse_program_text_format,TRUE); +#endif +} + + +char*TeX_search_hbf_file(name) +char*name; + +{ +#ifdef VERY_OLD_KPATHSEA +return kpse_find_file(name,kpse_dvips_header_format,TRUE); +#else +#ifndef KPSEDLL +return kpse_find_file(name,kpse_type1_format,TRUE); +#else +return kpse_find_file(name,kpse_miscfonts_format,TRUE); +#endif +#endif +} + + +#elif defined(HAVE_EMTEXDIR) +char*TeX_search_cfg_file(name) +char*name; + +{return file_find(name,&cfg_path); +} + + +char*TeX_search_hbf_file(name) +char*name; + +{return file_find(name,&hbf_path); +} + + +#elif defined(HAVE_MIKTEX) +char*TeX_search_cfg_file(name) +char*name; + +{char result[_MAX_PATH]; + +if(!miktex_find_input_file("hbf2gf",*name,result)) +return 0; +return strdup(result); +} + + +char*TeX_search_hbf_file(name) +char*name; + +{char result[_MAX_PATH]; + + +if(!miktex_find_miscfont_file(*name,result)) +return 0; +return strdup(result); +} + + +#else +char*TeX_search_cfg_file(name) +char*name; + +{return name; +} + + +char*TeX_search_hbf_file(name) +char*name; + +{return name; +} +#endif + + + +/*:80*/ diff --git a/Build/source/texk/cjkutils/hbf2gf/hbf2gf.scn b/Build/source/texk/cjkutils/hbf2gf/hbf2gf.scn new file mode 100644 index 00000000000..0d39715d758 --- /dev/null +++ b/Build/source/texk/cjkutils/hbf2gf/hbf2gf.scn @@ -0,0 +1,56 @@ +\I\X66:Check for environment variables\X +\U65. +\I\X8:Check other arguments\X +\U4. +\I\X61:Get code range\X +\U55. +\I\X63:Get sub code range\X +\U55. +\I\X2, 15, 19, 27, 38, 49, 53, 58, 60, 62, 70, 73, 76:Global variables\X +\U4. +\I\X56:Handle extension\X +\U55. +\I\X10, 69:Include files\X +\U4. +\I\X78:Initialize \TeX\ file searching\X +\U4. +\I\X28:Initialize variables\X +\U4. +\I\X57:Necessary parameters\X +\U55. +\I\X59:Optional parameters\X +\U55. +\I\X23:Post section\X +\U21. +\I\X24:Postpost section\X +\U21. +\I\X6:Print help information\X +\U7. +\I\X5:Print version\X +\U7. +\I\X44:Process rest of line\X +\U42. +\I\X33:Produce a temporary row\X +\U32. +\I\X11, 13, 16, 20, 25, 29, 36, 39, 41, 45, 47, 50, 54, 64, 67, 71, 74, +79:Prototypes\X +\U4. +\I\X34:Scale X from \PB{\\{temp\_pixelrow}[\,]} into \PB{\\{new\_pixelrow}[\,]} +and write it into \PB{\\{out\_char}[\,]}\X +\U31. +\I\X32:Scale Y from \PB{\\{pixelrow}[\,]} into \PB{\\{temp\_pixelrow}[\,]}\X +\U31. +\I\X31:Scale row by row\X +\U30. +\I\X7:Scan options\X +\U4. +\I\X43:Search blank lines\X +\U42. +\I\X22:Special section\X +\U21. +\I\X18:Write character\X +\U17. +\I\X9:Write files\X +\U4. +\I\X35:Write out a row\X +\U34. diff --git a/Build/source/texk/cjkutils/hbf2gf/hbf2gf.tex b/Build/source/texk/cjkutils/hbf2gf/hbf2gf.tex new file mode 100644 index 00000000000..0f5c79f4d3e --- /dev/null +++ b/Build/source/texk/cjkutils/hbf2gf/hbf2gf.tex @@ -0,0 +1,2970 @@ +\input cwebmac +% This is the cweb file hbf2gf.w of the CJK package ver. 4.7.0 17-Oct-2006 + +% Copyright (C) 1994-2006 Werner Lemberg <wl@gnu.org> +% +% This program is free software; you can redistribute it and/or modify +% it under the terms of the GNU General Public License as published by +% the Free Software Foundation; either version 2 of the License, or +% (at your option) any later version. +% +% This program is distributed in the hope that it will be useful, +% but WITHOUT ANY WARRANTY; without even the implied warranty of +% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +% GNU General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this program in doc/COPYING; if not, write to the Free +% Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +% MA 02110-1301 USA + +% To print this CWEB file you should (but not must) use the CWEAVE of the +% c2cweb-package (found at the CTAN archives, e.g. ftp.dante.de) and then say +% +% cweave +ai hbf2gf.w +% +% This (fully compatible) CWEAVE can transform CWEB-files with alternative +% output rules (look at the position of braces below!) the author (it's me +% too :-) prefer. Otherwise this file will be formatted traditionally. + +\font\meta=logo10 +\def\mf{{\meta META}\-{\meta FONT}} +\def\Om{\char "0A} % Omega symbol + +\def\title{hbf2gf (CJK Version 4.7.0)} + +\def\topofcontents{ + \null\vfill + \centerline{\titlefont The {\ttitlefont hbf2gf} program} + \vskip 20pt + \centerline{(CJK Version 4.7.0)} + \vfill} + +\def\botofcontents{ + \vfill + \noindent + Copyright \copyright~1996-1999 by Werner Lemberg + \bigskip\noindent + Permission is granted to make and distribute verbatim copies of this + document provided that the copyright notice and this permission notice are + preserved on all copies. + + \smallskip\noindent + Permission is granted to copy and distribute modified versions of this + document under the conditions for verbatim copying, provided that the + entire resulting derived work is distributed under the terms of a + permission notice identical to this one.} + +\pageno=\contentspagenumber \advance\pageno by 1 +\let\maybe=\iftrue +\fullpageheight=240mm +\pageheight=223mm +\pagewidth=158mm +\setpage +\frenchspacing + + +\def\msdos{\.{msdos}} + + + + + +\N{1}{1}Introduction. +This is the \.{hbf2gf} program by Werner Lemberg +(\.{wl@gnu.org}). + +The ``banner line'' defined here should be changed whenever \.{hbf2gf} is +modified. + +\Y\B\4\D$\\{banner}$ \5 +\.{"hbf2gf\ (CJK\ ver.\ 4.}\)\.{7.0)"}\par +\fi + +\M{2} +\.{hbf2gf} is intended to convert Hanzi Bitmap Fonts (HBF) into \TeX\ +generic font files (\.{GF} files) according to the \\{CJK} package, which +\.{hbf2gf} is part of. + +The outline of \.{hbf2gf} is simple: a CJK (Chinese/Japanese/Korean) bitmap +file will be scaled and written in at most \PB{\\{nmb\_files}} \.{GF} files, +each +file containing \PB{\T{256}}~characters (except the last and possibly the first +one). In the normal case it's not necessary to compute the right value of +\PB{\\{nmb\_files}} because \.{hbf2gf} will do this; you should use \PB{${-}% +\T{1}$} instead to +indicate this. See the last section for an example. + +Alternatively you can call \.{hbf2gf} similar to \mf, i.e., the program will +compute one font on demand. This mode will be used if two or three input +parameters instead of one are given: the font name, the horizontal +resolution, and optionally a vertical scaling factor or resolution to allow +modes for e.g.\ $300\times600\,\hbox{dpi}$ printers. \.{hbf2gf} will extract +the configuration file name from the font name; if this file isn't found, +the program exits with error code~\PB{\T{2}} (this is useful for scripts like +\.{mktexpk}). If the configuration file is found but an error occurs while +computing the font, error code~\PB{\T{1}} is returned. In case of success, the +exit +code is zero. + +The characters in the input font files are completely described by the HBF +header file. This program uses the HBF API implementation of Ross Paterson +(\.{ross@soi.city.ac.uk}; with small extensions). You will find a +description of the HBF standard at \.{ftp.ifcss.org}. + +A batch file created by \.{hbf2gf} too (if the program computes a whole set +of subfonts) will convert the \.{GF} files to \.{PK} files using +\.{GFtoPK}, a part of every \TeX\ package. + +\Y\B\4\D$\.{TRUE}$ \5 +\T{1}\par +\B\4\D$\.{FALSE}$ \5 +\T{0}\Y\par +\B\4\D$\.{STRING\_LENGTH}$ \5 +\T{255}\C{ the maximal length of an input string in the configuration file }\par +\B\4\D$\.{FILE\_NAME\_LENGTH}$ \5 +\T{1024}\C{ the maximal length (including the path) of a filename }\Y\par +\Y\B\4\X2:Global variables\X${}\E{}$\6 +\&{int} \\{nmb\_files}${}\K{-}\T{1}{}$;\C{ create all files by default }\6 +\&{int} \\{unicode}${}\K\.{FALSE}{}$;\C{ whether a Unicode font should be +processed }\7 +\&{int} \\{testing}${}\K\.{FALSE}{}$;\C{ whether we test only the font name }\7 +\&{int} \\{mf\_like}${}\K\.{FALSE}{}$;\C{ whether we are in the \mf-like mode }% +\6 +\&{int} \\{file\_number}${}\K\T{0}{}$;\C{ the subfont number }\7 +\&{double} \\{x\_resolution}${}\K\T{0.0}{}$;\C{ the second and third input +parameter }\6 +\&{double} \\{y\_scale}${}\K\T{1.0}{}$;\7 +\&{int} \\{pk\_files}${}\K\.{TRUE}{}$;\C{ command line options }\6 +\&{int} \\{tfm\_files}${}\K\.{TRUE};{}$\6 +\&{int} \\{long\_extension}${}\K\.{TRUE};{}$\6 +\&{int} \\{quiet}${}\K\.{FALSE}{}$;\7 +\&{char} ${}\\{config\_file}[\.{FILE\_NAME\_LENGTH}+\T{4}+\T{1}]{}$;\C{ we +probably must add `\.{.cfg}' }\6 +\&{char} ${}\\{output\_name}[\.{STRING\_LENGTH}+\T{1}]{}$;\7 +\&{FILE} ${}{*}\\{config},{}$ ${}{*}\\{out};{}$\6 +\&{HBF} ${}{*}\\{hbf}{}$;\7 +\8\#\&{ifdef} ${}\msdos{}$\C{ if we compile under DOS or OS/2 }\6 +\8\#\&{define} \.{WRITE\_BIN} \5\.{"wb"}\6 +\8\#\&{define} \.{WRITE\_TXT} \5\.{"wt"}\6 +\8\#\&{define} \.{READ\_BIN} \5\.{"rb"}\6 +\8\#\&{define} \.{READ\_TXT} \5\.{"rt"}\6 +\8\#\&{else}\6 +\8\#\&{define} \.{WRITE\_BIN} \5\.{"w"}\6 +\8\#\&{define} \.{WRITE\_TXT} \5\.{"w"}\6 +\8\#\&{define} \.{READ\_BIN} \5\.{"r"}\6 +\8\#\&{define} \.{READ\_TXT} \5\.{"r"}\6 +\8\#\&{endif}\7 +\&{int} \\{end\_of\_file}${}\K\.{FALSE}{}$;\par +\As15, 19, 27, 38, 49, 53, 58, 60, 62, 70, 73\ETs76. +\U4.\fi + +\M{3} +One \.{PL} file will be created additionally, which describes the font +metrics in a readable way. Because all CJK characters have identical +bounding boxes, one metrics file is enough---the batch job created by +\.{hbf2gf} calls \.{PLtoTF} to produce this \.{TFM} file and then copies +it into \PB{\\{nmb\_files}} metrics files. There usually will be a discrepancy +between the number of characters in the last \.{GF} file and the +\.{TFM} file, but this does not harm. + +If you specify the \.{ofm\_file} option in the configuration file, an +extended virtual property file (such files have the extension \.{.ovp}) for +the \Om\ system is written; this will be then converted with +\.{ovp2ovf} into an \.{OFM} and an \.{OVF} file to map all the subfonts +into one large virtual font. + + + +\fi + +\N{1}{4}The main routine. +The main routine takes \PB{\\{file\_name}}, \PB{\\{x\_resolution}}, and \PB{% +\\{y\_scale}} as command +line parameters if in \mf-like mode, otherwise \PB{\\{config\_file}} as the +only +argument. \PB{\\{read\_config}(\,)} scans the configuration file and fills the +global +variables, \PB{\\{write\_file}(\,)} writes the \.{GF} files, \PB{\\{write\_pl}(% +\,)} and +\PB{\\{write\_ovp}(\,)} write the \.{PL} and \.{OVP} files respectively, and +\PB{\\{write\_job}(\,)} the batch file. + +\Y\B\X10:Include files\X\6 +\X11:Prototypes\X\6 +\X2:Global variables\X\7 +\&{int} ${}\\{main}(\\{argc},\39\\{argv}){}$\1\1\6 +\&{int} \\{argc};\C{ argument count }\6 +\&{char} ${}{*}\\{argv}[\,]{}$;\C{ argument values }\2\2\6 +${}\{{}$\1\6 +\&{char} ${}{*}\|p;{}$\7 +\X78:Initialize \TeX\ file searching\X\7 +\X7:Scan options\X\7 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"\\n\%s\\n\\n"},\39\\{banner}){}$;\2\7 +${}\\{strncpy}(\\{config\_file},\39\\{argv}[\T{1}],\39\.{FILE\_NAME% +\_LENGTH});{}$\6 +${}\\{config\_file}[\.{FILE\_NAME\_LENGTH}]\K\.{'\\0'}{}$;\7 +\&{if} ${}(\\{argc}>\T{2}\V\\{testing}){}$\5 +${}\{{}$\1\6 +\&{int} \|l${}\K\\{strlen}(\\{config\_file});{}$\7 +\&{if} ${}(\|l>\T{2}){}$\1\5 +${}\\{config\_file}[\|l-\T{2}]\K\.{'\\0'}{}$;\C{ strip subfont number from file +name }\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"`\%s'\ can't\ be\ a\ sub}\)\.{font\ created\ by\ hbf2}\)\.{gf% +\\n"},\39\\{config\_file});{}$\2\6 +\\{exit}(\T{2});\6 +\4${}\}{}$\2\7 +${}\\{mf\_like}\K\.{TRUE};{}$\6 +\4${}\}{}$\2\7 +\\{read\_config}(\,);\C{ will call \PB{\\{exit}(\T{1})} on errors }\7 +\&{if} (\\{mf\_like})\1\5 +\X8:Check other arguments\X\2\7 +\X28:Initialize variables\X\7 +\X9:Write files\X\7 +\&{if} (\\{tfm\_files})\1\5 +\\{write\_pl}(\,);\2\6 +\&{if} (\\{ofm\_file})\1\5 +\\{write\_ovp}(\,);\2\6 +\&{if} ${}(\R\\{mf\_like}){}$\1\5 +\\{write\_job}(\,);\2\7 +\\{hbfClose}(\\{hbf});\7 +\\{exit}(\T{0});\6 +\&{return} \T{0};\C{ never reached }\6 +\4${}\}{}$\2\par +\fi + +\M{5} +\Y\B\4\D$\.{VERSION}$ \6 +\.{"\\n"}\6 +\.{"Copyright\ (C)\ 1996-}\)\.{1999\ Werner\ Lemberg.}\)\.{\\n"}\6 +\.{"There\ is\ NO\ warrant}\)\.{y.\ \ You\ may\ redistri}\)\.{bute\ this\ +software\\n}\)\.{"}\6 +\.{"under\ the\ terms\ of\ }\)\.{the\ GNU\ General\ Publ}\)\.{ic\ License\\n"}\6 +\.{"and\ the\ HBF\ library}\)\.{\ copyright.\\n"}\6 +\.{"\\n"}\6 +\.{"For\ more\ informatio}\)\.{n\ about\ these\ matter}\)\.{s,\ see\ the\ files% +\\n"}\6 +\.{"named\ COPYING\ and\ h}\)\.{bf.c.\\n"}\6 +\.{"\\n"}\par +\Y\B\4\X5:Print version\X${}\E{}$\6 +${}\{{}$\1\6 +\\{printf}(\.{"\\n"});\6 +\\{printf}(\\{banner});\6 +${}\\{printf}(\.{"\ (\%s)\\n"},\39\\{TeX\_search\_version}(\,));{}$\6 +\\{printf}(\.{VERSION});\6 +\\{exit}(\T{0});\6 +\4${}\}{}$\2\par +\U7.\fi + +\M{6} +\Y\B\4\D$\.{USAGE}$ \6 +\.{"\\n"}\6 +\.{"Usage:\ hbf2gf\ [-q]\ }\)\.{configuration\_file[.}\)\.{cfg]\\n"}\6 +\.{"\ \ \ \ \ \ \ hbf2gf\ [opti}\)\.{ons]\ font\_name\ x\_res}\)\.{olution\ [y% +\_scale\ |\ y}\)\.{\_resolution]\\n"}\6 +\.{"\ \ \ \ \ \ \ hbf2gf\ -t\ [-}\)\.{q]\ font\_name\\n"}\6 +\.{"\\n"}\6 +\.{"\ \ Convert\ a\ font\ in}\)\.{\ HBF\ format\ to\ TeX's}\)\.{\ GF\ resp.\ PK% +\ format.}\)\.{\\n"}\6 +\.{"\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ -q\ \ \ \ \ \ \ \ }\)\.{\ \ \ \ \ be\ silent\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ -p\ \ \ \ \ \ \ \ }\)\.{\ \ \ \ \ don't\ produce\ a}\)\.{% +\ PL\ file\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ -g\ \ \ \ \ \ \ \ }\)\.{\ \ \ \ \ don't\ produce\ a}\)\.{% +\ GF\ file\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ -n\ \ \ \ \ \ \ \ }\)\.{\ \ \ \ \ use\ no\ resoluti}\)% +\.{on\ in\ extension\ (onl}\)\.{y\ `.gf')\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ -t\ \ \ \ \ \ \ \ }\)\.{\ \ \ \ \ test\ for\ font\_n}\)% +\.{ame\ (returns\ 0\ on\ su}\)\.{ccess)\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ --help\ \ \ \ }\)\.{\ \ \ \ \ print\ this\ mess}\)\.{age\ +and\ exit\\n"}\6 +\.{"\ \ \ \ \ \ \ \ \ --version\ }\)\.{\ \ \ \ \ print\ version\ n}\)\.{umber\ +and\ exit\\n"}\6 +\.{"\\n"}\par +\Y\B\4\X6:Print help information\X${}\E{}$\6 +${}\{{}$\1\6 +\\{printf}(\.{USAGE});\6 +\\{exit}(\T{0});\6 +\4${}\}{}$\2\par +\U7.\fi + +\M{7} +Three options can be specified to the program (\.{-p}, \.{-g}, and \.{-n}) +if in \mf-like mode to suppress creation of a \.{PL} resp.\ a +\.{GF} file, and to force a `\.{.gf}' extension (instead of +e.g.\ `\.{.300gf}'). The corresponding setting of a particular switch in the +configuration file is ignored then. + +Additionally, the option \.{-t} tests whether the specified subfont name +leads to an \.{hbf2gf} configuration file. It returns 0 on success and prints +out the name of that configuration file (provided the \.{-q} switch isn't +set). This test isn't a thorough one; it only removes the last two characters +and checks whether a configuration file with that name exists. + +\Y\B\4\X7:Scan options\X${}\E{}$\6 +\&{if} ${}(\\{argc}\E\T{2}){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\\{strcmp}(\\{argv}[\T{1}],\39\.{"--help"})\E\T{0}){}$\1\5 +\X6:Print help information\X\2\6 +\&{else} \&{if} ${}(\\{strcmp}(\\{argv}[\T{1}],\39\.{"--version"})\E\T{0}){}$\1% +\5 +\X5:Print version\X\2\6 +\4${}\}{}$\2\7 +\&{while} ${}(\\{argc}>\T{1}){}$\5 +${}\{{}$\1\6 +${}\|p\K\\{argv}[\T{1}];{}$\6 +\&{if} ${}(\|p[\T{0}]\I\.{'-'}){}$\1\5 +\&{break};\2\6 +\&{if} ${}(\|p[\T{1}]\E\.{'p'}){}$\1\5 +${}\\{tfm\_files}\K\.{FALSE};{}$\2\6 +\&{else} \&{if} ${}(\|p[\T{1}]\E\.{'g'}){}$\1\5 +${}\\{pk\_files}\K\.{FALSE};{}$\2\6 +\&{else} \&{if} ${}(\|p[\T{1}]\E\.{'n'}){}$\1\5 +${}\\{long\_extension}\K\.{FALSE};{}$\2\6 +\&{else} \&{if} ${}(\|p[\T{1}]\E\.{'q'}){}$\1\5 +${}\\{quiet}\K\.{TRUE};{}$\2\6 +\&{else} \&{if} ${}(\|p[\T{1}]\E\.{'t'}){}$\1\5 +${}\\{testing}\K\.{TRUE}{}$;\2\7 +${}\\{argv}\PP;{}$\6 +${}\\{argc}\MM;{}$\6 +\4${}\}{}$\2\7 +\&{if} (\\{testing})\5 +${}\{{}$\1\6 +\&{if} ${}(\\{argc}\I\T{2}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Need\ exactly\ one\ pa}\)\.{rameter\ for\ `-t'% +\ opt}\)\.{ion.\\n"});{}$\6 +${}\\{fprintf}(\\{stderr},\39\.{"Try\ `hbf2gf\ --help'}\)\.{\ for\ more\ +informatio}\)\.{n.\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\&{else} \&{if} ${}(\\{argc}<\T{2}\V\\{argc}>\T{4}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ number\ of\ p}\)\.{arameters.% +\\n"});{}$\6 +${}\\{fprintf}(\\{stderr},\39\.{"Try\ `hbf2gf\ --help'}\)\.{\ for\ more\ +informatio}\)\.{n.\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\Y\par +\U4.\fi + +\M{8} +If the (optional) argument is larger than~\PB{\T{10}}, we treat it as a value +for +the vertical resolution (in dpi), otherwise as a vertical scaling factor. + +\Y\B\4\X8:Check other arguments\X${}\E{}$\6 +${}\{{}$\1\6 +\&{if} (\\{unicode})\1\5 +${}\\{file\_number}\K{}$(\&{int}) \\{strtol}${}({\AND}\\{argv}[\T{1}][% +\\{strlen}(\\{argv}[\T{1}])-\T{2}],\39{}$(\&{char} ${}{*}{*}){}$ ${}\NULL,\39% +\T{16});{}$\2\6 +\&{else}\1\5 +${}\\{file\_number}\K\\{atoi}({\AND}\\{argv}[\T{1}][\\{strlen}(\\{argv}[% +\T{1}])-\T{2}]){}$;\2\7 +${}\\{x\_resolution}\K\\{atof}(\\{argv}[\T{2}]);{}$\6 +\&{if} ${}(\\{x\_resolution}<\.{PRINTER\_MIN\_RES\_X}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ horizontal\ }\)\.{resolution% +\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +\&{if} ${}(\\{argc}>\T{3}){}$\5 +${}\{{}$\1\6 +${}\\{y\_scale}\K\\{atof}(\\{argv}[\T{3}]);{}$\6 +\&{if} ${}(\\{y\_scale}<\T{0.01}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ vertical\ sc}\)\.{aling\ factor\ or\ +reso}\)\.{lution\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{y\_scale}>\T{10.0}){}$\1\5 +${}\\{y\_scale}\K{}$(\&{double}) \\{x\_resolution}${}/\\{y\_scale};{}$\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\U4.\fi + +\M{9} +If \PB{\\{unicode}} is \PB{\.{TRUE}}, the start value of the running number +appended to +the base name of the output font files is taken from the HBF header file, +otherwise it starts with~`\.{01}'. \PB{\\{min\_char}} represents the lower +bound of +the code range. + +If we are in \mf-like mode, \PB{\\{file\_number}} is taken from the command +line, +and \PB{\\{max\_numb}} will be set to~\PB{\T{1}}. + +\Y\B\4\X9:Write files\X${}\E{}$\6 +${}\{{}$\1\6 +\&{int} \|j${},{}$ \\{max\_numb};\7 +\&{if} ${}(\R\\{mf\_like}){}$\5 +${}\{{}$\1\6 +${}\\{file\_number}\K(\\{unicode}\E\.{TRUE}\?(\\{min\_char}\GG\T{8}):\T{1});{}$% +\6 +\&{if} ${}(\\{nmb\_files}\E{-}\T{1}){}$\1\5 +${}\\{max\_numb}\K(\\{unicode}\E\.{TRUE}\?\T{\^100}:\T{100});{}$\2\6 +\&{else}\1\5 +${}\\{max\_numb}\K\\{nmb\_files};{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\1\5 +${}\\{max\_numb}\K\T{1}{}$;\2\7 +\&{for} ${}(\|j\K\T{0};{}$ ${}(\|j<\\{max\_numb})\W\R\\{end\_of\_file};{}$ ${}% +\\{file\_number}\PP,\39\|j\PP){}$\1\5 +\\{write\_file}(\,);\2\7 +${}\\{nmb\_files}\K\|j{}$;\C{ the real number of output font files }\6 +\4${}\}{}$\2\par +\U4.\fi + +\M{10} +\Y\B\4\X10:Include files\X${}\E{}$\6 +\8\#\&{include} \.{<ctype.h>}\6 +\8\#\&{include} \.{<stdio.h>}\6 +\8\#\&{include} \.{<stdlib.h>}\6 +\8\#\&{include} \.{<string.h>}\6 +\8\#\&{include} \.{<time.h>}\6 +\8\#\&{ifdef} \.{TM\_IN\_SYS\_TIME}\6 +\8\#\&{include} \.{<sys/time.h>}\6 +\8\#\&{endif}\6 +\8\#\&{include} \.{"hbf.h"}\par +\A69. +\U4.\fi + +\N{1}{11}The functions. +The first function to be described is \PB{\\{write\_file}(\,)}. Each \.{GF} +file +consists of three sections: a preamble, a data section, and a postamble. The +functions \PB{\\{write\_pre}(\,)}, \PB{\\{write\_data}(\,)}, and \PB{\\{write% +\_post}(\,)} handle this. + +\Y\B\4\X11:Prototypes\X${}\E{}$\6 +\&{void} \\{write\_file}(\&{void});\par +\As13, 16, 20, 25, 29, 36, 39, 41, 45, 47, 50, 54, 64, 67, 71, 74\ETs79. +\U4.\fi + +\M{12} +In \mf-like mode we create font file name extensions similar to \mf\ if +the \.{-n} option isn't specified; otherwise only `\.{.gf}' will be appended. + +\Y\B\&{void} \\{write\_file}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{char} ${}\\{output\_file}[\.{FILE\_NAME\_LENGTH}+\T{1}];{}$\7 +\&{if} (\\{pk\_files})\5 +${}\{{}$\1\6 +\&{if} (\\{mf\_like})\5 +${}\{{}$\1\6 +\&{if} (\\{unicode})\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s\%02x.\%.0igf"},{}$\6 +\\{output\_name}${},\39\\{file\_number},\39\\{long\_extension}\?(\&{int})(\\{x% +\_resolution}+\T{0.5}):\T{0});{}$\2\6 +\&{else}\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s\%02i.\%.0igf"},{}$\6 +\\{output\_name}${},\39\\{file\_number},\39\\{long\_extension}\?(\&{int})(\\{x% +\_resolution}+\T{0.5}):\T{0});{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} (\\{unicode})\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s\%02x.gf"},\39\\{output\_name},\39% +\\{file\_number});{}$\2\6 +\&{else}\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s\%02i.gf"},\39\\{output\_name},\39% +\\{file\_number});{}$\2\6 +\4${}\}{}$\2\6 +\&{if} ${}(\R(\\{out}\K\\{fopen}(\\{output\_file},\39\.{WRITE\_BIN}))){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ open\ `\%s'\\}\)\.{n"},\39\\{output% +\_file});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"Writing\ `\%s'\ "},\39\\{output\_file}){}$;\2\7 +\\{write\_pre}(\,);\6 +\\{write\_data}(\,);\6 +\\{write\_post}(\,);\6 +\\{fclose}(\\{out});\7 +\&{if} ${}(\R\\{quiet}){}$\1\5 +\\{printf}(\.{"\\n"});\2\6 +\4${}\}{}$\2\6 +\&{else}\1\5 +\\{write\_data}(\,);\2\6 +\4${}\}{}$\2\par +\fi + +\M{13} +The preamble has two bytes at the very beginning, \PB{\.{PRE}} and \PB{\.{GF% +\_ID}}. \PB{\.{PRE}} +starts the preamble, and \PB{\.{GF\_ID}} is the Generic Font Identity Byte. The +next +bytes are a string in Pascal format containing a header, the date, and the +time. Strings in Pascal format start with the length of the string and have +no terminating NULL byte. + +\Y\B\4\D$\.{GF\_ID}$ \5 +\T{131}\par +\B\4\D$\.{PRE}$ \5 +\T{247}\Y\par +\B\4\D$\\{header}$ \5 +\.{"\ hbf2gf\ output\ "}\par +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_pre}(\&{void});\par +\fi + +\M{14} +\Y\B\&{void} \\{write\_pre}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{char} \\{out\_s}[\T{40}]${},{}$ \|s[\T{20}];\6 +\&{time\_t} \\{secs\_now};\6 +\&{struct} \&{tm} ${}{*}\\{time\_now};{}$\7 +${}\\{strcpy}(\\{out\_s},\39\\{header}){}$;\7 +${}\\{secs\_now}\K\\{time}(\NULL){}$;\C{ system date and time }\6 +${}\\{time\_now}\K\\{localtime}({\AND}\\{secs\_now});{}$\6 +${}\\{strftime}(\|s,\39\T{20},\39\.{"\%Y.\%m.\%d:\%H.\%M"},\39\\{time% +\_now});{}$\6 +${}\\{strcat}(\\{out\_s},\39\|s){}$;\7 +${}\\{fputc}(\.{PRE},\39\\{out});{}$\6 +${}\\{fputc}(\.{GF\_ID},\39\\{out});{}$\6 +${}\\{fputc}(\\{strlen}(\\{out\_s}),\39\\{out});{}$\6 +${}\\{fputs}(\\{out\_s},\39\\{out});{}$\6 +\4${}\}{}$\2\par +\fi + +\M{15} +\PB{\\{write\_data}(\,)} produces the middle part of the \.{GF} file. It first +sets +\PB{\\{char\_adr\_p}} equal to the address of \PB{\\{char\_adr}[\,]} which will +contain file +offsets of the compressed characters. + +\PB{\\{input\_size\_x}} and \PB{\\{input\_size\_y}} reflect the original +dimensions of the +bitmap font, \PB{\\{pk\_output\_size\_x}} and \PB{\\{pk\_output\_size\_y}} +contain the width and +height of the output character box (in pixels), \PB{\\{pk\_offset\_x}} and +\PB{\\{pk\_offset\_y}} define the baseline of the font. The same names starting +with +`\\{tfm\_}' instead of `\\{pk\_}' are used for \.{TFM} files (values are +multiples of design size). \PB{\\{mag\_x}} and \PB{\\{mag\_y}} hold the scaling +factors +which are needed to reach \PB{\\{design\_size}}. \PB{\\{slant}} defines the +slant ($\Delta +x / \Delta y$), \PB{\\{target\_size\_x}} and \PB{\\{target\_size\_y}} will be +the final +dimensions; \PB{$\\{magstep\_x}\K\\{target\_size\_x}/\\{design\_size}$} is % +\TeX's +\.{\\magstep}. + +The \CEE/ standard specifies that all global values will be automatically +set to~\PB{\T{0}} if no initialization value is given. + +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{long} \\{char\_adr}[\T{256}];\6 +\&{long} ${}{*}\\{char\_adr\_p}{}$;\7 +\&{int} \\{pk\_offset\_x};\C{ horizontal offset (increase character width a +bit; will be applied on both the left and the right side) }\6 +\&{double} \\{tfm\_offset\_x};\6 +\&{int} \\{pk\_offset\_y};\C{ vertical offset (must be configured to desired +font size) }\6 +\&{double} \\{tfm\_offset\_y};\7 +\&{int} \\{input\_size\_x};\6 +\&{int} \\{input\_size\_y};\6 +\&{const} \&{char} ${}{*}\\{font\_encoding}{}$;\C{ taken from the HBF file }\6 +\&{int} \\{pk\_width};\C{ without slant }\6 +\&{int} \\{pk\_output\_size\_x};\C{ the output character box dimensions without +offsets }\6 +\&{double} \\{tfm\_output\_size\_x};\6 +\&{int} \\{pk\_output\_size\_y};\6 +\&{double} \\{tfm\_output\_size\_y};\7 +\&{double} \\{design\_size}${}\K\T{10.0}{}$;\C{ in points }\6 +\&{double} \\{target\_size\_x};\C{ in points }\6 +\&{double} \\{target\_size\_y};\6 +\&{double} \\{magstep\_x};\6 +\&{double} \\{magstep\_y};\6 +\&{double} \\{slant};\6 +\&{int} \\{rotation};\7 +\&{double} \\{mag\_x};\C{ horizontal and vertical magnification values }\6 +\&{double} \\{mag\_y};\7 +\&{int} \\{empty\_char};\C{ a flag whether the character does not exist or is +empty }\6 +\&{int} \\{last\_char};\C{ the last valid character in a \.{GF} file }\7 +\&{int} \\{dot\_count};\C{ this counts the processed characters; + every ten characters a dot is output to the screen }\par +\fi + +\M{16} +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_data}(\&{void});\par +\fi + +\M{17} +\Y\B\&{void} \\{write\_data}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +${}\\{dot\_count}\K\T{0};{}$\6 +${}\\{char\_adr\_p}\K\\{char\_adr}{}$;\7 +\&{for} ${}(\\{last\_char}\K\T{0};{}$ ${}(\\{last\_char}<\T{256})\W\R\\{end\_of% +\_file};{}$ ${}\\{last\_char}\PP){}$\1\5 +\X18:Write character\X\2\6 +\4${}\}{}$\2\par +\fi + +\M{18} +The code in this section saves the current file position first and calls +\PB{\\{make\_pixel\_array}(\,)}, which expands and scales the character bitmap. + +\PB{\.{BOC}} (and \PB{\.{BOC1}}), the Begin Of Character command byte, must be +followed by +the character code and the dimensions of the character as explained in +``\mf---the program'' (corrected by vertical and horizontal offsets). + +\PB{\\{write\_coding}(\,)} compresses and outputs the bitmap; \PB{\.{EOC}} (End +Of Character) +finishes the current character. + +\Y\B\4\D$\.{BOC}$ \5 +\T{67}\par +\B\4\D$\.{BOC1}$ \5 +\T{68}\C{ simplified version of \PB{\.{BOC}} }\par +\B\4\D$\.{EOC}$ \5 +\T{69}\par +\Y\B\4\X18:Write character\X${}\E{}$\6 +${}\{{}$\1\6 +\&{if} ${}(\\{dot\_count}\PP\MOD\T{10}\E\T{0}{}$)\C{ a progress report for +impatient users }\1\6 +\&{if} ${}(\\{pk\_files}\W\R\\{quiet}){}$\5 +${}\{{}$\1\6 +\\{printf}(\.{"."});\6 +\\{fflush}(\\{stdout});\6 +\4${}\}{}$\2\2\7 +${}\\{empty\_char}\K\.{FALSE};{}$\6 +\\{make\_pixel\_array}(\,);\6 +\&{if} (\\{end\_of\_file})\1\5 +\&{return};\2\7 +\&{if} (\\{pk\_files})\5 +${}\{{}$\1\6 +${}{*}\\{char\_adr\_p}\K\\{ftell}(\\{out});{}$\6 +${}\\{char\_adr\_p}\PP{}$;\7 +\&{if} (\\{empty\_char})\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{BOC1},\39\\{out});{}$\6 +\\{fputc}((\&{unsigned} \&{char}) \\{last\_char}${},\39\\{out});{}$\6 +${}\\{fputc}(\T{0},\39\\{out});{}$\6 +${}\\{fputc}(\T{0},\39\\{out});{}$\6 +${}\\{fputc}(\T{0},\39\\{out});{}$\6 +${}\\{fputc}(\T{0},\39\\{out});{}$\6 +${}\\{fputc}(\.{EOC},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{BOC},\39\\{out});{}$\6 +${}\\{fputl}(\\{last\_char},\39\\{out});{}$\6 +${}\\{fputl}({-}\T{1\$L},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_offset\_x},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_output\_size\_x}+\\{pk\_offset\_x},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_offset\_y},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_output\_size\_y}+\\{pk\_offset\_y},\39\\{out}){}$;\7 +\\{write\_coding}(\,);\7 +${}\\{fputc}(\.{EOC},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\U17.\fi + +\M{19} +The current \.{GF} file will be completed with data written by +\PB{\\{write\_post}(\,)}. The end consists of three sections: ``special'', +``post'', +and ``postpost''. The first contains material not used by \TeX\ itself but +which can be used by other programs like \.{GFtoDVI} or for documentary +purposes (\PB{\\{coding}[\,]} and \PB{\\{comment}[\,]}). The second describes +the font as a +whole, and the last marks the end of the file. + +\PB{\\{pk\_total\_min\_x}} up to \PB{\\{pk\_total\_max\_y}} define the greatest +bounding box of +this file (including offsets); the horizontal character escapement after +drawing the character is \PB{\\{pk\_dx}}. \PB{\\{tfm\_width}} is the width in +multiples of +the design size ignoring the target size. + +\Y\B\4\D$\.{\_2\_16}$ \5 +\T{65536.0}\C{ $2^{16}$ }\par +\B\4\D$\.{\_2\_20}$ \5 +\T{1048576.0}\C{ $2^{20}$ }\par +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{char} ${}\\{coding}[\.{STRING\_LENGTH}+\T{1}]{}$;\C{ a comment describing +the font encoding }\6 +\&{char} ${}\\{comment}[\.{STRING\_LENGTH}+\T{1}]{}$;\C{ a comment describing +the font }\7 +\&{unsigned} \&{long} \\{checksum};\7 +\&{long} \\{pk\_total\_min\_x};\6 +\&{long} \\{pk\_total\_max\_x};\6 +\&{long} \\{pk\_total\_min\_y};\6 +\&{long} \\{pk\_total\_max\_y};\7 +\&{int} \\{dpi\_x};\C{ printer resolution }\6 +\&{int} \\{dpi\_y};\6 +\&{double} \\{ppp\_x};\C{ pixels per point }\6 +\&{double} \\{ppp\_y};\par +\fi + +\M{20} +To clarify the meaning of these values see the sections about the metrics +and configuration file also. + +\TeX\ defines that 72.27~points are exactly 1~inch. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_post}(\&{void});\par +\fi + +\M{21} +\Y\B\&{void} \\{write\_post}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{long} \\{special\_adr};\6 +\&{long} \\{post\_adr};\7 +\&{long} \\{designsize}${}\K\\{design\_size}*\.{\_2\_20}{}$;\C{ design size $* +2^{20}$ }\7 +\&{int} \\{pk\_dx};\6 +\&{long} \\{tfm\_width};\7 +\&{int} \|i;\6 +\&{long} \\{temp};\7 +${}\\{ppp\_x}\K\\{dpi\_x}/\T{72.27}*\\{magstep\_x};{}$\6 +${}\\{ppp\_y}\K\\{dpi\_y}/\T{72.27}*\\{magstep\_y}{}$;\7 +${}\\{pk\_total\_min\_x}\K\\{pk\_offset\_x};{}$\6 +${}\\{pk\_total\_max\_x}\K\\{pk\_output\_size\_x}+\T{2}*\\{pk\_offset\_x};{}$\6 +${}\\{pk\_total\_min\_y}\K\\{pk\_offset\_y};{}$\6 +${}\\{pk\_total\_max\_y}\K\\{pk\_output\_size\_y}+\\{pk\_offset\_y}{}$;\7 +${}\\{pk\_dx}\K\\{pk\_width}+\T{2}*\\{pk\_offset\_x}{}$;\C{ no slant }\6 +${}\\{tfm\_width}\K(\\{tfm\_output\_size\_x}+\T{2}*\\{tfm\_offset\_x})*\.{\_2% +\_20}{}$;\C{ width in multiples of design size $* 2^{20}$ }\7 +\X22:Special section\X\6 +\X23:Post section\X\6 +\X24:Postpost section\X\6 +\4${}\}{}$\2\par +\fi + +\M{22} +\.{XXXn} will be followed by n~bytes representing the length of a string +which follows immediately. \PB{\.{YYY}} is a 32~bit integer which is normally +connected with the preceding string (but not used here). \PB{\\{special\_adr}} +contains the address of the ``special section''. All items here are +optional. + +\Y\B\4\D$\.{XXX1}$ \5 +\T{239}\C{ these are all special command bytes }\par +\B\4\D$\.{XXX2}$ \5 +\T{240}\C{ not used }\par +\B\4\D$\.{XXX3}$ \5 +\T{241}\C{ not used }\par +\B\4\D$\.{XXX4}$ \5 +\T{242}\C{ not used }\Y\par +\B\4\D$\.{YYY}$ \5 +\T{243}\C{ not used }\par +\Y\B\4\X22:Special section\X${}\E{}$\6 +$\\{special\_adr}\K\\{ftell}(\\{out}){}$;\7 +\&{if} ${}({*}\\{coding}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{XXX1},\39\\{out}){}$;\C{ \PB{\.{XXX1}} implies a string length % +\PB{$<$ \T{256}} }\6 +${}\\{fputc}(\\{strlen}(\\{coding}),\39\\{out});{}$\6 +${}\\{fputs}(\\{coding},\39\\{out});{}$\6 +\4${}\}{}$\2\7 +\&{if} ${}({*}\\{comment}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{XXX1},\39\\{out});{}$\6 +${}\\{fputc}(\\{strlen}(\\{comment}),\39\\{out});{}$\6 +${}\\{fputs}(\\{comment},\39\\{out});{}$\6 +\4${}\}{}$\2\par +\U21.\fi + +\M{23} +All character offsets collected in \PB{\\{char\_adr}} will be written to the +output +file. \PB{\\{fputl}(\,)} writes a 32~bit integer into a file. + +\PB{\.{CHAR\_LOC0}} (and \PB{\.{CHAR\_LOC}}) is the first byte of a character +locator +(i.e., offset, character code, and width information). \PB{\.{POST}} starts the +postamble, and \PB{\\{post\_adr}} points to the beginning byte of the +postamble. + +\Y\B\4\D$\.{POST}$ \5 +\T{248}\Y\par +\B\4\D$\.{CHAR\_LOC}$ \5 +\T{245}\par +\B\4\D$\.{CHAR\_LOC0}$ \5 +\T{246}\C{ simplified version of \PB{\.{CHAR\_LOC}} }\par +\Y\B\4\X23:Post section\X${}\E{}$\6 +$\\{post\_adr}\K\\{ftell}(\\{out});{}$\6 +${}\\{fputc}(\.{POST},\39\\{out});{}$\6 +${}\\{fputl}(\\{special\_adr},\39\\{out}){}$;\7 +${}\\{fputl}(\\{designsize},\39\\{out});{}$\6 +${}\\{fputl}(\\{checksum},\39\\{out});{}$\6 +${}\\{fputl}(\\{ppp\_x}*\.{\_2\_16},\39\\{out});{}$\6 +${}\\{fputl}(\\{ppp\_y}*\.{\_2\_16},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_total\_min\_x},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_total\_max\_x},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_total\_min\_y},\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_total\_max\_y},\39\\{out}){}$;\7 +${}\\{char\_adr\_p}\K\\{char\_adr}{}$;\7 +\&{if} ${}(\\{pk\_dx}<\T{256}){}$\5 +${}\{{}$\1\6 +\&{for} ${}(\|i\K\T{0};{}$ ${}\|i<\\{last\_char};{}$ ${}\|i\PP{}$)\C{ the +character locators }\6 +${}\{{}$\1\6 +${}\\{fputc}(\.{CHAR\_LOC0},\39\\{out});{}$\6 +${}\\{fputc}(\|i,\39\\{out});{}$\6 +${}\\{fputc}(\\{pk\_dx},\39\\{out});{}$\6 +${}\\{fputl}(\\{tfm\_width},\39\\{out});{}$\6 +${}\\{fputl}({*}\\{char\_adr\_p}\PP,\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\C{ will only happen if \PB{$\.{MAX\_CHAR\_SIZE}\G\T{256}$} }\6 +${}\{{}$\1\6 +\&{for} ${}(\|i\K\T{0};{}$ ${}\|i<\\{last\_char};{}$ ${}\|i\PP){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{CHAR\_LOC},\39\\{out});{}$\6 +${}\\{fputc}(\|i,\39\\{out});{}$\6 +${}\\{fputl}(\\{pk\_dx}*\.{\_2\_16},\39\\{out});{}$\6 +${}\\{fputl}(\T{0},\39\\{out});{}$\6 +${}\\{fputl}(\\{tfm\_width},\39\\{out});{}$\6 +${}\\{fputl}({*}\\{char\_adr\_p}\PP,\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\U21.\fi + +\M{24} +\PB{\.{POSTPOST}} starts the section after the postamble. To get all +information in +a \.{GF} file, you must start here. The very last bytes of the file have +the value \PB{\.{POSTPOST\_ID}} (the file is filled with at least 4 of these +bytes +until a file length of a multiple of~4 is reached). Going backwards a +\PB{\.{GF\_ID}} will be next, then comes the address of the postamble section. + +Jumping to the postamble, a \PB{\.{POST}} byte comes first, then the address of +the special section, and afterwards all character offsets. These offsets and +addresses describe the whole file. + +\Y\B\4\D$\.{POSTPOST}$ \5 +\T{249}\par +\B\4\D$\.{POSTPOST\_ID}$ \5 +\T{223}\par +\Y\B\4\X24:Postpost section\X${}\E{}$\6 +$\\{fputc}(\.{POSTPOST},\39\\{out});{}$\6 +${}\\{fputl}(\\{post\_adr},\39\\{out});{}$\6 +${}\\{fputc}(\.{GF\_ID},\39\\{out});{}$\6 +${}\\{temp}\K\\{ftell}(\\{out});{}$\6 +${}\|i\K(\&{int})(\\{temp}\MOD\T{4})+\T{4};{}$\6 +\&{while} ${}(\|i\MM){}$\1\5 +${}\\{fputc}(\.{POSTPOST\_ID},\39\\{out}){}$;\2\par +\U21.\fi + +\M{25} +\TeX\ wants the most significant byte first. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} ${}\\{fputl}(\&{long},\39{}$\&{FILE} ${}{*}){}$;\par +\fi + +\M{26} +\Y\B\&{void} ${}\\{fputl}(\\{num},\39\|f){}$\1\1\6 +\&{long} \\{num};\6 +\&{FILE} ${}{*}\|f;\2\2{}$\6 +${}\{{}$\1\6 +${}\\{fputc}(\\{num}\GG\T{24},\39\|f);{}$\6 +${}\\{fputc}(\\{num}\GG\T{16},\39\|f);{}$\6 +${}\\{fputc}(\\{num}\GG\T{8},\39\|f);{}$\6 +${}\\{fputc}(\\{num},\39\|f);{}$\6 +\4${}\}{}$\2\par +\fi + +\M{27} +\PB{\\{make\_pixel\_array}(\,)} scales a character into the array \PB{\\{out% +\_char}[\,]} where +each \\{byte} represents one pixel, contrary to the input file where each +\\{bit} is used to store the character bitmap. \PB{\.{BLACK}} indicates a black +pixel. + +The scaling routine was modeled after the program \.{pnmscale} of the +\.{pbmplus} package. \.{pbmplus} was designed to handle arbitrary pictures, +and bitmaps are only a special case of a graymap with values from~0 for +white up to \PB{$\.{PIXEL\_MAXVAL}\K\T{255}$} for black. + +If \PB{\.{EOF}} is encountered, \PB{\\{end\_of\_file}} is set and the function +returns +immediately. + +\Y\B\4\D$\.{BLACK}$ \5 +\T{1}\par +\B\4\D$\.{WHITE}$ \5 +\T{0}\Y\par +\B\4\D$\.{PIXEL\_MAXVAL}$ \5 +\T{255}\par +\B\4\D$\.{SCALE}$ \5 +\T{4096}\par +\B\4\D$\.{HALFSCALE}$ \5 +\T{2048}\Y\par +\B\4\D$\.{MAX\_CHAR\_SIZE}$ \5 +\T{1023}\par +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{HBF\_CHAR} \\{code};\6 +\&{const} \&{unsigned} \&{char} ${}{*}\\{bitmap}{}$;\C{ a proper input bitmap +array will be allocated by the HBF API }\6 +\&{unsigned} \&{char} ${}{*}\\{bP}{}$;\7 +\&{unsigned} \&{char} ${}\\{out\_char}[\.{MAX\_CHAR\_SIZE}*\.{MAX\_CHAR\_SIZE}+% +\T{1}]{}$;\C{ the output bitmap array }\6 +\&{unsigned} \&{char} ${}{*}\\{out\_char\_p}{}$;\7 +\&{unsigned} \&{char} \\{pixelrow}[\.{MAX\_CHAR\_SIZE}];\6 +\&{unsigned} \&{char} \\{temp\_pixelrow}[\.{MAX\_CHAR\_SIZE}];\6 +\&{unsigned} \&{char} ${}\\{new\_pixelrow}[\.{MAX\_CHAR\_SIZE}+\T{1}]{}$;\C{ we +need space to append a white pixel }\7 +\&{int} \\{curr\_row};\C{ for \PB{\\{read\_row}(\,)} if we access the glyph +rotated }\6 +\&{long} \\{grayrow}[\.{MAX\_CHAR\_SIZE}];\7 +\&{long} \\{s\_mag\_x}${},{}$ \\{s\_mag\_y}${},{}$ \\{s\_slant};\par +\fi + +\M{28} +We need to initialize the \PB{\\{grayrow}[\,]} array together with some other +variables. + +Two steps are necessary to compute the \PB{\\{code}} if we are in the \mf-like +mode. Assuming that we search the code \.{0xXXYY}, we first set \PB{\\{code}} +to +the value \.{0xXXAA}, where \.{0xAA} is equal to \PB{\\{min\_2\_byte}} (getting +\PB{\\{offset}} as the number of remaining characters to reach the first +character +in our given subfont), then we increment \PB{\\{code}} (and decrement \PB{% +\\{offset}}) +until \PB{\\{offset}} equals~0. + +\Y\B\4\X28:Initialize variables\X${}\E{}$\6 +${}\{{}$\1\6 +\&{int} \\{col}${},{}$ \\{offset};\7 +\&{if} (\\{rotation})\5 +${}\{{}$\1\6 +\&{int} \\{tmp};\7 +${}\\{tmp}\K\\{input\_size\_x};{}$\6 +${}\\{input\_size\_x}\K\\{input\_size\_y};{}$\6 +${}\\{input\_size\_y}\K\\{tmp};{}$\6 +\4${}\}{}$\2\7 +\&{if} (\\{mf\_like})\5 +${}\{{}$\1\6 +${}\\{target\_size\_x}\K\\{design\_size}*(\\{x\_resolution}/\\{dpi\_x});{}$\6 +${}\\{target\_size\_y}\K\\{design\_size}*(\\{x\_resolution}*\\{y\_scale}/\\{dpi% +\_y});{}$\6 +\4${}\}{}$\2\6 +\&{else}\1\5 +${}\\{target\_size\_x}\K\\{target\_size\_y}\K\\{design\_size};{}$\2\6 +${}\\{magstep\_x}\K\\{target\_size\_x}/\\{design\_size};{}$\6 +${}\\{magstep\_y}\K\\{target\_size\_y}/\\{design\_size}{}$;\7 +${}\\{pk\_offset\_x}\K\\{offset\_x}*\\{magstep\_x}+\T{0.5};{}$\6 +${}\\{pk\_offset\_y}\K\\{offset\_y}*\\{magstep\_y}+\T{0.5};{}$\6 +${}\\{tfm\_offset\_x}\K\\{offset\_x}/(\\{dpi\_x}/\T{72.27})/\\{design% +\_size};{}$\6 +${}\\{tfm\_offset\_y}\K\\{offset\_y}/(\\{dpi\_y}/\T{72.27})/\\{design% +\_size}{}$;\7 +${}\\{pk\_width}\K\\{input\_size\_x}*\\{mag\_x}*\\{magstep\_x}+\T{0.5}{}$;\C{ +without slant }\6 +${}\\{pk\_output\_size\_x}\K\\{input\_size\_x}*\\{mag\_x}*\\{magstep\_x}+% +\\{input\_size\_y}*\\{mag\_y}*\\{magstep\_y}*\\{slant}+\T{0.5};{}$\6 +${}\\{pk\_output\_size\_y}\K\\{input\_size\_y}*\\{mag\_y}*\\{magstep\_y}+% +\T{0.5};{}$\6 +${}\\{tfm\_output\_size\_x}\K\\{input\_size\_x}*\\{mag\_x}/(\\{dpi\_x}/% +\T{72.27})/\\{design\_size};{}$\6 +${}\\{tfm\_output\_size\_y}\K\\{input\_size\_y}*\\{mag\_y}/(\\{dpi\_y}/% +\T{72.27})/\\{design\_size};{}$\6 +\&{if} ${}(\\{pk\_output\_size\_x}>\.{MAX\_CHAR\_SIZE}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Output\ character\ bo}\)\.{x\ width\ too\ big% +\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{pk\_output\_size\_y}>\.{MAX\_CHAR\_SIZE}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Output\ character\ bo}\)\.{x\ height\ too\ big% +\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +\&{for} ${}(\\{col}\K\T{0};{}$ ${}\\{col}<\\{input\_size\_x};{}$ ${}\PP% +\\{col}){}$\1\5 +${}\\{grayrow}[\\{col}]\K\.{HALFSCALE}{}$;\2\7 +\&{if} ${}(\R\\{mf\_like}){}$\1\5 +${}\\{code}\K(\\{min\_char}\AND\T{\^FF00})+\\{min\_2\_byte};{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} ${}((\\{file\_number}<(\\{unicode}\?\T{0}:\T{1}))\V(\\{file\_number}\G% +\T{\^100})){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ subfile\ num}\)\.{ber\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +\&{if} (\\{unicode})\5 +${}\{{}$\1\6 +${}\\{offset}\K\T{0};{}$\6 +${}\\{code}\K\\{file\_number}*\T{\^100};{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{offset}\K(\\{file\_number}-\T{1})*\T{256}\MOD\\{nmb\_2\_bytes};{}$\6 +${}\\{code}\K(\\{min\_char}\AND\T{\^FF00})+\\{min\_2\_byte}+(\\{file\_number}-% +\T{1})*\T{256}/\\{nmb\_2\_bytes}*\T{\^100};{}$\6 +\4${}\}{}$\2\7 +\&{while} ${}(\\{offset}\MM){}$\1\6 +\&{while} ${}(\R\\{b2\_codes}[\\{code}\PP\AND\T{\^FF}]{}$)\C{ eliminate invalid +\PB{\\{b2\_codes}} }\1\6 +;\2\2\7 +\&{if} ${}(\\{code}>\\{max\_char}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ subfile\ num}\)\.{ber\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +${}\\{s\_mag\_x}\K\\{mag\_x}*\\{magstep\_x}*\.{SCALE};{}$\6 +${}\\{s\_mag\_y}\K\\{mag\_y}*\\{magstep\_y}*\.{SCALE};{}$\6 +${}\\{s\_slant}\K\\{slant}*\.{SCALE};{}$\6 +\4${}\}{}$\2\par +\U4.\fi + +\M{29} +All arrays of the \\{pixelrow} family contain gray values. While scaling +with non-integer values a pixel of the input bitmap will normally not align +with the pixel grid of the output bitmap (geometrically spoken). In this +case we first compute the fractions of input pixel rows scaled vertically +and add the corresponding gray values until a temporary row is produced. +Then we repeat this procedure horizontally pixel by pixel and write the +result into an output array. + + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{make\_pixel\_array}(\&{void});\par +\fi + +\M{30} +\Y\B\&{void} \\{make\_pixel\_array}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{unsigned} \&{char} ${}{*}\\{prP};{}$\6 +\&{unsigned} \&{char} ${}{*}\\{temp\_prP};{}$\6 +\&{unsigned} \&{char} ${}{*}\\{new\_prP};{}$\6 +\&{long} ${}{*}\\{grP}{}$;\7 +\&{register} \&{unsigned} \&{char} ${}{*}\\{xP};{}$\6 +\&{register} \&{unsigned} \&{char} ${}{*}\\{nxP}{}$;\7 +\&{register} \&{int} \\{row}${},{}$ \\{col};\6 +\&{int} \\{rows\_read}${}\K\T{0};{}$\6 +\&{register} \&{int} \\{need\_to\_read\_row}${}\K\T{1}{}$;\7 +\&{long} \\{frac\_row\_to\_fill}${}\K\.{SCALE};{}$\6 +\&{long} \\{frac\_row\_left}${}\K\\{s\_mag\_y}{}$;\7 +\&{int} \\{no\_code}${}\K\.{FALSE};{}$\7 +${}\\{prP}\K\\{pixelrow};{}$\6 +${}\\{temp\_prP}\K\\{temp\_pixelrow};{}$\6 +${}\\{new\_prP}\K\\{new\_pixelrow};{}$\6 +${}\\{grP}\K\\{grayrow};{}$\6 +${}\\{out\_char\_p}\K\\{out\_char}{}$;\C{ will be increased by \PB{\\{write% +\_row}(\,)} }\7 +\4\\{again}:\6 +\&{if} ${}(\\{b2\_codes}[\\{code}\AND\T{\^FF}]{}$)\C{ a valid second byte? }\6 +${}\{{}$\1\6 +\&{if} (\\{pk\_files})\5 +${}\{{}$\1\6 +${}\\{bitmap}\K\\{hbfGetBitmap}(\\{hbf},\39\\{code});{}$\6 +${}\\{bP}\K{}$(\&{unsigned} \&{char} ${}{*}){}$ \\{bitmap};\C{ will be +increased by \PB{\\{read\_row}(\,)} }\7 +\&{if} ${}(\R\\{bitmap}){}$\1\5 +${}\\{empty\_char}\K\.{TRUE};{}$\2\6 +\&{else}\1\5 +\X31:Scale row by row\X\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\1\5 +${}\\{no\_code}\K\.{TRUE}{}$;\2\7 +\&{if} ${}((\\{code}\AND\T{\^FF})\E\\{max\_2\_byte}){}$\1\5 +${}\\{code}\MRL{+{\K}}\T{\^FF}-(\\{max\_2\_byte}-\\{min\_2\_byte}){}$;\C{ go to +next plane }\2\6 +\&{if} ${}(\\{code}\G\\{max\_char}){}$\5 +${}\{{}$\1\6 +${}\\{end\_of\_file}\K\.{TRUE};{}$\6 +\&{return};\6 +\4${}\}{}$\2\7 +${}\\{code}\PP{}$;\7 +\&{if} (\\{no\_code})\5 +${}\{{}$\1\6 +${}\\{no\_code}\K\.{FALSE};{}$\6 +\&{goto} \\{again};\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\fi + +\M{31} +\Y\B\4\X31:Scale row by row\X${}\E{}$\6 +${}\{{}$\1\6 +\&{if} ${}(\\{pk\_output\_size\_y}\E\\{input\_size\_y}{}$)\C{ shortcut +Y~scaling if possible }\1\6 +${}\\{temp\_prP}\K\\{prP}{}$;\2\7 +${}\\{curr\_row}\K\\{input\_size\_y}-\T{1}{}$;\C{ only needed for rotated +glyphs }\6 +\&{for} ${}(\\{row}\K\T{0};{}$ ${}\\{row}<\\{pk\_output\_size\_y};{}$ ${}\PP% +\\{row}){}$\5 +${}\{{}$\1\6 +\X32:Scale Y from \PB{\\{pixelrow}[\,]} into \PB{\\{temp\_pixelrow}[\,]}\X\6 +\X34:Scale X from \PB{\\{temp\_pixelrow}[\,]} into \PB{\\{new\_pixelrow}[\,]} +and write it into \PB{\\{out\_char}[\,]}\X\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\U30.\fi + +\M{32} +\Y\B\4\X32:Scale Y from \PB{\\{pixelrow}[\,]} into \PB{\\{temp\_pixelrow}[\,]}% +\X${}\E{}$\6 +\&{if} ${}(\\{pk\_output\_size\_y}\E\\{input\_size\_y}{}$)\C{ shortcut +Y~scaling if possible }\1\6 +\\{read\_row}(\\{prP});\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{while} ${}(\\{frac\_row\_left}<\\{frac\_row\_to\_fill}){}$\5 +${}\{{}$\1\6 +\&{if} (\\{need\_to\_read\_row})\1\6 +\&{if} ${}(\\{rows\_read}<\\{input\_size\_y}){}$\5 +${}\{{}$\1\6 +\\{read\_row}(\\{prP});\6 +${}\PP\\{rows\_read};{}$\6 +\4${}\}{}$\2\2\7 +\&{for} ${}(\\{col}\K\T{0},\39\\{xP}\K\\{prP};{}$ ${}\\{col}<\\{input\_size% +\_x};{}$ ${}\PP\\{col},\39\PP\\{xP}){}$\1\5 +${}\\{grP}[\\{col}]\MRL{+{\K}}\\{frac\_row\_left}*({*}\\{xP}){}$;\2\7 +${}\\{frac\_row\_to\_fill}\MRL{-{\K}}\\{frac\_row\_left};{}$\6 +${}\\{frac\_row\_left}\K\\{s\_mag\_y};{}$\6 +${}\\{need\_to\_read\_row}\K\T{1};{}$\6 +\4${}\}{}$\2\7 +\X33:Produce a temporary row\X\6 +\4${}\}{}$\2\par +\U31.\fi + +\M{33} +Now \PB{$\\{frac\_row\_left}\G\\{frac\_row\_to\_fill}$}, so we can produce a +row. + +\Y\B\4\X33:Produce a temporary row\X${}\E{}$\6 +\&{if} (\\{need\_to\_read\_row})\1\6 +\&{if} ${}(\\{rows\_read}<\\{input\_size\_y}){}$\5 +${}\{{}$\1\6 +\\{read\_row}(\\{prP});\6 +${}\PP\\{rows\_read};{}$\6 +${}\\{need\_to\_read\_row}\K\T{0};{}$\6 +\4${}\}{}$\2\2\7 +\&{for} ${}(\\{col}\K\T{0},\39\\{xP}\K\\{prP},\39\\{nxP}\K\\{temp\_prP};{}$ ${}% +\\{col}<\\{input\_size\_x};{}$ ${}\PP\\{col},\39\PP\\{xP},\39\PP\\{nxP}){}$\5 +${}\{{}$\1\6 +\&{register} \&{long} \|g;\7 +${}\|g\K\\{grP}[\\{col}]+\\{frac\_row\_to\_fill}*({*}\\{xP});{}$\6 +${}\|g\MRL{{/}{\K}}\.{SCALE};{}$\6 +\&{if} ${}(\|g>\.{PIXEL\_MAXVAL}){}$\1\5 +${}\|g\K\.{PIXEL\_MAXVAL}{}$;\2\7 +${}{*}\\{nxP}\K\|g;{}$\6 +${}\\{grP}[\\{col}]\K\.{HALFSCALE};{}$\6 +\4${}\}{}$\2\7 +${}\\{frac\_row\_left}\MRL{-{\K}}\\{frac\_row\_to\_fill};{}$\6 +\&{if} ${}(\\{frac\_row\_left}\E\T{0}){}$\5 +${}\{{}$\1\6 +${}\\{frac\_row\_left}\K\\{s\_mag\_y};{}$\6 +${}\\{need\_to\_read\_row}\K\T{1};{}$\6 +\4${}\}{}$\2\6 +${}\\{frac\_row\_to\_fill}\K\.{SCALE}{}$;\par +\U32.\fi + +\M{34} +To implement the slant we move the starting point \PB{\\{nxP}} to the right +according to the corresponding \PB{\|y}~value. To simplify life only positive +shift values are allowed. + +We always append a white pixel to avoid artefacts at the end of the line +produced by the last line. This rule sets the second condition that the +slant must not be greater than~\PB{\T{1}}---such a large slant would be +unusable +anyway for typesetting purposes. + +\Y\B\4\X34:Scale X from \PB{\\{temp\_pixelrow}[\,]} into \PB{\\{new\_pixelrow}[% +\,]} and write it into \PB{\\{out\_char}[\,]}\X${}\E{}$\6 +\&{if} ${}(\\{pk\_width}\E\\{input\_size\_x}\W\\{s\_slant}\E\T{0}{}$)\C{ +shortcut X~scaling if possible }\1\6 +\\{write\_row}(\\{temp\_prP});\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{register} \&{long} \|g${}\K\.{HALFSCALE};{}$\6 +\&{register} \&{long} \\{frac\_col\_to\_fill}${}\K\.{SCALE};{}$\6 +\&{register} \&{long} \\{frac\_col\_left};\6 +\&{register} \&{int} \\{need\_col}${}\K\T{0};{}$\7 +${}\\{nxP}\K\\{new\_prP}{}$;\7 +${}\\{frac\_col\_left}\K(\\{pk\_output\_size\_y}-\\{row})*\\{s\_slant};{}$\6 +\&{while} ${}(\\{frac\_col\_left}\G\\{frac\_col\_to\_fill}){}$\5 +${}\{{}$\1\6 +${}{*}(\\{nxP}\PP)\K\T{0};{}$\6 +${}\\{frac\_col\_left}\MRL{-{\K}}\\{frac\_col\_to\_fill};{}$\6 +\4${}\}{}$\2\7 +\&{if} ${}(\\{frac\_col\_left}>\T{0}){}$\1\5 +${}\\{frac\_col\_to\_fill}\MRL{-{\K}}\\{frac\_col\_left}{}$;\2\7 +\&{for} ${}(\\{col}\K\T{0},\39\\{xP}\K\\{temp\_prP};{}$ ${}\\{col}<\\{input% +\_size\_x};{}$ ${}\PP\\{col},\39\PP\\{xP}){}$\5 +${}\{{}$\1\6 +${}\\{frac\_col\_left}\K\\{s\_mag\_x};{}$\6 +\&{while} ${}(\\{frac\_col\_left}\G\\{frac\_col\_to\_fill}){}$\5 +${}\{{}$\1\6 +\&{if} (\\{need\_col})\5 +${}\{{}$\1\6 +${}\PP\\{nxP};{}$\6 +${}\|g\K\.{HALFSCALE};{}$\6 +\4${}\}{}$\2\7 +${}\|g\MRL{+{\K}}\\{frac\_col\_to\_fill}*({*}\\{xP});{}$\6 +${}\|g\MRL{{/}{\K}}\.{SCALE};{}$\6 +\&{if} ${}(\|g>\.{PIXEL\_MAXVAL}){}$\1\5 +${}\|g\K\.{PIXEL\_MAXVAL}{}$;\2\7 +${}{*}\\{nxP}\K\|g;{}$\6 +${}\\{frac\_col\_left}\MRL{-{\K}}\\{frac\_col\_to\_fill};{}$\6 +${}\\{frac\_col\_to\_fill}\K\.{SCALE};{}$\6 +${}\\{need\_col}\K\T{1};{}$\6 +\4${}\}{}$\2\7 +\&{if} ${}(\\{frac\_col\_left}>\T{0}){}$\5 +${}\{{}$\1\6 +\&{if} (\\{need\_col})\5 +${}\{{}$\1\6 +${}\PP\\{nxP};{}$\6 +${}\|g\K\.{HALFSCALE};{}$\6 +${}\\{need\_col}\K\T{0};{}$\6 +\4${}\}{}$\2\7 +${}\|g\MRL{+{\K}}\\{frac\_col\_left}*({*}\\{xP});{}$\6 +${}\\{frac\_col\_to\_fill}\MRL{-{\K}}\\{frac\_col\_left};{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\7 +\X35:Write out a row\X\6 +\4${}\}{}$\2\par +\U31.\fi + +\M{35} +\Y\B\4\X35:Write out a row\X${}\E{}$\6 +\&{if} ${}(\\{frac\_col\_to\_fill}>\T{0}){}$\5 +${}\{{}$\1\6 +${}\MM\\{xP};{}$\6 +${}\|g\MRL{+{\K}}\\{frac\_col\_to\_fill}*({*}\\{xP});{}$\6 +\4${}\}{}$\2\7 +\&{if} ${}(\R\\{need\_col}){}$\5 +${}\{{}$\1\6 +${}\|g\MRL{{/}{\K}}\.{SCALE};{}$\6 +\&{if} ${}(\|g>\.{PIXEL\_MAXVAL}){}$\1\5 +${}\|g\K\.{PIXEL\_MAXVAL};{}$\2\6 +${}{*}\\{nxP}\K\|g;{}$\6 +\4${}\}{}$\2\7 +${}{*}(\PP\\{nxP})\K\T{0}{}$;\C{ append a blank pixel }\7 +\\{write\_row}(\\{new\_prP});\par +\U34.\fi + +\M{36} +\PB{\\{read\_row}(\,)} reads a row from \PB{\\{bitmap}[\,]} and converts it +into a graymap row. +If the \PB{\\{rotation}} flag has been set, we get the proper column instead +(note +that in this case \PB{\\{input\_size\_x}} already reflects the width of the +rotated +glyph). + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\8\#\&{ifdef} \.{\_\_GNUC\_\_}\6 +\&{\_\_inline\_\_}\6 +\8\#\&{endif}\6 +\&{void} \\{read\_row}(\&{unsigned} \&{char} ${}{*}){}$;\par +\fi + +\M{37} +\Y\B\8\#\&{ifdef} \.{\_\_GNUC\_\_}\6 +\&{\_\_inline\_\_}\6 +\8\#\&{endif}\6 +\&{void} \\{read\_row}(\\{pixelrow})\1\1\6 +\&{unsigned} \&{char} ${}{*}\\{pixelrow};\2\2{}$\6 +${}\{{}$\1\6 +\&{register} \&{int} \\{col}${},{}$ \\{bitshift}${},{}$ \\{offset};\6 +\&{register} \&{unsigned} \&{char} ${}{*}\\{xP};{}$\6 +\&{register} \&{unsigned} \&{char} \\{item}${}\K\T{0};{}$\7 +\&{if} (\\{rotation})\5 +${}\{{}$\1\6 +${}\\{bitshift}\K\T{7}-(\\{curr\_row}\MOD\T{8});{}$\6 +${}\\{offset}\K(\\{input\_size\_y}+\T{7})/\T{8};{}$\6 +${}\\{bP}\K{}$(\&{unsigned} \&{char} ${}{*}){}$ \\{bitmap}${}+\\{curr\_row}/% +\T{8};{}$\6 +\&{for} ${}(\\{col}\K\T{0},\39\\{xP}\K\\{pixelrow};{}$ ${}\\{col}<\\{input% +\_size\_x};{}$ ${}\PP\\{col},\39\PP\\{xP}){}$\5 +${}\{{}$\1\6 +${}{*}\\{xP}\K(({*}\\{bP}\GG\\{bitshift})\AND\T{1})\E\T{1}\?\.{PIXEL\_MAXVAL}:% +\T{0};{}$\6 +${}\\{bP}\MRL{+{\K}}\\{offset};{}$\6 +\4${}\}{}$\2\6 +${}\\{curr\_row}\MM;{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{bitshift}\K{-}\T{1};{}$\6 +\&{for} ${}(\\{col}\K\T{0},\39\\{xP}\K\\{pixelrow};{}$ ${}\\{col}<\\{input% +\_size\_x};{}$ ${}\PP\\{col},\39\PP\\{xP}){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\\{bitshift}\E{-}\T{1}){}$\5 +${}\{{}$\1\6 +${}\\{item}\K{*}(\\{bP}\PP){}$;\C{ increase input bitmap pointer }\6 +${}\\{bitshift}\K\T{7};{}$\6 +\4${}\}{}$\2\6 +${}{*}\\{xP}\K((\\{item}\GG\\{bitshift})\AND\T{1})\E\T{1}\?\.{PIXEL\_MAXVAL}:% +\T{0};{}$\6 +${}\MM\\{bitshift};{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\fi + +\M{38} +\PB{\\{write\_row}(\,)} converts the graymap back into a bitmap using a simple +threshold. + +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{int} \\{threshold}${}\K\T{128}{}$;\par +\fi + +\M{39} +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\8\#\&{ifdef} \.{\_\_GNUC\_\_}\6 +\&{\_\_inline\_\_}\6 +\8\#\&{endif}\6 +\&{void} \\{write\_row}(\&{unsigned} \&{char} ${}{*}){}$;\par +\fi + +\M{40} +\Y\B\8\#\&{ifdef} \.{\_\_GNUC\_\_}\6 +\&{\_\_inline\_\_}\6 +\8\#\&{endif}\6 +\&{void} \\{write\_row}(\\{pixelrow})\1\1\6 +\&{unsigned} \&{char} ${}{*}\\{pixelrow};\2\2{}$\6 +${}\{{}$\1\6 +\&{register} \&{int} \\{col};\6 +\&{register} \&{unsigned} \&{char} ${}{*}\\{xP};{}$\7 +\&{for} ${}(\\{col}\K\T{0},\39\\{xP}\K\\{pixelrow};{}$ ${}\\{col}<\\{pk\_output% +\_size\_x};{}$ ${}\PP\\{col},\39\PP\\{xP}){}$\1\5 +${}{*}(\\{out\_char\_p}\PP)\K({*}\\{xP}\G\\{threshold})\?\T{1}:\T{0}{}$;\C{ +increase output bitmap pointer }\2\6 +\4${}\}{}$\2\par +\fi + +\M{41} +Now comes the most interesting routine. The pixel array will be compressed +in sequences of black and white pixels. + +\PB{\.{SKIP0}}, \PB{\.{SKIP1}}, and \PB{\.{SKIP2}} indicate how many blank +lines will be skipped. +\PB{\.{PAINT\_}(\|x)} means that the next x~pixels will have the same color, +then the +color changes. \PB{\.{NEW\_ROW\_}(\|x)} is the first black pixel in the next +row. + +An example: the pixel sequence 111100011001 [new row] 000111011110 will be +output as 4 3 2 2 1 77 3 1 4 1. + +Commands with an ending~`n' in its name indicate that the next n~bytes +should be read as the counter. Example: \PB{\.{SKIP1}}~26 means `skip the next +26~rows'. + +For further details please refer to ``\mf---the program''. + +\Y\B\4\D$\.{PAINT\_}(\|x)$ \5 +(\|x)\C{ $0 \le x \le 63$ }\par +\B\4\D$\.{PAINT1}$ \5 +\T{64}\par +\B\4\D$\.{PAINT2}$ \5 +\T{65}\par +\B\4\D$\.{PAINT3}$ \5 +\T{66}\C{ not used }\Y\par +\B\4\D$\.{SKIP0}$ \5 +\T{70}\par +\B\4\D$\.{SKIP1}$ \5 +\T{71}\par +\B\4\D$\.{SKIP2}$ \5 +\T{72}\par +\B\4\D$\.{SKIP3}$ \5 +\T{73}\C{ not used }\Y\par +\B\4\D$\.{NEW\_ROW\_}(\|x)$ \5 +$((\|x)+\T{74}{}$)\C{ $0 \le x \le 164$ }\Y\par +\B\4\D$\.{NOOP}$ \5 +\T{244}\C{ not used }\par +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_coding}(\&{void});\par +\fi + +\M{42} +The \PB{\&{goto} \\{start}} instruction causes some compilers to complain about +``Unreachable code $\ldots$'' or something similar. + +\Y\B\&{void} \\{write\_coding}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{register} \&{int} \\{count}${},{}$ \\{skip};\6 +\&{register} \&{unsigned} \&{char} \\{paint};\6 +\&{register} \&{int} \|x${},{}$ \|y;\6 +\&{register} \&{unsigned} \&{char} ${}{*}\\{cp};{}$\7 +${}\|x\K\T{0};{}$\6 +${}\|y\K\T{0};{}$\6 +${}\\{cp}\K\\{out\_char}+\|y*\\{pk\_output\_size\_x}+\|x;{}$\6 +${}\\{count}\K\\{skip}\K\T{0};{}$\6 +${}\\{paint}\K\.{WHITE};{}$\6 +\&{goto} \\{start};\7 +\&{while} ${}(\|y<\\{pk\_output\_size\_y}){}$\5 +${}\{{}$\1\6 +\X43:Search blank lines\X\6 +\4\\{start}:\5 +\X44:Process rest of line\X\6 +${}\|y\PP;{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\Y\par +\fi + +\M{43} +\Y\B\4\X43:Search blank lines\X${}\E{}$\6 +$\\{count}\K\T{0};{}$\6 +${}\|x\K\T{0};{}$\6 +${}\\{cp}\K\\{out\_char}+\|y*\\{pk\_output\_size\_x}+\|x{}$;\7 +\&{while} ${}(\|x<\\{pk\_output\_size\_x}){}$\5 +${}\{{}$\1\6 +\&{if} ${}({*}\\{cp}\E\\{paint}){}$\1\5 +${}\\{count}\PP;{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} ${}(\\{skip}\E\T{0}){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\\{count}\Z\T{164}){}$\1\5 +${}\\{fputc}(\.{NEW\_ROW\_}(\\{count}),\39\\{out});{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{SKIP0},\39\\{out}){}$;\7 +\&{if} ${}(\\{count}<\T{256}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT1},\39\\{out});{}$\6 +${}\\{fputc}(\\{count},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT2},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\GG\T{8},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\AND\T{\^FF},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} ${}(\\{skip}\E\T{1}){}$\1\5 +${}\\{fputc}(\.{SKIP0},\39\\{out});{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} ${}(\\{skip}<\T{256}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{SKIP1},\39\\{out});{}$\6 +${}\\{fputc}(\\{skip},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{SKIP2},\39\\{out});{}$\6 +${}\\{fputc}(\\{skip}\GG\T{8},\39\\{out});{}$\6 +${}\\{fputc}(\\{skip}\AND\T{\^FF},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +${}\\{skip}\K\T{0};{}$\6 +\&{if} ${}(\\{count}<\T{64}){}$\1\5 +${}\\{fputc}(\.{PAINT\_}(\\{count}),\39\\{out});{}$\2\6 +\&{else} \&{if} ${}(\\{count}<\T{256}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT1},\39\\{out});{}$\6 +${}\\{fputc}(\\{count},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT2},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\GG\T{8},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\AND\T{\^FF},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +${}\\{count}\K\T{0};{}$\6 +${}\\{paint}\K\.{BLACK};{}$\6 +\&{break};\6 +\4${}\}{}$\2\6 +${}\|x\PP;{}$\6 +${}\\{cp}\PP;{}$\6 +\4${}\}{}$\2\6 +\&{if} ${}(\|x\G\\{pk\_output\_size\_x}){}$\5 +${}\{{}$\1\6 +${}\\{skip}\PP;{}$\6 +${}\|y\PP;{}$\6 +\&{continue};\6 +\4${}\}{}$\2\par +\U42.\fi + +\M{44} +\Y\B\4\X44:Process rest of line\X${}\E{}$\6 +\&{while} ${}(\|x<\\{pk\_output\_size\_x}){}$\5 +${}\{{}$\1\6 +\&{if} ${}({*}\\{cp}\E\\{paint}){}$\1\5 +${}\\{count}\PP;{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{if} ${}(\\{count}<\T{64}){}$\1\5 +${}\\{fputc}(\.{PAINT\_}(\\{count}),\39\\{out});{}$\2\6 +\&{else} \&{if} ${}(\\{count}<\T{256}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT1},\39\\{out});{}$\6 +${}\\{fputc}(\\{count},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT2},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\GG\T{8},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\AND\T{\^FF},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +${}\\{count}\K\T{1};{}$\6 +${}\\{paint}\K\.{BLACK}-\\{paint};{}$\6 +\4${}\}{}$\2\6 +${}\|x\PP;{}$\6 +${}\\{cp}\PP;{}$\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{paint}\E\.{BLACK}){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\\{count}<\T{64}){}$\1\5 +${}\\{fputc}(\.{PAINT\_}(\\{count}),\39\\{out});{}$\2\6 +\&{else} \&{if} ${}(\\{count}<\T{256}){}$\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT1},\39\\{out});{}$\6 +${}\\{fputc}(\\{count},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fputc}(\.{PAINT2},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\GG\T{8},\39\\{out});{}$\6 +${}\\{fputc}(\\{count}\AND\T{\^FF},\39\\{out});{}$\6 +\4${}\}{}$\2\6 +${}\\{paint}\K\.{WHITE};{}$\6 +\4${}\}{}$\2\par +\U42.\fi + +\N{1}{45}The font metrics file. +This routine creates one \.{PL} file with the font properties. None of the +\TeX\ font dimensions are needed because you never will use CJK fonts +directly, and intercharacter stretching is handled by the \\{CJK} macro +\.{\\CJKglue}. (Other packages may define similar commands.) + +The name of the \.{PL} file will contain the running two digits in +\mf-like mode only. + +It makes sense \\{not} to compute the check sum automatically for two +reasons. Firstly, since \TeX's checksum algorithm is based on the character +width, the number of valid characters, and the designsize, there is a much +higher chance that two subfonts from different HBF fonts have the same check +sum than it is for ordinary fonts, because all characters have the same +width, usually 256~characters in a subfont, and very often the same design +size. Secondly, and this is more important, we create just one +\.{TFM} file for all subfonts regardless of the real number of characters +in a particular subfont. + +To have an identification string in the \.{TFM} file, we split it into +single bytes and use the \.{HEADER} command repeatedly. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_pl}(\&{void});\par +\fi + +\M{46} +\Y\B\&{void} \\{write\_pl}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{int} \|i${},{}$ \\{pos};\6 +\&{char} ${}\\{output\_file}[\.{FILE\_NAME\_LENGTH}+\T{1}];{}$\6 +\&{long} \|t${},{}$ \\{sc};\6 +\&{char} ${}{*}\|s;{}$\6 +\&{char} \\{tfm\_header}[\,]${}\K\.{"Created\ by\ hbf2gf"};{}$\7 +${}\\{file\_number}\MM{}$;\C{ for \mf-like mode }\7 +\&{if} (\\{mf\_like})\5 +${}\{{}$\1\6 +\&{if} (\\{unicode})\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s\%02x.pl"},\39\\{output\_name},\39% +\\{file\_number});{}$\2\6 +\&{else}\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s\%02i.pl"},\39\\{output\_name},\39% +\\{file\_number});{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\1\5 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s.pl"},\39\\{output\_name}){}$;\2\7 +\&{if} ${}(\R(\\{out}\K\\{fopen}(\\{output\_file},\39\.{WRITE\_TXT}))){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ open\ `\%s'\\}\)\.{n"},\39\\{output% +\_file});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"\\nWriting\ `\%s'\\n"},\39\\{output\_file}){}$;\2\7 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n(FAMILY\ \%s\%d)"}\6 +\.{"\\n(CODINGSCHEME\ CJK}\)\.{-\%s)"}${},\39\\{output\_name},\39\\{file% +\_number},\39\\{font\_encoding}){}$;\7 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n(DESIGNSIZE\ R\ \%.6}\)\.{f)"}\6 +\.{"\\n(COMMENT\ DESIGNSI}\)\.{ZE\ IS\ IN\ POINTS)"}\6 +\.{"\\n(COMMENT\ OTHER\ SI}\)\.{ZES\ ARE\ MULTIPLES\ OF}\)\.{\ DESIGNSIZE)"}\6 +\.{"\\n(CHECKSUM\ O\ \%lo)"}\6 +\.{"\\n(FONTDIMEN"}\6 +\.{"\\n\ \ \ (SLANT\ R\ \%.6f)}\)\.{"}\6 +\.{"\\n\ \ \ (SPACE\ R\ 0.0)"}\6 +\.{"\\n\ \ \ (STRETCH\ R\ 0.0}\)\.{)"}\6 +\.{"\\n\ \ \ (SHRINK\ R\ 0.0)}\)\.{"}\6 +\.{"\\n\ \ \ (XHEIGHT\ R\ 1.0}\)\.{)"}\6 +\.{"\\n\ \ \ (QUAD\ R\ 1.0)"}\6 +\.{"\\n\ \ \ (EXTRASPACE\ R\ }\)\.{0.0)"}\6 +\.{"\\n\ \ \ )"}${},\39\\{design\_size},\39\\{checksum},\39\\{slant}){}$;\7 +${}\|s\K\\{tfm\_header};{}$\6 +${}\|i\K\\{strlen}(\|s);{}$\6 +${}\|t\K{}$((\&{long}) \|i)${}\LL\T{24};{}$\6 +${}\\{sc}\K\T{16};{}$\6 +${}\\{pos}\K\T{18}{}$;\7 +${}\\{fprintf}(\\{out},\39\.{"\\n"});{}$\6 +\&{while} ${}(\|i>\T{0}){}$\5 +${}\{{}$\1\6 +${}\|t\MRL{{\OR}{\K}}((\&{long})({*}{}$(\&{unsigned} \&{char} ${}{*}){}$ \|s${}% +\PP))\LL\\{sc};{}$\6 +${}\\{sc}\MRL{-{\K}}\T{8};{}$\6 +\&{if} ${}(\\{sc}<\T{0}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},\39\.{"\\n(HEADER\ D\ \%d\ O\ \%l}\)\.{o)"},\39\\{pos},% +\39\|t);{}$\6 +${}\|t\K\T{0};{}$\6 +${}\\{sc}\K\T{24};{}$\6 +${}\\{pos}\PP;{}$\6 +\4${}\}{}$\2\6 +${}\|i\MM;{}$\6 +\4${}\}{}$\2\6 +\&{if} (\|t)\1\5 +${}\\{fprintf}(\\{out},\39\.{"\\n(HEADER\ D\ \%d\ O\ \%l}\)\.{o)"},\39\\{pos},% +\39\|t);{}$\2\6 +${}\\{fprintf}(\\{out},\39\.{"\\n"}){}$;\7 +\&{for} ${}(\|i\K\T{0};{}$ ${}\|i<\T{256};{}$ ${}\|i\PP){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n(CHARACTER\ O\ \%o"}\6 +\.{"\\n\ \ \ (CHARWD\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (CHARHT\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (CHARDP\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (CHARIC\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ )"}${},{}$\6 +\|i${},\39\\{tfm\_output\_size\_x}+\T{2}*\\{tfm\_offset\_x},\39\\{tfm\_output% +\_size\_y}+\\{tfm\_offset\_y},\39{-}\\{tfm\_offset\_y},\39\\{slant}*(\\{tfm% +\_output\_size\_y}+\\{tfm\_offset\_y}));{}$\6 +\4${}\}{}$\2\7 +\\{fclose}(\\{out});\6 +\4${}\}{}$\2\par +\fi + +\N{1}{47}The extended virtual font file for \Om. +The following is very similar to \PB{\\{write\_pl}(\,)}; we simply map the +glyphs +of the subfonts back to the original encoding positions. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_ovp}(\&{void});\par +\fi + +\M{48} +\Y\B\&{void} \\{write\_ovp}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{int} \|c${},{}$ \|i${},{}$ \\{nmb\_subfonts}${},{}$ \\{remainder}${},{}$ % +\\{count}${},{}$ \\{pos};\6 +\&{char} ${}\\{output\_file}[\.{FILE\_NAME\_LENGTH}+\T{1}];{}$\6 +\&{long} \|t${},{}$ \\{sc};\6 +\&{char} ${}{*}\|s;{}$\6 +\&{char} \\{ofm\_header}[\,]${}\K\.{"Created\ by\ hbf2gf"};{}$\7 +${}\\{nmb\_subfonts}\K((\\{max\_char}-(\\{min\_char}\AND\T{\^FF00}))/\T{256}*% +\\{nmb\_2\_bytes})/\T{256}+\T{1};{}$\6 +${}\\{remainder}\K((\\{max\_char}-(\\{min\_char}\AND\T{\^FF00}))/\T{256}*\\{nmb% +\_2\_bytes})\MOD\T{256}{}$;\C{ correction for the last incomplete second byte +range }\6 +\&{for} ${}(\\{count}\K\T{0};{}$ ${}\\{count}<(\\{max\_char}\AND\T{\^FF});{}$ +${}\\{count}\PP){}$\1\6 +\&{if} (\\{b2\_codes}[\\{count}])\1\5 +${}\\{remainder}\PP;{}$\2\2\6 +\&{if} ${}(\\{remainder}\G\T{256}){}$\1\5 +${}\\{nmb\_subfonts}\PP{}$;\2\7 +${}\\{sprintf}(\\{output\_file},\39\.{"\%s.ovp"},\39\\{output\_name}){}$;\7 +\&{if} ${}(\R(\\{out}\K\\{fopen}(\\{output\_file},\39\.{WRITE\_TXT}))){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ open\ `\%s'\\}\)\.{n"},\39\\{output% +\_file});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"\\nWriting\ `\%s'\\n"},\39\\{output\_file}){}$;\2\7 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n(VTITLE\ Omega\ vir}\)\.{tual\ font\ created\ by}\)\.{\ hbf2gf)"}\6 +\.{"\\n(DESIGNSIZE\ R\ \%.6}\)\.{f)"}\6 +\.{"\\n(COMMENT\ DESIGNSI}\)\.{ZE\ IS\ IN\ POINTS)"}\6 +\.{"\\n(COMMENT\ OTHER\ SI}\)\.{ZES\ ARE\ MULTIPLES\ OF}\)\.{\ DESIGNSIZE)"}\6 +\.{"\\n(CHECKSUM\ O\ \%lo)"}\6 +\.{"\\n(FONTDIMEN"}\6 +\.{"\\n\ \ \ (SLANT\ R\ \%.6f)}\)\.{"}\6 +\.{"\\n\ \ \ (SPACE\ R\ 0.0)"}\6 +\.{"\\n\ \ \ (STRETCH\ R\ 0.0}\)\.{)"}\6 +\.{"\\n\ \ \ (SHRINK\ R\ 0.0)}\)\.{"}\6 +\.{"\\n\ \ \ (XHEIGHT\ R\ 1.0}\)\.{)"}\6 +\.{"\\n\ \ \ (QUAD\ R\ 1.0)"}\6 +\.{"\\n\ \ \ (EXTRASPACE\ R\ }\)\.{0.0)"}\6 +\.{"\\n\ \ \ )"}${},\39\\{design\_size},\39\\{checksum},\39\\{slant}){}$;\7 +${}\|s\K\\{ofm\_header};{}$\6 +${}\|i\K\\{strlen}(\|s);{}$\6 +${}\|t\K{}$((\&{long}) \|i)${}\LL\T{24};{}$\6 +${}\\{sc}\K\T{16};{}$\6 +${}\\{pos}\K\T{18}{}$;\7 +${}\\{fprintf}(\\{out},\39\.{"\\n"});{}$\6 +\&{while} ${}(\|i>\T{0}){}$\5 +${}\{{}$\1\6 +${}\|t\MRL{{\OR}{\K}}((\&{long})({*}{}$(\&{unsigned} \&{char} ${}{*}){}$ \|s${}% +\PP))\LL\\{sc};{}$\6 +${}\\{sc}\MRL{-{\K}}\T{8};{}$\6 +\&{if} ${}(\\{sc}<\T{0}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},\39\.{"\\n(HEADER\ D\ \%d\ O\ \%l}\)\.{o)"},\39\\{pos},% +\39\|t);{}$\6 +${}\|t\K\T{0};{}$\6 +${}\\{sc}\K\T{24};{}$\6 +${}\\{pos}\PP;{}$\6 +\4${}\}{}$\2\6 +${}\|i\MM;{}$\6 +\4${}\}{}$\2\6 +\&{if} (\|t)\1\5 +${}\\{fprintf}(\\{out},\39\.{"\\n(HEADER\ D\ \%d\ O\ \%l}\)\.{o)"},\39\\{pos},% +\39\|t);{}$\2\6 +${}\\{fprintf}(\\{out},\39\.{"\\n"}){}$;\7 +\&{for} ${}(\|i\K\T{0};{}$ ${}\|i<\\{nmb\_subfonts};{}$ ${}\|i\PP){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n(MAPFONT\ D\ \%i"}\6 +\.{"\\n\ \ \ (FONTNAME\ \%s\%0}\)\.{2i)"}\6 +\.{"\\n\ \ \ (FONTCHECKSUM\ }\)\.{O\ \%lo)"}\6 +\.{"\\n\ \ \ (FONTAT\ R\ 1.0)}\)\.{"}\6 +\.{"\\n\ \ \ (FONTDSIZE\ R\ \%}\)\.{.6f)"}\6 +\.{"\\n\ \ \ )"}${},\39\|i,\39\\{output\_name},\39\|i+\T{1},\39\\{checksum},\39% +\\{design\_size});{}$\6 +\4${}\}{}$\2\7 +\&{for} ${}(\|c\K\\{min\_char},\39\|i\K\T{0},\39\\{count}\K\T{0};{}$ ${}\|c\Z% +\\{max\_char};{}$ ${}\|c\PP){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\\{b2\_codes}[\|c\AND\T{\^FF}]\E\.{VALID\_SUBCODE}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n(CHARACTER\ O\ \%o"}\6 +\.{"\\n\ \ \ (CHARWD\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (CHARHT\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (CHARDP\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (CHARIC\ R\ \%.6f}\)\.{)"}\6 +\.{"\\n\ \ \ (MAP"}\6 +\.{"\\n\ \ \ \ \ \ (SELECTFONT}\)\.{\ D\ \%i)"}\6 +\.{"\\n\ \ \ \ \ \ (SETCHAR\ O\ }\)\.{\%o)"}\6 +\.{"\\n\ \ \ \ \ \ )"}\6 +\.{"\\n\ \ \ )"}${},{}$\6 +\|c${},\39\\{tfm\_output\_size\_x}+\T{2}*\\{tfm\_offset\_x},\39\\{tfm\_output% +\_size\_y}+\\{tfm\_offset\_y},\39{-}\\{tfm\_offset\_y},\39\\{slant}*(\\{tfm% +\_output\_size\_y}+\\{tfm\_offset\_y}),\39\|i,\39\\{count}){}$;\7 +${}\\{count}\PP;{}$\6 +\&{if} ${}(\\{count}\E\T{256}){}$\5 +${}\{{}$\1\6 +${}\\{count}\K\T{0};{}$\6 +${}\|i\PP;{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\1\5 +\&{continue};\2\6 +\4${}\}{}$\2\7 +\\{fclose}(\\{out});\6 +\4${}\}{}$\2\par +\fi + +\N{1}{49}The job file. +This routine is the most system specific one. If your operating system needs +a different outline, make appropriate changes here. + +You have to call this batch file after \.{hbf2gf} has finished (if not in +\mf-like mode). It will transform the \.{GF} files into \.{PK} files and +delete the now unnecessary \.{GF} files, then transform the \.{PL} file into +a \.{TFM} file and copy it \PB{\\{nmb\_files}} times. The name of the job file +is +\PB{\\{output\_name}}. + +\Y\B\4\D$\.{EXTENSION\_LENGTH}$ \5 +\T{8}\C{ the maximal length of a file extension }\Y\par +\B\4\D$\.{GFTOPK\_NAME}$ \5 +\.{"gftopk"}\par +\B\4\D$\.{PLTOTF\_NAME}$ \5 +\.{"pltotf"}\par +\B\4\D$\.{OVP2OVF\_NAME}$ \5 +\.{"ovp2ovf"}\par +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{char} ${}\\{job\_extension}[\.{EXTENSION\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}\\{rm\_command}[\.{STRING\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}\\{cp\_command}[\.{STRING\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}\\{pk\_directory}[\.{STRING\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}\\{tfm\_directory}[\.{STRING\_LENGTH}+\T{1}]{}$;\7 +\&{int} \\{ofm\_file}${}\K\.{FALSE}{}$;\par +\fi + +\M{50} +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{write\_job}(\&{void});\par +\fi + +\M{51} +\Y\B\&{void} \\{write\_job}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{FILE} ${}{*}\\{out};{}$\6 +\&{int} \|i${},{}$ \|j;\6 +\&{char} ${}\\{buffer}[\.{FILE\_NAME\_LENGTH}+\T{1}];{}$\7 +${}\\{strcpy}(\\{buffer},\39\\{output\_name});{}$\6 +${}\\{strcat}(\\{buffer},\39\\{job\_extension});{}$\6 +\&{if} ${}(\R(\\{out}\K\\{fopen}(\\{buffer},\39\.{WRITE\_TXT}))){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ open\ `\%s'\\}\)\.{n"},\39% +\\{buffer});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"\\nWriting\ `\%s'\\n"},\39\\{buffer}){}$;\2\7 +\&{if} (\\{pk\_files})\5 +${}\{{}$\1\6 +\&{if} (\\{unicode})\5 +${}\{{}$\1\6 +\&{for} ${}(\|i\K(\\{min\_char}\GG\T{8}),\39\|j\K\T{0};{}$ ${}\|j<\\{nmb% +\_files};{}$ ${}\|i\PP,\39\|j\PP){}$\1\5 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\%s\ \%s\%02x.gf\ \%s\%s\%0}\)\.{2x.\%.0ipk\\n"}\6 +\.{"\%s\ \%s\%02x.gf\\n"}${},{}$\6 +\.{GFTOPK\_NAME}${},\39\\{output\_name},\39\|i,{}$\6 +\\{pk\_directory}${},\39\\{output\_name},\39\|i,\39\\{long\_extension}\?(% +\&{int})(\\{dpi\_x}*\\{magstep\_x}+\T{0.5}):\T{0},{}$\6 +\\{rm\_command}${},\39\\{output\_name},\39\|i);{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{for} ${}(\|i\K\T{1};{}$ ${}\|i\Z\\{nmb\_files};{}$ ${}\|i\PP){}$\1\5 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\%s\ \%s\%02i.gf\ \%s\%s\%0}\)\.{2i.\%.0ipk\\n"}\6 +\.{"\%s\ \%s\%02i.gf\\n"}${},{}$\6 +\.{GFTOPK\_NAME}${},\39\\{output\_name},\39\|i,{}$\6 +\\{pk\_directory}${},\39\\{output\_name},\39\|i,\39\\{long\_extension}\?(% +\&{int})(\\{dpi\_x}*\\{magstep\_x}+\T{0.5}):\T{0},{}$\6 +\\{rm\_command}${},\39\\{output\_name},\39\|i);{}$\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\7 +\&{if} (\\{tfm\_files})\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n"}\6 +\.{"\%s\ \%s.pl\ \%s.tfm\\n"}\6 +\.{"\%s\ \%s.pl\\n"}\6 +\.{"\\n"}${},{}$\6 +\.{PLTOTF\_NAME}${},\39\\{output\_name},\39\\{output\_name},{}$\6 +\\{rm\_command}${},\39\\{output\_name}){}$;\7 +\&{if} (\\{unicode})\5 +${}\{{}$\1\6 +\&{for} ${}(\|i\K(\\{min\_char}\GG\T{8}),\39\|j\K\T{0};{}$ ${}\|j<\\{nmb% +\_files};{}$ ${}\|i\PP,\39\|j\PP){}$\1\5 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\%s\ \%s.tfm\ \%s\%s\%02x.}\)\.{tfm\\n"}${},{}$\6 +\\{cp\_command}${},\39\\{output\_name},\39\\{tfm\_directory},\39\\{output% +\_name},\39\|i);{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{for} ${}(\|i\K\T{1};{}$ ${}\|i\Z\\{nmb\_files};{}$ ${}\|i\PP){}$\1\5 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\%s\ \%s.tfm\ \%s\%s\%02i.}\)\.{tfm\\n"}${},{}$\6 +\\{cp\_command}${},\39\\{output\_name},\39\\{tfm\_directory},\39\\{output% +\_name},\39\|i);{}$\2\6 +\4${}\}{}$\2\7 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n"}\6 +\.{"\%s\ \%s.tfm"}${},{}$\6 +\\{rm\_command}${},\39\\{output\_name});{}$\6 +\4${}\}{}$\2\7 +\&{if} (\\{ofm\_file})\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{out},{}$\6 +\.{"\\n"}\6 +\.{"\%s\ \%s.ovp\ \%s.ovf\ \%s}\)\.{.ofm\\n"}\6 +\.{"\%s\ \%s.ovp\\n"}\6 +\.{"\\n"}${},{}$\6 +\.{OVP2OVF\_NAME}${},\39\\{output\_name},\39\\{output\_name},\39\\{output% +\_name},{}$\6 +\\{rm\_command}${},\39\\{output\_name});{}$\6 +\4${}\}{}$\2\7 +\\{fclose}(\\{out});\6 +\4${}\}{}$\2\par +\fi + +\N{1}{52}The configuration file. +Here is a list with all necessary keywords (and parameters): +\medskip +\halign{\quad\.{#}\hfil&\quad#\hfil\cr +hbf\_header & the HBF header file name of the input font(s). \cr +output\_name & the name stem of the output files. \cr +& Should be equal to the name of the configuration file +in most cases.\cr +& A running two digit decimal number starting with +\.{01} will be appended. \cr +& (For Unicode fonts see the keyword \.{unicode} +below.) \cr +} +\bigskip +And now all optional keywords: +\medskip +\halign{\quad\.{#}\hfil&\quad#\hfil\cr +x\_offset & increases the character width. \cr +& Will be applied on both sides; \cr +& default is the value given in the HBF header +(\.{HBF\_BITMAP\_BOUNDING\_BOX}) \cr +& scaled to \\{design\/}size (in pixels). \cr +y\_offset & shifts all characters up or down; \cr +& default is the value given in the HBF header +(\.{HBF\_BITMAP\_BOUNDING\_BOX}) \cr +& scaled to \\{design\/}size (in pixels). \cr +design\_size & the design size (in points) of the font. \cr +& \.{x\_offset} and \.{y\_offset} refer to this +size. \cr +& Default is \PB{\T{10.0}} \cr +target\_size & This command is obsolete now and will be +ignored.\cr +& \cr +slant & the slant of the font (given as $\Delta x / +\Delta y$). \cr +& Only values in the range \PB{$\T{0}\Z\\{slant}\Z\T{1}$} +are allowed. \cr +& Default is \PB{\T{0.0}} \cr +rotation & if set to `yes'. the glyphs are rotated +90~degrees counter-clockwise. \cr +& The default offsets as given in the HBF header +will be ignored (and set to~\PB{\T{0}}). \cr +& Default is `no'. \cr +& \cr +mag\_x & \cr +mag\_y & scaling values of the characters to reach +design size. \cr +& If only one magnification is given, x and y +values are assumed to be equal. \cr +& Default is \.{mag\_x} $=$ \.{mag\_y} $=$ \PB{\T{1.0}} +\cr +threshold & A value between \PB{\T{1}} and \PB{\T{254}} defining a +threshold for converting the internal \cr +& graymap into the output bitmap; lower values +cut more pixels. \cr +& Default value is \PB{\T{128}}. \cr +& \cr +comment & a comment describing the font; \cr +& default is none. \cr +& \cr +nmb\_fonts & the number of the fonts. \cr +& Default value is~\PB{${-}\T{1}$} for creating all +fonts. \cr +unicode & if `yes', a two digit hexadecimal number will +be used as a running number, \cr +& starting with the value of the first byte of +the first code range. \cr +& Default is `no'. \cr +min\_char & the minimum of the encoding range. \cr +& Specify this value if it is not identical to +the lowest code value \cr +& in the HBF file (to which it defaults). \cr +& \cr +dpi\_x & \cr +dpi\_y & the horizontal and vertical resolution (in +dpi) of the printer. \cr +& If only one resolution is given, x and y +values are assumed to be equal. \cr +& Default is \PB{\T{300}}. \cr +checksum & a checksum to identify the \.{GF} files +with the appropriate \.{TFM} files. \cr +& The default of this 32~bit unsigned integer +is \PB{\T{0}}. \cr +coding & a comment describing the coding scheme; \cr +& default is none. \cr +& \cr +pk\_directory & the destination directory of the +\.{PK} files; \cr +& default: none. \cr +& Attention! The batch file will not check +whether this directory exists. \cr +tfm\_directory & the destination directory of the +\.{TFM} files; \cr +& default: none. \cr +& Attention! The batch file will not check +whether this directory exists. \cr +pk\_files & whether to create \.{PK} files or not; \cr +& default is `yes'. \cr +tfm\_files & whether to create \.{TFM} files or not; \cr +& default is `yes'. \cr +ofm\_file & whether to create an \.{OFM} and an +\.{OVF} file or not; \cr +& default is `no'. \cr +long\_extension & if `yes', \.{PK} files will include the +resolution in the extension \cr +& (e.g. \.{gsso1201.300pk}). \cr +& This affects the batch file only (default is +`yes'). \cr +rm\_command & this shell command removes files; \cr +& default: `rm'. \cr +cp\_command & this shell command copies files; \cr +& default: `cp'. \cr +job\_extension & the extension of the batch file which calls +\.{GFtoPK} and \.{PLtoTF} \cr +& to convert the \.{GF} and the +\.{PL} files into \.{PK} and +\.{TFM} files; \cr +& default is none. \cr +} +\bigskip + +The searching algorithm (for the keywords) of \.{hbf2gf} is case +insensitive; it makes no difference whether you write for example \.{comment} +or \.{CommenT}. The keywords must start a line (be in the first column), and +the corresponding parameters must be on the same line with the keyword and +separated by at least one space or tabulator stop. Lines starting not with a +keyword are ignored. + +Key values \\{are} case sensitive (except \.{yes} and \.{no}). + +The default system dependent values are for \UNIX/-like operating systems; +if you use for example DOS, you must write +\medskip +\halign{\quad\.{#}\hfil&\quad\.{#}\hfil\cr +long\_extension & no \cr +rm\_command & del \cr +cp\_command & copy \cr +job\_extension & .bat \cr +} +\medskip + +Both the values \PB{\\{pk\_output\_size\_x}} and \PB{\\{pk\_output\_size\_y}} +must not exceed +\PB{\.{MAX\_CHAR\_SIZE}}; \.{x\_offset} and \.{y\_offset} are related to the +design size (and not to the input size). + +In \mf-like mode, one \.{GF} file and one \.{PL} file will be computed +(depending on the command line options \.{-g} and \.{-p}), taking +\PB{\\{x\_resolution}} and \PB{\\{y\_scale}} from the command line. \.{nmb% +\_fonts} will +always be set to~\PB{\T{1}}; no job file will be created. + + +\fi + +\M{53} +\Y\B\4\D$\.{PRINTER\_MIN\_RES\_X}$ \5 +\T{50}\par +\B\4\D$\.{PRINTER\_MIN\_RES\_Y}$ \5 +\T{50}\par +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{char} ${}\\{Buffer}[\.{STRING\_LENGTH}+\T{1}]{}$;\par +\fi + +\M{54} +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{read\_config}(\&{void});\par +\fi + +\M{55} +If \PB{\\{config\_file}} isn't found in \mf-like mode we assume that the font +isn't a HBF font at all. + +\Y\B\&{void} \\{read\_config}(\&{void})\1\1\2\2\6 +${}\{{}$\1\6 +\&{HBF\_BBOX} ${}{*}\\{boxp};{}$\6 +\&{char} ${}{*}\\{real\_config\_file};{}$\7 +\X56:Handle extension\X\7 +${}\\{real\_config\_file}\K\\{TeX\_search\_cfg\_file}(\\{config\_file});{}$\6 +\&{if} ${}(\R\\{real\_config\_file}){}$\5 +${}\{{}$\1\6 +\&{if} (\\{mf\_like})\5 +${}\{{}$\1\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"Couldn't\ find\ `\%s'\\}\)\.{n"},\39\\{config\_file});{}$\2\6 +\\{exit}(\T{2});\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ find\ `\%s'\\}\)\.{n"},\39\\{config% +\_file});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\7 +\&{if} ${}(\R(\\{config}\K\\{fopen}(\\{real\_config\_file},\39\.{READ% +\_TXT}))){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\R\\{testing}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ open\ `\%s'\\}\)\.{n"},\39\\{config% +\_file});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{else}\C{ We reach this point only if no searching library is used }\6 +${}\{{}$\1\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ find\ or\ op}\)\.{en\ `\%s'\\n"},\39% +\\{config\_file});{}$\2\6 +\\{exit}(\T{2});\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\7 +\&{if} (\\{testing})\5 +${}\{{}$\1\6 +\&{if} ${}(\R\\{quiet}){}$\1\5 +${}\\{printf}(\.{"\%s\\n"},\39\\{real\_config\_file});{}$\2\6 +\\{exit}(\T{0});\6 +\4${}\}{}$\2\6 +\X57:Necessary parameters\X\6 +\X59:Optional parameters\X\7 +\X61:Get code range\X\6 +\X63:Get sub code range\X\7 +\\{fclose}(\\{config});\6 +\4${}\}{}$\2\par +\fi + +\M{56} +Here we check whether we have to add an extension. + +\Y\B\4\X56:Handle extension\X${}\E{}$\6 +${}\{{}$\1\6 +\&{int} \|i${},{}$ \\{lastext}${}\K{-}\T{1};{}$\7 +\&{for} ${}(\|i\K\T{0};{}$ \\{config\_file}[\|i]; ${}\|i\PP){}$\1\6 +\&{if} ${}(\\{config\_file}[\|i]\E\.{'.'}){}$\1\5 +${}\\{lastext}\K\|i;{}$\2\6 +\&{else} \&{if} ${}(\\{config\_file}[\|i]\E\.{'/'}\V\\{config\_file}[\|i]\E% +\.{':'}\V\\{config\_file}[\|i]\E\.{'\\\\'}){}$\1\5 +${}\\{lastext}\K{-}\T{1}{}$;\2\2\7 +\&{if} ${}(\\{lastext}\E{-}\T{1}){}$\1\5 +${}\\{strcat}(\\{config\_file},\39\.{".cfg"});{}$\2\6 +\4${}\}{}$\2\par +\U55.\fi + +\M{57} +\Y\B\4\X57:Necessary parameters\X${}\E{}$\6 +${}\{{}$\1\6 +\&{char} ${}\\{hbf\_header}[\.{STRING\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}{*}\\{real\_hbf\_header};{}$\7 +\&{if} ${}(\R\\{fsearch}(\.{"hbf\_header"})){}$\1\5 +\\{config\_error}(\.{"hbf\_header"});\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{hbf\_header},\39\\{Buffer}){}$;\2\7 +${}\\{real\_hbf\_header}\K\\{TeX\_search\_hbf\_file}(\\{hbf\_header});{}$\6 +\&{if} ${}(\R\\{real\_hbf\_header}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ find\ `\%s'\\}\)\.{n"},\39\\{hbf% +\_header});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +${}\\{hbfDebug}\K\T{1}{}$;\C{ we activate error messages of the HBF API + while scanning the HBF header file }\7 +\&{if} ${}(\R(\\{hbf}\K\\{hbfOpen}(\\{real\_hbf\_header}))){}$\1\5 +\\{exit}(\T{1});\2\7 +${}\\{hbfDebug}\K\T{0}{}$;\7 +${}\\{boxp}\K\\{hbfBitmapBBox}(\\{hbf});{}$\6 +${}\\{input\_size\_x}\K\\{boxp}\MG\\{hbf\_height}{}$;\C{ will be checked later +for rotation }\6 +${}\\{input\_size\_y}\K\\{boxp}\MG\\{hbf\_width};{}$\6 +${}\\{font\_encoding}\K\\{hbfProperty}(\\{hbf},\39\.{"HBF\_CODE\_SCHEME"}){}$;\7 +\&{if} ${}(\R\\{fsearch}(\.{"output\_name"})){}$\1\5 +\\{config\_error}(\.{"output\_name"});\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{output\_name},\39\\{Buffer});{}$\2\6 +\4${}\}{}$\2\par +\U55.\fi + +\M{58} +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{int} \\{offset\_x};\6 +\&{int} \\{offset\_y};\7 +\&{HBF\_CHAR} \\{user\_min\_char};\6 +\&{int} \\{have\_min\_char}${}\K\.{FALSE}{}$;\par +\fi + +\M{59} +\Y\B\4\X59:Optional parameters\X${}\E{}$\6 +${}\{{}$\1\6 +\&{if} (\\{fsearch}(\.{"nmb\_files"}))\1\5 +${}\\{nmb\_files}\K\\{atoi}(\\{Buffer});{}$\2\6 +\&{if} (\\{fsearch}(\.{"unicode"}))\1\6 +\&{if} ${}(\\{Buffer}[\T{0}]\E\.{'y'}\V\\{Buffer}[\T{0}]\E\.{'Y'}){}$\1\5 +${}\\{unicode}\K\.{TRUE};{}$\2\2\6 +\&{if} (\\{fsearch}(\.{"min\_char"}))\5 +${}\{{}$\1\6 +${}\\{user\_min\_char}\K\\{strtoul}(\\{Buffer},\39{}$(\&{char} ${}{*}{*}){}$ +${}\NULL,\39\T{0});{}$\6 +${}\\{have\_min\_char}\K\.{TRUE};{}$\6 +\4${}\}{}$\2\7 +\&{if} ${}(\R\\{mf\_like}){}$\5 +${}\{{}$\1\6 +\&{if} (\\{fsearch}(\.{"pk\_files"}))\1\6 +\&{if} ${}(\\{Buffer}[\T{0}]\E\.{'n'}\V\\{Buffer}[\T{0}]\E\.{'N'}){}$\1\5 +${}\\{pk\_files}\K\.{FALSE};{}$\2\2\6 +\&{if} (\\{fsearch}(\.{"tfm\_files"}))\1\6 +\&{if} ${}(\\{Buffer}[\T{0}]\E\.{'n'}\V\\{Buffer}[\T{0}]\E\.{'N'}){}$\1\5 +${}\\{tfm\_files}\K\.{FALSE};{}$\2\2\6 +\&{if} (\\{fsearch}(\.{"ofm\_file"}))\1\6 +\&{if} ${}(\\{Buffer}[\T{0}]\E\.{'y'}\V\\{Buffer}[\T{0}]\E\.{'Y'}){}$\1\5 +${}\\{ofm\_file}\K\.{TRUE};{}$\2\2\6 +\&{if} (\\{fsearch}(\.{"long\_extension"}))\1\6 +\&{if} ${}(\\{Buffer}[\T{0}]\E\.{'n'}\V\\{Buffer}[\T{0}]\E\.{'N'}){}$\1\5 +${}\\{long\_extension}\K\.{FALSE};{}$\2\2\6 +\4${}\}{}$\2\7 +\&{if} (\\{fsearch}(\.{"slant"}))\1\5 +${}\\{slant}\K\\{atof}(\\{Buffer});{}$\2\6 +\&{if} ${}(\\{slant}<\T{0.0}\V\\{slant}>\T{1.0}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ slant\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} (\\{fsearch}(\.{"rotation"}))\1\6 +\&{if} ${}(\\{Buffer}[\T{0}]\E\.{'y'}\V\\{Buffer}[\T{0}]\E\.{'Y'}){}$\1\5 +${}\\{rotation}\K\.{TRUE}{}$;\2\2\7 +\&{if} (\\{fsearch}(\.{"mag\_x"}))\1\5 +${}\\{mag\_x}\K\\{atof}(\\{Buffer});{}$\2\6 +\&{if} (\\{fsearch}(\.{"mag\_y"}))\1\5 +${}\\{mag\_y}\K\\{atof}(\\{Buffer});{}$\2\6 +\&{if} ${}(\R\\{mag\_x}\W\R\\{mag\_y}){}$\5 +${}\{{}$\1\6 +${}\\{mag\_x}\K\T{1.0};{}$\6 +${}\\{mag\_y}\K\T{1.0};{}$\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{mag\_x}\W\R\\{mag\_y}){}$\1\5 +${}\\{mag\_y}\K\\{mag\_x};{}$\2\6 +\&{if} ${}(\\{mag\_y}\W\R\\{mag\_x}){}$\1\5 +${}\\{mag\_x}\K\\{mag\_y};{}$\2\6 +\&{if} ${}(\\{mag\_x}\Z\T{0.0}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ horizontal\ }\)\.{magnification% +\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{mag\_y}\Z\T{0.0}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ vertical\ ma}\)\.{gnification% +\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +\&{if} (\\{fsearch}(\.{"dpi\_x"}))\1\5 +${}\\{dpi\_x}\K\\{atoi}(\\{Buffer});{}$\2\6 +\&{if} (\\{fsearch}(\.{"dpi\_y"}))\1\5 +${}\\{dpi\_y}\K\\{atoi}(\\{Buffer});{}$\2\6 +\&{if} ${}(\R\\{dpi\_x}\W\R\\{dpi\_y}){}$\5 +${}\{{}$\1\6 +${}\\{dpi\_x}\K\T{300};{}$\6 +${}\\{dpi\_y}\K\T{300};{}$\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{dpi\_x}\W\R\\{dpi\_y}){}$\1\5 +${}\\{dpi\_y}\K\\{dpi\_x};{}$\2\6 +\&{if} ${}(\\{dpi\_y}\W\R\\{dpi\_x}){}$\1\5 +${}\\{dpi\_x}\K\\{dpi\_y};{}$\2\6 +\&{if} ${}(\\{dpi\_x}\Z\.{PRINTER\_MIN\_RES\_X}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ horizontal\ }\)\.{printer\ resolution% +\\n}\)\.{"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\\{dpi\_y}\Z\.{PRINTER\_MIN\_RES\_Y}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ vertical\ pr}\)\.{inter\ resolution% +\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +\&{if} (\\{fsearch}(\.{"design\_size"}))\1\5 +${}\\{design\_size}\K\\{atof}(\\{Buffer}){}$;\2\7 +\&{if} (\\{fsearch}(\.{"x\_offset"}))\1\5 +${}\\{offset\_x}\K\\{atoi}(\\{Buffer});{}$\2\6 +\&{else}\1\5 +${}\\{offset\_x}\K\\{rotation}\?\T{0}:(\\{boxp}\MG\\{hbf\_xDisplacement}*\\{mag% +\_x}+\T{0.5});{}$\2\6 +\&{if} (\\{fsearch}(\.{"y\_offset"}))\1\5 +${}\\{offset\_y}\K\\{atoi}(\\{Buffer});{}$\2\6 +\&{else}\1\5 +${}\\{offset\_y}\K\\{rotation}\?\T{0}:(\\{boxp}\MG\\{hbf\_yDisplacement}*\\{mag% +\_y}+\T{0.5});{}$\2\6 +\&{if} ${}(\R\\{fsearch}(\.{"comment"})){}$\1\5 +${}\\{comment}[\T{0}]\K\.{'\\0'};{}$\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{comment},\39\\{Buffer}){}$;\2\7 +\&{if} (\\{fsearch}(\.{"threshold"}))\1\5 +${}\\{threshold}\K\\{atoi}(\\{Buffer});{}$\2\6 +\&{if} ${}(\\{threshold}\Z\T{0}\V\\{threshold}\G\T{255}){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Invalid\ threshold\\n}\)\.{"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\7 +\&{if} ${}(\R\\{fsearch}(\.{"checksum"})){}$\1\5 +${}\\{checksum}\K\T{0};{}$\2\6 +\&{else}\1\5 +${}\\{checksum}\K\\{strtoul}(\\{Buffer},\39{}$(\&{char} ${}{*}{*}){}$ ${}\NULL,% +\39\T{0}){}$;\2\7 +\&{if} ${}(\R\\{fsearch}(\.{"coding"})){}$\1\5 +${}\\{coding}[\T{0}]\K\.{'\\0'};{}$\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{coding},\39\\{Buffer}){}$;\2\7 +\&{if} ${}(\R\\{fsearch}(\.{"pk\_directory"})){}$\1\5 +${}\\{pk\_directory}[\T{0}]\K\.{'\\0'};{}$\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{pk\_directory},\39\\{Buffer}){}$;\2\7 +\&{if} ${}(\R\\{fsearch}(\.{"tfm\_directory"})){}$\1\5 +${}\\{tfm\_directory}[\T{0}]\K\.{'\\0'};{}$\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{tfm\_directory},\39\\{Buffer}){}$;\2\7 +\&{if} (\\{fsearch}(\.{"rm\_command"}))\1\5 +${}\\{strcpy}(\\{rm\_command},\39\\{Buffer});{}$\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{rm\_command},\39\.{"rm"}){}$;\2\7 +\&{if} (\\{fsearch}(\.{"cp\_command"}))\1\5 +${}\\{strcpy}(\\{cp\_command},\39\\{Buffer});{}$\2\6 +\&{else}\1\5 +${}\\{strcpy}(\\{cp\_command},\39\.{"cp"}){}$;\2\7 +\&{if} ${}(\R\\{fsearch}(\.{"job\_extension"})){}$\1\5 +${}\\{job\_extension}[\T{0}]\K\.{'\\0'};{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}\\{strncpy}(\\{job\_extension},\39\\{Buffer},\39\.{EXTENSION\_LENGTH});{}$\6 +${}\\{job\_extension}[\.{EXTENSION\_LENGTH}]\K\.{'\\0'};{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\par +\U55.\fi + +\M{60} +The function \PB{\\{hbfGetCodeRange}(\,)} is an extension to the HBF API. + +Successive calls return the code ranges in ascending order; we only need the +extrema of the whole code range. + +In case \PB{\\{min\_char}} has been supplied in the configuration file, we use +that +value instead. + +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{HBF\_CHAR} \\{min\_char}${},{}$ \\{max\_char};\par +\fi + +\M{61} +\Y\B\4\X61:Get code range\X${}\E{}$\6 +${}\{{}$\1\6 +\&{const} \&{void} ${}{*}\\{cp};{}$\6 +\&{HBF\_CHAR} \\{dummy};\7 +${}\\{cp}\K\\{hbfGetCodeRange}(\\{hbf},\39\NULL,\39{\AND}\\{min\_char},\39{% +\AND}\\{max\_char});{}$\6 +\&{for} ( ; ${}\\{cp}\I\NULL;{}$ ${}\\{cp}\K\\{hbfGetCodeRange}(\\{hbf},\39% +\\{cp},\39{\AND}\\{dummy},\39{\AND}\\{max\_char})){}$\1\5 +;\2\7 +\&{if} (\\{have\_min\_char})\1\5 +${}\\{min\_char}\K\\{user\_min\_char};{}$\2\6 +\4${}\}{}$\2\par +\U55.\fi + +\M{62} +The function \PB{\\{hbfGetByte2Range}(\,)} is an extension to the HBF API. + +Successive calls return the byte~2 ranges in ascending order. We raise +\PB{\.{VALID\_SUBCODE}} in the array \PB{\\{b2\_codes}[\,]} for all characters +in subcode +ranges. + +\Y\B\4\D$\.{VALID\_SUBCODE}$ \5 +\T{1}\par +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{char} \\{b2\_codes}[\T{256}];\6 +\&{unsigned} \&{char} \\{min\_2\_byte}${},{}$ \\{max\_2\_byte};\6 +\&{int} \\{nmb\_2\_bytes}${}\K\T{0}{}$;\par +\fi + +\M{63} +\Y\B\4\X63:Get sub code range\X${}\E{}$\6 +${}\{{}$\1\6 +\&{const} \&{void} ${}{*}\\{b2r};{}$\6 +\&{unsigned} \&{char} \\{dummy};\6 +\&{int} \|i;\7 +\&{for} ${}(\|i\K\T{0};{}$ ${}\|i<\T{256};{}$ ${}\|i\PP){}$\1\5 +${}\\{b2\_codes}[\|i]\K\T{0}{}$;\2\7 +${}\\{b2r}\K\\{hbfGetByte2Range}(\\{hbf},\39\NULL,\39{\AND}\\{min\_2\_byte},% +\39{\AND}\\{max\_2\_byte});{}$\6 +${}\\{dummy}\K\\{min\_2\_byte};{}$\6 +\&{for} ( ; ${}\\{b2r}\I\NULL;{}$ ${}\\{b2r}\K\\{hbfGetByte2Range}(\\{hbf},\39% +\\{b2r},\39{\AND}\\{dummy},\39{\AND}\\{max\_2\_byte})){}$\5 +${}\{{}$\1\6 +\&{for} ${}(\|i\K\\{dummy};{}$ ${}\|i\Z\\{max\_2\_byte};{}$ ${}\|i\PP){}$\1\5 +${}\\{b2\_codes}[\|i]\K\.{VALID\_SUBCODE};{}$\2\6 +\4${}\}{}$\2\7 +\&{for} ${}(\|i\K\T{0};{}$ ${}\|i<\T{256};{}$ ${}\|i\PP{}$)\C{ compute the +number of valid \PB{\\{b2\_codes}} }\1\6 +\&{if} ${}(\\{b2\_codes}[\|i]\E\.{VALID\_SUBCODE}){}$\1\5 +${}\\{nmb\_2\_bytes}\PP;{}$\2\2\6 +\4${}\}{}$\2\par +\U55.\fi + +\M{64} +This search routine is case insignificant. Each keyword must start a line; +the function checks whether the character before the keyword is a newline +character (\PB{\.{'\\n'}}). It also checks the presence of a parameter and +fills +\PB{\\{Buffer}} if existent. \PB{\\{fsearch}(\,)} returns~1 on success. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{int} \\{fsearch}(\&{char} ${}{*}){}$;\par +\fi + +\M{65} +\Y\B\&{int} \\{fsearch}(\\{search\_string})\1\1\6 +\&{char} ${}{*}\\{search\_string};\2\2{}$\6 +${}\{{}$\1\6 +\&{char} ${}{*}\|P,{}$ \|p;\6 +\&{char} ${}\\{temp\_buffer}[\.{STRING\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}\\{env\_name}[\.{STRING\_LENGTH}+\T{1}];{}$\6 +\&{char} ${}{*}\\{env\_p};{}$\6 +\&{char} ${}{*}\\{env\_value};{}$\6 +\&{char} ${}{*}\\{Buf\_p};{}$\6 +\&{int} \\{Ch}${},{}$ \\{ch}${},{}$ \\{old\_ch}${}\K\.{'\\n'};{}$\6 +\&{int} \\{count}${}\K\.{STRING\_LENGTH};{}$\7 +\\{rewind}(\\{config});\C{ we start at offset~0 }\7 +\&{do}\5 +${}\{{}$\1\6 +${}\|P\K\\{search\_string};{}$\6 +${}\|p\K\\{tolower}({*}\|P);{}$\6 +${}\\{Ch}\K\\{fgetc}(\\{config});{}$\6 +${}\\{ch}\K\\{tolower}(\\{Ch});{}$\6 +\&{while} ${}(\R(\\{ch}\E\|p\W\\{old\_ch}\E\.{'\\n'})\W\\{Ch}\I\.{EOF}{}$)\C{ +search first character of \PB{\\{search\_string}}; + \PB{\.{'\\n'}} must be the character before }\6 +${}\{{}$\1\6 +${}\\{old\_ch}\K\\{ch};{}$\6 +${}\\{Ch}\K\\{fgetc}(\\{config});{}$\6 +${}\\{ch}\K\\{tolower}(\\{Ch});{}$\6 +\4${}\}{}$\2\7 +\&{for} ( ; ; \,)\5 +${}\{{}$\1\6 +\&{if} ${}({*}(\PP\|P)\E\.{'\\0'}){}$\1\6 +\&{if} ${}((\\{Ch}\K\\{fgetc}(\\{config}))\E\.{'\ '}\V\\{Ch}\E\.{'\\t'}{}$)\C{ +there must be a space or a tab stop after the keyword }\1\6 +\&{goto} \\{success};\2\2\6 +${}\\{Ch}\K\\{fgetc}(\\{config});{}$\6 +\&{if} ${}(\\{tolower}(\\{Ch})\I\\{tolower}({*}\|P)){}$\1\5 +\&{break};\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\5 +\&{while} ${}(\\{Ch}\I\.{EOF}){}$;\7 +\&{return} \T{0};\7 +\4\\{success}:\5 +${}\|P\K\\{temp\_buffer}{}$;\7 +\&{while} ${}((\\{Ch}\K\\{fgetc}(\\{config}))\E\.{'\ '}\V\\{Ch}\E\.{'\\t'}{}$)% +\C{ remove leading blanks and tabs }\1\6 +;\2\6 +\&{while} ${}(\\{Ch}\I\.{'\\n'}\W\MM\\{count}>\T{0}\W\\{Ch}\I\.{EOF}{}$)\C{ +fill \PB{\\{Buffer}} }\6 +${}\{{}$\1\6 +${}{*}\|P\PP\K\\{Ch};{}$\6 +${}\\{Ch}\K\\{fgetc}(\\{config});{}$\6 +\4${}\}{}$\2\6 +${}{*}\|P\K\.{'\\0'}{}$;\7 +\&{if} ${}({*}\\{temp\_buffer}){}$\1\5 +\X66:Check for environment variables\X\2\6 +\&{else}\1\5 +${}{*}\\{Buffer}\K\.{'\\0'}{}$;\2\7 +\&{return} ${}({*}\\{Buffer})\?\T{1}:\T{0}{}$;\C{ is there something in the +buffer? }\6 +\4${}\}{}$\2\par +\fi + +\M{66} +To make the configuration file more flexible we allow environment variables +in the arguments. We scan the parameter stored in \PB{\\{temp\_buffer}} whether +it +contains a `\.{\$}' character. If yes, the following code fragment tries to +get an environment variable name whose value will be then fetched with +\PB{\\{getenv}(\,)}. An environment variable name recognized by \.{hbf2gf} must +start +with a letter or underscore; the other characters may be alphanumeric or an +underscore. You can surround the environment variable name with braces to +indicate where the name ends, e.g. \.{\$\{FOO\}}. The interpolated +configuration parameter will be truncated to \PB{\.{STRING\_LENGTH}} +characters. If +you want to have `\.{\$}' you must write `\.{\$\$}'. + +Note that you should avoid to use such environment variables for specifying +the location of the configuration file in case you have support for a file +searching library like kpathsea. Its primary aim is to specify the target +directories for the \.{pk\_directory} and the \.{tfm\_directory} keywords. + +\Y\B\4\X66:Check for environment variables\X${}\E{}$\6 +${}\{{}$\1\6 +${}\|P\K\\{temp\_buffer};{}$\6 +${}\\{Buf\_p}\K\\{Buffer};{}$\6 +${}\\{count}\K\.{STRING\_LENGTH}-\T{1}{}$;\7 +\&{while} ${}({*}\|P\W\\{count}>\T{0}){}$\5 +${}\{{}$\1\6 +${}\\{env\_p}\K\\{env\_name}{}$;\7 +\&{if} ${}({*}\|P\E\.{'\$'}){}$\5 +${}\{{}$\1\6 +${}\|P\PP;{}$\6 +\&{if} ${}({*}\|P\E\.{'\$'}){}$\5 +${}\{{}$\1\6 +${}{*}(\\{Buf\_p}\PP)\K{*}(\|P\PP);{}$\6 +${}\\{count}\MM;{}$\6 +\&{continue};\6 +\4${}\}{}$\2\6 +\&{while} ${}({*}\|P\E\.{'\{'}){}$\1\5 +${}\|P\PP;{}$\2\6 +\&{if} ${}(\R(\\{isalpha}({*}\|P)\V{*}\|P\E\.{'\_'})){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},{}$\6 +\.{"Invalid\ environment}\)\.{\ variable\ name\ in\ co}\)\.{nfiguration\ file% +\\n"});\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +${}{*}(\\{env\_p}\PP)\K{*}(\|P\PP);{}$\6 +\&{while} ${}({*}\|P){}$\5 +${}\{{}$\1\6 +\&{if} ${}(\\{isalnum}({*}\|P)\V{*}\|P\E\.{'\_'}){}$\1\5 +${}{*}(\\{env\_p}\PP)\K{*}(\|P\PP);{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +\&{while} ${}({*}\|P\E\.{'\}'}){}$\1\5 +${}\|P\PP;{}$\2\6 +${}{*}\\{env\_p}\K\.{'\\0'};{}$\6 +\&{break};\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\7 +${}\\{env\_value}\K\\{getenv}(\\{env\_name});{}$\6 +\&{if} (\\{env\_value})\C{ append the environment value to \PB{\\{Buffer}} }\6 +${}\{{}$\1\6 +\&{while} ${}({*}\\{env\_value}\W\\{count}>\T{0}){}$\5 +${}\{{}$\1\6 +${}{*}(\\{Buf\_p}\PP)\K{*}(\\{env\_value}\PP);{}$\6 +${}\\{count}\MM;{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +\&{else}\5 +${}\{{}$\1\6 +${}{*}(\\{Buf\_p}\PP)\K{*}(\|P\PP);{}$\6 +${}\\{count}\MM;{}$\6 +\4${}\}{}$\2\6 +\4${}\}{}$\2\6 +${}{*}\\{Buf\_p}\K\.{'\\0'};{}$\6 +\4${}\}{}$\2\par +\U65.\fi + +\M{67} +If an error occurs, \PB{\\{config\_error}(\,)} will leave the program with an +error +message. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{void} \\{config\_error}(\&{char} ${}{*}){}$;\par +\fi + +\M{68} +\Y\B\&{void} \\{config\_error}(\\{message})\1\1\6 +\&{char} ${}{*}\\{message};\2\2{}$\6 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ find\ `\%s'\ }\)\.{entry\ in\ +configurati}\)\.{on\ file\\n"},\39\\{message});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\par +\fi + +\N{1}{69}File searching. + +We support three searching engines: emtexdir, kpathsea, and MiKTeX (which is +a Win32 port of kpathsea). For emtexdir, define \PB{\.{HAVE\_EMTEXDIR}} while +compiling. For kpathsea, define \PB{\.{HAVE\_LIBKPATHSEA}}. If you have a +version of +kpathsea older than~3.2, define \PB{\.{OLD\_KPATHSEA}} additionally. For +kpathsea +older than~3.0, \PB{\.{VERY\_OLD\_KPATHSEA}} must be also set. For MikTeX, +define +\PB{\.{HAVE\_MIKTEX}}. If none of these macros is defined, a simple \PB{% +\\{fopen}(\,)} will +be used instead. + +\Y\B\4\X10:Include files\X${}\mathrel+\E{}$\6 +\8\#\&{if} \&{defined} (\.{HAVE\_LIBKPATHSEA})\6 +\8\#\&{ifdef} \.{VERY\_OLD\_KPATHSEA}\6 +\8\#\&{include} \.{"kpathsea/proginit.h}\)\.{"}\6 +\8\#\&{include} \.{"kpathsea/progname.h}\)\.{"}\6 +\8\#\&{include} \.{"kpathsea/tex-glyph.}\)\.{h"}\6 +\8\#\&{else}\6 +\8\#\&{include} \.{"kpathsea/kpathsea.h}\)\.{"}\6 +\8\#\&{endif}\7 +\8\#\&{elif} \&{defined} (\.{HAVE\_EMTEXDIR})\6 +\8\#\&{include} \.{"emtexdir.h"}\6 +\8\#\&{elif} \&{defined} (\.{HAVE\_MIKTEX})\6 +\8\#\&{include} \.{"miktex.h"}\6 +\8\#\&{endif}\par +\fi + +\M{70} +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\8\#\&{if} \&{defined} (\.{HAVE\_LIBKPATHSEA})\6 +\8\#\&{ifdef} \&{KPSEDLL} \C{ this is kpathsea 3.3 and newer }\6 +\&{extern} \&{KPSEDLL} \&{char} ${}{*}\\{kpathsea\_version\_string};{}$\6 +\8\#\&{else}\6 +\&{extern} \&{DllImport} \&{char} ${}{*}\\{kpathsea\_version\_string};{}$\6 +\8\#\&{endif}\6 +\8\#\&{elif} \&{defined} (\.{HAVE\_EMTEXDIR})\6 +\&{char} \\{emtex\_version\_string}[\,]${}\K\.{"emTeXdir"};{}$\6 +\8\#\&{elif} ${}\R{}$\&{defined} (\.{HAVE\_MIKTEX})\6 +\&{char} \\{no\_version\_string}[\,]${}\K\.{"no\ search\ library"};{}$\6 +\8\#\&{endif}\par +\fi + +\M{71} +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{char} ${}{*}\\{TeX\_search\_version}(\&{void}){}$;\par +\fi + +\M{72} +\Y\B\&{char} ${}{*}\\{TeX\_search\_version}(\&{void}){}$\1\1\2\2\6 +${}\{{}$\6 +\8\#\&{if} \&{defined} (\.{HAVE\_LIBKPATHSEA})\1\6 +\&{return} \\{kpathsea\_version\_string};\6 +\8\#\&{elif} \&{defined} (\.{HAVE\_EMTEXDIR})\6 +\&{return} \\{emtex\_version\_string};\6 +\8\#\&{elif} \&{defined} (\.{HAVE\_MIKTEX})\7 +\&{char} \\{buf}[\T{200}];\7 +${}\\{strcpy}(\\{buf},\39\.{"MiKTeX\ "});{}$\6 +${}\\{miktex\_get\_miktex\_version\_string\_ex}(\\{buf}+\T{7},\39{}$\&{sizeof} +(\\{buf})${}-\T{7});{}$\6 +\&{return} \\{buf};\6 +\8\#\&{else}\6 +\&{return} \\{no\_version\_string};\6 +\8\#\&{endif}\6 +\4${}\}{}$\2\par +\fi + +\M{73} +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\8\#\&{ifdef} \.{HAVE\_EMTEXDIR}\6 +\&{struct} \&{emtex\_dir} \\{cfg\_path}${},{}$ \\{hbf\_path};\6 +\8\#\&{endif}\par +\fi + +\M{74} +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\8\#\&{ifdef} \.{HAVE\_EMTEXDIR}\6 +\&{extern} \&{int} \\{setup\_list}(\&{struct} \&{emtex\_dir} ${}{*},\39{}$% +\&{char} ${}{*},\39{}$\&{const} \&{char} ${}{*},\39\&{unsigned});{}$\6 +\&{int} \\{dir\_setup}(\&{struct} \&{emtex\_dir} ${}{*},\39{}$\&{const} % +\&{char} ${}{*},\39{}$\&{const} \&{char} ${}{*},\39\&{unsigned});{}$\6 +\&{char} ${}{*}{}$\\{file\_find}(\&{char} ${}{*},\39{}$\&{struct} \&{emtex% +\_dir} ${}{*});{}$\6 +\8\#\&{endif}\par +\fi + +\M{75} +We slightly modify \PB{\\{emtex\_dir\_setup}(\,)} (from the file % +\.{emtexdir.c}) to +output a warning in case the environment variable \PB{\\{env}} isn't set +properly. + +\Y\B\8\#\&{ifdef} \.{HAVE\_EMTEXDIR}\6 +\&{int} ${}\\{dir\_setup}(\\{ed},\39\\{env},\39\\{dir},\39\\{flags}){}$\1\1\6 +\&{struct} \&{emtex\_dir} ${}{*}\\{ed};{}$\6 +\&{const} \&{char} ${}{*}\\{env};{}$\6 +\&{const} \&{char} ${}{*}\\{dir};{}$\6 +\&{unsigned} \\{flags};\2\2\6 +${}\{{}$\1\6 +\&{const} \&{char} ${}{*}\\{val};{}$\6 +\&{char} \\{path}[\T{260}];\7 +${}\\{ed}\MG\\{alloc}\K\T{0};{}$\6 +${}\\{ed}\MG\\{used}\K\T{0};{}$\6 +${}\\{ed}\MG\\{list}\K\NULL{}$;\7 +\&{if} ${}(\\{env}\I\NULL\W(\\{val}\K\\{getenv}(\\{env}))\I\NULL){}$\1\5 +\&{return} \\{setup\_list}${}(\\{ed},\39\\{path},\39\\{val},\39\\{flags});{}$\2% +\6 +\&{else}\1\5 +${}\\{fprintf}(\\{stderr},\39\.{"Environment\ variabl}\)\.{e\ `\%s'\ not\ set;\ +use\ }\)\.{current\ directory\\n"},\39\\{env}){}$;\2\7 +\&{return} \.{TRUE};\6 +\4${}\}{}$\2\par +\fi + +\M{76} +\Y\B\4\X2:Global variables\X${}\mathrel+\E{}$\6 +\&{char} ${}\\{name\_buffer}[\.{FILE\_NAME\_LENGTH}+\T{1}]{}$;\par +\fi + +\M{77} +\Y\B\&{char} ${}{*}\\{file\_find}(\\{name},\39\\{list}){}$\1\1\6 +\&{char} ${}{*}\\{name};{}$\6 +\&{struct} \&{emtex\_dir} ${}{*}\\{list};\2\2{}$\6 +${}\{{}$\1\6 +\&{if} ${}(\\{emtex\_dir\_find}(\\{name\_buffer},\39{}$\&{sizeof} (\\{name% +\_buffer})${},\39\\{list},\39\\{name},\39\.{EDF\_CWD})){}$\1\5 +\&{return} \\{name\_buffer};\2\7 +\&{return} ${}\NULL;{}$\6 +\4${}\}{}$\2\6 +\8\#\&{endif}\par +\fi + +\M{78} +For emtexdir we use the environment variables \.{HBFCFG} and \.{HBFONTS} for +configuration resp.\ HBF header files. + +\Y\B\4\X78:Initialize \TeX\ file searching\X${}\E{}$\6 +\8\#\&{if} \&{defined} (\.{HAVE\_LIBKPATHSEA})\6 +\8\#\&{ifdef} \.{OLD\_KPATHSEA}\6 +\\{kpse\_set\_progname}(\\{argv}[\T{0}]);\6 +\8\#\&{else}\6 +${}\\{kpse\_set\_program\_name}(\\{argv}[\T{0}],\39\.{"hbf2gf"});{}$\6 +\8\#\&{endif}\7 +\8\#\&{ifdef} \.{VERY\_OLD\_KPATHSEA}\6 +${}\\{kpse\_init\_prog}(\.{"HBF2GF"},\39\T{300},\39\.{"cx"},\39\\{true},\39% +\.{"cmr10"});{}$\6 +\8\#\&{else}\6 +${}\\{kpse\_init\_prog}(\.{"HBF2GF"},\39\T{300},\39\.{"cx"},\39\.{"cmr10"}){}$;% +\7 +\8\#\&{endif}\7 +\8\#\&{elif} \&{defined} (\.{HAVE\_EMTEXDIR})\6 +\&{if} ${}(\R\\{dir\_setup}({\AND}\\{cfg\_path},\39\.{"HBFCFG"},\39\NULL,\39% +\.{EDS\_BANG})){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ setup\ sear}\)\.{ch\ path\ for\ +configur}\)\.{ation\ files\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\&{if} ${}(\R\\{dir\_setup}({\AND}\\{hbf\_path},\39\.{"HBFONTS"},\39\NULL,\39% +\.{EDS\_BANG})){}$\5 +${}\{{}$\1\6 +${}\\{fprintf}(\\{stderr},\39\.{"Couldn't\ setup\ sear}\)\.{ch\ path\ for\ HBF\ +head}\)\.{er\ files\\n"});{}$\6 +\\{exit}(\T{1});\6 +\4${}\}{}$\2\6 +\8\#\&{endif}\par +\U4.\fi + +\M{79} +Finally, here are the searching routines. A special format in the kpathsea +library for fonts which are neither PostScript nor TrueType (\.{MISCFONTS}) +is available with version~3.3 and newer. For older versions we use the path +for PostScript fonts (\.{T1FONTS}) to find HBF files. Configuration files +are searched in the path specified within \.{TEXCONFIG} for old kpathsea +versions, and within \.{HBF2GFINPUTS} for new versions. + +\Y\B\4\X11:Prototypes\X${}\mathrel+\E{}$\6 +\&{char} ${}{*}{}$\\{TeX\_search\_cfg\_file}(\&{char} ${}{*});{}$\6 +\&{char} ${}{*}{}$\\{TeX\_search\_hbf\_file}(\&{char} ${}{*}){}$;\par +\fi + +\M{80} +\Y\B\8\#\&{if} \&{defined} (\.{HAVE\_LIBKPATHSEA})\6 +\&{char} ${}{*}\\{TeX\_search\_cfg\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\6 +\8\#\&{ifdef} \.{OLD\_KPATHSEA}\1\6 +\&{return} \\{kpse\_find\_file}${}(\\{name},\39\\{kpse\_dvips\_config\_format},% +\39\.{TRUE});{}$\6 +\8\#\&{else}\6 +\&{return} \\{kpse\_find\_file}${}(\\{name},\39\\{kpse\_program\_text\_format},% +\39\.{TRUE});{}$\6 +\8\#\&{endif}\6 +\4${}\}{}$\2\7 +\&{char} ${}{*}\\{TeX\_search\_hbf\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};$ $\{{}$\6 +\8\#\&{ifdef} \.{VERY\_OLD\_KPATHSEA}\6 +\&{return} \\{kpse\_find\_file}${}(\\{name},\39\\{kpse\_dvips\_header\_format},% +\39\.{TRUE});{}$\6 +\8\#\&{else}\6 +\8\#\&{ifndef} \&{KPSEDLL} \6 +\&{return} \\{kpse\_find\_file}${}(\\{name},\39\\{kpse\_type1\_format},\39% +\.{TRUE});{}$\6 +\8\#\&{else}\6 +\&{return} \\{kpse\_find\_file}${}(\\{name},\39\\{kpse\_miscfonts\_format},\39% +\.{TRUE});{}$\6 +\8\#\&{endif}\6 +\8\#\&{endif}\6 +$\}{}$\7 +\8\#\&{elif} \&{defined} (\.{HAVE\_EMTEXDIR})\6 +\&{char} ${}{*}\\{TeX\_search\_cfg\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\1\6 +\&{return} \\{file\_find}${}(\\{name},\39{\AND}\\{cfg\_path});{}$\6 +\4${}\}{}$\2\7 +\&{char} ${}{*}\\{TeX\_search\_hbf\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\1\6 +\&{return} \\{file\_find}${}(\\{name},\39{\AND}\\{hbf\_path});{}$\6 +\4${}\}{}$\2\7 +\8\#\&{elif} \&{defined} (\.{HAVE\_MIKTEX})\7 +\&{char} ${}{*}\\{TeX\_search\_cfg\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\1\6 +\&{char} \\{result}[\.{\_MAX\_PATH}];\7 +\&{if} ${}(\R\\{miktex\_find\_input\_file}(\.{"hbf2gf"},\39{*}\\{name},\39% +\\{result})){}$\1\5 +\&{return} \T{0};\2\6 +\&{return} \\{strdup}(\\{result});\6 +\4${}\}{}$\2\7 +\&{char} ${}{*}\\{TeX\_search\_hbf\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\1\6 +\&{char} \\{result}[\.{\_MAX\_PATH}];\7 +\&{if} ${}(\R\\{miktex\_find\_miscfont\_file}({*}\\{name},\39\\{result})){}$\1\5 +\&{return} \T{0};\2\6 +\&{return} \\{strdup}(\\{result});\6 +\4${}\}{}$\2\7 +\8\#\&{else}\7 +\&{char} ${}{*}\\{TeX\_search\_cfg\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\1\6 +\&{return} \\{name};\6 +\4${}\}{}$\2\7 +\&{char} ${}{*}\\{TeX\_search\_hbf\_file}(\\{name}){}$\1\1\6 +\&{char} ${}{*}\\{name};\2\2{}$\6 +${}\{{}$\1\6 +\&{return} \\{name};\6 +\4${}\}{}$\2\6 +\8\#\&{endif}\par +\fi + +\N{1}{81}An example. +This is the example configuration file \.{b5so12.cfg} (for use with DOS or +OS/2 and the emtexdir searching engine): +\bigskip +\halign{\quad\.{#}\hfil&\quad\.{#}\hfil\cr +hbf\_header & et24.hbf \cr +mag\_x & 2.076 \cr +x\_offset & 3 \cr +y\_offset & -8 \cr +comment & fanti songti 24x24 pixel font scaled and +adapted to 12 pt \cr +& \cr +design\_size & 12.0 \cr +& \cr +nmb\_fonts & -1 \cr +& \cr +output\_name & b5so12 \cr +& \cr +dpi\_x & 300 \cr +checksum & 123456789 \cr +coding & codingscheme Big 5 encoded TeX text \cr +& \cr +long\_extension & no \cr +job\_extension & .cmd \cr +rm\_command & del \cr +cp\_command & copy \cr +pk\_directory & \$HBF\_TARGET\\pk\\360dpi\\ \cr +tfm\_directory & \$HBF\_TARGET\\tfm\\ \cr +} +\bigskip +If you say e.g. +\medskip +\quad \.{set HBF\_TARGET=c:\\emtex\\texfonts} +\medskip +on your DOS prompt (or in your \.{autoexec.bat} file), then the interpolated +value of the \.{tfm\_directory} keyword is \.{c:\\emtex\\texfonts\\tfm\\}. +The HBF header file \.{et24.hbf} will be searched in the path specified by +the \.{HBFCFG} environment variable. +\bigskip +The call +\medskip +\quad \.{hbf2gf b5so12.cfg} +\medskip +creates the files +\medskip +\quad \.{b5so1201.gf}, \.{b5so1202.gf}, $\ldots$ , \.{b5so1255.gf}, +\.{b5so12.pl}, and \.{b5so12.cmd} +\bigskip +After calling +\medskip +\quad \.{b5so12.cmd} +\medskip +you will find the \.{PK} files in the +\.{c:\\emtex\\texfonts\\pk\\360dpi} directory and the \.{TFM} files in +the \.{c:\\emtex\\texfonts\\tfm} directory; all \.{GF} files and +\.{b5so12.pl} will be deleted. +\bigskip +The call +\medskip +\quad \.{hbf2gf -n b5so1220 417} +\medskip +creates two files: +\medskip +\quad \.{b5so1220.gf} and \.{b5so1220.pl} +\medskip +using the configuration file \.{b5so12.cfg}. The \.{GF} file would be +named \.{b5so1220.417gf} if the flag \.{-n} had not been used. + +\medskip + +It is possible to convert bitmap fonts to \.{PK} files almost +automatically. The HBF header file already has the entry +\.{HBF\_BITMAP\_BOUNDING\_BOX} which defines vertical and horizontal offsets +(in pixels), but these values are not in all cases optimal. If you omit +\.{x\_offset} and \.{y\_offset} in the configuration file, the third and +fourth parameter of \.{HBF\_BITMAP\_BOUNDING\_BOX} is used, scaled to design +size (to say it with other words: \.{x\_offset} and \.{y\_offset} will always +apply to the design size to be synchronous with the \.{TFM} files). + +Don't confuse scaling and magnification: Scaling here means that you choose +a (arbitrary) design size and compute scaling values (\.{mag\_x} and +\.{mag\_y}) which scales the bitmap to this particular design size at a +certain (arbitrarily chosen) resolution (\.{dpi\_x} and \.{dpi\_y}). +Magnification means that the scaled bitmap will be then magnified to a +certain target size while still using the font parameters (i.e., the +\.{TFM} file) of the design size. + +In the sample, you have a $24 \times 24$ bitmap font which will be scaled to +$12\,\hbox{pt}$ having a resolution of $300\,\hbox{dpi}$: +\medskip +\quad $1\,\hbox{pt}$ are $300 / 72.27 = 4.1511$ pixel; + +\quad $12\,\hbox{pt}$ are $4.1511 * 12 = 49.813$ pixel; + +\quad thus the theoretical scaling value is $49.813 / 24 = 2.076$. + +\medskip + +But especially for small sizes, this may not be the best value if the font +should harmonize with, say, Knuth's Computer Modern fonts. I recommend to +compute, say, 5~\.{PK} fonts, then check the CJK font with different \TeX\ +fonts to see whether the offsets and/or the scaling value is good. The +greater the design size the finer you can control the offsets---as an +example you could use a design size of $30\,\hbox{pt}$ (nevertheless there +is a compile-time constant \PB{\.{MAX\_CHAR\_SIZE}} which limits the maximal +character size; default is 255~pixels). + +If you have found optimal offsets, you can produce many different +magnifications of the CJK font using the same set of \.{TFM} files +analogous to ordinary \TeX\ fonts; as a simplification, we assume that +\.{PK} files with a resolution of $300\,\hbox{dpi}$ and a design size of +$10\,\hbox{pt}$ have the extension `\.{.300pk}' (respectively come into a +`\.{300dpi}' subdirectory)---this is the reason why in the above example for +the $12\,\hbox{pt}$ design size a `\.{360dpi}' target directory has been +used. Now we can use the following formula: + +$$ \\{needed\_dpi} = \\{your\_horizontal\_resolution} * +{\\{your\_target\_size} \over 10.0} $$ + +Example: assuming that your printer has a resolution of +$300\times400\,\hbox{dpi}$, and you want $14.4\,\hbox{pt}$: + +$$ 300 * {14.4 \over 10.0} = 432 $$ + +The vertical scaling value is $400 / 300 = 1.3333$. Use these values now to +call \.{hbf2gf} in \mf-like mode: + +\quad \.{hbf2gf b5so1220 432 1.3333} + + + +\fi + +\N{1}{82}Index. +\fi + +\inx +\fin +\con |