summaryrefslogtreecommitdiff
path: root/Build/source
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source')
-rw-r--r--Build/source/texk/README2
-rwxr-xr-xBuild/source/texk/configure2
-rw-r--r--Build/source/texk/xdvik/CHANGES17
-rw-r--r--Build/source/texk/xdvik/ChangeLog (renamed from Build/source/texk/xdvik/ChangeLog.TL)15
-rw-r--r--Build/source/texk/xdvik/Makefile.am28
-rw-r--r--Build/source/texk/xdvik/Makefile.in117
-rw-r--r--Build/source/texk/xdvik/README.t1fonts137
-rw-r--r--Build/source/texk/xdvik/ac/withenable.ac4
-rw-r--r--Build/source/texk/xdvik/aclocal.m45
-rw-r--r--Build/source/texk/xdvik/c-auto.in12
-rw-r--r--Build/source/texk/xdvik/common.am12
-rwxr-xr-xBuild/source/texk/xdvik/configure309
-rw-r--r--Build/source/texk/xdvik/configure.ac19
-rw-r--r--Build/source/texk/xdvik/dvi-draw.c1889
-rw-r--r--Build/source/texk/xdvik/dvi-draw.h21
-rw-r--r--Build/source/texk/xdvik/dvi-init.c121
-rw-r--r--Build/source/texk/xdvik/dvi-init.h32
-rw-r--r--Build/source/texk/xdvik/encodings.c6
-rw-r--r--Build/source/texk/xdvik/events.c16
-rw-r--r--Build/source/texk/xdvik/font-open.c1463
-rw-r--r--Build/source/texk/xdvik/font-open.h65
-rw-r--r--Build/source/texk/xdvik/ft.c484
-rw-r--r--Build/source/texk/xdvik/gui/Panner.c18
-rw-r--r--Build/source/texk/xdvik/gui/help-window.c19
-rw-r--r--Build/source/texk/xdvik/gui/mag.c12
-rw-r--r--Build/source/texk/xdvik/gui/pagesel.c4
-rw-r--r--Build/source/texk/xdvik/gui/print-dialog.c5
-rw-r--r--Build/source/texk/xdvik/gui/search-dialog.c2
-rw-r--r--Build/source/texk/xdvik/gui/sfSelFile.c18
-rw-r--r--Build/source/texk/xdvik/gui/xm_filesel.c10
-rw-r--r--Build/source/texk/xdvik/m4/xdvi-func-xkbbell.m429
-rw-r--r--Build/source/texk/xdvik/m4/xdvi-gs-lib-path.m439
-rw-r--r--Build/source/texk/xdvik/main.c46
-rw-r--r--Build/source/texk/xdvik/read-mapfile.c158
-rw-r--r--Build/source/texk/xdvik/read-mapfile.h28
-rw-r--r--Build/source/texk/xdvik/tests/Makefile.in23
-rw-r--r--Build/source/texk/xdvik/texmf-alt/xdvi.cfg90
-rw-r--r--Build/source/texk/xdvik/texmf/config.xdvi40
-rw-r--r--Build/source/texk/xdvik/texmf/xdvi.cfg65
-rw-r--r--Build/source/texk/xdvik/tfmload.c120
-rw-r--r--Build/source/texk/xdvik/tfmload.h31
-rw-r--r--Build/source/texk/xdvik/util.c150
-rw-r--r--Build/source/texk/xdvik/util.h27
-rw-r--r--Build/source/texk/xdvik/version.h2
-rw-r--r--Build/source/texk/xdvik/x_util.c179
-rw-r--r--Build/source/texk/xdvik/x_util.h3
-rw-r--r--Build/source/texk/xdvik/xdvi-debug.h22
-rw-r--r--Build/source/texk/xdvik/xdvi.1.in154
-rw-r--r--Build/source/texk/xdvik/xdvi.c60
-rw-r--r--Build/source/texk/xdvik/xdvi.h14
50 files changed, 3351 insertions, 2793 deletions
diff --git a/Build/source/texk/README b/Build/source/texk/README
index 5582e3bc18d..f0ff9bfe513 100644
--- a/Build/source/texk/README
+++ b/Build/source/texk/README
@@ -102,7 +102,7 @@ web2c - maintained here, by us - core web2c, plain tex, etc.
xdv2pdf - maintained here, by Khaled Hosny, Jonathan Kew
-xdvik 22.85 - checked 10may12
+xdvik 22.86 - checked 7apr13
http://sourceforge.net/projects/xdvi/files/xdvik/
xdvipdfmx - maintainered here, by Khaled Hosny, Jonathan Kew
diff --git a/Build/source/texk/configure b/Build/source/texk/configure
index 685abd58cdb..46686f3260f 100755
--- a/Build/source/texk/configure
+++ b/Build/source/texk/configure
@@ -4684,7 +4684,7 @@ esac
test "x$enable_xdvik" = xno || {
need_kpathsea=yes
- need_t1lib=yes
+ need_freetype2=yes
}
## texk/xdvik/ac/xdvik.ac: configure.ac fragment for the TeX Live subdirectory texk/xdvik/
diff --git a/Build/source/texk/xdvik/CHANGES b/Build/source/texk/xdvik/CHANGES
index 93f00243445..0c43b088128 100644
--- a/Build/source/texk/xdvik/CHANGES
+++ b/Build/source/texk/xdvik/CHANGES
@@ -9,6 +9,23 @@ Versions containing major changes are marked as `beta'; these
may contain undetected bugs. Such versions shouldn't be used
by distributors.
+ * 22.86 (2013-04-04):
+ + xdvi.h, xdvi.c, x_util.h, x_util.c, dvi-init.c: Fixed bugs in
+ property handling on 64-bit systems (related to source specials).
+ + m4/xdvi-check-iconv.m4, m4/xdvi-check-langinfo.m4,
+ m4/xdvi-func-working-vsnprintf.m4: fixed copyright notices;
+ configure.ac: removed some obsolete lines.
+ + Added support for XkbBell, to make the console bell work again.
+ + Fixed #3514485 (mksedscript improperly handles macro values in
+ c-auto.in that contain spaces) (fix from TeX Live).
+ + Makefile.am and Makefile.in: Removed invalid utf-8 character \0x80.
+ + dvi-draw.c: Fixed #3578773 (type1 -> pk fallback bug if >1 size used)
+ + dvi-draw.c: Fixed #3607324 (misspelling)
+ + events.c: Fixed a bug involving a segfault when switching to a dvi
+ file whose name does not end in .dvi
+ + main.c: Added copyright message
+ + Many places: Switched from using the t1lib library to FreeType2
+
* 22.85 (2012-04-01):
+ configure.ac: check for ulltostr is no longer used
+ hypertex.c, gui/xm_toolbar.c: avoid compiler warnings about mixed
diff --git a/Build/source/texk/xdvik/ChangeLog.TL b/Build/source/texk/xdvik/ChangeLog
index 018557b28c6..ca84994e0db 100644
--- a/Build/source/texk/xdvik/ChangeLog.TL
+++ b/Build/source/texk/xdvik/ChangeLog
@@ -1,5 +1,16 @@
-ChangeLog.TL: Changes for xdvik (TeX Live)
-==================================================
+2013-04-07 Peter Breitenlohner <peb@mppmu.mpg.de>
+
+ Imported xdvik-22.86.tar.gz
+ from http://sourceforge.net/projects/xdvi/files/xdvik/.
+
+ * Makefile.am: Renamed ChangeLog.TL => ChangeLog.
+ (install-data-hook): Make sure $(DESTDIR)$(dvipsconfdir) exists.
+
+ * util.c (find_str_int_hash): Return type of hash_lookup() is
+ 'const_string *'.
+
+ * ft.c (read_ft_char): Count bmTypeT words instead of bytes and
+ avoid cast causing 'strict-aliasing rules' warning.
2013-02-08 Peter Breitenlohner <peb@mppmu.mpg.de>
diff --git a/Build/source/texk/xdvik/Makefile.am b/Build/source/texk/xdvik/Makefile.am
index 8e722f2d216..99654a44206 100644
--- a/Build/source/texk/xdvik/Makefile.am
+++ b/Build/source/texk/xdvik/Makefile.am
@@ -44,6 +44,7 @@ libxdvi_a_SOURCES = \
filehist.h \
font-open.c \
font-open.h \
+ ft.c \
gf.c \
hypertex.c \
hypertex.h \
@@ -66,8 +67,6 @@ libxdvi_a_SOURCES = \
psgs.h \
psnews.c \
psnews.h \
- read-mapfile.c \
- read-mapfile.h \
search-internal.c \
search-internal.h \
special.c \
@@ -76,8 +75,6 @@ libxdvi_a_SOURCES = \
string-utils.h \
string_list.c \
string_list.h \
- tfmload.c \
- tfmload.h \
translations.h \
util.c \
util.h \
@@ -208,20 +205,23 @@ dist_xdvi_DATA = texmf/XDvi
pixmapdir = $(datarootdir)/texmf-dist/xdvi/pixmap
dist_pixmap_DATA = pixmaps/toolbar.xpm pixmaps/toolbar2.xpm
-dist_noinst_DATA = texmf/xdvi.cfg
+dvipsconfdir = $(datarootdir)/texmf-dist/dvips/config
+dist_noinst_DATA = texmf/config.xdvi
install-data-hook:
- @if grep "original xdvi.cfg --" "$(DESTDIR)$(xdvidir)/xdvi.cfg" >/dev/null 2>&1 \
- || test ! -r "$(DESTDIR)$(xdvidir)/xdvi.cfg"; then \
- echo " $(INSTALL_DATA) '$(srcdir)/texmf/xdvi.cfg' '$(DESTDIR)$(xdvidir)/xdvi.cfg'"; \
- $(INSTALL_DATA) "$(srcdir)/texmf/xdvi.cfg" "$(DESTDIR)$(xdvidir)/xdvi.cfg"; \
+ @echo " $(MKDIR_P) '$(DESTDIR)$(dvipsconfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvipsconfdir)" || exit 1; \
+ if grep "original config.xdvi --" "$(DESTDIR)$(dvipsconfdir)/config.xdvi" >/dev/null 2>&1 \
+ || test ! -r "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; then \
+ echo " $(INSTALL_DATA) '$(srcdir)/texmf/config.xdvi' '$(DESTDIR)$(dvipsconfdir)/config.xdvi'"; \
+ $(INSTALL_DATA) "$(srcdir)/texmf/config.xdvi" "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; \
else :; fi
uninstall-hook:
- @if grep "original xdvi.cfg --" "$(DESTDIR)$(xdvidir)/xdvi.cfg" >/dev/null 2>&1 \
- || test ! -r "$(DESTDIR)$(xdvidir)/xdvi.cfg"; then \
- echo " rm -f '$(DESTDIR)$(xdvidir)/xdvi.cfg'"; \
- rm -f "$(DESTDIR)$(xdvidir)/xdvi.cfg"; \
+ @if grep "original config.xdvi --" "$(DESTDIR)$(dvipsconfdir)/config.xdvi" >/dev/null 2>&1 \
+ || test ! -r "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; then \
+ echo " rm -f '$(DESTDIR)$(dvipsconfdir)/config.xdvi'"; \
+ rm -f "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; \
else :; fi
## Not used
@@ -229,7 +229,6 @@ uninstall-hook:
EXTRA_DIST += \
BUGS \
CHANGES \
- ChangeLog.TL \
FAQ \
LESSTIF-BUGS \
README.t1fonts \
@@ -257,7 +256,6 @@ EXTRA_DIST += \
texmf-alt/charter2.map \
texmf-alt/lucida.map \
texmf-alt/marvosym.map \
- texmf-alt/xdvi.cfg \
texmf-alt/xdvifont.map \
texmf-alt/xypic.map \
xdvi-search.el \
diff --git a/Build/source/texk/xdvik/Makefile.in b/Build/source/texk/xdvik/Makefile.in
index 21a8b3da09a..2dacdb50616 100644
--- a/Build/source/texk/xdvik/Makefile.in
+++ b/Build/source/texk/xdvik/Makefile.in
@@ -57,7 +57,7 @@ DIST_COMMON = $(srcdir)/common.am $(srcdir)/Makefile.in \
$(srcdir)/Makefile.am $(top_srcdir)/configure \
$(am__configure_deps) $(srcdir)/c-auto.in $(srcdir)/xdvi-sh.in \
$(top_srcdir)/../../build-aux/depcomp $(dist_noinst_DATA) \
- $(dist_pixmap_DATA) $(dist_xdvi_DATA) \
+ $(dist_pixmap_DATA) $(dist_xdvi_DATA) ChangeLog \
../../build-aux/config.guess ../../build-aux/config.sub \
../../build-aux/depcomp ../../build-aux/install-sh \
../../build-aux/missing ../../build-aux/texinfo.tex \
@@ -80,13 +80,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/xdvi-c-bitmap-type.m4 \
$(top_srcdir)/m4/xdvi-func-poll.m4 \
$(top_srcdir)/m4/xdvi-func-setsid-in-fork.m4 \
$(top_srcdir)/m4/xdvi-func-working-vsnprintf.m4 \
+ $(top_srcdir)/m4/xdvi-func-xkbbell.m4 \
+ $(top_srcdir)/m4/xdvi-gs-lib-path.m4 \
$(top_srcdir)/m4/xdvi-linker-multiple-defns.m4 \
$(top_srcdir)/m4/xdvi-sys-old-linux.m4 \
$(top_srcdir)/m4/xdvi-sys-streams.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
+ $(top_srcdir)/../../m4/kpse-freetype2-flags.m4 \
$(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \
- $(top_srcdir)/../../m4/kpse-t1lib-flags.m4 \
$(top_srcdir)/../../m4/kpse-warnings.m4 \
+ $(top_srcdir)/../../m4/kpse-zlib-flags.m4 \
$(top_srcdir)/../../m4/libtool.m4 \
$(top_srcdir)/../../m4/ltoptions.m4 \
$(top_srcdir)/../../m4/ltsugar.m4 \
@@ -113,21 +116,20 @@ am__dirstamp = $(am__leading_dot)dirstamp
am_libxdvi_a_OBJECTS = browser.$(OBJEXT) dl_list.$(OBJEXT) \
dvi-draw.$(OBJEXT) dvi-init.$(OBJEXT) dvisel.$(OBJEXT) \
encodings.$(OBJEXT) events.$(OBJEXT) exit-handlers.$(OBJEXT) \
- filehist.$(OBJEXT) font-open.$(OBJEXT) gf.$(OBJEXT) \
- hypertex.$(OBJEXT) image-magick.$(OBJEXT) mime.$(OBJEXT) \
- my-snprintf.$(OBJEXT) my-vsnprintf.$(OBJEXT) \
+ filehist.$(OBJEXT) font-open.$(OBJEXT) ft.$(OBJEXT) \
+ gf.$(OBJEXT) hypertex.$(OBJEXT) image-magick.$(OBJEXT) \
+ mime.$(OBJEXT) my-snprintf.$(OBJEXT) my-vsnprintf.$(OBJEXT) \
pagehist.$(OBJEXT) pk.$(OBJEXT) print-internal.$(OBJEXT) \
psdps.$(OBJEXT) psgs.$(OBJEXT) psnews.$(OBJEXT) \
- read-mapfile.$(OBJEXT) search-internal.$(OBJEXT) \
- special.$(OBJEXT) string-utils.$(OBJEXT) string_list.$(OBJEXT) \
- tfmload.$(OBJEXT) util.$(OBJEXT) vf.$(OBJEXT) x_util.$(OBJEXT) \
- xdvi.$(OBJEXT) xserver-info.$(OBJEXT) gui/Panner.$(OBJEXT) \
- gui/Tip.$(OBJEXT) gui/help-window.$(OBJEXT) gui/mag.$(OBJEXT) \
- gui/menu.$(OBJEXT) gui/message-window.$(OBJEXT) \
- gui/pagesel.$(OBJEXT) gui/print-dialog.$(OBJEXT) \
- gui/print-log.$(OBJEXT) gui/search-dialog.$(OBJEXT) \
- gui/selection.$(OBJEXT) gui/sfDir.$(OBJEXT) \
- gui/sfDraw.$(OBJEXT) gui/sfPath.$(OBJEXT) \
+ search-internal.$(OBJEXT) special.$(OBJEXT) \
+ string-utils.$(OBJEXT) string_list.$(OBJEXT) util.$(OBJEXT) \
+ vf.$(OBJEXT) x_util.$(OBJEXT) xdvi.$(OBJEXT) \
+ xserver-info.$(OBJEXT) gui/Panner.$(OBJEXT) gui/Tip.$(OBJEXT) \
+ gui/help-window.$(OBJEXT) gui/mag.$(OBJEXT) gui/menu.$(OBJEXT) \
+ gui/message-window.$(OBJEXT) gui/pagesel.$(OBJEXT) \
+ gui/print-dialog.$(OBJEXT) gui/print-log.$(OBJEXT) \
+ gui/search-dialog.$(OBJEXT) gui/selection.$(OBJEXT) \
+ gui/sfDir.$(OBJEXT) gui/sfDraw.$(OBJEXT) gui/sfPath.$(OBJEXT) \
gui/sfSelFile.$(OBJEXT) gui/statusline.$(OBJEXT) \
gui/topic-window.$(OBJEXT) gui/xaw_bitmaps.$(OBJEXT) \
gui/xaw_menu.$(OBJEXT) gui/xicon.$(OBJEXT) \
@@ -343,6 +345,10 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FREETYPE2_DEPEND = @FREETYPE2_DEPEND@
+FREETYPE2_INCLUDES = @FREETYPE2_INCLUDES@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+FT2_CONFIG = @FT2_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -384,9 +390,6 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
-T1LIB_DEPEND = @T1LIB_DEPEND@
-T1LIB_INCLUDES = @T1LIB_INCLUDES@
-T1LIB_LIBS = @T1LIB_LIBS@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
XDVIK_VERSION = @XDVIK_VERSION@
@@ -395,6 +398,9 @@ X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
+ZLIB_DEPEND = @ZLIB_DEPEND@
+ZLIB_INCLUDES = @ZLIB_INCLUDES@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -461,13 +467,13 @@ ACLOCAL_AMFLAGS = -I ../../m4 -I m4
AM_CFLAGS = $(WARNING_CFLAGS)
SUBDIRS = squeeze . tests
x_cppflags = $(X_CFLAGS) $(iconv_includes)
-common_includes = $(PS_DEF) $(KPATHSEA_INCLUDES) $(T1LIB_INCLUDES) $(x_cppflags)
+common_includes = $(PS_DEF) $(KPATHSEA_INCLUDES) $(FREETYPE2_INCLUDES) $(x_cppflags)
x_ldflags = $(X_LIBS) $(x_linker_options) $(iconv_libpath)
x_extra_libs = $(X_EXTRA_LIBS) $(iconv_libs)
xdvi_x_libs = $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt \
$(X_PRE_LIBS) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs)
-common_ldadd = $(KPATHSEA_LIBS) $(T1LIB_LIBS) $(xdvi_x_libs)
-common_dependencies = $(KPATHSEA_DEPEND) $(T1LIB_DEPEND)
+common_ldadd = $(KPATHSEA_LIBS) $(FREETYPE2_LIBS) $(xdvi_x_libs)
+common_dependencies = $(KPATHSEA_DEPEND) $(FREETYPE2_DEPEND)
libxdvi_dependencies = ${top_srcdir}/*.[ch] ${top_srcdir}/gui/*.[ch] ${top_builddir}/psheader.c
AM_CPPFLAGS = -I$(srcdir)/gui $(common_includes)
noinst_LIBRARIES = libxdvi.a
@@ -476,25 +482,24 @@ libxdvi_a_SOURCES = alloc-debug.h browser.c browser.h c-openmx.h \
dl_list.c dl_list.h dvi-draw.c dvi-draw.h dvi-init.c \
dvi-init.h dvi.h dvisel.c dvisel.h encodings.c encodings.h \
events.c events.h exit-handlers.c exit-handlers.h filehist.c \
- filehist.h font-open.c font-open.h gf.c hypertex.c hypertex.h \
- image-magick.c image-magick.h mime.c mime.h my-snprintf.c \
- my-snprintf.h my-vsnprintf.c my-vsnprintf.h pagehist.c \
- pagehist.h pk.c print-internal.c print-internal.h psdps.c \
- psdps.h psgs.c psgs.h psnews.c psnews.h read-mapfile.c \
- read-mapfile.h search-internal.c search-internal.h special.c \
- special.h string-utils.c string-utils.h string_list.c \
- string_list.h tfmload.c tfmload.h translations.h util.c util.h \
- version.h vf.c x_util.c x_util.h xdvi.c xdvi-config.h \
- xdvi-debug.h xserver-info.c xdvi.h xserver-info.h gui/Panner.c \
- gui/Panner.h gui/PannerP.h gui/Tip.c gui/Tip.h gui/TipP.h \
- gui/help-window.c gui/help-window.h gui/mag.c gui/mag.h \
- gui/menu.c gui/menu.h gui/message-window.c \
- gui/message-window.h gui/pagesel.c gui/pagesel.h \
- gui/print-dialog.c gui/print-dialog.h gui/print-log.c \
- gui/print-log.h gui/search-dialog.c gui/search-dialog.h \
- gui/selection.c gui/selection.h gui/sfDir.c gui/sfDir.h \
- gui/sfDraw.c gui/sfDraw.h gui/sfPath.c gui/sfPath.h \
- gui/sfSelFile.c gui/sfSelFile.h gui/sfinternal.h \
+ filehist.h font-open.c font-open.h ft.c gf.c hypertex.c \
+ hypertex.h image-magick.c image-magick.h mime.c mime.h \
+ my-snprintf.c my-snprintf.h my-vsnprintf.c my-vsnprintf.h \
+ pagehist.c pagehist.h pk.c print-internal.c print-internal.h \
+ psdps.c psdps.h psgs.c psgs.h psnews.c psnews.h \
+ search-internal.c search-internal.h special.c special.h \
+ string-utils.c string-utils.h string_list.c string_list.h \
+ translations.h util.c util.h version.h vf.c x_util.c x_util.h \
+ xdvi.c xdvi-config.h xdvi-debug.h xserver-info.c xdvi.h \
+ xserver-info.h gui/Panner.c gui/Panner.h gui/PannerP.h \
+ gui/Tip.c gui/Tip.h gui/TipP.h gui/help-window.c \
+ gui/help-window.h gui/mag.c gui/mag.h gui/menu.c gui/menu.h \
+ gui/message-window.c gui/message-window.h gui/pagesel.c \
+ gui/pagesel.h gui/print-dialog.c gui/print-dialog.h \
+ gui/print-log.c gui/print-log.h gui/search-dialog.c \
+ gui/search-dialog.h gui/selection.c gui/selection.h \
+ gui/sfDir.c gui/sfDir.h gui/sfDraw.c gui/sfDraw.h gui/sfPath.c \
+ gui/sfPath.h gui/sfSelFile.c gui/sfSelFile.h gui/sfinternal.h \
gui/statusline.c gui/statusline.h gui/topic-window.c \
gui/topic-window.h gui/xaw_bitmaps.c gui/xaw_bitmaps.h \
gui/xaw_menu.c gui/xaw_menu.h gui/xicon.c gui/xicon.h \
@@ -511,8 +516,8 @@ DISTCLEANFILES = config.force
bin_SCRIPTS = xdvi
xdvi_bin_SOURCES = main.c
LDADD = libxdvi.a $(common_ldadd)
-EXTRA_DIST = psheader.txt mksedscript xdvi.1.in BUGS CHANGES \
- ChangeLog.TL FAQ LESSTIF-BUGS README.t1fonts README.t1mapper \
+EXTRA_DIST = psheader.txt mksedscript xdvi.1.in BUGS CHANGES FAQ \
+ LESSTIF-BUGS README.t1fonts README.t1mapper \
pixmaps/drag_horiz.xbm pixmaps/drag_horiz_mask.xbm \
pixmaps/drag_omni.xbm pixmaps/drag_omni_mask.xbm \
pixmaps/drag_vert.xbm pixmaps/drag_vert_mask.xbm \
@@ -522,7 +527,7 @@ EXTRA_DIST = psheader.txt mksedscript xdvi.1.in BUGS CHANGES \
pixmaps/time16_mask.xbm pixmaps/xdvi16x16.xpm \
pixmaps/xdvi32x32.xpm pixmaps/xdvi48x48.xpm t1mapper \
t1mapper.1 texmf-alt/README texmf-alt/charter2.map \
- texmf-alt/lucida.map texmf-alt/marvosym.map texmf-alt/xdvi.cfg \
+ texmf-alt/lucida.map texmf-alt/marvosym.map \
texmf-alt/xdvifont.map texmf-alt/xypic.map xdvi-search.el \
xdvi.icon xdvizilla xdvizilla.1
CLEANFILES = psheader.c sedscript xdvi.1
@@ -531,7 +536,8 @@ xdvidir = $(datarootdir)/texmf-dist/xdvi
dist_xdvi_DATA = texmf/XDvi
pixmapdir = $(datarootdir)/texmf-dist/xdvi/pixmap
dist_pixmap_DATA = pixmaps/toolbar.xpm pixmaps/toolbar2.xpm
-dist_noinst_DATA = texmf/xdvi.cfg
+dvipsconfdir = $(datarootdir)/texmf-dist/dvips/config
+dist_noinst_DATA = texmf/config.xdvi
all: c-auto.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
@@ -764,6 +770,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exit-handlers.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filehist.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font-open.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ft.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hypertex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/image-magick.Po@am__quote@
@@ -778,12 +785,10 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psgs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psheader.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/psnews.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/read-mapfile.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search-internal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/special.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string-utils.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string_list.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfmload.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vf.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/x_util.Po@am__quote@
@@ -1377,7 +1382,7 @@ uninstall-man: uninstall-man1
@KPATHSEA_RULE@
-@T1LIB_RULE@
+@FREETYPE2_RULE@
$(libxdvi_a_OBJECTS): config.force
@@ -1402,17 +1407,19 @@ sedscript: mksedscript CHANGES Makefile c-auto.h
$(AM_V_GEN)$(SHELL) $(srcdir)/mksedscript $(srcdir) $(DEFS) $(PS_DEF) >$@
install-data-hook:
- @if grep "original xdvi.cfg --" "$(DESTDIR)$(xdvidir)/xdvi.cfg" >/dev/null 2>&1 \
- || test ! -r "$(DESTDIR)$(xdvidir)/xdvi.cfg"; then \
- echo " $(INSTALL_DATA) '$(srcdir)/texmf/xdvi.cfg' '$(DESTDIR)$(xdvidir)/xdvi.cfg'"; \
- $(INSTALL_DATA) "$(srcdir)/texmf/xdvi.cfg" "$(DESTDIR)$(xdvidir)/xdvi.cfg"; \
+ @echo " $(MKDIR_P) '$(DESTDIR)$(dvipsconfdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(dvipsconfdir)" || exit 1; \
+ if grep "original config.xdvi --" "$(DESTDIR)$(dvipsconfdir)/config.xdvi" >/dev/null 2>&1 \
+ || test ! -r "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; then \
+ echo " $(INSTALL_DATA) '$(srcdir)/texmf/config.xdvi' '$(DESTDIR)$(dvipsconfdir)/config.xdvi'"; \
+ $(INSTALL_DATA) "$(srcdir)/texmf/config.xdvi" "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; \
else :; fi
uninstall-hook:
- @if grep "original xdvi.cfg --" "$(DESTDIR)$(xdvidir)/xdvi.cfg" >/dev/null 2>&1 \
- || test ! -r "$(DESTDIR)$(xdvidir)/xdvi.cfg"; then \
- echo " rm -f '$(DESTDIR)$(xdvidir)/xdvi.cfg'"; \
- rm -f "$(DESTDIR)$(xdvidir)/xdvi.cfg"; \
+ @if grep "original config.xdvi --" "$(DESTDIR)$(dvipsconfdir)/config.xdvi" >/dev/null 2>&1 \
+ || test ! -r "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; then \
+ echo " rm -f '$(DESTDIR)$(dvipsconfdir)/config.xdvi'"; \
+ rm -f "$(DESTDIR)$(dvipsconfdir)/config.xdvi"; \
else :; fi
# Tell versions [3.59,3.63) of GNU make to not export all variables.
diff --git a/Build/source/texk/xdvik/README.t1fonts b/Build/source/texk/xdvik/README.t1fonts
index 0aa9ff538f0..692fe2dcf32 100644
--- a/Build/source/texk/xdvik/README.t1fonts
+++ b/Build/source/texk/xdvik/README.t1fonts
@@ -1,30 +1,31 @@
-README for using Postscript Type1 fonts with xdvik
-==================================================
+README for using PostScript Type 1 fonts with xdvik
+===================================================
-Starting from version 22.39, xdvik supports direct display of
-Postscript Type1 fonts via t1lib. Unlike the bitmapped TeX PK fonts
-that xdvik used to depend upon, Type1 fonts only need to be stored in
+Starting with version 22.86, xdvik supports direct display of
+PostScript Type 1 fonts using freetype (version 2). (Prior versions used
+t1lib, which is no longer supported.) Unlike the bitmapped TeX PK fonts
+that xdvik used to depend upon, Type 1 fonts only need to be stored in
one size on disk. This means no more waiting for mktexpk runs when
viewing DVI files with previously unused fonts or at a different
resolution, less hassle with temporary directories filling up with
PK files, etc.
-To be able to support Type1 fonts, xdvi needs a xdvi.cfg file. The
-standard `make install' process will copy the file from texmf/xdvi.cfg
-which is suitable for recent teTeX distributions (starting from teTeX
->= 1.0). (If the file exists already and has been modified from the
+To be able to support Type 1 fonts, xdvi uses a config.xdvi file. The
+standard `make install' process will copy the file from texmf/config.xdvi
+which is suitable for recent TeX Live distributions.
+(If the file exists already and has been modified from the
original, the modified file will not be overwritten). Apart from the
section `Debugging your font setup', this README contains mostly
instructions for versions of teTeX older than 1.0.x or non-teTeX
-systems; users of teTeX >= 1.0.x should ignore these instructions,
+systems; users of teTeX >= 1.0.x and TeX Live should ignore these instructions,
and only consult the `Debugging' section in case of problems with
-the Type1 fonts setup.
+the Type 1 fonts setup.
Note that xdvi can always use a TeX bitmap (PK) font as a fallback
(produced via mktexpk, which in turn invokes ps2pk or gsftopk), so
-it's not vital that xdvi is configured for Type1 fonts. However, for
-the reasons mentioned above, setting up xdvi properly for Type1 fonts
+it's not vital that xdvi is configured for Type 1 fonts. However, for
+the reasons mentioned above, setting up xdvi properly for Type 1 fonts
is usually preferable.
@@ -33,35 +34,13 @@ Instructions for users of older teTeX versions (< 1.0), or
non-teTeX systems:
==========================================================
-Xdvi needs to load all Type1 fonts from disk, which means that it
+Xdvi needs to load all Type 1 fonts from disk, which means that it
(just like dvips) needs to translate the TeX names for fonts to
filenames, load encoding vectors according to map files and so on.
-But unlike dvips, which produces Postscript code for printers with
-built-in fonts, xdvi has _no_ builtin fonts, and thus cannot share
-all font maps with dvips.
-The main difference is that fontmaps for xdvi always need to contain
-the name of a `real' Type1 font file (a .pfa or .pfb file) at the end
-of the line, e.g. `utmr8a.pfb' in the following case:
-
- ptmr8r NimbusRomNo9L-Regu "TeXBase1Encoding ReEncodeFont" <8r.enc <utmr8a.pfb
-
-whereas dvips would only need the font file name for embedding the font
-into the PS file; otherwise, the font will be treated as `printer
-resident'.
-
-If you don't want to use Type1 fonts, simply create a empty xdvi.cfg
-file in the location pointed to by the XDVIINPUTS environment variable
-(this variable can also be defined in texmf.cnf).
-
-Otherwise, the xdvi.cfg file should list the map files (.map extension)
-that can be used by xdvi. The file `xdvi.cfg' in the texk/xdvik/texmf-alt/
-subdirectory of the xdvik distribution contains a default configuration
-that can be used for your own customizations. The xdvi.cfg file
-installed by the standard `make install' process is only suitable for
-more recent versions of teTeX, as mentioned above, so you'll need to
-copy this file manually into the directory pointed to by XDVIINPUTS.
-
-The sections `Fontmap file format' below and the dvips documentation
+This process is governed by fontmap files, which use the same format
+as dvips.
+
+The section `Fontmap file format' below and the dvips documentation
contain more information on the fontmap file format.
@@ -71,35 +50,32 @@ Font Search Order
The order in which xdvi tries to load a font file is:
1. Virtual fonts
-2. Type1 fonts
+2. Type 1 fonts
3. PK fonts
4. (If xdvi was compiled with gf support:) GF fonts
For example, consider the search for TeX's default font `cmr10'. In
-most texk/teTeX installations the file cmr10.pfb is present in the
+most texk/TeX Live installations the file cmr10.pfb is present in the
texmf tree. This means that it is found at step 2 in the search and
-the Type1 font is used. Currently xdvi handles fonts with no
+the Type 1 font is used. Currently xdvi handles fonts with no
"implied" encoding (such as cmr10) without configuration. Most texk and
-teTeX installations come with the Blue Sky Research/Y&Y Type1 versions
-of Knuths fonts, and xdvi will be able to use them with no further
+TeX Live installations come with the Blue Sky Research/Y&Y Type 1 versions
+of Knuth's fonts, and xdvi will be able to use them with no further
action.
-For fonts with an "implicit" encoding such as ptmr8r (Postscript Times
-Roman, 8r encoded), xdvi also needs to know about the 8r encoding,
-and be able to find a Type1 font file called ptmr (ptmr.pfa or
-ptmr.pfb). The file xdvi.cfg contains a list of these encodings and
-the corresponding dvips encoding files, which can be used by xdvi
-as well.
-
-The 35 `standard Postscript fonts', such as Times Roman, are are
+The 35 `standard PostScript fonts', such as Times Roman, are are
usually available under a different name for previewing the file with
-ghostscript. These font files can be used by xdvi, too, but they need
-to be copied to a place where xdvi can find them. This is already
-the case by default in newer TeX distributions such as teTeX-beta or
-teTeX >= 1.0 or TeXLive >= 6b. Users of older systems can use the
+ghostscript. These font files can be used by xdvi, too, and xdvi mimics
+ghostscript's process for finding them. However, this is usually unnecessary,
+since TeX Live comes with fonts that can be used in place of those provided
+with ghostscript.
+
+As an alternative, these 35 fonts to be copied to a place where xdvi
+can find them. Users of older systems can use the
`t1mapper' script to copy/symlink the required files to a directory
where xdvi can find them; please see the file README.t1mapper and the
-manual page of t1mapper for more information.
+manual page of t1mapper for more information. This support may be dropped
+in later versions of xdvi.
===================
@@ -113,42 +89,43 @@ section of the dvips manual (dvips.{texi,dvi,pdf}).
Xdvi accepts fontmaps that obey these rules:
-1. The vector files must have a .enc extention or be included by the
+1. The encoding files must have a .enc extention or be included by the
<[ ... syntax in the fontmap. Encoding is optional. The ReEncodeFont
keyword and its argument is tolerated, but it is _ignored_. xdvi
looks for a <foo.enc or <[foo to determine the encoding vector, and
re-encode the font.
2. The other file in the map line must be a font file in pfa or pfb
- format. The extention need not be included for the sake of xdvi,
- but dvips and pdftex might need it, so better include it when using
- shared fontmap files. An explicit font file name is required by
- xdvi since xdvi does not have any builtin fonts.
+ format. The extension need not be included for the sake of xdvi,
+ but dvips and pdftex might need it, so it is better to include it when
+ using shared fontmap files.
3. There may not be any other input files on a fontmap line.
Xdvi is not a printer and cannot accept arbitrary postscript
- prologues or setup things in fontmaps.
+ prologues or set up things in fontmaps.
4. Xdvi decodes the ExtendFont and SlantFont commands in the quoted
- postscript code and the extention factor and slanting is applied
+ postscript code and the extension factor and slanting is applied
to the font when displayed. Any other magic done by the quoted
- postscript code won't be understood by xdvi.
+ PostScript code won't be understood by xdvi.
=========================
Debugging your font setup
=========================
-If your Type1 font setup doesn't work, please check the following:
+If your Type 1 font setup doesn't work, please check the following:
-1. Make sure that xdvi finds your xdvi.cfg file (it will print a warning
- to stderr if it doesn't). The file should be located in a directory
- referenced by the XDVIINPUTS variable, which can be either set in your
- shell environment, or in your texmf.cnf file.
+1. Make sure that xdvi finds your config.xdvi file (this file is optional;
+ by default it will use the same map files as dvips lists in its config.ps
+ file). If you use it, the file should be located in a directory
+ referenced by the TEXINPUTS variable, which can be either set in your
+ shell environment, or in your texmf.cnf file. This directory is generally
+ something ending in texmf/dvips/config or texmf-dist/dvips/config .
-2. Make sure that xdvi can find the map files listed in your xdvi.cfg
- file (in the `dvipsmap' entries). Use the `-debug 3968' option for
+2. Make sure that xdvi can find the map files listed in your config.xdvi
+ file, or in config.ps. Use the `-debug 3968' option for
xdvi to see where it searches for the files. E.g., with the (ba)sh
shell:
@@ -156,13 +133,15 @@ If your Type1 font setup doesn't work, please check the following:
For a successful search, the end of the grep'ed output should
look like this:
- kdebug:fopen(/some/paht/xyz.map, r) => 0x81cccd8
+ kdebug:fopen(/some/path/xyz.map, r) => 0x81cccd8
If the search is not successful, look at the debugging output in
more detail, checking which variable settings contribute to the
path where a file is searched.
-3. Make sure that xdvi finds the Type1 versions of your fonts. E.g.
+ Generally, if you have problems here, then you also have them with dvips.
+
+3. Make sure that xdvi finds the Type 1 versions of your fonts. E.g.
if your texmf tree is located in /usr/local/share/texmf,
for a minimal LaTeX file like
@@ -171,7 +150,7 @@ If your Type1 font setup doesn't work, please check the following:
the command
$ xdvi -debug 3968 ~/test.dvi 2>&1 | grep cmr10.pfb
-
+
should contain a line at the bottom that looks similar to this:
kdebug:search(cmr10.pfb) => /usr/local/share/texmf/fonts/type1/bluesky/cm/cmr10.pfb
@@ -179,7 +158,7 @@ If your Type1 font setup doesn't work, please check the following:
texmf.cnf file if this doesn't work.
-See also kpathsea.dvi and TETEXDOC.dvi for more information on the
+See also kpathsea.pdf and texlive-en.pdf for more information on the
how kpathsea works.
@@ -197,10 +176,10 @@ Some common sources of problems:
/usr/share/texmf/web2c/
and the search path contains
{$SELFAUTOLOC,$SELFAUTODIR,$SELFAUTOPARENT}{,{/share,}/texmf{-local,}/web2c}:
- then xdvi.bin should be contained 2 directories below
+ then xdvi.bin should be contained two directories below
/usr, e.g. in /usr/local/bin/xdvi.bin. ($SELFAUTOPARENT is
a misnomer in that it actually denotes the grand-parent
- of the current directory, i.e. 2 levels up in the directory
+ of the current directory, i.e. two levels up in the directory
hierarchy).
As a fix, either set XDVIINPUTS in your shell environment, or install
diff --git a/Build/source/texk/xdvik/ac/withenable.ac b/Build/source/texk/xdvik/ac/withenable.ac
index 2308645ab27..35efd6831e5 100644
--- a/Build/source/texk/xdvik/ac/withenable.ac
+++ b/Build/source/texk/xdvik/ac/withenable.ac
@@ -1,10 +1,10 @@
## texk/xdvik/ac/withenable.ac: configure.ac fragment for the TeX Live subdirectory texk/xdvik/
dnl
-dnl Copyright (C) 2009, 2010 Peter Breitenlohner <tex-live@tug.org>
+dnl Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
dnl You may freely use, modify and/or distribute this file.
dnl
dnl extra_dirs = texk/xdvik/squeeze
dnl
## configure options and TL libraries required for xdvik
-KPSE_ENABLE_PROG([xdvik], [kpathsea t1lib], [x])
+KPSE_ENABLE_PROG([xdvik], [kpathsea freetype2], [x])
m4_include(kpse_TL[texk/xdvik/ac/xdvik.ac])
diff --git a/Build/source/texk/xdvik/aclocal.m4 b/Build/source/texk/xdvik/aclocal.m4
index 4bf48b38403..431725b45d2 100644
--- a/Build/source/texk/xdvik/aclocal.m4
+++ b/Build/source/texk/xdvik/aclocal.m4
@@ -1045,13 +1045,16 @@ m4_include([m4/xdvi-func-memicmp.m4])
m4_include([m4/xdvi-func-poll.m4])
m4_include([m4/xdvi-func-setsid-in-fork.m4])
m4_include([m4/xdvi-func-working-vsnprintf.m4])
+m4_include([m4/xdvi-func-xkbbell.m4])
+m4_include([m4/xdvi-gs-lib-path.m4])
m4_include([m4/xdvi-linker-multiple-defns.m4])
m4_include([m4/xdvi-sys-old-linux.m4])
m4_include([m4/xdvi-sys-streams.m4])
m4_include([../../m4/kpse-common.m4])
+m4_include([../../m4/kpse-freetype2-flags.m4])
m4_include([../../m4/kpse-kpathsea-flags.m4])
-m4_include([../../m4/kpse-t1lib-flags.m4])
m4_include([../../m4/kpse-warnings.m4])
+m4_include([../../m4/kpse-zlib-flags.m4])
m4_include([../../m4/libtool.m4])
m4_include([../../m4/ltoptions.m4])
m4_include([../../m4/ltsugar.m4])
diff --git a/Build/source/texk/xdvik/c-auto.in b/Build/source/texk/xdvik/c-auto.in
index 5902786d47b..43242a9321e 100644
--- a/Build/source/texk/xdvik/c-auto.in
+++ b/Build/source/texk/xdvik/c-auto.in
@@ -30,6 +30,9 @@
/* Define to point to the default command to use for printing (optional). */
#undef DEFAULT_DVIPS_PATH
+/* Define to set the default path for ghostscript-style font searching. */
+#undef DEFAULT_GS_LIB_PATH
+
/* Define to point to the default command to use for printing (optional). */
#undef DEFAULT_PS2PDF_PATH
@@ -37,6 +40,9 @@
necessary. */
#undef FLAKY_SIGPOLL
+/* Define to compile in the FreeType2 library. */
+#undef FREETYPE
+
/* Define to enable greyscale anti-aliasing for shrunken bitmaps. */
#undef GREY
@@ -305,6 +311,9 @@
/* Define if you have the <X11/xpm.h> header file. */
#undef HAVE_X11_XPM_H
+/* Define if your system has XkbBell(). */
+#undef HAVE_XKB_BELL_EXT
+
/* Define to 1 if you have the <Xm/XpmP.h> header file. */
#undef HAVE_XM_XPMP_H
@@ -375,9 +384,6 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
-/* Define to compile in t1lib. */
-#undef T1LIB
-
/* Define to use Xaw panner. */
#undef USE_XAW_PANNER
diff --git a/Build/source/texk/xdvik/common.am b/Build/source/texk/xdvik/common.am
index 85c55f5bcd6..e438eed6654 100644
--- a/Build/source/texk/xdvik/common.am
+++ b/Build/source/texk/xdvik/common.am
@@ -1,11 +1,11 @@
## texk/xdvik/common.am: Makefile fragment for the TeX Live subdirectory texk/xdvik/
##
-## Copyright (C) 2009 Peter Breitenlohner <tex-live@tug.org>
+## Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
##
## Make `#include <X11/...>' work.
x_cppflags = $(X_CFLAGS) $(iconv_includes)
-common_includes = $(PS_DEF) $(KPATHSEA_INCLUDES) $(T1LIB_INCLUDES) $(x_cppflags)
+common_includes = $(PS_DEF) $(KPATHSEA_INCLUDES) $(FREETYPE2_INCLUDES) $(x_cppflags)
## Make `-lX...' work. Follow the library order used in X11R6 itself.
##
@@ -19,9 +19,9 @@ x_extra_libs = $(X_EXTRA_LIBS) $(iconv_libs)
xdvi_x_libs = $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt $(X_PRE_LIBS)
xdvi_x_libs += $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs)
-common_ldadd = $(KPATHSEA_LIBS) $(T1LIB_LIBS) $(xdvi_x_libs)
+common_ldadd = $(KPATHSEA_LIBS) $(FREETYPE2_LIBS) $(xdvi_x_libs)
-common_dependencies = $(KPATHSEA_DEPEND) $(T1LIB_DEPEND)
+common_dependencies = $(KPATHSEA_DEPEND) $(FREETYPE2_DEPEND)
## Dependencies for libxdvi.a
##
@@ -29,6 +29,6 @@ libxdvi_dependencies = ${top_srcdir}/*.[ch] ${top_srcdir}/gui/*.[ch] ${top_build
## Rebuild libkpathsea
@KPATHSEA_RULE@
-## Rebuild libt1
-@T1LIB_RULE@
+## Rebuild freetype2
+@FREETYPE2_RULE@
diff --git a/Build/source/texk/xdvik/configure b/Build/source/texk/xdvik/configure
index ba737fb566d..95cb39f6711 100755
--- a/Build/source/texk/xdvik/configure
+++ b/Build/source/texk/xdvik/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xdvik 22.85.
+# Generated by GNU Autoconf 2.69 for xdvik 22.86.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -590,8 +590,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='xdvik'
PACKAGE_TARNAME='xdvik'
-PACKAGE_VERSION='22.85'
-PACKAGE_STRING='xdvik 22.85'
+PACKAGE_VERSION='22.86'
+PACKAGE_STRING='xdvik 22.86'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -638,10 +638,15 @@ am__EXEEXT_TRUE
LTLIBOBJS
subdirs
XDVIK_VERSION
-T1LIB_RULE
-T1LIB_DEPEND
-T1LIB_LIBS
-T1LIB_INCLUDES
+FREETYPE2_RULE
+FREETYPE2_DEPEND
+FREETYPE2_LIBS
+FREETYPE2_INCLUDES
+FT2_CONFIG
+ZLIB_RULE
+ZLIB_DEPEND
+ZLIB_LIBS
+ZLIB_INCLUDES
KPATHSEA_RULE
KPATHSEA_DEPEND
KPATHSEA_LIBS
@@ -811,9 +816,11 @@ with_motif_libdir
with_system_kpathsea
with_kpathsea_includes
with_kpathsea_libdir
-with_system_t1lib
-with_t1lib_includes
-with_t1lib_libdir
+with_system_zlib
+with_zlib_includes
+with_zlib_libdir
+with_system_freetype2
+with_default_gs_lib_path
with_default_dvips_path
with_default_ps2pdf_path
'
@@ -1367,7 +1374,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures xdvik 22.85 to adapt to many kinds of systems.
+\`configure' configures xdvik 22.86 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1441,7 +1448,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of xdvik 22.85:";;
+ short | recursive ) echo "Configuration of xdvik 22.86:";;
esac
cat <<\_ACEOF
@@ -1502,10 +1509,14 @@ Optional Packages:
kpathsea headers installed in DIR
--with-kpathsea-libdir=DIR
kpathsea library installed in DIR
- --with-system-t1lib use installed t1lib headers and library
- --with-t1lib-includes=DIR
- t1lib headers installed in DIR
- --with-t1lib-libdir=DIR t1lib library installed in DIR
+ --with-system-zlib use installed zlib headers and library
+ --with-zlib-includes=DIR
+ zlib headers installed in DIR
+ --with-zlib-libdir=DIR zlib library installed in DIR
+ --with-system-freetype2 use installed freetype2 headers and library
+ (requires freetype-config)
+ --with-default-gs-lib-path=PATH
+ set default path for finding font aliases to PATH
--with-default-dvips-path=CMD
Use CMD as default DVI to PS converter
--with-default-ps2pdf-path=CMD
@@ -1588,7 +1599,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-xdvik configure 22.85
+xdvik configure 22.86
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2381,7 +2392,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by xdvik $as_me 22.85, which was
+It was created by xdvik $as_me 22.86, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -7812,7 +7823,7 @@ fi
# Define the identity of the package.
PACKAGE='xdvik'
- VERSION='22.85'
+ VERSION='22.86'
cat >>confdefs.h <<_ACEOF
@@ -13172,7 +13183,7 @@ $as_echo "#define COLOR 1" >>confdefs.h
-$as_echo "#define T1LIB 1" >>confdefs.h
+$as_echo "#define FREETYPE 1" >>confdefs.h
@@ -15104,6 +15115,48 @@ done
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for XKB Bell extension" >&5
+$as_echo_n "checking for XKB Bell extension... " >&6; }
+if ${xdvi_cv_func_xkb_bell+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ xdvi_save_LIBS=$LIBS
+LIBS="$X_PRE_LIBS"" $LIBS $X_LIBS -lX11"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <X11/X.h>
+#include <X11/XKBlib.h> /* has the prototype */
+
+int
+main ()
+{
+
+ Atom y;
+ XkbBell((Display *)0, (Window)0, 0, y);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ xdvi_cv_func_xkb_bell=yes
+else
+ xdvi_cv_func_xkb_bell=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$xdvi_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xdvi_cv_func_xkb_bell" >&5
+$as_echo "$xdvi_cv_func_xkb_bell" >&6; }
+if test "$xdvi_cv_func_xkb_bell" = yes; then
+ X_PRE_LIBS="$X_PRE_LIBS"
+
+$as_echo "#define HAVE_XKB_BELL_EXT 1" >>confdefs.h
+
+fi
+
@@ -15856,7 +15909,7 @@ fi
# Check for libXp.
# Although libXp is now defunct (no longer part of XOrg), older versions
# of libXm may need to link with libXp; same for the equally defunct libXaw8.
-# We certainly don't want to include libXp unless necessay, since this might
+# We certainly don't want to include libXp unless necessary, since this might
# only perpetuate the need to keep libXp.so around.
# Moreover for ELF shared libraries a requirement for libXp.so is probably
# encoded into libXm.so and/or libXaw.so and need not be specified explicitly.
@@ -16967,7 +17020,7 @@ Usage: $0 [OPTIONS]
Report bugs to <bug-libtool@gnu.org>."
lt_cl_version="\
-xdvik config.lt 22.85
+xdvik config.lt 22.86
configured by $0, generated by GNU Autoconf 2.69.
Copyright (C) 2011 Free Software Foundation, Inc.
@@ -18012,39 +18065,197 @@ if test "x$kpse_cv_kpse_debug" != xyes; then :
KPATHSEA_INCLUDES="$KPATHSEA_INCLUDES -DNO_DEBUG"
fi
-## _KPSE_LIB_FLAGS: Setup t1lib (-lt1) flags
+## _KPSE_LIB_FLAGS: Setup zlib (-lz) flags
+
+# Check whether --with-system-zlib was given.
+if test "${with_system_zlib+set}" = set; then :
+ withval=$with_system_zlib;
+fi
+
+# Check whether --with-zlib-includes was given.
+if test "${with_zlib_includes+set}" = set; then :
+ withval=$with_zlib_includes;
+fi
+
+# Check whether --with-zlib-libdir was given.
+if test "${with_zlib_libdir+set}" = set; then :
+ withval=$with_zlib_libdir;
+fi
+if test "x$with_system_zlib" = xyes; then
+ if test "x$with_zlib_includes" != x && test "x$with_zlib_includes" != xyes; then
+ ZLIB_INCLUDES="-I$with_zlib_includes"
+fi
+ZLIB_LIBS="-lz"
+if test "x$with_zlib_libdir" != x && test "x$with_zlib_libdir" != xyes; then
+ ZLIB_LIBS="-L$with_zlib_libdir $ZLIB_LIBS"
+fi
+else
+ ZLIB_INCLUDES="-I$kpse_BLD/libs/zlib/include"
+ ZLIB_LIBS="$kpse_BLD/libs/zlib/libz.a"
+ ZLIB_DEPEND='${top_builddir}/../../libs/zlib/libz.a'
+ ZLIB_RULE='# Rebuild libz
+$(ZLIB_DEPEND): ${top_builddir}/../../libs/zlib/include/zconf.h
+ cd ${top_builddir}/../../libs/zlib && $(MAKE) $(AM_MAKEFLAGS) rebuild
+${top_builddir}/../../libs/zlib/include/zconf.h:
+ cd ${top_builddir}/../../libs/zlib && $(MAKE) $(AM_MAKEFLAGS) rebuild'
+fi
+
+## _KPSE_LIB_FLAGS: Setup freetype2 (-lfreetype) flags
+
+# Check whether --with-system-freetype2 was given.
+if test "${with_system_freetype2+set}" = set; then :
+ withval=$with_system_freetype2;
+fi
+if test "x$with_system_freetype2" = xyes; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}freetype-config", so it can be a program name with args.
+set dummy ${ac_tool_prefix}freetype-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_FT2_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$FT2_CONFIG"; then
+ ac_cv_prog_FT2_CONFIG="$FT2_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_FT2_CONFIG="${ac_tool_prefix}freetype-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+FT2_CONFIG=$ac_cv_prog_FT2_CONFIG
+if test -n "$FT2_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FT2_CONFIG" >&5
+$as_echo "$FT2_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
-# Check whether --with-system-t1lib was given.
-if test "${with_system_t1lib+set}" = set; then :
- withval=$with_system_t1lib;
fi
+if test -z "$ac_cv_prog_FT2_CONFIG"; then
+ ac_ct_FT2_CONFIG=$FT2_CONFIG
+ # Extract the first word of "freetype-config", so it can be a program name with args.
+set dummy freetype-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_FT2_CONFIG+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_FT2_CONFIG"; then
+ ac_cv_prog_ac_ct_FT2_CONFIG="$ac_ct_FT2_CONFIG" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_FT2_CONFIG="freetype-config"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
-# Check whether --with-t1lib-includes was given.
-if test "${with_t1lib_includes+set}" = set; then :
- withval=$with_t1lib_includes;
+fi
+fi
+ac_ct_FT2_CONFIG=$ac_cv_prog_ac_ct_FT2_CONFIG
+if test -n "$ac_ct_FT2_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_FT2_CONFIG" >&5
+$as_echo "$ac_ct_FT2_CONFIG" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
-# Check whether --with-t1lib-libdir was given.
-if test "${with_t1lib_libdir+set}" = set; then :
- withval=$with_t1lib_libdir;
+ if test "x$ac_ct_FT2_CONFIG" = x; then
+ FT2_CONFIG="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ FT2_CONFIG=$ac_ct_FT2_CONFIG
+ fi
+else
+ FT2_CONFIG="$ac_cv_prog_FT2_CONFIG"
fi
-if test "x$with_system_t1lib" = xyes; then
- if test "x$with_t1lib_includes" != x && test "x$with_t1lib_includes" != xyes; then
- T1LIB_INCLUDES="-I$with_t1lib_includes"
+if $FT2_CONFIG --ftversion >/dev/null 2>&1; then
+ FREETYPE2_INCLUDES=`$FT2_CONFIG --cflags`
+ FREETYPE2_LIBS=`$FT2_CONFIG --libs`
+elif test "x$need_freetype2:$with_system_freetype2" = xyes:yes; then
+ as_fn_error $? "did not find freetype-config required for system freetype2 library" "$LINENO" 5
fi
-T1LIB_LIBS="-lt1"
-if test "x$with_t1lib_libdir" != x && test "x$with_t1lib_libdir" != xyes; then
- T1LIB_LIBS="-L$with_t1lib_libdir $T1LIB_LIBS"
+else
+ FREETYPE2_INCLUDES="-I$kpse_BLD/libs/freetype2/freetype2 -I$kpse_BLD/libs/freetype2"
+ FREETYPE2_LIBS="$kpse_BLD/libs/freetype2/libfreetype.la"
+ FREETYPE2_DEPEND='${top_builddir}/../../libs/freetype2/libfreetype.la'
+ FREETYPE2_RULE='# Rebuild libfreetype
+$(FREETYPE2_DEPEND): ${top_builddir}/../../libs/freetype2/ft2build.h
+ cd ${top_builddir}/../../libs/freetype2 && $(MAKE) $(AM_MAKEFLAGS) rebuild
+${top_builddir}/../../libs/freetype2/ft2build.h:
+ cd ${top_builddir}/../../libs/freetype2 && $(MAKE) $(AM_MAKEFLAGS) rebuild'
fi
+
+
+
+# Check whether --with-default-gs-lib-path was given.
+if test "${with_default_gs_lib_path+set}" = set; then :
+ withval=$with_default_gs_lib_path;
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_GS_LIB_PATH "$withval"
+_ACEOF
+
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for the path to be used for Ghostscript searches" >&5
+$as_echo_n "checking for the path to be used for Ghostscript searches... " >&6; }
+if ${xdvi_cv_gs_lib_path+:} false; then :
+ $as_echo_n "(cached) " >&6
else
- T1LIB_INCLUDES="-I$kpse_BLD/libs/t1lib"
- T1LIB_LIBS="$kpse_BLD/libs/t1lib/libt1.a"
- T1LIB_DEPEND='${top_builddir}/../../libs/t1lib/libt1.a'
- T1LIB_RULE='# Rebuild libt1
-$(T1LIB_DEPEND): ${top_builddir}/../../libs/t1lib/t1lib.h
- cd ${top_builddir}/../../libs/t1lib && $(MAKE) $(AM_MAKEFLAGS) rebuild
-${top_builddir}/../../libs/t1lib/t1lib.h:
- cd ${top_builddir}/../../libs/t1lib && $(MAKE) $(AM_MAKEFLAGS) rebuild'
+ if gs -h >/dev/null 2>&1; then
+ ac_tmp="`gs -h \
+ | sed \
+ -e '1,/Search path:/d' \
+ -e '/For more information/,$d' \
+ -e '/Initialization files are compiled/d' \
+ -e 's/$/\/\/\//' \
+ -e 's/^ //' \
+ | tr '\n' '/'`"
+ # Solaris 9 sed doesn't handle incomplete lines at eof
+ xdvi_cv_gs_lib_path=`echo "$ac_tmp" \
+ | sed -e 's/\/\/\/\// /g' -e 's/ *$//' -e 's/ : /:/g'`
+else
+ xdvi_cv_gs_lib_path=/usr/local/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/ghostscript/fonts:/var/lib/ghostscript/fonts:/usr/share/cups/fonts:/usr/share/fonts
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not determine Ghostscript search path; using $xdvi_cv_gs_lib_path" >&5
+$as_echo "$as_me: WARNING: Could not determine Ghostscript search path; using $xdvi_cv_gs_lib_path" >&2;}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xdvi_cv_gs_lib_path" >&5
+$as_echo "$xdvi_cv_gs_lib_path" >&6; }
+cat >>confdefs.h <<_ACEOF
+#define DEFAULT_GS_LIB_PATH "$xdvi_cv_gs_lib_path"
+_ACEOF
+
+
fi
@@ -18128,7 +18339,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-XDVIK_VERSION=22.85
+XDVIK_VERSION=22.86
@@ -18679,7 +18890,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by xdvik $as_me 22.85, which was
+This file was extended by xdvik $as_me 22.86, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -18745,7 +18956,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-xdvik config.status 22.85
+xdvik config.status 22.86
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/texk/xdvik/configure.ac b/Build/source/texk/xdvik/configure.ac
index cfce7a9a7af..c7955789c76 100644
--- a/Build/source/texk/xdvik/configure.ac
+++ b/Build/source/texk/xdvik/configure.ac
@@ -1,12 +1,12 @@
dnl Process this file with autoconf to produce a configure script.
dnl
-dnl Copyright (C) 2009-2012 Peter Breitenlohner <tex-live@tug.org>
+dnl Copyright (C) 2009-2013 Peter Breitenlohner <tex-live@tug.org>
dnl
dnl This file is free software; the copyright holder
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
dnl
-m4_define([xdvik_version], [22.85])
+m4_define([xdvik_version], [22.86])
AC_INIT([xdvik], xdvik_version, [tex-k@tug.org])
AC_PREREQ([2.65])
AC_CONFIG_SRCDIR([xdvi.c])
@@ -50,10 +50,10 @@ dnl [Disable support for color specials]))
AC_DEFINE([COLOR], 1, [Define to enable support for color specials.])
dnl Required, not optional.
-dnl AC_ARG_ENABLE([t1lib],
-dnl AS_HELP_STRING([--disable-t1lib],
-dnl [Do not use T1lib (direct rendering of Type1 fonts)]))
-AC_DEFINE([T1LIB], 1, [Define to compile in t1lib.])
+dnl AC_ARG_ENABLE([freetype],
+dnl AS_HELP_STRING([--disable-freetype],
+dnl [Do not use FreeType2 (direct rendering of Type1 fonts)]))
+AC_DEFINE([FREETYPE], 1, [Define to compile in the FreeType2 library.])
dnl OBSOLETE AC_ARG_ENABLE([gf],
dnl OBSOLETE AS_HELP_STRING([--enable-gf],
@@ -87,6 +87,7 @@ XDVI_C_BITMAP_TYPE
XDVI_SYS_STREAMS
XDVI_SYS_OLD_LINUX
XDVI_FUNC_POLL
+XDVI_FUNC_XKB_BELL
dnl #######
@@ -178,7 +179,7 @@ AC_SUBST([x_ext_lib])
# Check for libXp.
# Although libXp is now defunct (no longer part of XOrg), older versions
# of libXm may need to link with libXp; same for the equally defunct libXaw8.
-# We certainly don't want to include libXp unless necessay, since this might
+# We certainly don't want to include libXp unless necessary, since this might
# only perpetuate the need to keep libXp.so around.
# Moreover for ELF shared libraries a requirement for libXp.so is probably
# encoded into libXm.so and/or libXaw.so and need not be specified explicitly.
@@ -260,7 +261,9 @@ elif echo "$PS_DEF" | grep PS_NEWS >/dev/null; then
fi
KPSE_KPATHSEA_FLAGS
-KPSE_T1LIB_FLAGS
+KPSE_FREETYPE2_FLAGS
+
+XDVI_GS_LIB_PATH
KPSE_ADD_FLAGS([kpathsea])
diff --git a/Build/source/texk/xdvik/dvi-draw.c b/Build/source/texk/xdvik/dvi-draw.c
index 867744c2413..faed476097a 100644
--- a/Build/source/texk/xdvik/dvi-draw.c
+++ b/Build/source/texk/xdvik/dvi-draw.c
@@ -1,6 +1,6 @@
/* The rest of the code has the following copyright:
-Copyright (c) 1990-2004 Paul Vojta and others
+Copyright (c) 1990-2013 Paul Vojta and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -52,11 +52,10 @@ in xdvi.c.
#include "x_util.h"
#include "events.h"
#include "dvi-init.h"
+#include "font-open.h"
#include "statusline.h"
#include "hypertex.h"
#include "special.h"
-#include "tfmload.h"
-#include "read-mapfile.h"
#include "my-snprintf.h"
#include "kpathsea/tex-file.h"
#include "mag.h"
@@ -68,6 +67,11 @@ in xdvi.c.
#include "pagesel.h"
#include "pagehist.h"
+#if FREETYPE
+ /* other freetype includes are already done in dvi-init.h */
+# include FT_TYPE1_TABLES_H
+#endif
+
#ifdef RGB_ANTI_ALIASING
#define TRACE_AA 0
#define TRACE_AA1 1
@@ -108,19 +112,6 @@ in xdvi.c.
#define G_OFFSET_X (resource.xoffset_int << 16) + (3 << 15)
#define G_OFFSET_Y (resource.yoffset_int << 16) + (3 << 15)
-#ifdef T1LIB
-/* hashing stuff to speed up checking whether a font or tfminfo file
- has already been loaded.
-*/
-#define T1FONTS_INITIAL_HASHTABLE_SIZE 1031
-static hashTableT t1fonts_hash;
-static hashTableT tfminfo_hash;
-static hashTableT fontmaps_hash;
-/* static hashTableT font_warn_hash; */
-
-typedef enum { FAILURE_BLANK = -2, FAILURE_PK = -1, SUCCESS = 0 } t1FontLoadStatusT;
-#endif
-
#if PS
int scanned_page_ps;
int scanned_page_ps_bak;
@@ -137,433 +128,6 @@ Boolean htex_inside_href = False; /* whether we're inside a href */
Boolean drawing_mag = False;
-#ifdef T1LIB
-
-# include "t1lib.h"
-
-/* Datastructures:
-
-encodings[n]: Loaded from map file
-[0] = 8r, <vector>
-[1] = 8c, <vector>
-
-The vectors are demand-loaded in 'load_encoded_font'
-*/
-
-struct encoding {
- char *enc; /* This may be NULL. From dvips maps we get
- encodings loaded by filename, and no name given */
- char *file;
- char **vector;
-};
-
-static struct encoding *encodings = NULL; /* Dynamic array = realloc when it gets full */
-static size_t enclidx = 0; /* global, for communication with find_T1_font */
-
-/*
- t1fonts[n]: Built as xdvi loads t1 fonts
- idx file short t1id loaded
- [0] = /path/cmr10.pfb, cmr10 0 1
- [1] = /path/prmr.pfa, prmr 1 0
- [2] = /path/pcrr8a.pfa, pcrr8a 2 0
-
- This array enumerates the loaded t1 fonts by full path name.
- The integer `t1id' is the t1lib font id. The font will not be
- extended/slanted/encoded. The `loaded' field indicates if
- T1_LoadFont has been called for the font yet. Texfonts that need a
- modified version of the t1 font must use T1_CopyFont to copy the
- raw font and obtain the id of a new t1 font which can then be
- modified. As described in the t1 docs a font must be loaded before
- it can be copied.
-
- Fonts that are copies of other fonts have NULL filenames. If any
- font files are to be reused based on the file name, the raw font
- must be reused, not a copy.
-
- The `short' field contains the font as it was identified in the
- fontmap. This is used to save searching; if two fonts are
- identified the same way in the fontmap, they are the same font.
-
-*/
-
-struct t1font_info {
- char *file;
- char *shortname;
- int t1id;
- int loaded;
-};
-
-static struct t1font_info *t1fonts = NULL; /* Dynamic array */
-
-/*
- fontmaps[n]: Loaded from map file, and extended with 'implied'
- fonts as needed.
- idx texname enc exten. slant filena. t1libid pathn. tfmidx
- [0] = pcrr8rn 0 750 0 pcrr8a 2 ... 2
- [1] = putro8r 0 0 0 putro8r 3 ... 3
-
- The first 5 fields of this table are loaded from the font map
- files, or filled out with default values when implied fonts are
- set-up. The t1libid is -1 until the font is loaded or copied as
- described under t1fonts. Once the dvi file reveals that the font
- is needed, it is located on disk to ensure it exists, and the
- pathname field is filled out. The t1 font is not loaded or
- copied before it's needed because set_t1_char has been called to
- draw a glyph from the font. The late loading is necessiated by the
- high cost of loading fonts. If the font loading is concentrated at
- startup of the program the startup-time becomes ecessively high due
- to the high number of fonts used by the average LaTeX document.
-
- A value of 0 for `extension'/`slant' means no extension/slant. If
- the input values are decimal (less than 10) they're multiplied by
- 1000 and 10000 respectively to obtain fixed-point integer values.
- (This means that xdvi will translate entries like `0.81' to 810.)
- Integer values have the advantage that they can be tested for
- exact equality on all architectures.
-*/
-
-struct fontmap {
- char *texname;
- int enc; /* Index in encoding array */
- int extension; /* Fixed point, *1000 */
- int slant; /* Fixed point, *10000, some font slantings have 4
- significant digits, all after the decimalpoint */
- char *filename; /* Name of the t1 font file as given in map/dvi */
-
- int t1libid; /* The t1lib id of this font, or -1 if not set up */
- char *pathname; /* Full path of the font, once needed and located */
- int tfmidx; /* Index in tfminfo array, or -1 */
- Boolean warned_about; /* whether a warning message about this font has been displayed yet */
- /*
- if the font file was not readable for some reason (e.g. corrupt,
- or encrypted for proprietry distribution), load_font_now() will
- try to load a PK version via load_font() instead. If this is
- successful, it will set force_pk to true, which will tell
- get_t1_glyph() to return immediately, and just use the standard
- set_char() routine to set the PK glyph. If even that fails,
- get_t1_glyph() returns an error status in a special flag that's
- evaluated by set_t1_char().
- */
- Boolean force_pk;
-};
-
-static struct fontmap *fontmaps = NULL;
-static size_t g_maplidx = 0; /* global, for communication with find_texfont */
-
-/*
- widthinfo[n]: TFM width info, loaded on demand as the fonts are used.
- idx texname widths
- [0] = cmr10 ...
- [1] = ptmr8r ...
- [2] = pcrr8rn ...
- [3] = putro8r ...
-
- The widthinfo is loaded from the font tfm file because the type1
- width information isn't precise enough to avoid accumulating
- rounding errors that make things visibly misaligned. This is
- esp. noticeable in tables (for the lines separating the columns).
-
- For other than "design" sizes the widths are scaled up or down.
-
-*/
-
-struct tfminfos {
- const char *texname;
- long designsize;
- long widths[256];
- long fontdimen2; /* width of word spacing in this font */
-};
-
-static struct tfminfos *tfminfo = NULL;
-
-/* For file reading */
-# define BUFFER_SIZE 1024
-
-/* This is the conversion factor from TeXs pt to TeXs bp (big point).
- Maximum machine precision is needed to keep it accurate. */
-/* UNUSED */
-/* static double bp_fac=72.0/72.27; */
-
-/* Try to convert from PS charspace units to DVI units with minimal
- loss of significant digits */
-# define t1_dvi_conv(x) ((((int) (x)) << 16)/1000)
-
-/* Convert from TFM units to DVI units */
-# define tfm_dvi_conv(x) (((int) (x)) >> 1)
-
-static Boolean padMismatch = False; /* Does t1lib padding match xdvi required padding? */
-static int archpad;
-# define T1PAD(bits, pad) (((bits) + (pad) - 1) & -(pad))
-
-static struct glyph *get_t1_glyph(
-# ifdef TEXXET
- wide_ubyte cmd,
-# endif
- wide_ubyte ch, t1FontLoadStatusT *flag,
- Boolean is_geom_scan);
-
-# ifdef WORDS_BIGENDIAN
-unsigned char rbits[] = {
- 0x00, /* 00000000 -> 00000000 */
- 0x80, /* 00000001 -> 10000000 */
- 0x40, /* 00000010 -> 01000000 */
- 0xC0, /* 00000011 -> 11000000 */
- 0x20, /* 00000100 -> 00100000 */
- 0xA0, /* 00000101 -> 10100000 */
- 0x60, /* 00000110 -> 01100000 */
- 0xE0, /* 00000111 -> 11100000 */
- 0x10, /* 00001000 -> 00010000 */
- 0x90, /* 00001001 -> 10010000 */
- 0x50, /* 00001010 -> 01010000 */
- 0xD0, /* 00001011 -> 11010000 */
- 0x30, /* 00001100 -> 00110000 */
- 0xB0, /* 00001101 -> 10110000 */
- 0x70, /* 00001110 -> 01110000 */
- 0xF0, /* 00001111 -> 11110000 */
- 0x08, /* 00010000 -> 00001000 */
- 0x88, /* 00010001 -> 10001000 */
- 0x48, /* 00010010 -> 01001000 */
- 0xC8, /* 00010011 -> 11001000 */
- 0x28, /* 00010100 -> 00101000 */
- 0xA8, /* 00010101 -> 10101000 */
- 0x68, /* 00010110 -> 01101000 */
- 0xE8, /* 00010111 -> 11101000 */
- 0x18, /* 00011000 -> 00011000 */
- 0x98, /* 00011001 -> 10011000 */
- 0x58, /* 00011010 -> 01011000 */
- 0xD8, /* 00011011 -> 11011000 */
- 0x38, /* 00011100 -> 00111000 */
- 0xB8, /* 00011101 -> 10111000 */
- 0x78, /* 00011110 -> 01111000 */
- 0xF8, /* 00011111 -> 11111000 */
- 0x04, /* 00100000 -> 00000100 */
- 0x84, /* 00100001 -> 10000100 */
- 0x44, /* 00100010 -> 01000100 */
- 0xC4, /* 00100011 -> 11000100 */
- 0x24, /* 00100100 -> 00100100 */
- 0xA4, /* 00100101 -> 10100100 */
- 0x64, /* 00100110 -> 01100100 */
- 0xE4, /* 00100111 -> 11100100 */
- 0x14, /* 00101000 -> 00010100 */
- 0x94, /* 00101001 -> 10010100 */
- 0x54, /* 00101010 -> 01010100 */
- 0xD4, /* 00101011 -> 11010100 */
- 0x34, /* 00101100 -> 00110100 */
- 0xB4, /* 00101101 -> 10110100 */
- 0x74, /* 00101110 -> 01110100 */
- 0xF4, /* 00101111 -> 11110100 */
- 0x0C, /* 00110000 -> 00001100 */
- 0x8C, /* 00110001 -> 10001100 */
- 0x4C, /* 00110010 -> 01001100 */
- 0xCC, /* 00110011 -> 11001100 */
- 0x2C, /* 00110100 -> 00101100 */
- 0xAC, /* 00110101 -> 10101100 */
- 0x6C, /* 00110110 -> 01101100 */
- 0xEC, /* 00110111 -> 11101100 */
- 0x1C, /* 00111000 -> 00011100 */
- 0x9C, /* 00111001 -> 10011100 */
- 0x5C, /* 00111010 -> 01011100 */
- 0xDC, /* 00111011 -> 11011100 */
- 0x3C, /* 00111100 -> 00111100 */
- 0xBC, /* 00111101 -> 10111100 */
- 0x7C, /* 00111110 -> 01111100 */
- 0xFC, /* 00111111 -> 11111100 */
- 0x02, /* 01000000 -> 00000010 */
- 0x82, /* 01000001 -> 10000010 */
- 0x42, /* 01000010 -> 01000010 */
- 0xC2, /* 01000011 -> 11000010 */
- 0x22, /* 01000100 -> 00100010 */
- 0xA2, /* 01000101 -> 10100010 */
- 0x62, /* 01000110 -> 01100010 */
- 0xE2, /* 01000111 -> 11100010 */
- 0x12, /* 01001000 -> 00010010 */
- 0x92, /* 01001001 -> 10010010 */
- 0x52, /* 01001010 -> 01010010 */
- 0xD2, /* 01001011 -> 11010010 */
- 0x32, /* 01001100 -> 00110010 */
- 0xB2, /* 01001101 -> 10110010 */
- 0x72, /* 01001110 -> 01110010 */
- 0xF2, /* 01001111 -> 11110010 */
- 0x0A, /* 01010000 -> 00001010 */
- 0x8A, /* 01010001 -> 10001010 */
- 0x4A, /* 01010010 -> 01001010 */
- 0xCA, /* 01010011 -> 11001010 */
- 0x2A, /* 01010100 -> 00101010 */
- 0xAA, /* 01010101 -> 10101010 */
- 0x6A, /* 01010110 -> 01101010 */
- 0xEA, /* 01010111 -> 11101010 */
- 0x1A, /* 01011000 -> 00011010 */
- 0x9A, /* 01011001 -> 10011010 */
- 0x5A, /* 01011010 -> 01011010 */
- 0xDA, /* 01011011 -> 11011010 */
- 0x3A, /* 01011100 -> 00111010 */
- 0xBA, /* 01011101 -> 10111010 */
- 0x7A, /* 01011110 -> 01111010 */
- 0xFA, /* 01011111 -> 11111010 */
- 0x06, /* 01100000 -> 00000110 */
- 0x86, /* 01100001 -> 10000110 */
- 0x46, /* 01100010 -> 01000110 */
- 0xC6, /* 01100011 -> 11000110 */
- 0x26, /* 01100100 -> 00100110 */
- 0xA6, /* 01100101 -> 10100110 */
- 0x66, /* 01100110 -> 01100110 */
- 0xE6, /* 01100111 -> 11100110 */
- 0x16, /* 01101000 -> 00010110 */
- 0x96, /* 01101001 -> 10010110 */
- 0x56, /* 01101010 -> 01010110 */
- 0xD6, /* 01101011 -> 11010110 */
- 0x36, /* 01101100 -> 00110110 */
- 0xB6, /* 01101101 -> 10110110 */
- 0x76, /* 01101110 -> 01110110 */
- 0xF6, /* 01101111 -> 11110110 */
- 0x0E, /* 01110000 -> 00001110 */
- 0x8E, /* 01110001 -> 10001110 */
- 0x4E, /* 01110010 -> 01001110 */
- 0xCE, /* 01110011 -> 11001110 */
- 0x2E, /* 01110100 -> 00101110 */
- 0xAE, /* 01110101 -> 10101110 */
- 0x6E, /* 01110110 -> 01101110 */
- 0xEE, /* 01110111 -> 11101110 */
- 0x1E, /* 01111000 -> 00011110 */
- 0x9E, /* 01111001 -> 10011110 */
- 0x5E, /* 01111010 -> 01011110 */
- 0xDE, /* 01111011 -> 11011110 */
- 0x3E, /* 01111100 -> 00111110 */
- 0xBE, /* 01111101 -> 10111110 */
- 0x7E, /* 01111110 -> 01111110 */
- 0xFE, /* 01111111 -> 11111110 */
- 0x01, /* 10000000 -> 00000001 */
- 0x81, /* 10000001 -> 10000001 */
- 0x41, /* 10000010 -> 01000001 */
- 0xC1, /* 10000011 -> 11000001 */
- 0x21, /* 10000100 -> 00100001 */
- 0xA1, /* 10000101 -> 10100001 */
- 0x61, /* 10000110 -> 01100001 */
- 0xE1, /* 10000111 -> 11100001 */
- 0x11, /* 10001000 -> 00010001 */
- 0x91, /* 10001001 -> 10010001 */
- 0x51, /* 10001010 -> 01010001 */
- 0xD1, /* 10001011 -> 11010001 */
- 0x31, /* 10001100 -> 00110001 */
- 0xB1, /* 10001101 -> 10110001 */
- 0x71, /* 10001110 -> 01110001 */
- 0xF1, /* 10001111 -> 11110001 */
- 0x09, /* 10010000 -> 00001001 */
- 0x89, /* 10010001 -> 10001001 */
- 0x49, /* 10010010 -> 01001001 */
- 0xC9, /* 10010011 -> 11001001 */
- 0x29, /* 10010100 -> 00101001 */
- 0xA9, /* 10010101 -> 10101001 */
- 0x69, /* 10010110 -> 01101001 */
- 0xE9, /* 10010111 -> 11101001 */
- 0x19, /* 10011000 -> 00011001 */
- 0x99, /* 10011001 -> 10011001 */
- 0x59, /* 10011010 -> 01011001 */
- 0xD9, /* 10011011 -> 11011001 */
- 0x39, /* 10011100 -> 00111001 */
- 0xB9, /* 10011101 -> 10111001 */
- 0x79, /* 10011110 -> 01111001 */
- 0xF9, /* 10011111 -> 11111001 */
- 0x05, /* 10100000 -> 00000101 */
- 0x85, /* 10100001 -> 10000101 */
- 0x45, /* 10100010 -> 01000101 */
- 0xC5, /* 10100011 -> 11000101 */
- 0x25, /* 10100100 -> 00100101 */
- 0xA5, /* 10100101 -> 10100101 */
- 0x65, /* 10100110 -> 01100101 */
- 0xE5, /* 10100111 -> 11100101 */
- 0x15, /* 10101000 -> 00010101 */
- 0x95, /* 10101001 -> 10010101 */
- 0x55, /* 10101010 -> 01010101 */
- 0xD5, /* 10101011 -> 11010101 */
- 0x35, /* 10101100 -> 00110101 */
- 0xB5, /* 10101101 -> 10110101 */
- 0x75, /* 10101110 -> 01110101 */
- 0xF5, /* 10101111 -> 11110101 */
- 0x0D, /* 10110000 -> 00001101 */
- 0x8D, /* 10110001 -> 10001101 */
- 0x4D, /* 10110010 -> 01001101 */
- 0xCD, /* 10110011 -> 11001101 */
- 0x2D, /* 10110100 -> 00101101 */
- 0xAD, /* 10110101 -> 10101101 */
- 0x6D, /* 10110110 -> 01101101 */
- 0xED, /* 10110111 -> 11101101 */
- 0x1D, /* 10111000 -> 00011101 */
- 0x9D, /* 10111001 -> 10011101 */
- 0x5D, /* 10111010 -> 01011101 */
- 0xDD, /* 10111011 -> 11011101 */
- 0x3D, /* 10111100 -> 00111101 */
- 0xBD, /* 10111101 -> 10111101 */
- 0x7D, /* 10111110 -> 01111101 */
- 0xFD, /* 10111111 -> 11111101 */
- 0x03, /* 11000000 -> 00000011 */
- 0x83, /* 11000001 -> 10000011 */
- 0x43, /* 11000010 -> 01000011 */
- 0xC3, /* 11000011 -> 11000011 */
- 0x23, /* 11000100 -> 00100011 */
- 0xA3, /* 11000101 -> 10100011 */
- 0x63, /* 11000110 -> 01100011 */
- 0xE3, /* 11000111 -> 11100011 */
- 0x13, /* 11001000 -> 00010011 */
- 0x93, /* 11001001 -> 10010011 */
- 0x53, /* 11001010 -> 01010011 */
- 0xD3, /* 11001011 -> 11010011 */
- 0x33, /* 11001100 -> 00110011 */
- 0xB3, /* 11001101 -> 10110011 */
- 0x73, /* 11001110 -> 01110011 */
- 0xF3, /* 11001111 -> 11110011 */
- 0x0B, /* 11010000 -> 00001011 */
- 0x8B, /* 11010001 -> 10001011 */
- 0x4B, /* 11010010 -> 01001011 */
- 0xCB, /* 11010011 -> 11001011 */
- 0x2B, /* 11010100 -> 00101011 */
- 0xAB, /* 11010101 -> 10101011 */
- 0x6B, /* 11010110 -> 01101011 */
- 0xEB, /* 11010111 -> 11101011 */
- 0x1B, /* 11011000 -> 00011011 */
- 0x9B, /* 11011001 -> 10011011 */
- 0x5B, /* 11011010 -> 01011011 */
- 0xDB, /* 11011011 -> 11011011 */
- 0x3B, /* 11011100 -> 00111011 */
- 0xBB, /* 11011101 -> 10111011 */
- 0x7B, /* 11011110 -> 01111011 */
- 0xFB, /* 11011111 -> 11111011 */
- 0x07, /* 11100000 -> 00000111 */
- 0x87, /* 11100001 -> 10000111 */
- 0x47, /* 11100010 -> 01000111 */
- 0xC7, /* 11100011 -> 11000111 */
- 0x27, /* 11100100 -> 00100111 */
- 0xA7, /* 11100101 -> 10100111 */
- 0x67, /* 11100110 -> 01100111 */
- 0xE7, /* 11100111 -> 11100111 */
- 0x17, /* 11101000 -> 00010111 */
- 0x97, /* 11101001 -> 10010111 */
- 0x57, /* 11101010 -> 01010111 */
- 0xD7, /* 11101011 -> 11010111 */
- 0x37, /* 11101100 -> 00110111 */
- 0xB7, /* 11101101 -> 10110111 */
- 0x77, /* 11101110 -> 01110111 */
- 0xF7, /* 11101111 -> 11110111 */
- 0x0F, /* 11110000 -> 00001111 */
- 0x8F, /* 11110001 -> 10001111 */
- 0x4F, /* 11110010 -> 01001111 */
- 0xCF, /* 11110011 -> 11001111 */
- 0x2F, /* 11110100 -> 00101111 */
- 0xAF, /* 11110101 -> 10101111 */
- 0x6F, /* 11110110 -> 01101111 */
- 0xEF, /* 11110111 -> 11101111 */
- 0x1F, /* 11111000 -> 00011111 */
- 0x9F, /* 11111001 -> 10011111 */
- 0x5F, /* 11111010 -> 01011111 */
- 0xDF, /* 11111011 -> 11011111 */
- 0x3F, /* 11111100 -> 00111111 */
- 0xBF, /* 11111101 -> 10111111 */
- 0x7F, /* 11111110 -> 01111111 */
- 0xFF /* 11111111 -> 11111111 */
-};
-# endif /* WORDS_BIGENDIAN */
-#endif /* T1LIB */
-
static struct frame frame0; /* dummy head of list */
#ifdef TEXXET
static struct frame *scan_frame; /* head frame for scanning */
@@ -728,7 +292,7 @@ put_bitmap(struct bitmap *bitmap, int x, int y)
image) for the given shrink factor. E.g. at shrink level 2, the
size of the pixel table is 4; in other words, 1 pixel in the shrunk
image corresponds to 4 pixels in the unshrunk image. Thus, the possible
- values for shink level 2 are: black, 1/4 (0x404040), 1/2 (0x808080),
+ values for shrink level 2 are: black, 1/4 (0x404040), 1/2 (0x808080),
3/4 (0xc0c0c0) and white (0xffffff).
*/
static Pixel *pixeltbl;
@@ -1651,7 +1215,7 @@ change_font(unsigned long n)
* Open a font file.
*/
-static void
+void
open_font_file(struct font *fontp)
{
if (fontp->file == NULL) {
@@ -1921,8 +1485,13 @@ set_char(
return 0L; /* previously flagged missing char */
#endif
}
- open_font_file(currinf.fontp);
- fseek(currinf.fontp->file, g->addr, SEEK_SET);
+#if FREETYPE
+ if (currinf.fontp->ft == NULL) /* if not freetype font */
+#endif
+ {
+ open_font_file(currinf.fontp);
+ fseek(currinf.fontp->file, g->addr, SEEK_SET);
+ }
(*currinf.fontp->read_char) (currinf.fontp, ch);
if (globals.debug & DBG_BITMAP)
print_char((ubyte) ch, g);
@@ -1954,7 +1523,7 @@ set_char(
if (resource.use_grey) {
if (g->pixmap2 == NULL) {
#ifdef DBG_AA
- fprintf(stderr, "shinking the bitmap!\n");
+ fprintf(stderr, "shrinking the bitmap!\n");
#endif /* DBG_AA */
/* print_bitmap(&g->bitmap); */
shrink_glyph_grey(g);
@@ -1990,6 +1559,32 @@ set_char(
* Routines to print characters.
*/
+static void
+warn_setting_empty_char(void)
+{
+ /* this is probably serious enough for a GUI warning */
+ popup_message(globals.widgets.top_level,
+ MSG_ERR,
+ /* helptext */
+ "Xdvi tries all of the following possibilities in turn, and "
+ "all of them have failed:\n\n"
+ " (1) If the resource type1 is set, try a PostScript Type 1 "
+ "version of a font.\n\n"
+ " (2) Otherwise, or if the Type 1 version hasn't been found, "
+ "try to "
+ "locate, or generate via mktexpk, a TeX Pixel (PK) version of "
+ "the font.\n\n"
+ " (3) Use the fallback font defined via the \"altfont\" "
+ "resource (cmr10 by default), "
+ "both as Type 1 and as PK version, at various resolutions.\n\n"
+ "It seems that your font setup is defective.\n",
+ /* errmsg */
+ "Error loading font %s: Neither a Type 1 version nor "
+ "a pixel version could be found. The character(s) "
+ "will be left blank.",
+ currinf.fontp->fontname);
+}
+
static setcharRetvalT
set_empty_char(
#ifdef TEXXET
@@ -2015,7 +1610,7 @@ load_n_set_char(
#endif
wide_ubyte ch)
{
- if (!load_font(currinf.fontp, resource.t1lib
+ if (!load_font(currinf.fontp
#if DELAYED_MKTEXPK
, True
#endif
@@ -2024,9 +1619,8 @@ load_n_set_char(
longjmp(globals.ev.canit, 1);
}
- /* FIXME: does this need to be replaced by GUI warning, or has this case already been covered? */
- XDVI_WARNING((stderr, "load_n_set_char: Character(s) will be left blank."));
currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char;
+ warn_setting_empty_char();
#ifdef TEXXET
return;
@@ -2108,6 +1702,87 @@ set_vf_char(
#endif
}
+
+#if FREETYPE
+
+/*
+ * set_ft_char() is used as a set_char routine to handle delayed loading
+ * of freetype fonts. See more details in ft.c.
+ */
+
+static void
+do_load_freetype_font(void)
+{
+ if (!load_ft_font(currinf.fontp)) {
+ /* Revert to non-scalable font */
+ struct ftfont *ftp;
+
+ TRACE_FT((stderr,
+ "Font %s is not loadable; reverting to non-scalable font",
+ currinf.fontp->fontname));
+
+ ftp = currinf.fontp->ft;
+ ftp->t1->bad = True;
+ if (currinf.fontp == ftp->first_size) {
+ if (currinf.fontp->next_size == NULL) {
+ /* if this is the only size of this font face */
+ ftp->t1->ft = NULL;
+ free(ftp);
+ }
+ else {
+ struct font *fontp2;
+
+ ftp->first_size = fontp2 = currinf.fontp->next_size;
+ /*
+ * Opening the file might have succeeded at some other size,
+ * so we need to transfer that information to the next
+ * record in case it was put here.
+ */
+ fontp2->file = currinf.fontp->file;
+ currinf.fontp->file = NULL;
+ fontp2->filename = currinf.fontp->filename;
+ currinf.fontp->filename = NULL;
+ fontp2->timestamp = currinf.fontp->timestamp;
+ }
+ }
+ else {
+ struct font *fontp2;
+
+ fontp2 = ftp->first_size;
+ while (fontp2->next_size != currinf.fontp)
+ fontp2 = fontp2->next_size;
+ fontp2->next_size = currinf.fontp->next_size;
+ }
+ currinf.fontp->ft = NULL;
+ /* The virtual font machinery will take it from here. */
+ /* That will call load_font(), but it won't take us back to the */
+ /* freetype font, because that font will have been marked bad. */
+ currinf.set_char_p = load_n_set_char;
+ }
+ else
+ currinf.set_char_p = currinf.fontp->set_char_p = set_char;
+}
+
+setcharRetvalT
+set_ft_char(
+# if TEXXET
+ wide_ubyte cmd,
+# endif
+ wide_ubyte ch)
+{
+ do_load_freetype_font();
+
+# if !TEXXET
+ return (*currinf.set_char_p)(ch);
+# else
+ (*currinf.set_char_p)(cmd, ch);
+ return;
+# endif
+}
+
+#endif /* FREETYPE */
+
+
static setcharRetvalT
set_no_char(
#ifdef TEXXET
@@ -2708,26 +2383,35 @@ static struct frame *geom_current_frame;
static uint32_t
get_unicode_char(wide_ubyte ch, struct drawinf currinf, char *retbuf)
{
+#if FREETYPE
/* attempt 1: if it's a Type1 font, get the Adobe character name
- from T1lib's T1_GetCharName */
- if (currinf.set_char_p == set_t1_char) {
- int id = currinf.fontp->t1id;
- int t1libid = fontmaps[id].t1libid;
- char *char_name;
- ASSERT(t1libid != -1, "Font must have been loaded at this point!");
- char_name = T1_GetCharName(t1libid, ch);
- TRACE_FIND_VERBOSE((stderr, "T1 char: %d = `%s' (id: %d; font: %s; enc: %d)",
+ from FreeType's FT_Get_Glyph_Name */
+ if (currinf.fontp->ft != NULL) {
+ FT_Face face = currinf.fontp->ft->face;
+
+ ASSERT(face != NULL, "Font must have been loaded at this point!");
+ if (FT_Has_PS_Glyph_Names(face)) {
+ char buffer[32]; /* holds longest name in adobe2unicode_table */
+ int index = currinf.fontp->glyph[ch].addr;
+
+ if (index == 0
+ || FT_Get_Glyph_Name(face, index, buffer, sizeof buffer) != 0)
+ TRACE_FIND_VERBOSE((stderr, "T1 char: %d has no name", ch));
+ else {
+ TRACE_FIND_VERBOSE((stderr,
+ "T1 char: %d = `%s' (font: %s; enc: %s)",
ch, char_name,
- currinf.fontp->t1id, fontmaps[currinf.fontp->t1id].texname,
- fontmaps[currinf.fontp->t1id].enc));
- return adobe2unicode_name(char_name);
- }
- else {
- /* attempt 2: try to derive the encoding from the font name, by
- looking it up in a list of known font names.
- */
- return guess_encoding(ch, currinf.fontp->fontname, retbuf);
+ currinf.fontp->fontname,
+ currinf.fontp->ft->t1->encname));
+ return adobe2unicode_name(buffer);
+ }
+ }
}
+#endif /* FREETYPE */
+ /* attempt 2: try to derive the encoding from the font name,
+ by looking it up in a list of known font names.
+ */
+ return guess_encoding(ch, currinf.fontp->fontname, retbuf);
}
#define MAX_CHARS 16 /* maximum number of unicode characters that one do_char can produce (rounded up ...) */
@@ -3256,10 +2940,15 @@ text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
if (currinf.set_char_p == set_empty_char)
return 0; /* error; we'll catch it later */
+#if FREETYPE
+ if (currinf.set_char_p == set_ft_char)
+ do_load_freetype_font();
+#endif
+
if (currinf.set_char_p == load_n_set_char) {
if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */
return 0;
- if (!load_font(currinf.fontp, resource.t1lib
+ if (!load_font(currinf.fontp
#if DELAYED_MKTEXPK
, True
#endif
@@ -3267,9 +2956,8 @@ text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */
return 0;
- /* FIXME: replace by GUI warning! */
- fputs("geom_do_char: Character(s) will be left blank.\n", stderr);
currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char;
+ warn_setting_empty_char();
return 0;
}
maxchar = currinf.fontp->maxchar;
@@ -3287,8 +2975,13 @@ text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
return 0; /* catch the error later */
if (g->addr == -1)
return 0; /* previously flagged missing char */
- open_font_file(currinf.fontp);
- fseek(currinf.fontp->file, g->addr, SEEK_SET);
+#if FREETYPE
+ if (currinf.fontp->ft == NULL) /* if not freetype font */
+#endif
+ {
+ open_font_file(currinf.fontp);
+ fseek(currinf.fontp->file, g->addr, SEEK_SET);
+ }
(*currinf.fontp->read_char) (currinf.fontp, ch);
if (globals.debug & DBG_BITMAP)
print_char((ubyte) ch, g);
@@ -3345,38 +3038,8 @@ text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
#endif
return DIR * m->dvi_adv;
}
-#ifdef T1LIB
- else if (currinf.set_char_p == set_t1_char) {
- struct glyph *g ;
- long x, y;
- t1FontLoadStatusT status;
-
-#ifdef TEXXET
- g = get_t1_glyph(0, ch, &status, True);
- if (status == FAILURE_BLANK)
- return 0;
- if (geom_scan_frame == NULL) {
- long dvi_h_sav = DVI_H;
- if (currinf.dir < 0)
- DVI_H -= g->dvi_adv;
- x = G_PXL_H - g->x;
- y = PXL_V - g->y;
- do_char(ch, currinf, info, PXL_V, y, x, x + g->bitmap.w - 1, g);
- DVI_H = dvi_h_sav;
- }
-#else
- g = get_t1_glyph(ch, &status, True);
- if (status == FAILURE_BLANK)
- return 0;
- x = G_PXL_H - g->x;
- y = PXL_V - g->y;
- do_char(ch, currinf, info, PXL_V, y, x, x + g->bitmap.w - 1, g);
-#endif
- return DIR * g->dvi_adv;
- }
-#endif /* T1LIB */
else {
- XDVI_FATAL((stderr, "currinf.set_char_p not a registered routine!"));
+ XDVI_FATAL((stderr, "currinf.set_char_p is not a registered routine!"));
}
/* NOTREACHED */
return 0;
@@ -3402,10 +3065,15 @@ geom_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
if (currinf.set_char_p == set_empty_char)
return 0; /* error; we'll catch it later */
+#if FREETYPE
+ if (currinf.set_char_p == set_ft_char)
+ do_load_freetype_font();
+#endif
+
if (currinf.set_char_p == load_n_set_char) {
if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */
return 0;
- if (!load_font(currinf.fontp, resource.t1lib
+ if (!load_font(currinf.fontp
#if DELAYED_MKTEXPK
, True
#endif
@@ -3413,9 +3081,8 @@ geom_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
if (globals.ev.flags & EV_GE_NEWDOC) /* if abort */
return 0;
- /* FIXME: replace by GUI warning! */
- fputs("geom_do_char: Character(s) will be left blank.\n", stderr);
currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char;
+ warn_setting_empty_char();
return 0;
}
maxchar = currinf.fontp->maxchar;
@@ -3433,8 +3100,13 @@ geom_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
return 0; /* catch the error later */
if (g->addr == -1)
return 0; /* previously flagged missing char */
- open_font_file(currinf.fontp);
- fseek(currinf.fontp->file, g->addr, SEEK_SET);
+#if FREETYPE
+ if (currinf.fontp->ft == NULL) /* if not freetype font */
+#endif
+ {
+ open_font_file(currinf.fontp);
+ fseek(currinf.fontp->file, g->addr, SEEK_SET);
+ }
(*currinf.fontp->read_char) (currinf.fontp, ch);
if (globals.debug & DBG_BITMAP)
print_char((ubyte) ch, g);
@@ -3493,40 +3165,8 @@ geom_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch)
#endif
return DIR * m->dvi_adv;
}
-#ifdef T1LIB
- else if (currinf.set_char_p == set_t1_char) {
- struct glyph *g ;
- long x, y;
- t1FontLoadStatusT status;
-
-#ifdef TEXXET
- g = get_t1_glyph(0, ch, &status, False);
- if (status == FAILURE_BLANK)
- return 0;
- if (geom_scan_frame == NULL) {
- long dvi_h_sav = DVI_H;
- if (currinf.dir < 0)
- DVI_H -= g->dvi_adv;
- x = G_PXL_H - g->x;
- y = PXL_V - g->y;
- g_info->geom_box(info, x, y,
- x + g->bitmap.w - 1, y + g->bitmap.h - 1);
- DVI_H = dvi_h_sav;
- }
-#else
- g = get_t1_glyph(ch, &status, False);
- if (status == FAILURE_BLANK)
- return 0;
- x = G_PXL_H - g->x;
- y = PXL_V - g->y;
- g_info->geom_box(info, x, y,
- x + g->bitmap.w - 1, y + g->bitmap.h - 1);
-#endif
- return DIR * g->dvi_adv;
- }
-#endif /* T1LIB */
else {
- XDVI_FATAL((stderr, "currinf.set_char_p not a registered routine!"));
+ XDVI_FATAL((stderr, "currinf.set_char_p is not a registered routine!"));
}
/* NOTREACHED */
return 0;
@@ -5039,1171 +4679,6 @@ anchor_search(const char *str)
}
-
-#ifdef T1LIB
-
-/* ********************** FONT AND ENCODING LOADING ******************** */
-
-static char **
-load_vector(const char *enc)
-{
- char *filename;
-
- TRACE_T1((stderr, "loading vector: |%s|", enc));
- /*
- * With TDS 1.0/kpathsea 3.5.2(?), encoding files are in texmf/fonts/enc and accessed
- * via kpse_enc_format; see e.g.:
- * http://tug.org/mailman/htdig/tex-live/2004-January/004734.html
- *
- * The lookups under kpse_program_text_format and kpse_tex_ps_header_format
- * are kept for backwards compatibility.
- */
- do {
- filename = kpse_find_file(enc, kpse_enc_format, 0);
- if (filename != NULL)
- break;
- filename = kpse_find_file(enc, kpse_program_text_format, 0);
- if (filename != NULL)
- break;
- /* If that fails we try the standard place: postscript headers */
- filename = kpse_find_file(enc, kpse_tex_ps_header_format, 1);
- } while (0);
-
- if (filename != NULL) {
- return T1_LoadEncoding(filename);
- }
- return NULL;
-}
-
-
-
-static int
-add_tfm(const char *texname)
-{
- /* Load font metrics if not already loaded. Return index into
- fontmetrics array. If it fails, fallback metrics must be
- loaded instead; if that fails as well, exit. */
-
- size_t i;
- int idx;
- static size_t wlidx = 0;
- static size_t wlidx_max = 0;
- static const size_t wlidx_step = 1024;
-
-#ifdef USE_HASH
- if (tfminfo_hash.size == 0)
- tfminfo_hash = hash_create(T1FONTS_INITIAL_HASHTABLE_SIZE);
-
- if (find_str_int_hash(&tfminfo_hash, texname, &i)) {
- return i;
- }
-#else
- for (i = 0; i <= wlidx; i++)
- if (strcmp(tfminfo[i].texname, texname) == 0)
- return i;
-#endif /* USE_HASH */
-
- while (wlidx >= wlidx_max) {
- wlidx_max += wlidx_step;
- tfminfo = xrealloc(tfminfo, wlidx_max * sizeof *tfminfo);
- }
-
- tfminfo[wlidx].texname = texname;
-#ifdef USE_HASH
- put_str_int_hash(&tfminfo_hash, tfminfo[wlidx].texname, wlidx);
-#endif /* USE_HASH */
-
- if (!tfmload(texname, &tfminfo[wlidx].designsize, tfminfo[wlidx].widths,
- &(tfminfo[wlidx].fontdimen2))) {
- XDVI_FATAL((stderr, "Cannot find font metrics file %s.tfm, "
- "and fallback metrics cmr10.tfm is missing as well - exiting.\n",
- texname));
- }
-
- idx = wlidx++;
-
- if (fallbacktfm == 1) {
- fallbacktfm = 2;
- popup_message(globals.widgets.top_level,
- MSG_ERR,
- /* helptext */
- "A font metrics file is missing and cmr10.tfm is used instead. Either "
- "you don't have the file, or your TeX system cannot find it. Try to "
- "invoke \"kpsewhich\" with the filename mentioned in the error "
- "message and the \"-debug 2\" option to find out where Xdvik is "
- "searching for your files.\n"
- "To enable automatic creation of .tfm files for "
- "Metafont fonts, "
- /* FIXME: how about Type1 fonts?? */
- "set the environment variable MKTEXTFM "
- "to 1 and re-start xdvi. See the file texmf.cnf for the default settings "
- "of MKTEXTFM and related variables.",
- /* message */
- "Could not find font metrics file %s.tfm; using cmr10.tfm instead. "
- "Expect ugly output.",
- texname);
- }
-
- return idx;
-}
-
-static int
-add_t1font(const char *fontname, const char *filename)
-{
- /* Add t1 font to list if it's not already there; return the
- (newly created, or already existing) t1lib font id. The
- filename argument is optional, but is assumed to be a full path
- if it is given.
- */
-
- int id, idx;
- size_t i;
- char *path = NULL;
-
- static size_t t1lidx = 0;
- static size_t t1lidx_max = 0;
- static const size_t t1lidx_step = 1024;
-
-
-#ifdef USE_HASH
- /* Already set up by that name? */
- if (t1fonts_hash.size == 0)
- t1fonts_hash = hash_create(T1FONTS_INITIAL_HASHTABLE_SIZE);
-
- if (find_str_int_hash(&t1fonts_hash, fontname, &i)) {
- return i;
- }
-#else
- for (i = 0; i <= t1lidx; i++) {
- if (strcmp(t1fonts[i].shortname, fontname) == 0 ||
- strcmp(t1fonts[i].file, fontname) == 0) {
- TRACE_T1((stderr, "Type1 font %s already loaded from %s", fontname, filename));
- return i;
- }
- }
-#endif /* USE_HASH */
-
- /* Insert and set up new t1 font */
- while (t1lidx >= t1lidx_max) {
- t1lidx_max += t1lidx_step;
- t1fonts = xrealloc(t1fonts, t1lidx_max * sizeof *t1fonts);
-
- TRACE_T1((stderr, "Enlarged t1 table from %lu to %lu entries",
- (unsigned long)t1lidx, (unsigned long)t1lidx_max));
- }
-
- if (filename == NULL) {
- /* We don't know the full path name yet, find it */
- path = kpse_find_file(fontname, kpse_type1_format, 0);
- if (path == NULL)
- return -1; /* xdvi will use substitution font */
- }
- else {
- path = xstrdup(filename);
- }
-
- t1fonts[t1lidx].file = xstrdup(path);
- t1fonts[t1lidx].t1id = id = T1_AddFont(path);
- t1fonts[t1lidx].shortname = xstrdup(fontname);
- t1fonts[t1lidx].loaded = 0;
-
- TRACE_T1((stderr, "Loaded font %lu/%s (%d) from %s", (unsigned long)t1lidx, fontname, id, path));
-
-#ifdef USE_HASH
- /* also save the info in the hashtable (note: no duplication of the string here!) */
- put_str_int_hash(&t1fonts_hash, t1fonts[t1lidx].shortname, t1lidx);
-#endif /* USE_HASH */
-
- idx = t1lidx++;
-
- free(path);
-
-#if USE_AFM
- /* BZZT! AFM files are useless to us, their metric information is
- too inacurate for TeX use. Never define USE_AFM */
- /* Set the afm filename. Always before loading. If no afm file
- found t1lib will use fallback code. In fact the fallback code
- has been deactivated entierly, it's dog slow. */
- path = kpse_find_file(fontname, kpse_afm_format, 0);
- if (path != NULL) {
- TRACE_T1((stderr, "found afm file: %s", path));
- T1_SetAfmFileName(id, path);
- free(path);
- }
-#endif
-
- return idx;
-}
-
-static int
-find_texfont(const char *texname)
-{
- /* Find fontmap index of texfont */
- size_t i;
-
-#ifdef USE_HASH
- if (fontmaps_hash.size == 0)
- fontmaps_hash = hash_create(T1FONTS_INITIAL_HASHTABLE_SIZE);
-
- if (find_str_int_hash(&fontmaps_hash, texname, &i)) {
- return i;
- }
-#else
- for (i = 0; i < g_maplidx; i++) {
- if (strcmp(fontmaps[i].texname, texname) == 0) {
- TRACE_T1((stderr, "Type1 font already loaded at index %d: %s\n", i, texname));
- return i;
- }
- }
-#endif /* USE_HASH */
- return -1;
-}
-
-
-static int
-setup_encoded_T1_font(const char *mapfile,
- int lineno,
- const char *texname,
- const char *alias,
- const char *filename,
- int enc,
- int ext,
- int sl)
-{
- /* xdvi T1 Font loading is done in two steps:
-
- 1. At xdvi startup two things happen:
-
- a. The fontmaps are read.
-
- b. the dvi file is (partialy) scanned, and fonts are set up.
- In the case of t1 fonts we only set up the data structures,
- they are not actually loaded until they are used.
-
- 2. At the time a T1 font is used it is loaded, encoded, extended
- and slanted as prescribed.
-
- This procedure takes care of step 1a. It locates the font and
- sets up the data-structures so it may be assumed, by xdvi, to be
- loaded. Return the fontmaps array index.
-
- The 'texname' param should be the texname of the font, such as
- ptmr8r or cmr10.
-
- The 'alias' param should be the file name of the font if it is
- different from the texname. This is often the case with fonts
- defined in fontmaps.
-
- If, for some reason, the full filename of the font has already
- been looked up before we get here it is passed in the filename
- param so we don't have to look it up again.
-
- Implied encodings are not handled here.
-
- REMEMBER: THIS PROC IS CALLED FOR EACH FONT IN THE FONTMAPS, WE
- CANNOT DO ANY EXPENSIVE OPERATIONS HERE!!!
-
- */
-
- int test_idx;
- size_t curr_idx;
- static size_t maplidx_max = 0;
- static const size_t maplidx_step = 1024;
-
- /* fprintf(stderr, "setup font: |%s|, %s\n", texname, mapfile); */
-
- /* Already setup by that name? */
- test_idx = find_texfont(texname);
- ASSERT(test_idx == -1 || (test_idx > -1 && test_idx < (int)g_maplidx), "Result of find_texfont() out of range");
-
- if (mapfile != NULL && test_idx != -1) {
- /* font is already set up, and we're scanning the map file: replace existing font with new one */
- curr_idx = test_idx;
- XDVI_INFO((stdout, "%s: Entry for font \"%s\" on line %d overrides previous entry.",
- mapfile, texname, lineno));
-
- free(fontmaps[curr_idx].filename);
- free(fontmaps[curr_idx].pathname);
- }
- else if (test_idx != -1) {
- /* font is already set up, but we're not scanning the map file - return font index */
- TRACE_T1_VERBOSE((stderr, "font |%s| already set up at index %d", texname, test_idx));
- return test_idx;
- }
- else { /* Not set up yet, do it. */
- curr_idx = g_maplidx++; /* increment global index count */
- while (curr_idx >= maplidx_max) {
- maplidx_max += maplidx_step;
- fontmaps = xrealloc(fontmaps, maplidx_max * sizeof *fontmaps);
-
- TRACE_T1((stderr, "Enlarged the fontmap from %lu to %lu entries",
- (unsigned long)curr_idx, (unsigned long)maplidx_max));
- }
- fontmaps[curr_idx].texname = xstrdup(texname);
- }
-
- if (alias == NULL)
- alias = texname;
-
-#ifdef USE_HASH
- if (test_idx == -1) {
- if (fontmaps_hash.size == 0)
- fontmaps_hash = hash_create(T1FONTS_INITIAL_HASHTABLE_SIZE);
- put_str_int_hash(&fontmaps_hash, fontmaps[curr_idx].texname, curr_idx);
- }
-#endif /* USE_HASH */
-
- fontmaps[curr_idx].enc = enc;
- fontmaps[curr_idx].extension = ext;
- fontmaps[curr_idx].slant = sl;
-
- fontmaps[curr_idx].filename = xstrdup(alias);
- fontmaps[curr_idx].t1libid = -1;
- TRACE_T1((stderr,
- "fontmaps[%lu]: \"%s\", enc=%d, ext=%d, sl=%d, alias \"%s\"",
- (unsigned long)curr_idx, texname, enc, ext, sl, alias));
-
- if (filename != NULL) {
- fontmaps[curr_idx].pathname = xstrdup(filename);
- }
- else {
- fontmaps[curr_idx].pathname = NULL;
- }
- fontmaps[curr_idx].tfmidx = -1;
- fontmaps[curr_idx].warned_about = False;
- fontmaps[curr_idx].force_pk = False;
-
- return curr_idx;
-}
-
-
-static t1FontLoadStatusT
-try_pk_fallback(int idx, struct font *fontp)
-{
- Boolean success;
-
- success = load_font(fontp, False
-#if DELAYED_MKTEXPK
- , True
-#endif
- ); /* loading non-t1 version of font */
- fontmaps[idx].force_pk = True;
- TRACE_T1((stderr,
- "setting force_pk for %d to true; success for PK fallback: %d\n",
- idx, success));
-
- if (!success) {
- /* this is probably serious enough for a GUI warning */
- popup_message(globals.widgets.top_level,
- MSG_ERR,
- /* helptext */
- "Xdvi tries all of the following possibilities in turn, and all of them have failed:\n\n"
- " (1) If the resource t1lib is set, try a Postscript Type1 version of a font.\n\n"
- " (2) Otherwise, or if the Type1 version hasn't been found, try to "
- "locate, or generate via mktexpk, a TeX Pixel (PK) version of the font.\n\n"
- " (3) Use the fallback font defined via the \"altfont\" resource (cmr10 by default), "
- "both as Type1 and as PK version, at various resolutions.\n\n"
- "It seems that your font setup is defective.\n",
- /* errmsg */
- "Error loading font %s: Neither a Type1 version nor "
- "a pixel version could be found. The character(s) "
- "will be left blank.",
- fontmaps[idx].texname);
- currinf.set_char_p = currinf.fontp->set_char_p = set_empty_char;
- return FAILURE_BLANK;
- }
- /* free unneeded resources. We mustn't free
- fontmaps[idx].texname,
- else find_T1_font will try to load the font all over again.
- */
- free(fontmaps[idx].filename);
- free(fontmaps[idx].pathname);
- currinf.set_char_p = currinf.fontp->set_char_p = set_char;
- return FAILURE_PK;
-}
-
-static t1FontLoadStatusT
-load_font_now(int idx, struct font *fontp)
-{
- /* At this point xdvi needs to draw a glyph from this font. But
- first it must be loaded/copied and modified if needed. */
-
- int t1idx; /* The fontmap entry number */
- int t1id; /* The id of the unmodified font */
- int cid; /* The id of the copied font */
- int enc, sl, ext;
-
- /* statusline_info(STATUS_SHORT, "Loading T1 font %s", fontmaps[idx].filename); */
- TRACE_T1((stderr, "adding %s %s",
- fontmaps[idx].filename, fontmaps[idx].pathname));
-
- t1idx = add_t1font(fontmaps[idx].filename, fontmaps[idx].pathname);
-
- t1id = fontmaps[idx].t1libid = t1fonts[t1idx].t1id;
-
- errno = 0;
- if (!t1fonts[t1idx].loaded && T1_LoadFont(t1id) == -1) {
- /* this error is somehow better kept at stderr instead of
- a popup (too annoying) or the statusline (might disappear
- too fast) ... */
- XDVI_ERROR((stderr, "Could not load Type1 font %s from %s: %s %s (T1_errno = %d); "
- "will try pixel version instead.\nPlease see the T1lib documentation for details about this.\n",
- fontmaps[idx].texname, fontmaps[idx].pathname,
- T1_StrError(T1_errno),
- errno != 0 ? strerror(errno) : "",
- T1_errno));
- return try_pk_fallback(idx, fontp);
- }
-
- fontmaps[idx].tfmidx = add_tfm(fontmaps[idx].texname);
-
- t1fonts[t1idx].loaded = 1;
-
- /* If there is nothing further to do, just return */
- enc = fontmaps[idx].enc;
- ext = fontmaps[idx].extension;
- sl = fontmaps[idx].slant;
- TRACE_T1((stderr, "lookup at idx[%d] yields: %d, %d, %d", idx, enc, ext, sl));
-
- if (enc == -1 && ext == 0 && sl == 0)
- return SUCCESS;
-
- /* The fontmap entry speaks of a modified font. Copy it first. */
- cid = T1_CopyFont(t1id);
-
- fontmaps[idx].t1libid = cid;
-
- if (enc != -1) {
- TRACE_T1_VERBOSE((stderr, "trying to load vector from encodings index %d", enc));
- /* Demand load vector */
- if (encodings[enc].vector == NULL)
- encodings[enc].vector = load_vector(encodings[enc].file);
-
- if (encodings[enc].vector == NULL) {
- /* this error is somehow better kept at stderr instead of
- a popup (too annoying) or the statusline (might disappear
- too fast) ... */
- XDVI_ERROR((stderr, "Could not load load encoding file %s for vector %s (font %s): %s (T1_errno = %d); "
- "will try pixel version instead.\n"
- "Please see the T1lib documentation for details about this.\n",
- encodings[enc].file, encodings[enc].enc, fontmaps[idx].texname,
- T1_StrError(T1_errno), T1_errno));
- return try_pk_fallback(idx, fontp);
- }
- else {
- if (T1_ReencodeFont(cid, encodings[enc].vector) != 0) {
- XDVI_ERROR((stderr, "Re-encoding of %s failed: %s (T1_errno = %d); "
- "will try pixel version instead.\n"
- "Please see the T1lib documentation for details about this.\n",
- fontmaps[idx].texname,
- T1_StrError(T1_errno), T1_errno));
- return try_pk_fallback(idx, fontp);
- }
- }
- }
-
- if (ext)
- T1_ExtendFont(cid, ext / 1000.0);
-
- if (sl)
- T1_SlantFont(cid, sl / 10000.0);
-
- return SUCCESS;
-}
-
-
-int
-find_T1_font(const char *texname)
-{
- /* Step 1b in the scenario above. xdvi knows that this font is
- needed. Check if it is available, but do not load it yet.
- Return the fontmap index at which the font was found */
-
- int idx; /* Iterator, t1 font id */
- char *filename;
- int fl, el; /* Fontname length, encoding name length */
- int encoded = -1;
- char *mname; /* Modified font name */
- size_t i;
-
- encoded = 0;
-
- /* First: Check the maps */
- idx = find_texfont(texname);
-
- if (idx != -1) {
- if (fontmaps[idx].force_pk) {
- return idx;
- }
- if (fontmaps[idx].pathname == NULL) {
- filename = kpse_find_file(fontmaps[idx].filename, kpse_type1_format, 0);
- /* It should have been on disk according to the map, but never
- fear, xdvi will try to find it other ways. */
- if (filename == NULL) {
- if (!fontmaps[idx].warned_about) {
- fontmaps[idx].warned_about = True;
- XDVI_WARNING((stderr, "Font map calls for %s, but it was not found (will try PK version instead).",
- fontmaps[idx].filename));
- }
- return -1;
- }
- fontmaps[idx].pathname = filename;
- }
- TRACE_T1((stderr, "find_T1_font map: %s, entered as #%d",texname,idx));
- return idx;
- }
-
-#if 0
- /* SU: Fix for #1295829: If eg. plr10 is missing from ps2pk.map, xdvi
- will use plr10.pfb without reencoding it instead of calling mktexpk
- for plr10.mf which will use the correct encoding.
- */
-
- /* Second: the bare name */
- filename = kpse_find_file(texname, kpse_type1_format, 0);
-
- if (filename != NULL) {
- idx = setup_encoded_T1_font(NULL, 0, texname, NULL, filename, -1, 0, 0);
- TRACE_T1((stderr, "find_T1_font bare enc: %s, entered as #%d", texname, idx));
- return idx;
- }
-#endif
-
- /* Third: Implied encoding? */
- fl = strlen(texname);
-
- for (i = 0; i < enclidx; i++) {
- if (encodings[i].enc == NULL)
- continue;
-
- el = strlen(encodings[i].enc);
-
- /* Note: the encodings map is short, so the strcmp doesn't hurt here */
- if (strcmp(texname + (fl - el), encodings[i].enc) == 0) {
- /* Found a matching encoding */
- TRACE_T1((stderr, "Encoding match: %s - %s", texname,
- encodings[i].enc));
-
- mname = malloc(fl + 2);
- strcpy(mname, texname);
- mname[fl - el] = '\0';
- /* If we had 'ptmr8r' the we now look for 'ptmr' */
- filename = kpse_find_file(mname, kpse_type1_format, 0);
- if (filename == NULL) {
- /* No? Look for ptmr8a. 8a postfix is oft used on raw fonts */
- strcat(mname, "8a");
- filename = kpse_find_file(mname, kpse_type1_format, 0);
- }
- if (filename != NULL) {
- idx = setup_encoded_T1_font(NULL, 0, texname, mname, filename, i, 0, 0);
- TRACE_T1((stderr, "find_T1_font implied enc: %s, is #%d", texname, idx));
- return idx;
- }
-
- free(mname);
- /* Now we have tried everything. Time to give up. */
- return -1;
-
- } /* If (strcmp...) */
- } /* for */
- return -1;
-}
-
-/* ************************* CONFIG FILE READING ************************ */
-
-
-static int
-new_encoding(const char *enc, const char *file)
-{
- /* (Possibly) new encoding entered from .cfg file, or from dvips
- map. When entered from dvips map the enc is null/anonymous */
-
- size_t i;
- static size_t enclidx_max = 0;
- static const size_t enclidx_step = 16;
-
- /* Shirley! You're jesting! */
- if (file == NULL)
- return -1;
-
- if (enc == NULL) {
- /* Enter by file name. First check if the file has been entered
- already. */
- for (i = 0; i < enclidx; i++) {
- if (strcmp(encodings[i].file, file) == 0) {
- return i;
- }
- }
- }
- else {
- /* Enter by encoding name. Check if already loaded first. */
- for (i = 0; i < enclidx; i++) {
- if (encodings[i].enc != NULL && strcmp(encodings[i].enc, enc) == 0)
- return i;
- }
- }
-
- /* Bonafide new encoding */
-
- while (enclidx >= enclidx_max) {
- enclidx_max += enclidx_step;
- encodings = xrealloc(encodings, enclidx_max * sizeof *encodings);
-
- TRACE_T1((stderr, "Enlarged encoding map from %lu to %lu entries",
- (unsigned long)enclidx, (unsigned long)enclidx_max));
- }
-
- TRACE_T1((stderr, "New encoding #%lu: '%s' -> '%s'", (unsigned long)enclidx, enc ? enc : "<NULL>", file));
-
- /* The encoding name is optional */
- encodings[enclidx].enc = NULL;
- if (enc != NULL)
- encodings[enclidx].enc = xstrdup(enc);
-
- /* The file name is required */
- encodings[enclidx].file = xstrdup(file);
- encodings[enclidx].vector = NULL; /* Demand load later */
-
- return enclidx++;
-}
-
-
-void
-add_T1_mapentry(int lineno,
- const char *mapfile,
- const char *name,
- const char *file,
- const char *vec,
- char *spec)
-{
- /* This is called from read_map_file, once for each fontmap line `lineno'. We
- will dutifully enter the information into our fontmap table */
-
- static char delim[] = "\t ";
- char *last, *current;
- float number;
- int extend = 0;
- int slant = 0;
-
- TRACE_T1_VERBOSE((stderr, "%s:%d: %s -> %s Enc: %s Spec: %s",
- mapfile, lineno,
- name, file,
- vec == NULL ? "<none>" : vec,
- spec == NULL ? "<none>" : spec));
-
- if (spec != NULL) {
- /* Try to analyze the postscript string. We recognize two things:
- "n ExtendFont" and "m SlantFont". n can be a decimal number in
- which case it's an extension factor, or a integer, in which
- case it's a charspace unit? In any case 850 = .85 */
-
- last = strtok(spec, delim);
- current = strtok(NULL, delim);
- while (current != NULL) {
- if (strcmp(current, "ExtendFont") == 0) {
- sscanf(last, "%f", &number);
- if (number < 10.0)
- extend = number * 1000.0;
- else
- extend = number;
- }
- else if (strcmp(current, "SlantFont") == 0) {
- sscanf(last, "%f", &number);
- slant = number * 10000.0;
- }
- last = current;
- current = strtok(NULL, delim);
- }
- }
-
- setup_encoded_T1_font(mapfile, lineno,
- name, file, NULL, new_encoding(NULL, vec), extend,
- slant);
-}
-
-static void
-read_cfg_file(const char *file)
-{
- char *filename;
- FILE *fp;
- int len;
- char *keyword;
- char *ptr;
- char *buffer;
- char *enc;
- char *name;
- int i;
- static const char delim[] = "\t \n\r";
- Boolean found_no_map_files = True;
-
- if (file == NULL)
- file = "xdvi.cfg";
-
- filename = kpse_find_file(file, kpse_program_text_format, 1);
- if (filename == NULL) {
- statusline_error(STATUS_MEDIUM, "Warning: Unable to find \"%s\"!", file);
- return;
- }
-
- if ((fp = XFOPEN(filename, "r")) == NULL) {
- XDVI_ERROR((stderr, "Cannot open config file `%s' for reading: %s", filename, strerror(errno)));
- return;
- }
-
- TRACE_T1((stderr, "Reading cfg file %s", filename));
-
- buffer = xmalloc(BUFFER_SIZE);
-
- while (fgets(buffer, BUFFER_SIZE, fp) != NULL) {
- len = strlen(buffer);
- if (buffer[len - 1] != '\n') {
- int c;
- /* this really shouldn't happen ... */
- XDVI_WARNING((stderr, "Skipping overlong line (> %d characters) in config file `%s':\n%s ...",
- BUFFER_SIZE, filename, buffer));
- /* read until end of this line */
- while((c = fgetc(fp)) != '\n' && c != EOF) { ; }
- continue;
- }
-
- keyword = buffer;
-
- /* Skip leading whitespace */
- while (keyword[0] != '\0' && (keyword[0] == ' ' || keyword[0] == '\t'))
- keyword++;
-
- /* % in first column is a correct comment */
- if (keyword[0] == '%' || keyword[0] == '\0' || keyword[0] == '\n')
- continue;
-
- keyword = strtok(keyword, delim);
-
- if (strcmp(keyword, "dvipsmap") == 0) {
- if ((ptr = strtok(NULL, delim)) == NULL) {
- XDVI_WARNING((stderr, "Syntax error in entry \"%s\"", buffer));
- continue;
- }
- TRACE_T1((stderr, "DVIPSMAP: '%s'", ptr));
-
- if (read_map_file(ptr)) {
- found_no_map_files = False;
- }
- else {
- TRACE_T1((stderr, "Read map file: '%s'", ptr));
- }
- }
- else if (strcmp(keyword, "encmap") == 0) {
- popup_message(globals.widgets.top_level,
- MSG_ERR,
- "Your xdvi.cfg file is for a previous version of xdvik. Please replace "
- "it by the xdvi.cfg file in the current xdvik distribution.",
- "Keyword \"encmap\" in xdvi.cfg is no longer supported, "
- "please update the config file %s.",
- filename);
- }
- else if (strcmp(keyword, "enc") == 0) {
- enc = strtok(NULL, delim);
- name = strtok(NULL, delim);
- if ((ptr = strtok(NULL, delim)) == NULL) {
- XDVI_WARNING((stderr, "Syntax error in entry \"%s\" (skipping line)", buffer));
- continue;
- }
- i = new_encoding(enc, ptr);
- TRACE_T1((stderr, "Encoding[%d]: '%s' = '%s' -> '%s'", i, enc, name, ptr));
- } else {
- /* again, nag them with a popup so that they'll do something about this ... */
- popup_message(globals.widgets.top_level,
- MSG_ERR,
- "Please check the syntax of your config file. "
- "Valid keywords are: \"enc\" and \"dvipsmap\".",
- "Skipping unknown keyword \"%s\" in config file %s.",
- keyword, filename);
- }
- }
-
- if (found_no_map_files) {
- /* nag 'em with a popup so that they'll do something about this ... */
- popup_message(globals.widgets.top_level,
- MSG_ERR,
- "Direct Type 1 font rendering via T1lib gives you many benefits, such as:\n"
- " - quicker startup time, since no bitmap fonts need to be generated;\n"
- " - saving disk space for storing the bitmap fonts.\n"
- "To fix this error, check that the file `ps2pk.map' is located somewhere "
- "in your XDVIINPUTS path. Have a look at the xdvi wrapper shell script "
- "(type \"which xdvi\" to locate that shell script) for the current setting "
- "of XDVIINPUTS.",
- "Could not load any of the map files listed in xdvi.cfg - disabling T1lib.");
- resource.t1lib = False;
- }
- fclose(fp);
-
- free(buffer);
- free(filename);
-}
-
-
-/* **************************** GLYPH DRAWING *************************** */
-
-
-/* Set character# ch */
-
-static struct glyph *
-get_t1_glyph(
-#ifdef TEXXET
- wide_ubyte cmd,
-#endif
- wide_ubyte ch, t1FontLoadStatusT *flag,
- Boolean is_geom_scan)
-{
-
- /*
- A problem is that there are some gaps in math modes tall braces '{',
- (see for example the amstex users guide). These gaps are seen less if a
- small size factor is applied, 1.03 seems nice. This does not seem like
- the Right Thing though. Also gaps do not show up in the fullsize
- window.
-
- All in all the factor has been dropped. Despite the beauty flaw.
- */
-
- float size = currinf.fontp->pixsize * 72 / resource.pixels_per_inch;
-
- int id = currinf.fontp->t1id;
- int t1libid = fontmaps[id].t1libid;
-
- GLYPH *G; /* t1lib glyph */
- struct glyph *g; /* xdvi glyph */
-
-#ifdef TEXXET
- UNUSED(cmd);
-#endif
- *flag = SUCCESS;
-
-#if COLOR
- if (!is_geom_scan && fg_active != fg_current)
- do_color_change();
-#endif
-
- /* return immediately if we need to use the fallback PK */
- if (fontmaps[id].force_pk)
- return NULL;
-
- TRACE_T1((stderr, "pixsize: %f, ppi %d, sf: %d, size: %f",
- currinf.fontp->pixsize, resource.pixels_per_inch,
- currwin.shrinkfactor, size));
-
- if (t1libid == -1) {
- TRACE_T1((stderr, "trying to load font %d", id));
- *flag = load_font_now(id, currinf.fontp);
- if (*flag < 0) {
- TRACE_T1((stderr, "load_font_now failed for T1 font %d", id));
- return NULL;
- }
- t1libid = fontmaps[id].t1libid;
- }
-
- TRACE_T1((stderr, "Setting 0x%x `%c' of %d, at %f(%.2fpt), shrinkage is %d",
- ch,
- isprint(ch) ? ch : '?',
- t1libid, currinf.fontp->pixsize,
- size, currwin.shrinkfactor));
-
- /* Check if the glyph already has been rendered */
- if (ch > currinf.fontp->maxchar) {
- /* in this case, the replacement font is 'smaller' than the requested one.
- This will later lead to a warning: "Character 9561 not defined in font cmr10".
- */
- return NULL;
- }
- if ((g = &currinf.fontp->glyph[ch])->bitmap.bits == NULL) {
- int bitmapbytes;
- int h;
- unsigned char *f;
- unsigned char *t;
- /* Not rendered: Generate xdvi glyph from t1font */
-
- g->addr = 1; /* Dummy, should not provoke errors other places in xdvi */
-
- /* Use the width from the tfm file */
- g->dvi_adv = tfminfo[fontmaps[id].tfmidx].widths[ch] * currinf.fontp->dimconv;
- TRACE_T1((stderr, "0x%x, dvi_adv = %ld; dimconv: %f",
- ch,
- tfminfo[fontmaps[id].tfmidx].widths[ch],
- currinf.fontp->dimconv));
-
- /* Render the glyph. Size here should be postscript bigpoints */
- G = T1_SetChar(t1libid, ch, size, NULL);
- if (G == NULL) {
- /* This can happen e.g. if font is too small; example with plain TeX:
- \magnification=50 Hello, world!\bye
- Correction (2010-01-05): this doesn't happen anymore, now that
- (*ahem*) the size is no longer rounded to an integer.
- */
- statusline_info(STATUS_FOREVER,
- "Error rendering character 0x%x `%c' - replacing by whitespace",
- ch,
- isprint(ch) ? ch : '?');
- XDVI_ERROR((stderr, "T1lib failed for character 0x%x `%c': %s. Replacing by whitespace.",
- ch, isprint(ch) ? ch : '?',
- T1_StrError(T1_errno)));
- g->bitmap.w = 1;
- g->bitmap.h = 1;
- g->bitmap.bytes_wide = T1PAD(g->bitmap.w, archpad) / 8;
- alloc_bitmap(&g->bitmap);
- memset(g->bitmap.bits, 0, g->bitmap.h * g->bitmap.bytes_wide);
- g->x = 0;
- g->y = 0;
-#if COLOR
- g->fg = fg_current;
-#endif
- return g;
- }
-
- if (G->bits == NULL) {
-#if 0
- /* in this case the glyph can either be a whitespace or .notdef.
- We would like to warn about the latter, but I haven't found a way
- to distinguish between the two cases that works reliably.
-
- If the font has built-in encoding, we can't use the following
- test to check for the name, since the index i doesn't correspond to "ch":
- */
- char **glyph_names = T1_GetAllCharNames(t1libid);
- for (i = 0; glyph_names[i] != NULL; i++) {
- fprintf(stderr, "CHAR %d: %s\n", i, glyph_names[i]);
- }
- free(glyph_names); // not sure about this ...
-
- /*
- For ~/projects/xdvik/bugs/cjk-notdef-problem, this prints:
-
- CHAR 0: .notdef
- CHAR 1: uni3000
-
- even though the character at point 0 is uni3000.
-
- For external encodings, it should be possible to look at the encoding
- vector:
- */
-
- int enc = fontmaps[id].enc;
- if (enc != -1) {
- if (encodings[enc].vector == NULL) {
- fprintf(stderr, "Unexpected: vector is NULL!\n");
- }
- else {
- fprintf(stderr, "GOT CHAR: %s\n", encodings[enc].vector[ch]);
- }
- }
-
- /*
- Also checking for the font dimens doesn't help in this case - the
- results are identical for .notdef and uni3000:
- */
-
- fprintf(stderr, "DIMENS: %d,%d,%d,%d\n",
- G->metrics.rightSideBearing, G->metrics.leftSideBearing,
- G->metrics.advanceX, G->metrics.advanceY);
-
- /* the following simple test for whitespace doesn't work for Chinese fonts either: */
- if (ch != ' ') {
- char index[128];
- char *fontname = xstrdup(currinf.fontp->fontname);
- size_t dummy = 0;
-
- SNPRINTF(index, sizeof index, "%d", ch);
- fontname = xstrcat(fontname, index);
- if (font_warn_hash.size == 0) {
- /* TODO: print to statusline */
- /* popup_message(MSG_WARN, */
- /* NULL, */
- /* "Unexpected blank character (.notdef) in font %s, " */
- /* "replacing with whitespace (see output to stderr for details). " */
- /* "This might indicate that the font %s is missing " */
- /* "from the font map, or that it has been specified " */
- /* "with a wrong encoding.", */
- /* currinf.fontp->fontname, currinf.fontp->fontname); */
- font_warn_hash = hash_create(T1FONTS_INITIAL_HASHTABLE_SIZE);
- }
-
- if (!find_str_int_hash(&font_warn_hash, fontname, &dummy)) {
- if (!resource.hush_chars)
- XDVI_WARNING((stderr, "Character %d is mapped to .notdef in font %s (page %d), "
- "replaced by whitespace.",
- ch, currinf.fontp->fontname, current_page + 1));
- put_str_int_hash(&font_warn_hash, fontname, dummy);
- }
- else {
- free(fontname);
- }
- }
-#endif
- /* *flag = FAILURE_BLANK; */
- /* g->addr = -1; */
- /* return NULL; */
-
- /* FIXME: g->dvi_adv is only used when invoking set_char(), not with
- set_empty_char(), and the former apparently needs a valid bitmap.
- Check how this is done without t1lib.
- */
- TRACE_T1((stderr, "replaced .notdef or whitespace char 0x%02x by space.\n", ch));
- g->bitmap.w = 1;
- g->bitmap.h = 1;
- g->bitmap.bytes_wide = T1PAD(g->bitmap.w, archpad) / 8;
- alloc_bitmap(&g->bitmap);
- memset(g->bitmap.bits, 0, g->bitmap.h * g->bitmap.bytes_wide);
- g->x = 0;
- g->y = 0;
-#if COLOR
- g->fg = fg_current;
-#endif
- return g;
- }
-
- g->bitmap.w = abs(G->metrics.rightSideBearing - G->metrics.leftSideBearing);
- g->bitmap.h = abs(G->metrics.descent - G->metrics.ascent);
- g->bitmap.bytes_wide = T1PAD(g->bitmap.w, archpad) / 8;
- alloc_bitmap(&g->bitmap);
-
- bitmapbytes = g->bitmap.bytes_wide * g->bitmap.h;
-
- if (padMismatch) {
- /* Fix alignment mismatch */
- int from_bytes = T1PAD(g->bitmap.w, 8) / 8;
-
- f = (unsigned char *)G->bits;
- t = (unsigned char *)g->bitmap.bits;
-
- memset(t, 0, bitmapbytes); /* OR ELSE! you get garbage */
-
- for (h = 0 ; h < g->bitmap.h; h++) {
- memcpy(t, f, from_bytes);
- f += from_bytes;
- t += g->bitmap.bytes_wide;
- }
-
-
- } else {
- /* t1lib and arch alignment matches */
- memcpy(g->bitmap.bits, G->bits, bitmapbytes);
- }
-
-#ifdef WORDS_BIGENDIAN
- /* xdvi expects the bits to be reversed according to
- endianness. t1lib expects no such thing. This loop reverses
- the bit order in all the bytes. -janl 18/5/2001 */
- t = (unsigned char *)g->bitmap.bits;
-
- for (h = 0; h < bitmapbytes; h++) {
- *t = rbits[*t];
- t++;
- }
-#endif
-
- g->x = -G->metrics.leftSideBearing; /* Opposed x-axis */
- g->y = G->metrics.ascent;
-#if COLOR
- g->fg = fg_current;
-#endif
- }
- return g;
-}
-
-setcharRetvalT
-set_t1_char(
-#ifdef TEXXET
- wide_ubyte cmd,
-#endif
- wide_ubyte ch)
-{
- t1FontLoadStatusT flag;
-
- /*
- get_t1_glyph() will itself set currinf.fontp->set_char_p
- to set_empty_char() or set_char() if it failed to load the
- T1 version, but for the *current* call of set_t1_char,
- we still need to know whether (1) or (2) holds:
- (1) Type1 font hasn't been found but PK is working,
- use set_char() to set the PK version
- (2) neither Type1 nor PK have been found (this is the
- FAILURE_BLANK case), use set_empty_char().
- So we need the flag to pass this additional information.
- */
-#ifdef TEXXET
- (void)get_t1_glyph(cmd, ch, &flag, False);
- if (flag == FAILURE_BLANK)
- set_empty_char(cmd, ch);
- else
- set_char(cmd, ch);
- return;
-#else
- (void)get_t1_glyph(ch, &flag, False);
- if (flag == FAILURE_BLANK)
- return set_empty_char(ch);
- else
- return set_char(ch);
-#endif
-}
-
-void read_T1_char(struct font *fontp, wide_ubyte ch)
-{
- UNUSED(fontp);
- UNUSED(ch);
- /* Should never be called */
- XDVI_ABORT((stderr, "%s:%d: asked to load %c", __FILE__, __LINE__, ch));
-}
-
-void init_t1(void)
-{
- int i;
- void *success;
- /* Attempt to set needed padding.
-
- FIXME: This is not really the required alignment/padding. On
- ix86 the requirement for int * is 8 bits, on sparc on the other
- hand it's 32 bits. Even so, some operations will be faster if
- the bitmaps lines are alligned "better". But on the other hand
- this requires a more complex glyph copying operation...
-
- - janl 16/5/2001
- */
- archpad = BMBYTES * 8;
- i = T1_SetBitmapPad(archpad);
- if (i == -1) {
- /* Failed, revert to 8 bits and compilicated bitmap copying */
- padMismatch = True;
- T1_SetBitmapPad(8);
- } else {
- padMismatch = False;
- }
-
- /* Initialize t1lib, use LOGFILE to get logging, NO_LOGFILE otherwise */
- /* Under NO circumstances remove T1_NO_AFM, it slows us down a LOT */
-
- if (globals.debug & DBG_T1) {
- XDVI_INFO((stdout, "Additional t1lib messages may be found in \"t1lib.log\"."));
- success = T1_InitLib(LOGFILE | T1_NO_AFM | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE);
- }
- else
- success = T1_InitLib(NO_LOGFILE | T1_NO_AFM | IGNORE_CONFIGFILE | IGNORE_FONTDATABASE);
- if (success == NULL) {
- XDVI_FATAL((stderr, "Initialization of t1lib failed!"));
- }
- T1_SetLogLevel(T1LOG_DEBUG);
-
- if (resource.subpixel_order == SUBPIXEL_NONE)
- T1_SetDeviceResolutions(resource.pixels_per_inch,
- resource.pixels_per_inch);
- else
- T1_SetDeviceResolutions(3 * resource.pixels_per_inch,
- resource.pixels_per_inch);
-
- read_cfg_file(NULL);
-}
-
-#endif /* T1LIB */
-
-
#if GREY
extern double pow();
diff --git a/Build/source/texk/xdvik/dvi-draw.h b/Build/source/texk/xdvik/dvi-draw.h
index bacb8a721f6..f79667b2f23 100644
--- a/Build/source/texk/xdvik/dvi-draw.h
+++ b/Build/source/texk/xdvik/dvi-draw.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1990-2004 Paul Vojta and the xdvik development team
+ * Copyright (c) 1990-2013 Paul Vojta and the xdvik development team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -90,18 +90,6 @@ extern void source_forward_search(const char *);
extern void anchor_search(const char *str);
-#ifdef T1LIB
-extern void init_t1(void);
-extern void add_T1_mapentry(int lineno, const char *mapfile, const char *name, const char *file, const char *vec, char *psec);
-extern void read_T1_char(struct font *, wide_ubyte);
-extern int find_T1_font(const char *);
-extern setcharRetvalT set_t1_char(
-#ifdef TEXXET
- wide_ubyte cmd,
-#endif
- wide_ubyte ch);
-#endif /* T1LIB */
-
/*
this is needed by any program that wants to use spcl_scan,
@@ -111,6 +99,7 @@ extern setcharRetvalT set_t1_char(
#define DVI_BUFFER_LEN 2048
#endif
+extern void open_font_file(struct font *fontp);
extern long text_do_char(FILE *fp, struct scan_info *info, wide_ubyte ch);
extern Boolean spcl_scan(Boolean(*spcl_proc) (char *str, int str_len, void *data), void *data, Boolean return_if_found, FILE *fp);
@@ -142,6 +131,12 @@ extern setcharRetvalT set_vf_char(
#endif
wide_ubyte ch);
+extern setcharRetvalT set_ft_char(
+#if TEXXET
+ wide_ubyte cmd,
+#endif
+ wide_ubyte ch);
+
#ifdef GREY
void init_plane_masks(void);
#endif
diff --git a/Build/source/texk/xdvik/dvi-init.c b/Build/source/texk/xdvik/dvi-init.c
index dea3950544f..10e425fe303 100644
--- a/Build/source/texk/xdvik/dvi-init.c
+++ b/Build/source/texk/xdvik/dvi-init.c
@@ -1,6 +1,6 @@
/*========================================================================*\
-Copyright (c) 1990-2004 Paul Vojta
+Copyright (c) 1990-2013 Paul Vojta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -48,23 +48,16 @@ in xdvi.c.
#include "sfSelFile.h"
#include "xm_toolbar.h"
#include "pagehist.h"
-
-#if DELAYED_MKTEXPK
-#include "font-open.h" /* for reinit_missing_font_count() */
-#endif
-
-
-
-#ifdef T1LIB
-#include "t1lib.h"
-#endif
-
#include "message-window.h"
#include "search-internal.h"
#include "statusline.h"
#include "events.h"
#include "font-open.h"
+#if FREETYPE
+# include FT_SIZES_H
+#endif
+
#define PK_PRE 247
#define PK_ID 89
#define PK_MAGIC ((PK_PRE << 8) | PK_ID)
@@ -235,10 +228,49 @@ free_unused_fonts(void)
*fontpp = fontp->next; /* remove from list */
free(fontp->fontname);
if (fontp->flags & FONT_LOADED) {
+#if FREETYPE
+ if (fontp->ft != NULL) { /* if FreeType font */
+ struct ftfont *ft;
+
+ ft = fontp->ft;
+ if (fontp->size != NULL)
+ FT_Done_Size(fontp->size);
+ if (fontp == ft->first_size) {
+ if (fontp->next_size == NULL) {
+ /* if this is the only size of this font face */
+ FT_Done_Face(ft->face);
+ ft->t1->ft = NULL;
+ free(ft);
+ }
+ else {
+ struct font *fp2;
+
+ ft->first_size = fp2 = fontp->next_size;
+ fp2->file = fontp->file;
+ fontp->file = NULL;
+ fp2->filename = fontp->filename;
+ fontp->filename = NULL;
+ fp2->timestamp = fontp->timestamp;
+ }
+ }
+ else {
+ struct font *fp2;
+
+ fp2 = ft->first_size;
+ while (fp2->next_size != fontp)
+ fp2 = fp2->next_size;
+ fp2->next_size = fontp->next_size;
+ }
+ }
+#endif
if (fontp->file != NULL) {
fclose(fontp->file);
}
- free(fontp->filename);
+#if FREETYPE
+ if (fontp->filename != NULL)
+#endif
+ free((char *) fontp->filename);
+
if (fontp->flags & FONT_VIRTUAL) {
struct macro *m;
@@ -381,7 +413,7 @@ realloc_virtual_font(struct font *fontp, wide_ubyte newsize)
*/
Boolean
-load_font(struct font *fontp, Boolean use_t1lib
+load_font(struct font *fontp
#if DELAYED_MKTEXPK
, Boolean load_font_now
#endif
@@ -421,26 +453,18 @@ load_font(struct font *fontp, Boolean use_t1lib
#endif
fontp,
(const char **) &font_found,
- &size_found,
-#ifdef T1LIB
- &fontp->t1id,
-#endif
- use_t1lib);
+ &size_found);
#if DELAYED_MKTEXPK
if (!load_font_now)
return True;
#endif
-
-#ifdef T1LIB
- if (fontp->t1id >= 0 && use_t1lib) {
- /* It's a type1 font */
- fontp->fsize = fsize; /* It comes in all sizes */
+
+#if FREETYPE
+ if (fontp->ft != NULL) { /* if freetype font */
fontp->timestamp = ++current_timestamp;
fontp->maxchar = maxchar = 255;
- fontp->set_char_p = set_t1_char;
- /* read_T1_char is a dummy */
- fontp->read_char = read_T1_char;
+ fontp->set_char_p = set_ft_char;
fontp->glyph = xmalloc (256 * sizeof (struct glyph));
memset((char *) fontp->glyph, 0, 256 * sizeof (struct glyph));
fontp->flags |= FONT_LOADED;
@@ -454,8 +478,9 @@ load_font(struct font *fontp, Boolean use_t1lib
}
return True;
}
-#endif /* T1LIB */
- /* when not using T1lib, fontp->file == NULL means total failure */
+#endif /* FREETYPE */
+
+ /* when it's not a freetype font, fontp->file == NULL means total failure */
if (fontp->file == NULL) {
if (globals.ev.flags & EV_GE_NEWDOC)
return False;
@@ -505,7 +530,8 @@ load_font(struct font *fontp, Boolean use_t1lib
(void)read_VF_index(fontp, (wide_bool)hushcs);
break;
default:
- XDVI_FATAL((stderr, "Cannot recognize format for font file %s", fontp->filename));
+ XDVI_FATAL((stderr, "Cannot recognize format for font file %s",
+ fontp->filename));
break;
}
@@ -685,19 +711,23 @@ define_font(
fontp->fontname = fontname;
fontp->fsize = fsize;
fontp->magstepval = magstepval;
- fontp->file = NULL; /* needed if it's a virtual font */
+ fontp->file = NULL; /* needed for virtual/freetype fonts */
+ fontp->filename = NULL; /* needed for freetype fonts */
fontp->checksum = checksum;
fontp->flags = FONT_IN_USE;
fontp->dimconv = scale * scale_dimconv / (1 << 20);
fontp->set_char_p = load_n_set_char;
- /* pixsize = scaled size of the font in pixels,
- * = scale * [vfparent->]dimconv / (1 << 16).
- */
- fontp->pixsize =
- (vfparent != NULL ? vfparent->dimconv : dimconv) * scale
- / (1 << 16);
+#if FREETYPE
+ fontp->ft = NULL;
+ /* pixsize = scaled size of the font in pixels,
+ * = scale * [vfparent->]dimconv / (1 << 16).
+ */
+ fontp->pixsize =
+ (vfparent != NULL ? vfparent->dimconv : dimconv) * scale
+ / (1 << 16);
+#endif
if (vfparent == NULL)
- if (!load_font(fontp, resource.t1lib
+ if (!load_font(fontp
#if DELAYED_MKTEXPK
, initialize_fonts
#endif
@@ -734,7 +764,6 @@ define_font(
return fontp;
}
-
/*
@@ -1162,7 +1191,7 @@ make_backup_fp(FILE *source_fp, FILE *target_fp)
#if HAVE_FTRUNCATE
if (ftruncate(tmp_fd, 0) < 0) {
-
+
XDVI_ERROR((stderr, "Couldn't truncate file %s: %s - disabling `useTempFp'; target_fp: %p.",
m_tmp_dvi_name, strerror(errno), target_fp));
resource.use_temp_fp = False;
@@ -1471,7 +1500,7 @@ find_dvi_file(const char *filename, Boolean *tried_dvi_ext, Boolean from_file_hi
new_filename = xstrdup(filename);
new_filename = xstrcat(new_filename, ".dvi");
*tried_dvi_ext = True;
-
+
if (file_exists_p(new_filename, &errflag)) { /* file exists */
char *expanded_filename = expand_filename(new_filename, USE_CWD_PATH);
free(new_filename);
@@ -1541,7 +1570,7 @@ open_dvi_file_wrapper(const char *filename,
real_filename = find_dvi_file(filename, tried_dvi_ext, from_file_history); /* this allocates real_filename */
if (real_filename == NULL)
return False;
-
+
TRACE_HTEX((stderr, "filename |%s| %p from commandline;\ndvi_name: |%s|,\nfilename: |%s|%p",
real_filename, real_filename, globals.dvi_name, filename, (void *)filename));
new_dvi_name = xstrdup(REALPATH(real_filename, canonical_path));
@@ -1642,8 +1671,8 @@ form_dvi_property(void)
dvi_property_length = strlen(globals.dvi_name) + 1; /* also copy the terminating 0 */
dvi_property = xmalloc(dvi_property_length);
- /* NOTE: we don't use dvi_inode like non-k xdvi, since dvi_name is
- always fully expanded with xdvik. */
+ /* NOTE: we don't use dvi_inode like non-k xdvi, since xdvik keeps closer
+ track of when the path points to a different inode. */
strcpy(dvi_property, globals.dvi_name);
}
@@ -1731,7 +1760,7 @@ dvi_file_changed(void)
TRACE_FILES((stderr, "Stat failed, or different timestamp ..."));
globals.dvi_file.time = 0; /* force reload next time also if stat failed */
-
+
if (resource.use_temp_fp) { /* in this case, reload only if file has been written completely */
if (resource.watch_file == 0.0) {
statusline_info(STATUS_MEDIUM, "File corrupted (click on window to reload) ...");
@@ -1751,7 +1780,7 @@ dvi_file_changed(void)
#endif
)) {
TRACE_FILES((stderr, "File OK, reloading ..."));
-
+
globals.ev.flags |= EV_RELOAD;
return True;
}
diff --git a/Build/source/texk/xdvik/dvi-init.h b/Build/source/texk/xdvik/dvi-init.h
index 01aabf48a0b..c762382c3fe 100644
--- a/Build/source/texk/xdvik/dvi-init.h
+++ b/Build/source/texk/xdvik/dvi-init.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1990-2004 Paul Vojta and the xdvik development team
+ * Copyright (c) 1990-2013 Paul Vojta and the xdvik development team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -27,6 +27,11 @@
#include "xdvi-config.h"
#include "xdvi.h"
+#if FREETYPE
+# include <ft2build.h>
+# include FT_FREETYPE_H
+#endif
+
typedef enum {
NO_ERROR = 0,
WRONG_DVI_VERSION,
@@ -74,7 +79,7 @@ struct bitmap {
/*
* Per-character information.
- * There is one of these for each character in a font (raster fonts only).
+ * There is one of these for each character in a font (non-virtual fonts only).
* All fields are filled in at font definition time,
* except for the bitmap, which is "faulted in"
* when the character is first referenced.
@@ -139,14 +144,14 @@ struct font {
float fsize; /* size information (dots per inch) */
int magstepval; /* magstep number * two, or NOMAGSTP */
FILE *file; /* open font file or NULL */
- char *filename; /* name of font file */
+ const char *filename; /* name of font file */
long checksum; /* checksum */
unsigned short timestamp; /* for LRU management of fonts */
ubyte flags; /* flags byte (see values below) */
wide_ubyte maxchar; /* largest character code */
double dimconv; /* size conversion factor */
set_char_proc set_char_p; /* proc used to set char */
- /* these fields are used by (loaded) raster fonts */
+ /* these fields are used by (loaded) non-virtual fonts */
read_char_proc read_char; /* function to read bitmap */
struct glyph *glyph;
/* these fields are used by (loaded) virtual fonts */
@@ -154,9 +159,13 @@ struct font {
struct tn *vf_chain; /* ditto, if TeXnumber >= VFTABLELEN */
struct font *first_font; /* first font defined */
struct macro *macro;
- /* These were added for t1 use */
- int t1id;
- double pixsize; /* scaled size of font in pixels */
+#if FREETYPE
+ /* these fields are used by (loaded) FreeType fonts */
+ struct ftfont *ft; /* master record for font (all sizes) */
+ double pixsize; /* scaled size of the font in pixels */
+ FT_Size size;
+ struct font *next_size; /* next font from same face */
+#endif
};
struct tn {
@@ -173,8 +182,7 @@ extern void full_reset_colors(void);
#endif
extern void realloc_font(struct font *, wide_ubyte);
extern void realloc_virtual_font(struct font *, wide_ubyte);
-extern Boolean load_font(struct font *,
- Boolean use_t1lib
+extern Boolean load_font(struct font *
#if DELAYED_MKTEXPK
, Boolean load_font_now
#endif
@@ -186,7 +194,7 @@ extern struct font *define_font(
Boolean initialize_fonts,
#else
Boolean load_font_now,
-#endif
+#endif
FILE *,
wide_ubyte,
struct font *,
@@ -206,6 +214,10 @@ extern void read_PK_index(struct font *, wide_bool);
extern void read_GF_index(struct font *, wide_bool);
extern unsigned long read_VF_index(struct font *, wide_bool);
+#if FREETYPE
+extern Boolean load_ft_font(struct font *fontp);
+#endif
+
extern Boolean set_paper_type(const char *arg);
extern Boolean find_postamble(FILE *fp, dviErrFlagT *errflag);
diff --git a/Build/source/texk/xdvik/encodings.c b/Build/source/texk/xdvik/encodings.c
index 9910755b4d5..b7ee14859fe 100644
--- a/Build/source/texk/xdvik/encodings.c
+++ b/Build/source/texk/xdvik/encodings.c
@@ -42,7 +42,7 @@
*/
-/* The rest of the file is Copyright (c) 2003-2004 the xdvik development team
+/* The rest of the file is Copyright (c) 2003-2013 the xdvik development team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -3739,7 +3739,7 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf)
hash_initialized = True;
}
if (!find_str_int_hash(&unknown_font_hash, fontname, &dummy)) {
- if (resource.t1lib) {
+ if (resource.freetype) {
XDVI_WARNING((stderr,
"guess_encoding(): nothing suitable for \"%s\", assuming Cork encoding.\n"
"(Please tell us about this at "
@@ -3747,7 +3747,7 @@ guess_encoding(wide_ubyte ch, const char *fontname, char *retbuf)
}
else {
XDVI_INFO((stderr,
- "T1lib not enabled, assuming Cork encoding for font \"%s\".\n",
+ "FreeType2 not enabled, assuming Cork encoding for font \"%s\".\n",
fontname));
}
put_str_int_hash(&unknown_font_hash, fontname, dummy);
diff --git a/Build/source/texk/xdvik/events.c b/Build/source/texk/xdvik/events.c
index 1b7be053eae..db582cd9a6c 100644
--- a/Build/source/texk/xdvik/events.c
+++ b/Build/source/texk/xdvik/events.c
@@ -103,6 +103,14 @@ in xdvi.c.
extern int errno;
#endif /* X_NOT_STDC_ENV */
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define XdviBell(display, window, percent) \
+ XkbBell(display, window, percent, (Atom) None)
+#else
+# define XdviBell(display, window, percent) XBell(display, percent)
+#endif
+
/* Linux prefers O_ASYNC over FASYNC; SGI IRIX does the opposite. */
#if !defined(FASYNC) && defined(O_ASYNC)
# define FASYNC O_ASYNC
@@ -1296,7 +1304,7 @@ Act_magnifier(Widget w, XEvent *event,
if (event->type != ButtonPress || mouse_release != null_mouse
|| MAGNIFIER_ACTIVE || mane.shrinkfactor == 1 || *num_params != 1) {
- XBell(DISP, 0);
+ XdviBell(DISP, event->xany.window, 0);
if (mane.shrinkfactor == 1) {
statusline_info(STATUS_SHORT,
"No magnification available at shrink factor 1");
@@ -3875,7 +3883,8 @@ select_cb(const char *filename, void *data)
launch_xdvi(filename, NULL);
}
else {
- set_dvi_name_expand(filename);
+ /* the filename should be complete already, so don't append .dvi */
+ set_dvi_name(expand_filename(filename, USE_CWD_PATH));
current_page = 0; /* switch to first page */
close_old_filep();
globals.ev.flags |= EV_NEWDOC;
@@ -5284,7 +5293,8 @@ redraw(struct WindowRec *windowrec)
that window.
*/
if (have_src_specials && do_update_property
- && globals.win_expose.min_x != 1 && globals.win_expose.max_y - globals.win_expose.min_y != 1
+ && globals.win_expose.min_x != 1
+ && globals.win_expose.max_y - globals.win_expose.min_y != 1
&& currwin.base_x == 0 && currwin.base_y == 0) {
update_window_property(XtWindow(globals.widgets.top_level), True);
}
diff --git a/Build/source/texk/xdvik/font-open.c b/Build/source/texk/xdvik/font-open.c
index ac5a1476766..d0a3cef062f 100644
--- a/Build/source/texk/xdvik/font-open.c
+++ b/Build/source/texk/xdvik/font-open.c
@@ -1,8 +1,8 @@
/*
- font_open.c: find font filenames. This bears no relation (but the
- interface) to the original font_open.c.
+ font-open.c: find font files. The routine font_open() itself bears
+ no relation (except for the interface) to the original font_open().
- Copyright (c) 1999-2004 The texk project
+ Copyright (c) 1999-2013 The texk project
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -34,6 +34,7 @@
#include "print-log.h"
#include "statusline.h"
+#include "message-window.h"
#include "font-open.h"
#include "kpathsea/c-fopen.h"
@@ -87,6 +88,1395 @@
# define XIO_OUT 2
#endif /* HAVE_POLL */
+
+ /* see just above the second init_t1_lookup for why this was chosen */
+#define DVIPS_SETUP 1
+
+#if FREETYPE || PS
+
+/*
+ * The following code handles lookup of Type 1 fonts for use as FreeType
+ * fonts, and for use within MetaPost output.
+ * The system psfonts.map file is read into an AVL tree as needed (lazy
+ * evaluation), and searched for Type 1 fonts.
+ */
+
+struct p_list { /* list of map file names */
+ struct p_list *next;
+ const char *value;
+};
+
+ /* Initialize this list to "psfonts.map". */
+
+static struct p_list psfonts_map = {NULL, "psfonts.map"};
+
+static struct p_list *p_head = &psfonts_map;
+static struct p_list **p_tail = &psfonts_map.next;
+
+static FILE *mapfile = NULL;
+
+static char *ffline = NULL; /* an array used to store */
+ /* the file name being formed. */
+ /* It expands as needed. */
+ /* Also used elsewhere. */
+static size_t ffline_len = 0; /* current length of ffline[] */
+
+/*
+ * Expand ffline[] to at least the given size.
+ */
+
+static void
+expandline(int n)
+{
+ int newlen = n + 128;
+
+ ffline = (ffline == NULL) ? xmalloc(newlen) : xrealloc(ffline, newlen);
+ ffline_len = newlen;
+}
+
+
+/*
+ * Like fgets(), but read an arbitrarily long line into ffline[].
+ */
+
+static Boolean
+fgets_long(FILE *f)
+{
+ int len;
+
+ if (fgets(ffline, ffline_len, f) == NULL)
+ return False;
+
+ len = 0;
+ for (;;) {
+ len += strlen(ffline + len);
+ if (len > 0 && ffline[len - 1] == '\n') {
+ ffline[--len] = '\0';
+ break;
+ }
+ if (len < ffline_len - 1)
+ break;
+ expandline(len);
+ fgets(ffline + len, ffline_len - len, f);
+ }
+
+ return True;
+}
+
+# if DVIPS_SETUP
+
+/*
+ * Get list of map files from dvips config file(s).
+ */
+
+static void
+getdefaults(FILE *f)
+{
+ char *p, *q;
+ int len;
+ struct p_list *p_node;
+
+ while (fgets_long(f)) {
+ p = ffline;
+ while (*p == ' ' || *p == '\t') ++p;
+ if (*p == 'p') {
+ do ++p;
+ while (*p == ' ' || *p == '\t');
+
+ if (*p == '+')
+ do ++p;
+ while (*p == ' ' || *p == '\t');
+ else { /* discard old list */
+ struct p_list *pl, *pl2;
+
+ *p_tail = NULL;
+ pl = p_head;
+ if (pl == &psfonts_map) pl = pl->next;
+ while (pl != NULL) {
+ free((char *) pl->value);
+ pl2 = pl->next;
+ free(pl);
+ pl = pl2;
+ }
+ p_tail = &p_head;
+ }
+
+ /* get white-delimited argument */
+ len = strlen(p);
+ q = memchr(p, ' ', len);
+ if (q != NULL) len = q - p;
+ q = memchr(p, '\t', len);
+ if (q != NULL) len = q - p;
+ p[len] = '\0';
+
+ p_node = xmalloc(sizeof *p_node);
+ p_node->value = xmemdup(p, len + 1);
+ *p_tail = p_node;
+ p_tail = &p_node->next;
+ }
+ }
+
+ fclose(f);
+}
+
+# endif /* DVIPS_SETUP */
+
+/*
+ * Open the next (available) map file.
+ */
+
+static Boolean
+open_next_mapfile(void)
+{
+ char *filename;
+
+ /*
+ * Look for the first (openable) map file. Others will be read later
+ * as needed.
+ */
+
+ while (p_head != NULL) {
+ filename = kpse_find_file(p_head->value, kpse_program_text_format,
+ True);
+ if (filename == NULL)
+ filename = kpse_find_file(p_head->value, kpse_fontmap_format,
+ True);
+ if (filename == NULL) {
+ XDVI_WARNING((stderr,
+ "could not find dvips map file %s; skipping\n",
+ p_head->value));
+ }
+ else {
+ mapfile = XFOPEN(filename, OPEN_MODE);
+ if (mapfile == NULL) {
+ XDVI_WARNING((stderr,
+ "could not open dvips map file %s: %s\n",
+ filename, strerror(errno)));
+ free(filename);
+ }
+ else {
+ TRACE_FT((stderr, "Map file: %s\n", filename));
+ free(filename);
+ return True;
+ }
+ }
+ p_head = p_head->next;
+ }
+
+ return False;
+}
+
+
+/*
+ * Initialize these lookup routines.
+ */
+
+# if DVIPS_SETUP
+
+Boolean
+init_t1_lookup(void)
+{
+ char *filename;
+ struct stat statbuf;
+ FILE *f;
+ char *dvipsrc;
+
+ if (ffline == NULL) expandline(80);
+
+ filename = find_file("config.ps", &statbuf, kpse_dvips_config_format);
+ if (filename == NULL) {
+ TRACE_FT((stderr, "could not find file config.ps; skipping"));
+ }
+ else {
+ f = XFOPEN(filename, OPEN_MODE);
+ if (f == NULL) {
+ TRACE_FT((stderr, "could not open file %s: %s",
+ filename, strerror(errno)));
+ }
+ else
+ getdefaults(f);
+ free(filename);
+ }
+
+ dvipsrc = getenv("DVIPSRC");
+ if (dvipsrc == NULL) {
+ dvipsrc = getenv("HOME");
+ if (dvipsrc != NULL) {
+ size_t n;
+
+ n = strlen(dvipsrc);
+ if (n + 10 > ffline_len) expandline(n + 10);
+ memcpy(ffline, dvipsrc, n);
+ memcpy(ffline + n, "/.dvipsrc", 10);
+ dvipsrc = ffline;
+ }
+ }
+ if (dvipsrc != NULL) {
+ f = XFOPEN(dvipsrc, OPEN_MODE);
+ if (f == NULL) {
+ TRACE_FT((stderr,
+ "could not open dvipsrc file %s: %s; skipping",
+ dvipsrc, strerror(errno)));
+ }
+ else
+ getdefaults(f);
+ }
+
+ filename = find_file("config.xdvi", &statbuf, kpse_dvips_config_format);
+ if (filename == NULL) {
+ TRACE_FT((stderr, "could not find file config.xdvi; skipping"));
+ }
+ else {
+ f = XFOPEN(filename, OPEN_MODE);
+ if (f == NULL) {
+ TRACE_FT((stderr, "could not open file %s: %s",
+ filename, strerror(errno)));
+ }
+ else
+ getdefaults(f);
+ free(filename);
+ }
+
+ *p_tail = NULL;
+
+ return open_next_mapfile();
+}
+
+# else /* !DVIPS_SETUP */
+
+/*
+ * Under the earlier regime, T1 lookup was controlled by xdvi.cfg.
+ *
+ * This has been disabled, for the following reasons.
+ *
+ * It only supported "enc" and "dvipsmap" directives.
+ *
+ * The "enc" directives selected implicit encoding files for fonts ending
+ * in certain character strings (8r, 8c, 8y), unless the map file
+ * explicitly referenced a .enc file. However, among the dvips map files
+ * supplied with TeX Live 2012 (at least) there were no such fonts ending
+ * in 8r and 8y, and the encoding file for the 8c fonts was cork.enc,
+ * which is no longer included in TeX Live.
+ *
+ * As for the dvipsmap directives, it seemed better to use the dvips
+ * configuration method.
+ */
+
+Boolean
+init_t1_lookup(void)
+{
+ char *filename;
+ FILE *fp;
+ char *keyword;
+ char *ptr;
+ struct p_list *p_node;
+ char *enc;
+ char *name;
+ static const char delim[] = "\t \n\r";
+
+ if (ffline == NULL) expandline(80);
+
+ filename = kpse_find_file("xdvi.cfg", kpse_program_text_format, 1);
+ if (filename == NULL) {
+ statusline_error(STATUS_MEDIUM,
+ "Warning: Unable to find \"xdvi.cfg\"!");
+ return open_next_mapfile();
+ }
+
+ if ((fp = XFOPEN(filename, "r")) == NULL) {
+ XDVI_ERROR((stderr, "Cannot open config file `%s' for reading: %s",
+ filename, strerror(errno)));
+ free(filename);
+ return open_next_mapfile();
+ }
+
+ TRACE_FT((stderr, "Reading cfg file %s", filename));
+
+ while (fgets_long(fp)) {
+ keyword = ffline;
+
+ /* Skip leading whitespace */
+ while (*keyword == ' ' || *keyword == '\t')
+ keyword++;
+
+ /* % in first column is a correct comment */
+ if (*keyword == '%' || *keyword == '\0' || *keyword == '\n')
+ continue;
+
+ keyword = strtok(keyword, delim);
+
+ if (strcmp(keyword, "dvipsmap") == 0) {
+ if ((ptr = strtok(NULL, delim)) == NULL) {
+ XDVI_WARNING((stderr, "Syntax error in entry \"%s\"",
+ ffline));
+ continue;
+ }
+ TRACE_FT((stderr, "DVIPSMAP: '%s'", ptr));
+
+ /* Add it to the list for later reading */
+ p_node = xmalloc(sizeof *p_node);
+ p_node->value = xmemdup(ptr, strlen(ptr) + 1);
+ /* If we're still pointing to the default list, remove it */
+ if (p_tail == &psfonts_map.next)
+ p_tail = &p_head;
+ *p_tail = p_node;
+ p_tail = &p_node->next;
+ }
+ else if (strcmp(keyword, "encmap") == 0) {
+ popup_message(globals.widgets.top_level,
+ MSG_ERR,
+ "Your xdvi.cfg file is for a previous version "
+ "of xdvik. Please replace it with the xdvi.cfg file "
+ "in the current xdvik distribution.",
+ "The keyword \"encmap\" in xdvi.cfg is no longer "
+ "supported. Please update the config file %s.",
+ filename);
+ }
+ else if (strcmp(keyword, "enc") == 0) {
+ enc = strtok(NULL, delim);
+ name = strtok(NULL, delim);
+ if ((ptr = strtok(NULL, delim)) == NULL) {
+ XDVI_WARNING((stderr,
+ "Syntax error in entry \"%s\" (skipping line)",
+ ffline));
+ continue;
+ }
+# if 0
+ i = new_encoding(enc, ptr);
+ TRACE_FT((stderr, "Encoding[%d]: '%s' = '%s' -> '%s'",
+ i, enc, name, ptr));
+# endif
+ } else {
+ /* again, nag them with a popup so that they'll do something
+ about this ... */
+ popup_message(globals.widgets.top_level,
+ MSG_ERR,
+ "Please check the syntax of your config file. "
+ "Valid keywords are: \"enc\" and \"dvipsmap\".",
+ "Skipping unknown keyword \"%s\" in config file %s.",
+ keyword, filename);
+ }
+ }
+ *p_tail = NULL; /* terminate linked list of map files */
+
+ fclose(fp);
+ free(filename);
+
+ return open_next_mapfile();
+}
+
+# endif /* not DVIPS_SETUP */
+
+
+/*
+ * Information about Type 1 fonts is stored in an AVL tree.
+ */
+
+static struct avl_t1 *t1_head = NULL;
+
+
+/*
+ * Parse line from psfonts.map file.
+ */
+
+static struct avl_t1 *
+dvips_parse(const char *line)
+{
+ const char *w1p, *encp, *pfp, *qp;
+ size_t w1l, encl, pfl, ql;
+ const char *w2p;
+ size_t w2l;
+ const char *p, *p0;
+ const char *err;
+ struct avl_t1 *t1p;
+ char *q;
+
+ w2l = w1l = encl = pfl = ql = 0;
+ err = NULL;
+ p = line;
+ for (;;) { /* loop over words */
+ while (*p == ' ' || *p == '\t') ++p;
+ if (*p == '\0')
+ break;
+
+ if (*p == '"') { /* quoted string */
+ const char *p_end;
+
+ p0 = p + 1;
+ p_end = p0 + strlen(p0);
+ p = memchr(p0, '"', p_end - p0);
+ if (p == NULL) p = p_end;
+ qp = (ql == 0 ? p0 : NULL);
+ ql += p - p0 + 1;
+ if (*p == '"') ++p;
+ continue;
+ }
+
+ if (*p == '<') { /* encoding or pfa/b file */
+ int wtype = 0;
+
+ ++p;
+ if (*p == '<') {
+ wtype = 1; /* font file */
+ ++p;
+ }
+ else if (*p == '[') {
+ wtype = -1; /* encoding file */
+ ++p;
+ }
+
+ /* find word */
+ while (*p == ' ' || *p == '\t') ++p;
+ p0 = p;
+ while (*p != '\0' && *p != ' ' && *p != '\t') ++p;
+
+ if (wtype == 0 && p > p0 + 4 && p[-4] == '.') {
+ if (memcmp(p - 3, "enc", 3) == 0
+ || memcmp(p - 3, "ENC", 3) == 0)
+ wtype = -1;
+ else if (memcmp(p - 3, "pfa", 3) == 0
+ || memcmp(p - 3, "pfb", 3) == 0
+ || memcmp(p - 3, "PFA", 3) == 0
+ || memcmp(p - 3, "PFB", 3) == 0)
+ wtype = 1;
+ }
+
+ if (wtype > 0) {
+ if (pfl != 0)
+ err = "more than one font file given";
+ else {
+ pfp = p0;
+ pfl = p - p0 + 1;
+ }
+ }
+ else if (wtype < 0) {
+ if (encl != 0)
+ err = "more than one encoding file given";
+ else {
+ encp = p0;
+ encl = p - p0 + 1;
+ }
+ }
+ else
+ err = "cannot identify file type";
+ }
+ else { /* if ordinary word */
+ p0 = p;
+ while (*p != '\0' && *p != ' ' && *p != '\t') ++p;
+ if (w1l == 0) {
+ w1p = p0;
+ w1l = p - p0;
+ }
+ else if (w2l == 0) {
+ w2p = p0;
+ w2l = p - p0;
+ }
+ else
+ err = "more than two non-download words given";
+ }
+ } /* end loop over words */
+
+ if (w1l == 0) {
+ TRACE_FT((stderr,
+ "map file %s: line \"%s\" does not give a font name.",
+ p_head->value, line));
+ return NULL;
+ }
+
+ if (err != NULL) {
+ TRACE_FT((stderr, "map file %s, font %.*s: %s", p_head->value,
+ (int) w1l, w1p, err));
+ return NULL;
+ }
+
+ t1p = (struct avl_t1 *) avladd(w1p, w1l, (struct avl **) &t1_head,
+ sizeof(struct avl_t1));
+
+ if (t1p->key != w1p) { /* if existing record */
+ TRACE_FT((stderr,
+ "map file %s, font %.*s: duplicate record; using first one",
+ p_head->value, (int) w1l, w1p));
+ return NULL;
+ }
+
+ t1p->key = q = xmalloc(w1l + w2l + 1 + pfl + encl + ql);
+
+ memcpy(q, w1p, w1l);
+ q += w1l;
+ t1p->psname = t1p->key;
+ if (w2l != 0) {
+ t1p->psname = q;
+ memcpy(q, w2p, w2l);
+ q += w2l;
+ }
+ *q++ = '\0';
+
+ t1p->fontfile = NULL;
+ if (pfl != 0) {
+ t1p->fontfile = q;
+ memcpy(q, pfp, pfl - 1);
+ q += pfl;
+ q[-1] = '\0';
+ }
+
+ t1p->encname = t1p->addinfo = NULL;
+# if FREETYPE
+ t1p->bad = False;
+ t1p->ft = NULL;
+# endif
+
+ if (encl != 0) {
+ t1p->encname = q;
+ memcpy(q, encp, encl - 1);
+ q += encl;
+ q[-1] = '\0';
+ }
+
+ if (ql != 0) {
+ t1p->addinfo = q;
+ if (qp != 0) {
+ memcpy(q, qp, ql - 1);
+ q += ql;
+ }
+ else { /* multiple quoted strings; rescan to get them */
+ const char *p_end;
+
+ p = line;
+ p_end = p + strlen(p);
+ for (;;) {
+ while (*p == ' ' || *p == '\t') ++p;
+ if (*p == '\0')
+ break;
+
+ /* found a word */
+ if (*p == '"') {
+ ++p;
+ p0 = p;
+ p = memchr(p0, '"', p_end - p0);
+ if (p == NULL) p = p_end;
+ memcpy(q, p0, p - p0);
+ q += p - p0;
+ *q++ = ' ';
+ if (*p == '\0') break;
+ ++p;
+ }
+ else /* skip unquoted word */
+ while (*p != '\0' && *p != ' ' && *p != '\t') ++p;
+ }
+ }
+ q[-1] = '\0';
+ }
+
+ return t1p;
+}
+
+/*
+ * Information on the Ghostscript font aliasing mechanism is kept in
+ * another AVL tree. Each identifier points to a list of strings,
+ * up to one from each Fontmap file. Within a Fontmap file, later entries
+ * for a given string override earlier ones.
+ */
+
+struct avl_gs { /* structure for gs font information */
+ AVL_COMMON;
+ short fontmap_number; /* sequence of most recent entry */
+ Boolean in_use;
+ struct gs_list *list;
+};
+
+struct gs_list { /* list of Fontmap entries for this font name */
+ struct gs_list *next;
+ const char value[0];
+};
+
+static struct avl_gs *gs_head = NULL;
+
+typedef void (*gs_path_proc)(FILE *);
+
+static const char *env_gs_lib;
+
+static FILE *
+gs_try_fopen(const char *str, unsigned int len, const char *name)
+{
+ unsigned int namelen = strlen(name) + 1;
+ FILE *f;
+
+ if (len + namelen + 1 > ffline_len) expandline(len + namelen + 1);
+ memcpy(ffline, str, len);
+ ffline[len] = '/';
+ memcpy(ffline + len + 1, name, namelen);
+
+ f = XFOPEN(ffline, OPEN_MODE);
+
+ TRACE_FT((stderr, "gs_try_fopen: %s: %s", ffline,
+ f != NULL ? "file opened" : strerror(errno)));
+
+ return f;
+}
+
+static FILE *
+gs_path_fopen(const char *name, gs_path_proc proc)
+{
+ const char *str1 = env_gs_lib;
+ const char *str2 = DEFAULT_GS_LIB_PATH;
+ const char *str1_end, *str2_end;
+ const char *p1, *p2;
+ FILE *f;
+
+ if (str1 == NULL) {
+ str1 = str2;
+ str2 = NULL;
+ }
+
+ str1_end = str1 + strlen(str1);
+
+ for (;;) {
+ p1 = memchr(str1, ':', str1_end - str1);
+ if (p1 == NULL) p1 = str1_end;
+ if (p1 == str1) {
+ if (str2 != NULL) {
+ str2_end = str2 + strlen(str2);
+ for (;;) {
+ p2 = memchr(str2, ':', str2_end - str2);
+ if (p2 == NULL) p2 = str2_end;
+ if (p2 > str2) {
+ f = gs_try_fopen(str2, p2 - str2, name);
+ if (f != NULL) {
+ if (proc != NULL)
+ proc(f);
+ else
+ return f;
+ }
+ }
+ if (*p2 == '\0')
+ break;
+ str2 = p2 + 1;
+ }
+ str2 = NULL;
+ }
+ }
+ else {
+ f = gs_try_fopen(str1, p1 - str1, name);
+ if (f != NULL) {
+ if (proc != NULL)
+ proc(f);
+ else
+ return f;
+ }
+ }
+
+ if (*p1 == '\0')
+ break;
+ str1 = p1 + 1;
+ }
+
+ return NULL;
+}
+
+
+static FILE *
+lookup_gs_font(const char *font, const char **path_ret)
+{
+ struct avl_gs *gsfp;
+ int font_len;
+ int i;
+
+ font_len = strlen(font);
+ gsfp = gs_head;
+ for (;;) {
+ if (gsfp == NULL) /* if not found */
+ return NULL;
+
+ i = font_len - gsfp->key_len;
+ if (i == 0)
+ i = memcmp(font, gsfp->key, font_len);
+ if (i == 0) { /* if found */
+ struct gs_list *gl, *gl2, *gl3;
+ FILE *f;
+
+ if (gsfp->in_use) {
+ TRACE_FT((stderr, "Alias loop for %s detected; ignoring.",
+ font));
+ return NULL;
+ }
+
+ /* If we haven't done it yet, reverse the linked list */
+ if (gsfp->fontmap_number != 0) {
+ gsfp->fontmap_number = 0;
+ gl = gsfp->list;
+ gl2 = NULL;
+ while (gl != NULL) {
+ gl3 = gl->next;
+ gl->next = gl2;
+ gl2 = gl;
+ gl = gl3;
+ }
+ gsfp->list = gl2;
+ }
+ gsfp->in_use = True;
+ f = NULL;
+ for (gl = gsfp->list; gl != NULL; gl = gl->next) {
+ if (gl->value[0] == '\0') { /* if alias */
+ TRACE_FT((stderr, "Found alias %s --> %s",
+ font, gl->value + 1));
+ f = lookup_gs_font(gl->value + 1, path_ret);
+ if (f == NULL)
+ TRACE_FT((stderr, "Alias %s not found.",
+ gl->value + 1));
+ if (f != NULL) break;
+ }
+ else {
+ TRACE_FT((stderr, "Checking file %s", gl->value));
+ if (gl->value[0] == '/' || (gl->value[0] == '.'
+ && (gl->value[1] == '/' || (gl->value[1] == '.'
+ && gl->value[2] == '/')))) {
+ f = XFOPEN(gl->value, OPEN_MODE);
+ if (f != NULL) {
+ *path_ret = xstrdup(gl->value);
+ break;
+ }
+ }
+ else {
+ f = gs_path_fopen(gl->value, NULL);
+ if (f != NULL) {
+ *path_ret = xstrdup(ffline);
+ break;
+ }
+ }
+ }
+ }
+ gsfp->in_use = False;
+ return f;
+ }
+ gsfp = (struct avl_gs *) (i < 0 ? gsfp->left : gsfp->right);
+ }
+}
+
+
+#define GS_BUF_SIZE 4096
+
+struct gsfile {
+ FILE *f;
+ unsigned char *buffer;
+ const unsigned char *bufpos;
+ const unsigned char *buf_end;
+};
+
+static Boolean
+gs_fillbuf(struct gsfile *gsf)
+{
+ unsigned char *p;
+ unsigned int len;
+
+ if (gsf->buf_end < gsf->buffer + GS_BUF_SIZE)
+ return False;
+
+ gsf->bufpos = p = gsf->buffer;
+ for (;;) {
+ len = gsf->buf_end - p;
+ if (len <= 0) break;
+ len = fread(p, 1, len, gsf->f);
+ if (len <= 0) break;
+ p += len;
+ }
+ gsf->buf_end = p;
+ return (p > gsf->buffer);
+}
+
+static unsigned char gs_ctype[256];
+
+#define GS_EOF '\0'
+#define GS_ERR '%'
+#define LPAREN '('
+#define RPAREN ')'
+
+static void
+init_gs_ctype(void)
+{
+ const char *p;
+
+ for (p = " \t\f\n\r";; ++p) {
+ gs_ctype[(unsigned char) *p] = 1; /* white space */
+ if (*p == '\0') break;
+ }
+ gs_ctype['/'] = 2; /* literal token */
+ gs_ctype['('] = 3; /* string */
+ for (p = ")<>[]{}%"; *p != '\0'; ++p)
+ gs_ctype[(unsigned char) *p] = 4; /* delimiter */
+}
+
+static unsigned char
+get_gs_character(struct gsfile *gsfp)
+{
+ unsigned char c;
+
+ for (;;) {
+ if (gsfp->bufpos >= gsfp->buf_end && !gs_fillbuf(gsfp))
+ return '%';
+ c = *gsfp->bufpos++;
+
+ /* Check for comments */
+ if (c == '%') {
+ for (;;) {
+ const unsigned char *p1, *p2;
+
+ p1 = memchr(gsfp->bufpos, '\n',
+ gsfp->buf_end - gsfp->bufpos);
+ if (p1 == NULL) p1 = gsfp->buf_end;
+ p2 = memchr(gsfp->bufpos, '\r', p1 - gsfp->bufpos);
+ if (p2 != NULL) p1 = p2;
+ p2 = memchr(gsfp->bufpos, '\f', p1 - gsfp->bufpos);
+ if (p2 != NULL) p1 = p2;
+ if (p1 < gsfp->buf_end) {
+ gsfp->bufpos = p1 + 1;
+ break;
+ }
+ if (!gs_fillbuf(gsfp))
+ return '%';
+ }
+ continue;
+ }
+
+ if (gs_ctype[c] != 1)
+ break;
+ }
+
+ return c;
+}
+
+static unsigned char
+get_gs_token(struct gsfile *gsfp,
+ unsigned int pos,
+ unsigned int *pos_ret,
+ const char *file_type)
+{
+ unsigned char gs_t_type;
+ unsigned char c;
+ const unsigned char *p0;
+ unsigned int pos0;
+ unsigned int depth;
+
+ gs_t_type = c = get_gs_character(gsfp);
+ if (c == '%')
+ return GS_EOF;
+
+ p0 = gsfp->bufpos;
+ switch (gs_ctype[c]) {
+ case 0: /* most characters */
+ case 2: /* '/' */
+ --p0; /* retain initial character */
+ pos0 = pos;
+ for (;;) {
+ if (gsfp->bufpos >= gsfp->buf_end) {
+ unsigned int len = gsfp->bufpos - p0;
+
+ if (pos + len >= ffline_len) expandline(pos + len);
+ bcopy(p0, ffline + pos, len);
+ pos += len;
+ if (!gs_fillbuf(gsfp))
+ break;
+ p0 = gsfp->buffer;
+ }
+ if (gs_ctype[*gsfp->bufpos] != 0) {
+ unsigned int len = gsfp->bufpos - p0;
+
+ if (pos + len >= ffline_len) expandline(pos + len);
+ bcopy(p0, ffline + pos, len);
+ pos += len;
+ break;
+ }
+ ++gsfp->bufpos;
+ }
+ /* Filter out DOS ^Z */
+ if (pos == pos0 + 1 && ffline[pos0] == '\032')
+ return GS_EOF;
+ break;
+
+ case 3: /* left parenthesis */
+ depth = 1;
+ for (;;) {
+ const unsigned char *p1, *p2, *p3;
+
+ if (gsfp->bufpos >= gsfp->buf_end) {
+ unsigned int len = gsfp->bufpos - p0;
+
+ if (pos + len >= ffline_len) expandline(pos + len);
+ bcopy(p0, ffline + pos, len);
+ pos += len;
+ if (!gs_fillbuf(gsfp)) {
+ TRACE_FT((stderr,
+ "unterminated string in %s file; giving up.",
+ file_type));
+ return GS_ERR;
+ }
+ p0 = gsfp->buffer;
+ }
+ p1 = memchr(gsfp->bufpos, RPAREN,
+ gsfp->buf_end - gsfp->bufpos);
+ if (p1 == NULL) p1 = gsfp->buf_end;
+ for (;;) {
+ p2 = memchr(gsfp->bufpos, LPAREN, p1 - gsfp->bufpos);
+ if (p2 == NULL) p2 = p1;
+ p3 = p2;
+ for (;;) {
+ if (p3 <= gsfp->bufpos) {
+ if (c == '\\') --p3;
+ break;
+ }
+ if (p3[-1] != '\\') break;
+ --p3;
+ }
+ c = '\\' - 1 + ((p2 - p3) & 1);
+ if (p2 >= p1)
+ break;
+ if (c != '\\')
+ ++depth;
+ gsfp->bufpos = p2 + 1;
+ c = '\0';
+ }
+ if (p1 < gsfp->buf_end) { /* if left parenthesis at p1 */
+ if (c != '\\') {
+ if (--depth == 0) {
+ unsigned int len = p1 - p0;
+
+ if (pos + len >= ffline_len)
+ expandline(pos + len);
+ bcopy(p0, ffline + pos, len);
+ pos += len;
+ gsfp->bufpos = p1 + 1;
+ break;
+ }
+ }
+ ++p1;
+ }
+ gsfp->bufpos = p1;
+ }
+ /* We could do backslash escaping here, but it's probably
+ unnecessary. */
+ break;
+
+ default:
+ TRACE_FT((stderr,
+ "invalid character `%c' encountered in %s file; giving up.",
+ c, file_type));
+ return GS_ERR;
+ }
+
+ *pos_ret = pos;
+ return gs_t_type;
+}
+
+
+static short gs_fontmap_number = 0;
+
+static void
+process_gs_fontmap(FILE *f)
+{
+ struct gsfile gsf;
+ unsigned char buffer[GS_BUF_SIZE];
+ unsigned char ttype;
+ unsigned int pos1, pos2, pos3;
+
+ ++gs_fontmap_number;
+
+ gsf.f = f;
+ gsf.buffer = buffer;
+ gsf.bufpos = gsf.buf_end = buffer + GS_BUF_SIZE;
+
+ /*
+ * Allow entries of the following types:
+ *
+ * (string) .runlibfile
+ * /identifier (string) ;
+ * /identifier /alias ;
+ */
+
+ for (;;) {
+ ttype = get_gs_token(&gsf, 0, &pos1, "Fontmap");
+ if (ttype == GS_EOF || ttype == GS_ERR)
+ break;
+ if (ttype == LPAREN) {
+ FILE *f1;
+
+ ttype = get_gs_token(&gsf, pos1, &pos2, "Fontmap");
+ if (ttype == GS_ERR)
+ break;
+ if (ttype == GS_EOF) {
+ TRACE_FT((stderr,
+ "unexpected end of Fontmap file; giving up."));
+ break;
+ }
+ if (ttype != '.' || pos2 - pos1 != 11
+ || memcmp(ffline + pos1, ".runlibfile", 11) != 0) {
+ TRACE_FT((stderr, "invalid token following \"(%.*s)\" in Fontmap file; giving up.",
+ (int) pos1, ffline));
+ break;
+ }
+
+ ffline[pos1] = '\0';
+ if (ffline[0] == '/' || (ffline[0] == '.' && (ffline[1] == '/'
+ || (ffline[1] == '.' && ffline[2] == '/'))))
+ f1 = XFOPEN(ffline, OPEN_MODE);
+ else {
+ char *q;
+
+ q = xmemdup(ffline, pos1 + 1);
+ f1 = gs_path_fopen(q, NULL);
+ free(q);
+ }
+
+ if (f1 == NULL)
+ TRACE_FT((stderr, "Fontmap .runlibfile: %s: %s",
+ ffline, strerror(errno)));
+ else {
+ --gs_fontmap_number;
+ process_gs_fontmap(f1);
+ }
+ }
+ else if (ttype == '/') {
+ struct avl_gs *gsfp;
+ struct gs_list *gslp;
+
+ ttype = get_gs_token(&gsf, pos1, &pos2, "Fontmap");
+ if (ttype == GS_ERR)
+ break;
+ if (ttype == GS_EOF) {
+ TRACE_FT((stderr,
+ "unexpected end of Fontmap file; giving up."));
+ break;
+ }
+ if ((ttype != '/' && ttype != LPAREN)
+ || pos2 == pos1 /* empty string would mess things up */
+ || get_gs_token(&gsf, pos2, &pos3, "Fontmap") != ';'
+ || pos3 != pos2 + 1) {
+ TRACE_FT((stderr,
+ "invalid token following \"%.*s\" in Fontmap file; giving up.",
+ (int) pos1, ffline));
+ break;
+ }
+ if (ttype == '/')
+ ffline[pos1] = '\0'; /* mark aliases by initial \0 */
+ ffline[pos2++] = '\0'; /* terminate string */
+
+ /* Add to database */
+ gsfp = (struct avl_gs *) avladd(ffline + 1, pos1 - 1,
+ (struct avl **) &gs_head, sizeof *gsfp);
+
+ if (gsfp->key == ffline + 1) { /* if new record */
+ gsfp->key = xmemdup(ffline + 1, pos1 - 1);
+ gsfp->in_use = False;
+ gsfp->list = NULL;
+ }
+ else {
+ if (strlen(gsfp->list->value + 1) + 2 == pos2 - pos1
+ && memcmp(gsfp->list->value, ffline + pos1, pos2 - pos1)
+ == 0)
+ continue; /* ignore duplicate entry */
+ if (gsfp->fontmap_number == gs_fontmap_number) {
+ /* Later entries in a Fontmap file override earlier
+ ones */
+ gslp = gsfp->list;
+ gsfp->list = gslp->next;
+ free(gslp);
+ }
+ }
+ gslp = xmalloc(sizeof *gslp + pos2 - pos1);
+ gslp->next = gsfp->list;
+ gsfp->list = gslp;
+ memcpy((char *) gslp->value, ffline + pos1, pos2 - pos1);
+
+ gsfp->fontmap_number = gs_fontmap_number;
+ }
+ else {
+ TRACE_FT((stderr,
+ "invalid token \"%s\" in Fontmap file; giving up.",
+ ffline));
+ }
+ }
+
+ fclose(f);
+}
+
+/*
+ * Read Ghostscript Fontmap files. These are used if the line in
+ * psfonts.map does not contain a filename for the font.
+ *
+ * For example:
+ * n019003l NimbusSanL-Regu
+ */
+
+static void
+read_gs_fontmaps(void)
+{
+ env_gs_lib = getenv("XDVI_GS_LIB");
+ if (env_gs_lib == NULL)
+ env_gs_lib = getenv("GS_LIB");
+
+ if (gs_ctype[0] == 0)
+ init_gs_ctype();
+
+ (void) gs_path_fopen("Fontmap", process_gs_fontmap);
+}
+
+
+/*
+ * pre_lookup_t1_font - Find a Type 1 font (or return NULL).
+ */
+
+static struct avl_t1 *
+pre_lookup_t1_font(const char *fontname)
+{
+ struct avl_t1 *t1p;
+ size_t len;
+ int i;
+
+ /* first, search for the font */
+
+ len = strlen(fontname);
+ t1p = t1_head;
+ while (t1p != NULL) {
+ i = len - t1p->key_len;
+ if (i == 0)
+ i = memcmp(fontname, t1p->key, len);
+ if (i == 0)
+ return t1p; /* found it */
+ t1p = (struct avl_t1 *) (i < 0 ? t1p->left : t1p->right);
+ }
+
+ /* next, read in more records in hopes of finding the font */
+
+ if (p_head != NULL)
+ for (;;) {
+ if (!fgets_long(mapfile)) { /* if end of file */
+ fclose(mapfile);
+ p_head = p_head->next;
+ if (!open_next_mapfile())
+ return NULL;
+ continue;
+ }
+
+ if (*ffline < ' ' || *ffline == '*' || *ffline == '#'
+ || *ffline == ';' || *ffline == '%')
+ continue;
+
+ t1p = dvips_parse(ffline);
+
+ if (t1p != NULL && t1p->key_len == len
+ && memcmp(t1p->key, fontname, len) == 0)
+ return t1p; /* found it */
+ }
+
+ return NULL;
+}
+
+/*
+ * lookup_t1_font - Find a Type 1 font (or return NULL).
+ */
+
+Boolean
+lookup_t1_font(struct font *fontp,
+ const char *fontname)
+{
+ struct avl_t1 *t1p;
+ struct ftfont *ftp;
+
+ t1p = pre_lookup_t1_font(fontname);
+
+ if (t1p == NULL)
+ return False;
+
+ if (t1p->bad) {
+ TRACE_FT((stderr,
+ "Font %s is marked as bad: skipping scalable version",
+ fontname));
+ return False;
+ }
+
+ ftp = t1p->ft;
+ if (ftp != NULL) { /* if it's is already in use at another size */
+ struct font *first_size;
+
+ /* The first node in the linked list of sizes contains the file */
+ /* reference, so we link in the new node after the first node */
+ first_size = ftp->first_size;
+ fontp->next_size = first_size->next_size;
+ first_size->next_size = fontp;
+ }
+ else { /* first use at this size */
+ t1p->ft = ftp = xmalloc(sizeof *ftp);
+ ftp->face = NULL;
+ ftp->t1 = t1p;
+ ftp->first_size = fontp;
+ fontp->next_size = NULL;
+ }
+ fontp->ft = ftp;
+ fontp->size = NULL;
+
+ return True;
+}
+
+FILE *
+open_t1_font(struct avl_t1 *t1p,
+ const char **path_ret)
+{
+ FILE *f;
+
+ if (t1p->fontfile == NULL) { /* look up in GS Fontmap */
+ static Boolean gs_fontmap_initialized = False;
+
+ if (!gs_fontmap_initialized) {
+ read_gs_fontmaps();
+ gs_fontmap_initialized = True;
+ }
+
+ TRACE_FT((stderr,
+ "Looking for font %.*s using gs method (PS name %s) --",
+ t1p->key_len, t1p->key, t1p->psname));
+ f = lookup_gs_font(t1p->psname, path_ret);
+
+ if (f == NULL) {
+ TRACE_FT((stderr, "cannot find Type 1 font %s",
+ t1p->psname));
+ return NULL;
+ }
+
+ TRACE_FT((stderr, "Found file %s", *path_ret));
+ }
+ else {
+ char *filename;
+
+ filename = kpse_find_file(t1p->fontfile, kpse_type1_format, 0);
+ if (filename == NULL) {
+ XDVI_WARNING((stderr, "cannot find Type 1 font file %s "
+ "(will try PK version instead).",
+ t1p->fontfile));
+ return NULL;
+ }
+
+ f = XFOPEN(filename, OPEN_MODE);
+ if (f == NULL) {
+ TRACE_FT((stderr, "cannot open Type 1 font file %s: %s",
+ filename, strerror(errno)));
+ free(filename);
+ return NULL;
+ }
+ *path_ret = filename;
+ }
+
+ return f;
+}
+
+
+/*
+ * Read the encoding vector file. This assumes the same format as afm2tfm.
+ */
+
+extern struct findrec search_header; /* from special.c */
+
+void
+read_encoding(struct avl_enc *encp)
+{
+ char *filename;
+ FILE *f;
+ struct gsfile gsf;
+ unsigned char buffer[GS_BUF_SIZE];
+ jmp_buf err_env;
+ unsigned char ttype;
+ unsigned int pos1, pos2;
+ unsigned int identindex[256];
+ const char *str;
+ unsigned int i;
+
+ TRACE_FT((stderr, "Reading encoding file %s", encp->key));
+
+ encp->valid = False;
+
+ /*
+ * With TDS 1.0/kpathsea 3.5.2(?), encoding files are in texmf/fonts/enc
+ * and accessed via kpse_enc_format; see e.g.:
+ * http://tug.org/mailman/htdig/tex-live/2004-January/004734.html
+ *
+ * The lookups under kpse_program_text_format and
+ * kpse_tex_ps_header_format are kept for backwards compatibility.
+ */
+
+ filename = kpse_find_file(encp->key, kpse_enc_format, 0);
+ if (filename == NULL) {
+ filename = kpse_find_file(filename, kpse_program_text_format, 0);
+ if (filename == NULL)
+ filename = kpse_find_file(filename, kpse_tex_ps_header_format,
+ True);
+ }
+ if (filename == NULL) {
+ TRACE_FT((stderr,
+ "cannot find encoding file %s; ignoring encoding", encp->key));
+ return;
+ }
+
+ f = XFOPEN(filename, OPEN_MODE);
+ if (f == NULL) {
+ TRACE_FT((stderr, "cannot open encoding file %s: %s",
+ filename, strerror(errno)));
+ free(filename);
+ return;
+ }
+ free(filename);
+
+ if (gs_ctype[0] == 0)
+ init_gs_ctype();
+
+ gsf.f = f;
+ gsf.buffer = buffer;
+ gsf.bufpos = gsf.buf_end = buffer + GS_BUF_SIZE;
+
+ if (!setjmp(err_env)) {
+ if (get_gs_token(&gsf, 0, &pos1, "encoding") != '/'
+ || get_gs_character(&gsf) != '[')
+ longjmp(err_env, 1);
+
+ pos1 = 0;
+ for (i = 0; i < 256; ++i) {
+ if (get_gs_token(&gsf, pos1, &pos2, "encoding") != '/')
+ longjmp(err_env, 1);
+ if (pos2 == pos1 + 8
+ && memcmp(ffline + pos1, "/.notdef", 8) == 0)
+ identindex[i] = 0;
+ else {
+ ffline[pos1] = '\0';
+ identindex[i] = pos1 + 1;
+ pos1 = pos2;
+ }
+ }
+
+ if (get_gs_character(&gsf) != ']')
+ longjmp(err_env, 1);
+
+ ttype = get_gs_token(&gsf, pos1, &pos2, "encoding");
+ if (!(ttype == GS_EOF
+ || (ttype == 'd' && pos2 == pos1 + 3
+ && memcmp(ffline + pos1, "def", 3) == 0
+ && get_gs_token(&gsf, pos2, &pos2, "encoding") == GS_EOF)))
+ longjmp(err_env, 1);
+
+ if (pos1 >= ffline_len) expandline(pos1 + 1);
+ ffline[pos1] = '\0';
+ str = xmemdup(ffline + 1, pos1);
+ for (i = 0; i < 256; ++i)
+ encp->vec[i] =
+ (identindex[i] != 0 ? str + identindex[i] - 1 : NULL);
+
+ encp->valid = True;
+ }
+ else /* if error */
+ TRACE_FT((stderr,
+ "invalid format in encoding file %s; giving up.", encp->key));
+
+ fclose(f);
+}
+
+#endif /* FREETYPE || PS */
+
+
#if 0
static int mktexpk_io[2];
static struct xchild mktexpk_child = { NULL, 0, True, "font creation", NULL, NULL, mktexpk_ended };
@@ -283,11 +1673,7 @@ font_open(
#endif
struct font *fontp,
const char **font_ret,
- int *dpi_ret,
-#ifdef T1LIB
- int *t1id,
-#endif
- Boolean use_t1lib)
+ int *dpi_ret)
{
char *name;
kpse_glyph_file_type file_ret;
@@ -312,12 +1698,6 @@ font_open(
name = kpse_find_vf(fontp->fontname);
}
-#ifdef T1LIB
- if (resource.t1lib) {
- *t1id = -1;
- }
-#endif /* T1LIB */
-
if (name) { /* found a vf font */
/* pretend it has the expected dpi value, else caller will complain */
*dpi_ret = fontp->fsize;
@@ -325,27 +1705,26 @@ font_open(
return XFOPEN(name, FOPEN_R_MODE);
}
-#ifdef T1LIB
- if (resource.t1lib && use_t1lib
-#if DELAYED_MKTEXPK
+#if FREETYPE
+ if (resource.freetype
+# if DELAYED_MKTEXPK
&& load_font_now
-#endif
+# endif
) {
- /* First attempt: T1 font of correct size
+ /* First attempt: freetype font of correct size
* (for delayed_mtkexpk, only when scanning postamble for the first time)
*/
- *t1id = find_T1_font(fontp->fontname);
- if (*t1id >= 0) {
- TRACE_T1((stderr, "found T1 font %s", fontp->fontname));
+ if (lookup_t1_font(fontp, fontp->fontname)) {
+ TRACE_FT((stderr, "found freetype font %s", fontp->fontname));
return NULL;
}
- TRACE_T1((stderr,
- "T1 version of font %s not found, trying pixel version next, then fallback",
+ TRACE_FT((stderr,
+ "Freetype version of font %s not found, trying pixel version next, then fallback",
fontp->fontname));
}
-#endif /* T1LIB */
-
-
+#endif /* FREETYPE */
+
+
/*
TODO:
@@ -441,7 +1820,7 @@ font_open(
*dpi_ret = file_ret.dpi;
fontp->filename = name;
*font_ret = file_ret.name;
- TRACE_T1((stderr, "Found pixel version: %s at %d dpi", file_ret.name, *dpi_ret));
+ TRACE_FT((stderr, "Found pixel version: %s at %d dpi", file_ret.name, *dpi_ret));
#if DELAYED_MKTEXPK
if (message_done) {
statusline_append(STATUS_VERYSHORT, "DUMMY", /* append text, don't overwrite */
@@ -463,41 +1842,41 @@ font_open(
already exist. So we invoke it explicitly a second time
for that one.
*/
- TRACE_T1((stderr, "Trying fallback"));
-#ifdef T1LIB
- if (resource.t1lib
+ TRACE_FT((stderr, "Trying fallback"));
+#if FREETYPE
+ if (resource.freetype
#if DELAYED_MKTEXPK
&& load_font_now
#endif
) {
- /* Third attempt: T1 version of fallback font */
- *t1id = find_T1_font(resource.alt_font);
- if (*t1id >= 0) {
- TRACE_T1((stderr, "found fallback font for %s: %s", fontp->fontname, resource.alt_font));
+ /* Third attempt: freetype version of fallback font */
+ if (lookup_t1_font(fontp, resource.alt_font)) {
+ TRACE_FT((stderr, "found fallback font for %s: %s",
+ fontp->fontname, resource.alt_font));
*font_ret = xstrdup(resource.alt_font);
return NULL;
}
- TRACE_T1((stderr,
- "Type1 version of fallback font %s not found, trying pixel version",
+ TRACE_FT((stderr,
+ "Freetype version of fallback font %s not found, trying pixel version",
resource.alt_font));
}
-#endif /* T1LIB */
- /* Forth attempt: PK version of fallback font */
+#endif /* FREETYPE */
+ /* Fourth attempt: PK version of fallback font */
name = kpse_find_glyph(resource.alt_font, (unsigned)(fontp->fsize + .5),
kpse_any_glyph_format, &file_ret);
if (name) { /* success */
- TRACE_T1((stderr, "Success for PK version of fallback"));
+ TRACE_FT((stderr, "Success for PK version of fallback"));
*dpi_ret = file_ret.dpi;
fontp->filename = name;
*font_ret = xstrdup(resource.alt_font);
return XFOPEN(name, FOPEN_R_MODE);
}
else {
- TRACE_T1((stderr, "Failure for PK version of fallback"));
+ TRACE_FT((stderr, "Failure for PK version of fallback"));
}
}
/* all other cases are failure */
- TRACE_T1((stderr, "Failure"));
+ TRACE_FT((stderr, "Failure"));
return NULL;
}
diff --git a/Build/source/texk/xdvik/font-open.h b/Build/source/texk/xdvik/font-open.h
index 3979a4bfdbc..236ee6d7192 100644
--- a/Build/source/texk/xdvik/font-open.h
+++ b/Build/source/texk/xdvik/font-open.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2004 the xdvik development team
+ * Copyright (c) 2002-2013 the xdvik development team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -23,17 +23,70 @@
#ifndef FONT_OPEN_H_
#define FONT_OPEN_H_
+
+#if FREETYPE || PS
+
+#include "util.h" /* get AVL basics */
+
+#if FREETYPE
+# include <ft2build.h>
+# include FT_FREETYPE_H
+#endif
+
+
+/*
+ * AVL tree structures.
+ */
+
+ /* Data structure for Type 1 fonts -- contents of psfonts.map */
+struct avl_t1 {
+ AVL_COMMON;
+ const char *psname; /* PS name of font */
+ const char *fontfile; /* (short) name of pfa/pfb file */
+ const char *encname; /* (short) name of encoding file */
+ const char *addinfo; /* additional PS instructions */
+# if FREETYPE
+ Boolean bad; /* if later found to be unloadable */
+ struct ftfont *ft; /* pointer to FreeType record */
+# endif
+};
+
+
+# if FREETYPE
+
+struct ftfont { /* info for FreeType font (Type 1 or TrueType) */
+ FT_Face face; /* NULL means not loaded yet */
+ struct font *first_size;
+ struct avl_t1 *t1;
+ /* struct avl_tt *tt; */
+ struct FT_StreamRec_ stream;
+ struct avl_enc *enc; /* pointer to encoding record */
+ double expn; /* expansion factor */
+};
+
+struct avl_enc {
+ AVL_COMMON;
+ Boolean valid;
+ const char *vec[256];
+};
+
+# endif /* FREETYPE */
+
+extern Boolean init_t1_lookup(void);
+extern Boolean lookup_t1_font(struct font *fontp, const char *fontname);
+extern FILE *open_t1_font (struct avl_t1 *t1p, const char **path_ret);
+extern void read_encoding(struct avl_enc *encp);
+
+#endif /* FREETYPE || PS */
+
+
extern FILE *font_open(
#if DELAYED_MKTEXPK
Boolean load_font_now,
#endif
struct font *fontp,
const char **font_ret,
- int *dpi_ret,
-#ifdef T1LIB
- int *t1id,
-#endif
- Boolean use_t1lib);
+ int *dpi_ret);
#if DELAYED_MKTEXPK
void reset_missing_font_count(void);
diff --git a/Build/source/texk/xdvik/ft.c b/Build/source/texk/xdvik/ft.c
new file mode 100644
index 00000000000..74ef96786e4
--- /dev/null
+++ b/Build/source/texk/xdvik/ft.c
@@ -0,0 +1,484 @@
+/*========================================================================*\
+
+Copyright (c) 2013 Paul Vojta
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+PAUL VOJTA BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+\*========================================================================*/
+
+/*
+ * FreeType (PostScript Type 1 and TrueType) font reading routines.
+ * Public routines are load_ft_font and read_ft_char.
+ * The prototype for load_ft_font is in dvi-init.h.
+ */
+
+#include "xdvi-config.h"
+#include "xdvi.h"
+#include "dvi-init.h"
+#include "dvi-draw.h"
+#include "util.h"
+#include "font-open.h"
+
+#include <ctype.h>
+#include <math.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_SIZES_H
+
+static FT_Library library = NULL;
+
+static struct avl_enc *enc_head = NULL;
+
+/* From xc/lib/X11/PutImage.c */
+
+#if !WORDS_BIGENDIAN
+static const unsigned char reverse_byte[0x100] = {
+ 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
+ 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
+ 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
+ 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
+ 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
+ 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
+ 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
+ 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
+ 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
+ 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
+ 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
+ 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
+ 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
+ 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
+ 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
+ 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
+ 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
+ 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
+ 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
+ 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
+ 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
+ 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
+ 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
+ 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
+ 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
+ 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
+ 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
+ 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
+ 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
+ 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
+ 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
+ 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff
+};
+#endif /* !WORDS_BIGENDIAN */
+
+
+/*
+ * FreeType I/O stream functions
+ */
+
+static unsigned long
+xdvi_stream_read(FT_Stream stream,
+ unsigned long offset,
+ unsigned char *buffer,
+ unsigned long count)
+{
+ struct font *fontp;
+
+ fontp = ((struct ftfont *) stream->descriptor.pointer)->first_size;
+ open_font_file(fontp);
+ fseek(fontp->file, offset, SEEK_SET);
+ return (unsigned long) fread(buffer, 1, count, fontp->file);
+}
+
+static void
+xdvi_stream_close(FT_Stream stream)
+{
+ /* do nothing */
+}
+
+
+/*
+ * Public routines
+ */
+
+static void
+read_ft_char(struct font *fontp, wide_ubyte ch)
+{
+ struct glyph *g;
+ FT_Face face;
+ FT_GlyphSlot slot;
+ int bmTypeT_wide;
+ int err;
+
+ if (globals.debug & DBG_PK)
+ printf("Loading FreeType char %d", ch);
+
+ /*
+ * Load it unscaled first, so that we can get a more accurate
+ * (non-hinted) value of the horizontal advance.
+ */
+
+ g = &fontp->glyph[ch];
+ face = fontp->ft->face;
+ FT_Activate_Size(fontp->size);
+ err = FT_Load_Glyph(face, g->addr, FT_LOAD_NO_SCALE);
+ if (err != 0)
+ XDVI_FATAL((stderr, "FT_Load_Glyph: error = %d", err));
+
+ g->dvi_adv = face->glyph->metrics.horiAdvance * fontp->ft->expn
+ * fontp->pixsize * (1 << 16) / face->units_per_EM + 0.5;
+
+ /* Now do the real loading. */
+
+ err = FT_Load_Glyph(face, g->addr, FT_LOAD_RENDER | FT_LOAD_MONOCHROME);
+ if (err != 0)
+ XDVI_FATAL((stderr, "FT_Load_Glyph: error = %d", err));
+
+ slot = face->glyph;
+ g->bitmap.w = slot->bitmap.width;
+ g->bitmap.h = slot->bitmap.rows;
+
+ if (globals.debug & DBG_PK)
+ printf(", size=%dx%d, dvi_adv=%ld\n", g->bitmap.w, g->bitmap.h,
+ g->dvi_adv);
+
+ alloc_bitmap(&g->bitmap);
+ bmTypeT_wide = ROUNDUP((int) g->bitmap.w, BMBITS);
+
+ if (slot->bitmap.width > 0) {
+ int i;
+ unsigned char *p;
+ bmUnitT *q;
+
+ p = slot->bitmap.buffer;
+ q = (bmUnitT *) g->bitmap.bits;
+ for (i = g->bitmap.h; i > 0; --i) {
+#if WORDS_BIGENDIAN
+ memcpy(q, p, (slot->bitmap.width + 7) / 8);
+#else
+ unsigned char *p1 = p;
+ bmUnitT *q1 = q;
+ bmUnitT data = 0;
+ int shift = 0;
+ int j;
+
+ for (j = (slot->bitmap.width + 7) / 8; j > 0; --j) {
+ if (shift >= BMBITS) {
+ *q1++ = data;
+ data = 0;
+ shift = 0;
+ }
+ data |= reverse_byte[*p1++] << shift;
+ shift += 8;
+ }
+ *q1 = data;
+#endif
+ p += slot->bitmap.pitch;
+ q += bmTypeT_wide;
+ }
+ }
+
+ /* The offset of (-1,-1) is from comparing bitmaps of 'R' and 'a'
+ between cmr10.pfb and cmr10.300pk. */
+ g->x = -1 - slot->bitmap_left;
+ g->y = slot->bitmap_top - 1;
+}
+
+/*
+ * Do the ScaleFont, etc. directives.
+ */
+
+static Boolean
+set_transform(struct ftfont *ftp,
+ const char *str)
+{
+ double x = 1.0;
+ double y = 0.0;
+
+ for (;;) {
+ while (isspace(*str)) ++str;
+ if (*str == '\0')
+ break;
+
+ if (isdigit(*str) || *str == '.' || *str == '-') {
+ double arg = strtod(str, (char **) &str);
+
+ while (isspace(*str)) ++str;
+
+ if (memcmp(str, "ObliqueSlant", 12) == 0
+ && (isspace(str[12]) || str[12] == '\0')) {
+ arg = -tan(arg);
+ str += 12;
+ while (isspace(*str)) ++str;
+ }
+
+ if (memcmp(str, "SlantFont", 9) == 0
+ && (isspace(str[9]) || str[9] == '\0')) {
+ y += arg;
+ str += 9;
+ }
+ else if (memcmp(str, "ExtendFont", 10) == 0
+ && (isspace(str[10]) || str[10] == '\0')) {
+ x *= arg;
+ str += 10;
+ }
+ else return False;
+ }
+ else { /* other characters; presume encoding name */
+ while (!isspace(*str) && *str != '\0') ++str;
+ while (isspace(*str)) ++str;
+ if (memcmp(str, "ReEncodeFont", 12) == 0
+ && (isspace(str[12]) || str[12] == '\0'))
+ str += 12;
+ else
+ return False;
+ }
+ }
+
+ if (x != 1.0 || y != 0.0) {
+ FT_Matrix mat;
+
+ mat.xx = (FT_Fixed) (x * 0x10000 + 0.5);
+ mat.xy = (FT_Fixed) (y * 0x10000 + 0.5);
+ mat.yx = 0;
+ mat.yy = 0x10000;
+
+ FT_Set_Transform(ftp->face, &mat, NULL);
+ ftp->expn = x;
+ }
+
+ return True;
+}
+
+
+/*
+ * When a document uses many freetype fonts, it can take a while to read
+ * them all (due mostly to disk access issues). So, we delay loading
+ * freetype fonts until they're needed.
+ *
+ * Therefore, this routine is not called until it is time to render a
+ * character from the font (see set_ft_char() in dvi-draw.c).
+ *
+ * It loads and sets up the font.
+ */
+
+Boolean
+load_ft_font(struct font *fontp)
+{
+ struct ftfont *ftp;
+ struct avl_t1 *t1p;
+ struct font *fontp2;
+ FT_Face face;
+ FT_Size size;
+ int err;
+ const char *path;
+ FILE *f;
+
+ ftp = fontp->ft;
+ t1p = ftp->t1;
+ fontp2 = ftp->first_size;
+
+ if (!resource.freetype) {
+ TRACE_FT((stderr,
+ "load_ft_font returning: freetype has been turned off"));
+ return False;
+ }
+
+ if (t1p->bad) {
+ TRACE_FT((stderr, "Font %s was flagged as bad; skipping (size %d)",
+ fontp->fontname, (int) (fontp->fsize + 0.5)));
+ return False;
+ }
+
+ face = ftp->face;
+ if (face != NULL) { /* if this face is already in use */
+ err = FT_New_Size(face, &size);
+ if (err != 0) {
+ /* This error is probably better kept at stderr instead of
+ a popup (too annoying) or the statusline (might disappear
+ too fast) ... */
+ XDVI_ERROR((stderr, "Could not load FreeType font %s at %d: "
+ "FreeType FT_New_Size error = %d.\n"
+ "Will try pixel version instead.\n"
+ "Please see the FreeType documentation for details "
+ "about this.",
+ fontp->fontname, (int) (fontp->fsize + 0.5), err));
+ return False;
+ }
+ }
+ else {
+ FT_Open_Args args;
+
+ f = open_t1_font(t1p, &path);
+ if (f == NULL)
+ return False;
+
+ if (library == NULL) {
+ err = FT_Init_FreeType(&library);
+ if (err != 0) {
+ XDVI_ERROR((stderr,
+ "Could not initialize FreeType library: "
+ "FreeType FT_Init_FreeType error = %d.\n"
+ "Turning off use of FreeType.\n"
+ "Please see the FreeType documentation for details "
+ "about this.",
+ err));
+ resource.freetype = False;
+ free((char *) path);
+ fclose(f);
+ return False;
+ }
+ }
+
+ fontp2->filename = path;
+ fontp2->file = f;
+
+ fseek(f, 0L, SEEK_END);
+ ftp->stream.size = ftell(f);
+ fseek(f, 0L, SEEK_SET); /* this might not be necessary */
+
+ ftp->stream.descriptor.pointer = ftp;
+ ftp->stream.read = xdvi_stream_read;
+ ftp->stream.close = xdvi_stream_close;
+
+ args.flags = FT_OPEN_STREAM;
+ args.stream = &ftp->stream;
+ err = FT_Open_Face(library, &args, 0, &face);
+ if (err != 0) {
+ /* This error is probably better kept at stderr instead of
+ a popup (too annoying) or the statusline (might disappear
+ too fast) ... */
+ XDVI_ERROR((stderr, "Could not load FreeType font %s: "
+ "FreeType FT_Open_Face error = %d.\n"
+ "Will try pixel version instead.\n"
+ "Please see the FreeType documentation for details "
+ "about this.",
+ fontp->fontname, err));
+ free((char *) path);
+ fclose(f);
+ fontp2->file = NULL;
+ fontp2->filename = NULL;
+ return False;
+ }
+ ftp->face = face;
+
+ if (!FT_IS_SCALABLE(face)) {
+ TRACE_FT((stderr, "Font %s is not scalable.", fontp->fontname));
+ FT_Done_Face(face);
+ free((char *) path);
+ fclose(f);
+ fontp2->file = NULL;
+ fontp2->filename = NULL;
+ return False;
+ }
+
+ ftp->expn = 1.0;
+ if (t1p->addinfo != NULL)
+ if (!set_transform(ftp, t1p->addinfo)) {
+ FT_Done_Face(face);
+ free((char *) path);
+ fclose(f);
+ fontp2->file = NULL;
+ fontp2->filename = NULL;
+ return False;
+ }
+
+ if (face->charmap == NULL) {
+ if (face->num_charmaps > 0) {
+ if ((globals.debug & DBG_PK) && face->num_charmaps > 1)
+ printf("Choosing the first of %d charmaps.\n",
+ face->num_charmaps);
+ }
+ FT_Set_Charmap(face, face->charmaps[0]);
+ }
+ else if (face->charmap->encoding == ft_encoding_unicode
+ && FT_Select_Charmap(face, ft_encoding_adobe_custom) != 0
+ && FT_Select_Charmap(face, ft_encoding_adobe_standard) != 0
+ && FT_Select_Charmap(face, ft_encoding_adobe_expert) != 0) {
+ if (globals.debug & DBG_PK)
+ puts("Using unicode charmap for font.");
+ fputs("Using unicode charmap\n", stderr); /* ||| */
+ }
+
+ ftp->enc = NULL;
+ if (t1p->encname != NULL) { /* if there's an encoding */
+ struct avl_enc *encp;
+
+ encp = (struct avl_enc *) avladd(t1p->encname,
+ strlen(t1p->encname),
+ (struct avl **) &enc_head, sizeof *encp);
+ if (encp->key == t1p->encname) /* if new record */
+ read_encoding(encp);
+ if (encp->valid)
+ ftp->enc = encp;
+ }
+
+ size = face->size;
+ }
+
+ /* Get character indices (store them in addr) */
+
+ if (globals.debug & DBG_PK)
+ printf("Character indices for %s:\n", fontp->fontname);
+
+ FT_Activate_Size(size);
+
+ err = FT_Set_Char_Size(face,
+ (int) (fontp->pixsize * (72<<6) / resource.pixels_per_inch + 0.5), 0,
+ resource.pixels_per_inch, resource.pixels_per_inch);
+ if (err != 0)
+ XDVI_FATAL((stderr, "FT_Set_Char_Size: error = %d\n", err));
+
+ /* Look for already-computed character indices */
+ for (fontp2 = ftp->first_size;; fontp2 = fontp2->next_size) {
+ int i;
+
+ if (fontp2 == NULL) { /* if not found */
+ struct avl_enc *encp = ftp->enc;
+
+ for (i = 0; i < 256; ++i) {
+ int ci;
+
+ if (encp == NULL)
+ ci = FT_Get_Char_Index(face, i);
+ else {
+ const char *glyphname = encp->vec[i];
+
+ if (glyphname == NULL)
+ ci = 0;
+ else
+ ci = FT_Get_Name_Index(face,
+ (FT_String *) glyphname);
+ }
+
+ fontp->glyph[i].addr = ci;
+ if (globals.debug & DBG_PK)
+ printf("%3d->%3d%s", i, ci, (i + 1) % 8 ? " " : "\n");
+ }
+ break;
+ }
+ if (fontp2->size != NULL) { /* found the information */
+ for (i = 0; i < 256; ++i)
+ fontp->glyph[i].addr = fontp2->glyph[i].addr;
+ break;
+ }
+ }
+
+ fontp->size = size; /* it needed to be NULL in the above loop */
+ fontp->read_char = read_ft_char;
+
+ return True;
+}
diff --git a/Build/source/texk/xdvik/gui/Panner.c b/Build/source/texk/xdvik/gui/Panner.c
index 9acca69ac14..8a8577a617d 100644
--- a/Build/source/texk/xdvik/gui/Panner.c
+++ b/Build/source/texk/xdvik/gui/Panner.c
@@ -48,6 +48,14 @@
extern Bool XmuDistinguishablePixels(); /* not defined in any Xmu headers */
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define panBell(display, window, percent) \
+ XkbBell(display, window, percent, (Atom) None)
+#else
+# define panBell(display, window, percent) XBell(display, percent)
+#endif
+
/*
======================================================================
begin copy from Simple.c
@@ -1020,7 +1028,7 @@ static void ActionStart (Widget gw, XEvent *event, String *params, Cardinal *num
UNUSED(num_params);
if (!get_event_xy (pw, event, &x, &y)) {
- XBell (XtDisplay(gw), 0); /* should do error message */
+ panBell(XtDisplay(gw), XtWindow(gw), 0); /* should do error message */
return;
}
@@ -1085,7 +1093,7 @@ static void ActionMove (Widget gw, XEvent *event, String *params, Cardinal *num_
if (!pw->panner.tmp.doing) return;
if (!get_event_xy (pw, event, &x, &y)) {
- XBell (XtDisplay(gw), 0); /* should do error message */
+ panBell(XtDisplay(gw), XtWindow(gw), 0); /* should do error message */
return;
}
@@ -1116,7 +1124,7 @@ static void ActionPage (Widget gw, XEvent *event, String *params, Cardinal *num_
UNUSED(num_params);
if (*num_params != 2) {
- XBell (XtDisplay(gw), 0);
+ panBell (XtDisplay(gw), XtWindow(gw), 0);
return;
}
@@ -1205,7 +1213,7 @@ static void ActionSet (Widget gw, XEvent *event, String *params, Cardinal *num_p
if (*num_params < 2 ||
XmuCompareISOLatin1 (params[0], "rubberband") != 0) {
- XBell (XtDisplay(gw), 0);
+ panBell (XtDisplay(gw), XtWindow(gw), 0);
return;
}
@@ -1216,7 +1224,7 @@ static void ActionSet (Widget gw, XEvent *event, String *params, Cardinal *num_p
} else if (XmuCompareISOLatin1 (params[1], "toggle") == 0) {
rb = !pw->panner.rubber_band;
} else {
- XBell (XtDisplay(gw), 0);
+ panBell (XtDisplay(gw), XtWindow(gw), 0);
return;
}
diff --git a/Build/source/texk/xdvik/gui/help-window.c b/Build/source/texk/xdvik/gui/help-window.c
index 4386d21a8ae..1f0124d7fe6 100644
--- a/Build/source/texk/xdvik/gui/help-window.c
+++ b/Build/source/texk/xdvik/gui/help-window.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 the xdvik development team
+ * Copyright (c) 2004-2013 the xdvik development team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -56,6 +56,14 @@
#include "topic-window.h"
#include "help-window.h"
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define XdviBell(display, window, percent) \
+ XkbBell(display, window, percent, (Atom) None)
+#else
+# define XdviBell(display, window, percent) XBell(display, percent)
+#endif
+
/* missing features that will be listed in the help window */
#if !XDVI_XT_TIMER_HACK
#define HAVE_MISSING_FEATURES 1
@@ -284,8 +292,7 @@ initialize_items(struct topic_info *info)
"Xdvik uses the following libraries:\n",
"- The kpathsea library, licensed in part under the GNU General Public\n",
" License, in part under the GNU Library General Public License.\n",
- "- t1lib, licensed in parts under the GNU Library General Public License,\n",
- " in parts under the X Consortium license.\n",
+ "- freetype2, licensed under the GNU General Public License.\n",
"There is NO WARRANTY of anything.\n",
"\n",
"Built using these configure options:\n",
@@ -304,8 +311,8 @@ initialize_items(struct topic_info *info)
#ifdef GREY
"- anti-aliasing (grey) enabled\n",
#endif
-#ifdef T1LIB
- "- T1lib (direct rendering of PS fonts) enabled\n",
+#if FREETYPE
+ "- freetype2 (direct rendering of PS fonts) enabled\n",
#endif
#if HAVE_ICONV_H
"- Iconv support compiled in\n",
@@ -1087,7 +1094,7 @@ show_help(Widget toplevel, const char *topic)
}
}
if (!matched) {
- XBell(DISP, 0);
+ XdviBell(DISP, XtWindow(help_shell), 0);
popup_message(help_shell,
MSG_WARN,
NULL,
diff --git a/Build/source/texk/xdvik/gui/mag.c b/Build/source/texk/xdvik/gui/mag.c
index 21526269c6d..2bf87904a0f 100644
--- a/Build/source/texk/xdvik/gui/mag.c
+++ b/Build/source/texk/xdvik/gui/mag.c
@@ -52,6 +52,14 @@
#include "util.h"
#include "pagesel.h"
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define XdviBell(display, window, percent) \
+ XkbBell(display, window, percent, (Atom) None)
+#else
+# define XdviBell(display, window, percent) XBell(display, percent)
+#endif
+
/* to measure distance of pointer from ruler in ruler mode */
static int g_ruler_pos_x = 0, g_ruler_pos_y = 0;
@@ -627,7 +635,7 @@ void magnifier_move(String params, XEvent *event)
int n = atoi(p + 1) - 1;
if (n < 0 || n >= (int)get_magglass_items() || get_magglass_width(n) <= 0) {
- XBell(DISP, 0);
+ XdviBell(DISP, event->xany.window, 0);
return;
}
magnifier.width = get_magglass_width(n);
@@ -642,7 +650,7 @@ void magnifier_move(String params, XEvent *event)
magnifier.width = 0;
}
if (magnifier.width == 0) {
- XBell(DISP, 0);
+ XdviBell(DISP, event->xany.window, 0);
return;
}
}
diff --git a/Build/source/texk/xdvik/gui/pagesel.c b/Build/source/texk/xdvik/gui/pagesel.c
index 3d14e3a8426..dd1f4c71eec 100644
--- a/Build/source/texk/xdvik/gui/pagesel.c
+++ b/Build/source/texk/xdvik/gui/pagesel.c
@@ -728,7 +728,7 @@ wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean
int pageno = current_page;
if (button == 5) {
if (current_page >= total_pages - 1) {
- XBell(DISP, 0);
+ xdvi_bell();
/* statusline_info(STATUS_SHORT, "Last page of DVI file"); */
return;
}
@@ -736,7 +736,7 @@ wheel_scroll_list_callback(Widget widget, XtPointer data, XEvent *event, Boolean
}
else {
if (current_page == 0) {
- XBell(DISP, 0);
+ xdvi_bell();
/* statusline_info(STATUS_SHORT, "First page of DVI file"); */
return;
}
diff --git a/Build/source/texk/xdvik/gui/print-dialog.c b/Build/source/texk/xdvik/gui/print-dialog.c
index 5b489e2b51e..4724513f0ca 100644
--- a/Build/source/texk/xdvik/gui/print-dialog.c
+++ b/Build/source/texk/xdvik/gui/print-dialog.c
@@ -91,6 +91,11 @@ static Pixmap menu_double_arrow_bitmap;
#define XTranslations XtNtranslations
#endif /* MOTIF */
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define XBell(dpy, percent) XkbBell(dpy, mane.win, percent, (Atom) None)
+#endif
+
struct output_format_mapping {
const char *fmt_string;
outputFormatT fmt;
diff --git a/Build/source/texk/xdvik/gui/search-dialog.c b/Build/source/texk/xdvik/gui/search-dialog.c
index 000d0b05db4..895db86480c 100644
--- a/Build/source/texk/xdvik/gui/search-dialog.c
+++ b/Build/source/texk/xdvik/gui/search-dialog.c
@@ -339,7 +339,7 @@ cb_regexp_search(Widget w, XtPointer client_data, XtPointer call_data)
return;
}
- XBell(DISP, 0);
+ xdvi_bell();
popup_message(get_matching_parent(w, globals.widgets.top_level, "find_popup", NULL),
MSG_ERR,
NULL,
diff --git a/Build/source/texk/xdvik/gui/sfSelFile.c b/Build/source/texk/xdvik/gui/sfSelFile.c
index 457fb74b148..7afcc1acedf 100644
--- a/Build/source/texk/xdvik/gui/sfSelFile.c
+++ b/Build/source/texk/xdvik/gui/sfSelFile.c
@@ -54,6 +54,14 @@
extern int errno;
#endif
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define sfBell(display, window, percent) \
+ XkbBell(display, window, percent, (Atom) None)
+#else
+# define sfBell(display, window, percent) XBell(display, percent)
+#endif
+
#define SEL_FILE_CANCEL -1
#define SEL_FILE_OK 0
#define SEL_FILE_NULL 1
@@ -147,7 +155,7 @@ void
raise_file_selector(void)
{
if (selFile != NULL && XtIsManaged(selFile)) {
- XBell(DISP, 10);
+ sfBell(DISP, XtWindow(selFile), 10);
XRaiseWindow(DISP, XtWindow(selFile));
return;
}
@@ -795,7 +803,9 @@ SFopenFile(const char *name, const char *mode, const char *prompt, const char *f
SFchdir(SFstartDir);
errno = 0;
if (!name || *name == 0 || (fp = XFOPEN(name, mode)) == NULL) {
- XBell(DISP, 0);
+ sfBell(DISP,
+ (selFile != NULL && XtIsManaged(selFile))
+ ? XtWindow(selFile) : (Window) NULL, 0);
return NULL;
}
return fp;
@@ -854,7 +864,7 @@ XsraSelFilePopup(struct filesel_callback *callback)
XEvent event;
if (XtIsManaged(callback->shell)) {
- XBell(DISP, 10);
+ sfBell(DISP, XtWindow(callback->shell), 10);
XRaiseWindow(DISP, XtWindow(callback->shell));
return;
}
@@ -966,7 +976,7 @@ XsraSelFilePopup(struct filesel_callback *callback)
w = XtParent(w);
}
if (w == NULL || w == globals.widgets.top_level) {
- XBell(DISP, 0);
+ sfBell(DISP, event.xany.window, 0);
continue;
}
break;
diff --git a/Build/source/texk/xdvik/gui/xm_filesel.c b/Build/source/texk/xdvik/gui/xm_filesel.c
index 484e84d17c2..b7a2d6fe2f4 100644
--- a/Build/source/texk/xdvik/gui/xm_filesel.c
+++ b/Build/source/texk/xdvik/gui/xm_filesel.c
@@ -43,6 +43,14 @@
#include <Xm/Form.h>
#include <Xm/ToggleBG.h>
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define XdviBell(display, window, percent) \
+ XkbBell(display, window, percent, (Atom) None)
+#else
+# define XdviBell(display, window, percent) XBell(display, percent)
+#endif
+
/* static Widget dialog = NULL; */
/* static char *browse_fname = NULL; */
@@ -156,7 +164,7 @@ void
XsraSelFilePopup(struct filesel_callback *callback)
{
if (XtIsManaged(callback->shell)) {
- XBell(DISP, 10);
+ XdviBell(DISP, XtWindow(callback->shell), 10);
XRaiseWindow(DISP, XtWindow(callback->shell));
return;
}
diff --git a/Build/source/texk/xdvik/m4/xdvi-func-xkbbell.m4 b/Build/source/texk/xdvik/m4/xdvi-func-xkbbell.m4
new file mode 100644
index 00000000000..0be2df199f2
--- /dev/null
+++ b/Build/source/texk/xdvik/m4/xdvi-func-xkbbell.m4
@@ -0,0 +1,29 @@
+# Autoconf macros for xdvik.
+# Copyright (C) 2012 Paul Vojta <xdvi-core@lists.sourceforge.net>
+# Adapted from xterm, Copyright 1997-2010,2011 by Thomas E. Dickey
+#
+# This file is free software; the copyright holder
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# XDVI_FUNC_XKB_BELL
+# -------------------------
+# Check for whether the XkbBell() extension is present in the X libraries.
+
+dnl ### Check for XkbBell() functionality. Adapted from xterm's version.
+AC_DEFUN([XDVI_FUNC_XKB_BELL],[
+AC_CACHE_CHECK([for XKB Bell extension], xdvi_cv_func_xkb_bell,
+[xdvi_save_LIBS=$LIBS
+LIBS="$X_PRE_LIBS"$1" $LIBS $X_LIBS -lX11"
+AC_TRY_LINK([
+#include <X11/X.h>
+#include <X11/XKBlib.h> /* has the prototype */
+],[
+ Atom y;
+ XkbBell((Display *)0, (Window)0, 0, y);
+],[xdvi_cv_func_xkb_bell=yes],[xdvi_cv_func_xkb_bell=no])
+LIBS=$xdvi_save_LIBS])
+if test "$xdvi_cv_func_xkb_bell" = yes; then
+ X_PRE_LIBS="$X_PRE_LIBS"$1
+ AC_DEFINE([HAVE_XKB_BELL_EXT], 1, [Define if your system has XkbBell().])
+fi])
diff --git a/Build/source/texk/xdvik/m4/xdvi-gs-lib-path.m4 b/Build/source/texk/xdvik/m4/xdvi-gs-lib-path.m4
new file mode 100644
index 00000000000..ab5ab1fc1a0
--- /dev/null
+++ b/Build/source/texk/xdvik/m4/xdvi-gs-lib-path.m4
@@ -0,0 +1,39 @@
+# Autoconf macros for xdvik.
+# Copyright (C) 2013 Paul Vojta <xdvi-core@lists.sourceforge.net>
+#
+# This file is free software; the copyright holder
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# XDVI_GS_LIB_PATH
+# ----------------
+# Find the path to use for GS_LIB.
+
+dnl ### Determine the path to use for GS_LIB.
+
+AC_DEFUN([XDVI_GS_LIB_PATH],
+[AC_ARG_WITH(default-gs-lib-path, [ --with-default-gs-lib-path=PATH
+ set default path for finding font aliases to PATH],
+[AC_DEFINE_UNQUOTED([DEFAULT_GS_LIB_PATH], "$withval",
+ [Define to set the default path for ghostscript-style font searching.])
+],
+[AC_CACHE_CHECK([for the path to be used for Ghostscript searches],
+xdvi_cv_gs_lib_path,
+[if gs -h >/dev/null 2>&1; then
+ ac_tmp="`gs -h \
+ | sed \
+ -e '1,/Search path:/d' \
+ -e '/For more information/,$d' \
+ -e '/Initialization files are compiled/d' \
+ -e 's/$/\/\/\//' \
+ -e 's/^ //' \
+ | tr '\n' '/'`"
+ # Solaris 9 sed doesn't handle incomplete lines at eof
+ xdvi_cv_gs_lib_path=`echo "$ac_tmp" \
+ | sed -e 's/\/\/\/\// /g' -e 's/ *$//' -e 's/ : /:/g'`
+else
+ xdvi_cv_gs_lib_path=/usr/local/share/ghostscript/fonts:/usr/local/lib/ghostscript/fonts:/usr/share/ghostscript/fonts:/var/lib/ghostscript/fonts:/usr/share/cups/fonts:/usr/share/fonts
+ AC_MSG_WARN(Could not determine Ghostscript search path; using $xdvi_cv_gs_lib_path)
+fi])
+AC_DEFINE_UNQUOTED([DEFAULT_GS_LIB_PATH], "$xdvi_cv_gs_lib_path")
+])])
diff --git a/Build/source/texk/xdvik/main.c b/Build/source/texk/xdvik/main.c
index 0ca170dec90..5da0a783442 100644
--- a/Build/source/texk/xdvik/main.c
+++ b/Build/source/texk/xdvik/main.c
@@ -1,3 +1,26 @@
+/*
+ * Copyright (c) 2013 the xdvik development team
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
+ * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
+ * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ */
+
#include "xdvi-config.h"
#include <locale.h>
@@ -17,9 +40,10 @@
#include "mag.h"
#include "message-window.h"
-#ifdef T1LIB
-#include "t1lib.h"
-#endif /* T1LIB */
+#if FREETYPE
+# include <ft2build.h>
+# include FT_FREETYPE_H
+#endif
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
@@ -85,9 +109,9 @@ static XrmOptionDescRec options[] = {
#endif
{"-mfmode", ".mfMode", XrmoptionSepArg, (XPointer)NULL },
{"-editor", ".editor", XrmoptionSepArg, (XPointer)NULL },
-#ifdef T1LIB
- {"-not1lib", ".t1lib", XrmoptionNoArg, (XPointer)"off" },
- {"+not1lib", ".t1lib", XrmoptionNoArg, (XPointer)"on" },
+#if FREETYPE
+ {"-notype1fonts", ".type1", XrmoptionNoArg, (XPointer)"off" },
+ {"+notype1fonts", ".type1", XrmoptionNoArg, (XPointer)"on" },
#endif
{"-sourceposition", ".sourcePosition", XrmoptionSepArg, (XPointer)NULL },
{"-findstring", ".findString", XrmoptionSepArg, (XPointer)NULL },
@@ -407,8 +431,7 @@ display_long_licensing_info(void)
"Xdvik uses the following libraries:\n"
"- The kpathsea library, licensed in part under the GNU General Public\n"
" License, in part under the GNU Library General Public License.\n"
- "- t1lib, licensed in parts under the GNU Library General Public License,\n"
- " in parts under the X Consortium license.\n"
+ "- FreeType2, licensed under the GNU General Public License.\n"
"There is NO WARRANTY of anything.\n\n", stdout);
}
@@ -759,7 +782,12 @@ display_version_info(void)
#else
printf("%s\n", XDVI_GUI);
#endif
- printf("Libraries: %s, T1lib version %s\n", kpathsea_version_string, T1LIB_VERSIONSTRING);
+#if FREETYPE
+ printf("Libraries: %s, freetype version %d.%d.%d\n",
+ kpathsea_version_string, FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH);
+#else
+ printf("Libraries: %s\n", kpathsea_version_string);
+#endif
}
diff --git a/Build/source/texk/xdvik/read-mapfile.c b/Build/source/texk/xdvik/read-mapfile.c
deleted file mode 100644
index ccc2233e83e..00000000000
--- a/Build/source/texk/xdvik/read-mapfile.c
+++ /dev/null
@@ -1,158 +0,0 @@
-/*
- This code was stolen from dvips (getpsinfo() in resident.c) for xdvi
- use. The file itself does not carry any licensing info, except for
- reference to dvips.h, which doesn't have a standart-type license
- either. The code seems to be either in the public domain, or, in
- the worst case, GPL.
-
- - Nicolai Langfeldt, 21/2/1999
-
-*/
-
-#include "xdvi-config.h"
-#include "xdvi.h"
-#include "util.h"
-#include "read-mapfile.h"
-#include "dvi-draw.h" /* for add_T1_mapentry */
-#include <stdio.h>
-
-#ifdef T1LIB
-
-#include "kpathsea/tex-file.h"
-
-#define INLINE_SIZE 2048
-
-/*
- * Read a dvips psfont map file. Return True if it was read ok,
- * False otherwise.
- */
-Boolean
-read_map_file(char *name)
-{
- FILE *fp;
- char *p;
- char *specinfo;
- char specbuf[500];
- char *fullname;
- int lineno = 0;
- static char inline_buf[INLINE_SIZE];
-
- /* Try first for xdvi specific file */
- fullname = kpse_find_file(name, kpse_program_text_format, 0);
- /* Then any fontmap file */
- if (fullname == NULL) {
- fullname = kpse_find_file(name, kpse_fontmap_format, 0);
- }
-
- if (fullname == NULL) {
- XDVI_WARNING((stderr, "Could not find map file \"%s\".", name));
- return False;
- }
-
- fp = XFOPEN(fullname, "r");
- if (fp == NULL) {
- XDVI_WARNING((stderr, "Could not open map file \"%s\": %s.\n", name, strerror(errno)));
- return False;
- }
-
- TRACE_T1((stderr, "Map file: %s\n", fullname));
-
- while (fgets(inline_buf, INLINE_SIZE, fp) != NULL) {
- char *TeXname = NULL;
- char *PSname = NULL;
- char *Fontfile = NULL;
- char *Vectfile = NULL;
- char *hdr_name = NULL;
- specinfo = NULL;
- specbuf[0] = 0;
- lineno++;
-
- /* One line at a time */
- p = inline_buf;
-
- if (*p < ' ' || *p == '*' || *p == '#' || *p == ';' || *p == '%')
- continue;
-
- while (*p) {
- while (*p && *p <= ' ')
- p++;
- if (*p) {
- /* Note: In dvips, this flag is set outside the loop
- so that font files may be scanned/included as encoding files
- (I guess it doesn't matter for dvips, but it does for xdvi ...)
- */
- boolean encoding_p = False;
- if (*p == '"') { /* PostScript instructions? */
- if (specinfo) {
- strcat(specbuf, specinfo);
- strcat(specbuf, " ");
- }
- specinfo = p + 1;
-
- }
- else if (*p == '<') { /* Header to download? */
- if (p[1] == '<') { /* << means always full download, ignore */
- p++;
- }
- else if (p[1] == '[') { /* <[ means an encoding */
- p++;
- encoding_p = True;
- }
- p++;
- /* skip whitespace after < */
- while (*p && *p <= ' ')
- p++;
-
- /* save start of header name */
- hdr_name = p;
-
- }
- else if (TeXname) /* second regular word on line? */
- PSname = p;
-
- else /* first regular word? */
- TeXname = p;
-
- if (*p == '"') {
- p++; /* find end of "..." word */
- while (*p != '"' && *p)
- p++;
- }
- else
- while (*p > ' ') /* find end of anything else */
- p++;
-
- /* Terminate the substring we just identified */
- if (*p)
- *p++ = 0;
-
- /* If we had a header we were downloading, figure out what to do;
- couldn't do this above since we want to check the suffix. */
- if (hdr_name) {
- const char *suffix = find_suffix(hdr_name);
- if (encoding_p
- || (suffix != NULL && strcmp(suffix, "enc") == 0)) {
- Vectfile = hdr_name;
- }
- else {
- Fontfile = hdr_name;
- }
- }
- }
- } /* while (*p) */
-
- /* Line finished. Lookit what we got */
- if (specinfo) {
- strcat(specbuf, specinfo);
- }
-
- if (TeXname) {
- add_T1_mapentry(lineno, fullname, TeXname, Fontfile, Vectfile, specinfo);
- }
-
- }
- fclose(fp);
- return True;
-}
-
-#endif /* T1LIB */
diff --git a/Build/source/texk/xdvik/read-mapfile.h b/Build/source/texk/xdvik/read-mapfile.h
deleted file mode 100644
index ed56eb49614..00000000000
--- a/Build/source/texk/xdvik/read-mapfile.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2002-2004 the xdvik development team
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef DVIPS_H_
-#define DVIPS_H_
-
-extern Boolean read_map_file(char *filename);
-
-#endif /* DVIPS_H_ */
diff --git a/Build/source/texk/xdvik/tests/Makefile.in b/Build/source/texk/xdvik/tests/Makefile.in
index 384b0bb96a8..02681b1d9d4 100644
--- a/Build/source/texk/xdvik/tests/Makefile.in
+++ b/Build/source/texk/xdvik/tests/Makefile.in
@@ -65,13 +65,16 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/xdvi-c-bitmap-type.m4 \
$(top_srcdir)/m4/xdvi-func-poll.m4 \
$(top_srcdir)/m4/xdvi-func-setsid-in-fork.m4 \
$(top_srcdir)/m4/xdvi-func-working-vsnprintf.m4 \
+ $(top_srcdir)/m4/xdvi-func-xkbbell.m4 \
+ $(top_srcdir)/m4/xdvi-gs-lib-path.m4 \
$(top_srcdir)/m4/xdvi-linker-multiple-defns.m4 \
$(top_srcdir)/m4/xdvi-sys-old-linux.m4 \
$(top_srcdir)/m4/xdvi-sys-streams.m4 \
$(top_srcdir)/../../m4/kpse-common.m4 \
+ $(top_srcdir)/../../m4/kpse-freetype2-flags.m4 \
$(top_srcdir)/../../m4/kpse-kpathsea-flags.m4 \
- $(top_srcdir)/../../m4/kpse-t1lib-flags.m4 \
$(top_srcdir)/../../m4/kpse-warnings.m4 \
+ $(top_srcdir)/../../m4/kpse-zlib-flags.m4 \
$(top_srcdir)/../../m4/libtool.m4 \
$(top_srcdir)/../../m4/ltoptions.m4 \
$(top_srcdir)/../../m4/ltsugar.m4 \
@@ -396,6 +399,10 @@ ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
FGREP = @FGREP@
+FREETYPE2_DEPEND = @FREETYPE2_DEPEND@
+FREETYPE2_INCLUDES = @FREETYPE2_INCLUDES@
+FREETYPE2_LIBS = @FREETYPE2_LIBS@
+FT2_CONFIG = @FT2_CONFIG@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -437,9 +444,6 @@ SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
STRIP = @STRIP@
-T1LIB_DEPEND = @T1LIB_DEPEND@
-T1LIB_INCLUDES = @T1LIB_INCLUDES@
-T1LIB_LIBS = @T1LIB_LIBS@
VERSION = @VERSION@
WARNING_CFLAGS = @WARNING_CFLAGS@
XDVIK_VERSION = @XDVIK_VERSION@
@@ -448,6 +452,9 @@ X_CFLAGS = @X_CFLAGS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_LIBS = @X_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
+ZLIB_DEPEND = @ZLIB_DEPEND@
+ZLIB_INCLUDES = @ZLIB_INCLUDES@
+ZLIB_LIBS = @ZLIB_LIBS@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
@@ -511,13 +518,13 @@ x_tool_libs = @x_tool_libs@
x_xmu_lib = @x_xmu_lib@
x_xpm_libs = @x_xpm_libs@
x_cppflags = $(X_CFLAGS) $(iconv_includes)
-common_includes = $(PS_DEF) $(KPATHSEA_INCLUDES) $(T1LIB_INCLUDES) $(x_cppflags)
+common_includes = $(PS_DEF) $(KPATHSEA_INCLUDES) $(FREETYPE2_INCLUDES) $(x_cppflags)
x_ldflags = $(X_LIBS) $(x_linker_options) $(iconv_libpath)
x_extra_libs = $(X_EXTRA_LIBS) $(iconv_libs)
xdvi_x_libs = $(x_ldflags) $(x_tool_libs) $(x_xmu_lib) -lXt \
$(X_PRE_LIBS) $(x_ext_lib) $(x_xpm_libs) -lX11 $(x_extra_libs)
-common_ldadd = $(KPATHSEA_LIBS) $(T1LIB_LIBS) $(xdvi_x_libs)
-common_dependencies = $(KPATHSEA_DEPEND) $(T1LIB_DEPEND)
+common_ldadd = $(KPATHSEA_LIBS) $(FREETYPE2_LIBS) $(xdvi_x_libs)
+common_dependencies = $(KPATHSEA_DEPEND) $(FREETYPE2_DEPEND)
libxdvi_dependencies = ${top_srcdir}/*.[ch] ${top_srcdir}/gui/*.[ch] ${top_builddir}/psheader.c
AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/gui $(common_includes)
AM_CFLAGS = $(WARNING_CFLAGS)
@@ -995,7 +1002,7 @@ uninstall-am:
@KPATHSEA_RULE@
-@T1LIB_RULE@
+@FREETYPE2_RULE@
$(run_tests_OBJECTS): ../libxdvi.a $(common_dependencies)
diff --git a/Build/source/texk/xdvik/texmf-alt/xdvi.cfg b/Build/source/texk/xdvik/texmf-alt/xdvi.cfg
deleted file mode 100644
index 51966e747fc..00000000000
--- a/Build/source/texk/xdvik/texmf-alt/xdvi.cfg
+++ /dev/null
@@ -1,90 +0,0 @@
-% original xdvi.cfg -- Configuration file for the Type1 rendering module of xdvi.
-% (If you change or delete `original' in the first line of this file,
-% new xdvik installations won't overwrite this file.)
-%
-% Lines starting with `%' are comments.
-%
-% Version 1.0 for xdvik-22.x and teTeX < 1.0 or non-teTeX installations,
-% 2003/02/28
-%
-% Original version by Nicolai Langfeldt 2001/06/05
-
-% NOTE TO TETEX USERS: For teTeX >= v1.0, use the file texmf/xdvi.cfg
-% instead. That file uses ps2pk.map which will automatically be updated
-% by teTeX's `updmap' script; by contrast, the map files listed in Section 2
-% below need to be maintained manually.
-
-
-% =============== Section 1: Encodings ===============
-%
-% Here we list all the encodings we want xdvi to recognize as an
-% "implied" encoding. This means that ptmr8r will be recognized as
-% ptmr encoded with 8r and ptmr8y as ptmr encoded with 8y. If the font file
-% we want to encode with 8r is named ptmr8a, however, this must be listed in
-% the map file entry.
-
-% NOTE: the enc files used by xdvi are similar to those used by dvips,
-% whith the important exception that xdvi _cannot_ parse postscript,
-% so the vectors mustn't require postscript execution.
-
-% Suffix Encoding name Defined by this file
-enc 8r TeXBase1Encoding 8r.enc
-enc 8c CorkEncoding cork.enc
-enc 8y TeXnANSIEncoding texnansi.enc
-
-
-
-% =============== Section 2: Map files ===============
-%
-% A font map file is a mapping of TeX font names (and encodings) to
-% Postscript Type1 font names, similar to dvips' psfonts.map. See the
-% dvips documentation for more information about the font map file
-% format, and the file `README.t1fonts' in the xdvik source
-% distribution for information on the differences between dvips and
-% xdvik font maps.
-%
-% Multiple map files are allowed. If a font entry is found in several
-% files, later entries will override earlier ones (and a warning
-% will be printed to stderr).
-%
-% The .map files listed below here are ones found in teTeX <= 1.0.
-
-% xdvifont.map is a edited digest of psfonts.map for use with xdvi
-dvipsmap xdvifont.map
-
-% Users of teTeX-1.0 should use the following combination of map files:
-%dvipsmap psfonts.map
-%dvipsmap ps2pk.map
-
-% Otherwise, you can add any of the following maps, depending on
-% whether you have the respective fonts.
-
-% We can use these un-modified:
-dvipsmap marvosym.map
-dvipsmap xypic.map
-
-% If you applied t1mapper to the Charter fonts (they are in gs)
-% you want this:
-dvipsmap charter2.map
-% otherwise you want this:
-% dvipsmap charter.map
-
-% Lucida fonts. Possibly unsuitabe. Much of these are wrong if
-% t1mapper was applied to the fonts. Some of the lines describing
-% fonts with modified slant or width will need editing if t1mapper was
-% applied. If t1mapper was not applied they are both needed:
-% dvipsmap lucidabr.map
-% dvipsmap utopia.map
-
-% "real" bakoma instead of interpolated bsr
-% dvipsmap bakomaextra.map
-% this one *or* the previous one. Not both!
-% dvipsmap bsr-missing-interpolated.map
-
-% Various symbol/calligraphic fonts
-% dvipsmap hoekwater.map
-
-% The following files are never needed: mathtime.map (partly trivial,
-% partly unsuitable, the rest is in xdvifont.map); acrobat.map,
-% lw35extra.map (t1mapper should have taken care of this); psfonts.map
-% (see above); cs.map, omega.map, bsr.map (no map files needed for these).
diff --git a/Build/source/texk/xdvik/texmf/config.xdvi b/Build/source/texk/xdvik/texmf/config.xdvi
new file mode 100644
index 00000000000..5504fb48c2f
--- /dev/null
+++ b/Build/source/texk/xdvik/texmf/config.xdvi
@@ -0,0 +1,40 @@
+% original config.xdvi -- Configuration file for Type 1 rendering in xdvi.
+% (If you change or delete `original' in the first line of this file,
+% new xdvik installations won't overwrite the file.)
+%
+% This file is part of xdvik (notwithstanding its location).
+%
+% Lines starting with `%' are comments.
+%
+% This file indicates which map files are to be used when running xdvi.
+% (It is not used by dvips, unless you type "dvips -Pxdvi ...", which is not
+% likely. Doing so, however, would allow you to use the same map files
+% in dvips as are used in xdvi.)
+%
+% The format is the same as for dvips configuration files, except that only
+% the `p' and `p+' directives are used. A line
+%
+% p file.map
+%
+% clears the existing list of map files and sets the list to the given file.
+% A line
+%
+% p+ file2.map
+%
+% adds the given map file to the end of the list. If you use "p file.map"
+% anywhere other than as the first (non-comment, non-blank) line of the file,
+% then you are probably making a mistake.
+%
+% If a font entry is found in several files, the earlier entry will be used
+% (as is done in dvips). Therefore, to override font entries in the standard
+% file psfonts.map, you should use entries such as:
+%
+% p myfile.map
+% p+ anotherfile.map
+% p+ psfonts.map
+%
+% However, normally it isn't necessary to add any other map file here
+% because psfonts.map is (normally) a generated file (by the updmap
+% script). Instead, map files should be added to the updmap.cfg file.
+%
+% p psfonts.map
diff --git a/Build/source/texk/xdvik/texmf/xdvi.cfg b/Build/source/texk/xdvik/texmf/xdvi.cfg
deleted file mode 100644
index f175e5a3f92..00000000000
--- a/Build/source/texk/xdvik/texmf/xdvi.cfg
+++ /dev/null
@@ -1,65 +0,0 @@
-% original xdvi.cfg -- Configuration file for the Type1 rendering module of xdvi.
-% (If you change or delete `original' in the first line of this file,
-% new xdvik installations won't overwrite the file.)
-%
-% Lines starting with `%' are comments.
-%
-% This file is not suitable for teTeX versions before 1.0. Users of
-% such or non-teTeX installations should have a look at the following
-% files instead:
-%
-% ../texmf-alt/xdvi.cfg
-% ../README.t1fonts
-%
-% For using this file with teTeX-1.0.x, please uncomment the line with
-% `psfonts.map' (preserving the order of the lines).
-%
-% For any later version of teTeX, no modification is needed.
-%
-
-% File version 1.2
-% Original version by Nicolai Langfeldt 2001/06/05
-% Changes by Thomas Esser for teTeX, Sat Nov 3 23:33:54 CET 2001.
-
-% =============== Section 1: Encodings ===============
-%
-% Here we list all the encodings we want xdvi to recognize as an
-% "implied" encoding. This means that a font named `ptmr8r' will
-% be treated as font `ptmr' encoded with `8r', and `ptmr8y' as
-% `ptmr' encoded with `8y'. Fonts that don not follow this convention
-% must have an explicit encoding entry in the map file.
-%
-% The encoding files used by xdvi are similar to those used by dvips,
-% whith the important exception that xdvi _cannot_ parse postscript,
-% so the vectors mustn't require postscript execution.
-
-%Keyword Suffix Encoding name Defined by this file
-enc 8r TeXBase1Encoding 8r.enc
-enc 8c CorkEncoding cork.enc
-enc 8y TeXnANSIEncoding texnansi.enc
-
-
-
-% =============== Section 2: Map files ===============
-%
-% A font map file is a mapping of TeX font names (and encodings) to
-% Postscript Type1 font names, similar to dvips' psfonts.map. See the
-% dvips documentation for more information about the font map file
-% format, and the file `README.t1fonts' in the xdvik source
-% distribution for information on the differences between dvips and
-% xdvik font maps.
-%
-% Multiple map files are allowed. If a font entry is found in several
-% files, later entries will override earlier ones (and a warning
-% will be printed to stderr).
-%
-% However, normally it isn't necessary to add any other map file here
-% because ps2pk.map is (normally) a generated file (by the updmap
-% script). Instead, map files should be added to the updmap.cfg file.
-%
-% ps2pk has no "built-in" fonts, just like xdvik, so its map file is used
-% for xdvik too. For teTeX-1.0, psfonts.map is needed in addition.
-
-% dvipsmap psfonts.map
-dvipsmap ps2pk.map
-
diff --git a/Build/source/texk/xdvik/tfmload.c b/Build/source/texk/xdvik/tfmload.c
deleted file mode 100644
index 6d2ceb1c9b6..00000000000
--- a/Build/source/texk/xdvik/tfmload.c
+++ /dev/null
@@ -1,120 +0,0 @@
-/* This code was stolen from dvips for xdvi use. The file itself did
- * not carry any licensing info. According to other filed the code
- * either public domain, or, in the worst case, GPL.
- *
- * Loads a tfm file. It marks the characters as undefined.
- *
- * Modified for use by xdvi/t1 by Nicolai Langfeldt */
-
-#include <stdio.h>
-
-#include "xdvi-config.h"
-#include "xdvi.h"
-#include "util.h"
-#include "tfmload.h"
-
-#ifdef T1LIB
-
-#include "kpathsea/tex-file.h"
-
-int fallbacktfm = 0;
-
-Boolean
-tfmload(const char *name, long *design, long *widths, long *fontdimen2)
-{
- int i;
- int li;
- int nw, hd;
- int bc, ec;
- int f_param_off, f_param_num;
- long wtab[256];
- unsigned short chardat[256];
- char *filename;
- FILE *curfnt;
-
- fallbacktfm = 0;
-
- filename = kpse_find_tfm(name);
-
- if (filename == NULL) {
- filename = kpse_find_tfm("cmr10.tfm");
- if (fallbacktfm == 0)
- fallbacktfm = 1;
- }
-
- if (filename == NULL)
- return False;
-
- curfnt = XFOPEN(filename, "r");
-
- if (curfnt == NULL)
- return False;
-
- /* Next, we read the font data from the tfm file, and store it in
- * our own array. */
-
- /* Lengths section, 16 bit unsigned quanities */
- li = get_bytes(curfnt, 2); /* lf = length of file, in words(4 bytes) */
- hd = get_bytes(curfnt, 2); /* lh = length of header data, in words */
- bc = get_bytes(curfnt, 2); /* bc = lowest charcode */
- ec = get_bytes(curfnt, 2); /* ec = largest charcode */
- nw = get_bytes(curfnt, 2); /* nw = number of width words */
- f_param_off = get_bytes(curfnt, 2); /* nh = number of height words */
- f_param_off += get_bytes(curfnt, 2); /* nd = number of depth words */
- f_param_off += get_bytes(curfnt, 2); /* ni = number of italic words */
- f_param_off += get_bytes(curfnt, 2); /* nl = number of words in lig/kern table */
- f_param_off += get_bytes(curfnt, 2); /* nk = number of words in the kern table */
- f_param_off += get_bytes(curfnt, 2); /* ne = number of words in the extensible char tab */
- f_param_num = get_bytes(curfnt, 2); /* np = number of font parameter words */
-
- /* Header, 32 bit signed quantities */
- (void)get_bytes(curfnt, 4); /* header[0]: checksum */
- *design = get_bytes(curfnt, 4); /* header[1]: design size */
-
- /* Skip the rest: header[2..(hd-1)] */
- for (i = 2; i < hd; i++)
- li = get_bytes(curfnt, 4);
-
- /* Initialize to undef value */
- for (i = 0; i < 256; i++) {
- chardat[i] = 256;
- widths[i] = 0;
- }
-
- /* The charinfo array: */
- for (i = bc; i <= ec; i++) {
- chardat[i] = get_byte(curfnt); /* 8 bits of width index */
- (void)get_byte(curfnt); /* skip */
- (void)get_bytes(curfnt, 2); /* skip, jump */
- }
-
- /* The (compressed!) width table */
- for (i = 0; i < nw; i++)
- wtab[i] = get_bytes(curfnt, 4);
-
- /* skip to font parameter words */
- for (i = 0; i < f_param_off; i++)
- (void)get_bytes(curfnt, 4);
-
- /* read fontdimen2 (width of space) */
- for (i = 0; i < f_param_num; i++) {
- long l = get_bytes(curfnt, 4);
- if (i == 1) {
- *fontdimen2 = l;
- if (globals.debug & DBG_T1)
- fprintf(stderr, "fontdimen2 of %s: %ld\n", filename, *fontdimen2);
- }
-
- }
- (void)fclose(curfnt);
-
- /* Now we have the table and the indexes. Expand into a directly
- mapped width array */
- for (i = bc; i <= ec; i++)
- if (chardat[i] != 256)
- widths[i] = wtab[chardat[i]];
-
- return True;
-}
-
-#endif /* T1LIB */
diff --git a/Build/source/texk/xdvik/tfmload.h b/Build/source/texk/xdvik/tfmload.h
deleted file mode 100644
index 35b9f7c853f..00000000000
--- a/Build/source/texk/xdvik/tfmload.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2002-2004 the xdvik development team
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to
- * deal in the Software without restriction, including without limitation the
- * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
- * sell copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * PAUL VOJTA OR ANY OTHER AUTHOR OF THIS SOFTWARE BE LIABLE FOR ANY CLAIM,
- * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef TFMLOAD_H_
-#define TFMLOAD_H_
-#ifdef T1LIB
-
-extern int fallbacktfm;
-extern Boolean tfmload(const char *, long *, long *, long *);
-
-#endif
-#endif /* TFMLOAD_H_ */
diff --git a/Build/source/texk/xdvik/util.c b/Build/source/texk/xdvik/util.c
index 3915af93a82..8dbd1fa7cbd 100644
--- a/Build/source/texk/xdvik/util.c
+++ b/Build/source/texk/xdvik/util.c
@@ -1,6 +1,6 @@
/*========================================================================*\
-Copyright (c) 1990-2004 Paul Vojta and others
+Copyright (c) 1990-2013 Paul Vojta and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -83,6 +83,10 @@ extern void *malloc();
extern void *realloc();
#endif
+#if HAVE_XKB_BELL_EXT
+# include <X11/XKBlib.h>
+# define XBell(dpy, percent) XkbBell(dpy, mane.win, percent, (Atom) None)
+#endif
/* if POSIX O_NONBLOCK is not available, use O_NDELAY */
#if !defined O_NONBLOCK && defined O_NDELAY
@@ -206,8 +210,8 @@ struct debug_string_options debug_options[] = {
{ DBG_HTEX, "htex", ", " },
{ DBG_SRC_SPECIALS,"src", ", " },
{ DBG_CLIENT, "client", ", " },
- { DBG_T1, "t1", ", " },
- { DBG_T1_VERBOSE, "t1_verbose", ",\n"},
+ { DBG_FT, "ft", ", " },
+ { DBG_FT_VERBOSE, "ft_verbose", ",\n"},
{ DBG_GUI, "gui", ", " },
{ DBG_FIND, "find", ", " },
{ DBG_FILES, "files", ", " },
@@ -642,6 +646,7 @@ xstrdup(const char *str)
return new;
}
+#endif /* not KPATHSEA */
/*
@@ -658,8 +663,6 @@ xmemdup(const char *str, size_t len)
return new;
}
-#endif /* not KPATHSEA */
-
/* like xstrdup(), but with XtMalloc() */
char *
xt_strdup(const char *ptr)
@@ -1577,6 +1580,143 @@ put_str_int_hash(hashTableT *hashtable, const char *key, size_t val)
hash_insert(hashtable, key, (const string)ptr);
}
+
+#if FREETYPE || PS
+
+/*
+ * General AVL tree mechanism. Search for a node, and return it if found.
+ * Otherwise insert a node.
+ * This uses the AVL algorithm from Knuth Vol. 3.
+ */
+
+struct avl *
+avladd(const char *key, size_t key_len, struct avl **headp, size_t size)
+{
+ struct avl *ap;
+ struct avl **app;
+ struct avl *sp; /* place where rebalancing may be necessary */
+ struct avl **spp; /* points to sp */
+ int i;
+
+ /* Search */
+ spp = app = headp;
+ for (;;) {
+ ap = *app;
+ if (ap == NULL) /* bottom of tree */
+ break;
+ if (ap->bal != 0)
+ spp = app;
+ i = key_len - ap->key_len;
+ if (i == 0)
+ i = memcmp(key, ap->key, key_len);
+ if (i == 0) /* found record already */
+ return ap;
+ if (i < 0) /* move left */
+ app = &ap->left;
+ else
+ app = &ap->right;
+ }
+
+ /* Insert */
+ ap = xmalloc(size);
+ ap->key = key;
+ ap->key_len = key_len;
+ ap->bal = 0;
+ ap->left = ap->right = NULL;
+ *app = ap;
+
+ /* Adjust balance factors */
+ sp = *spp;
+ if (sp == ap)
+ return ap;
+ i = key_len - sp->key_len;
+ if (i == 0)
+ i = memcmp(key, sp->key, key_len);
+ sp = (i < 0 ? sp->left : sp->right);
+ while (sp != ap) {
+ i = key_len - sp->key_len;
+ if (i == 0)
+ i = memcmp(key, sp->key, key_len);
+ if (i < 0) {
+ sp->bal = -1;
+ sp = sp->left;
+ }
+ else {
+ sp->bal = 1;
+ sp = sp->right;
+ }
+ }
+
+ /* Balancing act */
+ sp = *spp;
+ i = key_len - sp->key_len;
+ if (i == 0)
+ i = memcmp(key, sp->key, key_len);
+ if (i < 0) {
+ if (sp->bal >= 0)
+ --sp->bal;
+ else { /* need to rebalance */
+ struct avl *left;
+
+ left = sp->left;
+ if (left->bal < 0) { /* single rotation */
+ sp->left = left->right;
+ left->right = sp;
+ sp->bal = left->bal = 0;
+ *spp = left;
+ }
+ else { /* double rotation */
+ struct avl *newtop;
+
+ newtop = left->right;
+ sp->left = newtop->right;
+ newtop->right = sp;
+ left->right = newtop->left;
+ newtop->left = left;
+ sp->bal = left->bal = 0;
+ if (newtop->bal < 0) ++sp->bal;
+ else if (newtop->bal > 0) --left->bal;
+ newtop->bal = 0;
+ *spp = newtop;
+ }
+ }
+ }
+ else {
+ if (sp->bal <= 0)
+ ++sp->bal;
+ else { /* need to rebalance */
+ struct avl *right;
+
+ right = sp->right;
+ if (right->bal > 0) { /* single rotation */
+ sp->right = right->left;
+ right->left = sp;
+ sp->bal = right->bal = 0;
+ *spp = right;
+ }
+ else { /* double rotation */
+ struct avl *newtop;
+
+ newtop = right->left;
+ sp->right = newtop->left;
+ newtop->left = sp;
+ right->left = newtop->right;
+ newtop->right = right;
+ sp->bal = right->bal = 0;
+ if (newtop->bal > 0) --sp->bal;
+ else if (newtop->bal < 0) ++right->bal;
+ newtop->bal = 0;
+ *spp = newtop;
+ }
+ }
+ }
+
+ return ap;
+}
+
+#endif /* FREETYPE || PS */
+
+
/* set globals.dvi_name, globals.dvi_file.dirname and globals.dvi_file.dirlen */
void
set_dvi_name_expand(const char *new_filename)
diff --git a/Build/source/texk/xdvik/util.h b/Build/source/texk/xdvik/util.h
index 615b521d3de..d82d8d94581 100644
--- a/Build/source/texk/xdvik/util.h
+++ b/Build/source/texk/xdvik/util.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002-2004 the xdvik development team
+ * Copyright (c) 2002-2013 the xdvik development team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -96,9 +96,10 @@ extern int memicmp(const char *, const char *, size_t);
/* extern void *xmalloc(unsigned); */
/* extern void *xrealloc(void *, unsigned); */
/* extern char *xstrdup(const char *); */
-/* extern char *xmemdump(const char *, size_t); */
/* extern void xputenv(const char *, const char *); */
+extern char *xmemdup(const char *, size_t);
+
/* like xstrdup, but only copy len characters and zero-terminate at next index (allocates len+1 characters) */
extern char *xstrndup(const char *str, size_t len);
@@ -149,6 +150,28 @@ typedef hash_table_type hashTableT; /* from kpathsea */
extern Boolean find_str_int_hash(hashTableT *hashtable, const char *key, size_t *val);
extern void put_str_int_hash(hashTableT *hashtable, const char *key, size_t val);
+#if FREETYPE || PS
+
+/*
+ * AVL tree structures.
+ */
+
+#define AVL_COMMON \
+ const char *key; /* key */ \
+ int key_len; /* length of key */ \
+ int bal; /* AVL balancing information */ \
+ struct avl *left; \
+ struct avl *right
+
+struct avl { /* generic data structure */
+ AVL_COMMON;
+};
+
+extern struct avl *avladd(const char *, size_t, struct avl **, size_t);
+
+#endif /* FREETYPE || PS */
+
+
extern Boolean copy_file(const char *from, const char *to);
extern Boolean copy_fp(FILE *in, FILE *out);
diff --git a/Build/source/texk/xdvik/version.h b/Build/source/texk/xdvik/version.h
index ba660fdd874..d764fca456f 100644
--- a/Build/source/texk/xdvik/version.h
+++ b/Build/source/texk/xdvik/version.h
@@ -2,7 +2,7 @@
#ifndef VERSION_H_
#define VERSION_H_
-#define XDVI_VERSION "22.85"
+#define XDVI_VERSION "22.86"
#ifdef MOTIF
#define XDVI_GUI "(Motif toolkit)"
diff --git a/Build/source/texk/xdvik/x_util.c b/Build/source/texk/xdvik/x_util.c
index e2aabede685..df1c48d92e6 100644
--- a/Build/source/texk/xdvik/x_util.c
+++ b/Build/source/texk/xdvik/x_util.c
@@ -196,35 +196,24 @@ static char *atom_names[] = {
};
static Atom atoms[XtNumber(atom_names)];
-Window
-get_window_id(char *window_p)
-{
- Window w;
- unsigned char *tmp;
- tmp = (unsigned char *)window_p;
-
-#if !(defined(WORD64) || defined(LONG64))
- w = (*((xuint32 *) window_p));
+/*
+ * On 64-bit platforms, XGetWindowProperty and related functions convert
+ * properties with format=32 to arrays of longs. This function keeps that
+ * convention.
+ * The return value is the total number of bytes in the buffer.
+ */
+
+#if defined(WORD64) || defined(LONG64)
+# define LONG_CONV_64(bytes, format) ((bytes) << ((format) >> 5))
#else
-# if WORDS_BIGENDIAN
- w = ((unsigned long)tmp[0] << 24) |
- ((unsigned long)tmp[1] << 16) |
- ((unsigned long)tmp[2] << 8) |
- (unsigned long)tmp[3];
-# else
- w = ((unsigned long)tmp[3] << 24) |
- ((unsigned long)tmp[2] << 16) |
- ((unsigned long)tmp[1] << 8) |
- (unsigned long)tmp[0];
-# endif
+# define LONG_CONV_64(bytes, format) (bytes)
#endif
- return w;
-}
size_t
property_get_data(Window w, Atom a, char **ret_buf,
int (*x_get_property)(Display *, Window, Atom, long,
- long, Bool, Atom, Atom *, int *, unsigned long *,
+ long, Bool, Atom,
+ Atom *, int *, unsigned long *,
unsigned long *, unsigned char **))
{
/* all of these are in 8-bit units */
@@ -253,13 +242,17 @@ property_get_data(Window w, Atom a, char **ret_buf,
nitems_ret *= (format_ret / 8); /* convert to bytes */
- while ((byte_offset + nitems_ret) >= buffer_len) {
- buffer_len += 256;
- buffer = xrealloc(buffer, buffer_len);
+ if (LONG_CONV_64(byte_offset + nitems_ret, format_ret) >= buffer_len) {
+ buffer_len += 256
+ * ((LONG_CONV_64(byte_offset + nitems_ret, format_ret)
+ - buffer_len) / 256 + 1);
+ buffer = (buffer == NULL ? xmalloc(buffer_len)
+ : xrealloc(buffer, buffer_len));
}
/* the +1 captures the extra '\0' that Xlib puts after the end. */
- memcpy(buffer + byte_offset, prop_ret, nitems_ret + 1);
+ memcpy(buffer + LONG_CONV_64(byte_offset, format_ret), prop_ret,
+ LONG_CONV_64(nitems_ret, format_ret) + 1);
byte_offset += nitems_ret;
XFree(prop_ret);
@@ -273,42 +266,28 @@ property_get_data(Window w, Atom a, char **ret_buf,
XFree(prop_ret);
*ret_buf = (char *)buffer;
- return byte_offset;
+ return LONG_CONV_64(byte_offset, format_ret);
}
-size_t
-property_get_window_list(char **window_list)
+static size_t
+property_get_window_list(long **window_list)
{
size_t len = property_get_data(DefaultRootWindow(DISP),
- atom_xdvi_windows(), window_list,
+ atom_xdvi_windows(), (char **) window_list,
XGetWindowProperty);
if (len == 0) {
TRACE_CLIENT((stderr, "No \"xdvi windows\" property found"));
return 0;
}
- if (len % 4 != 0) {
- TRACE_CLIENT((stderr, "\"XDVI_WINDOWS\" property had incorrect size; deleting it."));
+ if (len % sizeof(long) != 0) {
+ TRACE_CLIENT((stderr,
+ "\"XDVI_WINDOWS\" property had incorrect size; deleting it."));
XDeleteProperty(DISP, DefaultRootWindow(DISP), atom_xdvi_windows());
return 0;
}
- return len;
-}
-void
-set_window_id(Window w, unsigned char *data)
-{
-#if WORDS_BIGENDIAN
- data[0] = (unsigned int)w >> 24;
- data[1] = (unsigned int)w >> 16;
- data[2] = (unsigned int)w >> 8;
- data[3] = (unsigned int)w;
-#else
- data[0] = (unsigned int)w;
- data[1] = (unsigned int)w >> 8;
- data[2] = (unsigned int)w >> 16;
- data[3] = (unsigned int)w >> 24;
-#endif
+ return len / sizeof (long);
}
/**
@@ -325,16 +304,16 @@ set_dvi_property(void)
/*
- * Delete all occurences of window w from the window list property. Then,
- * if `prepend' is true, prepend the window ID to the existing list.
+ * Delete all occurrences of window w from the window list property.
+ * Then, if `prepend' is true, prepend the window ID to the existing list.
*/
void
update_window_property(Window w, Boolean prepend)
{
- char *wlist;
+ long *wlist;
size_t wlist_len;
- char *wlist_end;
- char *wp;
+ long *wlist_end;
+ long *wp;
#if 0
int i;
#endif /* 0 */
@@ -347,33 +326,27 @@ update_window_property(Window w, Boolean prepend)
wlist_end = wlist + wlist_len;
#if 0
- for (i = 0, wp = wlist; wp < wlist_end; wp += 4, i++) {
- fprintf(stderr, "WIN %d: %08lx; len: %d\n", i, get_window_id(wp), wlist_len);
+ for (i = 0, wp = wlist; wp < wlist_end; ++wp, ++i) {
+ fprintf(stderr, "WIN %d: %08lx; len: %d\n", i, *wp, wlist_len);
}
#endif /* 0 */
- for (wp = wlist; wp < wlist_end; wp += 4) {
- if (get_window_id(wp) == w) { /* match, remove our ID */
- wlist_len -= 4;
- wlist_end -= 4;
- memmove(wp, wp + 4, wlist_end - wp);
- wp -= 4; /* new item is now at wp; don't skip it in next iteration */
+ for (wp = wlist; wp < wlist_end; ++wp) {
+ if (*wp == w) { /* match, remove our ID */
+ --wlist_len;
+ --wlist_end;
+ memmove(wp, wp + 1, (wlist_end - wp) * sizeof (long));
+ --wp; /* new item is now at wp; don't skip it in next iteration */
}
}
if (prepend) { /* add our ID again to front */
-#if (defined(WORD64) || defined(LONG64))
- unsigned char data[4];
- set_window_id(w, data);
-#else
- xuint32 data = w;
-#endif
/* Note: no need to realloc wlist, since the original length
was sufficient for all elements.
*/
- memmove(wlist + 4, wlist, wlist_len);
- wlist_len += 4;
- memcpy(wlist, &data, 4);
+ memmove(wlist + 1, wlist, wlist_len * sizeof (long));
+ ++wlist_len;
+ *wlist = w;
}
if (wlist_len == 0)
@@ -382,8 +355,7 @@ update_window_property(Window w, Boolean prepend)
else
XChangeProperty(DISP, DefaultRootWindow(DISP),
atom_xdvi_windows(), atom_xdvi_windows(), 32,
- PropModeReplace, (unsigned char *)wlist,
- wlist_len / 4);
+ PropModeReplace, (unsigned char *)wlist, wlist_len);
XFlush(DISP);
}
@@ -1102,30 +1074,32 @@ set_string_property(const char *str, Atom prop, Window win)
}
/*
- * Check for another running copy of xdvi. If same_file is true, return
- * the window ID of that other instance only if it has currently loaded the
- * same file; else, return 0.
+ * Check for another running copy of xdvi.
+ * If same_file is true, return the window ID of an instance that has
+ * currently loaded the same file, or 0 if none exists.
* If same_file is false, return the first valid xdvi window ID.
*/
+
Window
get_xdvi_window_id(Boolean same_file, property_cbT callback)
{
- char *window_list;
+ long *window_list;
size_t window_list_len;
- char *window_list_end;
- char *wp;
- char *p;
+ long *window_list_end;
+ long *wp;
+ long *p;
Boolean need_rewrite = False;
Window ret_window = 0;
/*
- * Get window list. Copy it over (we'll be calling property_get_data() again).
+ * Get window list.
+ * Copy it over (we'll be calling property_get_data() again).
*/
if ((window_list_len = property_get_window_list(&p)) == 0)
return 0;
- window_list = xmalloc(window_list_len);
- memcpy(window_list, p, window_list_len);
+ window_list = xmalloc(window_list_len * sizeof (long));
+ memcpy(window_list, p, window_list_len * sizeof (long));
XdviOldErrorHandler = XSetErrorHandler(XdviErrorHandler);
@@ -1134,16 +1108,13 @@ get_xdvi_window_id(Boolean same_file, property_cbT callback)
window_list_end = window_list + window_list_len;
TRACE_CLIENT((stderr, "My property: `%s'", dvi_property));
- for (wp = window_list; wp < window_list_end; wp += 4) {
- Window w;
+ for (wp = window_list; wp < window_list_end; ++wp) {
char *buf_ret;
size_t len;
- w = get_window_id(wp);
-
- TRACE_CLIENT((stderr, "Checking window %08lx", w));
+ TRACE_CLIENT((stderr, "Checking window %08lx", *wp));
- len = property_get_data(w, atom_dvi_file(), &buf_ret,
+ len = property_get_data((Window) *wp, atom_dvi_file(), &buf_ret,
XdviGetWindowProperty);
if (len == 0) {
@@ -1151,39 +1122,33 @@ get_xdvi_window_id(Boolean same_file, property_cbT callback)
that the application the window had belonged to had
been killed with signal 9
*/
- TRACE_CLIENT((stderr, "Window %08lx: doesn't exist any more, deleting", w));
- window_list_len -= 4;
- window_list_end -= 4;
- memmove(wp, wp + 4, window_list_end - wp);
- wp -= 4; /* new item is now at wp; don't skip it in next iteration */
+ TRACE_CLIENT((stderr,
+ "Window %08lx: doesn't exist any more, deleting", *wp));
+ --window_list_len;
+ --window_list_end;
+ memmove(wp, wp + 1, (window_list_end - wp) * sizeof (long));
+ --wp; /* new item is now at wp; don't skip it in next iteration */
need_rewrite = True;
continue;
}
else { /* window still alive */
if (globals.debug & DBG_CLIENT) {
-#if 0
- unsigned long ino;
- int i;
-
- ino = 0;
- for (i = 7; i >= 0; --i)
- ino = (ino << 8) | (unsigned char)(buf_ret[i]);
-#endif
- TRACE_CLIENT((stderr, "Window %08lx: property: `%s'", w, buf_ret));
+ TRACE_CLIENT((stderr,
+ "Window %08lx: property: `%s'", *wp, buf_ret));
}
/* invoke callback if given */
if (callback != NULL) {
- callback(w);
+ callback((Window) *wp);
}
if (!same_file && ret_window == 0) {
- ret_window = w;
+ ret_window = *wp;
if (callback == 0) /* can return early */
break;
}
else if (strcmp(buf_ret, dvi_property) == 0 && ret_window == 0) { /* match */
- ret_window = w;
+ ret_window = *wp;
if (callback == 0) /* can return early */
break;
}
@@ -1196,7 +1161,7 @@ get_xdvi_window_id(Boolean same_file, property_cbT callback)
XChangeProperty(DISP, DefaultRootWindow(DISP),
atom_xdvi_windows(), atom_xdvi_windows(), 32,
PropModeReplace, (unsigned char *)window_list,
- window_list_len / 4);
+ window_list_len);
return ret_window;
}
diff --git a/Build/source/texk/xdvik/x_util.h b/Build/source/texk/xdvik/x_util.h
index 3fe04c5d66c..4ce190295b4 100644
--- a/Build/source/texk/xdvik/x_util.h
+++ b/Build/source/texk/xdvik/x_util.h
@@ -50,10 +50,7 @@ extern size_t property_get_data(Window, Atom, char **,
long, Bool, Atom, Atom *, int *, unsigned long *,
unsigned long *, unsigned char **));
-extern size_t property_get_window_list(char **window_list);
extern void set_dvi_property(void);
-extern void set_window_id(Window w, unsigned char *data);
-extern Window get_window_id(char *window_p);
extern void update_window_property(Window w, Boolean prepend);
extern void update_dvi_property(void);
extern void property_initialize(void);
diff --git a/Build/source/texk/xdvik/xdvi-debug.h b/Build/source/texk/xdvik/xdvi-debug.h
index 10eacefa87b..506f785f0bc 100644
--- a/Build/source/texk/xdvik/xdvi-debug.h
+++ b/Build/source/texk/xdvik/xdvi-debug.h
@@ -2,7 +2,7 @@
#define XDVI_DEBUG_H_
/*
- * Copyright (c) 2002-2004 the xdvik development team
+ * Copyright (c) 2002-2013 the xdvik development team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@@ -96,8 +96,8 @@
#define DBG_HTEX 4096
#define DBG_SRC_SPECIALS 8192
#define DBG_CLIENT 16384
-#define DBG_T1 32768
-#define DBG_T1_VERBOSE 65536
+#define DBG_FT 32768
+#define DBG_FT_VERBOSE 65536 /* not currently used */
#define DBG_GUI 131072
#define DBG_FIND 262144
#define DBG_FILES 524288
@@ -121,8 +121,8 @@ struct debug_string_options {
#define TRACE_HTEX(X)
#define TRACE_SRC(X)
#define TRACE_CLIENT(X)
-#define TRACE_T1(X)
-#define TRACE_T1_VERBOSE(X)
+#define TRACE_FT(X)
+#define TRACE_FT_VERBOSE(X)
#define TRACE_GUI(X)
#define TRACE_EVENTS(X)
#define TRACE_FIND(X)
@@ -163,18 +163,18 @@ struct debug_string_options {
fprintf(stderr, "\n"); \
} \
} while(0)
-#define TRACE_T1(X) \
+#define TRACE_FT(X) \
do { \
- if (globals.debug & DBG_T1) { \
- fprintf(stderr, "%s:%d: T1: ", __FILE__, __LINE__); \
+ if (globals.debug & DBG_FT) { \
+ fprintf(stderr, "%s:%d: FT: ", __FILE__, __LINE__); \
fprintf X; \
fprintf(stderr, "\n"); \
} \
} while(0)
-#define TRACE_T1_VERBOSE(X) \
+#define TRACE_FT_VERBOSE(X) \
do { \
- if (globals.debug & DBG_T1_VERBOSE) { \
- fprintf(stderr, "%s:%d: T1_VERBOSE: ", __FILE__, __LINE__); \
+ if (globals.debug & DBG_FT_VERBOSE) { \
+ fprintf(stderr, "%s:%d: FT_VERBOSE: ", __FILE__, __LINE__); \
fprintf X; \
fprintf(stderr, "\n"); \
} \
diff --git a/Build/source/texk/xdvik/xdvi.1.in b/Build/source/texk/xdvik/xdvi.1.in
index f53c8c89816..7925ae4e7b9 100644
--- a/Build/source/texk/xdvik/xdvi.1.in
+++ b/Build/source/texk/xdvik/xdvi.1.in
@@ -1,4 +1,4 @@
-.\" Copyright (c) 1990-2004 Paul Vojta and others
+.\" Copyright (c) 1990-2013 Paul Vojta and others
.\"
.\" This is Paul's license, included here only for reference, it does not apply
.\" to all parts of the k version.
@@ -154,7 +154,7 @@ xdvi \- DVI Previewer for the X Window System
[\fB\-noomega\fP]
[\fB\-noscan\fP]
#ift1
-[\fB\-not1lib\fP]
+[\fB\-notype1fonts\fP]
#endif
[\fB\-notempfile\fP]
[\fB\-offsets\fP \fIdimen\fP]
@@ -212,7 +212,7 @@ hyperlinks in DVI files (section HYPERLINKS),
.TP
-
#ift1
-direct rendering of Postscript<tm> Type1 fonts (section T1LIB),
+direct rendering of PostScript<tm> Type 1 fonts (section TYPE 1 FONTS),
.TP
-
#endif
@@ -413,13 +413,13 @@ The individual numbers and strings have the following meanings:
512 paths Kpathsea path definitions
1024 expand Kpathsea path expansion
2048 search Kpathsea searching
- 4032 kpathsea All Kpathsea options
+ 4032 kpathsea All Kpathsea options
4096 htex Hypertex specials
- 8192 src Source specials
+ 8192 src Source specials
16384 client Client/server mode (see -unique
and -sourceposition options)
- 32768 t1 Type1 font library messages
- 65536 t1_verbose Verbose Type1 library messages
+ 32768 ft FreeType library messages (Type 1 fonts)
+ 65536 ft_verbose Verbose FreeType library messages (currently unused)
131072 gui GUI elements
.sp 1n
.fi
@@ -460,7 +460,7 @@ as the
program to use when printing. The default for this is
.BR dvips .
The program or script should read the DVI file from standard input,
-and write the Postscript file to standard output.
+and write the PostScript file to standard output.
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
.BI \-editor " editor"
@@ -1231,20 +1231,21 @@ to
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
#ift1
.TP
-.BI \-not1lib
-.RB ( .t1lib )
-This will disable the use of T1Lib to display PostScript<tm> fonts.
+.BI \-notype1fonts
+.RB ( .type1 )
+This will disable the use of the FreeType library to display PostScript<tm>
+Type 1 fonts.
Use this option as a workaround when you encounter problems with the
-display of T1Lib (but please don't forget to send a bug report in
+display of Type 1 fonts (but please don't forget to send a bug report in
this case, to the URL mentioned in the section AUTHORS below).
.br
(Note:
-.B \-not1lib
+.B \-notype1fonts
corresponds to
-.BR t1lib:off ;
-.B +not1lib
+.BR type1:off ;
+.B +notype1fonts
to
-.BR t1lib:on .)
+.BR type1:on .)
#endif
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
@@ -1433,8 +1434,8 @@ keystroke and the corresponding numerical prefix arguments 0, 1 and 2.
.RB ( .ps2pdfPath )
Use
.I path
-as a conversion program from Postscript to PDF. The program or script
-should accept two command-line arguments: The Postscript file as first
+as a conversion program from PostScript to PDF. The program or script
+should accept two command-line arguments: The PostScript file as first
argument, and the PDF output file as second argument.
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.TP
@@ -2309,7 +2310,7 @@ values; except for `px', they all correspond to \*(Te\&'s units:
.I sp
(scaled points, the unit used internally by \*(Te\&)
.I bp
-(big points or `Postscript points'),
+(big points or `PostScript points'),
.I cc
(cicero points),
.I dd
@@ -3228,17 +3229,17 @@ DVI file. You can save in one of the following formats:
.RS 2
.TP 2
-
-Postscript (uses
+PostScript (uses
.B dvips
-to convert the DVI file to a Postscript file, just like when printing
-to a Postscript file).
+to convert the DVI file to a PostScript file, just like when printing
+to a PostScript file).
.TP
-
PDF (first uses
.B dvips
-to convert the DVI file to a Postscript file, then uses
+to convert the DVI file to a PostScript file, then uses
.B ps2pdf
-to convert the Postscript file to PDF).
+to convert the PostScript file to PDF).
.TP
-
Plain text in ISO-8859-1 or UTF-8 encoding. The latter will preserve more
@@ -3250,7 +3251,7 @@ charset, it is replaced by `\e' followed by the hexadecimal character code.
If a character is not recognized at all, it is replaced by `?'.
.RE
.PP
-The programs for Postscript and PDF conversion can be customized via
+The programs for PostScript and PDF conversion can be customized via
the command line options or X resources
.BR -dvipspath / .dvipsPath
and
@@ -3621,7 +3622,7 @@ command-line option.
.B NOTE:
You should never use this option when viewing documents that you
didn't compile yourself. The backtick specials are not needed for
-uncompressing gzipped Postscript files, since
+uncompressing gzipped PostScript files, since
.B xdvi
can do that on the fly if the filename ends with
.I .eps.gz
@@ -3635,38 +3636,48 @@ filenames too.
#ift1
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
-.SH T1LIB
-Using T1Lib, a library written by Rainer Menzner
-(see ftp://sunsite.unc.edu/pub/Linux/libs/graphics/),
+.SH TYPE 1 FONTS
+Using FreeType (version 2),
.B xdvi
-can render Postscript<tm> Type1 fonts directly, without the
+can render PostScript<tm> Type 1 fonts directly, without the
route via \*(Te\& pixel (pk)
fonts. The advantage of this is that only one size of each font needs
to be stored on disk.
Unless the
-.B -not1lib
+.B -notype1fonts
option is used,
.B xdvi
-will try to render every font using T1Lib. Only as a fallback it will
+will try to render every font using FreeType. Only as a fallback will it
invoke an external program (like
.BR mktexpk ,
which in turn may invoke utilities like
.B ps2pk
or
.BR gsftopk )
-to generate a pixel font from the Type1 source. The direct rendering
+to generate a pixel font from the Type 1 source. The direct rendering
of the
.B Computer Modern
-fonts should work out-of-the box, whereas other Type1 fonts such as
-the 35 `standard' Postscript<tm> fonts resident in printers may need
-to be made accessible for use with xdvi, unless your system
+fonts should work out-of-the box, whereas other Type 1 fonts such as
+the 35 `standard' PostScript<tm> fonts resident in printers may need
+to be made accessible for use with
+.BR xdvi ,
+unless your system
administrator or TeX distribution has already done so (which is the case
-e.g. for current teTeX systems). The
+e.g. for current TeX Live systems). For the 35 PostScript<tm> resident
+fonts,
+.B xdvik
+will search using the
+.B Fontmap
+provided with
+.BR Ghostscript ,
+if necessary. Also, the
.B xdvik
distribution comes with a utility called
.B t1mapper
to make these fonts available for xdvi;
-see the manual page for t1mapper(1) for usage details.
+see the manual page for t1mapper(1) for usage details. This program is
+likely to be dropped in the future, however, since it is probably not
+needed anymore.
#endif
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
@@ -4112,6 +4123,50 @@ for more details on the
.B BROWSER
environment variable.
.RE
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+#ift1
+.TP
+.SB GS_LIB
+A colon-separated list of directories to search for
+.B Fontmap
+files, etc., as used for Ghostscript. It has the same meaning as it does
+when running Ghostscript. In
+.BR xdvik ,
+it is used when searching for font files when the map file does not give a
+file name for the font (this should be quite rare). The command
+.B gs \-h
+will list the default value that Ghostscript uses. See also the
+.SB XDVI_GS_LIB
+environment variable (below).
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+.TP
+.SB XDVI_GS_LIB
+This has the same effect as
+.SB GS_LIB
+but affects only
+.BR xdvi .
+Use this when you want to use a different value for
+.SB GS_LIB
+when running
+.BR xdvi ,
+but use either the compiled-in default value or some other value when running
+Ghostscript. If both
+.SB GS_LIB
+and
+.SB XDVI_GS_LIB
+are set, then
+.B xdvi
+uses
+.SB XDVI_GS_LIB.
+To use the default value compiled in to
+.B xdvi
+while still retaining the ability to set
+.SB GS_LIB
+for use with Ghostscript, you can set
+.SB XDVI_GS_LIB
+to the empty string.
+#endif
+.\"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
#ifps
.TP
.SB TMPDIR
@@ -4208,14 +4263,23 @@ This file is ignored if the
option is used or the
.B noInitFile
X resource is set.
+#ift1
.TP
-.SB xdvi.cfg
-A configuration file for the T1 font setup which needs to be supplied
-in the directory determined by the
-.B XDVIINPUTS
-environment variable. Please see the file
-.B http://xdvi.sourceforge.net/README.t1fonts
-if that file is missing.
+.SB config.xdvi
+An optional configuration file for the Type 1 font setup, which specifies
+.BR dvips \-style
+map files specific to
+.BR xdvik .
+If used, it should be present in the directory determined by the
+.B TEXCONFIG
+environment variable. Its format is similar to configuration files for
+.BR dvips ,
+except that it is only scanned for the names of map files
+.RB ( p
+and
+.B p+
+directives).
+#endif
.SH SEE ALSO
.BR X (1),
.BR dvips (1),
diff --git a/Build/source/texk/xdvik/xdvi.c b/Build/source/texk/xdvik/xdvi.c
index 439c722f5d5..b5153c64695 100644
--- a/Build/source/texk/xdvik/xdvi.c
+++ b/Build/source/texk/xdvik/xdvi.c
@@ -1,6 +1,6 @@
/*========================================================================*\
-Copyright (c) 1990-2004 Paul Vojta and others
+Copyright (c) 1990-2013 Paul Vojta and others
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -98,10 +98,6 @@ NOTE: xdvi is based on prior work as noted in the modification history, below.
#endif /* NEW_MENU_CREATION */
#include "xm_toolbar.h"
-#ifdef T1LIB
-#include "t1lib.h"
-#endif /* T1LIB */
-
#ifdef MOTIF
# include <Xm/Xm.h>
@@ -158,7 +154,6 @@ XmStringCharSet G_charset = XmFONTLIST_DEFAULT_TAG;
#include "kpathsea/c-errno.h"
#include "translations.h"
-#include "dvi-init.h"
#include "c-openmx.h"
#include "xicon.h"
#include "x_util.h"
@@ -178,6 +173,10 @@ XmStringCharSet G_charset = XmFONTLIST_DEFAULT_TAG;
#include "exit-handlers.h"
#include "xm_prefsP.h" /* for Xdvi_PREFS_BROWSER_DEFAULTS and Xdvi_PREFS_EDITOR_DEFAULTS */
+#if FREETYPE
+# include "font-open.h" /* for init_t1_lookup() */
+#endif
+
#ifdef VMS
# include "pixmaps/hand.xbm"
# include "pixmaps/hand_mask.xbm"
@@ -429,9 +428,9 @@ static XtResource application_resources[] = {
offset(mfmode), XtRString, MFMODE},
{"editor", "Editor", XtRString, sizeof(char *),
offset(editor), XtRString, (XtPointer) NULL},
-#ifdef T1LIB
- {"t1lib", "T1lib", XtRBoolean, sizeof(Boolean),
- offset(t1lib), XtRString, "true"},
+#if FREETYPE
+ {"type1", "Type1", XtRBoolean, sizeof(Boolean),
+ offset(freetype), XtRString, "true"},
#endif
{"sourcePosition", "SourcePosition", XtRString, sizeof(char *),
offset(src_pos), XtRString, (XtPointer) NULL},
@@ -3032,10 +3031,6 @@ run_dvi_file(const char *filename, void *data)
resource.paper);
}
-#ifdef T1LIB
- /* needed so that T1lib can produce tfm's e.g. for cm-super */
- kpse_set_program_enabled(kpse_tfm_format, True, kpse_src_compile);
-#endif
kpse_set_program_enabled(kpse_any_glyph_format, resource.makepk, kpse_src_compile);
/* janl 16/11/98: I have changed this. The above line used to
say the settings in resource.makepk was supplied on the
@@ -3131,19 +3126,36 @@ run_dvi_file(const char *filename, void *data)
* Step 3: Initialize the dvi file and set titles.
*/
-#ifdef T1LIB
+#if FREETYPE
/*
At this point DISP, G_visual, G_depth and G_colormap must
- be defined. Also, init_t1() must go before internal_open_dvi(), since
- read_postamble will define some fonts and insert them into
+ be defined. Also, init_t1_lookup() must go before internal_open_dvi(),
+ since read_postamble will define some fonts and insert them into
fontmaps_hash, but we need a clean fontmaps_hash for detecting
duplicate entries in the map file.
*/
- if (resource.t1lib) {
- init_t1();
+ if (resource.freetype) {
+ if (!init_t1_lookup()) {
+ /* nag 'em with a popup so that they'll do something about this */
+ popup_message(globals.widgets.top_level,
+ MSG_ERR,
+ "Direct Type 1 font rendering via FreeType gives you "
+ "many benefits, such as:\n"
+ " - quicker startup time, since no bitmap fonts need "
+ "to be generated;\n"
+ " - saving disk space for storing the bitmap fonts.\n"
+ "To fix this error, check that the file `ps2pk.map' "
+ "is located somewhere in your XDVIINPUTS path. "
+ "Have a look at the xdvi wrapper shell script "
+ "(type \"which xdvi\" to locate that shell script) "
+ "for the current setting of XDVIINPUTS.",
+ "Could not load any of the map files listed in xdvi.cfg "
+ "- disabling FreeType.");
+ resource.freetype = False;
+ }
}
-#endif /* T1LIB */
+#endif /* FREETYPE */
#if DELAYED_MKTEXPK
/* Open and initialize the DVI file. First, disable creation of PK fonts
@@ -3300,14 +3312,8 @@ run_dvi_file(const char *filename, void *data)
/* Store window id for use by src_client_check(). */
{
- /* was xuint32, but need 8-byte alignment on some 64-bit systems. */
- long data;
-#if !(defined(WORD64) || defined(LONG64))
- data = XtWindow(globals.widgets.top_level);
-#else
- set_window_id(XtWindow(globals.widgets.top_level),
- (unsigned char *)&data);
-#endif
+ long data = XtWindow(globals.widgets.top_level);
+
XChangeProperty(DISP, DefaultRootWindow(DISP),
atom_xdvi_windows(), atom_xdvi_windows(), 32,
PropModePrepend, (unsigned char *)&data, 1);
diff --git a/Build/source/texk/xdvik/xdvi.h b/Build/source/texk/xdvik/xdvi.h
index 3fb634ec572..2851f7e7d87 100644
--- a/Build/source/texk/xdvik/xdvi.h
+++ b/Build/source/texk/xdvik/xdvi.h
@@ -1,6 +1,6 @@
/*========================================================================*\
-Copyright (c) 1990-2004 Paul Vojta
+Copyright (c) 1990-2013 Paul Vojta
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
@@ -188,14 +188,6 @@ extern unsigned long time_start, time_end;
#include <X11/Xmd.h> /* get WORD64 and LONG64 */
-#ifndef WORD64
-# ifdef LONG64
-typedef unsigned int xuint32;
-# else
-typedef unsigned long xuint32;
-# endif
-#endif
-
#if defined(HAVE_STDINT_H)
#include <stdint.h>
#elif defined(HAVE_INTTYPES_H)
@@ -495,7 +487,7 @@ extern struct x_resources {
#ifdef MOTIF
char *prefs_editor_list;
#endif
- Boolean t1lib;
+ Boolean freetype;
const char *src_pos;
const char *find_string;
const char *text_encoding;
@@ -504,8 +496,10 @@ extern struct x_resources {
const char *file_history;
int file_history_size;
Boolean no_file_arg_use_history;
+#if RGB_ANTI_ALIASING
subpixelOrderT subpixel_order;
float subpixel_energy[3];
+#endif
Boolean unique;
Boolean list_fonts;
Boolean reverse;