texlive[50122] Build/source/libs: xpdf-4.01

commits+kakuto at tug.org commits+kakuto at tug.org
Mon Feb 25 04:01:13 CET 2019


Revision: 50122
          http://tug.org/svn/texlive?view=revision&revision=50122
Author:   kakuto
Date:     2019-02-25 04:01:12 +0100 (Mon, 25 Feb 2019)
Log Message:
-----------
xpdf-4.01

Modified Paths:
--------------
    trunk/Build/source/libs/README
    trunk/Build/source/libs/xpdf/ChangeLog
    trunk/Build/source/libs/xpdf/Makefile.am
    trunk/Build/source/libs/xpdf/Makefile.in
    trunk/Build/source/libs/xpdf/TLpatches/ChangeLog
    trunk/Build/source/libs/xpdf/TLpatches/TL-Changes
    trunk/Build/source/libs/xpdf/TLpatches/patch-bunched
    trunk/Build/source/libs/xpdf/configure
    trunk/Build/source/libs/xpdf/version.ac
    trunk/Build/source/libs/xpdf/xpdf-src/ANNOUNCE
    trunk/Build/source/libs/xpdf/xpdf-src/CHANGES
    trunk/Build/source/libs/xpdf/xpdf-src/INSTALL
    trunk/Build/source/libs/xpdf/xpdf-src/README
    trunk/Build/source/libs/xpdf/xpdf-src/cmake-config.txt
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/sample-xpdfrc
    trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1
    trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat
    trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5
    trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat
    trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc
    trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h
    trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc
    trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc
    trunk/Build/source/libs/xpdf/xpdf-src/goo/GMutex.h
    trunk/Build/source/libs/xpdf/xpdf-src/goo/GString.cc
    trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
    trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.h
    trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.cc
    trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.h
    trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.h
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.h
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFTFont.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFontEngine.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashMath.h
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPath.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.h
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashScreen.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h
    trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashTypes.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFontTables.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/NameToUnicodeTable.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UTF8.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc

Added Paths:
-----------
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc
    trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h

Modified: trunk/Build/source/libs/README
===================================================================
--- trunk/Build/source/libs/README	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/README	2019-02-25 03:01:12 UTC (rev 50122)
@@ -59,7 +59,7 @@
 teckit 2.5.8 - checked 24jul18
   https://github.com/silnrsi/teckit/archive/2.5.8.tar.gz
 
-xpdf 4.00 - checked 13aug17
+xpdf 4.01 - checked 25feb19
   http://www.xpdfreader.com/download.html
   with modifications for pdftex
 

Modified: trunk/Build/source/libs/xpdf/ChangeLog
===================================================================
--- trunk/Build/source/libs/xpdf/ChangeLog	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/ChangeLog	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,3 +1,8 @@
+2019-02-25  Akira Kakuto  <kakuto at w32tex.org>
+
+	* Import xpdf-4.01.
+	* Makefile.am, version.ac: Adjust.
+
 2018-10-02  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* aconf-w32.h: Added for w32.

Modified: trunk/Build/source/libs/xpdf/Makefile.am
===================================================================
--- trunk/Build/source/libs/xpdf/Makefile.am	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/Makefile.am	2019-02-25 03:01:12 UTC (rev 50122)
@@ -103,6 +103,7 @@
 	@XPDF_TREE@/xpdf/OptionalContent.cc \
 	@XPDF_TREE@/xpdf/Outline.cc \
 	@XPDF_TREE@/xpdf/OutputDev.cc \
+	@XPDF_TREE@/xpdf/PDF417Barcode.cc \
 	@XPDF_TREE@/xpdf/PDFDoc.cc \
 	@XPDF_TREE@/xpdf/PDFDocEncoding.cc \
 	@XPDF_TREE@/xpdf/PSTokenizer.cc \
@@ -112,6 +113,7 @@
 	@XPDF_TREE@/xpdf/Stream.cc \
 	@XPDF_TREE@/xpdf/TextString.cc \
 	@XPDF_TREE@/xpdf/UnicodeMap.cc \
+	@XPDF_TREE@/xpdf/UnicodeRemapping.cc \
 	@XPDF_TREE@/xpdf/UTF8.cc \
 	@XPDF_TREE@/xpdf/XFAForm.cc \
 	@XPDF_TREE@/xpdf/XRef.cc \

Modified: trunk/Build/source/libs/xpdf/Makefile.in
===================================================================
--- trunk/Build/source/libs/xpdf/Makefile.in	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/Makefile.in	2019-02-25 03:01:12 UTC (rev 50122)
@@ -151,6 +151,7 @@
 	@XPDF_TREE@/xpdf/OptionalContent.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/Outline.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/OutputDev.$(OBJEXT) \
+	@XPDF_TREE@/xpdf/PDF417Barcode.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/PDFDoc.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/PDFDocEncoding.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/PSTokenizer.$(OBJEXT) \
@@ -160,6 +161,7 @@
 	@XPDF_TREE@/xpdf/Stream.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/TextString.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/UnicodeMap.$(OBJEXT) \
+	@XPDF_TREE@/xpdf/UnicodeRemapping.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/UTF8.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/XFAForm.$(OBJEXT) \
 	@XPDF_TREE@/xpdf/XRef.$(OBJEXT) \
@@ -223,6 +225,7 @@
 	@XPDF_TREE@/xpdf/$(DEPDIR)/OptionalContent.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/Outline.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/OutputDev.Po \
+	@XPDF_TREE@/xpdf/$(DEPDIR)/PDF417Barcode.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/PDFDoc.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/PDFDocEncoding.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/PSTokenizer.Po \
@@ -233,6 +236,7 @@
 	@XPDF_TREE@/xpdf/$(DEPDIR)/TextString.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/UTF8.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeMap.Po \
+	@XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeRemapping.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/XFAForm.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/XRef.Po \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/Zoox.Po
@@ -518,6 +522,7 @@
 	@XPDF_TREE@/xpdf/OptionalContent.cc \
 	@XPDF_TREE@/xpdf/Outline.cc \
 	@XPDF_TREE@/xpdf/OutputDev.cc \
+	@XPDF_TREE@/xpdf/PDF417Barcode.cc \
 	@XPDF_TREE@/xpdf/PDFDoc.cc \
 	@XPDF_TREE@/xpdf/PDFDocEncoding.cc \
 	@XPDF_TREE@/xpdf/PSTokenizer.cc \
@@ -527,6 +532,7 @@
 	@XPDF_TREE@/xpdf/Stream.cc \
 	@XPDF_TREE@/xpdf/TextString.cc \
 	@XPDF_TREE@/xpdf/UnicodeMap.cc \
+	@XPDF_TREE@/xpdf/UnicodeRemapping.cc \
 	@XPDF_TREE@/xpdf/UTF8.cc \
 	@XPDF_TREE@/xpdf/XFAForm.cc \
 	@XPDF_TREE@/xpdf/XRef.cc \
@@ -710,6 +716,9 @@
 @XPDF_TREE@/xpdf/OutputDev.$(OBJEXT):  \
 	@XPDF_TREE@/xpdf/$(am__dirstamp) \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/$(am__dirstamp)
+ at XPDF_TREE@/xpdf/PDF417Barcode.$(OBJEXT):  \
+	@XPDF_TREE@/xpdf/$(am__dirstamp) \
+	@XPDF_TREE@/xpdf/$(DEPDIR)/$(am__dirstamp)
 @XPDF_TREE@/xpdf/PDFDoc.$(OBJEXT): @XPDF_TREE@/xpdf/$(am__dirstamp) \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/$(am__dirstamp)
 @XPDF_TREE@/xpdf/PDFDocEncoding.$(OBJEXT):  \
@@ -733,6 +742,9 @@
 @XPDF_TREE@/xpdf/UnicodeMap.$(OBJEXT):  \
 	@XPDF_TREE@/xpdf/$(am__dirstamp) \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/$(am__dirstamp)
+ at XPDF_TREE@/xpdf/UnicodeRemapping.$(OBJEXT):  \
+	@XPDF_TREE@/xpdf/$(am__dirstamp) \
+	@XPDF_TREE@/xpdf/$(DEPDIR)/$(am__dirstamp)
 @XPDF_TREE@/xpdf/UTF8.$(OBJEXT): @XPDF_TREE@/xpdf/$(am__dirstamp) \
 	@XPDF_TREE@/xpdf/$(DEPDIR)/$(am__dirstamp)
 @XPDF_TREE@/xpdf/XFAForm.$(OBJEXT): @XPDF_TREE@/xpdf/$(am__dirstamp) \
@@ -797,6 +809,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/OptionalContent.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/Outline.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/OutputDev.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/PDF417Barcode.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/PDFDoc.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/PDFDocEncoding.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/PSTokenizer.Po at am__quote@ # am--include-marker
@@ -807,6 +820,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/TextString.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/UTF8.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeMap.Po at am__quote@ # am--include-marker
+ at AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeRemapping.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/XFAForm.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/XRef.Po at am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@@XPDF_TREE@/xpdf/$(DEPDIR)/Zoox.Po at am__quote@ # am--include-marker
@@ -1222,6 +1236,7 @@
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/OptionalContent.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/Outline.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/OutputDev.Po
+	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PDF417Barcode.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PDFDoc.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PDFDocEncoding.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PSTokenizer.Po
@@ -1232,6 +1247,7 @@
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/TextString.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/UTF8.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeMap.Po
+	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeRemapping.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/XFAForm.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/XRef.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/Zoox.Po
@@ -1323,6 +1339,7 @@
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/OptionalContent.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/Outline.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/OutputDev.Po
+	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PDF417Barcode.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PDFDoc.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PDFDocEncoding.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/PSTokenizer.Po
@@ -1333,6 +1350,7 @@
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/TextString.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/UTF8.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeMap.Po
+	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/UnicodeRemapping.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/XFAForm.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/XRef.Po
 	-rm -f @XPDF_TREE@/xpdf/$(DEPDIR)/Zoox.Po

Modified: trunk/Build/source/libs/xpdf/TLpatches/ChangeLog
===================================================================
--- trunk/Build/source/libs/xpdf/TLpatches/ChangeLog	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/TLpatches/ChangeLog	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,3 +1,7 @@
+2019-02-25  Akira Kakuto  <kakuto at w32tex.org>
+
+	* patch-bunched: Adjust.
+
 2018-10-02  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* patch-bunched: Changed for w32.

Modified: trunk/Build/source/libs/xpdf/TLpatches/TL-Changes
===================================================================
--- trunk/Build/source/libs/xpdf/TLpatches/TL-Changes	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/TLpatches/TL-Changes	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,4 +1,4 @@
-Changes applied to the xpdf-4.00/ tree as obtained from:
+Changes applied to the xpdf-4.01/ tree as obtained from:
 	http://www.xpdfreader.com/download.html
 
 Removed:

Modified: trunk/Build/source/libs/xpdf/TLpatches/patch-bunched
===================================================================
--- trunk/Build/source/libs/xpdf/TLpatches/patch-bunched	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/TLpatches/patch-bunched	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,6 +1,6 @@
-diff -ur xpdf-4.00/goo/gfile.cc xpdf-src/goo/gfile.cc
---- xpdf-4.00/goo/gfile.cc	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/goo/gfile.cc	Wed Oct 03 00:39:16 2018
+diff -ur xpdf-4.01/goo/gfile.cc xpdf-src/goo/gfile.cc
+--- xpdf-4.01/goo/gfile.cc	Tue Feb 19 03:24:19 2019
++++ xpdf-src/goo/gfile.cc	Mon Feb 25 11:09:32 2019
 @@ -7,6 +7,9 @@
  // Copyright 1996-2003 Glyph & Cog, LLC
  //
@@ -11,7 +11,7 @@
  
  #include <aconf.h>
  
-@@ -51,7 +54,11 @@
+@@ -52,7 +55,11 @@
    char *s;
    GString *ret;
  
@@ -23,7 +23,7 @@
      ret = new GString(s);
    else
      ret = new GString(".");
-@@ -400,6 +407,7 @@
+@@ -401,6 +408,7 @@
  #endif
  }
  
@@ -31,11 +31,11 @@
  GBool openTempFile(GString **name, FILE **f,
  		   const char *mode, const char *ext) {
  #if defined(_WIN32)
-@@ -514,10 +522,11 @@
+@@ -515,10 +523,11 @@
    return gTrue;
  #endif
  }
-+#endif
++#endif /* !PDF_PARSER_ONLY */
  
  GBool createDir(char *path, int mode) {
  #ifdef _WIN32
@@ -44,26 +44,51 @@
  #else
    return !mkdir(path, mode);
  #endif
-@@ -571,6 +580,8 @@
+@@ -572,6 +581,8 @@
  
  FILE *openFile(const char *path, const char *mode) {
- #ifdef _WIN32
+ #if defined(_WIN32)
 +  return fopen(path, mode);
 +#if 0
    OSVERSIONINFO version;
    wchar_t wPath[_MAX_PATH + 1];
    char nPath[_MAX_PATH + 1];
-@@ -627,6 +638,7 @@
+@@ -628,6 +639,7 @@
      nPath[i] = '\0';
      return fopen(nPath, mode);
    }
 +#endif /* 0 */
+ #elif defined(VMS)
+   return fopen(path, mode, "ctx=stm");
  #else
-   return fopen(path, mode);
+@@ -688,6 +700,7 @@
  #endif
-diff -ur xpdf-4.00/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc
---- xpdf-4.00/xpdf/GlobalParams.cc	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/xpdf/GlobalParams.cc	Sun Aug 13 13:51:38 2017
+ }
+ 
++#ifndef PDF_PARSER_ONLY
+ void fixCommandLine(int *argc, char **argv[]) {
+ #ifdef _WIN32
+   int argcw;
+@@ -713,3 +726,4 @@
+   LocalFree(argvw);
+ #endif
+ }
++#endif /* !PDF_PARSER_ONLY */
+diff -ur xpdf-4.01/goo/gfile.h xpdf-src/goo/gfile.h
+--- xpdf-4.01/goo/gfile.h	Tue Feb 19 03:24:19 2019
++++ xpdf-src/goo/gfile.h	Mon Feb 25 11:07:26 2019
+@@ -114,6 +114,8 @@
+ 
+ // On Windows, this gets the Unicode command line and converts it to
+ // UTF-8.  On other systems, this is a nop.
++#ifndef PDF_PARSER_ONLY
+ extern void fixCommandLine(int *argc, char **argv[]);
++#endif /* !PDF_PARSER_ONLY */
+ 
+ #endif
+diff -ur xpdf-4.01/xpdf/GlobalParams.cc xpdf-src/xpdf/GlobalParams.cc
+--- xpdf-4.01/xpdf/GlobalParams.cc	Tue Feb 19 03:24:19 2019
++++ xpdf-src/xpdf/GlobalParams.cc	Mon Feb 25 08:01:11 2019
 @@ -5,6 +5,9 @@
  // Copyright 2001-2003 Glyph & Cog, LLC
  //
@@ -74,7 +99,7 @@
  
  #include <aconf.h>
  
-@@ -38,8 +41,12 @@
+@@ -39,8 +42,12 @@
  #include "GlobalParams.h"
  
  #ifdef _WIN32
@@ -89,7 +114,7 @@
  #endif
  
  #if MULTITHREADED
-@@ -677,6 +684,7 @@
+@@ -684,6 +691,7 @@
    f = NULL;
    fileName = NULL;
    if (cfgFileName && cfgFileName[0]) {
@@ -97,7 +122,7 @@
      fileName = new GString(cfgFileName);
      if (!(f = fopen(fileName->getCString(), "r"))) {
        delete fileName;
-@@ -709,6 +717,7 @@
+@@ -716,6 +724,7 @@
      parseFile(fileName, f);
      delete fileName;
      fclose(f);
@@ -105,7 +130,7 @@
    }
  }
  
-@@ -2105,8 +2114,11 @@
+@@ -2092,8 +2101,11 @@
  				   base14->fontNum,
  				   displayFontTab[i].obliqueFactor));
        } else {
@@ -117,9 +142,9 @@
        }
      }
    }
-diff -ur xpdf-4.00/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h
---- xpdf-4.00/xpdf/GlobalParams.h	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/xpdf/GlobalParams.h	Sun Aug 13 16:14:54 2017
+diff -ur xpdf-4.01/xpdf/GlobalParams.h xpdf-src/xpdf/GlobalParams.h
+--- xpdf-4.01/xpdf/GlobalParams.h	Tue Feb 19 03:24:19 2019
++++ xpdf-src/xpdf/GlobalParams.h	Mon Feb 25 08:02:36 2019
 @@ -5,6 +5,9 @@
  // Copyright 2001-2003 Glyph & Cog, LLC
  //
@@ -130,7 +155,7 @@
  
  #ifndef GLOBALPARAMS_H
  #define GLOBALPARAMS_H
-@@ -217,7 +220,7 @@
+@@ -218,7 +221,7 @@
  
    // Initialize the global parameters by attempting to read a config
    // file.
@@ -139,28 +164,49 @@
  
    ~GlobalParams();
  
-diff -ur xpdf-4.00/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc
---- xpdf-4.00/xpdf/PDFDoc.cc	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/xpdf/PDFDoc.cc	Wed Oct 03 00:39:16 2018
-@@ -147,13 +147,17 @@
+diff -ur xpdf-4.01/xpdf/PDFDoc.cc xpdf-src/xpdf/PDFDoc.cc
+--- xpdf-4.01/xpdf/PDFDoc.cc	Tue Feb 19 03:24:19 2019
++++ xpdf-src/xpdf/PDFDoc.cc	Mon Feb 25 08:16:35 2019
+@@ -147,20 +147,25 @@
  
-   // try to open file
-   // NB: _wfopen is only available in NT
+ PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword,
+ 	       GString *userPassword, PDFCore *coreA) {
 +/*
-   version.dwOSVersionInfoSize = sizeof(version);
-   GetVersionEx(&version);
+ #ifdef _WIN32
+   OSVERSIONINFO version;
+ #endif
++*/
+   Object obj;
++/*
+ #ifdef _WIN32
+   Unicode u;
+   int n, i, j;
+ #endif
++*/
+ 
+   init(coreA);
+ 
+   fileName = new GString(fileNameA);
+ 
+ #if defined(_WIN32)
++#if 0
+   n = 0;
+   i = 0;
+   while (getUTF8(fileName, &i, &u)) {
+@@ -178,8 +183,12 @@
    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
      file = _wfopen(fileNameU, L"rb");
    } else {
-+*/
++#endif /* 0 */
      file = fopen(fileName->getCString(), "rb");
-+/*
++#if 0
    }
-+*/
-   if (!file) {
-     error(errIO, -1, "Couldn't open file '{0:t}'", fileName);
-     errCode = errOpenFile;
-@@ -535,6 +539,7 @@
++#endif /* 0 */
++
+ #elif defined(VMS)
+   file = fopen(fileName->getCString(), "rb", "ctx=stm");
+ #else
+@@ -571,6 +580,7 @@
    GBool ret;
  
    // NB: _wfopen is only available in NT
@@ -168,7 +214,7 @@
    version.dwOSVersionInfoSize = sizeof(version);
    GetVersionEx(&version);
    if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
-@@ -544,12 +549,15 @@
+@@ -580,12 +590,15 @@
      path2w[i] = 0;
      f = _wfopen(path2w, L"wb");
    } else {
@@ -184,9 +230,9 @@
    if (!f) {
      return gFalse;
    }
-diff -ur xpdf-4.00/xpdf/Page.cc xpdf-src/xpdf/Page.cc
---- xpdf-4.00/xpdf/Page.cc	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/xpdf/Page.cc	Sun Aug 13 13:24:08 2017
+diff -ur xpdf-4.01/xpdf/Page.cc xpdf-src/xpdf/Page.cc
+--- xpdf-4.01/xpdf/Page.cc	Tue Feb 19 03:24:19 2019
++++ xpdf-src/xpdf/Page.cc	Mon Feb 25 08:19:00 2019
 @@ -480,9 +480,9 @@
    delete links;
  }
@@ -205,10 +251,10 @@
 -}
  #endif
 +}
-diff -ur xpdf-4.00/xpdf/XFAForm.cc xpdf-src/xpdf/XFAForm.cc
---- xpdf-4.00/xpdf/XFAForm.cc	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/xpdf/XFAForm.cc	Sun Aug 13 14:28:34 2017
-@@ -27,8 +27,10 @@
+diff -ur xpdf-4.01/xpdf/XFAForm.cc xpdf-src/xpdf/XFAForm.cc
+--- xpdf-4.01/xpdf/XFAForm.cc	Tue Feb 19 03:24:19 2019
++++ xpdf-src/xpdf/XFAForm.cc	Mon Feb 25 08:20:00 2019
+@@ -28,8 +28,10 @@
  #include "XFAForm.h"
  
  #ifdef _WIN32
@@ -221,9 +267,9 @@
  #endif
  
  //------------------------------------------------------------------------
-diff -ur xpdf-4.00/xpdf/config.h xpdf-src/xpdf/config.h
---- xpdf-4.00/xpdf/config.h	Wed Aug 09 08:22:50 2017
-+++ xpdf-src/xpdf/config.h	Sun Aug 13 16:14:54 2017
+diff -ur xpdf-4.01/xpdf/config.h xpdf-src/xpdf/config.h
+--- xpdf-4.01/xpdf/config.h	Tue Feb 19 03:24:19 2019
++++ xpdf-src/xpdf/config.h	Mon Feb 25 08:21:02 2019
 @@ -78,11 +78,6 @@
  // popen
  //------------------------------------------------------------------------

Modified: trunk/Build/source/libs/xpdf/configure
===================================================================
--- trunk/Build/source/libs/xpdf/configure	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/configure	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for xpdf (TeX Live) 4.00.
+# Generated by GNU Autoconf 2.69 for xpdf (TeX Live) 4.01.
 #
 # Report bugs to <tex-k at tug.org>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='xpdf (TeX Live)'
 PACKAGE_TARNAME='xpdf--tex-live-'
-PACKAGE_VERSION='4.00'
-PACKAGE_STRING='xpdf (TeX Live) 4.00'
+PACKAGE_VERSION='4.01'
+PACKAGE_STRING='xpdf (TeX Live) 4.01'
 PACKAGE_BUGREPORT='tex-k at tug.org'
 PACKAGE_URL=''
 
@@ -1290,7 +1290,7 @@
   # 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 xpdf (TeX Live) 4.00 to adapt to many kinds of systems.
+\`configure' configures xpdf (TeX Live) 4.01 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1356,7 +1356,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of xpdf (TeX Live) 4.00:";;
+     short | recursive ) echo "Configuration of xpdf (TeX Live) 4.01:";;
    esac
   cat <<\_ACEOF
 
@@ -1460,7 +1460,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-xpdf (TeX Live) configure 4.00
+xpdf (TeX Live) configure 4.01
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1867,7 +1867,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by xpdf (TeX Live) $as_me 4.00, which was
+It was created by xpdf (TeX Live) $as_me 4.01, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -3791,7 +3791,7 @@
 
 # Define the identity of the package.
  PACKAGE='xpdf--tex-live-'
- VERSION='4.00'
+ VERSION='4.01'
 
 
 # Some tools Automake needs.
@@ -6704,7 +6704,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by xpdf (TeX Live) $as_me 4.00, which was
+This file was extended by xpdf (TeX Live) $as_me 4.01, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -6774,7 +6774,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-xpdf (TeX Live) config.status 4.00
+xpdf (TeX Live) config.status 4.01
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/libs/xpdf/version.ac
===================================================================
--- trunk/Build/source/libs/xpdf/version.ac	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/version.ac	2019-02-25 03:01:12 UTC (rev 50122)
@@ -8,4 +8,4 @@
 dnl --------------------------------------------------------
 dnl
 dnl  m4-include this file to define the current xpdf version
-m4_define([xpdf_version], [4.00])
+m4_define([xpdf_version], [4.01])

Modified: trunk/Build/source/libs/xpdf/xpdf-src/ANNOUNCE
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/ANNOUNCE	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/ANNOUNCE	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,4 +1,4 @@
-Subject: ANNOUNCE: Xpdf 4.00 - a PDF viewer and related tools
+Subject: ANNOUNCE: Xpdf 4.01 - a PDF viewer and related tools
 
 Glyph & Cog, LLC is pleased to announce a new version of Xpdf, the
 open source Portable Document Format (PDF) viewer.  The Xpdf project
@@ -12,12 +12,14 @@
 Unix, Windows, MacOSX, and pretty much any other system with a decent
 C++ compiler.
 
-Major changes:
-* Complete rewrite of the xpdf GUI, using Qt instead of Motif.
-* Multithreaded rasterization in the viewer - pages are now rasterized
-  in a separate thread so that scrolling and other UI activity is not
-  blocked.
-* Added a linear text selection mode.
+4.01 is primarily a bug fix release.  There are some new features:
+* Added remote server mode back into xpdf.
+* Added support for Unicode file names for the command line tools on
+  Windows.
+* Added the tabStateFile setting, the saveTabState/loadTabState
+  commands, and the "-tabstate" switch to xpdf.  [Thanks to Christian
+  Barthel for the suggestion.]
+* Added the defaultPrinter xpdfrc setting.
 
 See the `CHANGES' file for a complete list of changes.
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/CHANGES
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/CHANGES	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/CHANGES	2019-02-25 03:01:12 UTC (rev 50122)
@@ -2454,3 +2454,88 @@
 Fixed a security hole in Function.cc (write past end of array).
 Fixed a security hole with the use of d0/d1 operators outside of a
   Type3 CharProc [CVE-2016-9027].
+
+4.01 (2019-feb-18)
+------------------
+Added remote server mode back into xpdf.
+Add support for Unicode file names for the command line tools on
+  Windows.
+Added the tabStateFile setting, the saveTabState/loadTabState
+  commands, and the "-tabstate" switch to xpdf.  [Thanks to Christian
+  Barthel for the suggestion.]
+Added the defaultPrinter xpdfrc setting.
+Removed the psFile xpdfrc option (should have been removed in the 4.00
+  release).
+Tweaked the TrueType encoding/cmap code again, to get closer to the
+  PDF 2.0 spec, and to fix a problem (difference between Xpdf and
+  Adobe) with a specific PDF file.
+Optimized transparency group rasterization: only composite the part of
+  the group bitmap that was modified.
+If vector antialiasing is disabled, use the narrow stroke code for
+  lines less than one pixel wide.
+Do not map through Unicode for non-embedded CID TrueType fonts with
+  encoding = Identity-H and char collection = Adobe-Identity -- this
+  matches Adobe's behavior on a somewhat common case.
+The CCITTFax decoder now aborts after 1000 error messages, avoiding
+  problems with huge data expansion for badly corrupted CCITTFax
+  streams.
+The xref loop detection code was only looking at xref tables, and not
+  xref streams.  (CVE-2018-7174)  [Thanks to skysider for the bug
+  report.]
+The JPX decoder wasn't checking to make sure the number of components
+  is non-zero.  (CVE-2018-7175)  [Thanks to skysider for the bug
+  report.]
+Modify the lexer to accept leading '+' signs on numbers.
+Pdftohtml wasn't setting the background image width/height attributes
+  correctly for rotated pages.
+Ignore color-setting operators in cached Type 3 characters.
+Support color-key masking in Level3Gray PS output with preload.
+Xpdf was crashing on zero-page PDF files.
+Added the unicodeRemapping xpdfrc option.
+Change the cursor when the mouse is over text (in linear selection
+  mode).
+Support external OpenType CFF fonts for PostScript output.
+Handle choice-type AcroForm fields that have separate display values
+  and export values.
+Increased the supported PDF version from 1.7 to 2.0.  (This isn't a
+  change in functionality.  The code was already in place -- I just
+  forgot to bump the PDF version number.)
+Added the dropFont xpdfrc option.
+Added support for PDF417 barcodes in XFA forms.
+Modified pdfinfo to look at both the Info dict and the XML metadata.
+Check for invalid line cap/join values.  [Thanks to
+  fish at 360TeamSeri0us for the bug report.]
+Modified the object stream cache to hold onto more object streams, if
+  they're being used.
+Don't look at the "DV" (default value) key in AcroForm fields -- that
+  should only be used when a form is explicitly reset.
+Accept 8-byte values in xref streams.
+Two DCTStream bugs: don't allow SOF headers between progressive scans;
+  check for invalid Huffman table indexes.  [Thanks to
+  fish at 360TeamSeri0us for the bug reports.]
+Check for uses of the scn/SCN operators with no arguments.  [Thanks to
+  fish at 360TeamSeri0us for the bug report.]
+Correctly handle indexed color spaces with empty lookup tables.
+  [Thanks to fish at 360TeamSeri0us for the bug report.]
+Support large bitmaps (>4GB) on 64-bit systems.
+Soft masks are always isolated.
+When "undoing" preblended image/softmask data, clip the resulting
+  color values to avoid problems with incorrect data.
+Set the default text encoding to UCS-2 in Xpdf, so that copying to the
+  clipboard works as expected.
+Added a sanity check for JBIG2 symbol height.  (CVE-2018-7173)
+  [Reported by skysider.]
+Check for uninitialized value in JPXStream::fillReadBuf.
+  (CVE-2018-7452)  [Thanks to skysider for the bug report.]
+Don't try to load an XFAForm if the PDF file has zero pages.
+  (CVE-2018-7454)  [Thanks to skysider for the bug report.]
+Check for invalid line cap/join values.  (CVE-2018-16368)  [Thanks to
+  fish at 360TeamSeri0us for the bug report.]
+If the page count is greater than 50k, rescan the page tree and count
+  the pages.  This prevents long load times where various tools try to
+  read pages 1 through n.  (CVE-2018-18651)  [Thanks to krace for the
+  bug report.]
+Handle a null font name in PSOutputDev::setupEmbeddedType1Font.
+  [Thanks to r4xis for the bug report.]
+Check for invalid quant table indexes in the DCT decoder.  [Thanks to
+  r4xis for the bug report.]

Modified: trunk/Build/source/libs/xpdf/xpdf-src/INSTALL
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/INSTALL	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/INSTALL	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,11 +1,11 @@
 Xpdf
 ====
 
-version 4.00
-2017-aug-10
+version 4.01
+2019-feb-18
 
 The Xpdf software and documentation are
-copyright 1996-2017 Glyph & Cog, LLC.
+copyright 1996-2019 Glyph & Cog, LLC.
 
 Email: xpdf at xpdfreader.com
 WWW: http://www.xpdfreader.com/
@@ -119,6 +119,14 @@
      -DCMAKE_EXE_LINKER_FLAGS="..."
         Set additional options to pass to the linker.
 
+     -DCMAKE_INSTALL_BINDIR
+        Set the bin directory, relative to CMAKE_INSTALL_PREFIX
+        (typically "bin").
+
+     -DCMAKE_INSTALL_MANDIR
+        Set the man directory, relative to CMAKE_INSTALL_PREFIX
+        (typically "man" or "share/man").
+
 * Build:
 
       make

Modified: trunk/Build/source/libs/xpdf/xpdf-src/README
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/README	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/README	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,17 +1,17 @@
 Xpdf
 ====
 
-version 4.00
-2017-aug-10
+version 4.01
+2019-feb-18
 
 The Xpdf software and documentation are
-copyright 1996-2017 Glyph & Cog, LLC.
+copyright 1996-2019 Glyph & Cog, LLC.
 
 Email: xpdf at xpdfreader.com
 WWW: http://www.xpdfreader.com/
 
 The PDF data structures, operators, and specification are
-documented in ISO 32000-1:2008.
+documented in ISO 32000-2:2017.
 
 
 What is Xpdf?
@@ -196,21 +196,6 @@
 References
 ----------
 
-Adobe Systems Inc., ISO 32000-1:2008, Document Management - Portable
-document format - Part 1: PDF 1.7.
-http://www.adobe.com/devnet/pdf/pdf_reference.html
-[The manual for PDF version 1.7.]
-
-Adobe Systems Inc., Adobe Supplement to the ISO 32000, BaseVersion
-1.7, ExtensionLevel 3, June 2008.
-http://www.adobe.com/devnet/pdf/pdf_reference.html
-[Additions to the PDF 1.7 spec.]
-
-Adobe Systems Inc., Adobe Supplement to ISO 32000-1, BaseVersion 1.7,
-ExtensionLevel 5, June 2009.
-http://www.adobe.com/devnet/pdf/pdf_reference.html
-[Additions to the PDF 1.7 spec.]
-
 Adobe Systems Inc., _PostScript Language Reference_, 3rd ed.
 Addison-Wesley, 1999, ISBN 0-201-37922-8.
 [The official PostScript manual.]
@@ -340,6 +325,10 @@
 were changes made to the bitstream format between that draft and the
 published spec.]
 
+ISO, International Standard -- Document Management - Portable document
+format - Part 2: PDF 2.0.  ISO 32000-2:2017.
+[The manual for PDF version 2.0.]
+
 ITU, "Standardization of Group 3 facsimile terminals for document
 transmission", ITU-T Recommendation T.4, 1999.
 ITU, "Facsimile coding schemes and coding control functions for Group 4

Modified: trunk/Build/source/libs/xpdf/xpdf-src/cmake-config.txt
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/cmake-config.txt	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/cmake-config.txt	2019-02-25 03:01:12 UTC (rev 50122)
@@ -10,6 +10,7 @@
 
 include(CheckFunctionExists)
 include(CheckCXXSourceCompiles)
+include(GNUInstallDirs)
 
 enable_language(CXX)
 
@@ -18,6 +19,8 @@
 if (CMAKE_GENERATOR STREQUAL "Unix Makefiles")
   if (CYGWIN)
     set(PIC_FLAG "")
+  elseif (CMAKE_HOST_SYSTEM_NAME MATCHES "AIX")
+    set(PIC_FLAG "-qPIC")
   else ()
     set(PIC_FLAG "-fPIC")
   endif ()
@@ -78,12 +81,6 @@
 option(USE_EXCEPTIONS "use C++ exceptions" ON)
 option(USE_FIXEDPOINT "use fixed point (instead of floating point) arithmetic" OFF)
 option(SPLASH_CMYK "include support for CMYK rasterization" OFF)
-option(SPLASH_DEVICEN "include support for DeviceN rasterization" OFF)
-if (SPLASH_DEVICEN)
-  set(SPLASH_CMYK ON)
-endif ()
-option(USE_LCMS "enable color management using lcms2" OFF)
-option(HIGHLIGHTED_REGIONS "include support for highlighted regions" OFF)
 option(SYSTEM_XPDFRC "full path for system-wide xpdfrc file" "")
 if (SYSTEM_XPDFRC)
   set(SYSTEM_XPDFRC_DEFINE "#define SYSTEM_XPDFRC \"${SYSTEM_XPDFRC}\"")
@@ -90,9 +87,11 @@
 else ()
   set(SYSTEM_XPDFRC_DEFINE "/* #undef SYSTEM_XPDFRC */")
 endif ()
-option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" OFF)
-option(EVAL_MODE "enable evaluation mode" OFF)
-option(BUILDING_XPDFREADER "enable closed source XpdfReader build" OFF)
+if (WIN32)
+  option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" OFF)
+else ()
+  option(XPDFWIDGET_PRINTING "include printing support in XpdfWidget" ON)
+endif ()
 
 #--- check for various library functions
 check_function_exists(mkstemp HAVE_MKSTEMP)
@@ -178,11 +177,6 @@
   set(HAVE_SPLASH TRUE)
 endif ()
 
-#--- look for D-Type
-if (DTYPE_INCLUDE_DIR AND DTYPE_LIBRARY)
-  set(HAVE_DTYPE4_H TRUE)
-  message(STATUS "Found D-Type: ${DTYPE_LIBRARY}")
-endif ()
 
 #--- look for zlib
 find_package(ZLIB)
@@ -190,42 +184,13 @@
 #--- look for libpng
 find_package(PNG)
 
-#--- look for libjpeg
-find_package(JPEG)
 
-#--- look for libtiff
-find_package(TIFF)
 
-#--- look for lcms2
-if (USE_LCMS)
-  find_path(LCMS_INCLUDE_DIR lcms2.h
-    HINTS
-    ${LCMS_DIR}
-    PATHS
-    /usr/local/include
-    /usr/freeware/include
-    PATH_SUFFIXES include
-  )
-  find_library(LCMS_LIBRARY
-    NAMES lcms2 liblcms2
-    HINTS
-    ${LCMS_DIR}
-    PATHS
-    /usr/local
-    /usr/freeware
-  )
-endif ()
-if (USE_LCMS AND LCMS_INCLUDE_DIR AND LCMS_LIBRARY)
-  set(HAVE_LCMS TRUE)
-  message(STATUS "Found lcms2: ${LCMS_LIBRARY}")
-else ()
-  set(HAVE_LCMS FALSE)
-  message(STATUS "lcms2 not found")
-endif ()
 
 #--- look for Qt
 find_package(Qt5Widgets QUIET)
 if (Qt5Widgets_FOUND)
+  find_package(Qt5Network)
   find_package(Qt5PrintSupport)
 else ()
   find_package(Qt4)
@@ -233,19 +198,19 @@
 if(Qt5Widgets_FOUND)
   message(STATUS "Qt5 found")
   if (XPDFWIDGET_PRINTING)
-    set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS}")
-    set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5PrintSupport_DEFINITIONS}")
+    set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS}")
+    set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS} ${Qt5PrintSupport_DEFINITIONS}")
     if (APPLE)
-      set(QT_LIBRARIES Qt5::Widgets Qt5::PrintSupport "-framework ApplicationServices")
+      set(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::PrintSupport "-framework ApplicationServices")
     elseif (UNIX)
-      set(QT_LIBRARIES Qt5::Widgets Qt5::PrintSupport cups)
+      set(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::PrintSupport cups)
     else ()
-      set(QT_LIBRARIES Qt5::Widgets Qt5::PrintSupport)
+      set(QT_LIBRARIES Qt5::Widgets Qt5::Network Qt5::PrintSupport)
     endif ()
   else ()
-    set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS}")
-    set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS}")
-    set(QT_LIBRARIES Qt5::Widgets)
+    set(QT_INCLUDES "${Qt5Widgets_INCLUDE_DIRS} ${Qt5Network_INCLUDE_DIRS}")
+    set(QT_DEFINITIONS "${Qt5Widgets_DEFINITIONS} ${Qt5Network_DEFINITIONS}")
+    set(QT_LIBRARIES Qt5::Widgets Qt5::Network)
   endif ()
   if (XPDFWIDGET_PRINTING)
     if (APPLE)
@@ -258,10 +223,6 @@
   endif ()
   # remove "-fPIE" here because we added "-fPIC" above
   string(REPLACE "-fPIE" "" QT_CFLAGS "${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
-  if (POLICY CMP0020)
-    # do not link to qtmain.lib
-    cmake_policy(SET CMP0020 OLD)
-  endif ()
 elseif(QT4_FOUND)
   message(STATUS "Qt4 found")
   if (XPDFWIDGET_PRINTING)
@@ -278,10 +239,16 @@
 endif()
 
 #--- look for libpaper
-find_library(HAVE_PAPER_H
+find_library(PAPER_LIBRARY
              NAMES paper libpaper
              PATH_SUFFIXES lib64 lib
 )
+if (PAPER_LIBRARY)
+  set(HAVE_PAPER_H TRUE)
+else ()
+  set(HAVE_PAPER_H FALSE)
+  set(PAPER_LIBRARY "")
+endif ()
 
 #--- look for pthreads
 find_package(Threads)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 2013-2017 Glyph & Cog, LLC
-.TH pdfdetach 1 "10 Aug 2017"
+.\" Copyright 2013-2019 Glyph & Cog, LLC
+.TH pdfdetach 1 "18 Feb 2019"
 .SH NAME
 pdfdetach \- Portable Document Format (PDF) document embedded file
-extractor (version 4.00)
+extractor (version 4.01)
 .SH SYNOPSIS
 .B pdfdetach
 [options]
@@ -90,7 +90,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdfinfo software and documentation are copyright 1996-2017 Glyph &
+The pdfinfo software and documentation are copyright 1996-2019 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfdetach.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdfdetach  -  Portable  Document  Format  (PDF)  document embedded file
-       extractor (version 4.00)
+       extractor (version 4.01)
 
 SYNOPSIS
        pdfdetach [options] [PDF-file]
@@ -79,7 +79,7 @@
        99     Other error.
 
 AUTHOR
-       The pdfinfo software and documentation are copyright 1996-2017 Glyph  &
+       The pdfinfo software and documentation are copyright 1996-2019 Glyph  &
        Cog, LLC.
 
 SEE ALSO
@@ -89,4 +89,4 @@
 
 
 
-                                  10 Aug 2017                     pdfdetach(1)
+                                  18 Feb 2019                     pdfdetach(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 1999-2017 Glyph & Cog, LLC
-.TH pdffonts 1 "10 Aug 2017"
+.\" Copyright 1999-2019 Glyph & Cog, LLC
+.TH pdffonts 1 "18 Feb 2019"
 .SH NAME
 pdffonts \- Portable Document Format (PDF) font analyzer (version
-4.00)
+4.01)
 .SH SYNOPSIS
 .B pdffonts
 [options]
@@ -147,7 +147,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdffonts software and documentation are copyright 1996-2017 Glyph
+The pdffonts software and documentation are copyright 1996-2019 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdffonts.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -3,7 +3,7 @@
 
 
 NAME
-       pdffonts - Portable Document Format (PDF) font analyzer (version 4.00)
+       pdffonts - Portable Document Format (PDF) font analyzer (version 4.01)
 
 SYNOPSIS
        pdffonts [options] [PDF-file]
@@ -105,7 +105,7 @@
        99     Other error.
 
 AUTHOR
-       The pdffonts software and documentation are copyright 1996-2017 Glyph &
+       The pdffonts software and documentation are copyright 1996-2019 Glyph &
        Cog, LLC.
 
 SEE ALSO
@@ -115,4 +115,4 @@
 
 
 
-                                  10 Aug 2017                      pdffonts(1)
+                                  18 Feb 2019                      pdffonts(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 1998-2017 Glyph & Cog, LLC
-.TH pdfimages 1 "10 Aug 2017"
+.\" Copyright 1998-2019 Glyph & Cog, LLC
+.TH pdfimages 1 "18 Feb 2019"
 .SH NAME
 pdfimages \- Portable Document Format (PDF) image extractor
-(version 4.00)
+(version 4.01)
 .SH SYNOPSIS
 .B pdfimages
 [options]
@@ -102,7 +102,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdfimages software and documentation are copyright 1998-2017 Glyph
+The pdfimages software and documentation are copyright 1998-2019 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfimages.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdfimages  -  Portable  Document  Format (PDF) image extractor (version
-       4.00)
+       4.01)
 
 SYNOPSIS
        pdfimages [options] PDF-file image-root
@@ -85,7 +85,7 @@
        99     Other error.
 
 AUTHOR
-       The  pdfimages software and documentation are copyright 1998-2017 Glyph
+       The  pdfimages software and documentation are copyright 1998-2019 Glyph
        & Cog, LLC.
 
 SEE ALSO
@@ -95,4 +95,4 @@
 
 
 
-                                  10 Aug 2017                     pdfimages(1)
+                                  18 Feb 2019                     pdfimages(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 1999-2017 Glyph & Cog, LLC
-.TH pdfinfo 1 "10 Aug 2017"
+.\" Copyright 1999-2019 Glyph & Cog, LLC
+.TH pdfinfo 1 "18 Feb 2019"
 .SH NAME
 pdfinfo \- Portable Document Format (PDF) document information
-extractor (version 4.00)
+extractor (version 4.01)
 .SH SYNOPSIS
 .B pdfinfo
 [options]
@@ -150,7 +150,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdfinfo software and documentation are copyright 1996-2017 Glyph &
+The pdfinfo software and documentation are copyright 1996-2019 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdfinfo.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdfinfo - Portable Document Format (PDF) document information extractor
-       (version 4.00)
+       (version 4.01)
 
 SYNOPSIS
        pdfinfo [options] [PDF-file]
@@ -104,7 +104,7 @@
        99     Other error.
 
 AUTHOR
-       The  pdfinfo software and documentation are copyright 1996-2017 Glyph &
+       The  pdfinfo software and documentation are copyright 1996-2019 Glyph &
        Cog, LLC.
 
 SEE ALSO
@@ -114,4 +114,4 @@
 
 
 
-                                  10 Aug 2017                       pdfinfo(1)
+                                  18 Feb 2019                       pdfinfo(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 1997-2017 Glyph & Cog, LLC
-.TH pdftohtml 1 "10 Aug 2017"
+.\" Copyright 1997-2019 Glyph & Cog, LLC
+.TH pdftohtml 1 "18 Feb 2019"
 .SH NAME
 pdftohtml \- Portable Document Format (PDF) to HTML converter
-(version 4.00)
+(version 4.01)
 .SH SYNOPSIS
 .B pdftohtml
 [options]
@@ -109,7 +109,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdftohtml software and documentation are copyright 1996-2017 Glyph
+The pdftohtml software and documentation are copyright 1996-2019 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftohtml.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdftohtml  -  Portable Document Format (PDF) to HTML converter (version
-       4.00)
+       4.01)
 
 SYNOPSIS
        pdftohtml [options] PDF-file HTML-dir
@@ -97,7 +97,7 @@
        99     Other error.
 
 AUTHOR
-       The  pdftohtml software and documentation are copyright 1996-2017 Glyph
+       The  pdftohtml software and documentation are copyright 1996-2019 Glyph
        & Cog, LLC.
 
 SEE ALSO
@@ -107,4 +107,4 @@
 
 
 
-                                  10 Aug 2017                     pdftohtml(1)
+                                  18 Feb 2019                     pdftohtml(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 2017 Glyph & Cog, LLC
-.TH pdftopng 1 "10 Aug 2017"
+.\" Copyright 2017-2019 Glyph & Cog, LLC
+.TH pdftopng 1 "18 Feb 2019"
 .SH NAME
 pdftopng \- Portable Document Format (PDF) to Portable Network Graphics
-(PNG) converter (version 4.00)
+(PNG) converter (version 4.01)
 .SH SYNOPSIS
 .B pdftopng
 [options]
@@ -107,7 +107,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdftopng software and documentation are copyright 1996-2017 Glyph
+The pdftopng software and documentation are copyright 1996-2019 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftopng.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdftopng  - Portable Document Format (PDF) to Portable Network Graphics
-       (PNG) converter (version 4.00)
+       (PNG) converter (version 4.01)
 
 SYNOPSIS
        pdftopng [options] PDF-file PNG-root
@@ -87,7 +87,7 @@
        99     Other error.
 
 AUTHOR
-       The pdftopng software and documentation are copyright 1996-2017 Glyph &
+       The pdftopng software and documentation are copyright 1996-2019 Glyph &
        Cog, LLC.
 
 SEE ALSO
@@ -97,4 +97,4 @@
 
 
 
-                                  10 Aug 2017                      pdftopng(1)
+                                  18 Feb 2019                      pdftopng(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 2005-2017 Glyph & Cog, LLC
-.TH pdftoppm 1 "10 Aug 2017"
+.\" Copyright 2005-2019 Glyph & Cog, LLC
+.TH pdftoppm 1 "18 Feb 2019"
 .SH NAME
 pdftoppm \- Portable Document Format (PDF) to Portable Pixmap (PPM)
-converter (version 4.00)
+converter (version 4.01)
 .SH SYNOPSIS
 .B pdftoppm
 [options]
@@ -107,7 +107,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdftoppm software and documentation are copyright 1996-2017 Glyph
+The pdftoppm software and documentation are copyright 1996-2019 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftoppm.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdftoppm - Portable Document Format (PDF) to Portable Pixmap (PPM) con-
-       verter (version 4.00)
+       verter (version 4.01)
 
 SYNOPSIS
        pdftoppm [options] PDF-file PPM-root
@@ -86,7 +86,7 @@
        99     Other error.
 
 AUTHOR
-       The pdftoppm software and documentation are copyright 1996-2017 Glyph &
+       The pdftoppm software and documentation are copyright 1996-2019 Glyph &
        Cog, LLC.
 
 SEE ALSO
@@ -96,4 +96,4 @@
 
 
 
-                                  10 Aug 2017                      pdftoppm(1)
+                                  18 Feb 2019                      pdftoppm(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 1996-2017 Glyph & Cog, LLC
-.TH pdftops 1 "10 Aug 2017"
+.\" Copyright 1996-2019 Glyph & Cog, LLC
+.TH pdftops 1 "18 Feb 2019"
 .SH NAME
 pdftops \- Portable Document Format (PDF) to PostScript converter
-(version 4.00)
+(version 4.01)
 .SH SYNOPSIS
 .B pdftops
 [options]
@@ -236,7 +236,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdftops software and documentation are copyright 1996-2017 Glyph &
+The pdftops software and documentation are copyright 1996-2019 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftops.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdftops  - Portable Document Format (PDF) to PostScript converter (ver-
-       sion 4.00)
+       sion 4.01)
 
 SYNOPSIS
        pdftops [options] [PDF-file [PS-file]]
@@ -201,7 +201,7 @@
        99     Other error.
 
 AUTHOR
-       The  pdftops software and documentation are copyright 1996-2017 Glyph &
+       The  pdftops software and documentation are copyright 1996-2019 Glyph &
        Cog, LLC.
 
 SEE ALSO
@@ -211,4 +211,4 @@
 
 
 
-                                  10 Aug 2017                       pdftops(1)
+                                  18 Feb 2019                       pdftops(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,8 +1,8 @@
-.\" Copyright 1997-2017 Glyph & Cog, LLC
-.TH pdftotext 1 "10 Aug 2017"
+.\" Copyright 1997-2019 Glyph & Cog, LLC
+.TH pdftotext 1 "18 Feb 2019"
 .SH NAME
 pdftotext \- Portable Document Format (PDF) to text converter
-(version 4.00)
+(version 4.01)
 .SH SYNOPSIS
 .B pdftotext
 [options]
@@ -172,7 +172,7 @@
 99
 Other error.
 .SH AUTHOR
-The pdftotext software and documentation are copyright 1996-2017 Glyph
+The pdftotext software and documentation are copyright 1996-2019 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/pdftotext.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -4,7 +4,7 @@
 
 NAME
        pdftotext  -  Portable Document Format (PDF) to text converter (version
-       4.00)
+       4.01)
 
 SYNOPSIS
        pdftotext [options] [PDF-file [text-file]]
@@ -138,7 +138,7 @@
        99     Other error.
 
 AUTHOR
-       The  pdftotext software and documentation are copyright 1996-2017 Glyph
+       The  pdftotext software and documentation are copyright 1996-2019 Glyph
        & Cog, LLC.
 
 SEE ALSO
@@ -148,4 +148,4 @@
 
 
 
-                                  10 Aug 2017                     pdftotext(1)
+                                  18 Feb 2019                     pdftotext(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/sample-xpdfrc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/sample-xpdfrc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/sample-xpdfrc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -54,10 +54,6 @@
 
 #----- PostScript output control
 
-# Set the default PostScript file or command.
-
-#psFile			"|lpr -Pmyprinter"
-
 # Set the default PostScript paper size -- this can be letter, legal,
 # A4, or A3.  You can also specify a paper size as width and height
 # (in points).
@@ -88,4 +84,3 @@
 # clicked.
 
 #launchCommand  viewer-script
-#urlCommand	"netscape -remote 'openURL(%s)'"

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.1	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,12 +1,17 @@
-.\" Copyright 1996-2017 Glyph & Cog, LLC
-.TH xpdf 1 "10 Aug 2017"
+.\" Copyright 1996-2019 Glyph & Cog, LLC
+.TH xpdf 1 "18 Feb 2019"
 .SH NAME
-xpdf \- Portable Document Format (PDF) file viewer (version 4.00)
+xpdf \- Portable Document Format (PDF) file viewer (version 4.01)
 .SH SYNOPSIS
 .B xpdf
 [options]
 .RI [ PDF-file
 .RI [: page " | +" dest "]] ..."
+.PP
+.B xpdf
+[options]
+.B -remote
+.IR remote-name " [" command " ...]"
 .SH DESCRIPTION
 .B Xpdf
 is a viewer for Portable Document Format (PDF) files.  (These are also
@@ -124,6 +129,9 @@
 .B \-fullscreen
 Open xpdf in full-screen mode, useful for presentations.
 .TP
+.BI \-remote " remote-name"
+Start Xpdf in remote server mode.  See the REMOVE SERVER MODE section.
+.TP
 .BI \-display " display"
 Set the X display (only available with X11).
 .TP
@@ -349,7 +357,8 @@
 command line option, the \'full screen' menu item, or a binding to the
 .B fullScreenMode
 or
-.BR toggleFullScreenMode command .
+.B toggleFullScreenMode
+command.
 .PP
 Entering full-screen mode automatically switches to single-page view
 mode and to the fit-page zoom factor.
@@ -376,6 +385,23 @@
 rectangle.  Any part of the page can be selected, regardless of the
 content on the page.
 .TP
+.BI checkOpenFile( file )
+Check that
+.I file
+is open in the current tab, and open it if not.
+.TP
+.BI checkOpenFileAtDest( file, dest )
+Check that
+.I file
+is open in the current tab, and open it if not.  In either case go to
+the specified named destination.
+.TP
+.BI checkOpenFileAtPage( file, page )
+Check that
+.I file
+is open in the current tab, and open it if not.  In either case go to
+the specified page.
+.TP
 .B closeSidebar
 Close the sidebar.
 .TP
@@ -478,6 +504,12 @@
 Set linear selection mode.  In this mode, the selection follows text.
 Non-text regions cannot be selected.
 .TP
+.BI loadTabState
+Load the tab state file (which was written via the saveTabState
+command), and restore the tabs listed in that file.  The path for the
+tab state file is specified with the tabStateFile setting (see
+.BR xpdfrc (5)).
+.TP
 .B newTab
 Open an empty new tab.
 .TP
@@ -499,6 +531,16 @@
 .B openErrorWindow
 Open the error window.
 .TP
+.BI openFile( file )
+Open the specified file in the current tab.
+.TP
+.BI openFileAtDest( file, dest )
+Open the specified file in the current tab at the specified named
+destination.
+.TP
+.BI openFileAtPage( file, page )
+Open the specified file in the current tab at the specified page.
+.TP
 .B openSidebar
 Open the sidebar.
 .TP
@@ -579,6 +621,10 @@
     bind x "run(ls -l)"
 
 .fi
+The command string may not be run through a shell.  It is recommended
+to keep the command simple, so that it doesn't depend on specific
+shell functionality.  For complex things, you can have the command
+string run a shell script.
 .TP
 .B saveAs
 Save PDF via a file requester.
@@ -586,12 +632,20 @@
 .B saveImage
 Open the \'save image' dialog.
 .TP
+.BI saveTabState
+Save a list of all tabs open in this window to the tab state file.
+For each tab, this writes the PDF file name and page number (on
+separate lines).  This file can be loaded later with the loadTabState
+command.  The path for the tab state file is specified with the
+tabStateFile setting (see
+.BR xpdfrc (5)).
+.TP
 .BI scrollDown( n )
 Scroll down by
 .I n
 pixels.
 .TP
-.BI scrollDownPrevPage( n )
+.BI scrollDownNextPage( n )
 Scroll down by
 .I n
 pixels, moving to the next page if appropriate.
@@ -617,11 +671,11 @@
 pixels.
 .TP
 .B scrollToBottomEdge
-Scroll to the bottom edge of the current page, with no horizontal
-movement.
+Scroll to the bottom edge of the last displayed page, with no
+horizontal movement.
 .TP
 .B scrollToBottomRight
-Scroll to the bottom-right corner of the current page.
+Scroll to the bottom-right corner of the last displayed page.
 .TP
 .B scrollToLeftEdge
 Scroll to the left edge of the current page, with no vertical
@@ -632,11 +686,11 @@
 movement.
 .TP
 .B scrollToTopEdge
-Scroll to the top edge of the current page, with no horizontal
+Scroll to the top edge of the first displayed page, with no horizontal
 movement.
 .TP
 .B scrollToTopLeft
-Scroll to the top-left corner of the current page.
+Scroll to the top-left corner of the first displayed page.
 .TP
 .BI scrollUp( n )
 Scroll up by
@@ -710,6 +764,25 @@
 .TP
 .B zoomToSelection
 Zoom to the current selection.
+.SH REMOTE SERVER MODE
+Starting xpdf with the "-remote" switch puts it into remote server
+mode.  All remaining command line options are commands (see the
+COMMANDS section).  Subsequent invocations of "xpdf -remote" with the
+same remote server name will send commands to the already-running
+instance of xpdf.  The "checkOpenFile" commands are useful here for
+things like changing pages.
+For example:
+.PP
+.RS
+    # Start up xpdf, and open something.pdf.
+    xpdf -remote foo 'openFile(something.pdf)'
+
+    # Switch to page 7 in the already-open something.pdf.  If the user
+    # has closed xpdf in the meantime, this will restart it and reopen
+    # the file.
+    xpdf -remote foo 'checkOpenFileAtPage(something.pdf, 7)'
+.RE
+.PP
 .SH EXIT CODES
 The Xpdf tools use the following exit codes:
 .TP
@@ -728,7 +801,7 @@
 99
 Other error.
 .SH AUTHOR
-The xpdf software and documentation are copyright 1996-2017 Glyph &
+The xpdf software and documentation are copyright 1996-2019 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
 .BR pdftops (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdf.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -3,11 +3,13 @@
 
 
 NAME
-       xpdf - Portable Document Format (PDF) file viewer (version 4.00)
+       xpdf - Portable Document Format (PDF) file viewer (version 4.01)
 
 SYNOPSIS
        xpdf [options] [PDF-file [:page | +dest]] ...
 
+       xpdf [options] -remote remote-name [command ...]
+
 DESCRIPTION
        Xpdf  is a viewer for Portable Document Format (PDF) files.  (These are
        also sometimes also called 'Acrobat' files, from the  name  of  Adobe's
@@ -108,10 +110,14 @@
        -fullscreen
               Open xpdf in full-screen mode, useful for presentations.
 
+       -remote remote-name
+              Start  Xpdf  in  remote server mode.  See the REMOVE SERVER MODE
+              section.
+
        -display display
               Set the X display (only available with X11).
 
-       -cmd   Print  commands  as  they're  executed  (useful  for debugging).
+       -cmd   Print commands  as  they're  executed  (useful  for  debugging).
               [config file: printCommands]
 
        -cfg config-file
@@ -125,7 +131,7 @@
 CONTROLS
    Tool bar
        'page' entry box
-              Move  to  a  specific page number.  Click in the box to activate
+              Move to a specific page number.  Click in the  box  to  activate
               it, type the page number, then hit return.
 
        left/right arrow buttons
@@ -135,11 +141,11 @@
               Zoom out or in (i.e., change magnification) incrementally.
 
        zoom popup menu
-              Change the zoom factor (see the description  of  the  -z  option
+              Change  the  zoom  factor  (see the description of the -z option
               above).
 
        fit width button
-              Change  the  zoom  factor  to  fit  the page width to the window
+              Change the zoom factor to fit  the  page  width  to  the  window
               width.
 
        fit page button
@@ -146,12 +152,12 @@
               Change the zoom factor to fit the page to the window size.
 
        working/error indicator
-              This icon is animated while Xpdf is rendering a page.  It  turns
-              red  when  an  error or warning has been issued.  Clicking on it
+              This  icon is animated while Xpdf is rendering a page.  It turns
+              red when an error or warning has been issued.   Clicking  on  it
               opens the error dialog.
 
        'find' box
-              Find a text string.  Click in the box to  activate  it,  type  a
+              Find  a  text  string.   Click in the box to activate it, type a
               search string, then hit return.
 
        find next button
@@ -165,41 +171,41 @@
               whole words (on/off).
 
    Menu bar
-       The menu bar is above the tool bar.  The menu  items  should  be  self-
+       The  menu  bar  is  above the tool bar.  The menu items should be self-
        explanatory.
 
    Tab list
-       The  tab  list  is  on the left, just below the tool bar.  It lists all
+       The tab list is on the left, just below the tool  bar.   It  lists  all
        open tabs.
 
    Outline/layers/attachments pane
-       This pane is on the left, below the tab list.  The popup allows you  to
+       This  pane is on the left, below the tab list.  The popup allows you to
        select from outline, layers, or attachments.
 
-       The  outline  is  a tree-like structure of bookmarks that allows moving
+       The outline is a tree-like structure of bookmarks  that  allows  moving
        within the PDF file.  Not all PDF files have outlines.
 
-       Layers (a.k.a. optional content) allow parts of the PDF content  to  be
+       Layers  (a.k.a.  optional content) allow parts of the PDF content to be
        shown or hidden.  Not all PDF files have layers.
 
-       Attachments  are  other files embedded within the PDF file.  There is a
-       'save' button for each attached file.  Not all PDF files  have  attach-
+       Attachments are other files embedded within the PDF file.  There  is  a
+       'save'  button  for each attached file.  Not all PDF files have attach-
        ments.
 
    Text selection
-       Dragging  the  mouse  with  the left button held down will highlight an
-       arbitrary rectangle.  Selected text can  be  copied  to  the  clipboard
-       (with  the  edit/copy menu item).  On X11, selected text will be avail-
+       Dragging the mouse with the left button held  down  will  highlight  an
+       arbitrary  rectangle.   Selected  text  can  be copied to the clipboard
+       (with the edit/copy menu item).  On X11, selected text will  be  avail-
        able in the X selection buffer.
 
    Links
-       When the mouse is over a hyperlink, the link target will be shown in  a
+       When  the mouse is over a hyperlink, the link target will be shown in a
        popup near the bottom of the window.
 
        Clicking on a hyperlink will jump to the link's destination.  A link to
-       another PDF document will make xpdf load  that  document.   A  'launch'
-       link  to  an executable program will display a dialog, and if you click
-       'ok', execute the program.  URL links are opened in a  system-dependent
+       another  PDF  document  will  make xpdf load that document.  A 'launch'
+       link to an executable program will display a dialog, and if  you  click
+       'ok',  execute the program.  URL links are opened in a system-dependent
        way.  (On UNIX, Qt uses the $BROWSER environment variable.)
 
    Mouse bindings
@@ -209,11 +215,11 @@
 
        Dragging the mouse with the middle button held down pans the window.
 
-       The  right  mouse  button  opens  a  popup  menu  (see  popupMenuCmd in
+       The right  mouse  button  opens  a  popup  menu  (see  popupMenuCmd  in
        xpdfrc(5)).
 
    Key bindings
-       This section lists the default key bindings.  Bindings can  be  changed
+       This  section  lists the default key bindings.  Bindings can be changed
        using the config file (see xpdfrc(5)).
 
        control-o
@@ -220,8 +226,8 @@
               Open a new PDF file via a file requester.
 
        control-r
-              Reload  the  current  PDF  file.  Note that Xpdf will reload the
-              file automatically (on a  page  change  or  redraw)  if  it  has
+              Reload the current PDF file.  Note that  Xpdf  will  reload  the
+              file  automatically  (on  a  page  change  or  redraw) if it has
               changed since it was last loaded.
 
        control-f
@@ -255,8 +261,8 @@
               Open a new window.
 
        control-w
-              Close  the  current tab.  Closes the window if this was the last
-              open tab.  Quits the application if this was the last open  win-
+              Close the current tab.  Closes the window if this was  the  last
+              open  tab.  Quits the application if this was the last open win-
               dow.
 
        control-q
@@ -288,11 +294,11 @@
               Go to the last page.
 
        <space> or <PageDown>
-              Scroll  down  on the current page; if already at bottom, move to
+              Scroll down on the current page; if already at bottom,  move  to
               next page.
 
        control-<PageDown> or control-<down-arrow>
-              Go to the next page.  If <ScrollLock> is active, this  maintains
+              Go  to the next page.  If <ScrollLock> is active, this maintains
               the relative position on the page.
 
        <PageUp>
@@ -300,7 +306,7 @@
               ous page.
 
        control-<PageUp> or control-<up-arrow>
-              Go to the previous page.  If <ScrollLock> is active, this  main-
+              Go  to the previous page.  If <ScrollLock> is active, this main-
               tains the relative position on the page.
 
        <esc>  Exit full-screen mode.
@@ -314,20 +320,20 @@
        w      Set the zoom factor to 'width' (fit page width to window).
 
 Full-screen mode
-       Xpdf  can  be  placed into full-screen mode via the -fullscreen command
-       line option,  the  'full  screen'  menu  item,  or  a  binding  to  the
-       fullScreenMode or toggleFullScreenModecommand.
+       Xpdf can be placed into full-screen mode via  the  -fullscreen  command
+       line  option,  the  'full  screen'  menu  item,  or  a  binding  to the
+       fullScreenMode or toggleFullScreenMode command.
 
-       Entering  full-screen  mode  automatically switches to single-page view
+       Entering full-screen mode automatically switches  to  single-page  view
        mode and to the fit-page zoom factor.
 
-       Full-screen mode can be exited via the default <esc>  key  binding,  or
+       Full-screen  mode  can  be exited via the default <esc> key binding, or
        via a binding to the windowMode or toggleFullScreenModecommand.
 
 COMMANDS
        Xpdf's key and mouse bindings are user-configurable, using the bind and
-       unbind commands in the config file (see xpdfrc(5)).  The  bind  command
-       allows  you  to bind a key or mouse button to a sequence of one or more
+       unbind  commands  in the config file (see xpdfrc(5)).  The bind command
+       allows you to bind a key or mouse button to a sequence of one  or  more
        commands.
 
        The following commands are supported:
@@ -339,6 +345,17 @@
               ple rectangle.  Any part of the page can be selected, regardless
               of the content on the page.
 
+       checkOpenFile(file)
+              Check that file is open in the current tab, and open it if not.
+
+       checkOpenFileAtDest(file,dest)
+              Check  that file is open in the current tab, and open it if not.
+              In either case go to the specified named destination.
+
+       checkOpenFileAtPage(file,page)
+              Check that file is open in the current tab, and open it if  not.
+              In either case go to the specified page.
+
        closeSidebar
               Close the sidebar.
 
@@ -386,29 +403,29 @@
               Set keyboard focus to the page number text box.
 
        followLink
-              Follow a hyperlink (does nothing if the  mouse  is  not  over  a
+              Follow  a  hyperlink  (does  nothing  if the mouse is not over a
               link).
 
        followLinkInNewTab
               Follow a hyperlink, opening PDF files in a new tab (does nothing
-              if the mouse is not over a link).  For links to  non-PDF  files,
+              if  the  mouse is not over a link).  For links to non-PDF files,
               this command is identical to followLink.
 
        followLinkInNewTabNoSel
-              Same  as followLinkInNewTab, but does nothing if there is a non-
+              Same as followLinkInNewTab, but does nothing if there is a  non-
               empty selection.  (This is useful as a mouse button binding.)
 
        followLinkInNewWin
-              Follow a hyperlink, opening PDF files  in  a  new  window  (does
-              nothing  if the mouse is not over a link).  For links to non-PDF
+              Follow  a  hyperlink,  opening  PDF  files in a new window (does
+              nothing if the mouse is not over a link).  For links to  non-PDF
               files, this command is identical to followLink.
 
        followLinkInNewWinNoSel
-              Same as followLinkInNewWin, but does nothing if there is a  non-
+              Same  as followLinkInNewWin, but does nothing if there is a non-
               empty selection.  (This is useful as a mouse button binding.)
 
        followLinkNoSel
-              Same  as  followLink,  but  does nothing if there is a non-empty
+              Same as followLink, but does nothing if  there  is  a  non-empty
               selection.  (This is useful as a mouse button binding.)
 
        fullScreenMode
@@ -435,9 +452,15 @@
               Switch to horizontal continuous view mode.
 
        linearSelectMode
-              Set linear selection mode.  In this mode, the selection  follows
+              Set  linear selection mode.  In this mode, the selection follows
               text.  Non-text regions cannot be selected.
 
+       loadTabState
+              Load the tab state file (which was written via the  saveTabState
+              command),  and  restore  the tabs listed in that file.  The path
+              for the tab state file is specified with the  tabStateFile  set-
+              ting (see xpdfrc(5)).
+
        newTab Open an empty new tab.
 
        newWindow
@@ -457,6 +480,17 @@
        openErrorWindow
               Open the error window.
 
+       openFile(file)
+              Open the specified file in the current tab.
+
+       openFileAtDest(file,dest)
+              Open  the  specified  file  in  the current tab at the specified
+              named destination.
+
+       openFileAtPage(file,page)
+              Open the specified file in the  current  tab  at  the  specified
+              page.
+
        openSidebar
               Open the sidebar.
 
@@ -530,6 +564,10 @@
 
                   bind x "run(ls -l)"
 
+              The command string may not be run through a shell.  It is recom-
+              mended to keep the command simple, so that it doesn't depend  on
+              specific  shell functionality.  For complex things, you can have
+              the command string run a shell script.
 
        saveAs Save PDF via a file requester.
 
@@ -536,10 +574,17 @@
        saveImage
               Open the 'save image' dialog.
 
+       saveTabState
+              Save a list of all tabs open in this window  to  the  tab  state
+              file.  For each tab, this writes the PDF file name and page num-
+              ber (on separate lines).  This file can be loaded later with the
+              loadTabState command.  The path for the tab state file is speci-
+              fied with the tabStateFile setting (see xpdfrc(5)).
+
        scrollDown(n)
               Scroll down by n pixels.
 
-       scrollDownPrevPage(n)
+       scrollDownNextPage(n)
               Scroll down by n pixels, moving to the next page if appropriate.
 
        scrollLeft(n)
@@ -555,36 +600,36 @@
               Scroll right by n pixels.
 
        scrollToBottomEdge
-              Scroll  to the bottom edge of the current page, with no horizon-
-              tal movement.
+              Scroll to the bottom edge of the last displayed  page,  with  no
+              horizontal movement.
 
        scrollToBottomRight
-              Scroll to the bottom-right corner of the current page.
+              Scroll to the bottom-right corner of the last displayed page.
 
        scrollToLeftEdge
-              Scroll to the left edge of the current page,  with  no  vertical
+              Scroll  to  the  left edge of the current page, with no vertical
               movement.
 
        scrollToRightEdge
-              Scroll  to  the right edge of the current page, with no vertical
+              Scroll to the right edge of the current page, with  no  vertical
               movement.
 
        scrollToTopEdge
-              Scroll to the top edge of the current page, with  no  horizontal
-              movement.
+              Scroll to the top edge of the first displayed page, with no hor-
+              izontal movement.
 
        scrollToTopLeft
-              Scroll to the top-left corner of the current page.
+              Scroll to the top-left corner of the first displayed page.
 
        scrollUp(n)
               Scroll up by n pixels.
 
        scrollUpPrevPage(n)
-              Scroll  up by n pixels, moving to the previous page if appropri-
+              Scroll up by n pixels, moving to the previous page if  appropri-
               ate.
 
        setSelection(pg,ulx,uly,lrx,lry)
-              Set the selection to the specified coordinates on the  specified
+              Set  the selection to the specified coordinates on the specified
               page.
 
        sideBySideContinuousMode
@@ -597,11 +642,11 @@
               Switch to single-page view mode.
 
        startPan
-              Start  a pan operation at the current mouse position, which will
+              Start a pan operation at the current mouse position, which  will
               scroll the document as the mouse moves.
 
        startSelection
-              Start a selection at the current mouse position, which  will  be
+              Start  a  selection at the current mouse position, which will be
               extended as the mouse moves.
 
        toggleContinuousMode
@@ -617,12 +662,12 @@
               Toggle the sidebar between open and closed.
 
        toggleSidebarMoveResizeWin
-              Toggle  the sidebar between open and closed, resizing the window
-              so that the document size doesn't change, and moving the  window
+              Toggle the sidebar between open and closed, resizing the  window
+              so  that the document size doesn't change, and moving the window
               so that the document stays in the same place on the screen.
 
        toggleSidebarResizeWin
-              Toggle  the sidebar between open and closed, resizing the window
+              Toggle the sidebar between open and closed, resizing the  window
               so that the document size doesn't change.
 
        windowMode
@@ -645,6 +690,24 @@
        zoomToSelection
               Zoom to the current selection.
 
+REMOTE SERVER MODE
+       Starting  xpdf  with  the  "-remote"  switch puts it into remote server
+       mode.  All remaining command line options are commands  (see  the  COM-
+       MANDS section).  Subsequent invocations of "xpdf -remote" with the same
+       remote server name will send commands to the  already-running  instance
+       of  xpdf.  The "checkOpenFile" commands are useful here for things like
+       changing pages.  For example:
+
+                  # Start up xpdf, and open something.pdf.
+                  xpdf -remote foo 'openFile(something.pdf)'
+
+                  # Switch to page 7 in the  already-open  something.pdf.   If
+              the user
+                  #  has closed xpdf in the meantime, this will restart it and
+              reopen
+                  # the file.
+                  xpdf -remote foo 'checkOpenFileAtPage(something.pdf, 7)'
+
 EXIT CODES
        The Xpdf tools use the following exit codes:
 
@@ -659,7 +722,7 @@
        99     Other error.
 
 AUTHOR
-       The xpdf software and documentation are  copyright  1996-2017  Glyph  &
+       The xpdf software and documentation are  copyright  1996-2019  Glyph  &
        Cog, LLC.
 
 SEE ALSO
@@ -669,4 +732,4 @@
 
 
 
-                                  10 Aug 2017                          xpdf(1)
+                                  18 Feb 2019                          xpdf(1)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.5	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1,7 +1,7 @@
-.\" Copyright 2002-2017 Glyph & Cog, LLC
-.TH xpdfrc 5 "10 Aug 2017"
+.\" Copyright 2002-2019 Glyph & Cog, LLC
+.TH xpdfrc 5 "18 Feb 2019"
 .SH NAME
-xpdfrc \- configuration file for Xpdf tools (version 4.00)
+xpdfrc \- configuration file for Xpdf tools (version 4.01)
 .SH DESCRIPTION
 All of the Xpdf tools read a single configuration file.  If you have a
 .I .xpdfrc
@@ -234,18 +234,13 @@
 defaults to "no".
 .TP
 .BR psNeverRasterize " yes | no"
-If set to "yes", PostScript output will never be rasterized.  This
-will likely result in incorrect output for PDF files that use
-transparency.  (If both psAlwaysRasterize and psNeverRasterize are set
-to "yes", the psAlwaysRasterize setting wins.)  This defaults to "no".
+Pdftops rasterizes an pages that use transparency (because PostScript
+doesn't support transparency).  If psNeverRasterize is set to "yes",
+rasterization is disabled: pages will never be rasterized, even if
+they contain transparency.  This will likely result in incorrect
+output for PDF files that use transparency, and a warning message to
+that effect will be printed.  This defaults to "no".
 .TP
-.BI psFile " file\-or\-command"
-Sets the default PostScript file or print command for xpdf.  Commands
-start with a \'|' character; anything else is a file.  If the file
-name or command contains spaces it must be quoted.  This defaults to
-unset, which tells xpdf to generate a name of the form <file>.ps for a
-PDF file <file>.pdf.
-.TP
 .BI fontDir " dir"
 See the description above, in the DISPLAY FONTS section.
 .SH TEXT CONTROL AND CHARACTER MAPPING
@@ -330,6 +325,18 @@
 .I in\-hex
 will be converted to the specified output sequence.
 .TP
+.BI unicodeRemapping " remap\-file"
+Remap Unicode characters when doing text extraction.  This specifies a
+file that maps from a particular Unicode index to zero or more
+replacement Unicode indexes.  Each line of the remap file represents
+one Unicode character:
+
+.RI "    " in\-hex " " out\-hex1 " " out\-hex2 " ..."
+
+Any Unicode characters not listed will be left unchanged.  This
+function is typically used to remap things like non-breaking spaces,
+soft hyphens, ligatures, etc.
+.TP
 .BI unicodeMap " encoding\-name map\-file"
 Specifies the file with mapping from Unicode to
 .IR encoding\-name .
@@ -412,6 +419,16 @@
 mapExtTrueTypeFontsViaUnicode is set to "no", Xpdf will assume the
 character codes are GIDs (i.e., use an identity mapping).  This
 defaults to "yes".
+.TP
+.BI dropFont " font-name"
+Drop all text drawn in the specified font.  To drop text drawn in
+unnamed fonts, use:
+.nf
+
+    dropFont ""
+
+.fi
+There can be any number of dropFont commands.
 .SH RASTERIZER SETTINGS
 .TP
 .BR enableFreeType " yes | no"
@@ -450,6 +467,11 @@
 the same adjusted width (at the expense of allowing gaps and overlaps
 between adjacent lines).  This defaults to "yes".
 .TP
+.BR forceAccurateTiling " yes | no"
+If this is set to "yes", the TilingType is forced to 2 (no distortion)
+for all tiling patterns, regardless of the setting in the pattern
+dictionary.  This defaults to "no".
+.TP
 .BR screenType " dispersed | clustered | stochasticClustered"
 Sets the halftone screen type, which will be used when generating a
 monochrome (1-bit) bitmap.  The three options are dispersed-dot
@@ -518,7 +540,7 @@
 .BI initialSidebarState " yes | no"
 If set to "yes", xpdf opens with the sidebar (tabs, outline, etc.)
 visible.  If set to "no", xpdf opens with the sidebar collapsed.  The
-default is "no".
+default is "yes".
 .TP
 .BI paperColor " color"
 Set the "paper color", i.e., the background of the page display.  The
@@ -574,6 +596,9 @@
 string "%s" will be replaced with the movie file name.  This has no
 default value.
 .TP
+.BI defaultPrinter " printer"
+Sets the default printer used in the viewer's print dialog.
+.TP
 .BI bind " modifiers-key context command ..."
 Add a key or mouse button binding.
 .I Modifiers
@@ -652,6 +677,12 @@
 useful to remove default key bindings before establishing new ones
 (e.g., if the default key binding is given for "any" context, and you
 want to create new key bindings for multiple contexts).
+.TP
+.BI tabStateFile " path"
+Sets the file used by the loadTabState and saveTabState commands (see
+the
+.BR xpdf (1)
+man page for more information).
 .SH MISCELLANEOUS SETTINGS
 .TP
 .BI drawAnnotations " yes | no"
@@ -712,7 +743,6 @@
 psLevel              level2
 psEmbedType1Fonts    yes
 psEmbedTrueTypeFonts yes
-psFile               "| lpr \-Pprinter5"
 
 # assume that the PostScript printer has the Univers and
 # Univers-Bold fonts
@@ -726,7 +756,6 @@
 # misc options
 enableFreeType  yes
 launchCommand   viewer-script
-urlCommand      "netscape \-remote 'openURL(%s)'"
 
 .fi
 .SH FILES
@@ -739,7 +768,7 @@
 This is the user's configuration file.  If it exists, it will be read
 in place of the system-wide file.
 .SH AUTHOR
-The Xpdf software and documentation are copyright 1996-2017 Glyph &
+The Xpdf software and documentation are copyright 1996-2019 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
 .BR xpdf (1),

Modified: trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/doc/xpdfrc.cat	2019-02-25 03:01:12 UTC (rev 50122)
@@ -3,7 +3,7 @@
 
 
 NAME
-       xpdfrc - configuration file for Xpdf tools (version 4.00)
+       xpdfrc - configuration file for Xpdf tools (version 4.01)
 
 DESCRIPTION
        All  of the Xpdf tools read a single configuration file.  If you have a
@@ -216,19 +216,14 @@
               defaults to "no".
 
        psNeverRasterize yes | no
-              If set to "yes", PostScript output  will  never  be  rasterized.
-              This  will  likely result in incorrect output for PDF files that
-              use transparency.  (If both psAlwaysRasterize and psNeverRaster-
-              ize are set to "yes", the psAlwaysRasterize setting wins.)  This
+              Pdftops rasterizes an pages that use transparency (because Post-
+              Script  doesn't  support  transparency).  If psNeverRasterize is
+              set to "yes", rasterization is disabled:  pages  will  never  be
+              rasterized, even if they contain transparency.  This will likely
+              result in incorrect output for PDF files that use  transparency,
+              and  a  warning  message  to  that effect will be printed.  This
               defaults to "no".
 
-       psFile file-or-command
-              Sets the default PostScript file  or  print  command  for  xpdf.
-              Commands  start  with  a '|' character; anything else is a file.
-              If the file name or command contains spaces it must  be  quoted.
-              This  defaults  to unset, which tells xpdf to generate a name of
-              the form <file>.ps for a PDF file <file>.pdf.
-
        fontDir dir
               See the description above, in the DISPLAY FONTS section.
 
@@ -305,11 +300,23 @@
               indexes.  Each occurrence of in-hex will  be  converted  to  the
               specified output sequence.
 
+       unicodeRemapping remap-file
+              Remap Unicode characters when doing text extraction.  This spec-
+              ifies a file that maps from a particular Unicode index  to  zero
+              or  more  replacement  Unicode  indexes.  Each line of the remap
+              file represents one Unicode character:
+
+                  in-hex out-hex1 out-hex2 ...
+
+              Any Unicode characters not listed will be left unchanged.   This
+              function  is  typically  used  to remap things like non-breaking
+              spaces, soft hyphens, ligatures, etc.
+
        unicodeMap encoding-name map-file
-              Specifies  the  file with mapping from Unicode to encoding-name.
+              Specifies the file with mapping from Unicode  to  encoding-name.
               These encodings are used for text output (see below).  Each line
-              of  a  unicodeMap file represents a range of one or more Unicode
-              characters which maps linearly to a range in the  output  encod-
+              of a unicodeMap file represents a range of one or  more  Unicode
+              characters  which  maps linearly to a range in the output encod-
               ing:
 
                    in-start-hex in-end-hex out-start-hex
@@ -318,54 +325,62 @@
 
                    in-hex out-hex
 
-              The  in-start-hex  and  in-end-hex  fields (or the single in-hex
-              field) specify the Unicode range.  The out-start-hex  field  (or
-              the  out-hex  field)  specifies the start of the output encoding
-              range.  The length of  the  out-start-hex  (or  out-hex)  string
+              The in-start-hex and in-end-hex fields  (or  the  single  in-hex
+              field)  specify  the Unicode range.  The out-start-hex field (or
+              the out-hex field) specifies the start of  the  output  encoding
+              range.   The  length  of  the  out-start-hex (or out-hex) string
               determines the length of the output characters (e.g., UTF-8 uses
-              different numbers of bytes to represent characters in  different
-              ranges).   Entries  must  be  given in increasing Unicode order.
-              Only one file is allowed per encoding; the last  specified  file
-              is  used.   The Latin1, ASCII7, Symbol, ZapfDingbats, UTF-8, and
+              different  numbers of bytes to represent characters in different
+              ranges).  Entries must be given  in  increasing  Unicode  order.
+              Only  one  file is allowed per encoding; the last specified file
+              is used.  The Latin1, ASCII7, Symbol, ZapfDingbats,  UTF-8,  and
               UCS-2 encodings are predefined.
 
        cMapDir registry-ordering dir
-              Specifies a search  directory,  dir,  for  CMaps  for  the  reg-
-              istry-ordering  character  collection.   There  can  be multiple
-              directories for a particular collection.  There are  no  default
+              Specifies  a  search  directory,  dir,  for  CMaps  for the reg-
+              istry-ordering character  collection.   There  can  be  multiple
+              directories  for  a particular collection.  There are no default
               CMap directories.
 
        toUnicodeDir dir
-              Specifies  a  search directory, dir, for ToUnicode CMaps.  There
-              can be multiple ToUnicode directories.   There  are  no  default
+              Specifies a search directory, dir, for ToUnicode  CMaps.   There
+              can  be  multiple  ToUnicode  directories.  There are no default
               ToUnicode directories.
 
        mapNumericCharNames yes | no
-              If  set  to  "yes",  the  Xpdf tools will attempt to map various
+              If set to "yes", the Xpdf tools  will  attempt  to  map  various
               numeric character names sometimes used in font subsets.  In some
-              cases  this leads to usable text, and in other cases it leads to
+              cases this leads to usable text, and in other cases it leads  to
               gibberish -- there is no way for Xpdf to tell.  This defaults to
               "yes".
 
        mapUnknownCharNames yes | no
-              If  set  to  "yes",  and mapNumericCharNames is set to "no", the
-              Xpdf tools will apply a  simple  pass-through  mapping  (Unicode
-              index  = character code) for all unrecognized glyph names.  (For
-              CID fonts, setting mapNumericCharNames to "no" is  unnecessary.)
-              In  some cases, this leads to usable text, and in other cases it
-              leads to gibberish -- there is no way for Xpdf  to  tell.   This
+              If set to "yes", and mapNumericCharNames is  set  to  "no",  the
+              Xpdf  tools  will  apply  a simple pass-through mapping (Unicode
+              index = character code) for all unrecognized glyph names.   (For
+              CID  fonts, setting mapNumericCharNames to "no" is unnecessary.)
+              In some cases, this leads to usable text, and in other cases  it
+              leads  to  gibberish  -- there is no way for Xpdf to tell.  This
               defaults to "no".
 
        mapExtTrueTypeFontsViaUnicode yes | no
               When rasterizing text using an external TrueType font, there are
-              two options for handling character  codes.   If  mapExtTrueType-
-              FontsViaUnicode  is  set to "yes", Xpdf will use the font encod-
-              ing/ToUnicode info to map character codes to Unicode,  and  then
-              use  the font's Unicode cmap to map Unicode to GIDs.  If mapExt-
-              TrueTypeFontsViaUnicode is set to "no",  Xpdf  will  assume  the
-              character  codes are GIDs (i.e., use an identity mapping).  This
+              two  options  for  handling character codes.  If mapExtTrueType-
+              FontsViaUnicode is set to "yes", Xpdf will use the  font  encod-
+              ing/ToUnicode  info  to map character codes to Unicode, and then
+              use the font's Unicode cmap to map Unicode to GIDs.  If  mapExt-
+              TrueTypeFontsViaUnicode  is  set  to  "no", Xpdf will assume the
+              character codes are GIDs (i.e., use an identity mapping).   This
               defaults to "yes".
 
+       dropFont font-name
+              Drop  all  text drawn in the specified font.  To drop text drawn
+              in unnamed fonts, use:
+
+                  dropFont ""
+
+              There can be any number of dropFont commands.
+
 RASTERIZER SETTINGS
        enableFreeType yes | no
               Enables or disables use of FreeType (a TrueType /  Type  1  font
@@ -404,6 +419,11 @@
               (at the expense of allowing gaps and overlaps  between  adjacent
               lines).  This defaults to "yes".
 
+       forceAccurateTiling yes | no
+              If  this is set to "yes", the TilingType is forced to 2 (no dis-
+              tortion) for all tiling patterns, regardless of the  setting  in
+              the pattern dictionary.  This defaults to "no".
+
        screenType dispersed | clustered | stochasticClustered
               Sets  the halftone screen type, which will be used when generat-
               ing a monochrome (1-bit) bitmap.  The  three  options  are  dis-
@@ -476,7 +496,7 @@
        initialSidebarState yes | no
               If set to "yes", xpdf opens with  the  sidebar  (tabs,  outline,
               etc.)   visible.   If  set  to "no", xpdf opens with the sidebar
-              collapsed.  The default is "no".
+              collapsed.  The default is "yes".
 
        paperColor color
               Set the "paper color", i.e., the background of the page display.
@@ -529,6 +549,9 @@
               The string "%s" will be replaced with the movie file name.  This
               has no default value.
 
+       defaultPrinter printer
+              Sets the default printer used in the viewer's print dialog.
+
        bind modifiers-key context command ...
               Add  a  key  or  mouse button binding.  Modifiers can be zero or
               more of:
@@ -595,26 +618,30 @@
               "any" context, and you want to create new key bindings for  mul-
               tiple contexts).
 
+       tabStateFile path
+              Sets the file used by the loadTabState and saveTabState commands
+              (see the xpdf(1) man page for more information).
+
 MISCELLANEOUS SETTINGS
        drawAnnotations yes | no
-              If  set  to "no", annotations will not be drawn or printed.  The
+              If set to "no", annotations will not be drawn or  printed.   The
               default value is "yes".
 
        drawFormFields yes | no
-              If set to "no", form fields will not be drawn or  printed.   The
+              If  set  to "no", form fields will not be drawn or printed.  The
               default value is "yes".
 
        enableXFA yes | no
-              If  set  to  "yes", an XFA form (if present) will be rendered in
-              place of an AcroForm.  If "no", an XFA form will never  be  ren-
+              If set to "yes", an XFA form (if present) will  be  rendered  in
+              place  of  an AcroForm.  If "no", an XFA form will never be ren-
               dered.  This defaults to "yes".
 
        printCommands yes | no
-              If  set  to  "yes", drawing commands are printed as they're exe-
+              If set to "yes", drawing commands are printed  as  they're  exe-
               cuted (useful for debugging).  This defaults to "no".
 
        errQuiet yes | no
-              If set to "yes", this suppresses all error and warning  messages
+              If  set to "yes", this suppresses all error and warning messages
               from all of the Xpdf tools.  This defaults to "no".
 
 EXAMPLES
@@ -654,7 +681,6 @@
        psLevel              level2
        psEmbedType1Fonts    yes
        psEmbedTrueTypeFonts yes
-       psFile               "| lpr -Pprinter5"
 
        # assume that the PostScript printer has the Univers and
        # Univers-Bold fonts
@@ -668,12 +694,11 @@
        # misc options
        enableFreeType  yes
        launchCommand   viewer-script
-       urlCommand      "netscape -remote 'openURL(%s)'"
 
 
 FILES
        /usr/local/etc/xpdfrc
-              This  is  the default location for the system-wide configuration
+              This is the default location for the  system-wide  configuration
               file.  Depending on build options, it may be placed elsewhere.
 
        $HOME/.xpdfrc
@@ -681,14 +706,14 @@
               read in place of the system-wide file.
 
 AUTHOR
-       The  Xpdf  software  and  documentation are copyright 1996-2017 Glyph &
+       The Xpdf software and documentation are  copyright  1996-2019  Glyph  &
        Cog, LLC.
 
 SEE ALSO
-       xpdf(1),  pdftops(1),  pdftotext(1),  pdftohtml(1),  pdfinfo(1),   pdf-
+       xpdf(1),   pdftops(1),  pdftotext(1),  pdftohtml(1),  pdfinfo(1),  pdf-
        fonts(1), pdfdetach(1), pdftoppm(1), pdftopng(1), pdfimages(1)
        http://www.xpdfreader.com/
 
 
 
-                                  10 Aug 2017                        xpdfrc(5)
+                                  18 Feb 2019                        xpdfrc(5)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -543,6 +543,21 @@
   { 0x000002e4, 0x05bcf058,	// MingLiU 1996-
     0x000087c4, 0x28233bf1,
     0x000001e1, 0xa344a1eb },
+  { 0x00000350,	0x12c3ebb2,	// DFGothic-EB
+    0x000087a7, 0xb680ee64,
+    0x00000758, 0xce939563 },
+  { 0x00000350, 0x11e5ead4,	// DFGyoSho-Lt
+    0x0000bc85, 0xce5956e9,
+    0x00000045, 0x8272f416 },
+  { 0x00000350, 0x1262eb4e,	// DFHSGothic-W5
+    0x00007940, 0xe86a5d64,
+    0x000005ff, 0x7850f729 },
+  { 0x00000350, 0x122deb0a,	// DFHSMincho-W3
+    0x0000859b, 0x3d16328a,
+    0x000002cb, 0xa93fc33b },
+  { 0x00000350, 0x125feb26,	// DFHSMincho-W7
+    0x00007ee1, 0xa5acc982,
+    0x0000041f, 0x90999196 },
   { 0x00000350, 0x11e5ead4,	// DFKaiShu
     0x00009063, 0x5a30ca3b,
     0x0000007e, 0x13a42602 },
@@ -590,7 +605,10 @@
     0x000022e0, 0x40745a5f },
   { 0x00000000, 0x00000000,	// NEC FA-RoundGothicM, 1996
     0x000001c2, 0xf055fc48,
-    0x00001e18, 0x3900ded3 }
+    0x00001e18, 0x3900ded3 },
+  { 0x00000060, 0x00170003,	// MINGLI, 1992
+    0x000058aa, 0xdbb4306e,
+    0x00000035, 0xd643482a }
 };
 
 #define nTrickyFonts ((int)(sizeof(trickyFonts) / sizeof(FoFiTrueTypeTrickyFont)))
@@ -965,9 +983,9 @@
   delete ff;
 }
 
-void FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
-			    void *outputStream, char *name,
-			    int *codeToGID) {
+GBool FoFiTrueType::writeTTF(FoFiOutputFunc outputFunc,
+			     void *outputStream, char *name,
+			     int *codeToGID) {
   // this substitute cmap table maps char code ffff to glyph 0,
   // with tables for MacRoman and MS Unicode
   static char cmapTab[44] = {
@@ -1061,7 +1079,7 @@
   int pos, i, j, k, n;
 
   if (openTypeCFF) {
-    return;
+    return gFalse;
   }
 
   // check for missing tables
@@ -1172,7 +1190,8 @@
       nZeroLengthTables == 0 && nBogusTables == 0 &&
       !name && !codeToGID && !isDfont) {
     (*outputFunc)(outputStream, (char *)file, len);
-    goto done1;
+    gfree(locaTable);
+    return gFalse;
   }
 
   // sort the 'loca' table: some (non-compliant) fonts have
@@ -1263,11 +1282,13 @@
       newNameTab[6 + i*12 + 4] = 0x04;	// language ID = American English
       newNameTab[6 + i*12 + 5] = 0x09;
       newNameTab[6 + i*12 + 6] = 0;	// name ID
-      newNameTab[6 + i*12 + 7] = i + 1;
-      newNameTab[6 + i*12 + 8] = i+1 == 2 ? 0 : ((2*n) >> 8); // string length
-      newNameTab[6 + i*12 + 9] = i+1 == 2 ? 14 : ((2*n) & 0xff);
-      newNameTab[6 + i*12 + 10] = next >> 8;		    // string offset
-      newNameTab[6 + i*12 + 11] = next & 0xff;
+      newNameTab[6 + i*12 + 7] = (char)(i + 1);
+      // string length
+      newNameTab[6 + i*12 + 8] = (char)(i+1 == 2 ? 0 : ((2*n) >> 8));
+      newNameTab[6 + i*12 + 9] = (char)(i+1 == 2 ? 14 : ((2*n) & 0xff));
+      // string offset
+      newNameTab[6 + i*12 + 10] = (char)(next >> 8);
+      newNameTab[6 + i*12 + 11] = (char)(next & 0xff);
       if (i+1 == 2) {
 	memcpy(newNameTab + 6 + 4*12 + next, "\0R\0e\0g\0u\0l\0a\0r", 14);
 	next += 14;
@@ -1340,8 +1361,8 @@
 	newCmapTab[44 + 2*i] = 0;
 	newCmapTab[44 + 2*i + 1] = 0;
       } else {
-	newCmapTab[44 + 2*i] = codeToGID[i] >> 8;
-	newCmapTab[44 + 2*i + 1] = codeToGID[i] & 0xff;
+	newCmapTab[44 + 2*i] = (char)(codeToGID[i] >> 8);
+	newCmapTab[44 + 2*i + 1] = (char)(codeToGID[i] & 0xff);
       }
     }
   } else {
@@ -1356,10 +1377,10 @@
     newHHEALen = 36;
     newHHEATab = (char *)gmalloc(newHHEALen);
     for (i = 0; i < newHHEALen; ++i) {
-      newHHEATab[i] = getU8(pos++, &ok);
+      newHHEATab[i] = (char)getU8(pos++, &ok);
     }
-    newHHEATab[34] = nGlyphs >> 8;
-    newHHEATab[35] = nGlyphs & 0xff;
+    newHHEATab[34] = (char)(nGlyphs >> 8);
+    newHHEATab[35] = (char)(nGlyphs & 0xff);
     i = seekTable("hmtx");
     pos = tables[i].offset;
     newHMTXLen = 4 * nGlyphs;
@@ -1369,18 +1390,18 @@
       advWidth = getU16BE(pos, &ok);
       lsb = getU16BE(pos + 2, &ok);
       pos += 4;
-      newHMTXTab[4*i    ] = advWidth >> 8;
-      newHMTXTab[4*i + 1] = advWidth & 0xff;
-      newHMTXTab[4*i + 2] = lsb >> 8;
-      newHMTXTab[4*i + 3] = lsb & 0xff;
+      newHMTXTab[4*i    ] = (char)(advWidth >> 8);
+      newHMTXTab[4*i + 1] = (char)(advWidth & 0xff);
+      newHMTXTab[4*i + 2] = (char)(lsb >> 8);
+      newHMTXTab[4*i + 3] = (char)(lsb & 0xff);
     }
     for (; i < nGlyphs; ++i) {
       lsb = getU16BE(pos, &ok);
       pos += 2;
-      newHMTXTab[4*i    ] = advWidth >> 8;
-      newHMTXTab[4*i + 1] = advWidth & 0xff;
-      newHMTXTab[4*i + 2] = lsb >> 8;
-      newHMTXTab[4*i + 3] = lsb & 0xff;
+      newHMTXTab[4*i    ] = (char)(advWidth >> 8);
+      newHMTXTab[4*i + 1] = (char)(advWidth & 0xff);
+      newHMTXTab[4*i + 2] = (char)(lsb >> 8);
+      newHMTXTab[4*i + 3] = (char)(lsb & 0xff);
     }
   } else {
     newHHEATab = newHMTXTab = NULL;
@@ -1554,10 +1575,10 @@
     if (newTables[i].tag == headTag) {
       if (checkRegion(newTables[i].origOffset, newTables[i].len)) {
 	(*outputFunc)(outputStream, (char *)file + newTables[i].origOffset, 8);
-	checksumBuf[0] = fileChecksum >> 24;
-	checksumBuf[1] = fileChecksum >> 16;
-	checksumBuf[2] = fileChecksum >> 8;
-	checksumBuf[3] = fileChecksum;
+	checksumBuf[0] = (char)(fileChecksum >> 24);
+	checksumBuf[1] = (char)(fileChecksum >> 16);
+	checksumBuf[2] = (char)(fileChecksum >> 8);
+	checksumBuf[3] = (char)fileChecksum;
 	(*outputFunc)(outputStream, checksumBuf, 4);
 	(*outputFunc)(outputStream,
 		      (char *)file + newTables[i].origOffset + 12,
@@ -1636,8 +1657,8 @@
   gfree(newNameTab);
   gfree(tableDir);
   gfree(newTables);
- done1:
   gfree(locaTable);
+  return gTrue;
 }
 
 void FoFiTrueType::cvtEncoding(char **encoding,
@@ -1907,15 +1928,15 @@
 	  checksum = computeTableChecksum(file + tables[j].offset, length);
 	}
       } else if (needVerticalMetrics && i == t42VheaTable) {
-	vheaTab[10] = advance / 256;    // max advance height
-	vheaTab[11] = advance % 256;
+	vheaTab[10] = (Guchar)(advance / 256);    // max advance height
+	vheaTab[11] = (Guchar)(advance % 256);
 	length = sizeof(vheaTab);
 	checksum = computeTableChecksum(vheaTab, length);
       } else if (needVerticalMetrics && i == t42VmtxTable) {
 	length = 4 + (nGlyphs - 1) * 2;
 	vmtxTab = (Guchar *)gmalloc(length);
-	vmtxTab[0] = advance / 256;
-	vmtxTab[1] = advance % 256;
+	vmtxTab[0] = (Guchar)(advance / 256);
+	vmtxTab[1] = (Guchar)(advance % 256);
 	for (j = 2; j < length; j += 2) {
 	  vmtxTab[j] = 0;
 	  vmtxTab[j+1] = 0;
@@ -1950,7 +1971,7 @@
   tableDir[2] = 0x00;
   tableDir[3] = 0x00;
   tableDir[4] = 0;		// numTables
-  tableDir[5] = nNewTables;
+  tableDir[5] = (Guchar)nNewTables;
   tableDir[6] = 0;		// searchRange
   tableDir[7] = (Guchar)128;
   tableDir[8] = 0;		// entrySelector
@@ -2343,12 +2364,9 @@
     if (!ok) {
       goto err;
     }
-    if (n > nGlyphs) {
-      n = nGlyphs;
-    }
     stringIdx = 0;
     stringPos = tablePos + 34 + 2*n;
-    for (i = 0; i < n; ++i) {
+    for (i = 0; i < n && i < nGlyphs; ++i) {
       ok = gTrue;
       j = getU16BE(tablePos + 34 + 2*i, &ok);
       if (j < 258) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiTrueType.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -155,9 +155,9 @@
   // to <name>.  If <codeToGID> is non-NULL, the font is re-encoded,
   // using a Windows Unicode cmap.  If <name> is NULL and the font is
   // complete and correct, it will be written unmodified.  (Not useful
-  // for OpenType CFF fonts.)
-  void writeTTF(FoFiOutputFunc outputFunc, void *outputStream,
-		char *name = NULL, int *codeToGID = NULL);
+  // for OpenType CFF fonts.)  Returns true if the font was modified.
+  GBool writeTTF(FoFiOutputFunc outputFunc, void *outputStream,
+		 char *name = NULL, int *codeToGID = NULL);
 
   // Returns a pointer to the CFF font embedded in this OpenType font.
   // If successful, sets *<start> and *<length>, and returns true.

Modified: trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -195,7 +195,7 @@
   char buf[256];
   char c;
   int n, code, base, i, j;
-  GBool gotMatrix;
+  GBool gotMatrix, startsWithDup, endsWithDup;
 
   gotMatrix = gFalse;
   for (i = 1, line = (char *)file;
@@ -231,9 +231,14 @@
 	strncpy(buf, line, n);
 	buf[n] = '\0';
 	for (p = buf; *p == ' ' || *p == '\t'; ++p) ;
-	if (!strncmp(p, "dup", 3)) {
+	endsWithDup = !strncmp(line - 4, "dup\x0a", 4) ||
+	              !strncmp(line - 5, "dup\x0d", 4);
+	startsWithDup = !strncmp(p, "dup", 3);
+	if (endsWithDup || startsWithDup) {
+	  if (startsWithDup) {
+	    p += 3;
+	  }
 	  while (1) {
-	    p += 3;
 	    for (; *p == ' ' || *p == '\t'; ++p) ;
 	    code = 0;
 	    if (*p == '8' && p[1] == '#') {
@@ -268,6 +273,7 @@
 	    if (strncmp(p, "dup", 3)) {
 	      break;
 	    }
+	    p += 3;
 	  }
 	} else {
 	  if (strtok(buf, " \t") &&

Modified: trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/fofi/FoFiType1C.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -2000,9 +2000,9 @@
   if (top) {
     r2 = 4330;
     for (i = start; i < charBuf->getLength(); ++i) {
-      byte = charBuf->getChar(i) ^ (r2 >> 8);
+      byte = (Guchar)(charBuf->getChar(i) ^ (r2 >> 8));
       charBuf->setChar(i, byte);
-      r2 = (byte + r2) * 52845 + 22719;
+      r2 = (Gushort)((byte + r2) * 52845 + 22719);
     }
   }
 }
@@ -2112,8 +2112,8 @@
   Guchar x;
 
   for (p = (Guchar *)s; *p; ++p) {
-    x = *p ^ (eb->r1 >> 8);
-    eb->r1 = (x + eb->r1) * 52845 + 22719;
+    x = *p ^ (Guchar)(eb->r1 >> 8);
+    eb->r1 = (Gushort)((x + eb->r1) * 52845 + 22719);
     if (eb->ascii) {
       (*eb->outputFunc)(eb->outputStream, &hexChars[x >> 4], 1);
       (*eb->outputFunc)(eb->outputStream, &hexChars[x & 0x0f], 1);
@@ -2135,8 +2135,8 @@
 
   // eexec encryption
   for (i = 0; i < n; ++i) {
-    x = s[i] ^ (eb->r1 >> 8);
-    eb->r1 = (x + eb->r1) * 52845 + 22719;
+    x = s[i] ^ (Guchar)(eb->r1 >> 8);
+    eb->r1 = (Gushort)((x + eb->r1) * 52845 + 22719);
     if (eb->ascii) {
       (*eb->outputFunc)(eb->outputStream, &hexChars[x >> 4], 1);
       (*eb->outputFunc)(eb->outputStream, &hexChars[x & 0x0f], 1);
@@ -2163,14 +2163,14 @@
     c = *p & 0xff;
     if (c == '(' || c == ')' || c == '\\') {
       buf[i++] = '\\';
-      buf[i++] = c;
+      buf[i++] = (char)c;
     } else if (c < 0x20 || c >= 0x80) {
       buf[i++] = '\\';
-      buf[i++] = '0' + ((c >> 6) & 7);
-      buf[i++] = '0' + ((c >> 3) & 7);
-      buf[i++] = '0' + (c & 7);
+      buf[i++] = (char)('0' + ((c >> 6) & 7));
+      buf[i++] = (char)('0' + ((c >> 3) & 7));
+      buf[i++] = (char)('0' + (c & 7));
     } else {
-      buf[i++] = c;
+      buf[i++] = (char)c;
     }
     if (i >= 64) {
       buf[i++] = '\\';
@@ -2596,7 +2596,7 @@
 	  return;
 	}
 	for (j = gid0; j < gid1; ++j) {
-	  fdSelect[j] = fd;
+	  fdSelect[j] = (Guchar)fd;
 	}
 	gid0 = gid1;
       }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/goo/GMutex.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/goo/GMutex.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/goo/GMutex.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -68,8 +68,11 @@
 
 #if defined(_WIN32)
   newVal = _InterlockedIncrement(counter);
-#elif defined(__GNUC__) // this also works for LLVM/clang
+#elif defined(__GNUC__) || defined(__xlC__)
+  // __GNUC__ also covers LLVM/clang
   newVal = __sync_add_and_fetch(counter, 1);
+#elif defined(__SUNPRO_CC)
+  newVal = atomic_inc_ulong_nv((ulong_t *)counter);
 #else
 #  error "gAtomicIncrement is not defined for this compiler/platform"
 #endif
@@ -83,8 +86,11 @@
 
 #if defined(_WIN32)
   newVal = _InterlockedDecrement(counter);
-#elif defined(__GNUC__) // this also works for LLVM/clang
+#elif defined(__GNUC__) || defined(__xlC__)
+  // __GNUC__ also covers LLVM/clang
   newVal = __sync_sub_and_fetch(counter, 1);
+#elif defined(__SUNPRO_CC)
+  newVal = atomic_dec_ulong_nv((ulong_t *)counter);
 #else
 #  error "gAtomicDecrement is not defined for this compiler/platform"
 #endif

Modified: trunk/Build/source/libs/xpdf/xpdf-src/goo/GString.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/goo/GString.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/goo/GString.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -656,7 +656,7 @@
     x2 = floor(0.1 * (x + 0.5));
     d = (int)floor(x - 10 * x2 + 0.5);
     if (started || d != 0) {
-      buf[--i] = '0' + d;
+      buf[--i] = (char)('0' + d);
       started = gTrue;
     }
     x = x2;
@@ -668,7 +668,7 @@
     do {
       x2 = floor(0.1 * (x + 0.5));
       d = (int)floor(x - 10 * x2 + 0.5);
-      buf[--i] = '0' + d;
+      buf[--i] = (char)('0' + d);
       x = x2;
     } while (i > 1 && x);
   }
@@ -757,7 +757,7 @@
 
   for (i = 0; i < length; ++i) {
     if (islower(s[i] & 0xff)) {
-      s[i] = toupper(s[i] & 0xff);
+      s[i] = (char)toupper(s[i] & 0xff);
     }
   }
   return this;
@@ -768,7 +768,7 @@
 
   for (i = 0; i < length; ++i) {
     if (isupper(s[i] & 0xff)) {
-      s[i] = tolower(s[i] & 0xff);
+      s[i] = (char)tolower(s[i] & 0xff);
     }
   }
   return this;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -32,6 +32,7 @@
 #    include <unixlib.h>
 #  endif
 #endif // _WIN32
+#include "gmem.h"
 #include "gmempp.h"
 #include "GString.h"
 #include "gfile.h"
@@ -291,7 +292,7 @@
   char *p;
 
   if ((p = strrchr(fileName, '/')))
-    return new GString(fileName, p - fileName);
+    return new GString(fileName, (int)(p - fileName));
   return new GString();
 #endif
 }
@@ -372,12 +373,12 @@
 #else
       for (p2 = p1; *p2 && *p2 != '/'; ++p2) ;
 #endif
-      if ((n = p2 - p1) > PATH_MAX)
+      if ((n = (int)(p2 - p1)) > PATH_MAX)
 	n = PATH_MAX;
       strncpy(buf, p1, n);
       buf[n] = '\0';
       if ((pw = getpwnam(buf))) {
-	path->del(0, p2 - p1 + 1);
+	path->del(0, (int)(p2 - p1 + 1));
 	path->insert(0, pw->pw_dir);
       }
     }
@@ -488,7 +489,7 @@
       *name = new GString("/tmp");
     }
     (*name)->append("/XXXXXX")->append(ext);
-    fd = mkstemps((*name)->getCString(), strlen(ext));
+    fd = mkstemps((*name)->getCString(), (int)strlen(ext));
 #else
     if (!(s = tmpnam(NULL))) {
       return gFalse;
@@ -522,7 +523,7 @@
   return gTrue;
 #endif
 }
-#endif
+#endif /* !PDF_PARSER_ONLY */
 
 GBool createDir(char *path, int mode) {
 #ifdef _WIN32
@@ -579,7 +580,7 @@
 #endif
 
 FILE *openFile(const char *path, const char *mode) {
-#ifdef _WIN32
+#if defined(_WIN32)
   return fopen(path, mode);
 #if 0
   OSVERSIONINFO version;
@@ -612,7 +613,7 @@
       }
     }
     wPath[i] = (wchar_t)0;
-    for (i = 0; mode[i] && i < sizeof(mode) - 1; ++i) {
+    for (i = 0; mode[i] && i < sizeof(wMode) - 1; ++i) {
       wMode[i] = (wchar_t)(mode[i] & 0xff);
     }
     wMode[i] = (wchar_t)0;
@@ -639,6 +640,8 @@
     return fopen(nPath, mode);
   }
 #endif /* 0 */
+#elif defined(VMS)
+  return fopen(path, mode, "ctx=stm");
 #else
   return fopen(path, mode);
 #endif
@@ -696,3 +699,31 @@
   return ftell(f);
 #endif
 }
+
+#ifndef PDF_PARSER_ONLY
+void fixCommandLine(int *argc, char **argv[]) {
+#ifdef _WIN32
+  int argcw;
+  wchar_t **argvw;
+  GString *arg;
+  int i;
+
+  argvw = CommandLineToArgvW(GetCommandLineW(), &argcw);
+  if (!argvw || argcw < 0) {
+    return;
+  }
+
+  *argc = argcw;
+
+  *argv = (char **)gmallocn(argcw + 1, sizeof(char *));
+  for (i = 0; i < argcw; ++i) {
+    arg = fileNameToUTF8(argvw[i]);
+    (*argv)[i] = copyString(arg->getCString());
+    delete arg;
+  }
+  (*argv)[argcw] = NULL;
+
+  LocalFree(argvw);
+#endif
+}
+#endif /* !PDF_PARSER_ONLY */

Modified: trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/goo/gfile.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -112,4 +112,10 @@
 // Like ftell, but returns a 64-bit file offset if available.
 extern GFileOffset gftell(FILE *f);
 
+// On Windows, this gets the Unicode command line and converts it to
+// UTF-8.  On other systems, this is a nop.
+#ifndef PDF_PARSER_ONLY
+extern void fixCommandLine(int *argc, char **argv[]);
+#endif /* !PDF_PARSER_ONLY */
+
 #endif

Modified: trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -10,6 +10,9 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <stddef.h>
+// older compilers won't define SIZE_MAX in stdint.h without this
+#define __STDC_LIMIT_MACROS 1
+#include <stdint.h>
 #include <string.h>
 #include <limits.h>
 #if MULTITHREADED && defined(_WIN32)
@@ -21,8 +24,8 @@
 
 typedef struct _GMemHdr {
   unsigned int magic;
-  int size;
   int index;
+  size_t size;
   struct _GMemHdr *next, *prev;
 } GMemHdr;
 
@@ -39,15 +42,18 @@
 
 /* round data size so trailer will be aligned */
 #define gMemDataSize(size) \
-  ((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize)
+  (int)(((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize))
 
+#define gMemDataSize64(size) \
+  (size_t)(((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize))
+
 static GMemHdr *gMemHead = NULL;
 static GMemHdr *gMemTail = NULL;
 
 static int gMemIndex = 0;
 static int gMemAlloc = 0;
-static int gMemInUse = 0;
-static int gMaxMemInUse = 0;
+static size_t gMemInUse = 0;
+static size_t gMaxMemInUse = 0;
 
 #if MULTITHREADED
 #  ifdef _WIN32
@@ -161,7 +167,7 @@
   }
   if (p) {
     hdr = (GMemHdr *)((char *)p - gMemHdrSize);
-    oldSize = hdr->size;
+    oldSize = (int)hdr->size;
     q = gmalloc(size);
     memcpy(q, p, size < oldSize ? size : oldSize);
     gfree(p);
@@ -206,6 +212,80 @@
   return gmalloc(n);
 }
 
+#ifdef DEBUG_MEM
+void *gmalloc64(size_t size, int ignore) GMEM_EXCEP {
+  size_t size1;
+  char *mem;
+  GMemHdr *hdr;
+  void *data;
+  unsigned long *trl, *p;
+
+  gMemInitMutex;
+  if (size == 0) {
+    return NULL;
+  }
+  size1 = gMemDataSize64(size);
+  if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) {
+    gMemError("Out of memory");
+  }
+  hdr = (GMemHdr *)mem;
+  data = (void *)(mem + gMemHdrSize);
+  trl = (unsigned long *)(mem + gMemHdrSize + size1);
+  hdr->magic = gMemMagic;
+  hdr->size = size;
+  if (ignore) {
+    hdr->index = -1;
+  } else {
+    hdr->index = gMemIndex++;
+  }
+  gMemLock;
+  if (gMemTail) {
+    gMemTail->next = hdr;
+    hdr->prev = gMemTail;
+    gMemTail = hdr;
+  } else {
+    hdr->prev = NULL;
+    gMemHead = gMemTail = hdr;
+  }
+  hdr->next = NULL;
+  ++gMemAlloc;
+  gMemInUse += size;
+  if (gMemInUse > gMaxMemInUse) {
+    gMaxMemInUse = gMemInUse;
+  }
+  gMemUnlock;
+  for (p = (unsigned long *)data; p <= trl; ++p) {
+    *p = gMemDeadVal;
+  }
+  return data;
+}
+#else
+void *gmalloc64(size_t size) GMEM_EXCEP {
+  void *p;
+
+  if (size == 0) {
+    return NULL;
+  }
+  if (!(p = malloc(size))) {
+    gMemError("Out of memory");
+  }
+  return p;
+}
+#endif
+
+void *gmallocn64(int nObjs, size_t objSize) GMEM_EXCEP {
+  size_t n;
+
+  if (nObjs == 0) {
+    return NULL;
+  }
+  n = nObjs * objSize;
+  if (nObjs < 0 || (size_t)nObjs >= SIZE_MAX / objSize) {
+    gMemError("Bogus memory allocation size");
+  }
+  return gmalloc64(n);
+}
+
 void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP {
   int n;
 
@@ -224,7 +304,7 @@
 
 void gfree(void *p) {
 #ifdef DEBUG_MEM
-  int size;
+  size_t size;
   GMemHdr *hdr;
   unsigned long *trl, *clr;
 
@@ -247,7 +327,7 @@
       --gMemAlloc;
       gMemInUse -= hdr->size;
       gMemUnlock;
-      size = gMemDataSize(hdr->size);
+      size = gMemDataSize64(hdr->size);
       trl = (unsigned long *)((char *)hdr + gMemHdrSize + size);
       if (*trl != gMemDeadVal) {
 	fprintf(stderr, "Overwrite past end of block %d at address %p\n",
@@ -284,7 +364,7 @@
   int left;
 
   fprintf(f, "%d memory allocations in all\n", gMemIndex);
-  fprintf(f, "maximum memory in use: %d bytes\n", gMaxMemInUse);
+  fprintf(f, "maximum memory in use: %zd bytes\n", gMaxMemInUse);
   left = 0;
   if (gMemAlloc > 0) {
     for (p = gMemHead; p; p = p->next) {
@@ -295,7 +375,7 @@
 	  fprintf(f, "-------- --------\n");
 	  left = 1;
 	}
-	fprintf(f, "%8d %8d\n", p->index, p->size);
+	fprintf(f, "%8d %8zd\n", p->index, p->size);
       }
     }
   }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/goo/gmem.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -58,6 +58,17 @@
 extern void *greallocn(void *p, int nObjs, int objSize) GMEM_EXCEP;
 
 /*
+ * Same as gmalloc and gmallocn, but allow a 64-bit size on 64-bit
+ * systems.
+ */
+#ifdef DEBUG_MEM
+extern void *gmalloc64(size_t size, int ignore = 0) GMEM_EXCEP;
+#else
+extern void *gmalloc64(size_t size) GMEM_EXCEP;
+#endif
+extern void *gmallocn64(int nObjs, size_t objSize) GMEM_EXCEP;
+
+/*
  * Same as free, but checks for and ignores NULL pointers.
  */
 extern void gfree(void *p);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -50,7 +50,7 @@
 
 // Clip x to lie in [0, 255].
 static inline Guchar clip255(int x) {
-  return x < 0 ? 0 : x > 255 ? 255 : x;
+  return x < 0 ? 0 : x > 255 ? 255 : (Guchar)x;
 }
 
 // Used by drawImage and fillImageMask to divide the target
@@ -132,8 +132,8 @@
 //------------------------------------------------------------------------
 
 void Splash::clearModRegion() {
-  modXMin = bitmap->getWidth();
-  modYMin = bitmap->getHeight();
+  modXMin = bitmap->width;
+  modYMin = bitmap->height;
   modXMax = -1;
   modYMax = -1;
 }
@@ -163,6 +163,10 @@
 inline void Splash::pipeInit(SplashPipe *pipe, SplashPattern *pattern,
 			     Guchar aInput, GBool usesShape,
 			     GBool nonIsolatedGroup) {
+  SplashColorMode mode;
+
+  mode = bitmap->mode;
+
   pipe->pattern = NULL;
 
   // source color
@@ -195,11 +199,11 @@
   // result color
   if (pipe->noTransparency) {
     // the !state->blendFunc case is handled separately in pipeRun
-    pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[bitmap->mode];
+    pipe->resultColorCtrl = pipeResultColorNoAlphaBlend[mode];
   } else if (!state->blendFunc) {
-    pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[bitmap->mode];
+    pipe->resultColorCtrl = pipeResultColorAlphaNoBlend[mode];
   } else {
-    pipe->resultColorCtrl = pipeResultColorAlphaBlend[bitmap->mode];
+    pipe->resultColorCtrl = pipeResultColorAlphaBlend[mode];
   }
 
   // non-isolated group correction
@@ -208,30 +212,30 @@
   // select the 'run' function
   pipe->run = &Splash::pipeRun;
   if (!pipe->pattern && pipe->noTransparency && !state->blendFunc) {
-    if (bitmap->mode == splashModeMono1 && !bitmap->alpha) {
+    if (mode == splashModeMono1 && !bitmap->alpha) {
       pipe->run = &Splash::pipeRunSimpleMono1;
-    } else if (bitmap->mode == splashModeMono8 && bitmap->alpha) {
+    } else if (mode == splashModeMono8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunSimpleMono8;
-    } else if (bitmap->mode == splashModeRGB8 && bitmap->alpha) {
+    } else if (mode == splashModeRGB8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunSimpleRGB8;
-    } else if (bitmap->mode == splashModeBGR8 && bitmap->alpha) {
+    } else if (mode == splashModeBGR8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunSimpleBGR8;
 #if SPLASH_CMYK
-    } else if (bitmap->mode == splashModeCMYK8 && bitmap->alpha) {
+    } else if (mode == splashModeCMYK8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunSimpleCMYK8;
 #endif
     }
   } else if (!pipe->pattern && pipe->shapeOnly && !state->blendFunc) {
-    if (bitmap->mode == splashModeMono1 && !bitmap->alpha) {
+    if (mode == splashModeMono1 && !bitmap->alpha) {
       pipe->run = &Splash::pipeRunShapeMono1;
-    } else if (bitmap->mode == splashModeMono8 && bitmap->alpha) {
+    } else if (mode == splashModeMono8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunShapeMono8;
-    } else if (bitmap->mode == splashModeRGB8 && bitmap->alpha) {
+    } else if (mode == splashModeRGB8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunShapeRGB8;
-    } else if (bitmap->mode == splashModeBGR8 && bitmap->alpha) {
+    } else if (mode == splashModeBGR8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunShapeBGR8;
 #if SPLASH_CMYK
-    } else if (bitmap->mode == splashModeCMYK8 && bitmap->alpha) {
+    } else if (mode == splashModeCMYK8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunShapeCMYK8;
 #endif
     }
@@ -240,16 +244,16 @@
 	     !(state->inNonIsolatedGroup && groupBackBitmap->alpha) &&
 	     !state->inKnockoutGroup &&
 	     !state->blendFunc && !pipe->nonIsolatedGroup) {
-    if (bitmap->mode == splashModeMono1 && !bitmap->alpha) {
+    if (mode == splashModeMono1 && !bitmap->alpha) {
       pipe->run = &Splash::pipeRunAAMono1;
-    } else if (bitmap->mode == splashModeMono8 && bitmap->alpha) {
+    } else if (mode == splashModeMono8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunAAMono8;
-    } else if (bitmap->mode == splashModeRGB8 && bitmap->alpha) {
+    } else if (mode == splashModeRGB8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunAARGB8;
-    } else if (bitmap->mode == splashModeBGR8 && bitmap->alpha) {
+    } else if (mode == splashModeBGR8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunAABGR8;
 #if SPLASH_CMYK
-    } else if (bitmap->mode == splashModeCMYK8 && bitmap->alpha) {
+    } else if (mode == splashModeCMYK8 && bitmap->alpha) {
       pipe->run = &Splash::pipeRunAACMYK8;
 #endif
     }
@@ -306,13 +310,13 @@
 
   if (bitmap->mode == splashModeMono1) {
     destColorPtr = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)];
-    destColorMask = 0x80 >> (x0 & 7);
+    destColorMask = (Guchar)(0x80 >> (x0 & 7));
   } else {
     destColorPtr = &bitmap->data[y * bitmap->rowSize + x0 * bitmapComps];
     destColorMask = 0; // make gcc happy
   }
   if (bitmap->alpha) {
-    destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+    destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
   } else {
     destAlphaPtr = NULL;
   }
@@ -326,7 +330,7 @@
       color0Ptr =
           &groupBackBitmap->data[(groupBackY + y) * groupBackBitmap->rowSize +
 				 ((groupBackX + x0) >> 3)];
-      color0Mask = 0x80 >> ((groupBackX + x0) & 7);
+      color0Mask = (Guchar)(0x80 >> ((groupBackX + x0) & 7));
     } else {
       color0Ptr =
           &groupBackBitmap->data[(groupBackY + y) * groupBackBitmap->rowSize +
@@ -339,7 +343,8 @@
   }
   if (state->inNonIsolatedGroup && groupBackBitmap->alpha) {
     alpha0Ptr =
-        &groupBackBitmap->alpha[(groupBackY + y) * groupBackBitmap->width +
+        &groupBackBitmap->alpha[(groupBackY + y)
+				  * groupBackBitmap->alphaRowSize +
 				(groupBackX + x0)];
   } else {
     alpha0Ptr = NULL;
@@ -353,7 +358,7 @@
     if (!shape) {
       if (bitmap->mode == splashModeMono1) {
 	destColorPtr += destColorMask & 1;
-	destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+	destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
       } else {
 	destColorPtr += bitmapComps;
       }
@@ -366,7 +371,7 @@
       if (color0Ptr) {
 	if (bitmap->mode == splashModeMono1) {
 	  color0Ptr += color0Mask & 1;
-	  color0Mask = (color0Mask << 7) | (color0Mask >> 1);
+	  color0Mask = (Guchar)((color0Mask << 7) | (color0Mask >> 1));
 	} else {
 	  color0Ptr += bitmapComps;
 	}
@@ -429,7 +434,7 @@
 	case splashModeMono1:
 	  cDest[0] = (*color0Ptr & color0Mask) ? 0xff : 0x00;
 	  color0Ptr += color0Mask & 1;
-	  color0Mask = (color0Mask << 7) | (color0Mask >> 1);
+	  color0Mask = (Guchar)((color0Mask << 7) | (color0Mask >> 1));
 	  break;
 	case splashModeMono8:
 	  cDest[0] = *color0Ptr++;
@@ -576,20 +581,20 @@
 #if SPLASH_CMYK
 	if (bitmap->mode == splashModeCMYK8) {
 	  // convert colors to additive
-	  cSrc2[0] = 0xff - cSrc[0];
-	  cSrc2[1] = 0xff - cSrc[1];
-	  cSrc2[2] = 0xff - cSrc[2];
-	  cSrc2[3] = 0xff - cSrc[3];
-	  cDest2[0] = 0xff - cDest[0];
-	  cDest2[1] = 0xff - cDest[1];
-	  cDest2[2] = 0xff - cDest[2];
-	  cDest2[3] = 0xff - cDest[3];
+	  cSrc2[0] = (Guchar)(0xff - cSrc[0]);
+	  cSrc2[1] = (Guchar)(0xff - cSrc[1]);
+	  cSrc2[2] = (Guchar)(0xff - cSrc[2]);
+	  cSrc2[3] = (Guchar)(0xff - cSrc[3]);
+	  cDest2[0] = (Guchar)(0xff - cDest[0]);
+	  cDest2[1] = (Guchar)(0xff - cDest[1]);
+	  cDest2[2] = (Guchar)(0xff - cDest[2]);
+	  cDest2[3] = (Guchar)(0xff - cDest[3]);
 	  (*state->blendFunc)(cSrc2, cDest2, cBlend, bitmap->mode);
 	  // convert result back to subtractive
-	  cBlend[0] = 0xff - cBlend[0];
-	  cBlend[1] = 0xff - cBlend[1];
-	  cBlend[2] = 0xff - cBlend[2];
-	  cBlend[3] = 0xff - cBlend[3];
+	  cBlend[0] = (Guchar)(0xff - cBlend[0]);
+	  cBlend[1] = (Guchar)(0xff - cBlend[1]);
+	  cBlend[2] = (Guchar)(0xff - cBlend[2]);
+	  cBlend[3] = (Guchar)(0xff - cBlend[3]);
 	} else
 #endif
 	(*state->blendFunc)(cSrc, cDest, cBlend, bitmap->mode);
@@ -607,14 +612,14 @@
 	  // non-isolated, knockout
 	  aResult = aSrc;
 	  alpha0 = *alpha0Ptr++;
-	  alphaI = aSrc + alpha0 - div255(aSrc * alpha0);
+	  alphaI = (Guchar)(aSrc + alpha0 - div255(aSrc * alpha0));
 	  alphaIm1 = alpha0;
 	} else {
 	  // non-isolated, non-knockout
-	  aResult = aSrc + aDest - div255(aSrc * aDest);
+	  aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
 	  alpha0 = *alpha0Ptr++;
-	  alphaI = aResult + alpha0 - div255(aResult * alpha0);
-	  alphaIm1 = alpha0 + aDest - div255(alpha0 * aDest);
+	  alphaI = (Guchar)(aResult + alpha0 - div255(aResult * alpha0));
+	  alphaIm1 = (Guchar)(alpha0 + aDest - div255(alpha0 * aDest));
 	}
       } else {
 	if (color0Ptr) {
@@ -624,7 +629,7 @@
 	  alphaIm1 = 0;
 	} else {
 	  // isolated, non-knockout
-	  aResult = aSrc + aDest - div255(aSrc * aDest);
+	  aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
 	  alphaI = aResult;
 	  alphaIm1 = aDest;
 	}
@@ -655,7 +660,8 @@
 	if (alphaI == 0) {
 	  cResult0 = 0;
 	} else {
-	  cResult0 = ((alphaI - aSrc) * cDest[0] + aSrc * cSrc[0]) / alphaI;
+	  cResult0 = (Guchar)(((alphaI - aSrc) * cDest[0] + aSrc * cSrc[0])
+			      / alphaI);
 	}
 	break;
       case splashPipeResultColorAlphaNoBlendRGB:
@@ -664,9 +670,12 @@
 	  cResult1 = 0;
 	  cResult2 = 0;
 	} else {
-	  cResult0 = ((alphaI - aSrc) * cDest[0] + aSrc * cSrc[0]) / alphaI;
-	  cResult1 = ((alphaI - aSrc) * cDest[1] + aSrc * cSrc[1]) / alphaI;
-	  cResult2 = ((alphaI - aSrc) * cDest[2] + aSrc * cSrc[2]) / alphaI;
+	  cResult0 = (Guchar)(((alphaI - aSrc) * cDest[0] + aSrc * cSrc[0])
+			      / alphaI);
+	  cResult1 = (Guchar)(((alphaI - aSrc) * cDest[1] + aSrc * cSrc[1])
+			      / alphaI);
+	  cResult2 = (Guchar)(((alphaI - aSrc) * cDest[2] + aSrc * cSrc[2])
+			      / alphaI);
 	}
 	break;
 #if SPLASH_CMYK
@@ -677,10 +686,14 @@
 	  cResult2 = 0;
 	  cResult3 = 0;
 	} else {
-	  cResult0 = ((alphaI - aSrc) * cDest[0] + aSrc * cSrc[0]) / alphaI;
-	  cResult1 = ((alphaI - aSrc) * cDest[1] + aSrc * cSrc[1]) / alphaI;
-	  cResult2 = ((alphaI - aSrc) * cDest[2] + aSrc * cSrc[2]) / alphaI;
-	  cResult3 = ((alphaI - aSrc) * cDest[3] + aSrc * cSrc[3]) / alphaI;
+	  cResult0 = (Guchar)(((alphaI - aSrc) * cDest[0] + aSrc * cSrc[0])
+			      / alphaI);
+	  cResult1 = (Guchar)(((alphaI - aSrc) * cDest[1] + aSrc * cSrc[1])
+			      / alphaI);
+	  cResult2 = (Guchar)(((alphaI - aSrc) * cDest[2] + aSrc * cSrc[2])
+			      / alphaI);
+	  cResult3 = (Guchar)(((alphaI - aSrc) * cDest[3] + aSrc * cSrc[3])
+			      / alphaI);
 	}
 	break;
 #endif
@@ -689,10 +702,10 @@
 	if (alphaI == 0) {
 	  cResult0 = 0;
 	} else {
-	  cResult0 = ((alphaI - aSrc) * cDest[0] +
-		      aSrc * ((255 - alphaIm1) * cSrc[0] +
-			      alphaIm1 * cBlend[0]) / 255)
-	             / alphaI;
+	  cResult0 = (Guchar)(((alphaI - aSrc) * cDest[0] +
+			       aSrc * ((255 - alphaIm1) * cSrc[0] +
+				       alphaIm1 * cBlend[0]) / 255)
+			      / alphaI);
 	}
 	break;
       case splashPipeResultColorAlphaBlendRGB:
@@ -701,18 +714,18 @@
 	  cResult1 = 0;
 	  cResult2 = 0;
 	} else {
-	  cResult0 = ((alphaI - aSrc) * cDest[0] +
-		      aSrc * ((255 - alphaIm1) * cSrc[0] +
-			      alphaIm1 * cBlend[0]) / 255)
-	             / alphaI;
-	  cResult1 = ((alphaI - aSrc) * cDest[1] +
-		      aSrc * ((255 - alphaIm1) * cSrc[1] +
-			      alphaIm1 * cBlend[1]) / 255)
-	             / alphaI;
-	  cResult2 = ((alphaI - aSrc) * cDest[2] +
-		      aSrc * ((255 - alphaIm1) * cSrc[2] +
-			      alphaIm1 * cBlend[2]) / 255)
-	             / alphaI;
+	  cResult0 = (Guchar)(((alphaI - aSrc) * cDest[0] +
+			       aSrc * ((255 - alphaIm1) * cSrc[0] +
+				       alphaIm1 * cBlend[0]) / 255)
+			      / alphaI);
+	  cResult1 = (Guchar)(((alphaI - aSrc) * cDest[1] +
+			       aSrc * ((255 - alphaIm1) * cSrc[1] +
+				       alphaIm1 * cBlend[1]) / 255)
+			      / alphaI);
+	  cResult2 = (Guchar)(((alphaI - aSrc) * cDest[2] +
+			       aSrc * ((255 - alphaIm1) * cSrc[2] +
+				       alphaIm1 * cBlend[2]) / 255)
+			      / alphaI);
 	}
 	break;
 #if SPLASH_CMYK
@@ -723,22 +736,22 @@
 	  cResult2 = 0;
 	  cResult3 = 0;
 	} else {
-	  cResult0 = ((alphaI - aSrc) * cDest[0] +
-		      aSrc * ((255 - alphaIm1) * cSrc[0] +
-			      alphaIm1 * cBlend[0]) / 255)
-	             / alphaI;
-	  cResult1 = ((alphaI - aSrc) * cDest[1] +
-		      aSrc * ((255 - alphaIm1) * cSrc[1] +
-			      alphaIm1 * cBlend[1]) / 255)
-	             / alphaI;
-	  cResult2 = ((alphaI - aSrc) * cDest[2] +
-		      aSrc * ((255 - alphaIm1) * cSrc[2] +
-			      alphaIm1 * cBlend[2]) / 255)
-	             / alphaI;
-	  cResult3 = ((alphaI - aSrc) * cDest[3] +
-		      aSrc * ((255 - alphaIm1) * cSrc[3] +
-			      alphaIm1 * cBlend[3]) / 255)
-	             / alphaI;
+	  cResult0 = (Guchar)(((alphaI - aSrc) * cDest[0] +
+			       aSrc * ((255 - alphaIm1) * cSrc[0] +
+				       alphaIm1 * cBlend[0]) / 255)
+			      / alphaI);
+	  cResult1 = (Guchar)(((alphaI - aSrc) * cDest[1] +
+			       aSrc * ((255 - alphaIm1) * cSrc[1] +
+				       alphaIm1 * cBlend[1]) / 255)
+			      / alphaI);
+	  cResult2 = (Guchar)(((alphaI - aSrc) * cDest[2] +
+			       aSrc * ((255 - alphaIm1) * cSrc[2] +
+				       alphaIm1 * cBlend[2]) / 255)
+			      / alphaI);
+	  cResult3 = (Guchar)(((alphaI - aSrc) * cDest[3] +
+			       aSrc * ((255 - alphaIm1) * cSrc[3] +
+				       alphaIm1 * cBlend[3]) / 255)
+			      / alphaI);
 	}
 	break;
 #endif
@@ -753,10 +766,10 @@
       if (state->screen->test(x, y, cResult0)) {
 	*destColorPtr |= destColorMask;
       } else {
-	*destColorPtr &= ~destColorMask;
+	*destColorPtr &= (Guchar)~destColorMask;
       }
       destColorPtr += destColorMask & 1;
-      destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+      destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
       break;
     case splashModeMono8:
       *destColorPtr++ = cResult0;
@@ -819,7 +832,7 @@
   updateModY(y);
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)];
-  destColorMask = 0x80 >> (x0 & 7);
+  destColorMask = (Guchar)(0x80 >> (x0 & 7));
 
   screenCursor = state->screen->getTestCursor(y);
 
@@ -830,10 +843,10 @@
     if (state->screen->testWithCursor(screenCursor, x, cResult0)) {
       *destColorPtr |= destColorMask;
     } else {
-      *destColorPtr &= ~destColorMask;
+      *destColorPtr &= (Guchar)~destColorMask;
     }
     destColorPtr += destColorMask & 1;
-    destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+    destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
 
     cSrcPtr += cSrcStride;
   }
@@ -862,7 +875,7 @@
   updateModY(y);
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -897,7 +910,7 @@
   updateModY(y);
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -935,7 +948,7 @@
   updateModY(y);
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -974,7 +987,7 @@
   updateModY(y);
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1024,7 +1037,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)];
-  destColorMask = 0x80 >> (x0 & 7);
+  destColorMask = (Guchar)(0x80 >> (x0 & 7));
 
   screenCursor = state->screen->getTestCursor(y);
 
@@ -1034,7 +1047,7 @@
     shape = *shapePtr;
     if (!shape) {
       destColorPtr += destColorMask & 1;
-      destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+      destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
       cSrcPtr += cSrcStride;
       ++shapePtr;
       continue;
@@ -1064,10 +1077,10 @@
     if (state->screen->testWithCursor(screenCursor, x, cResult0)) {
       *destColorPtr |= destColorMask;
     } else {
-      *destColorPtr &= ~destColorMask;
+      *destColorPtr &= (Guchar)~destColorMask;
     }
     destColorPtr += destColorMask & 1;
-    destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+    destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
 
     cSrcPtr += cSrcStride;
     ++shapePtr;
@@ -1107,7 +1120,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1147,7 +1160,7 @@
 	cDest0 = *destColorPtr;
 
 	//----- result alpha and non-isolated group element correction
-	aResult = aSrc + aDest - div255(aSrc * aDest);
+	aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
 	alphaI = aResult;
 
 	//----- result color
@@ -1200,7 +1213,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1248,7 +1261,7 @@
 	cDest2 = destColorPtr[2];
 
 	//----- result alpha and non-isolated group element correction
-	aResult = aSrc + aDest - div255(aSrc * aDest);
+	aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
 	alphaI = aResult;
 
 	//----- result color
@@ -1306,7 +1319,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1354,7 +1367,7 @@
 	cDest2 = destColorPtr[0];
 
 	//----- result alpha and non-isolated group element correction
-	aResult = aSrc + aDest - div255(aSrc * aDest);
+	aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
 	alphaI = aResult;
 
 	//----- result color
@@ -1413,7 +1426,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1479,7 +1492,7 @@
       } else {
 
 	//----- result alpha and non-isolated group element correction
-	aResult = aSrc + aDest - div255(aSrc * aDest);
+	aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
 	alphaI = aResult;
 
 	//----- result color
@@ -1541,7 +1554,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + (x0 >> 3)];
-  destColorMask = 0x80 >> (x0 & 7);
+  destColorMask = (Guchar)(0x80 >> (x0 & 7));
 
   screenCursor = state->screen->getTestCursor(y);
 
@@ -1551,7 +1564,7 @@
     shape = *shapePtr;
     if (!shape) {
       destColorPtr += destColorMask & 1;
-      destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+      destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
       cSrcPtr += cSrcStride;
       ++shapePtr;
       continue;
@@ -1575,10 +1588,10 @@
     if (state->screen->testWithCursor(screenCursor, x, cResult0)) {
       *destColorPtr |= destColorMask;
     } else {
-      *destColorPtr &= ~destColorMask;
+      *destColorPtr &= (Guchar)~destColorMask;
     }
     destColorPtr += destColorMask & 1;
-    destColorMask = (destColorMask << 7) | (destColorMask >> 1);
+    destColorMask = (Guchar)((destColorMask << 7) | (destColorMask >> 1));
 
     cSrcPtr += cSrcStride;
     ++shapePtr;
@@ -1620,7 +1633,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1646,7 +1659,7 @@
     aSrc = div255(pipe->aInput * shape);
 
     //----- result alpha and non-isolated group element correction
-    aResult = aSrc + aDest - div255(aSrc * aDest);
+    aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
     alphaI = aResult;
 
     //----- result color
@@ -1703,7 +1716,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1733,7 +1746,7 @@
     aSrc = div255(pipe->aInput * shape);
 
     //----- result alpha and non-isolated group element correction
-    aResult = aSrc + aDest - div255(aSrc * aDest);
+    aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
     alphaI = aResult;
 
     //----- result color
@@ -1797,7 +1810,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 3 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1827,7 +1840,7 @@
     aSrc = div255(pipe->aInput * shape);
 
     //----- result alpha and non-isolated group element correction
-    aResult = aSrc + aDest - div255(aSrc * aDest);
+    aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
     alphaI = aResult;
 
     //----- result color
@@ -1892,7 +1905,7 @@
   lastX = x0;
 
   destColorPtr = &bitmap->data[y * bitmap->rowSize + 4 * x0];
-  destAlphaPtr = &bitmap->alpha[y * bitmap->width + x0];
+  destAlphaPtr = &bitmap->alpha[y * bitmap->alphaRowSize + x0];
 
   for (x = x0; x <= x1; ++x) {
 
@@ -1940,7 +1953,7 @@
     aSrc = div255(pipe->aInput * shape);
 
     //----- result alpha and non-isolated group element correction
-    aResult = aSrc + aDest - div255(aSrc * aDest);
+    aResult = (Guchar)(aSrc + aDest - div255(aSrc * aDest));
     alphaI = aResult;
 
     //----- result color
@@ -2160,11 +2173,19 @@
 }
 
 void Splash::setLineCap(int lineCap) {
-  state->lineCap = lineCap;
+  if (lineCap >= 0 && lineCap <= 2) {
+    state->lineCap = lineCap;
+  } else {
+    state->lineCap = 0;
+  }
 }
 
 void Splash::setLineJoin(int lineJoin) {
-  state->lineJoin = lineJoin;
+  if (lineJoin >= 0 && lineJoin <= 2) {
+    state->lineJoin = lineJoin;
+  } else {
+    state->lineJoin = 0;
+  }
 }
 
 void Splash::setMiterLimit(SplashCoord miterLimit) {
@@ -2225,6 +2246,7 @@
   state->overprintMask = overprintMask;
 }
 
+
 void Splash::setEnablePathSimplification(GBool en) {
   state->enablePathSimplification = en;
 }
@@ -2349,7 +2371,7 @@
   }
 
   if (bitmap->alpha) {
-    memset(bitmap->alpha, alpha, bitmap->width * bitmap->height);
+    memset(bitmap->alpha, alpha, bitmap->alphaRowSize * bitmap->height);
   }
 
   updateModX(0);
@@ -2449,10 +2471,10 @@
   // is smaller, use the min line width
   if (w > 0 && w2 < minLineWidth) {
     strokeWide(path2, minLineWidth / w, splashLineCapButt, splashLineJoinBevel);
-  } else if (bitmap->mode == splashModeMono1) {
-    // in monochrome mode, use 0-width lines for any transformed line
-    // width <= 1 -- lines less than 1 pixel wide look too fat without
-    // antialiasing
+  } else if (bitmap->mode == splashModeMono1 || !vectorAntialias) {
+    // in monochrome mode or if antialiasing is disabled, use 0-width
+    // lines for any transformed line width <= 1 -- lines less than 1
+    // pixel wide look too fat without antialiasing
     if (w2 < 1.001) {
       strokeNarrow(path2);
     } else {
@@ -3251,7 +3273,7 @@
 	    alpha = *p++;
 	    for (xx = 0; xx < 8 && x + xx <= xMax; ++xx) {
 	      scanBuf[x + xx] = (alpha & 0x80) ? 0xff : 0x00;
-	      alpha <<= 1;
+	      alpha = (Guchar)(alpha << 1);
 	    }
 	  }
 	  (this->*pipe.run)(&pipe, xMin, xMax, y, scanBuf + xMin, NULL);
@@ -3285,16 +3307,16 @@
 	      + ((xMin - xg) >> 3);
 	    alpha = *p++;
 	    xx = (xMin - xg) & 7;
-	    alpha <<= xx;
+	    alpha = (Guchar)(alpha << xx);
 	    for (x = xMin; xx < 8 && x <= xMax; ++x, ++xx) {
 	      scanBuf[x] = (alpha & 0x80) ? 255 : 0;
-	      alpha <<= 1;
+	      alpha = (Guchar)(alpha << 1);
 	    }
 	    for (; x <= xMax; x += 8) {
 	      alpha = *p++;
 	      for (xx = 0; xx < 8 && x + xx <= xMax; ++xx) {
 		scanBuf[x + xx] = (alpha & 0x80) ? 255 : 0;
-		alpha <<= 1;
+		alpha = (Guchar)(alpha << 1);
 	      }
 	    }
 	    state->clip->clipSpanBinary(scanBuf, y, xMin, xMax,
@@ -3360,10 +3382,12 @@
   // pixels)
 #if USE_FIXEDPOINT
   if ((wSize > 2 * w && hSize > 2 * h && (int)wSize > 1000000 / (int)hSize) ||
-      (wSize >     w && hSize >     h && (int)wSize > 10000000 / (int)hSize)) {
+      (wSize >     w && hSize >     h && (int)wSize > 10000000 / (int)hSize) ||
+      ((wSize > w || hSize > h) && (int)wSize > 25000000 / (int)hSize)) {
 #else
   if ((wSize > 2 * w && hSize > 2 * h && wSize * hSize > 1000000) ||
-      (wSize >     w && hSize >     h && wSize * hSize > 10000000)) {
+      (wSize >     w && hSize >     h && wSize * hSize > 10000000) ||
+      ((wSize > w || hSize > h) && wSize * hSize > 25000000)) {
     upscaleMask(src, srcData, w, h, mat, glyphMode, interpolate);
 #endif
 
@@ -3540,7 +3564,7 @@
   for (y = 0, p = unscaledImage; y < srcHeight; ++y, p += srcWidth) {
     (*src)(srcData, p);
     for (x = 0; x < srcWidth; ++x) {
-      p[x] *= 255;
+      p[x] = (Guchar)(p[x] * 255);
     }
   }
 
@@ -3623,7 +3647,7 @@
   int xMin, yMin, xMax, yMax;
   ImageSection section[3];
   int nSections;
-  int y, xa, xb, x, i, xx, yy;
+  int bw, y, xa, xb, x, i, xx, yy;
 
   // compute the four vertices of the target quadrilateral
   vx[0] = mat[4];                    vy[0] = mat[5];
@@ -3817,6 +3841,7 @@
   }
 
   // scan all pixels inside the target region
+  bw = bitmap->width;
   for (i = 0; i < nSections; ++i) {
     for (y = section[i].y0; y <= section[i].y1; ++y) {
       xa = splashRound(section[i].xa0 +
@@ -3833,14 +3858,14 @@
 	++xb;
       }
       // check the scanBuf bounds
-      if (xa >= bitmap->width || xb < 0) {
+      if (xa >= bw || xb < 0) {
 	continue;
       }
       if (xa < 0) {
 	xa = 0;
       }
-      if (xb > bitmap->width) {
-	xb = bitmap->width;
+      if (xb > bw) {
+	xb = bw;
       }
       // get the scan line
       for (x = xa; x < xb; ++x) {
@@ -4333,8 +4358,8 @@
   SplashPipe pipe;
   int w, h, x0, x1, y0, y1, y, t;
 
-  w = src->getWidth();
-  h = src->getHeight();
+  w = src->width;
+  h = src->height;
   pipeInit(&pipe, state->fillPattern,
 	   (Guchar)splashRound(state->fillAlpha * 255),
 	   gTrue, gFalse);
@@ -4341,7 +4366,7 @@
   if (clipRes == splashClipAllInside) {
     for (y = 0; y < h; ++y) {
       (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
-			src->getDataPtr() + y * w, NULL);
+			src->data + y * (size_t)w, NULL);
     }
   } else {
     x0 = xDest;
@@ -4363,7 +4388,7 @@
     if (x0 < x1 && y0 < y1) {
       for (y = y0; y < y1; ++y) {
 	memcpy(scanBuf + x0,
-	       src->getDataPtr() + (y - yDest) * w + (x0 - xDest),
+	       src->data + (y - yDest) * (size_t)w + (x0 - xDest),
 	       x1 - x0);
 	if (vectorAntialias) {
 	  state->clip->clipSpan(scanBuf, y, x0, x1 - 1,
@@ -4444,10 +4469,12 @@
   // many pixels)
 #if USE_FIXEDPOINT
   if ((wSize > 2 * w && hSize > 2 * h && (int)wSize > 1000000 / (int)hSize) ||
-      (wSize >     w && hSize >     h && (int)wSize > 10000000 / (int)hSize)) {
+      (wSize >     w && hSize >     h && (int)wSize > 10000000 / (int)hSize) ||
+      ((wSize > w || hSize > h) && (int)wSize > 25000000 / (int)hSize)) {
 #else
   if ((wSize > 2 * w && hSize > 2 * h && wSize * hSize > 1000000) ||
-      (wSize >     w && hSize >     h && wSize * hSize > 10000000)) {
+      (wSize >     w && hSize >     h && wSize * hSize > 10000000) ||
+      ((wSize > w || hSize > h) && wSize * hSize > 25000000)) {
 #endif
     upscaleImage(src, srcData, srcMode, nComps, srcAlpha,
 		 w, h, mat, interpolate);
@@ -5080,7 +5107,7 @@
 
   // allocate buffers
   lineBuf = (Guchar *)gmallocn(srcWidth, nComps);
-  pixBuf = (Guint *)gmallocn(srcWidth, nComps * sizeof(int));
+  pixBuf = (Guint *)gmallocn(srcWidth, (int)(nComps * sizeof(int)));
   if (srcAlpha) {
     alphaLineBuf = (Guchar *)gmalloc(srcWidth);
     alphaPixBuf = (Guint *)gmallocn(srcWidth, sizeof(int));
@@ -5251,7 +5278,7 @@
 
   // allocate buffers
   lineBuf = (Guchar *)gmallocn(srcWidth, nComps);
-  pixBuf = (Guint *)gmallocn(srcWidth, nComps * sizeof(int));
+  pixBuf = (Guint *)gmallocn(srcWidth, (int)(nComps * sizeof(int)));
   if (srcAlpha) {
     alphaLineBuf = (Guchar *)gmalloc(srcWidth);
     alphaPixBuf = (Guint *)gmallocn(srcWidth, sizeof(int));
@@ -5517,7 +5544,7 @@
 #if SPLASH_CMYK
   Guchar pix3;
 #endif
-  Guint alpha;
+  Guchar alpha;
   Guchar *srcPtr, *srcAlphaPtr;
   Guchar *destPtr, *destAlphaPtr;
   int yp, yq, xp, xq, yt, y, yStep, xt, x, xStep;
@@ -5824,7 +5851,7 @@
 
   w = width * nComps;
   lineBuf = (Guchar *)gmalloc(w);
-  for (p0 = img->data, p1 = img->data + (height - 1) * w;
+  for (p0 = img->data, p1 = img->data + (height - 1) * (size_t)w;
        p0 < p1;
        p0 += w, p1 -= w) {
     memcpy(lineBuf, p0, w);
@@ -5832,7 +5859,7 @@
     memcpy(p1, lineBuf, w);
   }
   if (img->alpha) {
-    for (p0 = img->alpha, p1 = img->alpha + (height - 1) * width;
+    for (p0 = img->alpha, p1 = img->alpha + (height - 1) * (size_t)width;
 	 p0 < p1;
 	 p0 += width, p1 -= width) {
       memcpy(lineBuf, p0, width);
@@ -5882,8 +5909,8 @@
   int w, h, x0, y0, x1, y1, y;
 
   // split the image into clipped and unclipped regions
-  w = src->getWidth();
-  h = src->getHeight();
+  w = src->width;
+  h = src->height;
   if (clipRes == splashClipAllInside) {
     x0 = 0;
     y0 = 0;
@@ -5923,15 +5950,14 @@
     if (srcAlpha) {
       for (y = y0; y < y1; ++y) {
 	(this->*pipe.run)(&pipe, xDest + x0, xDest + x1 - 1, yDest + y,
-			  src->getAlphaPtr() + y * w + x0,
-			  src->getDataPtr() + y * src->getRowSize() +
-			    x0 * bitmapComps);
+			  src->alpha + y * src->alphaRowSize + x0,
+			  src->data + y * src->rowSize + x0 * bitmapComps);
       }
     } else {
       for (y = y0; y < y1; ++y) {
 	(this->*pipe.run)(&pipe, xDest + x0, xDest + x1 - 1, yDest + y,
 			  NULL,
-			  src->getDataPtr() + y * src->getRowSize() +
+			  src->data + y * src->getRowSize() +
 			    x0 * bitmapComps);
       }
     }
@@ -5985,7 +6011,7 @@
   if (srcAlpha) {
     for (y = 0; y < h; ++y) {
       memcpy(scanBuf + xDest,
-	     src->getAlphaPtr() + (ySrc + y) * src->getWidth() + xSrc,
+	     src->alpha + (ySrc + y) * src->alphaRowSize + xSrc,
 	     w);
       if (vectorAntialias) {
 	state->clip->clipSpan(scanBuf, yDest + y, xDest, xDest + w - 1,
@@ -5996,7 +6022,7 @@
       }
       (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
 			scanBuf + xDest,
-			src->getDataPtr() + (ySrc + y) * src->getRowSize() +
+			src->data + (ySrc + y) * src->rowSize +
 			  xSrc * bitmapComps);
     }
   } else {
@@ -6011,7 +6037,7 @@
       }
       (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
 			scanBuf + xDest,
-			src->getDataPtr() + (ySrc + y) * src->getRowSize() +
+			src->data + (ySrc + y) * src->rowSize +
 			  xSrc * bitmapComps);
     }
   }
@@ -6041,30 +6067,28 @@
     if (noClip) {
       if (src->alpha) {
 	for (y = 0; y < h; ++y) {
-	  mono1Ptr = src->getDataPtr()
-	             + (ySrc + y) * src->rowSize + (xSrc >> 3);
-	  mono1Mask = 0x80 >> (xSrc & 7);
+	  mono1Ptr = src->data + (ySrc + y) * src->rowSize + (xSrc >> 3);
+	  mono1Mask = (Guchar)(0x80 >> (xSrc & 7));
 	  for (x = 0; x < w; ++x) {
 	    scanBuf[x] = (*mono1Ptr & mono1Mask) ? 0xff : 0x00;
 	    mono1Ptr += mono1Mask & 1;
-	    mono1Mask = (mono1Mask << 7) | (mono1Mask >> 1);
+	    mono1Mask = (Guchar)((mono1Mask << 7) | (mono1Mask >> 1));
 	  }
 	  // this uses shape instead of alpha, which isn't technically
 	  // correct, but works out the same
 	  (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
-			    src->getAlphaPtr() +
-			      (ySrc + y) * src->getWidth() + xSrc,
+			    src->alpha +
+			      (ySrc + y) * src->alphaRowSize + xSrc,
 			    scanBuf);
 	}
       } else {
 	for (y = 0; y < h; ++y) {
-	  mono1Ptr = src->getDataPtr()
-	             + (ySrc + y) * src->rowSize + (xSrc >> 3);
-	  mono1Mask = 0x80 >> (xSrc & 7);
+	  mono1Ptr = src->data + (ySrc + y) * src->rowSize + (xSrc >> 3);
+	  mono1Mask = (Guchar)(0x80 >> (xSrc & 7));
 	  for (x = 0; x < w; ++x) {
 	    scanBuf[x] = (*mono1Ptr & mono1Mask) ? 0xff : 0x00;
 	    mono1Ptr += mono1Mask & 1;
-	    mono1Mask = (mono1Mask << 7) | (mono1Mask >> 1);
+	    mono1Mask = (Guchar)((mono1Mask << 7) | (mono1Mask >> 1));
 	  }
 	  (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
 			    NULL,
@@ -6091,17 +6115,17 @@
       if (x0 < x1 && y0 < y1) {
 	if (src->alpha) {
 	  for (y = y0; y < y1; ++y) {
-	    mono1Ptr = src->getDataPtr()
+	    mono1Ptr = src->data
 	               + (ySrc + y - yDest) * src->rowSize
 	               + ((xSrc + x0 - xDest) >> 3);
-	    mono1Mask = 0x80 >> ((xSrc + x0 - xDest) & 7);
+	    mono1Mask = (Guchar)(0x80 >> ((xSrc + x0 - xDest) & 7));
 	    for (x = x0; x < x1; ++x) {
 	      scanBuf[x] = (*mono1Ptr & mono1Mask) ? 0xff : 0x00;
 	      mono1Ptr += mono1Mask & 1;
-	      mono1Mask = (mono1Mask << 7) | (mono1Mask >> 1);
+	      mono1Mask = (Guchar)((mono1Mask << 7) | (mono1Mask >> 1));
 	    }
 	    memcpy(scanBuf2 + x0,
-		   src->getAlphaPtr() + (ySrc + y - yDest) * src->getWidth() + 
+		   src->alpha + (ySrc + y - yDest) * src->alphaRowSize + 
 		     (xSrc + x0 - xDest),
 		   x1 - x0);
 	    if (!state->clip->clipSpanBinary(scanBuf2, y, x0, x1 - 1,
@@ -6116,14 +6140,14 @@
 	  }
 	} else {
 	  for (y = y0; y < y1; ++y) {
-	    mono1Ptr = src->getDataPtr()
+	    mono1Ptr = src->data
 	               + (ySrc + y - yDest) * src->rowSize
 	               + ((xSrc + x0 - xDest) >> 3);
-	    mono1Mask = 0x80 >> ((xSrc + x0 - xDest) & 7);
+	    mono1Mask = (Guchar)(0x80 >> ((xSrc + x0 - xDest) & 7));
 	    for (x = x0; x < x1; ++x) {
 	      scanBuf[x] = (*mono1Ptr & mono1Mask) ? 0xff : 0x00;
 	      mono1Ptr += mono1Mask & 1;
-	      mono1Mask = (mono1Mask << 7) | (mono1Mask >> 1);
+	      mono1Mask = (Guchar)((mono1Mask << 7) | (mono1Mask >> 1));
 	    }
 	    memset(scanBuf2 + x0, 0xff, x1 - x0);
 	    if (!state->clip->clipSpanBinary(scanBuf2, y, x0, x1 - 1,
@@ -6146,7 +6170,7 @@
       if (src->alpha) {
 	for (y = 0; y < h; ++y) {
 	  memcpy(lineBuf,
-		 src->getDataPtr() + (ySrc + y) * src->rowSize + xSrc * 3,
+		 src->data + (ySrc + y) * src->rowSize + xSrc * 3,
 		 w * 3);
 	  for (x = 0, linePtr = lineBuf; x < w; ++x, linePtr += 3) {
 	    b = linePtr[0];
@@ -6156,14 +6180,14 @@
 	  // this uses shape instead of alpha, which isn't technically
 	  // correct, but works out the same
 	  (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
-			    src->getAlphaPtr() +
-			      (ySrc + y) * src->getWidth() + xSrc,
+			    src->alpha +
+			      (ySrc + y) * src->alphaRowSize + xSrc,
 			    lineBuf);
 	}
       } else {
 	for (y = 0; y < h; ++y) {
 	  memcpy(lineBuf,
-		 src->getDataPtr() + (ySrc + y) * src->rowSize + xSrc * 3,
+		 src->data + (ySrc + y) * src->rowSize + xSrc * 3,
 		 w * 3);
 	  for (x = 0, linePtr = lineBuf; x < w; ++x, linePtr += 3) {
 	    b = linePtr[0];
@@ -6195,12 +6219,12 @@
 	if (src->alpha) {
 	  for (y = y0; y < y1; ++y) {
 	    memcpy(scanBuf + x0,
-		   src->getAlphaPtr() + (ySrc + y - yDest) * src->getWidth() + 
+		   src->alpha + (ySrc + y - yDest) * src->alphaRowSize + 
 		     (xSrc + x0 - xDest),
 		   x1 - x0);
 	    state->clip->clipSpan(scanBuf, y, x0, x1 - 1, state->strokeAdjust);
 	    memcpy(lineBuf,
-		   src->getDataPtr() +
+		   src->data +
 		     (ySrc + y - yDest) * src->rowSize +
 		     (xSrc + x0 - xDest) * 3,
 		   (x1 - x0) * 3);
@@ -6219,7 +6243,7 @@
 	    memset(scanBuf + x0, 0xff, x1 - x0);
 	    state->clip->clipSpan(scanBuf, y, x0, x1 - 1, state->strokeAdjust);
 	    memcpy(lineBuf,
-		   src->getDataPtr() +
+		   src->data +
 		     (ySrc + y - yDest) * src->rowSize +
 		     (xSrc + x0 - xDest) * 3,
 		   (x1 - x0) * 3);
@@ -6230,7 +6254,7 @@
 	    }
 	    (this->*pipe.run)(&pipe, x0, x1 - 1, yDest + y,
 			      scanBuf + x0,
-			      src->getDataPtr() +
+			      src->data +
 			        (ySrc + y - yDest) * src->rowSize +
 			        (xSrc + x0 - xDest) * bitmapComps);
 	  }
@@ -6246,9 +6270,9 @@
 	  // this uses shape instead of alpha, which isn't technically
 	  // correct, but works out the same
 	  (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
-			    src->getAlphaPtr() +
-			      (ySrc + y) * src->getWidth() + xSrc,
-			    src->getDataPtr() + (ySrc + y) * src->rowSize +
+			    src->alpha +
+			      (ySrc + y) * src->alphaRowSize + xSrc,
+			    src->data + (ySrc + y) * src->rowSize +
 			      xSrc * bitmapComps);
 	}
       } else {
@@ -6255,7 +6279,7 @@
 	for (y = 0; y < h; ++y) {
 	  (this->*pipe.run)(&pipe, xDest, xDest + w - 1, yDest + y,
 			    NULL,
-			    src->getDataPtr() + (ySrc + y) * src->rowSize +
+			    src->data + (ySrc + y) * src->rowSize +
 			      xSrc * bitmapComps);
 	}
       }
@@ -6280,7 +6304,7 @@
 	if (src->alpha) {
 	  for (y = y0; y < y1; ++y) {
 	    memcpy(scanBuf + x0,
-		   src->getAlphaPtr() + (ySrc + y - yDest) * src->getWidth() + 
+		   src->alpha + (ySrc + y - yDest) * src->alphaRowSize + 
 		     (xSrc + x0 - xDest),
 		   x1 - x0);
 	    state->clip->clipSpan(scanBuf, y, x0, x1 - 1, state->strokeAdjust);
@@ -6288,7 +6312,7 @@
 	    // correct, but works out the same
 	    (this->*pipe.run)(&pipe, x0, x1 - 1, y,
 			      scanBuf + x0,
-			      src->getDataPtr() +
+			      src->data +
 			        (ySrc + y - yDest) * src->rowSize +
 			        (xSrc + x0 - xDest) * bitmapComps);
 	  }
@@ -6298,7 +6322,7 @@
 	    state->clip->clipSpan(scanBuf, y, x0, x1 - 1, state->strokeAdjust);
 	    (this->*pipe.run)(&pipe, x0, x1 - 1, yDest + y,
 			      scanBuf + x0,
-			      src->getDataPtr() +
+			      src->data +
 			        (ySrc + y - yDest) * src->rowSize +
 			        (xSrc + x0 - xDest) * bitmapComps);
 	  }
@@ -6313,11 +6337,11 @@
 void Splash::compositeBackground(SplashColorPtr color) {
   SplashColorPtr p;
   Guchar *q;
-  Guchar alpha, alpha1, c, color0, color1, color2;
+  Guchar alpha, alpha1, c, color0, color1, color2, mask;
 #if SPLASH_CMYK
   Guchar color3;
 #endif
-  int x, y, mask;
+  int x, y;
 
   switch (bitmap->mode) {
   case splashModeMono1:
@@ -6324,7 +6348,7 @@
     color0 = color[0];
     for (y = 0; y < bitmap->height; ++y) {
       p = &bitmap->data[y * bitmap->rowSize];
-      q = &bitmap->alpha[y * bitmap->width];
+      q = &bitmap->alpha[y * bitmap->alphaRowSize];
       mask = 0x80;
       for (x = 0; x < bitmap->width; ++x) {
 	alpha = *q++;
@@ -6332,19 +6356,19 @@
 	  if (color0 & 0x80) {
 	    *p |= mask;
 	  } else {
-	    *p &= ~mask;
+	    *p &= (Guchar)~mask;
 	  }
 	} else if (alpha != 255) {
-	  alpha1 = 255 - alpha;
+	  alpha1 = (Guchar)(255 - alpha);
 	  c = (*p & mask) ? 0xff : 0x00;
 	  c = div255(alpha1 * color0 + alpha * c);
 	  if (c & 0x80) {
 	    *p |= mask;
 	  } else {
-	    *p &= ~mask;
+	    *p &= (Guchar)~mask;
 	  }
 	}
-	if (!(mask >>= 1)) {
+	if (!(mask = (Guchar)(mask >> 1))) {
 	  mask = 0x80;
 	  ++p;
 	}
@@ -6355,13 +6379,13 @@
     color0 = color[0];
     for (y = 0; y < bitmap->height; ++y) {
       p = &bitmap->data[y * bitmap->rowSize];
-      q = &bitmap->alpha[y * bitmap->width];
+      q = &bitmap->alpha[y * bitmap->alphaRowSize];
       for (x = 0; x < bitmap->width; ++x) {
 	alpha = *q++;
 	if (alpha == 0) {
 	  p[0] = color0;
 	} else if (alpha != 255) {
-	  alpha1 = 255 - alpha;
+	  alpha1 = (Guchar)(255 - alpha);
 	  p[0] = div255(alpha1 * color0 + alpha * p[0]);
 	}
 	++p;
@@ -6375,7 +6399,7 @@
     color2 = color[2];
     for (y = 0; y < bitmap->height; ++y) {
       p = &bitmap->data[y * bitmap->rowSize];
-      q = &bitmap->alpha[y * bitmap->width];
+      q = &bitmap->alpha[y * bitmap->alphaRowSize];
       for (x = 0; x < bitmap->width; ++x) {
 	alpha = *q++;
 	if (alpha == 0) {
@@ -6383,7 +6407,7 @@
 	  p[1] = color1;
 	  p[2] = color2;
 	} else if (alpha != 255) {
-	  alpha1 = 255 - alpha;
+	  alpha1 = (Guchar)(255 - alpha);
 	  p[0] = div255(alpha1 * color0 + alpha * p[0]);
 	  p[1] = div255(alpha1 * color1 + alpha * p[1]);
 	  p[2] = div255(alpha1 * color2 + alpha * p[2]);
@@ -6400,7 +6424,7 @@
     color3 = color[3];
     for (y = 0; y < bitmap->height; ++y) {
       p = &bitmap->data[y * bitmap->rowSize];
-      q = &bitmap->alpha[y * bitmap->width];
+      q = &bitmap->alpha[y * bitmap->alphaRowSize];
       for (x = 0; x < bitmap->width; ++x) {
 	alpha = *q++;
 	if (alpha == 0) {
@@ -6409,7 +6433,7 @@
 	  p[2] = color2;
 	  p[3] = color3;
 	} else if (alpha != 255) {
-	  alpha1 = 255 - alpha;
+	  alpha1 = (Guchar)(255 - alpha);
 	  p[0] = div255(alpha1 * color0 + alpha * p[0]);
 	  p[1] = div255(alpha1 * color1 + alpha * p[1]);
 	  p[2] = div255(alpha1 * color2 + alpha * p[2]);
@@ -6421,13 +6445,14 @@
     break;
 #endif
   }
-  memset(bitmap->alpha, 255, bitmap->width * bitmap->height);
+  memset(bitmap->alpha, 255, bitmap->alphaRowSize * bitmap->height);
 }
 
 SplashError Splash::blitTransparent(SplashBitmap *src, int xSrc, int ySrc,
 				    int xDest, int yDest, int w, int h) {
   SplashColorPtr p, q;
-  int x, y, mask, srcMask;
+  Guchar mask, srcMask;
+  int x, y;
 
   if (src->mode != bitmap->mode) {
     return splashErrModeMismatch;
@@ -6437,20 +6462,20 @@
   case splashModeMono1:
     for (y = 0; y < h; ++y) {
       p = &bitmap->data[(yDest + y) * bitmap->rowSize + (xDest >> 3)];
-      mask = 0x80 >> (xDest & 7);
+      mask = (Guchar)(0x80 >> (xDest & 7));
       q = &src->data[(ySrc + y) * src->rowSize + (xSrc >> 3)];
-      srcMask = 0x80 >> (xSrc & 7);
+      srcMask = (Guchar)(0x80 >> (xSrc & 7));
       for (x = 0; x < w; ++x) {
 	if (*q & srcMask) {
 	  *p |= mask;
 	} else {
-	  *p &= ~mask;
+	  *p &= (Guchar)~mask;
 	}
-	if (!(mask >>= 1)) {
+	if (!(mask = (Guchar)(mask >> 1))) {
 	  mask = 0x80;
 	  ++p;
 	}
-	if (!(srcMask >>= 1)) {
+	if (!(srcMask = (Guchar)(srcMask >> 1))) {
 	  srcMask = 0x80;
 	  ++q;
 	}
@@ -6485,7 +6510,7 @@
 
   if (bitmap->alpha) {
     for (y = 0; y < h; ++y) {
-      q = &bitmap->alpha[(yDest + y) * bitmap->width + xDest];
+      q = &bitmap->alpha[(yDest + y) * bitmap->alphaRowSize + xDest];
       memset(q, 0, w);
     }
   }
@@ -6497,8 +6522,8 @@
 				       int xDest, int yDest, int w, int h) {
   SplashColorPtr p, q;
   Guchar *alpha0Ptr;
-  Guchar alpha0, aSrc;
-  int x, y, mask, srcMask;
+  Guchar alpha0, aSrc, mask, srcMask;
+  int x, y;
 
   if (bitmap->mode != dest->mode ||
       !bitmap->alpha ||
@@ -6511,20 +6536,20 @@
   case splashModeMono1:
     for (y = 0; y < h; ++y) {
       p = &dest->data[(yDest + y) * dest->rowSize + (xDest >> 3)];
-      mask = 0x80 >> (xDest & 7);
+      mask = (Guchar)(0x80 >> (xDest & 7));
       q = &bitmap->data[(ySrc + y) * bitmap->rowSize + (xSrc >> 3)];
-      srcMask = 0x80 >> (xSrc & 7);
+      srcMask = (Guchar)(0x80 >> (xSrc & 7));
       for (x = 0; x < w; ++x) {
 	if (*q & srcMask) {
 	  *p |= mask;
 	} else {
-	  *p &= ~mask;
+	  *p &= (Guchar)~mask;
 	}
-	if (!(mask >>= 1)) {
+	if (!(mask = (Guchar)(mask >> 1))) {
 	  mask = 0x80;
 	  ++p;
 	}
-	if (!(srcMask >>= 1)) {
+	if (!(srcMask = (Guchar)(srcMask >> 1))) {
 	  srcMask = 0x80;
 	  ++q;
 	}
@@ -6558,15 +6583,15 @@
   }
 
   for (y = 0; y < h; ++y) {
-    p = &dest->alpha[(yDest + y) * dest->width + xDest];
-    q = &bitmap->alpha[(ySrc + y) * bitmap->width + xSrc];
+    p = &dest->alpha[(yDest + y) * dest->alphaRowSize + xDest];
+    q = &bitmap->alpha[(ySrc + y) * bitmap->alphaRowSize + xSrc];
     alpha0Ptr = &groupBackBitmap->alpha[(groupBackY + ySrc + y)
-					  * groupBackBitmap->width +
+					  * groupBackBitmap->alphaRowSize +
 					(groupBackX + xSrc)];
     for (x = 0; x < w; ++x) {
       alpha0 = *alpha0Ptr++;
       aSrc = *q++;
-      *p++ = alpha0 + aSrc - div255(alpha0 * aSrc);
+      *p++ = (Guchar)(alpha0 + aSrc - div255(alpha0 * aSrc));
     }
   }
 
@@ -7155,3 +7180,4 @@
 	   path->segs[i].count);
   }
 }
+

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/Splash.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -34,7 +34,7 @@
 // Retrieves the next line of pixels in an image mask.  Normally,
 // fills in *<line> and returns true.  If the image stream is
 // exhausted, returns false.
-typedef GBool (*SplashImageMaskSource)(void *data, SplashColorPtr pixel);
+typedef GBool (*SplashImageMaskSource)(void *data, Guchar *pixel);
 
 // Retrieves the next line of pixels in an image.  Normally, fills in
 // *<line> and returns true.  If the image stream is exhausted,
@@ -42,6 +42,7 @@
 typedef GBool (*SplashImageSource)(void *data, SplashColorPtr colorLine,
 				   Guchar *alphaLine);
 
+
 //------------------------------------------------------------------------
 
 enum SplashPipeResultColorCtrl {
@@ -258,6 +259,7 @@
   void setInShading(GBool sh) { inShading = sh; }
 #endif
 
+
 private:
 
   void pipeInit(SplashPipe *pipe, SplashPattern *pattern,
@@ -410,6 +412,7 @@
   void dumpPath(SplashPath *path);
   void dumpXPath(SplashXPath *path);
 
+
   static SplashPipeResultColorCtrl pipeResultColorNoAlphaBlend[];
   static SplashPipeResultColorCtrl pipeResultColorAlphaNoBlend[];
   static SplashPipeResultColorCtrl pipeResultColorAlphaBlend[];

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -26,54 +26,53 @@
 SplashBitmap::SplashBitmap(int widthA, int heightA, int rowPad,
 			   SplashColorMode modeA, GBool alphaA,
 			   GBool topDown) {
+  // NB: this code checks that rowSize fits in a signed 32-bit
+  // integer, because some code (outside this class) makes that
+  // assumption
   width = widthA;
   height = heightA;
   mode = modeA;
   switch (mode) {
   case splashModeMono1:
-    if (width > 0) {
-      rowSize = (width + 7) >> 3;
-    } else {
-      rowSize = -1;
+    if (width <= 0) {
+      gMemError("invalid bitmap width");
     }
+    rowSize = (width + 7) >> 3;
     break;
   case splashModeMono8:
-    if (width > 0) {
-      rowSize = width;
-    } else {
-      rowSize = -1;
+    if (width <= 0) {
+      gMemError("invalid bitmap width");
     }
+    rowSize = width;
     break;
   case splashModeRGB8:
   case splashModeBGR8:
-    if (width > 0 && width <= INT_MAX / 3) {
-      rowSize = width * 3;
-    } else {
-      rowSize = -1;
+    if (width <= 0 || width > INT_MAX / 3) {
+      gMemError("invalid bitmap width");
     }
+    rowSize = (SplashBitmapRowSize)width * 3;
     break;
 #if SPLASH_CMYK
   case splashModeCMYK8:
-    if (width > 0 && width <= INT_MAX / 4) {
-      rowSize = width * 4;
-    } else {
-      rowSize = -1;
+    if (width <= 0 || width > INT_MAX / 4) {
+      gMemError("invalid bitmap width");
     }
+    rowSize = (SplashBitmapRowSize)width * 4;
     break;
 #endif
   }
-  if (rowSize > 0) {
-    rowSize += rowPad - 1;
-    rowSize -= rowSize % rowPad;
-  }
-  data = (SplashColorPtr)gmallocn(height, rowSize);
+  rowSize += rowPad - 1;
+  rowSize -= rowSize % rowPad;
+  data = (SplashColorPtr)gmallocn64(height, rowSize);
   if (!topDown) {
     data += (height - 1) * rowSize;
     rowSize = -rowSize;
   }
   if (alphaA) {
-    alpha = (Guchar *)gmallocn(width, height);
+    alphaRowSize = width;
+    alpha = (Guchar *)gmallocn64(height, alphaRowSize);
   } else {
+    alphaRowSize = 0;
     alpha = NULL;
   }
 }
@@ -231,7 +230,7 @@
 }
 
 Guchar SplashBitmap::getAlpha(int x, int y) {
-  return alpha[y * width + x];
+  return alpha[y * (size_t)width + x];
 }
 
 SplashColorPtr SplashBitmap::takeData() {
@@ -241,3 +240,4 @@
   data = NULL;
   return data2;
 }
+

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashBitmap.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -16,9 +16,22 @@
 #endif
 
 #include <stdio.h>
+#include <limits.h>
+#include <stdint.h>
 #include "SplashTypes.h"
 
 //------------------------------------------------------------------------
+
+// ssize_t isn't well-defined, so define our own
+#if SIZE_MAX == UINT_MAX
+  typedef int SplashBitmapRowSize;
+# define SplashBitmapRowSizeMax INT_MAX
+#else
+  typedef long long SplashBitmapRowSize;
+# define SplashBitmapRowSizeMax LLONG_MAX
+#endif
+
+//------------------------------------------------------------------------
 // SplashBitmap
 //------------------------------------------------------------------------
 
@@ -37,8 +50,8 @@
 
   int getWidth() { return width; }
   int getHeight() { return height; }
-  int getRowSize() { return rowSize; }
-  int getAlphaRowSize() { return width; }
+  SplashBitmapRowSize getRowSize() { return rowSize; }
+  size_t getAlphaRowSize() { return alphaRowSize; }
   SplashColorMode getMode() { return mode; }
   SplashColorPtr getDataPtr() { return data; }
   Guchar *getAlphaPtr() { return alpha; }
@@ -58,8 +71,9 @@
 private:
 
   int width, height;		// size of bitmap
-  int rowSize;			// size of one row of data, in bytes
+  SplashBitmapRowSize rowSize;	// size of one row of data, in bytes
 				//   - negative for bottom-up bitmaps
+  size_t alphaRowSize;		// size of one row of alpha, in bytes
   SplashColorMode mode;		// color mode
   SplashColorPtr data;		// pointer to row zero of the color data
   Guchar *alpha;		// pointer to row zero of the alpha data
@@ -68,4 +82,5 @@
   friend class Splash;
 };
 
+
 #endif

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFTFont.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFTFont.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFTFont.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -130,13 +130,16 @@
 #else // USE_FIXEDPOINT
   // transform the four corners of the font bounding box -- the min
   // and max values form the bounding box of the transformed font
-  x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMin) /
+  x = (int)((mat[0] * (SplashCoord)face->bbox.xMin
+	     + mat[2] * (SplashCoord)face->bbox.yMin) /
 	    (div * face->units_per_EM));
   xMin = xMax = x;
-  y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMin) /
+  y = (int)((mat[1] * (SplashCoord)face->bbox.xMin
+	     + mat[3] * (SplashCoord)face->bbox.yMin) /
 	    (div * face->units_per_EM));
   yMin = yMax = y;
-  x = (int)((mat[0] * face->bbox.xMin + mat[2] * face->bbox.yMax) /
+  x = (int)((mat[0] * (SplashCoord)face->bbox.xMin
+	     + mat[2] * (SplashCoord)face->bbox.yMax) /
 	    (div * face->units_per_EM));
   if (x < xMin) {
     xMin = x;
@@ -143,7 +146,8 @@
   } else if (x > xMax) {
     xMax = x;
   }
-  y = (int)((mat[1] * face->bbox.xMin + mat[3] * face->bbox.yMax) /
+  y = (int)((mat[1] * (SplashCoord)face->bbox.xMin
+	     + mat[3] * (SplashCoord)face->bbox.yMax) /
 	    (div * face->units_per_EM));
   if (y < yMin) {
     yMin = y;
@@ -150,7 +154,8 @@
   } else if (y > yMax) {
     yMax = y;
   }
-  x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMin) /
+  x = (int)((mat[0] * (SplashCoord)face->bbox.xMax
+	     + mat[2] * (SplashCoord)face->bbox.yMin) /
 	    (div * face->units_per_EM));
   if (x < xMin) {
     xMin = x;
@@ -157,7 +162,8 @@
   } else if (x > xMax) {
     xMax = x;
   }
-  y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMin) /
+  y = (int)((mat[1] * (SplashCoord)face->bbox.xMax
+	     + mat[3] * (SplashCoord)face->bbox.yMin) /
 	    (div * face->units_per_EM));
   if (y < yMin) {
     yMin = y;
@@ -164,7 +170,8 @@
   } else if (y > yMax) {
     yMax = y;
   }
-  x = (int)((mat[0] * face->bbox.xMax + mat[2] * face->bbox.yMax) /
+  x = (int)((mat[0] * (SplashCoord)face->bbox.xMax
+	     + mat[2] * (SplashCoord)face->bbox.yMax) /
 	    (div * face->units_per_EM));
   if (x < xMin) {
     xMin = x;
@@ -171,7 +178,8 @@
   } else if (x > xMax) {
     xMax = x;
   }
-  y = (int)((mat[1] * face->bbox.xMax + mat[3] * face->bbox.yMax) /
+  y = (int)((mat[1] * (SplashCoord)face->bbox.xMax
+	     + mat[3] * (SplashCoord)face->bbox.yMax) /
 	    (div * face->units_per_EM));
   if (y < yMin) {
     yMin = y;
@@ -260,7 +268,10 @@
   //   seems to be very rare (Type 1 fonts are mostly used for
   //   substitution, in which case the full font is being used, which
   //   means we have the glyph names)
-  flags = FT_LOAD_NO_BITMAP;
+  // This also sets the "pedantic" flag, running the FreeType hinter
+  // in paranoid mode.  If that triggers any errors, we disable
+  // hinting below.
+  flags = FT_LOAD_NO_BITMAP | FT_LOAD_PEDANTIC;
   if (ff->engine->flags & splashFTNoHinting) {
     flags |= FT_LOAD_NO_HINTING;
   } else if (ff->fontType == splashFontType1) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFontEngine.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFontEngine.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashFontEngine.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -112,7 +112,7 @@
   }
 #endif
 
-#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32)
+#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32) && !defined(__ANDROID__)
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
   // return an error, leaving the file to be deleted later (if
@@ -148,7 +148,7 @@
   }
 #endif
 
-#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32)
+#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32) && !defined(__ANDROID__)
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
   // return an error, leaving the file to be deleted later (if
@@ -184,7 +184,7 @@
   }
 #endif
 
-#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32)
+#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32) && !defined(__ANDROID__)
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
   // return an error, leaving the file to be deleted later (if
@@ -221,7 +221,7 @@
   }
 #endif
 
-#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32)
+#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32) && !defined(__ANDROID__)
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
   // return an error, leaving the file to be deleted later (if
@@ -258,7 +258,7 @@
   }
 #endif
 
-#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32)
+#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32) && !defined(__ANDROID__)
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
   // return an error, leaving the file to be deleted later (if
@@ -301,7 +301,7 @@
     gfree(codeToGID);
   }
 
-#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32)
+#if !LOAD_FONTS_FROM_MEM && !defined(_WIN32) && !defined(__ANDROID__)
   // delete the (temporary) font file -- with Unix hard link
   // semantics, this will remove the last link; otherwise it will
   // return an error, leaving the file to be deleted later (if

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashMath.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashMath.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashMath.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -347,8 +347,12 @@
     }
 #endif
   }
-  if (x1 == x0) {
-    ++x1;
+  if (x0 == x1) {
+    if (xMin + xMax < 2 * x0) {
+      --x0;
+    } else {
+      ++x1;
+    }
   }
   *xMinI = x0;
   *xMaxI = x1;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPath.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPath.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPath.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -108,7 +108,7 @@
   if (noCurrentPoint()) {
     return splashErrNoCurPt;
   }
-  flags[length-1] &= ~splashPathLast;
+  flags[length-1] &= (Guchar)~splashPathLast;
   grow(1);
   pts[length].x = x;
   pts[length].y = y;
@@ -123,7 +123,7 @@
   if (noCurrentPoint()) {
     return splashErrNoCurPt;
   }
-  flags[length-1] &= ~splashPathLast;
+  flags[length-1] &= (Guchar)~splashPathLast;
   grow(3);
   pts[length].x = x1;
   pts[length].y = y1;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -41,3 +41,4 @@
 void SplashSolidColor::getColor(int x, int y, SplashColorPtr c) {
   splashColorCopy(c, color);
 }
+

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashPattern.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -35,6 +35,7 @@
   // Return the color value for a specific pixel.
   virtual void getColor(int x, int y, SplashColorPtr c) = 0;
 
+
   // Returns true if this pattern object will return the same color
   // value for all pixels.
   virtual GBool isStatic() = 0;
@@ -64,4 +65,5 @@
   SplashColor color;
 };
 
+
 #endif

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashScreen.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashScreen.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashScreen.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -113,8 +113,9 @@
     white = 255;
   }
   for (i = 0; i < size * size; ++i) {
-    u = splashRound((SplashCoord)255.0 *
-		    splashPow((SplashCoord)mat[i] / 255.0, params->gamma));
+    u = (Guchar)splashRound((SplashCoord)255.0 *
+			    splashPow((SplashCoord)mat[i] / 255.0,
+				      params->gamma));
     if (u < black) {
       u = (Guchar)black;
     } else if (u >= white) {
@@ -133,7 +134,8 @@
 					int delta, int offset) {
   if (delta == 0) {
     // map values in [1, size^2] --> [1, 255]
-    mat[(i << log2Size) + j] = 1 + (254 * (val - 1)) / (size * size - 1);
+    mat[(i << log2Size) + j] =
+        (Guchar)(1 + (254 * (val - 1)) / (size * size - 1));
   } else {
     buildDispersedMatrix(i, j,
 			 val, delta / 2, 4*offset);
@@ -203,9 +205,9 @@
       }
     }
     // map values in [0, 2*size*size2-1] --> [1, 255]
-    val = 1 + (254 * (2*i)) / (2*size*size2 - 1);
+    val = (Guchar)(1 + (254 * (2*i)) / (2*size*size2 - 1));
     mat[(y1 << log2Size) + x1] = val;
-    val = 1 + (254 * (2*i+1)) / (2*size*size2 - 1);
+    val = (Guchar)(1 + (254 * (2*i+1)) / (2*size*size2 - 1));
     if (y1 < size2) {
       mat[((y1 + size2) << log2Size) + x1 + size2] = val;
     } else {
@@ -354,7 +356,8 @@
 #endif
     for (j = 0; j < n; ++j) {
       // map values in [0 .. n-1] --> [255 .. 1]
-      mat[(pts[j].y << log2Size) + pts[j].x] = 255 - (254 * j) / (n - 1);
+      mat[(pts[j].y << log2Size) + pts[j].x] =
+	  (Guchar)(255 - (254 * j) / (n - 1));
     }
   }
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -285,10 +285,11 @@
   memcpy(grayTransfer, gray, 256);
 #if SPLASH_CMYK
   for (i = 0; i < 256; ++i) {
-    cmykTransferC[i] = 255 - rgbTransferR[255 - i];
-    cmykTransferM[i] = 255 - rgbTransferG[255 - i];
-    cmykTransferY[i] = 255 - rgbTransferB[255 - i];
-    cmykTransferK[i] = 255 - grayTransfer[255 - i];
+    cmykTransferC[i] = (Guchar)(255 - rgbTransferR[255 - i]);
+    cmykTransferM[i] = (Guchar)(255 - rgbTransferG[255 - i]);
+    cmykTransferY[i] = (Guchar)(255 - rgbTransferB[255 - i]);
+    cmykTransferK[i] = (Guchar)(255 - grayTransfer[255 - i]);
   }
 #endif
 }
+

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashState.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -86,6 +86,7 @@
   // Set the transfer function.
   void setTransfer(Guchar *red, Guchar *green, Guchar *blue, Guchar *gray);
 
+
 private:
 
   SplashState(SplashState *state);
@@ -125,6 +126,7 @@
   Guint overprintMask;
   GBool enablePathSimplification;
 
+
   SplashState *next;		// used by Splash class
 
   friend class Splash;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashTypes.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashTypes.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/splash/SplashTypes.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -141,4 +141,5 @@
 
 typedef int SplashError;
 
+
 #endif

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/AcroForm.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -875,14 +875,15 @@
   GString *appearBuf;
   Object appearance, mkObj, ftObj, appearDict, drObj, apObj, asObj;
   Object resources, fontResources, defaultFont, gfxStateDict;
-  Object obj1, obj2, obj3;
+  Object obj1, obj2, obj3, obj4;
   Dict *mkDict;
   MemStream *appearStream;
   GfxFontDict *fontDict;
   GBool hasCaption;
   double dx, dy, r;
-  GString *caption, *da;
+  GString *val, *caption, *da;
   GString **text;
+  GBool done;
   GBool *selection;
   AnnotBorderType borderType;
   double borderWidth;
@@ -1200,10 +1201,7 @@
     }
   } else if (ftObj.isName("Tx")) {
     //~ value strings can be Unicode
-    if (!fieldLookup("V", &obj1)->isString()) {
-      obj1.free();
-      fieldLookup("DV", &obj1);
-    }
+    fieldLookup("V", &obj1);
     if (obj1.isString()) {
       if (fieldLookup("Q", &obj2)->isInt()) {
 	quadding = obj2.getInt();
@@ -1235,9 +1233,30 @@
     // combo box
     if (flags & acroFormFlagCombo) {
       if (fieldLookup("V", &obj1)->isString()) {
-	drawText(obj1.getString(), da, fontDict,
+	val = obj1.getString()->copy();
+	if (fieldObj.dictLookup("Opt", &obj2)->isArray()) {
+	  for (i = 0, done = false; i < obj2.arrayGetLength() && !done; ++i) {
+	    obj2.arrayGet(i, &obj3);
+	    if (obj3.isArray() && obj3.arrayGetLength() == 2) {
+	      if (obj3.arrayGet(0, &obj4)->isString() &&
+		  obj4.getString()->cmp(val) == 0) {
+		obj4.free();
+		if (obj3.arrayGet(1, &obj4)->isString()) {
+		  delete val;
+		  val = obj4.getString()->copy();
+		}
+		done = gTrue;
+	      }
+	      obj4.free();
+	    }
+	    obj3.free();
+	  }
+	}
+	obj2.free();
+	drawText(val, da, fontDict,
 		 gFalse, 0, quadding, gTrue, gFalse, rot,
 		 xMin, yMin, xMax, yMax, borderWidth, appearBuf);
+	delete val;
 	//~ Acrobat draws a popup icon on the right side
       }
       obj1.free();
@@ -1470,6 +1489,12 @@
   } else {
     text2 = text;
   }
+  if (text2->getLength() == 0) {
+    if (text2 != text) {
+      delete text2;
+    }
+    return;
+  }
 
   // parse the default appearance string
   tfPos = tmPos = -1;
@@ -1630,11 +1655,11 @@
 	c = text2->getChar(i) & 0xff;
 	if (c == '(' || c == ')' || c == '\\') {
 	  appearBuf->append('\\');
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	} else if (c < 0x20 || c >= 0x80) {
 	  appearBuf->appendf("\\{0:03o}", c);
 	} else {
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	}
       }
       appearBuf->append(") Tj\n");
@@ -1716,11 +1741,11 @@
 	c = text2->getChar(i) & 0xff;
 	if (c == '(' || c == ')' || c == '\\') {
 	  appearBuf->append('\\');
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	} else if (c < 0x20 || c >= 0x80) {
 	  appearBuf->appendf("{0:.4f} 0 Td\n", w);
 	} else {
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	}
 	appearBuf->append(") Tj\n");
       }
@@ -1798,11 +1823,11 @@
 	c = text2->getChar(i) & 0xff;
 	if (c == '(' || c == ')' || c == '\\') {
 	  appearBuf->append('\\');
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	} else if (c < 0x20 || c >= 0x80) {
 	  appearBuf->appendf("\\{0:03o}", c);
 	} else {
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	}
       }
       appearBuf->append(") Tj\n");
@@ -1986,11 +2011,11 @@
       c = text[i]->getChar(j) & 0xff;
       if (c == '(' || c == ')' || c == '\\') {
 	appearBuf->append('\\');
-	appearBuf->append(c);
+	appearBuf->append((char)c);
       } else if (c < 0x20 || c >= 0x80) {
 	appearBuf->appendf("\\{0:03o}", c);
       } else {
-	appearBuf->append(c);
+	appearBuf->append((char)c);
       }
     }
     appearBuf->append(") Tj\n");
@@ -2027,7 +2052,7 @@
       break;
     }
     if (font && !font->isCIDFont()) {
-      dw = ((Gfx8BitFont *)font)->getWidth(c) * fontSize;
+      dw = ((Gfx8BitFont *)font)->getWidth((Guchar)c) * fontSize;
     } else {
       // otherwise, make a crude estimate
       dw = 0.5 * fontSize;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Annot.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1287,11 +1287,11 @@
     c = text2->getChar(i) & 0xff;
     if (c == '(' || c == ')' || c == '\\') {
       appearBuf->append('\\');
-      appearBuf->append(c);
+      appearBuf->append((char)c);
     } else if (c < 0x20 || c >= 0x80) {
       appearBuf->appendf("\\{0:03o}", c);
     } else {
-      appearBuf->append(c);
+      appearBuf->append((char)c);
     }
   }
   appearBuf->append(") Tj\n");

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -51,7 +51,7 @@
   ++length;
 }
 
-Object *Array::get(int i, Object *obj) {
+Object *Array::get(int i, Object *obj, int recursion) {
   if (i < 0 || i >= length) {
 #ifdef DEBUG_MEM
     abort();
@@ -59,7 +59,7 @@
     return obj->initNull();
 #endif
   }
-  return elems[i].fetch(xref, obj);
+  return elems[i].fetch(xref, obj, recursion);
 }
 
 Object *Array::getNF(int i, Object *obj) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Array.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -37,11 +37,11 @@
 
   // Reference counting.
 #if MULTITHREADED
-  int incRef() { return gAtomicIncrement(&ref); }
-  int decRef() { return gAtomicDecrement(&ref); }
+  long incRef() { return gAtomicIncrement(&ref); }
+  long decRef() { return gAtomicDecrement(&ref); }
 #else
-  int incRef() { return ++ref; }
-  int decRef() { return --ref; }
+  long incRef() { return ++ref; }
+  long decRef() { return --ref; }
 #endif
 
   // Get number of elements.
@@ -51,7 +51,7 @@
   void add(Object *elem);
 
   // Accessors.
-  Object *get(int i, Object *obj);
+  Object *get(int i, Object *obj, int recursion = 0);
   Object *getNF(int i, Object *obj);
 
 private:
@@ -63,7 +63,7 @@
 #if MULTITHREADED
   GAtomicCounter ref;		// reference count
 #else
-  int ref;			// reference count
+  long ref;			// reference count
 #endif
 };
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFont.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -25,6 +25,7 @@
 struct BuiltinFont {
   const char *name;
   const char **defaultBaseEnc;
+  short missingWidth;
   short ascent;
   short descent;
   short bbox[4];

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFontTables.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFontTables.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/BuiltinFontTables.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -2,7 +2,7 @@
 //
 // BuiltinFontTables.cc
 //
-// Copyright 2001-2003 Glyph & Cog, LLC
+// Copyright 2001-2017 Glyph & Cog, LLC
 //
 //========================================================================
 
@@ -13,4235 +13,4235 @@
 #include "BuiltinFontTables.h"
 
 static BuiltinFontWidth courierWidthsTab[] = {
-  { "Ntilde",                            600, NULL },
-  { "rcaron",                            600, NULL },
-  { "kcommaaccent",                      600, NULL },
+  { "odieresis",                         600, NULL },
+  { "M",                                 600, NULL },
+  { "Ograve",                            600, NULL },
+  { "T",                                 600, NULL },
+  { "amacron",                           600, NULL },
   { "Ncommaaccent",                      600, NULL },
-  { "Zacute",                            600, NULL },
-  { "comma",                             600, NULL },
-  { "cedilla",                           600, NULL },
-  { "plusminus",                         600, NULL },
+  { "numbersign",                        600, NULL },
+  { "emacron",                           600, NULL },
+  { "divide",                            600, NULL },
+  { "fl",                                600, NULL },
+  { "E",                                 600, NULL },
+  { "quotedblbase",                      600, NULL },
+  { "guillemotleft",                     600, NULL },
+  { "endash",                            600, NULL },
+  { "w",                                 600, NULL },
+  { "twosuperior",                       600, NULL },
+  { "eth",                               600, NULL },
+  { "space",                             600, NULL },
+  { "Thorn",                             600, NULL },
+  { "ecaron",                            600, NULL },
+  { "brokenbar",                         600, NULL },
+  { "Aogonek",                           600, NULL },
+  { "commaaccent",                       600, NULL },
+  { "W",                                 600, NULL },
+  { "bracketright",                      600, NULL },
+  { "germandbls",                        600, NULL },
+  { "Ugrave",                            600, NULL },
+  { "thorn",                             600, NULL },
+  { "zero",                              600, NULL },
+  { "udieresis",                         600, NULL },
+  { "period",                            600, NULL },
+  { "scedilla",                          600, NULL },
+  { "Ccedilla",                          600, NULL },
+  { "Igrave",                            600, NULL },
+  { "Ocircumflex",                       600, NULL },
+  { "F",                                 600, NULL },
+  { "Uring",                             600, NULL },
+  { "perthousand",                       600, NULL },
+  { "Edotaccent",                        600, NULL },
+  { "acircumflex",                       600, NULL },
+  { "G",                                 600, NULL },
   { "circumflex",                        600, NULL },
+  { "Zcaron",                            600, NULL },
+  { "ogonek",                            600, NULL },
+  { "idieresis",                         600, NULL },
+  { "cent",                              600, NULL },
+  { "ae",                                600, NULL },
+  { "less",                              600, NULL },
+  { "ocircumflex",                       600, NULL },
+  { "minus",                             600, NULL },
+  { "four",                              600, NULL },
+  { "dollar",                            600, NULL },
+  { "Tcommaaccent",                      600, NULL },
   { "dotaccent",                         600, NULL },
-  { "edotaccent",                        600, NULL },
-  { "asciitilde",                        600, NULL },
-  { "colon",                             600, NULL },
-  { "onehalf",                           600, NULL },
-  { "dollar",                            600, NULL },
-  { "Lcaron",                            600, NULL },
-  { "ntilde",                            600, NULL },
-  { "Aogonek",                           600, NULL },
-  { "ncommaaccent",                      600, NULL },
-  { "minus",                             600, NULL },
-  { "Iogonek",                           600, NULL },
-  { "zacute",                            600, NULL },
+  { "Nacute",                            600, NULL },
+  { "v",                                 600, NULL },
+  { "Kcommaaccent",                      600, NULL },
+  { "imacron",                           600, NULL },
+  { "rcommaaccent",                      600, NULL },
+  { "tilde",                             600, NULL },
+  { "underscore",                        600, NULL },
+  { "racute",                            600, NULL },
+  { "mu",                                600, NULL },
+  { "D",                                 600, NULL },
+  { "Ccaron",                            600, NULL },
+  { "j",                                 600, NULL },
+  { "hungarumlaut",                      600, NULL },
+  { "Y",                                 600, NULL },
   { "yen",                               600, NULL },
-  { "space",                             600, NULL },
+  { "ccaron",                            600, NULL },
+  { "lessequal",                         600, NULL },
+  { "Ucircumflex",                       600, NULL },
   { "Omacron",                           600, NULL },
-  { "questiondown",                      600, NULL },
+  { "quotesinglbase",                    600, NULL },
+  { "Scedilla",                          600, NULL },
+  { "grave",                             600, NULL },
+  { "parenleft",                         600, NULL },
+  { "nine",                              600, NULL },
+  { "currency",                          600, NULL },
+  { "radical",                           600, NULL },
+  { "Ntilde",                            600, NULL },
+  { "p",                                 600, NULL },
+  { "dotlessi",                          600, NULL },
+  { "cedilla",                           600, NULL },
+  { "Idotaccent",                        600, NULL },
+  { "plusminus",                         600, NULL },
+  { "Eth",                               600, NULL },
+  { "quotedblright",                     600, NULL },
+  { "ccedilla",                          600, NULL },
+  { "colon",                             600, NULL },
+  { "g",                                 600, NULL },
+  { "oe",                                600, NULL },
+  { "Odieresis",                         600, NULL },
+  { "five",                              600, NULL },
+  { "asciicircum",                       600, NULL },
+  { "X",                                 600, NULL },
   { "emdash",                            600, NULL },
-  { "Agrave",                            600, NULL },
-  { "three",                             600, NULL },
-  { "numbersign",                        600, NULL },
+  { "Egrave",                            600, NULL },
+  { "aogonek",                           600, NULL },
+  { "ring",                              600, NULL },
+  { "Dcaron",                            600, NULL },
+  { "ecircumflex",                       600, NULL },
+  { "Z",                                 600, NULL },
+  { "breve",                             600, NULL },
+  { "Amacron",                           600, NULL },
+  { "zcaron",                            600, NULL },
+  { "paragraph",                         600, NULL },
   { "lcaron",                            600, NULL },
-  { "A",                                 600, NULL },
-  { "B",                                 600, NULL },
-  { "C",                                 600, NULL },
-  { "aogonek",                           600, NULL },
-  { "D",                                 600, NULL },
-  { "E",                                 600, NULL },
-  { "onequarter",                        600, NULL },
-  { "F",                                 600, NULL },
-  { "G",                                 600, NULL },
-  { "H",                                 600, NULL },
-  { "I",                                 600, NULL },
-  { "J",                                 600, NULL },
+  { "Ydieresis",                         600, NULL },
+  { "aring",                             600, NULL },
+  { "iogonek",                           600, NULL },
+  { "florin",                            600, NULL },
+  { "Euro",                              600, NULL },
+  { "Scaron",                            600, NULL },
+  { "degree",                            600, NULL },
+  { "section",                           600, NULL },
   { "K",                                 600, NULL },
-  { "iogonek",                           600, NULL },
-  { "L",                                 600, NULL },
-  { "backslash",                         600, NULL },
-  { "periodcentered",                    600, NULL },
-  { "M",                                 600, NULL },
-  { "N",                                 600, NULL },
-  { "omacron",                           600, NULL },
-  { "Tcommaaccent",                      600, NULL },
-  { "O",                                 600, NULL },
-  { "P",                                 600, NULL },
-  { "Q",                                 600, NULL },
-  { "Uhungarumlaut",                     600, NULL },
-  { "R",                                 600, NULL },
   { "Aacute",                            600, NULL },
-  { "caron",                             600, NULL },
-  { "S",                                 600, NULL },
-  { "T",                                 600, NULL },
-  { "U",                                 600, NULL },
-  { "agrave",                            600, NULL },
-  { "V",                                 600, NULL },
-  { "W",                                 600, NULL },
-  { "equal",                             600, NULL },
-  { "question",                          600, NULL },
-  { "X",                                 600, NULL },
-  { "Y",                                 600, NULL },
-  { "Z",                                 600, NULL },
-  { "four",                              600, NULL },
-  { "a",                                 600, NULL },
-  { "Gcommaaccent",                      600, NULL },
+  { "Scommaaccent",                      600, NULL },
   { "b",                                 600, NULL },
-  { "c",                                 600, NULL },
-  { "d",                                 600, NULL },
+  { "greater",                           600, NULL },
+  { "asterisk",                          600, NULL },
+  { "scommaaccent",                      600, NULL },
+  { "Emacron",                           600, NULL },
+  { "onesuperior",                       600, NULL },
+  { "percent",                           600, NULL },
+  { "o",                                 600, NULL },
+  { "icircumflex",                       600, NULL },
+  { "iacute",                            600, NULL },
   { "e",                                 600, NULL },
-  { "f",                                 600, NULL },
-  { "g",                                 600, NULL },
-  { "bullet",                            600, NULL },
-  { "h",                                 600, NULL },
-  { "i",                                 600, NULL },
-  { "Oslash",                            600, NULL },
+  { "Imacron",                           600, NULL },
+  { "abreve",                            600, NULL },
+  { "N",                                 600, NULL },
+  { "equal",                             600, NULL },
   { "dagger",                            600, NULL },
-  { "j",                                 600, NULL },
-  { "k",                                 600, NULL },
+  { "u",                                 600, NULL },
+  { "C",                                 600, NULL },
   { "l",                                 600, NULL },
-  { "m",                                 600, NULL },
-  { "n",                                 600, NULL },
-  { "tcommaaccent",                      600, NULL },
-  { "o",                                 600, NULL },
-  { "ordfeminine",                       600, NULL },
-  { "ring",                              600, NULL },
-  { "p",                                 600, NULL },
   { "q",                                 600, NULL },
+  { "quoteleft",                         600, NULL },
+  { "registered",                        600, NULL },
+  { "Gcommaaccent",                      600, NULL },
+  { "Racute",                            600, NULL },
+  { "k",                                 600, NULL },
+  { "copyright",                         600, NULL },
+  { "onehalf",                           600, NULL },
+  { "lcommaaccent",                      600, NULL },
   { "uhungarumlaut",                     600, NULL },
-  { "r",                                 600, NULL },
-  { "twosuperior",                       600, NULL },
-  { "aacute",                            600, NULL },
-  { "s",                                 600, NULL },
-  { "OE",                                600, NULL },
-  { "t",                                 600, NULL },
-  { "divide",                            600, NULL },
-  { "u",                                 600, NULL },
-  { "Ccaron",                            600, NULL },
-  { "v",                                 600, NULL },
-  { "w",                                 600, NULL },
-  { "x",                                 600, NULL },
-  { "y",                                 600, NULL },
-  { "z",                                 600, NULL },
-  { "Gbreve",                            600, NULL },
-  { "commaaccent",                       600, NULL },
-  { "hungarumlaut",                      600, NULL },
-  { "Idotaccent",                        600, NULL },
-  { "Nacute",                            600, NULL },
-  { "quotedbl",                          600, NULL },
-  { "gcommaaccent",                      600, NULL },
-  { "mu",                                600, NULL },
+  { "gbreve",                            600, NULL },
+  { "n",                                 600, NULL },
+  { "Ecaron",                            600, NULL },
+  { "zdotaccent",                        600, NULL },
+  { "threesuperior",                     600, NULL },
+  { "Uacute",                            600, NULL },
+  { "Zacute",                            600, NULL },
+  { "atilde",                            600, NULL },
+  { "fraction",                          600, NULL },
+  { "Adieresis",                         600, NULL },
+  { "Sacute",                            600, NULL },
+  { "asciitilde",                        600, NULL },
+  { "lacute",                            600, NULL },
+  { "Uogonek",                           600, NULL },
+  { "caron",                             600, NULL },
+  { "Lslash",                            600, NULL },
+  { "sterling",                          600, NULL },
+  { "H",                                 600, NULL },
+  { "at",                                600, NULL },
   { "greaterequal",                      600, NULL },
-  { "Scaron",                            600, NULL },
-  { "Lslash",                            600, NULL },
-  { "semicolon",                         600, NULL },
+  { "J",                                 600, NULL },
+  { "threequarters",                     600, NULL },
+  { "ohungarumlaut",                     600, NULL },
+  { "Ecircumflex",                       600, NULL },
+  { "L",                                 600, NULL },
+  { "Agrave",                            600, NULL },
+  { "exclam",                            600, NULL },
+  { "AE",                                600, NULL },
+  { "notequal",                          600, NULL },
   { "oslash",                            600, NULL },
-  { "lessequal",                         600, NULL },
-  { "lozenge",                           600, NULL },
+  { "Acircumflex",                       600, NULL },
+  { "ograve",                            600, NULL },
+  { "Rcommaaccent",                      600, NULL },
+  { "Lacute",                            600, NULL },
+  { "Idieresis",                         600, NULL },
+  { "sacute",                            600, NULL },
+  { "f",                                 600, NULL },
+  { "gcommaaccent",                      600, NULL },
+  { "bracketleft",                       600, NULL },
+  { "Ohungarumlaut",                     600, NULL },
+  { "otilde",                            600, NULL },
   { "parenright",                        600, NULL },
-  { "ccaron",                            600, NULL },
-  { "Ecircumflex",                       600, NULL },
-  { "gbreve",                            600, NULL },
-  { "trademark",                         600, NULL },
-  { "daggerdbl",                         600, NULL },
-  { "nacute",                            600, NULL },
+  { "questiondown",                      600, NULL },
+  { "Lcaron",                            600, NULL },
+  { "ordmasculine",                      600, NULL },
+  { "backslash",                         600, NULL },
+  { "Eogonek",                           600, NULL },
   { "macron",                            600, NULL },
-  { "Otilde",                            600, NULL },
-  { "Emacron",                           600, NULL },
+  { "three",                             600, NULL },
+  { "slash",                             600, NULL },
+  { "r",                                 600, NULL },
+  { "ucircumflex",                       600, NULL },
+  { "zacute",                            600, NULL },
+  { "Umacron",                           600, NULL },
+  { "adieresis",                         600, NULL },
+  { "ncaron",                            600, NULL },
+  { "V",                                 600, NULL },
+  { "lozenge",                           600, NULL },
+  { "exclamdown",                        600, NULL },
+  { "Q",                                 600, NULL },
+  { "uogonek",                           600, NULL },
+  { "quoteright",                        600, NULL },
+  { "guilsinglright",                    600, NULL },
+  { "semicolon",                         600, NULL },
+  { "egrave",                            600, NULL },
+  { "s",                                 600, NULL },
+  { "uring",                             600, NULL },
+  { "z",                                 600, NULL },
+  { "Uhungarumlaut",                     600, NULL },
+  { "I",                                 600, NULL },
+  { "one",                               600, NULL },
+  { "eight",                             600, NULL },
+  { "periodcentered",                    600, NULL },
+  { "d",                                 600, NULL },
+  { "c",                                 600, NULL },
+  { "agrave",                            600, NULL },
   { "ellipsis",                          600, NULL },
-  { "scaron",                            600, NULL },
-  { "AE",                                600, NULL },
-  { "Ucircumflex",                       600, NULL },
+  { "Aring",                             600, NULL },
+  { "t",                                 600, NULL },
+  { "quotedbl",                          600, NULL },
+  { "Oacute",                            600, NULL },
+  { "edotaccent",                        600, NULL },
+  { "six",                               600, NULL },
   { "lslash",                            600, NULL },
-  { "quotedblleft",                      600, NULL },
-  { "hyphen",                            600, NULL },
-  { "guilsinglright",                    600, NULL },
+  { "P",                                 600, NULL },
+  { "i",                                 600, NULL },
+  { "multiply",                          600, NULL },
+  { "bar",                               600, NULL },
   { "quotesingle",                       600, NULL },
-  { "eight",                             600, NULL },
-  { "exclamdown",                        600, NULL },
-  { "endash",                            600, NULL },
-  { "oe",                                600, NULL },
-  { "Abreve",                            600, NULL },
-  { "Umacron",                           600, NULL },
-  { "ecircumflex",                       600, NULL },
-  { "Adieresis",                         600, NULL },
-  { "copyright",                         600, NULL },
-  { "Egrave",                            600, NULL },
-  { "slash",                             600, NULL },
+  { "acute",                             600, NULL },
+  { "braceright",                        600, NULL },
+  { "braceleft",                         600, NULL },
+  { "onequarter",                        600, NULL },
+  { "Atilde",                            600, NULL },
   { "Edieresis",                         600, NULL },
-  { "otilde",                            600, NULL },
-  { "Idieresis",                         600, NULL },
-  { "parenleft",                         600, NULL },
-  { "one",                               600, NULL },
-  { "emacron",                           600, NULL },
-  { "Odieresis",                         600, NULL },
-  { "ucircumflex",                       600, NULL },
-  { "bracketleft",                       600, NULL },
-  { "Ugrave",                            600, NULL },
-  { "quoteright",                        600, NULL },
-  { "Udieresis",                         600, NULL },
-  { "perthousand",                       600, NULL },
-  { "Ydieresis",                         600, NULL },
-  { "umacron",                           600, NULL },
-  { "abreve",                            600, NULL },
-  { "Eacute",                            600, NULL },
-  { "adieresis",                         600, NULL },
-  { "egrave",                            600, NULL },
+  { "oacute",                            600, NULL },
+  { "Yacute",                            600, NULL },
+  { "daggerdbl",                         600, NULL },
+  { "ncommaaccent",                      600, NULL },
+  { "logicalnot",                        600, NULL },
+  { "tcommaaccent",                      600, NULL },
+  { "Dcroat",                            600, NULL },
+  { "cacute",                            600, NULL },
+  { "tcaron",                            600, NULL },
+  { "rcaron",                            600, NULL },
+  { "Iogonek",                           600, NULL },
+  { "y",                                 600, NULL },
   { "edieresis",                         600, NULL },
-  { "idieresis",                         600, NULL },
-  { "Eth",                               600, NULL },
-  { "ae",                                600, NULL },
-  { "asterisk",                          600, NULL },
-  { "odieresis",                         600, NULL },
-  { "Uacute",                            600, NULL },
-  { "ugrave",                            600, NULL },
-  { "five",                              600, NULL },
-  { "nine",                              600, NULL },
-  { "udieresis",                         600, NULL },
-  { "Zcaron",                            600, NULL },
-  { "Scommaaccent",                      600, NULL },
-  { "threequarters",                     600, NULL },
-  { "guillemotright",                    600, NULL },
-  { "Ccedilla",                          600, NULL },
-  { "ydieresis",                         600, NULL },
-  { "tilde",                             600, NULL },
-  { "at",                                600, NULL },
-  { "eacute",                            600, NULL },
-  { "underscore",                        600, NULL },
-  { "Euro",                              600, NULL },
-  { "Dcroat",                            600, NULL },
-  { "zero",                              600, NULL },
-  { "multiply",                          600, NULL },
-  { "eth",                               600, NULL },
-  { "Scedilla",                          600, NULL },
-  { "Racute",                            600, NULL },
-  { "Ograve",                            600, NULL },
+  { "x",                                 600, NULL },
+  { "Ncaron",                            600, NULL },
+  { "OE",                                600, NULL },
+  { "m",                                 600, NULL },
+  { "U",                                 600, NULL },
   { "partialdiff",                       600, NULL },
-  { "uacute",                            600, NULL },
-  { "braceleft",                         600, NULL },
-  { "Thorn",                             600, NULL },
-  { "zcaron",                            600, NULL },
-  { "scommaaccent",                      600, NULL },
-  { "ccedilla",                          600, NULL },
-  { "Dcaron",                            600, NULL },
   { "dcroat",                            600, NULL },
-  { "scedilla",                          600, NULL },
-  { "Oacute",                            600, NULL },
-  { "Ocircumflex",                       600, NULL },
-  { "ogonek",                            600, NULL },
-  { "ograve",                            600, NULL },
-  { "racute",                            600, NULL },
+  { "igrave",                            600, NULL },
+  { "summation",                         600, NULL },
+  { "question",                          600, NULL },
+  { "A",                                 600, NULL },
+  { "Cacute",                            600, NULL },
+  { "h",                                 600, NULL },
+  { "guilsinglleft",                     600, NULL },
+  { "plus",                              600, NULL },
+  { "Otilde",                            600, NULL },
+  { "umacron",                           600, NULL },
   { "Tcaron",                            600, NULL },
-  { "Eogonek",                           600, NULL },
-  { "thorn",                             600, NULL },
-  { "degree",                            600, NULL },
-  { "registered",                        600, NULL },
-  { "radical",                           600, NULL },
-  { "Aring",                             600, NULL },
-  { "percent",                           600, NULL },
-  { "six",                               600, NULL },
-  { "paragraph",                         600, NULL },
+  { "aacute",                            600, NULL },
+  { "B",                                 600, NULL },
+  { "R",                                 600, NULL },
+  { "ydieresis",                         600, NULL },
+  { "Rcaron",                            600, NULL },
+  { "kcommaaccent",                      600, NULL },
+  { "yacute",                            600, NULL },
   { "dcaron",                            600, NULL },
-  { "Uogonek",                           600, NULL },
-  { "two",                               600, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            600, NULL },
-  { "Lacute",                            600, NULL },
-  { "ocircumflex",                       600, NULL },
-  { "oacute",                            600, NULL },
-  { "Uring",                             600, NULL },
-  { "Lcommaaccent",                      600, NULL },
-  { "tcaron",                            600, NULL },
-  { "eogonek",                           600, NULL },
+  { "ugrave",                            600, NULL },
+  { "a",                                 600, NULL },
+  { "hyphen",                            600, NULL },
+  { "Oslash",                            600, NULL },
+  { "comma",                             600, NULL },
   { "Delta",                             600, NULL },
-  { "Ohungarumlaut",                     600, NULL },
-  { "asciicircum",                       600, NULL },
-  { "aring",                             600, NULL },
-  { "grave",                             600, NULL },
-  { "uogonek",                           600, NULL },
-  { "bracketright",                      600, NULL },
+  { "omacron",                           600, NULL },
+  { "Gbreve",                            600, NULL },
+  { "S",                                 600, NULL },
+  { "quotedblleft",                      600, NULL },
+  { "ordfeminine",                       600, NULL },
   { "ampersand",                         600, NULL },
-  { "Iacute",                            600, NULL },
-  { "lacute",                            600, NULL },
-  { "igrave",                            600, NULL },
-  { "Ncaron",                            600, NULL },
-  { "plus",                              600, NULL },
-  { "uring",                             600, NULL },
-  { "quotesinglbase",                    600, NULL },
-  { "lcommaaccent",                      600, NULL },
-  { "Yacute",                            600, NULL },
-  { "ohungarumlaut",                     600, NULL },
-  { "threesuperior",                     600, NULL },
-  { "acute",                             600, NULL },
-  { "section",                           600, NULL },
+  { "trademark",                         600, NULL },
+  { "Lcommaaccent",                      600, NULL },
+  { "ntilde",                            600, NULL },
+  { "fi",                                600, NULL },
   { "dieresis",                          600, NULL },
-  { "quotedblbase",                      600, NULL },
-  { "iacute",                            600, NULL },
-  { "ncaron",                            600, NULL },
-  { "florin",                            600, NULL },
-  { "yacute",                            600, NULL },
-  { "Rcommaaccent",                      600, NULL },
-  { "fi",                                600, NULL },
-  { "fl",                                600, NULL },
-  { "Acircumflex",                       600, NULL },
-  { "Cacute",                            600, NULL },
+  { "Eacute",                            600, NULL },
+  { "nacute",                            600, NULL },
+  { "O",                                 600, NULL },
   { "Icircumflex",                       600, NULL },
-  { "guillemotleft",                     600, NULL },
-  { "germandbls",                        600, NULL },
+  { "Udieresis",                         600, NULL },
+  { "Abreve",                            600, NULL },
+  { "Iacute",                            600, NULL },
+  { "uacute",                            600, NULL },
+  { "two",                               600, NULL },
   { "seven",                             600, NULL },
-  { "Amacron",                           600, NULL },
-  { "Sacute",                            600, NULL },
-  { "ordmasculine",                      600, NULL },
-  { "dotlessi",                          600, NULL },
-  { "sterling",                          600, NULL },
-  { "notequal",                          600, NULL },
-  { "Imacron",                           600, NULL },
-  { "rcommaaccent",                      600, NULL },
-  { "Zdotaccent",                        600, NULL },
-  { "acircumflex",                       600, NULL },
-  { "cacute",                            600, NULL },
-  { "Ecaron",                            600, NULL },
-  { "braceright",                        600, NULL },
-  { "icircumflex",                       600, NULL },
-  { "quotedblright",                     600, NULL },
-  { "amacron",                           600, NULL },
-  { "sacute",                            600, NULL },
-  { "imacron",                           600, NULL },
-  { "cent",                              600, NULL },
-  { "currency",                          600, NULL },
-  { "logicalnot",                        600, NULL },
-  { "zdotaccent",                        600, NULL },
-  { "Atilde",                            600, NULL },
-  { "breve",                             600, NULL },
-  { "bar",                               600, NULL },
-  { "fraction",                          600, NULL },
-  { "less",                              600, NULL },
-  { "ecaron",                            600, NULL },
-  { "guilsinglleft",                     600, NULL },
-  { "exclam",                            600, NULL },
-  { "period",                            600, NULL },
-  { "Rcaron",                            600, NULL },
-  { "Kcommaaccent",                      600, NULL },
-  { "greater",                           600, NULL },
-  { "atilde",                            600, NULL },
-  { "brokenbar",                         600, NULL },
-  { "quoteleft",                         600, NULL },
-  { "Edotaccent",                        600, NULL },
-  { "onesuperior",                       600, NULL }
+  { "scaron",                            600, NULL },
+  { "guillemotright",                    600, NULL },
+  { "bullet",                            600, NULL },
+  { "eogonek",                           600, NULL },
+  { "eacute",                            600, NULL },
+  { "Zdotaccent",                        600, NULL }
 };
 
 static BuiltinFontWidth courierBoldWidthsTab[] = {
-  { "Ntilde",                            600, NULL },
-  { "rcaron",                            600, NULL },
-  { "kcommaaccent",                      600, NULL },
-  { "Ncommaaccent",                      600, NULL },
-  { "Zacute",                            600, NULL },
-  { "comma",                             600, NULL },
-  { "cedilla",                           600, NULL },
-  { "plusminus",                         600, NULL },
-  { "circumflex",                        600, NULL },
-  { "dotaccent",                         600, NULL },
-  { "edotaccent",                        600, NULL },
-  { "asciitilde",                        600, NULL },
-  { "colon",                             600, NULL },
-  { "onehalf",                           600, NULL },
-  { "dollar",                            600, NULL },
-  { "Lcaron",                            600, NULL },
-  { "ntilde",                            600, NULL },
-  { "Aogonek",                           600, NULL },
-  { "ncommaaccent",                      600, NULL },
-  { "minus",                             600, NULL },
-  { "Iogonek",                           600, NULL },
-  { "zacute",                            600, NULL },
-  { "yen",                               600, NULL },
-  { "space",                             600, NULL },
-  { "Omacron",                           600, NULL },
-  { "questiondown",                      600, NULL },
-  { "emdash",                            600, NULL },
-  { "Agrave",                            600, NULL },
-  { "three",                             600, NULL },
-  { "numbersign",                        600, NULL },
-  { "lcaron",                            600, NULL },
-  { "A",                                 600, NULL },
-  { "B",                                 600, NULL },
-  { "C",                                 600, NULL },
-  { "aogonek",                           600, NULL },
-  { "D",                                 600, NULL },
-  { "E",                                 600, NULL },
-  { "onequarter",                        600, NULL },
-  { "F",                                 600, NULL },
-  { "G",                                 600, NULL },
-  { "H",                                 600, NULL },
+  { "t",                                 600, NULL },
+  { "quotedbl",                          600, NULL },
+  { "Oacute",                            600, NULL },
+  { "agrave",                            600, NULL },
+  { "ellipsis",                          600, NULL },
+  { "Aring",                             600, NULL },
+  { "eight",                             600, NULL },
   { "I",                                 600, NULL },
-  { "J",                                 600, NULL },
-  { "K",                                 600, NULL },
-  { "iogonek",                           600, NULL },
-  { "backslash",                         600, NULL },
-  { "L",                                 600, NULL },
+  { "one",                               600, NULL },
   { "periodcentered",                    600, NULL },
-  { "M",                                 600, NULL },
-  { "N",                                 600, NULL },
-  { "omacron",                           600, NULL },
-  { "Tcommaaccent",                      600, NULL },
-  { "O",                                 600, NULL },
-  { "P",                                 600, NULL },
-  { "Q",                                 600, NULL },
-  { "Uhungarumlaut",                     600, NULL },
-  { "R",                                 600, NULL },
-  { "Aacute",                            600, NULL },
-  { "caron",                             600, NULL },
-  { "S",                                 600, NULL },
-  { "T",                                 600, NULL },
-  { "U",                                 600, NULL },
-  { "agrave",                            600, NULL },
-  { "V",                                 600, NULL },
-  { "W",                                 600, NULL },
-  { "X",                                 600, NULL },
-  { "question",                          600, NULL },
-  { "equal",                             600, NULL },
-  { "Y",                                 600, NULL },
-  { "Z",                                 600, NULL },
-  { "four",                              600, NULL },
-  { "a",                                 600, NULL },
-  { "Gcommaaccent",                      600, NULL },
-  { "b",                                 600, NULL },
   { "c",                                 600, NULL },
   { "d",                                 600, NULL },
-  { "e",                                 600, NULL },
-  { "f",                                 600, NULL },
-  { "g",                                 600, NULL },
-  { "bullet",                            600, NULL },
-  { "h",                                 600, NULL },
-  { "i",                                 600, NULL },
-  { "Oslash",                            600, NULL },
-  { "dagger",                            600, NULL },
-  { "j",                                 600, NULL },
-  { "k",                                 600, NULL },
-  { "l",                                 600, NULL },
-  { "m",                                 600, NULL },
-  { "n",                                 600, NULL },
-  { "tcommaaccent",                      600, NULL },
-  { "o",                                 600, NULL },
-  { "ordfeminine",                       600, NULL },
-  { "ring",                              600, NULL },
-  { "p",                                 600, NULL },
-  { "q",                                 600, NULL },
-  { "uhungarumlaut",                     600, NULL },
-  { "r",                                 600, NULL },
-  { "twosuperior",                       600, NULL },
-  { "aacute",                            600, NULL },
+  { "egrave",                            600, NULL },
+  { "uring",                             600, NULL },
   { "s",                                 600, NULL },
-  { "OE",                                600, NULL },
-  { "t",                                 600, NULL },
-  { "divide",                            600, NULL },
-  { "u",                                 600, NULL },
-  { "Ccaron",                            600, NULL },
-  { "v",                                 600, NULL },
-  { "w",                                 600, NULL },
-  { "x",                                 600, NULL },
-  { "y",                                 600, NULL },
   { "z",                                 600, NULL },
-  { "Gbreve",                            600, NULL },
-  { "commaaccent",                       600, NULL },
-  { "hungarumlaut",                      600, NULL },
-  { "Idotaccent",                        600, NULL },
-  { "Nacute",                            600, NULL },
-  { "quotedbl",                          600, NULL },
-  { "gcommaaccent",                      600, NULL },
-  { "mu",                                600, NULL },
-  { "greaterequal",                      600, NULL },
-  { "Scaron",                            600, NULL },
-  { "Lslash",                            600, NULL },
+  { "Uhungarumlaut",                     600, NULL },
+  { "uogonek",                           600, NULL },
+  { "quoteright",                        600, NULL },
   { "semicolon",                         600, NULL },
-  { "oslash",                            600, NULL },
-  { "lessequal",                         600, NULL },
+  { "guilsinglright",                    600, NULL },
+  { "Umacron",                           600, NULL },
+  { "zacute",                            600, NULL },
+  { "ncaron",                            600, NULL },
+  { "adieresis",                         600, NULL },
   { "lozenge",                           600, NULL },
-  { "parenright",                        600, NULL },
-  { "ccaron",                            600, NULL },
-  { "Ecircumflex",                       600, NULL },
-  { "gbreve",                            600, NULL },
-  { "trademark",                         600, NULL },
-  { "daggerdbl",                         600, NULL },
-  { "nacute",                            600, NULL },
-  { "macron",                            600, NULL },
-  { "Otilde",                            600, NULL },
-  { "Emacron",                           600, NULL },
-  { "ellipsis",                          600, NULL },
-  { "scaron",                            600, NULL },
-  { "AE",                                600, NULL },
-  { "Ucircumflex",                       600, NULL },
-  { "lslash",                            600, NULL },
-  { "quotedblleft",                      600, NULL },
-  { "guilsinglright",                    600, NULL },
-  { "hyphen",                            600, NULL },
-  { "quotesingle",                       600, NULL },
-  { "eight",                             600, NULL },
+  { "V",                                 600, NULL },
+  { "Q",                                 600, NULL },
   { "exclamdown",                        600, NULL },
-  { "endash",                            600, NULL },
-  { "oe",                                600, NULL },
-  { "Abreve",                            600, NULL },
-  { "Umacron",                           600, NULL },
-  { "ecircumflex",                       600, NULL },
-  { "Adieresis",                         600, NULL },
-  { "copyright",                         600, NULL },
-  { "Egrave",                            600, NULL },
+  { "three",                             600, NULL },
   { "slash",                             600, NULL },
-  { "Edieresis",                         600, NULL },
+  { "r",                                 600, NULL },
+  { "ucircumflex",                       600, NULL },
+  { "macron",                            600, NULL },
+  { "Eogonek",                           600, NULL },
+  { "Lcaron",                            600, NULL },
+  { "ordmasculine",                      600, NULL },
+  { "questiondown",                      600, NULL },
+  { "backslash",                         600, NULL },
+  { "gcommaaccent",                      600, NULL },
+  { "Ohungarumlaut",                     600, NULL },
+  { "bracketleft",                       600, NULL },
   { "otilde",                            600, NULL },
+  { "parenright",                        600, NULL },
+  { "f",                                 600, NULL },
+  { "Lacute",                            600, NULL },
   { "Idieresis",                         600, NULL },
-  { "parenleft",                         600, NULL },
-  { "one",                               600, NULL },
-  { "emacron",                           600, NULL },
-  { "Odieresis",                         600, NULL },
-  { "ucircumflex",                       600, NULL },
-  { "bracketleft",                       600, NULL },
-  { "Ugrave",                            600, NULL },
-  { "quoteright",                        600, NULL },
-  { "Udieresis",                         600, NULL },
-  { "perthousand",                       600, NULL },
-  { "Ydieresis",                         600, NULL },
-  { "umacron",                           600, NULL },
-  { "abreve",                            600, NULL },
-  { "Eacute",                            600, NULL },
-  { "adieresis",                         600, NULL },
-  { "egrave",                            600, NULL },
-  { "edieresis",                         600, NULL },
-  { "idieresis",                         600, NULL },
-  { "Eth",                               600, NULL },
-  { "ae",                                600, NULL },
-  { "asterisk",                          600, NULL },
-  { "odieresis",                         600, NULL },
+  { "sacute",                            600, NULL },
+  { "Rcommaaccent",                      600, NULL },
+  { "ograve",                            600, NULL },
+  { "threequarters",                     600, NULL },
+  { "J",                                 600, NULL },
+  { "ohungarumlaut",                     600, NULL },
+  { "Ecircumflex",                       600, NULL },
+  { "L",                                 600, NULL },
+  { "notequal",                          600, NULL },
+  { "exclam",                            600, NULL },
+  { "Agrave",                            600, NULL },
+  { "AE",                                600, NULL },
+  { "Acircumflex",                       600, NULL },
+  { "oslash",                            600, NULL },
+  { "Uogonek",                           600, NULL },
+  { "caron",                             600, NULL },
+  { "Lslash",                            600, NULL },
+  { "lacute",                            600, NULL },
+  { "sterling",                          600, NULL },
+  { "H",                                 600, NULL },
+  { "at",                                600, NULL },
+  { "greaterequal",                      600, NULL },
+  { "asciitilde",                        600, NULL },
   { "Uacute",                            600, NULL },
-  { "ugrave",                            600, NULL },
-  { "nine",                              600, NULL },
-  { "five",                              600, NULL },
-  { "udieresis",                         600, NULL },
-  { "Zcaron",                            600, NULL },
-  { "Scommaaccent",                      600, NULL },
-  { "threequarters",                     600, NULL },
+  { "atilde",                            600, NULL },
+  { "Zacute",                            600, NULL },
+  { "fraction",                          600, NULL },
+  { "Adieresis",                         600, NULL },
+  { "Sacute",                            600, NULL },
+  { "scaron",                            600, NULL },
   { "guillemotright",                    600, NULL },
-  { "Ccedilla",                          600, NULL },
-  { "ydieresis",                         600, NULL },
-  { "tilde",                             600, NULL },
-  { "at",                                600, NULL },
+  { "bullet",                            600, NULL },
+  { "eogonek",                           600, NULL },
   { "eacute",                            600, NULL },
-  { "underscore",                        600, NULL },
-  { "Euro",                              600, NULL },
-  { "Dcroat",                            600, NULL },
-  { "multiply",                          600, NULL },
-  { "zero",                              600, NULL },
-  { "eth",                               600, NULL },
-  { "Scedilla",                          600, NULL },
-  { "Ograve",                            600, NULL },
-  { "Racute",                            600, NULL },
-  { "partialdiff",                       600, NULL },
+  { "Zdotaccent",                        600, NULL },
+  { "Abreve",                            600, NULL },
+  { "Udieresis",                         600, NULL },
+  { "Iacute",                            600, NULL },
+  { "two",                               600, NULL },
   { "uacute",                            600, NULL },
-  { "braceleft",                         600, NULL },
-  { "Thorn",                             600, NULL },
-  { "zcaron",                            600, NULL },
-  { "scommaaccent",                      600, NULL },
-  { "ccedilla",                          600, NULL },
-  { "Dcaron",                            600, NULL },
-  { "dcroat",                            600, NULL },
-  { "Ocircumflex",                       600, NULL },
-  { "Oacute",                            600, NULL },
-  { "scedilla",                          600, NULL },
-  { "ogonek",                            600, NULL },
-  { "ograve",                            600, NULL },
-  { "racute",                            600, NULL },
-  { "Tcaron",                            600, NULL },
-  { "Eogonek",                           600, NULL },
-  { "thorn",                             600, NULL },
-  { "degree",                            600, NULL },
-  { "registered",                        600, NULL },
-  { "radical",                           600, NULL },
-  { "Aring",                             600, NULL },
-  { "percent",                           600, NULL },
-  { "six",                               600, NULL },
-  { "paragraph",                         600, NULL },
-  { "dcaron",                            600, NULL },
-  { "Uogonek",                           600, NULL },
-  { "two",                               600, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            600, NULL },
-  { "Lacute",                            600, NULL },
-  { "ocircumflex",                       600, NULL },
-  { "oacute",                            600, NULL },
-  { "Uring",                             600, NULL },
+  { "seven",                             600, NULL },
+  { "dieresis",                          600, NULL },
+  { "Eacute",                            600, NULL },
+  { "O",                                 600, NULL },
+  { "Icircumflex",                       600, NULL },
+  { "nacute",                            600, NULL },
+  { "trademark",                         600, NULL },
+  { "ampersand",                         600, NULL },
   { "Lcommaaccent",                      600, NULL },
-  { "tcaron",                            600, NULL },
-  { "eogonek",                           600, NULL },
+  { "ntilde",                            600, NULL },
+  { "fi",                                600, NULL },
+  { "quotedblleft",                      600, NULL },
+  { "ordfeminine",                       600, NULL },
+  { "omacron",                           600, NULL },
+  { "comma",                             600, NULL },
   { "Delta",                             600, NULL },
-  { "Ohungarumlaut",                     600, NULL },
-  { "asciicircum",                       600, NULL },
-  { "aring",                             600, NULL },
-  { "grave",                             600, NULL },
-  { "uogonek",                           600, NULL },
-  { "bracketright",                      600, NULL },
-  { "Iacute",                            600, NULL },
-  { "ampersand",                         600, NULL },
+  { "Gbreve",                            600, NULL },
+  { "S",                                 600, NULL },
+  { "B",                                 600, NULL },
+  { "kcommaaccent",                      600, NULL },
+  { "Rcaron",                            600, NULL },
+  { "yacute",                            600, NULL },
+  { "ydieresis",                         600, NULL },
+  { "R",                                 600, NULL },
+  { "ugrave",                            600, NULL },
+  { "dcaron",                            600, NULL },
+  { "Oslash",                            600, NULL },
+  { "hyphen",                            600, NULL },
+  { "a",                                 600, NULL },
+  { "Otilde",                            600, NULL },
+  { "umacron",                           600, NULL },
+  { "Tcaron",                            600, NULL },
+  { "aacute",                            600, NULL },
+  { "guilsinglleft",                     600, NULL },
+  { "Cacute",                            600, NULL },
+  { "h",                                 600, NULL },
+  { "plus",                              600, NULL },
   { "igrave",                            600, NULL },
-  { "lacute",                            600, NULL },
+  { "dcroat",                            600, NULL },
+  { "question",                          600, NULL },
+  { "summation",                         600, NULL },
+  { "A",                                 600, NULL },
+  { "x",                                 600, NULL },
+  { "edieresis",                         600, NULL },
+  { "Iogonek",                           600, NULL },
+  { "y",                                 600, NULL },
   { "Ncaron",                            600, NULL },
-  { "plus",                              600, NULL },
-  { "uring",                             600, NULL },
-  { "quotesinglbase",                    600, NULL },
-  { "lcommaaccent",                      600, NULL },
+  { "m",                                 600, NULL },
+  { "OE",                                600, NULL },
+  { "partialdiff",                       600, NULL },
+  { "U",                                 600, NULL },
+  { "ncommaaccent",                      600, NULL },
+  { "tcommaaccent",                      600, NULL },
+  { "logicalnot",                        600, NULL },
+  { "cacute",                            600, NULL },
+  { "Dcroat",                            600, NULL },
+  { "tcaron",                            600, NULL },
+  { "rcaron",                            600, NULL },
+  { "Atilde",                            600, NULL },
+  { "Edieresis",                         600, NULL },
   { "Yacute",                            600, NULL },
-  { "ohungarumlaut",                     600, NULL },
-  { "threesuperior",                     600, NULL },
+  { "oacute",                            600, NULL },
+  { "daggerdbl",                         600, NULL },
+  { "braceleft",                         600, NULL },
+  { "braceright",                        600, NULL },
   { "acute",                             600, NULL },
-  { "section",                           600, NULL },
-  { "dieresis",                          600, NULL },
-  { "iacute",                            600, NULL },
-  { "quotedblbase",                      600, NULL },
-  { "ncaron",                            600, NULL },
-  { "florin",                            600, NULL },
-  { "yacute",                            600, NULL },
-  { "Rcommaaccent",                      600, NULL },
-  { "fi",                                600, NULL },
-  { "fl",                                600, NULL },
-  { "Acircumflex",                       600, NULL },
-  { "Cacute",                            600, NULL },
-  { "Icircumflex",                       600, NULL },
-  { "guillemotleft",                     600, NULL },
-  { "germandbls",                        600, NULL },
-  { "Amacron",                           600, NULL },
-  { "seven",                             600, NULL },
-  { "Sacute",                            600, NULL },
-  { "ordmasculine",                      600, NULL },
-  { "dotlessi",                          600, NULL },
-  { "sterling",                          600, NULL },
-  { "notequal",                          600, NULL },
-  { "Imacron",                           600, NULL },
+  { "onequarter",                        600, NULL },
+  { "i",                                 600, NULL },
+  { "multiply",                          600, NULL },
+  { "quotesingle",                       600, NULL },
+  { "bar",                               600, NULL },
+  { "six",                               600, NULL },
+  { "edotaccent",                        600, NULL },
+  { "lslash",                            600, NULL },
+  { "P",                                 600, NULL },
+  { "parenleft",                         600, NULL },
+  { "currency",                          600, NULL },
+  { "nine",                              600, NULL },
+  { "quotesinglbase",                    600, NULL },
+  { "grave",                             600, NULL },
+  { "Scedilla",                          600, NULL },
+  { "ccaron",                            600, NULL },
+  { "Ucircumflex",                       600, NULL },
+  { "lessequal",                         600, NULL },
+  { "Omacron",                           600, NULL },
+  { "hungarumlaut",                      600, NULL },
+  { "Ccaron",                            600, NULL },
+  { "j",                                 600, NULL },
+  { "Y",                                 600, NULL },
+  { "yen",                               600, NULL },
   { "rcommaaccent",                      600, NULL },
-  { "Zdotaccent",                        600, NULL },
-  { "acircumflex",                       600, NULL },
-  { "cacute",                            600, NULL },
-  { "Ecaron",                            600, NULL },
-  { "icircumflex",                       600, NULL },
-  { "braceright",                        600, NULL },
-  { "quotedblright",                     600, NULL },
-  { "amacron",                           600, NULL },
-  { "sacute",                            600, NULL },
+  { "Kcommaaccent",                      600, NULL },
   { "imacron",                           600, NULL },
+  { "tilde",                             600, NULL },
+  { "underscore",                        600, NULL },
+  { "mu",                                600, NULL },
+  { "D",                                 600, NULL },
+  { "racute",                            600, NULL },
+  { "Tcommaaccent",                      600, NULL },
+  { "dollar",                            600, NULL },
+  { "Nacute",                            600, NULL },
+  { "v",                                 600, NULL },
+  { "dotaccent",                         600, NULL },
   { "cent",                              600, NULL },
-  { "currency",                          600, NULL },
-  { "logicalnot",                        600, NULL },
-  { "zdotaccent",                        600, NULL },
-  { "Atilde",                            600, NULL },
-  { "breve",                             600, NULL },
-  { "bar",                               600, NULL },
-  { "fraction",                          600, NULL },
+  { "ae",                                600, NULL },
+  { "ocircumflex",                       600, NULL },
   { "less",                              600, NULL },
+  { "minus",                             600, NULL },
+  { "four",                              600, NULL },
+  { "circumflex",                        600, NULL },
+  { "Zcaron",                            600, NULL },
+  { "ogonek",                            600, NULL },
+  { "idieresis",                         600, NULL },
+  { "G",                                 600, NULL },
+  { "F",                                 600, NULL },
+  { "Ocircumflex",                       600, NULL },
+  { "Uring",                             600, NULL },
+  { "perthousand",                       600, NULL },
+  { "Edotaccent",                        600, NULL },
+  { "acircumflex",                       600, NULL },
+  { "zero",                              600, NULL },
+  { "period",                            600, NULL },
+  { "scedilla",                          600, NULL },
+  { "udieresis",                         600, NULL },
+  { "Ccedilla",                          600, NULL },
+  { "Igrave",                            600, NULL },
+  { "commaaccent",                       600, NULL },
+  { "W",                                 600, NULL },
+  { "bracketright",                      600, NULL },
+  { "Ugrave",                            600, NULL },
+  { "germandbls",                        600, NULL },
+  { "thorn",                             600, NULL },
+  { "w",                                 600, NULL },
+  { "Thorn",                             600, NULL },
+  { "space",                             600, NULL },
+  { "eth",                               600, NULL },
+  { "twosuperior",                       600, NULL },
   { "ecaron",                            600, NULL },
-  { "guilsinglleft",                     600, NULL },
-  { "exclam",                            600, NULL },
-  { "period",                            600, NULL },
-  { "Rcaron",                            600, NULL },
-  { "Kcommaaccent",                      600, NULL },
-  { "greater",                           600, NULL },
-  { "atilde",                            600, NULL },
+  { "Aogonek",                           600, NULL },
   { "brokenbar",                         600, NULL },
+  { "fl",                                600, NULL },
+  { "E",                                 600, NULL },
+  { "quotedblbase",                      600, NULL },
+  { "guillemotleft",                     600, NULL },
+  { "endash",                            600, NULL },
+  { "amacron",                           600, NULL },
+  { "Ncommaaccent",                      600, NULL },
+  { "numbersign",                        600, NULL },
+  { "divide",                            600, NULL },
+  { "emacron",                           600, NULL },
+  { "M",                                 600, NULL },
+  { "odieresis",                         600, NULL },
+  { "Ograve",                            600, NULL },
+  { "T",                                 600, NULL },
+  { "n",                                 600, NULL },
+  { "Ecaron",                            600, NULL },
+  { "threesuperior",                     600, NULL },
+  { "zdotaccent",                        600, NULL },
+  { "lcommaaccent",                      600, NULL },
+  { "onehalf",                           600, NULL },
+  { "gbreve",                            600, NULL },
+  { "uhungarumlaut",                     600, NULL },
+  { "Racute",                            600, NULL },
+  { "k",                                 600, NULL },
+  { "copyright",                         600, NULL },
   { "quoteleft",                         600, NULL },
-  { "Edotaccent",                        600, NULL },
-  { "onesuperior",                       600, NULL }
+  { "registered",                        600, NULL },
+  { "Gcommaaccent",                      600, NULL },
+  { "equal",                             600, NULL },
+  { "dagger",                            600, NULL },
+  { "N",                                 600, NULL },
+  { "C",                                 600, NULL },
+  { "u",                                 600, NULL },
+  { "q",                                 600, NULL },
+  { "l",                                 600, NULL },
+  { "icircumflex",                       600, NULL },
+  { "Imacron",                           600, NULL },
+  { "abreve",                            600, NULL },
+  { "e",                                 600, NULL },
+  { "iacute",                            600, NULL },
+  { "percent",                           600, NULL },
+  { "o",                                 600, NULL },
+  { "greater",                           600, NULL },
+  { "Emacron",                           600, NULL },
+  { "asterisk",                          600, NULL },
+  { "scommaaccent",                      600, NULL },
+  { "onesuperior",                       600, NULL },
+  { "K",                                 600, NULL },
+  { "Scommaaccent",                      600, NULL },
+  { "Aacute",                            600, NULL },
+  { "b",                                 600, NULL },
+  { "Euro",                              600, NULL },
+  { "florin",                            600, NULL },
+  { "iogonek",                           600, NULL },
+  { "section",                           600, NULL },
+  { "Scaron",                            600, NULL },
+  { "degree",                            600, NULL },
+  { "lcaron",                            600, NULL },
+  { "paragraph",                         600, NULL },
+  { "zcaron",                            600, NULL },
+  { "aring",                             600, NULL },
+  { "Ydieresis",                         600, NULL },
+  { "Dcaron",                            600, NULL },
+  { "Z",                                 600, NULL },
+  { "ecircumflex",                       600, NULL },
+  { "Amacron",                           600, NULL },
+  { "breve",                             600, NULL },
+  { "emdash",                            600, NULL },
+  { "Egrave",                            600, NULL },
+  { "aogonek",                           600, NULL },
+  { "ring",                              600, NULL },
+  { "Odieresis",                         600, NULL },
+  { "oe",                                600, NULL },
+  { "five",                              600, NULL },
+  { "X",                                 600, NULL },
+  { "asciicircum",                       600, NULL },
+  { "plusminus",                         600, NULL },
+  { "Idotaccent",                        600, NULL },
+  { "cedilla",                           600, NULL },
+  { "quotedblright",                     600, NULL },
+  { "Eth",                               600, NULL },
+  { "colon",                             600, NULL },
+  { "g",                                 600, NULL },
+  { "ccedilla",                          600, NULL },
+  { "radical",                           600, NULL },
+  { "Ntilde",                            600, NULL },
+  { "dotlessi",                          600, NULL },
+  { "p",                                 600, NULL }
 };
 
 static BuiltinFontWidth courierBoldObliqueWidthsTab[] = {
+  { "greater",                           600, NULL },
+  { "asterisk",                          600, NULL },
+  { "Emacron",                           600, NULL },
+  { "scommaaccent",                      600, NULL },
+  { "onesuperior",                       600, NULL },
+  { "percent",                           600, NULL },
+  { "o",                                 600, NULL },
+  { "icircumflex",                       600, NULL },
+  { "iacute",                            600, NULL },
+  { "e",                                 600, NULL },
+  { "Imacron",                           600, NULL },
+  { "abreve",                            600, NULL },
+  { "N",                                 600, NULL },
+  { "equal",                             600, NULL },
+  { "dagger",                            600, NULL },
+  { "u",                                 600, NULL },
+  { "C",                                 600, NULL },
+  { "l",                                 600, NULL },
+  { "q",                                 600, NULL },
+  { "quoteleft",                         600, NULL },
+  { "registered",                        600, NULL },
+  { "Gcommaaccent",                      600, NULL },
+  { "Racute",                            600, NULL },
+  { "k",                                 600, NULL },
+  { "copyright",                         600, NULL },
+  { "onehalf",                           600, NULL },
+  { "lcommaaccent",                      600, NULL },
+  { "uhungarumlaut",                     600, NULL },
+  { "gbreve",                            600, NULL },
+  { "n",                                 600, NULL },
+  { "Ecaron",                            600, NULL },
+  { "zdotaccent",                        600, NULL },
+  { "threesuperior",                     600, NULL },
+  { "radical",                           600, NULL },
   { "Ntilde",                            600, NULL },
-  { "rcaron",                            600, NULL },
-  { "kcommaaccent",                      600, NULL },
-  { "Ncommaaccent",                      600, NULL },
-  { "Zacute",                            600, NULL },
-  { "comma",                             600, NULL },
+  { "p",                                 600, NULL },
+  { "dotlessi",                          600, NULL },
   { "cedilla",                           600, NULL },
+  { "Idotaccent",                        600, NULL },
   { "plusminus",                         600, NULL },
-  { "circumflex",                        600, NULL },
-  { "dotaccent",                         600, NULL },
-  { "edotaccent",                        600, NULL },
-  { "asciitilde",                        600, NULL },
+  { "Eth",                               600, NULL },
+  { "quotedblright",                     600, NULL },
+  { "ccedilla",                          600, NULL },
+  { "g",                                 600, NULL },
   { "colon",                             600, NULL },
-  { "onehalf",                           600, NULL },
-  { "dollar",                            600, NULL },
-  { "Lcaron",                            600, NULL },
-  { "ntilde",                            600, NULL },
-  { "Aogonek",                           600, NULL },
-  { "ncommaaccent",                      600, NULL },
-  { "minus",                             600, NULL },
-  { "Iogonek",                           600, NULL },
-  { "zacute",                            600, NULL },
-  { "yen",                               600, NULL },
-  { "space",                             600, NULL },
-  { "Omacron",                           600, NULL },
-  { "questiondown",                      600, NULL },
+  { "oe",                                600, NULL },
+  { "Odieresis",                         600, NULL },
+  { "five",                              600, NULL },
+  { "asciicircum",                       600, NULL },
+  { "X",                                 600, NULL },
   { "emdash",                            600, NULL },
-  { "Agrave",                            600, NULL },
-  { "three",                             600, NULL },
-  { "numbersign",                        600, NULL },
+  { "aogonek",                           600, NULL },
+  { "Egrave",                            600, NULL },
+  { "ring",                              600, NULL },
+  { "Dcaron",                            600, NULL },
+  { "ecircumflex",                       600, NULL },
+  { "Z",                                 600, NULL },
+  { "breve",                             600, NULL },
+  { "Amacron",                           600, NULL },
+  { "paragraph",                         600, NULL },
+  { "zcaron",                            600, NULL },
   { "lcaron",                            600, NULL },
-  { "A",                                 600, NULL },
-  { "B",                                 600, NULL },
-  { "C",                                 600, NULL },
-  { "aogonek",                           600, NULL },
-  { "D",                                 600, NULL },
-  { "E",                                 600, NULL },
-  { "onequarter",                        600, NULL },
-  { "F",                                 600, NULL },
-  { "G",                                 600, NULL },
-  { "H",                                 600, NULL },
-  { "I",                                 600, NULL },
-  { "J",                                 600, NULL },
+  { "Ydieresis",                         600, NULL },
+  { "aring",                             600, NULL },
+  { "iogonek",                           600, NULL },
+  { "florin",                            600, NULL },
+  { "Euro",                              600, NULL },
+  { "Scaron",                            600, NULL },
+  { "degree",                            600, NULL },
+  { "section",                           600, NULL },
   { "K",                                 600, NULL },
-  { "iogonek",                           600, NULL },
-  { "backslash",                         600, NULL },
-  { "L",                                 600, NULL },
-  { "periodcentered",                    600, NULL },
-  { "M",                                 600, NULL },
-  { "N",                                 600, NULL },
-  { "omacron",                           600, NULL },
-  { "Tcommaaccent",                      600, NULL },
-  { "O",                                 600, NULL },
-  { "P",                                 600, NULL },
-  { "Q",                                 600, NULL },
-  { "Uhungarumlaut",                     600, NULL },
-  { "R",                                 600, NULL },
   { "Aacute",                            600, NULL },
-  { "caron",                             600, NULL },
-  { "S",                                 600, NULL },
-  { "T",                                 600, NULL },
-  { "U",                                 600, NULL },
-  { "agrave",                            600, NULL },
-  { "V",                                 600, NULL },
-  { "W",                                 600, NULL },
-  { "X",                                 600, NULL },
-  { "question",                          600, NULL },
-  { "equal",                             600, NULL },
-  { "Y",                                 600, NULL },
-  { "Z",                                 600, NULL },
+  { "Scommaaccent",                      600, NULL },
+  { "b",                                 600, NULL },
+  { "circumflex",                        600, NULL },
+  { "Zcaron",                            600, NULL },
+  { "ogonek",                            600, NULL },
+  { "idieresis",                         600, NULL },
+  { "ae",                                600, NULL },
+  { "cent",                              600, NULL },
+  { "less",                              600, NULL },
+  { "ocircumflex",                       600, NULL },
+  { "minus",                             600, NULL },
   { "four",                              600, NULL },
-  { "a",                                 600, NULL },
-  { "Gcommaaccent",                      600, NULL },
-  { "b",                                 600, NULL },
-  { "c",                                 600, NULL },
-  { "d",                                 600, NULL },
-  { "e",                                 600, NULL },
-  { "f",                                 600, NULL },
-  { "g",                                 600, NULL },
-  { "bullet",                            600, NULL },
-  { "h",                                 600, NULL },
-  { "i",                                 600, NULL },
-  { "Oslash",                            600, NULL },
-  { "dagger",                            600, NULL },
-  { "j",                                 600, NULL },
-  { "k",                                 600, NULL },
-  { "l",                                 600, NULL },
-  { "m",                                 600, NULL },
-  { "n",                                 600, NULL },
-  { "tcommaaccent",                      600, NULL },
-  { "o",                                 600, NULL },
-  { "ordfeminine",                       600, NULL },
-  { "ring",                              600, NULL },
-  { "p",                                 600, NULL },
-  { "q",                                 600, NULL },
-  { "uhungarumlaut",                     600, NULL },
-  { "r",                                 600, NULL },
-  { "twosuperior",                       600, NULL },
-  { "aacute",                            600, NULL },
-  { "s",                                 600, NULL },
-  { "OE",                                600, NULL },
-  { "t",                                 600, NULL },
-  { "divide",                            600, NULL },
-  { "u",                                 600, NULL },
-  { "Ccaron",                            600, NULL },
+  { "Tcommaaccent",                      600, NULL },
+  { "dollar",                            600, NULL },
+  { "dotaccent",                         600, NULL },
   { "v",                                 600, NULL },
-  { "w",                                 600, NULL },
-  { "x",                                 600, NULL },
-  { "y",                                 600, NULL },
-  { "z",                                 600, NULL },
-  { "Gbreve",                            600, NULL },
-  { "commaaccent",                       600, NULL },
-  { "hungarumlaut",                      600, NULL },
-  { "Idotaccent",                        600, NULL },
   { "Nacute",                            600, NULL },
-  { "quotedbl",                          600, NULL },
-  { "gcommaaccent",                      600, NULL },
+  { "Kcommaaccent",                      600, NULL },
+  { "imacron",                           600, NULL },
+  { "rcommaaccent",                      600, NULL },
+  { "tilde",                             600, NULL },
+  { "underscore",                        600, NULL },
+  { "racute",                            600, NULL },
   { "mu",                                600, NULL },
-  { "greaterequal",                      600, NULL },
-  { "Scaron",                            600, NULL },
-  { "Lslash",                            600, NULL },
-  { "semicolon",                         600, NULL },
-  { "oslash",                            600, NULL },
-  { "lessequal",                         600, NULL },
-  { "lozenge",                           600, NULL },
-  { "parenright",                        600, NULL },
+  { "D",                                 600, NULL },
+  { "Ccaron",                            600, NULL },
+  { "j",                                 600, NULL },
+  { "hungarumlaut",                      600, NULL },
+  { "Y",                                 600, NULL },
+  { "yen",                               600, NULL },
   { "ccaron",                            600, NULL },
-  { "Ecircumflex",                       600, NULL },
-  { "gbreve",                            600, NULL },
-  { "trademark",                         600, NULL },
-  { "daggerdbl",                         600, NULL },
-  { "nacute",                            600, NULL },
-  { "macron",                            600, NULL },
-  { "Otilde",                            600, NULL },
-  { "Emacron",                           600, NULL },
-  { "ellipsis",                          600, NULL },
-  { "scaron",                            600, NULL },
-  { "AE",                                600, NULL },
   { "Ucircumflex",                       600, NULL },
-  { "lslash",                            600, NULL },
-  { "quotedblleft",                      600, NULL },
-  { "guilsinglright",                    600, NULL },
-  { "hyphen",                            600, NULL },
-  { "quotesingle",                       600, NULL },
-  { "eight",                             600, NULL },
-  { "exclamdown",                        600, NULL },
-  { "endash",                            600, NULL },
-  { "oe",                                600, NULL },
-  { "Abreve",                            600, NULL },
-  { "Umacron",                           600, NULL },
-  { "ecircumflex",                       600, NULL },
-  { "Adieresis",                         600, NULL },
-  { "copyright",                         600, NULL },
-  { "Egrave",                            600, NULL },
-  { "slash",                             600, NULL },
-  { "Edieresis",                         600, NULL },
-  { "otilde",                            600, NULL },
-  { "Idieresis",                         600, NULL },
+  { "lessequal",                         600, NULL },
+  { "Omacron",                           600, NULL },
+  { "quotesinglbase",                    600, NULL },
+  { "Scedilla",                          600, NULL },
+  { "grave",                             600, NULL },
   { "parenleft",                         600, NULL },
-  { "one",                               600, NULL },
+  { "nine",                              600, NULL },
+  { "currency",                          600, NULL },
+  { "odieresis",                         600, NULL },
+  { "M",                                 600, NULL },
+  { "Ograve",                            600, NULL },
+  { "T",                                 600, NULL },
+  { "amacron",                           600, NULL },
+  { "Ncommaaccent",                      600, NULL },
+  { "numbersign",                        600, NULL },
   { "emacron",                           600, NULL },
-  { "Odieresis",                         600, NULL },
-  { "ucircumflex",                       600, NULL },
-  { "bracketleft",                       600, NULL },
+  { "divide",                            600, NULL },
+  { "fl",                                600, NULL },
+  { "quotedblbase",                      600, NULL },
+  { "E",                                 600, NULL },
+  { "guillemotleft",                     600, NULL },
+  { "endash",                            600, NULL },
+  { "w",                                 600, NULL },
+  { "eth",                               600, NULL },
+  { "twosuperior",                       600, NULL },
+  { "space",                             600, NULL },
+  { "Thorn",                             600, NULL },
+  { "ecaron",                            600, NULL },
+  { "brokenbar",                         600, NULL },
+  { "Aogonek",                           600, NULL },
+  { "commaaccent",                       600, NULL },
+  { "bracketright",                      600, NULL },
+  { "W",                                 600, NULL },
+  { "germandbls",                        600, NULL },
   { "Ugrave",                            600, NULL },
-  { "quoteright",                        600, NULL },
-  { "Udieresis",                         600, NULL },
+  { "thorn",                             600, NULL },
+  { "zero",                              600, NULL },
+  { "udieresis",                         600, NULL },
+  { "scedilla",                          600, NULL },
+  { "period",                            600, NULL },
+  { "Ccedilla",                          600, NULL },
+  { "Igrave",                            600, NULL },
+  { "F",                                 600, NULL },
+  { "Ocircumflex",                       600, NULL },
+  { "Uring",                             600, NULL },
   { "perthousand",                       600, NULL },
-  { "Ydieresis",                         600, NULL },
+  { "Edotaccent",                        600, NULL },
+  { "acircumflex",                       600, NULL },
+  { "G",                                 600, NULL },
+  { "Otilde",                            600, NULL },
   { "umacron",                           600, NULL },
-  { "abreve",                            600, NULL },
+  { "Tcaron",                            600, NULL },
+  { "aacute",                            600, NULL },
+  { "B",                                 600, NULL },
+  { "ydieresis",                         600, NULL },
+  { "R",                                 600, NULL },
+  { "kcommaaccent",                      600, NULL },
+  { "yacute",                            600, NULL },
+  { "Rcaron",                            600, NULL },
+  { "dcaron",                            600, NULL },
+  { "ugrave",                            600, NULL },
+  { "a",                                 600, NULL },
+  { "hyphen",                            600, NULL },
+  { "Oslash",                            600, NULL },
+  { "comma",                             600, NULL },
+  { "Delta",                             600, NULL },
+  { "omacron",                           600, NULL },
+  { "Gbreve",                            600, NULL },
+  { "S",                                 600, NULL },
+  { "quotedblleft",                      600, NULL },
+  { "ordfeminine",                       600, NULL },
+  { "ampersand",                         600, NULL },
+  { "trademark",                         600, NULL },
+  { "Lcommaaccent",                      600, NULL },
+  { "ntilde",                            600, NULL },
+  { "fi",                                600, NULL },
+  { "dieresis",                          600, NULL },
   { "Eacute",                            600, NULL },
-  { "adieresis",                         600, NULL },
-  { "egrave",                            600, NULL },
-  { "edieresis",                         600, NULL },
-  { "idieresis",                         600, NULL },
-  { "Eth",                               600, NULL },
-  { "ae",                                600, NULL },
-  { "asterisk",                          600, NULL },
-  { "odieresis",                         600, NULL },
-  { "Uacute",                            600, NULL },
-  { "ugrave",                            600, NULL },
-  { "nine",                              600, NULL },
-  { "five",                              600, NULL },
-  { "udieresis",                         600, NULL },
-  { "Zcaron",                            600, NULL },
-  { "Scommaaccent",                      600, NULL },
-  { "threequarters",                     600, NULL },
+  { "nacute",                            600, NULL },
+  { "O",                                 600, NULL },
+  { "Icircumflex",                       600, NULL },
+  { "Udieresis",                         600, NULL },
+  { "Abreve",                            600, NULL },
+  { "Iacute",                            600, NULL },
+  { "uacute",                            600, NULL },
+  { "two",                               600, NULL },
+  { "seven",                             600, NULL },
+  { "scaron",                            600, NULL },
   { "guillemotright",                    600, NULL },
-  { "Ccedilla",                          600, NULL },
-  { "ydieresis",                         600, NULL },
-  { "tilde",                             600, NULL },
-  { "at",                                600, NULL },
+  { "eogonek",                           600, NULL },
   { "eacute",                            600, NULL },
-  { "underscore",                        600, NULL },
-  { "Euro",                              600, NULL },
-  { "Dcroat",                            600, NULL },
+  { "bullet",                            600, NULL },
+  { "Zdotaccent",                        600, NULL },
+  { "edotaccent",                        600, NULL },
+  { "six",                               600, NULL },
+  { "lslash",                            600, NULL },
+  { "P",                                 600, NULL },
   { "multiply",                          600, NULL },
-  { "zero",                              600, NULL },
-  { "eth",                               600, NULL },
-  { "Scedilla",                          600, NULL },
-  { "Ograve",                            600, NULL },
-  { "Racute",                            600, NULL },
-  { "partialdiff",                       600, NULL },
-  { "uacute",                            600, NULL },
+  { "i",                                 600, NULL },
+  { "bar",                               600, NULL },
+  { "quotesingle",                       600, NULL },
+  { "acute",                             600, NULL },
+  { "braceright",                        600, NULL },
   { "braceleft",                         600, NULL },
-  { "Thorn",                             600, NULL },
-  { "zcaron",                            600, NULL },
-  { "scommaaccent",                      600, NULL },
-  { "ccedilla",                          600, NULL },
-  { "Dcaron",                            600, NULL },
-  { "dcroat",                            600, NULL },
-  { "Ocircumflex",                       600, NULL },
-  { "Oacute",                            600, NULL },
-  { "scedilla",                          600, NULL },
-  { "ogonek",                            600, NULL },
-  { "ograve",                            600, NULL },
-  { "racute",                            600, NULL },
-  { "Tcaron",                            600, NULL },
-  { "Eogonek",                           600, NULL },
-  { "thorn",                             600, NULL },
-  { "degree",                            600, NULL },
-  { "registered",                        600, NULL },
-  { "radical",                           600, NULL },
-  { "Aring",                             600, NULL },
-  { "percent",                           600, NULL },
-  { "six",                               600, NULL },
-  { "paragraph",                         600, NULL },
-  { "dcaron",                            600, NULL },
-  { "Uogonek",                           600, NULL },
-  { "two",                               600, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            600, NULL },
-  { "Lacute",                            600, NULL },
-  { "ocircumflex",                       600, NULL },
+  { "onequarter",                        600, NULL },
+  { "Atilde",                            600, NULL },
+  { "Edieresis",                         600, NULL },
+  { "Yacute",                            600, NULL },
   { "oacute",                            600, NULL },
-  { "Uring",                             600, NULL },
-  { "Lcommaaccent",                      600, NULL },
+  { "daggerdbl",                         600, NULL },
+  { "ncommaaccent",                      600, NULL },
+  { "logicalnot",                        600, NULL },
+  { "tcommaaccent",                      600, NULL },
+  { "Dcroat",                            600, NULL },
+  { "cacute",                            600, NULL },
+  { "rcaron",                            600, NULL },
   { "tcaron",                            600, NULL },
-  { "eogonek",                           600, NULL },
-  { "Delta",                             600, NULL },
-  { "Ohungarumlaut",                     600, NULL },
-  { "asciicircum",                       600, NULL },
-  { "aring",                             600, NULL },
-  { "grave",                             600, NULL },
-  { "uogonek",                           600, NULL },
-  { "bracketright",                      600, NULL },
-  { "Iacute",                            600, NULL },
-  { "ampersand",                         600, NULL },
+  { "y",                                 600, NULL },
+  { "Iogonek",                           600, NULL },
+  { "edieresis",                         600, NULL },
+  { "x",                                 600, NULL },
+  { "Ncaron",                            600, NULL },
+  { "OE",                                600, NULL },
+  { "m",                                 600, NULL },
+  { "U",                                 600, NULL },
+  { "partialdiff",                       600, NULL },
+  { "dcroat",                            600, NULL },
   { "igrave",                            600, NULL },
-  { "lacute",                            600, NULL },
-  { "Ncaron",                            600, NULL },
+  { "summation",                         600, NULL },
+  { "question",                          600, NULL },
+  { "A",                                 600, NULL },
+  { "h",                                 600, NULL },
+  { "Cacute",                            600, NULL },
+  { "guilsinglleft",                     600, NULL },
   { "plus",                              600, NULL },
+  { "ordmasculine",                      600, NULL },
+  { "Lcaron",                            600, NULL },
+  { "backslash",                         600, NULL },
+  { "questiondown",                      600, NULL },
+  { "macron",                            600, NULL },
+  { "Eogonek",                           600, NULL },
+  { "three",                             600, NULL },
+  { "slash",                             600, NULL },
+  { "ucircumflex",                       600, NULL },
+  { "r",                                 600, NULL },
+  { "zacute",                            600, NULL },
+  { "Umacron",                           600, NULL },
+  { "adieresis",                         600, NULL },
+  { "ncaron",                            600, NULL },
+  { "V",                                 600, NULL },
+  { "lozenge",                           600, NULL },
+  { "exclamdown",                        600, NULL },
+  { "Q",                                 600, NULL },
+  { "quoteright",                        600, NULL },
+  { "uogonek",                           600, NULL },
+  { "guilsinglright",                    600, NULL },
+  { "semicolon",                         600, NULL },
+  { "egrave",                            600, NULL },
+  { "s",                                 600, NULL },
   { "uring",                             600, NULL },
-  { "quotesinglbase",                    600, NULL },
-  { "lcommaaccent",                      600, NULL },
-  { "Yacute",                            600, NULL },
-  { "ohungarumlaut",                     600, NULL },
-  { "threesuperior",                     600, NULL },
-  { "acute",                             600, NULL },
-  { "section",                           600, NULL },
-  { "dieresis",                          600, NULL },
-  { "iacute",                            600, NULL },
-  { "quotedblbase",                      600, NULL },
-  { "ncaron",                            600, NULL },
-  { "florin",                            600, NULL },
-  { "yacute",                            600, NULL },
-  { "Rcommaaccent",                      600, NULL },
-  { "fi",                                600, NULL },
-  { "fl",                                600, NULL },
-  { "Acircumflex",                       600, NULL },
-  { "Cacute",                            600, NULL },
-  { "Icircumflex",                       600, NULL },
-  { "guillemotleft",                     600, NULL },
-  { "germandbls",                        600, NULL },
-  { "Amacron",                           600, NULL },
-  { "seven",                             600, NULL },
+  { "Uhungarumlaut",                     600, NULL },
+  { "z",                                 600, NULL },
+  { "I",                                 600, NULL },
+  { "one",                               600, NULL },
+  { "eight",                             600, NULL },
+  { "periodcentered",                    600, NULL },
+  { "d",                                 600, NULL },
+  { "c",                                 600, NULL },
+  { "agrave",                            600, NULL },
+  { "ellipsis",                          600, NULL },
+  { "Aring",                             600, NULL },
+  { "t",                                 600, NULL },
+  { "quotedbl",                          600, NULL },
+  { "Oacute",                            600, NULL },
+  { "Uacute",                            600, NULL },
+  { "Zacute",                            600, NULL },
+  { "atilde",                            600, NULL },
+  { "fraction",                          600, NULL },
+  { "Adieresis",                         600, NULL },
   { "Sacute",                            600, NULL },
-  { "ordmasculine",                      600, NULL },
-  { "dotlessi",                          600, NULL },
+  { "asciitilde",                        600, NULL },
+  { "lacute",                            600, NULL },
+  { "Uogonek",                           600, NULL },
+  { "Lslash",                            600, NULL },
+  { "caron",                             600, NULL },
   { "sterling",                          600, NULL },
+  { "H",                                 600, NULL },
+  { "greaterequal",                      600, NULL },
+  { "at",                                600, NULL },
+  { "J",                                 600, NULL },
+  { "threequarters",                     600, NULL },
+  { "ohungarumlaut",                     600, NULL },
+  { "Ecircumflex",                       600, NULL },
+  { "L",                                 600, NULL },
+  { "AE",                                600, NULL },
+  { "Agrave",                            600, NULL },
+  { "exclam",                            600, NULL },
   { "notequal",                          600, NULL },
-  { "Imacron",                           600, NULL },
-  { "rcommaaccent",                      600, NULL },
-  { "Zdotaccent",                        600, NULL },
-  { "acircumflex",                       600, NULL },
-  { "cacute",                            600, NULL },
-  { "Ecaron",                            600, NULL },
-  { "icircumflex",                       600, NULL },
-  { "braceright",                        600, NULL },
-  { "quotedblright",                     600, NULL },
-  { "amacron",                           600, NULL },
+  { "oslash",                            600, NULL },
+  { "Acircumflex",                       600, NULL },
+  { "Rcommaaccent",                      600, NULL },
+  { "ograve",                            600, NULL },
+  { "Lacute",                            600, NULL },
+  { "Idieresis",                         600, NULL },
   { "sacute",                            600, NULL },
-  { "imacron",                           600, NULL },
-  { "cent",                              600, NULL },
-  { "currency",                          600, NULL },
-  { "logicalnot",                        600, NULL },
-  { "zdotaccent",                        600, NULL },
-  { "Atilde",                            600, NULL },
-  { "breve",                             600, NULL },
-  { "bar",                               600, NULL },
-  { "fraction",                          600, NULL },
-  { "less",                              600, NULL },
-  { "ecaron",                            600, NULL },
-  { "guilsinglleft",                     600, NULL },
-  { "exclam",                            600, NULL },
-  { "period",                            600, NULL },
-  { "Rcaron",                            600, NULL },
-  { "Kcommaaccent",                      600, NULL },
-  { "greater",                           600, NULL },
-  { "atilde",                            600, NULL },
-  { "brokenbar",                         600, NULL },
-  { "quoteleft",                         600, NULL },
-  { "Edotaccent",                        600, NULL },
-  { "onesuperior",                       600, NULL }
+  { "f",                                 600, NULL },
+  { "gcommaaccent",                      600, NULL },
+  { "bracketleft",                       600, NULL },
+  { "Ohungarumlaut",                     600, NULL },
+  { "otilde",                            600, NULL },
+  { "parenright",                        600, NULL }
 };
 
 static BuiltinFontWidth courierObliqueWidthsTab[] = {
-  { "Ntilde",                            600, NULL },
-  { "rcaron",                            600, NULL },
-  { "kcommaaccent",                      600, NULL },
+  { "ecaron",                            600, NULL },
+  { "brokenbar",                         600, NULL },
+  { "Aogonek",                           600, NULL },
+  { "w",                                 600, NULL },
+  { "Thorn",                             600, NULL },
+  { "space",                             600, NULL },
+  { "eth",                               600, NULL },
+  { "twosuperior",                       600, NULL },
+  { "guillemotleft",                     600, NULL },
+  { "endash",                            600, NULL },
+  { "fl",                                600, NULL },
+  { "E",                                 600, NULL },
+  { "quotedblbase",                      600, NULL },
+  { "numbersign",                        600, NULL },
+  { "divide",                            600, NULL },
+  { "emacron",                           600, NULL },
+  { "amacron",                           600, NULL },
   { "Ncommaaccent",                      600, NULL },
-  { "Zacute",                            600, NULL },
-  { "comma",                             600, NULL },
-  { "cedilla",                           600, NULL },
-  { "plusminus",                         600, NULL },
-  { "circumflex",                        600, NULL },
+  { "T",                                 600, NULL },
+  { "M",                                 600, NULL },
+  { "odieresis",                         600, NULL },
+  { "Ograve",                            600, NULL },
+  { "G",                                 600, NULL },
+  { "perthousand",                       600, NULL },
+  { "Edotaccent",                        600, NULL },
+  { "acircumflex",                       600, NULL },
+  { "Ocircumflex",                       600, NULL },
+  { "F",                                 600, NULL },
+  { "Uring",                             600, NULL },
+  { "Ccedilla",                          600, NULL },
+  { "Igrave",                            600, NULL },
+  { "zero",                              600, NULL },
+  { "scedilla",                          600, NULL },
+  { "period",                            600, NULL },
+  { "udieresis",                         600, NULL },
+  { "Ugrave",                            600, NULL },
+  { "germandbls",                        600, NULL },
+  { "thorn",                             600, NULL },
+  { "commaaccent",                       600, NULL },
+  { "W",                                 600, NULL },
+  { "bracketright",                      600, NULL },
+  { "underscore",                        600, NULL },
+  { "D",                                 600, NULL },
+  { "mu",                                600, NULL },
+  { "racute",                            600, NULL },
+  { "rcommaaccent",                      600, NULL },
+  { "imacron",                           600, NULL },
+  { "Kcommaaccent",                      600, NULL },
+  { "tilde",                             600, NULL },
+  { "Tcommaaccent",                      600, NULL },
+  { "dollar",                            600, NULL },
+  { "v",                                 600, NULL },
+  { "Nacute",                            600, NULL },
   { "dotaccent",                         600, NULL },
-  { "edotaccent",                        600, NULL },
-  { "asciitilde",                        600, NULL },
-  { "colon",                             600, NULL },
-  { "onehalf",                           600, NULL },
-  { "dollar",                            600, NULL },
-  { "Lcaron",                            600, NULL },
-  { "ntilde",                            600, NULL },
-  { "Aogonek",                           600, NULL },
-  { "ncommaaccent",                      600, NULL },
+  { "ocircumflex",                       600, NULL },
+  { "less",                              600, NULL },
   { "minus",                             600, NULL },
-  { "Iogonek",                           600, NULL },
-  { "zacute",                            600, NULL },
+  { "four",                              600, NULL },
+  { "ae",                                600, NULL },
+  { "cent",                              600, NULL },
+  { "ogonek",                            600, NULL },
+  { "idieresis",                         600, NULL },
+  { "circumflex",                        600, NULL },
+  { "Zcaron",                            600, NULL },
+  { "currency",                          600, NULL },
+  { "nine",                              600, NULL },
+  { "parenleft",                         600, NULL },
+  { "grave",                             600, NULL },
+  { "Scedilla",                          600, NULL },
+  { "quotesinglbase",                    600, NULL },
+  { "lessequal",                         600, NULL },
+  { "Omacron",                           600, NULL },
+  { "Ucircumflex",                       600, NULL },
+  { "ccaron",                            600, NULL },
   { "yen",                               600, NULL },
-  { "space",                             600, NULL },
-  { "Omacron",                           600, NULL },
-  { "questiondown",                      600, NULL },
+  { "Y",                                 600, NULL },
+  { "hungarumlaut",                      600, NULL },
+  { "Ccaron",                            600, NULL },
+  { "j",                                 600, NULL },
+  { "aogonek",                           600, NULL },
+  { "Egrave",                            600, NULL },
+  { "ring",                              600, NULL },
   { "emdash",                            600, NULL },
-  { "Agrave",                            600, NULL },
-  { "three",                             600, NULL },
-  { "numbersign",                        600, NULL },
-  { "lcaron",                            600, NULL },
-  { "A",                                 600, NULL },
-  { "B",                                 600, NULL },
-  { "C",                                 600, NULL },
-  { "aogonek",                           600, NULL },
-  { "D",                                 600, NULL },
-  { "E",                                 600, NULL },
-  { "onequarter",                        600, NULL },
-  { "F",                                 600, NULL },
-  { "G",                                 600, NULL },
-  { "H",                                 600, NULL },
-  { "I",                                 600, NULL },
-  { "J",                                 600, NULL },
+  { "five",                              600, NULL },
+  { "X",                                 600, NULL },
+  { "asciicircum",                       600, NULL },
+  { "Odieresis",                         600, NULL },
+  { "oe",                                600, NULL },
+  { "colon",                             600, NULL },
+  { "g",                                 600, NULL },
+  { "ccedilla",                          600, NULL },
+  { "plusminus",                         600, NULL },
+  { "cedilla",                           600, NULL },
+  { "Idotaccent",                        600, NULL },
+  { "quotedblright",                     600, NULL },
+  { "Eth",                               600, NULL },
+  { "dotlessi",                          600, NULL },
+  { "p",                                 600, NULL },
+  { "radical",                           600, NULL },
+  { "Ntilde",                            600, NULL },
+  { "Scommaaccent",                      600, NULL },
+  { "Aacute",                            600, NULL },
+  { "b",                                 600, NULL },
   { "K",                                 600, NULL },
+  { "section",                           600, NULL },
+  { "degree",                            600, NULL },
+  { "Scaron",                            600, NULL },
+  { "Euro",                              600, NULL },
+  { "florin",                            600, NULL },
   { "iogonek",                           600, NULL },
-  { "backslash",                         600, NULL },
-  { "L",                                 600, NULL },
-  { "periodcentered",                    600, NULL },
-  { "M",                                 600, NULL },
+  { "lcaron",                            600, NULL },
+  { "paragraph",                         600, NULL },
+  { "zcaron",                            600, NULL },
+  { "aring",                             600, NULL },
+  { "Ydieresis",                         600, NULL },
+  { "Amacron",                           600, NULL },
+  { "breve",                             600, NULL },
+  { "Dcaron",                            600, NULL },
+  { "Z",                                 600, NULL },
+  { "ecircumflex",                       600, NULL },
+  { "q",                                 600, NULL },
+  { "l",                                 600, NULL },
+  { "dagger",                            600, NULL },
+  { "equal",                             600, NULL },
   { "N",                                 600, NULL },
-  { "omacron",                           600, NULL },
-  { "Tcommaaccent",                      600, NULL },
-  { "O",                                 600, NULL },
-  { "P",                                 600, NULL },
-  { "Q",                                 600, NULL },
-  { "Uhungarumlaut",                     600, NULL },
-  { "R",                                 600, NULL },
-  { "Aacute",                            600, NULL },
-  { "caron",                             600, NULL },
-  { "S",                                 600, NULL },
-  { "T",                                 600, NULL },
-  { "U",                                 600, NULL },
-  { "agrave",                            600, NULL },
-  { "V",                                 600, NULL },
-  { "W",                                 600, NULL },
-  { "X",                                 600, NULL },
-  { "question",                          600, NULL },
-  { "equal",                             600, NULL },
-  { "Y",                                 600, NULL },
-  { "Z",                                 600, NULL },
-  { "four",                              600, NULL },
-  { "a",                                 600, NULL },
-  { "Gcommaaccent",                      600, NULL },
-  { "b",                                 600, NULL },
-  { "c",                                 600, NULL },
-  { "d",                                 600, NULL },
+  { "C",                                 600, NULL },
+  { "u",                                 600, NULL },
+  { "abreve",                            600, NULL },
+  { "Imacron",                           600, NULL },
+  { "iacute",                            600, NULL },
   { "e",                                 600, NULL },
-  { "f",                                 600, NULL },
-  { "g",                                 600, NULL },
-  { "bullet",                            600, NULL },
-  { "h",                                 600, NULL },
-  { "i",                                 600, NULL },
-  { "Oslash",                            600, NULL },
-  { "dagger",                            600, NULL },
-  { "j",                                 600, NULL },
-  { "k",                                 600, NULL },
-  { "l",                                 600, NULL },
-  { "m",                                 600, NULL },
+  { "icircumflex",                       600, NULL },
+  { "percent",                           600, NULL },
+  { "o",                                 600, NULL },
+  { "asterisk",                          600, NULL },
+  { "Emacron",                           600, NULL },
+  { "scommaaccent",                      600, NULL },
+  { "onesuperior",                       600, NULL },
+  { "greater",                           600, NULL },
+  { "Ecaron",                            600, NULL },
+  { "threesuperior",                     600, NULL },
+  { "zdotaccent",                        600, NULL },
   { "n",                                 600, NULL },
-  { "tcommaaccent",                      600, NULL },
-  { "o",                                 600, NULL },
-  { "ordfeminine",                       600, NULL },
-  { "ring",                              600, NULL },
-  { "p",                                 600, NULL },
-  { "q",                                 600, NULL },
+  { "lcommaaccent",                      600, NULL },
+  { "onehalf",                           600, NULL },
+  { "gbreve",                            600, NULL },
   { "uhungarumlaut",                     600, NULL },
-  { "r",                                 600, NULL },
-  { "twosuperior",                       600, NULL },
-  { "aacute",                            600, NULL },
-  { "s",                                 600, NULL },
-  { "OE",                                600, NULL },
-  { "t",                                 600, NULL },
-  { "divide",                            600, NULL },
-  { "u",                                 600, NULL },
-  { "Ccaron",                            600, NULL },
-  { "v",                                 600, NULL },
-  { "w",                                 600, NULL },
-  { "x",                                 600, NULL },
-  { "y",                                 600, NULL },
-  { "z",                                 600, NULL },
-  { "Gbreve",                            600, NULL },
-  { "commaaccent",                       600, NULL },
-  { "hungarumlaut",                      600, NULL },
-  { "Idotaccent",                        600, NULL },
-  { "Nacute",                            600, NULL },
-  { "quotedbl",                          600, NULL },
-  { "gcommaaccent",                      600, NULL },
-  { "mu",                                600, NULL },
+  { "k",                                 600, NULL },
+  { "copyright",                         600, NULL },
+  { "Racute",                            600, NULL },
+  { "Gcommaaccent",                      600, NULL },
+  { "quoteleft",                         600, NULL },
+  { "registered",                        600, NULL },
+  { "notequal",                          600, NULL },
+  { "Agrave",                            600, NULL },
+  { "AE",                                600, NULL },
+  { "exclam",                            600, NULL },
+  { "Acircumflex",                       600, NULL },
+  { "oslash",                            600, NULL },
+  { "threequarters",                     600, NULL },
+  { "J",                                 600, NULL },
+  { "Ecircumflex",                       600, NULL },
+  { "ohungarumlaut",                     600, NULL },
+  { "L",                                 600, NULL },
+  { "H",                                 600, NULL },
+  { "sterling",                          600, NULL },
   { "greaterequal",                      600, NULL },
-  { "Scaron",                            600, NULL },
+  { "at",                                600, NULL },
+  { "caron",                             600, NULL },
+  { "Uogonek",                           600, NULL },
   { "Lslash",                            600, NULL },
+  { "lacute",                            600, NULL },
+  { "asciitilde",                        600, NULL },
+  { "fraction",                          600, NULL },
+  { "Sacute",                            600, NULL },
+  { "Adieresis",                         600, NULL },
+  { "Uacute",                            600, NULL },
+  { "atilde",                            600, NULL },
+  { "Zacute",                            600, NULL },
+  { "otilde",                            600, NULL },
+  { "parenright",                        600, NULL },
+  { "gcommaaccent",                      600, NULL },
+  { "Ohungarumlaut",                     600, NULL },
+  { "bracketleft",                       600, NULL },
+  { "f",                                 600, NULL },
+  { "Lacute",                            600, NULL },
+  { "Idieresis",                         600, NULL },
+  { "sacute",                            600, NULL },
+  { "Rcommaaccent",                      600, NULL },
+  { "ograve",                            600, NULL },
+  { "quoteright",                        600, NULL },
+  { "uogonek",                           600, NULL },
   { "semicolon",                         600, NULL },
-  { "oslash",                            600, NULL },
-  { "lessequal",                         600, NULL },
+  { "guilsinglright",                    600, NULL },
   { "lozenge",                           600, NULL },
-  { "parenright",                        600, NULL },
-  { "ccaron",                            600, NULL },
-  { "Ecircumflex",                       600, NULL },
-  { "gbreve",                            600, NULL },
-  { "trademark",                         600, NULL },
-  { "daggerdbl",                         600, NULL },
-  { "nacute",                            600, NULL },
-  { "macron",                            600, NULL },
-  { "Otilde",                            600, NULL },
-  { "Emacron",                           600, NULL },
-  { "ellipsis",                          600, NULL },
-  { "scaron",                            600, NULL },
-  { "AE",                                600, NULL },
-  { "Ucircumflex",                       600, NULL },
-  { "lslash",                            600, NULL },
-  { "quotedblleft",                      600, NULL },
-  { "guilsinglright",                    600, NULL },
-  { "hyphen",                            600, NULL },
-  { "quotesingle",                       600, NULL },
-  { "eight",                             600, NULL },
+  { "V",                                 600, NULL },
+  { "Q",                                 600, NULL },
   { "exclamdown",                        600, NULL },
-  { "endash",                            600, NULL },
-  { "oe",                                600, NULL },
-  { "Abreve",                            600, NULL },
   { "Umacron",                           600, NULL },
-  { "ecircumflex",                       600, NULL },
-  { "Adieresis",                         600, NULL },
-  { "copyright",                         600, NULL },
-  { "Egrave",                            600, NULL },
+  { "zacute",                            600, NULL },
+  { "ncaron",                            600, NULL },
+  { "adieresis",                         600, NULL },
   { "slash",                             600, NULL },
-  { "Edieresis",                         600, NULL },
-  { "otilde",                            600, NULL },
-  { "Idieresis",                         600, NULL },
-  { "parenleft",                         600, NULL },
+  { "ucircumflex",                       600, NULL },
+  { "r",                                 600, NULL },
+  { "three",                             600, NULL },
+  { "Eogonek",                           600, NULL },
+  { "macron",                            600, NULL },
+  { "Lcaron",                            600, NULL },
+  { "ordmasculine",                      600, NULL },
+  { "backslash",                         600, NULL },
+  { "questiondown",                      600, NULL },
+  { "Oacute",                            600, NULL },
+  { "t",                                 600, NULL },
+  { "quotedbl",                          600, NULL },
+  { "ellipsis",                          600, NULL },
+  { "Aring",                             600, NULL },
+  { "agrave",                            600, NULL },
+  { "c",                                 600, NULL },
+  { "d",                                 600, NULL },
   { "one",                               600, NULL },
-  { "emacron",                           600, NULL },
-  { "Odieresis",                         600, NULL },
-  { "ucircumflex",                       600, NULL },
-  { "bracketleft",                       600, NULL },
-  { "Ugrave",                            600, NULL },
-  { "quoteright",                        600, NULL },
-  { "Udieresis",                         600, NULL },
-  { "perthousand",                       600, NULL },
-  { "Ydieresis",                         600, NULL },
-  { "umacron",                           600, NULL },
-  { "abreve",                            600, NULL },
-  { "Eacute",                            600, NULL },
-  { "adieresis",                         600, NULL },
+  { "I",                                 600, NULL },
+  { "eight",                             600, NULL },
+  { "periodcentered",                    600, NULL },
+  { "z",                                 600, NULL },
+  { "Uhungarumlaut",                     600, NULL },
   { "egrave",                            600, NULL },
+  { "uring",                             600, NULL },
+  { "s",                                 600, NULL },
+  { "oacute",                            600, NULL },
+  { "Yacute",                            600, NULL },
+  { "daggerdbl",                         600, NULL },
+  { "Atilde",                            600, NULL },
+  { "Edieresis",                         600, NULL },
+  { "onequarter",                        600, NULL },
+  { "braceleft",                         600, NULL },
+  { "braceright",                        600, NULL },
+  { "acute",                             600, NULL },
+  { "quotesingle",                       600, NULL },
+  { "bar",                               600, NULL },
+  { "i",                                 600, NULL },
+  { "multiply",                          600, NULL },
+  { "lslash",                            600, NULL },
+  { "P",                                 600, NULL },
+  { "six",                               600, NULL },
+  { "edotaccent",                        600, NULL },
+  { "guilsinglleft",                     600, NULL },
+  { "h",                                 600, NULL },
+  { "Cacute",                            600, NULL },
+  { "plus",                              600, NULL },
+  { "question",                          600, NULL },
+  { "summation",                         600, NULL },
+  { "A",                                 600, NULL },
+  { "igrave",                            600, NULL },
+  { "dcroat",                            600, NULL },
+  { "m",                                 600, NULL },
+  { "OE",                                600, NULL },
+  { "partialdiff",                       600, NULL },
+  { "U",                                 600, NULL },
+  { "x",                                 600, NULL },
+  { "y",                                 600, NULL },
+  { "Iogonek",                           600, NULL },
   { "edieresis",                         600, NULL },
-  { "idieresis",                         600, NULL },
-  { "Eth",                               600, NULL },
-  { "ae",                                600, NULL },
-  { "asterisk",                          600, NULL },
-  { "odieresis",                         600, NULL },
-  { "Uacute",                            600, NULL },
+  { "Ncaron",                            600, NULL },
+  { "cacute",                            600, NULL },
+  { "Dcroat",                            600, NULL },
+  { "rcaron",                            600, NULL },
+  { "tcaron",                            600, NULL },
+  { "ncommaaccent",                      600, NULL },
+  { "tcommaaccent",                      600, NULL },
+  { "logicalnot",                        600, NULL },
+  { "ordfeminine",                       600, NULL },
+  { "quotedblleft",                      600, NULL },
+  { "S",                                 600, NULL },
+  { "omacron",                           600, NULL },
+  { "Delta",                             600, NULL },
+  { "comma",                             600, NULL },
+  { "Gbreve",                            600, NULL },
   { "ugrave",                            600, NULL },
-  { "nine",                              600, NULL },
-  { "five",                              600, NULL },
-  { "udieresis",                         600, NULL },
-  { "Zcaron",                            600, NULL },
-  { "Scommaaccent",                      600, NULL },
-  { "threequarters",                     600, NULL },
-  { "guillemotright",                    600, NULL },
-  { "Ccedilla",                          600, NULL },
+  { "dcaron",                            600, NULL },
+  { "hyphen",                            600, NULL },
+  { "Oslash",                            600, NULL },
+  { "a",                                 600, NULL },
+  { "B",                                 600, NULL },
+  { "Rcaron",                            600, NULL },
+  { "kcommaaccent",                      600, NULL },
+  { "yacute",                            600, NULL },
   { "ydieresis",                         600, NULL },
-  { "tilde",                             600, NULL },
-  { "at",                                600, NULL },
+  { "R",                                 600, NULL },
+  { "aacute",                            600, NULL },
+  { "umacron",                           600, NULL },
+  { "Otilde",                            600, NULL },
+  { "Tcaron",                            600, NULL },
+  { "eogonek",                           600, NULL },
+  { "bullet",                            600, NULL },
   { "eacute",                            600, NULL },
-  { "underscore",                        600, NULL },
-  { "Euro",                              600, NULL },
-  { "Dcroat",                            600, NULL },
-  { "multiply",                          600, NULL },
-  { "zero",                              600, NULL },
-  { "eth",                               600, NULL },
-  { "Scedilla",                          600, NULL },
-  { "Ograve",                            600, NULL },
-  { "Racute",                            600, NULL },
-  { "partialdiff",                       600, NULL },
+  { "Zdotaccent",                        600, NULL },
+  { "scaron",                            600, NULL },
+  { "guillemotright",                    600, NULL },
+  { "two",                               600, NULL },
   { "uacute",                            600, NULL },
-  { "braceleft",                         600, NULL },
-  { "Thorn",                             600, NULL },
-  { "zcaron",                            600, NULL },
-  { "scommaaccent",                      600, NULL },
-  { "ccedilla",                          600, NULL },
-  { "Dcaron",                            600, NULL },
-  { "dcroat",                            600, NULL },
-  { "Ocircumflex",                       600, NULL },
-  { "Oacute",                            600, NULL },
-  { "scedilla",                          600, NULL },
-  { "ogonek",                            600, NULL },
-  { "ograve",                            600, NULL },
-  { "racute",                            600, NULL },
-  { "Tcaron",                            600, NULL },
-  { "Eogonek",                           600, NULL },
-  { "thorn",                             600, NULL },
-  { "degree",                            600, NULL },
-  { "registered",                        600, NULL },
-  { "radical",                           600, NULL },
-  { "Aring",                             600, NULL },
-  { "percent",                           600, NULL },
-  { "six",                               600, NULL },
-  { "paragraph",                         600, NULL },
-  { "dcaron",                            600, NULL },
-  { "Uogonek",                           600, NULL },
-  { "two",                               600, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            600, NULL },
-  { "Lacute",                            600, NULL },
-  { "ocircumflex",                       600, NULL },
-  { "oacute",                            600, NULL },
-  { "Uring",                             600, NULL },
-  { "Lcommaaccent",                      600, NULL },
-  { "tcaron",                            600, NULL },
-  { "eogonek",                           600, NULL },
-  { "Delta",                             600, NULL },
-  { "Ohungarumlaut",                     600, NULL },
-  { "asciicircum",                       600, NULL },
-  { "aring",                             600, NULL },
-  { "grave",                             600, NULL },
-  { "uogonek",                           600, NULL },
-  { "bracketright",                      600, NULL },
+  { "seven",                             600, NULL },
+  { "Abreve",                            600, NULL },
+  { "Udieresis",                         600, NULL },
   { "Iacute",                            600, NULL },
-  { "ampersand",                         600, NULL },
-  { "igrave",                            600, NULL },
-  { "lacute",                            600, NULL },
-  { "Ncaron",                            600, NULL },
-  { "plus",                              600, NULL },
-  { "uring",                             600, NULL },
-  { "quotesinglbase",                    600, NULL },
-  { "lcommaaccent",                      600, NULL },
-  { "Yacute",                            600, NULL },
-  { "ohungarumlaut",                     600, NULL },
-  { "threesuperior",                     600, NULL },
-  { "acute",                             600, NULL },
-  { "section",                           600, NULL },
+  { "Icircumflex",                       600, NULL },
+  { "O",                                 600, NULL },
+  { "nacute",                            600, NULL },
   { "dieresis",                          600, NULL },
-  { "iacute",                            600, NULL },
-  { "quotedblbase",                      600, NULL },
-  { "ncaron",                            600, NULL },
-  { "florin",                            600, NULL },
-  { "yacute",                            600, NULL },
-  { "Rcommaaccent",                      600, NULL },
+  { "Eacute",                            600, NULL },
+  { "ntilde",                            600, NULL },
   { "fi",                                600, NULL },
-  { "fl",                                600, NULL },
-  { "Acircumflex",                       600, NULL },
-  { "Cacute",                            600, NULL },
-  { "Icircumflex",                       600, NULL },
-  { "guillemotleft",                     600, NULL },
-  { "germandbls",                        600, NULL },
-  { "Amacron",                           600, NULL },
-  { "seven",                             600, NULL },
-  { "Sacute",                            600, NULL },
-  { "ordmasculine",                      600, NULL },
-  { "dotlessi",                          600, NULL },
-  { "sterling",                          600, NULL },
-  { "notequal",                          600, NULL },
-  { "Imacron",                           600, NULL },
-  { "rcommaaccent",                      600, NULL },
-  { "Zdotaccent",                        600, NULL },
-  { "acircumflex",                       600, NULL },
-  { "cacute",                            600, NULL },
-  { "Ecaron",                            600, NULL },
-  { "icircumflex",                       600, NULL },
-  { "braceright",                        600, NULL },
-  { "quotedblright",                     600, NULL },
-  { "amacron",                           600, NULL },
-  { "sacute",                            600, NULL },
-  { "imacron",                           600, NULL },
-  { "cent",                              600, NULL },
-  { "currency",                          600, NULL },
-  { "logicalnot",                        600, NULL },
-  { "zdotaccent",                        600, NULL },
-  { "Atilde",                            600, NULL },
-  { "breve",                             600, NULL },
-  { "bar",                               600, NULL },
-  { "fraction",                          600, NULL },
-  { "less",                              600, NULL },
-  { "ecaron",                            600, NULL },
-  { "guilsinglleft",                     600, NULL },
-  { "exclam",                            600, NULL },
-  { "period",                            600, NULL },
-  { "Rcaron",                            600, NULL },
-  { "Kcommaaccent",                      600, NULL },
-  { "greater",                           600, NULL },
-  { "atilde",                            600, NULL },
-  { "brokenbar",                         600, NULL },
-  { "quoteleft",                         600, NULL },
-  { "Edotaccent",                        600, NULL },
-  { "onesuperior",                       600, NULL }
+  { "trademark",                         600, NULL },
+  { "ampersand",                         600, NULL },
+  { "Lcommaaccent",                      600, NULL }
 };
 
 static BuiltinFontWidth helveticaWidthsTab[] = {
+  { "lcommaaccent",                      222, NULL },
+  { "onehalf",                           834, NULL },
+  { "uhungarumlaut",                     556, NULL },
+  { "gbreve",                            556, NULL },
+  { "n",                                 556, NULL },
+  { "Ecaron",                            667, NULL },
+  { "threesuperior",                     333, NULL },
+  { "zdotaccent",                        500, NULL },
+  { "quoteleft",                         222, NULL },
+  { "registered",                        737, NULL },
+  { "Gcommaaccent",                      778, NULL },
+  { "Racute",                            722, NULL },
+  { "k",                                 500, NULL },
+  { "copyright",                         737, NULL },
+  { "icircumflex",                       278, NULL },
+  { "abreve",                            556, NULL },
+  { "Imacron",                           278, NULL },
+  { "iacute",                            278, NULL },
+  { "e",                                 556, NULL },
+  { "equal",                             584, NULL },
+  { "dagger",                            556, NULL },
+  { "N",                                 722, NULL },
+  { "C",                                 722, NULL },
+  { "u",                                 556, NULL },
+  { "q",                                 556, NULL },
+  { "l",                                 222, NULL },
+  { "greater",                           584, NULL },
+  { "asterisk",                          389, NULL },
+  { "Emacron",                           667, NULL },
+  { "scommaaccent",                      500, NULL },
+  { "onesuperior",                       333, NULL },
+  { "percent",                           889, NULL },
+  { "o",                                 556, NULL },
+  { "Euro",                              556, NULL },
+  { "florin",                            556, NULL },
+  { "iogonek",                           222, NULL },
+  { "section",                           556, NULL },
+  { "Scaron",                            667, NULL },
+  { "degree",                            400, NULL },
+  { "K",                                 667, NULL },
+  { "Scommaaccent",                      667, NULL },
+  { "Aacute",                            667, NULL },
+  { "b",                                 556, NULL },
+  { "Dcaron",                            722, NULL },
+  { "Z",                                 611, NULL },
+  { "ecircumflex",                       556, NULL },
+  { "Amacron",                           667, NULL },
+  { "breve",                             333, NULL },
+  { "lcaron",                            299, NULL },
+  { "paragraph",                         537, NULL },
+  { "zcaron",                            500, NULL },
+  { "aring",                             556, NULL },
+  { "Ydieresis",                         667, NULL },
+  { "Odieresis",                         778, NULL },
+  { "oe",                                944, NULL },
+  { "five",                              556, NULL },
+  { "X",                                 667, NULL },
+  { "asciicircum",                       469, NULL },
+  { "emdash",                           1000, NULL },
+  { "Egrave",                            667, NULL },
+  { "aogonek",                           556, NULL },
+  { "ring",                              333, NULL },
   { "Ntilde",                            722, NULL },
-  { "rcaron",                            333, NULL },
-  { "kcommaaccent",                      500, NULL },
-  { "Ncommaaccent",                      722, NULL },
-  { "Zacute",                            611, NULL },
-  { "comma",                             278, NULL },
+  { "radical",                           453, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 556, NULL },
+  { "plusminus",                         584, NULL },
   { "cedilla",                           333, NULL },
-  { "plusminus",                         584, NULL },
-  { "circumflex",                        333, NULL },
-  { "dotaccent",                         333, NULL },
-  { "edotaccent",                        556, NULL },
-  { "asciitilde",                        584, NULL },
+  { "Idotaccent",                        278, NULL },
+  { "quotedblright",                     333, NULL },
+  { "Eth",                               722, NULL },
+  { "g",                                 556, NULL },
   { "colon",                             278, NULL },
-  { "onehalf",                           834, NULL },
-  { "dollar",                            556, NULL },
-  { "Lcaron",                            556, NULL },
-  { "ntilde",                            556, NULL },
-  { "Aogonek",                           667, NULL },
-  { "ncommaaccent",                      556, NULL },
-  { "minus",                             584, NULL },
-  { "Iogonek",                           278, NULL },
-  { "zacute",                            500, NULL },
+  { "ccedilla",                          500, NULL },
+  { "quotesinglbase",                    222, NULL },
+  { "grave",                             333, NULL },
+  { "Scedilla",                          667, NULL },
+  { "parenleft",                         333, NULL },
+  { "currency",                          556, NULL },
+  { "nine",                              556, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "Ccaron",                            722, NULL },
+  { "j",                                 222, NULL },
   { "yen",                               556, NULL },
-  { "space",                             278, NULL },
+  { "Y",                                 667, NULL },
+  { "ccaron",                            500, NULL },
   { "Omacron",                           778, NULL },
-  { "questiondown",                      611, NULL },
-  { "emdash",                           1000, NULL },
-  { "Agrave",                            667, NULL },
-  { "three",                             556, NULL },
-  { "numbersign",                        556, NULL },
-  { "lcaron",                            299, NULL },
-  { "A",                                 667, NULL },
-  { "B",                                 667, NULL },
-  { "C",                                 722, NULL },
-  { "aogonek",                           556, NULL },
+  { "lessequal",                         549, NULL },
+  { "Ucircumflex",                       722, NULL },
+  { "dollar",                            556, NULL },
+  { "Tcommaaccent",                      611, NULL },
+  { "Nacute",                            722, NULL },
+  { "v",                                 500, NULL },
+  { "dotaccent",                         333, NULL },
+  { "rcommaaccent",                      333, NULL },
+  { "Kcommaaccent",                      667, NULL },
+  { "imacron",                           278, NULL },
+  { "tilde",                             333, NULL },
+  { "underscore",                        556, NULL },
+  { "mu",                                556, NULL },
   { "D",                                 722, NULL },
-  { "E",                                 667, NULL },
-  { "onequarter",                        834, NULL },
+  { "racute",                            333, NULL },
+  { "circumflex",                        333, NULL },
+  { "Zcaron",                            611, NULL },
+  { "ogonek",                            333, NULL },
+  { "idieresis",                         278, NULL },
+  { "cent",                              556, NULL },
+  { "ae",                                889, NULL },
+  { "ocircumflex",                       556, NULL },
+  { "less",                              584, NULL },
+  { "minus",                             584, NULL },
+  { "four",                              556, NULL },
   { "F",                                 611, NULL },
+  { "Ocircumflex",                       778, NULL },
+  { "Uring",                             722, NULL },
+  { "Edotaccent",                        667, NULL },
+  { "perthousand",                      1000, NULL },
+  { "acircumflex",                       556, NULL },
   { "G",                                 778, NULL },
-  { "H",                                 722, NULL },
-  { "I",                                 278, NULL },
-  { "J",                                 500, NULL },
-  { "K",                                 667, NULL },
-  { "iogonek",                           222, NULL },
-  { "backslash",                         278, NULL },
-  { "L",                                 556, NULL },
-  { "periodcentered",                    278, NULL },
+  { "commaaccent",                       250, NULL },
+  { "W",                                 944, NULL },
+  { "bracketright",                      278, NULL },
+  { "Ugrave",                            722, NULL },
+  { "germandbls",                        611, NULL },
+  { "thorn",                             556, NULL },
+  { "zero",                              556, NULL },
+  { "period",                            278, NULL },
+  { "scedilla",                          500, NULL },
+  { "udieresis",                         556, NULL },
+  { "Ccedilla",                          722, NULL },
+  { "Igrave",                            278, NULL },
+  { "fl",                                500, NULL },
+  { "quotedblbase",                      333, NULL },
+  { "E",                                 667, NULL },
+  { "endash",                            556, NULL },
+  { "guillemotleft",                     556, NULL },
+  { "w",                                 722, NULL },
+  { "space",                             278, NULL },
+  { "Thorn",                             667, NULL },
+  { "eth",                               556, NULL },
+  { "twosuperior",                       333, NULL },
+  { "ecaron",                            556, NULL },
+  { "brokenbar",                         260, NULL },
+  { "Aogonek",                           667, NULL },
   { "M",                                 833, NULL },
-  { "N",                                 722, NULL },
+  { "odieresis",                         556, NULL },
+  { "Ograve",                            778, NULL },
+  { "T",                                 611, NULL },
+  { "amacron",                           556, NULL },
+  { "Ncommaaccent",                      722, NULL },
+  { "numbersign",                        556, NULL },
+  { "divide",                            584, NULL },
+  { "emacron",                           556, NULL },
+  { "Abreve",                            667, NULL },
+  { "Udieresis",                         722, NULL },
+  { "Iacute",                            278, NULL },
+  { "two",                               556, NULL },
+  { "uacute",                            556, NULL },
+  { "seven",                             556, NULL },
+  { "scaron",                            500, NULL },
+  { "guillemotright",                    556, NULL },
+  { "bullet",                            350, NULL },
+  { "eogonek",                           556, NULL },
+  { "eacute",                            556, NULL },
+  { "Zdotaccent",                        611, NULL },
+  { "trademark",                        1000, NULL },
+  { "ampersand",                         667, NULL },
+  { "Lcommaaccent",                      556, NULL },
+  { "ntilde",                            556, NULL },
+  { "fi",                                500, NULL },
+  { "dieresis",                          333, NULL },
+  { "Eacute",                            667, NULL },
+  { "O",                                 778, NULL },
+  { "Icircumflex",                       278, NULL },
+  { "nacute",                            556, NULL },
   { "omacron",                           556, NULL },
-  { "Tcommaaccent",                      611, NULL },
-  { "O",                                 778, NULL },
-  { "P",                                 667, NULL },
-  { "Q",                                 778, NULL },
-  { "Uhungarumlaut",                     722, NULL },
+  { "comma",                             278, NULL },
+  { "Delta",                             612, NULL },
+  { "Gbreve",                            778, NULL },
+  { "S",                                 667, NULL },
+  { "quotedblleft",                      333, NULL },
+  { "ordfeminine",                       370, NULL },
+  { "Otilde",                            778, NULL },
+  { "umacron",                           556, NULL },
+  { "Tcaron",                            611, NULL },
+  { "aacute",                            556, NULL },
+  { "B",                                 667, NULL },
+  { "kcommaaccent",                      500, NULL },
+  { "Rcaron",                            722, NULL },
+  { "yacute",                            500, NULL },
+  { "ydieresis",                         500, NULL },
   { "R",                                 722, NULL },
-  { "Aacute",                            667, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 667, NULL },
-  { "T",                                 611, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            556, NULL },
-  { "V",                                 667, NULL },
-  { "W",                                 944, NULL },
-  { "X",                                 667, NULL },
+  { "ugrave",                            556, NULL },
+  { "dcaron",                            643, NULL },
+  { "hyphen",                            333, NULL },
+  { "Oslash",                            778, NULL },
+  { "a",                                 556, NULL },
+  { "igrave",                            278, NULL },
+  { "dcroat",                            556, NULL },
   { "question",                          556, NULL },
-  { "equal",                             584, NULL },
-  { "Y",                                 667, NULL },
-  { "Z",                                 611, NULL },
-  { "four",                              556, NULL },
-  { "a",                                 556, NULL },
-  { "Gcommaaccent",                      778, NULL },
-  { "b",                                 556, NULL },
-  { "c",                                 500, NULL },
-  { "d",                                 556, NULL },
-  { "e",                                 556, NULL },
-  { "f",                                 278, NULL },
-  { "g",                                 556, NULL },
-  { "bullet",                            350, NULL },
+  { "summation",                         600, NULL },
+  { "A",                                 667, NULL },
+  { "guilsinglleft",                     333, NULL },
   { "h",                                 556, NULL },
-  { "i",                                 222, NULL },
-  { "Oslash",                            778, NULL },
-  { "dagger",                            556, NULL },
-  { "j",                                 222, NULL },
-  { "k",                                 500, NULL },
-  { "l",                                 222, NULL },
-  { "m",                                 833, NULL },
-  { "n",                                 556, NULL },
+  { "Cacute",                            722, NULL },
+  { "plus",                              584, NULL },
+  { "ncommaaccent",                      556, NULL },
   { "tcommaaccent",                      278, NULL },
-  { "o",                                 556, NULL },
-  { "ordfeminine",                       370, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 556, NULL },
-  { "q",                                 556, NULL },
-  { "uhungarumlaut",                     556, NULL },
-  { "r",                                 333, NULL },
-  { "twosuperior",                       333, NULL },
-  { "aacute",                            556, NULL },
-  { "s",                                 500, NULL },
-  { "OE",                               1000, NULL },
-  { "t",                                 278, NULL },
-  { "divide",                            584, NULL },
-  { "u",                                 556, NULL },
-  { "Ccaron",                            722, NULL },
-  { "v",                                 500, NULL },
-  { "w",                                 722, NULL },
+  { "logicalnot",                        584, NULL },
+  { "cacute",                            500, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcaron",                            317, NULL },
+  { "rcaron",                            333, NULL },
   { "x",                                 500, NULL },
+  { "Iogonek",                           278, NULL },
   { "y",                                 500, NULL },
-  { "z",                                 500, NULL },
-  { "Gbreve",                            778, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        278, NULL },
-  { "Nacute",                            722, NULL },
-  { "quotedbl",                          355, NULL },
-  { "gcommaaccent",                      556, NULL },
-  { "mu",                                556, NULL },
-  { "greaterequal",                      549, NULL },
-  { "Scaron",                            667, NULL },
-  { "Lslash",                            556, NULL },
-  { "semicolon",                         278, NULL },
-  { "oslash",                            611, NULL },
-  { "lessequal",                         549, NULL },
-  { "lozenge",                           471, NULL },
-  { "parenright",                        333, NULL },
-  { "ccaron",                            500, NULL },
-  { "Ecircumflex",                       667, NULL },
-  { "gbreve",                            556, NULL },
-  { "trademark",                        1000, NULL },
+  { "edieresis",                         556, NULL },
+  { "Ncaron",                            722, NULL },
+  { "m",                                 833, NULL },
+  { "OE",                               1000, NULL },
+  { "U",                                 722, NULL },
+  { "partialdiff",                       476, NULL },
+  { "braceright",                        334, NULL },
+  { "braceleft",                         334, NULL },
+  { "acute",                             333, NULL },
+  { "onequarter",                        834, NULL },
+  { "Atilde",                            667, NULL },
+  { "Edieresis",                         667, NULL },
+  { "Yacute",                            667, NULL },
+  { "oacute",                            556, NULL },
   { "daggerdbl",                         556, NULL },
-  { "nacute",                            556, NULL },
-  { "macron",                            333, NULL },
-  { "Otilde",                            778, NULL },
-  { "Emacron",                           667, NULL },
-  { "ellipsis",                         1000, NULL },
-  { "scaron",                            500, NULL },
-  { "AE",                               1000, NULL },
-  { "Ucircumflex",                       722, NULL },
+  { "six",                               556, NULL },
+  { "edotaccent",                        556, NULL },
+  { "P",                                 667, NULL },
   { "lslash",                            222, NULL },
-  { "quotedblleft",                      333, NULL },
-  { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
+  { "multiply",                          584, NULL },
+  { "i",                                 222, NULL },
   { "quotesingle",                       191, NULL },
+  { "bar",                               260, NULL },
+  { "agrave",                            556, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "Aring",                             667, NULL },
+  { "t",                                 278, NULL },
+  { "quotedbl",                          355, NULL },
+  { "Oacute",                            778, NULL },
+  { "egrave",                            556, NULL },
+  { "uring",                             556, NULL },
+  { "s",                                 500, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "z",                                 500, NULL },
   { "eight",                             556, NULL },
+  { "I",                                 278, NULL },
+  { "one",                               556, NULL },
+  { "periodcentered",                    278, NULL },
+  { "c",                                 500, NULL },
+  { "d",                                 556, NULL },
+  { "zacute",                            500, NULL },
+  { "Umacron",                           722, NULL },
+  { "ncaron",                            556, NULL },
+  { "adieresis",                         556, NULL },
+  { "lozenge",                           471, NULL },
+  { "V",                                 667, NULL },
+  { "Q",                                 778, NULL },
   { "exclamdown",                        333, NULL },
-  { "endash",                            556, NULL },
-  { "oe",                                944, NULL },
-  { "Abreve",                            667, NULL },
-  { "Umacron",                           722, NULL },
-  { "ecircumflex",                       556, NULL },
-  { "Adieresis",                         667, NULL },
-  { "copyright",                         737, NULL },
-  { "Egrave",                            667, NULL },
+  { "quoteright",                        222, NULL },
+  { "uogonek",                           556, NULL },
+  { "semicolon",                         278, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "Eogonek",                           667, NULL },
+  { "macron",                            333, NULL },
+  { "ordmasculine",                      365, NULL },
+  { "Lcaron",                            556, NULL },
+  { "backslash",                         278, NULL },
+  { "questiondown",                      611, NULL },
+  { "three",                             556, NULL },
   { "slash",                             278, NULL },
-  { "Edieresis",                         667, NULL },
-  { "otilde",                            556, NULL },
-  { "Idieresis",                         278, NULL },
-  { "parenleft",                         333, NULL },
-  { "one",                               556, NULL },
-  { "emacron",                           556, NULL },
-  { "Odieresis",                         778, NULL },
   { "ucircumflex",                       556, NULL },
+  { "r",                                 333, NULL },
+  { "f",                                 278, NULL },
+  { "gcommaaccent",                      556, NULL },
+  { "Ohungarumlaut",                     778, NULL },
   { "bracketleft",                       278, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        222, NULL },
-  { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         667, NULL },
-  { "umacron",                           556, NULL },
-  { "abreve",                            556, NULL },
-  { "Eacute",                            667, NULL },
-  { "adieresis",                         556, NULL },
-  { "egrave",                            556, NULL },
-  { "edieresis",                         556, NULL },
-  { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
-  { "ae",                                889, NULL },
-  { "asterisk",                          389, NULL },
-  { "odieresis",                         556, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            556, NULL },
-  { "nine",                              556, NULL },
-  { "five",                              556, NULL },
-  { "udieresis",                         556, NULL },
-  { "Zcaron",                            611, NULL },
-  { "Scommaaccent",                      667, NULL },
-  { "threequarters",                     834, NULL },
-  { "guillemotright",                    556, NULL },
-  { "Ccedilla",                          722, NULL },
-  { "ydieresis",                         500, NULL },
-  { "tilde",                             333, NULL },
-  { "at",                               1015, NULL },
-  { "eacute",                            556, NULL },
-  { "underscore",                        556, NULL },
-  { "Euro",                              556, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          584, NULL },
-  { "zero",                              556, NULL },
-  { "eth",                               556, NULL },
-  { "Scedilla",                          667, NULL },
-  { "Ograve",                            778, NULL },
-  { "Racute",                            722, NULL },
-  { "partialdiff",                       476, NULL },
-  { "uacute",                            556, NULL },
-  { "braceleft",                         334, NULL },
-  { "Thorn",                             667, NULL },
-  { "zcaron",                            500, NULL },
-  { "scommaaccent",                      500, NULL },
-  { "ccedilla",                          500, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            556, NULL },
-  { "Ocircumflex",                       778, NULL },
-  { "Oacute",                            778, NULL },
-  { "scedilla",                          500, NULL },
-  { "ogonek",                            333, NULL },
+  { "otilde",                            556, NULL },
+  { "parenright",                        333, NULL },
+  { "Rcommaaccent",                      722, NULL },
   { "ograve",                            556, NULL },
-  { "racute",                            333, NULL },
-  { "Tcaron",                            611, NULL },
-  { "Eogonek",                           667, NULL },
-  { "thorn",                             556, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        737, NULL },
-  { "radical",                           453, NULL },
-  { "Aring",                             667, NULL },
-  { "percent",                           889, NULL },
-  { "six",                               556, NULL },
-  { "paragraph",                         537, NULL },
-  { "dcaron",                            643, NULL },
+  { "Lacute",                            556, NULL },
+  { "sacute",                            500, NULL },
+  { "Idieresis",                         278, NULL },
   { "Uogonek",                           722, NULL },
-  { "two",                               556, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            278, NULL },
-  { "Lacute",                            556, NULL },
-  { "ocircumflex",                       556, NULL },
-  { "oacute",                            556, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      556, NULL },
-  { "tcaron",                            317, NULL },
-  { "eogonek",                           556, NULL },
-  { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     778, NULL },
-  { "asciicircum",                       469, NULL },
-  { "aring",                             556, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           556, NULL },
-  { "bracketright",                      278, NULL },
-  { "Iacute",                            278, NULL },
-  { "ampersand",                         667, NULL },
-  { "igrave",                            278, NULL },
+  { "Lslash",                            556, NULL },
+  { "caron",                             333, NULL },
   { "lacute",                            222, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              584, NULL },
-  { "uring",                             556, NULL },
-  { "quotesinglbase",                    222, NULL },
-  { "lcommaaccent",                      222, NULL },
-  { "Yacute",                            667, NULL },
+  { "sterling",                          556, NULL },
+  { "H",                                 722, NULL },
+  { "at",                               1015, NULL },
+  { "greaterequal",                      549, NULL },
+  { "threequarters",                     834, NULL },
+  { "J",                                 500, NULL },
+  { "L",                                 556, NULL },
   { "ohungarumlaut",                     556, NULL },
-  { "threesuperior",                     333, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           556, NULL },
-  { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      333, NULL },
-  { "ncaron",                            556, NULL },
-  { "florin",                            556, NULL },
-  { "yacute",                            500, NULL },
-  { "Rcommaaccent",                      722, NULL },
-  { "fi",                                500, NULL },
-  { "fl",                                500, NULL },
-  { "Acircumflex",                       667, NULL },
-  { "Cacute",                            722, NULL },
-  { "Icircumflex",                       278, NULL },
-  { "guillemotleft",                     556, NULL },
-  { "germandbls",                        611, NULL },
-  { "Amacron",                           667, NULL },
-  { "seven",                             556, NULL },
-  { "Sacute",                            667, NULL },
-  { "ordmasculine",                      365, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          556, NULL },
+  { "Ecircumflex",                       667, NULL },
   { "notequal",                          549, NULL },
-  { "Imacron",                           278, NULL },
-  { "rcommaaccent",                      333, NULL },
-  { "Zdotaccent",                        611, NULL },
-  { "acircumflex",                       556, NULL },
-  { "cacute",                            500, NULL },
-  { "Ecaron",                            667, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        334, NULL },
-  { "quotedblright",                     333, NULL },
-  { "amacron",                           556, NULL },
-  { "sacute",                            500, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              556, NULL },
-  { "currency",                          556, NULL },
-  { "logicalnot",                        584, NULL },
-  { "zdotaccent",                        500, NULL },
-  { "Atilde",                            667, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               260, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              584, NULL },
-  { "ecaron",                            556, NULL },
-  { "guilsinglleft",                     333, NULL },
   { "exclam",                            278, NULL },
-  { "period",                            278, NULL },
-  { "Rcaron",                            722, NULL },
-  { "Kcommaaccent",                      667, NULL },
-  { "greater",                           584, NULL },
+  { "Agrave",                            667, NULL },
+  { "AE",                               1000, NULL },
+  { "Acircumflex",                       667, NULL },
+  { "oslash",                            611, NULL },
+  { "Uacute",                            722, NULL },
   { "atilde",                            556, NULL },
-  { "brokenbar",                         260, NULL },
-  { "quoteleft",                         222, NULL },
-  { "Edotaccent",                        667, NULL },
-  { "onesuperior",                       333, NULL }
+  { "Zacute",                            611, NULL },
+  { "fraction",                          167, NULL },
+  { "Sacute",                            667, NULL },
+  { "Adieresis",                         667, NULL },
+  { "asciitilde",                        584, NULL }
 };
 
 static BuiltinFontWidth helveticaBoldWidthsTab[] = {
-  { "Ntilde",                            722, NULL },
-  { "rcaron",                            389, NULL },
-  { "kcommaaccent",                      556, NULL },
-  { "Ncommaaccent",                      722, NULL },
-  { "Zacute",                            611, NULL },
-  { "comma",                             278, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         584, NULL },
-  { "circumflex",                        333, NULL },
-  { "dotaccent",                         333, NULL },
-  { "edotaccent",                        556, NULL },
-  { "asciitilde",                        584, NULL },
-  { "colon",                             333, NULL },
-  { "onehalf",                           834, NULL },
-  { "dollar",                            556, NULL },
+  { "uogonek",                           611, NULL },
+  { "quoteright",                        278, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "semicolon",                         333, NULL },
+  { "V",                                 667, NULL },
+  { "lozenge",                           494, NULL },
+  { "exclamdown",                        333, NULL },
+  { "Q",                                 778, NULL },
+  { "zacute",                            500, NULL },
+  { "Umacron",                           722, NULL },
+  { "adieresis",                         556, NULL },
+  { "ncaron",                            611, NULL },
+  { "slash",                             278, NULL },
+  { "r",                                 389, NULL },
+  { "ucircumflex",                       611, NULL },
+  { "three",                             556, NULL },
+  { "ordmasculine",                      365, NULL },
   { "Lcaron",                            611, NULL },
-  { "ntilde",                            611, NULL },
-  { "Aogonek",                           722, NULL },
-  { "ncommaaccent",                      611, NULL },
-  { "minus",                             584, NULL },
-  { "Iogonek",                           278, NULL },
-  { "zacute",                            500, NULL },
-  { "yen",                               556, NULL },
-  { "space",                             278, NULL },
-  { "Omacron",                           778, NULL },
+  { "backslash",                         278, NULL },
   { "questiondown",                      611, NULL },
-  { "emdash",                           1000, NULL },
+  { "macron",                            333, NULL },
+  { "Eogonek",                           667, NULL },
+  { "Oacute",                            778, NULL },
+  { "t",                                 333, NULL },
+  { "quotedbl",                          474, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "Aring",                             722, NULL },
+  { "agrave",                            556, NULL },
+  { "d",                                 611, NULL },
+  { "c",                                 556, NULL },
+  { "I",                                 278, NULL },
+  { "one",                               556, NULL },
+  { "eight",                             556, NULL },
+  { "periodcentered",                    278, NULL },
+  { "z",                                 500, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "egrave",                            556, NULL },
+  { "s",                                 556, NULL },
+  { "uring",                             611, NULL },
   { "Agrave",                            722, NULL },
-  { "three",                             556, NULL },
-  { "numbersign",                        556, NULL },
-  { "lcaron",                            400, NULL },
-  { "A",                                 722, NULL },
-  { "B",                                 722, NULL },
-  { "C",                                 722, NULL },
-  { "aogonek",                           556, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 667, NULL },
-  { "onequarter",                        834, NULL },
-  { "F",                                 611, NULL },
-  { "G",                                 778, NULL },
-  { "H",                                 722, NULL },
-  { "I",                                 278, NULL },
+  { "AE",                               1000, NULL },
+  { "exclam",                            333, NULL },
+  { "notequal",                          549, NULL },
+  { "oslash",                            611, NULL },
+  { "Acircumflex",                       722, NULL },
   { "J",                                 556, NULL },
-  { "K",                                 722, NULL },
-  { "iogonek",                           278, NULL },
-  { "backslash",                         278, NULL },
+  { "threequarters",                     834, NULL },
+  { "ohungarumlaut",                     611, NULL },
   { "L",                                 611, NULL },
-  { "periodcentered",                    278, NULL },
-  { "M",                                 833, NULL },
-  { "N",                                 722, NULL },
-  { "omacron",                           611, NULL },
-  { "Tcommaaccent",                      611, NULL },
-  { "O",                                 778, NULL },
-  { "P",                                 667, NULL },
-  { "Q",                                 778, NULL },
-  { "Uhungarumlaut",                     722, NULL },
-  { "R",                                 722, NULL },
-  { "Aacute",                            722, NULL },
+  { "Ecircumflex",                       667, NULL },
+  { "H",                                 722, NULL },
+  { "sterling",                          556, NULL },
+  { "greaterequal",                      549, NULL },
+  { "at",                                975, NULL },
+  { "lacute",                            278, NULL },
+  { "Uogonek",                           722, NULL },
   { "caron",                             333, NULL },
+  { "Lslash",                            611, NULL },
+  { "asciitilde",                        584, NULL },
+  { "fraction",                          167, NULL },
+  { "Adieresis",                         722, NULL },
+  { "Sacute",                            667, NULL },
+  { "Uacute",                            722, NULL },
+  { "Zacute",                            611, NULL },
+  { "atilde",                            556, NULL },
+  { "otilde",                            611, NULL },
+  { "parenright",                        333, NULL },
+  { "gcommaaccent",                      611, NULL },
+  { "bracketleft",                       333, NULL },
+  { "Ohungarumlaut",                     778, NULL },
+  { "f",                                 333, NULL },
+  { "Lacute",                            611, NULL },
+  { "sacute",                            556, NULL },
+  { "Idieresis",                         278, NULL },
+  { "ograve",                            611, NULL },
+  { "Rcommaaccent",                      722, NULL },
+  { "ordfeminine",                       370, NULL },
+  { "quotedblleft",                      500, NULL },
   { "S",                                 667, NULL },
-  { "T",                                 611, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            556, NULL },
-  { "V",                                 667, NULL },
-  { "W",                                 944, NULL },
-  { "X",                                 667, NULL },
-  { "question",                          611, NULL },
-  { "equal",                             584, NULL },
-  { "Y",                                 667, NULL },
-  { "Z",                                 611, NULL },
-  { "four",                              556, NULL },
+  { "comma",                             278, NULL },
+  { "Delta",                             612, NULL },
+  { "omacron",                           611, NULL },
+  { "Gbreve",                            778, NULL },
+  { "dcaron",                            743, NULL },
+  { "ugrave",                            611, NULL },
   { "a",                                 556, NULL },
-  { "Gcommaaccent",                      778, NULL },
-  { "b",                                 611, NULL },
-  { "c",                                 556, NULL },
-  { "d",                                 611, NULL },
-  { "e",                                 556, NULL },
-  { "f",                                 333, NULL },
-  { "g",                                 611, NULL },
-  { "bullet",                            350, NULL },
-  { "h",                                 611, NULL },
-  { "i",                                 278, NULL },
+  { "hyphen",                            333, NULL },
   { "Oslash",                            778, NULL },
-  { "dagger",                            556, NULL },
-  { "j",                                 278, NULL },
-  { "k",                                 556, NULL },
-  { "l",                                 278, NULL },
-  { "m",                                 889, NULL },
-  { "n",                                 611, NULL },
-  { "tcommaaccent",                      333, NULL },
-  { "o",                                 611, NULL },
-  { "ordfeminine",                       370, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 611, NULL },
-  { "q",                                 611, NULL },
-  { "uhungarumlaut",                     611, NULL },
-  { "r",                                 389, NULL },
-  { "twosuperior",                       333, NULL },
+  { "B",                                 722, NULL },
+  { "R",                                 722, NULL },
+  { "ydieresis",                         556, NULL },
+  { "yacute",                            556, NULL },
+  { "kcommaaccent",                      556, NULL },
+  { "Rcaron",                            722, NULL },
   { "aacute",                            556, NULL },
-  { "s",                                 556, NULL },
-  { "OE",                               1000, NULL },
-  { "t",                                 333, NULL },
-  { "divide",                            584, NULL },
-  { "u",                                 611, NULL },
-  { "Ccaron",                            722, NULL },
-  { "v",                                 556, NULL },
-  { "w",                                 778, NULL },
-  { "x",                                 556, NULL },
-  { "y",                                 556, NULL },
-  { "z",                                 500, NULL },
-  { "Gbreve",                            778, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        278, NULL },
-  { "Nacute",                            722, NULL },
-  { "quotedbl",                          474, NULL },
-  { "gcommaaccent",                      611, NULL },
-  { "mu",                                611, NULL },
-  { "greaterequal",                      549, NULL },
-  { "Scaron",                            667, NULL },
-  { "Lslash",                            611, NULL },
-  { "semicolon",                         333, NULL },
-  { "oslash",                            611, NULL },
-  { "lessequal",                         549, NULL },
-  { "lozenge",                           494, NULL },
-  { "parenright",                        333, NULL },
-  { "ccaron",                            556, NULL },
-  { "Ecircumflex",                       667, NULL },
-  { "gbreve",                            611, NULL },
-  { "trademark",                        1000, NULL },
-  { "daggerdbl",                         556, NULL },
-  { "nacute",                            611, NULL },
-  { "macron",                            333, NULL },
   { "Otilde",                            778, NULL },
-  { "Emacron",                           667, NULL },
-  { "ellipsis",                         1000, NULL },
+  { "umacron",                           611, NULL },
+  { "Tcaron",                            611, NULL },
+  { "bullet",                            350, NULL },
+  { "eogonek",                           556, NULL },
+  { "eacute",                            556, NULL },
+  { "Zdotaccent",                        611, NULL },
   { "scaron",                            556, NULL },
-  { "AE",                               1000, NULL },
-  { "Ucircumflex",                       722, NULL },
-  { "lslash",                            278, NULL },
-  { "quotedblleft",                      500, NULL },
-  { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
-  { "quotesingle",                       238, NULL },
-  { "eight",                             556, NULL },
-  { "exclamdown",                        333, NULL },
-  { "endash",                            556, NULL },
-  { "oe",                                944, NULL },
+  { "guillemotright",                    556, NULL },
+  { "uacute",                            611, NULL },
+  { "two",                               556, NULL },
+  { "seven",                             556, NULL },
   { "Abreve",                            722, NULL },
-  { "Umacron",                           722, NULL },
-  { "ecircumflex",                       556, NULL },
-  { "Adieresis",                         722, NULL },
-  { "copyright",                         737, NULL },
-  { "Egrave",                            667, NULL },
-  { "slash",                             278, NULL },
-  { "Edieresis",                         667, NULL },
-  { "otilde",                            611, NULL },
-  { "Idieresis",                         278, NULL },
-  { "parenleft",                         333, NULL },
-  { "one",                               556, NULL },
-  { "emacron",                           556, NULL },
-  { "Odieresis",                         778, NULL },
-  { "ucircumflex",                       611, NULL },
-  { "bracketleft",                       333, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        278, NULL },
   { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         667, NULL },
-  { "umacron",                           611, NULL },
-  { "abreve",                            556, NULL },
+  { "Iacute",                            278, NULL },
+  { "nacute",                            611, NULL },
+  { "O",                                 778, NULL },
+  { "Icircumflex",                       278, NULL },
+  { "dieresis",                          333, NULL },
   { "Eacute",                            667, NULL },
-  { "adieresis",                         556, NULL },
-  { "egrave",                            556, NULL },
+  { "ntilde",                            611, NULL },
+  { "fi",                                611, NULL },
+  { "ampersand",                         722, NULL },
+  { "trademark",                        1000, NULL },
+  { "Lcommaaccent",                      611, NULL },
+  { "Yacute",                            667, NULL },
+  { "oacute",                            611, NULL },
+  { "daggerdbl",                         556, NULL },
+  { "Atilde",                            722, NULL },
+  { "Edieresis",                         667, NULL },
+  { "onequarter",                        834, NULL },
+  { "acute",                             333, NULL },
+  { "braceright",                        389, NULL },
+  { "braceleft",                         389, NULL },
+  { "quotesingle",                       238, NULL },
+  { "bar",                               280, NULL },
+  { "i",                                 278, NULL },
+  { "multiply",                          584, NULL },
+  { "lslash",                            278, NULL },
+  { "P",                                 667, NULL },
+  { "edotaccent",                        556, NULL },
+  { "six",                               556, NULL },
+  { "Cacute",                            722, NULL },
+  { "h",                                 611, NULL },
+  { "guilsinglleft",                     333, NULL },
+  { "plus",                              584, NULL },
+  { "summation",                         600, NULL },
+  { "question",                          611, NULL },
+  { "A",                                 722, NULL },
+  { "dcroat",                            611, NULL },
+  { "igrave",                            278, NULL },
+  { "OE",                               1000, NULL },
+  { "m",                                 889, NULL },
+  { "U",                                 722, NULL },
+  { "partialdiff",                       494, NULL },
+  { "y",                                 556, NULL },
+  { "Iogonek",                           278, NULL },
   { "edieresis",                         556, NULL },
+  { "x",                                 556, NULL },
+  { "Ncaron",                            722, NULL },
+  { "Dcroat",                            722, NULL },
+  { "cacute",                            556, NULL },
+  { "tcaron",                            389, NULL },
+  { "rcaron",                            389, NULL },
+  { "ncommaaccent",                      611, NULL },
+  { "logicalnot",                        584, NULL },
+  { "tcommaaccent",                      333, NULL },
+  { "underscore",                        556, NULL },
+  { "racute",                            389, NULL },
+  { "D",                                 722, NULL },
+  { "mu",                                611, NULL },
+  { "Kcommaaccent",                      722, NULL },
+  { "imacron",                           278, NULL },
+  { "rcommaaccent",                      389, NULL },
+  { "tilde",                             333, NULL },
+  { "dollar",                            556, NULL },
+  { "Tcommaaccent",                      611, NULL },
+  { "dotaccent",                         333, NULL },
+  { "Nacute",                            722, NULL },
+  { "v",                                 556, NULL },
+  { "less",                              584, NULL },
+  { "ocircumflex",                       611, NULL },
+  { "four",                              556, NULL },
+  { "minus",                             584, NULL },
+  { "ae",                                889, NULL },
+  { "cent",                              556, NULL },
+  { "ogonek",                            333, NULL },
   { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
-  { "ae",                                889, NULL },
-  { "asterisk",                          389, NULL },
-  { "odieresis",                         611, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            611, NULL },
+  { "circumflex",                        333, NULL },
+  { "Zcaron",                            611, NULL },
   { "nine",                              556, NULL },
-  { "five",                              556, NULL },
-  { "udieresis",                         611, NULL },
-  { "Zcaron",                            611, NULL },
-  { "Scommaaccent",                      667, NULL },
-  { "threequarters",                     834, NULL },
-  { "guillemotright",                    556, NULL },
-  { "Ccedilla",                          722, NULL },
-  { "ydieresis",                         556, NULL },
-  { "tilde",                             333, NULL },
-  { "dbldaggerumlaut",                   556, NULL },
-  { "at",                                975, NULL },
-  { "eacute",                            556, NULL },
-  { "underscore",                        556, NULL },
-  { "Euro",                              556, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          584, NULL },
-  { "zero",                              556, NULL },
+  { "currency",                          556, NULL },
+  { "parenleft",                         333, NULL },
+  { "Scedilla",                          667, NULL },
+  { "grave",                             333, NULL },
+  { "quotesinglbase",                    278, NULL },
+  { "Ucircumflex",                       722, NULL },
+  { "lessequal",                         549, NULL },
+  { "Omacron",                           778, NULL },
+  { "ccaron",                            556, NULL },
+  { "Y",                                 667, NULL },
+  { "yen",                               556, NULL },
+  { "Ccaron",                            722, NULL },
+  { "j",                                 278, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "ecaron",                            556, NULL },
+  { "brokenbar",                         280, NULL },
+  { "Aogonek",                           722, NULL },
+  { "w",                                 778, NULL },
+  { "twosuperior",                       333, NULL },
   { "eth",                               611, NULL },
-  { "Scedilla",                          667, NULL },
+  { "Thorn",                             667, NULL },
+  { "space",                             278, NULL },
+  { "guillemotleft",                     556, NULL },
+  { "endash",                            556, NULL },
+  { "fl",                                611, NULL },
+  { "E",                                 667, NULL },
+  { "quotedblbase",                      500, NULL },
+  { "numbersign",                        556, NULL },
+  { "emacron",                           556, NULL },
+  { "divide",                            584, NULL },
+  { "amacron",                           556, NULL },
+  { "Ncommaaccent",                      722, NULL },
+  { "T",                                 611, NULL },
+  { "odieresis",                         611, NULL },
+  { "M",                                 833, NULL },
   { "Ograve",                            778, NULL },
-  { "Racute",                            722, NULL },
-  { "partialdiff",                       494, NULL },
-  { "uacute",                            611, NULL },
-  { "braceleft",                         389, NULL },
-  { "Thorn",                             667, NULL },
-  { "zcaron",                            500, NULL },
-  { "scommaaccent",                      556, NULL },
-  { "ccedilla",                          556, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            611, NULL },
+  { "G",                                 778, NULL },
+  { "perthousand",                      1000, NULL },
+  { "Edotaccent",                        667, NULL },
+  { "acircumflex",                       556, NULL },
+  { "F",                                 611, NULL },
   { "Ocircumflex",                       778, NULL },
-  { "Oacute",                            778, NULL },
+  { "Uring",                             722, NULL },
+  { "Ccedilla",                          722, NULL },
+  { "Igrave",                            278, NULL },
+  { "zero",                              556, NULL },
+  { "udieresis",                         611, NULL },
+  { "period",                            278, NULL },
   { "scedilla",                          556, NULL },
-  { "ogonek",                            333, NULL },
-  { "ograve",                            611, NULL },
-  { "racute",                            389, NULL },
-  { "Tcaron",                            611, NULL },
-  { "Eogonek",                           667, NULL },
+  { "germandbls",                        611, NULL },
+  { "Ugrave",                            722, NULL },
   { "thorn",                             611, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        737, NULL },
-  { "radical",                           549, NULL },
-  { "Aring",                             722, NULL },
-  { "percent",                           889, NULL },
-  { "six",                               556, NULL },
-  { "paragraph",                         556, NULL },
-  { "dcaron",                            743, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               556, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            278, NULL },
-  { "Lacute",                            611, NULL },
-  { "ocircumflex",                       611, NULL },
-  { "oacute",                            611, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      611, NULL },
-  { "tcaron",                            389, NULL },
-  { "eogonek",                           556, NULL },
-  { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     778, NULL },
-  { "asciicircum",                       584, NULL },
-  { "aring",                             556, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           611, NULL },
+  { "commaaccent",                       250, NULL },
+  { "W",                                 944, NULL },
   { "bracketright",                      333, NULL },
-  { "Iacute",                            278, NULL },
-  { "ampersand",                         722, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            278, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              584, NULL },
-  { "uring",                             611, NULL },
-  { "quotesinglbase",                    278, NULL },
-  { "lcommaaccent",                      278, NULL },
-  { "Yacute",                            667, NULL },
-  { "ohungarumlaut",                     611, NULL },
-  { "threesuperior",                     333, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           556, NULL },
-  { "dieresis",                          333, NULL },
+  { "l",                                 278, NULL },
+  { "q",                                 611, NULL },
+  { "N",                                 722, NULL },
+  { "dagger",                            556, NULL },
+  { "equal",                             584, NULL },
+  { "u",                                 611, NULL },
+  { "C",                                 722, NULL },
   { "iacute",                            278, NULL },
-  { "quotedblbase",                      500, NULL },
-  { "ncaron",                            611, NULL },
-  { "florin",                            556, NULL },
-  { "yacute",                            556, NULL },
-  { "Rcommaaccent",                      722, NULL },
-  { "fi",                                611, NULL },
-  { "fl",                                611, NULL },
-  { "Acircumflex",                       722, NULL },
-  { "Cacute",                            722, NULL },
-  { "Icircumflex",                       278, NULL },
-  { "guillemotleft",                     556, NULL },
-  { "germandbls",                        611, NULL },
-  { "Amacron",                           722, NULL },
-  { "seven",                             556, NULL },
-  { "Sacute",                            667, NULL },
-  { "ordmasculine",                      365, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          556, NULL },
-  { "notequal",                          549, NULL },
+  { "e",                                 556, NULL },
   { "Imacron",                           278, NULL },
-  { "rcommaaccent",                      389, NULL },
-  { "Zdotaccent",                        611, NULL },
-  { "acircumflex",                       556, NULL },
-  { "cacute",                            556, NULL },
+  { "abreve",                            556, NULL },
+  { "icircumflex",                       278, NULL },
+  { "percent",                           889, NULL },
+  { "o",                                 611, NULL },
+  { "asterisk",                          389, NULL },
+  { "Emacron",                           667, NULL },
+  { "scommaaccent",                      556, NULL },
+  { "onesuperior",                       333, NULL },
+  { "greater",                           584, NULL },
   { "Ecaron",                            667, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        389, NULL },
+  { "zdotaccent",                        500, NULL },
+  { "threesuperior",                     333, NULL },
+  { "n",                                 611, NULL },
+  { "dbldaggerumlaut",                   556, NULL },
+  { "onehalf",                           834, NULL },
+  { "lcommaaccent",                      278, NULL },
+  { "uhungarumlaut",                     611, NULL },
+  { "gbreve",                            611, NULL },
+  { "k",                                 556, NULL },
+  { "copyright",                         737, NULL },
+  { "Racute",                            722, NULL },
+  { "Gcommaaccent",                      778, NULL },
+  { "quoteleft",                         278, NULL },
+  { "registered",                        737, NULL },
+  { "aogonek",                           556, NULL },
+  { "Egrave",                            667, NULL },
+  { "ring",                              333, NULL },
+  { "emdash",                           1000, NULL },
+  { "five",                              556, NULL },
+  { "asciicircum",                       584, NULL },
+  { "X",                                 667, NULL },
+  { "oe",                                944, NULL },
+  { "Odieresis",                         778, NULL },
+  { "ccedilla",                          556, NULL },
+  { "g",                                 611, NULL },
+  { "colon",                             333, NULL },
+  { "Idotaccent",                        278, NULL },
+  { "cedilla",                           333, NULL },
+  { "plusminus",                         584, NULL },
+  { "Eth",                               722, NULL },
   { "quotedblright",                     500, NULL },
-  { "amacron",                           556, NULL },
-  { "sacute",                            556, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              556, NULL },
-  { "currency",                          556, NULL },
-  { "logicalnot",                        584, NULL },
-  { "zdotaccent",                        500, NULL },
-  { "Atilde",                            722, NULL },
+  { "p",                                 611, NULL },
+  { "dotlessi",                          278, NULL },
+  { "radical",                           549, NULL },
+  { "Ntilde",                            722, NULL },
+  { "Aacute",                            722, NULL },
+  { "Scommaaccent",                      667, NULL },
+  { "b",                                 611, NULL },
+  { "K",                                 722, NULL },
+  { "Scaron",                            667, NULL },
+  { "degree",                            400, NULL },
+  { "section",                           556, NULL },
+  { "florin",                            556, NULL },
+  { "iogonek",                           278, NULL },
+  { "Euro",                              556, NULL },
+  { "paragraph",                         556, NULL },
+  { "zcaron",                            500, NULL },
+  { "lcaron",                            400, NULL },
+  { "Ydieresis",                         667, NULL },
+  { "aring",                             556, NULL },
   { "breve",                             333, NULL },
-  { "bar",                               280, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              584, NULL },
-  { "ecaron",                            556, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            333, NULL },
-  { "period",                            278, NULL },
-  { "Rcaron",                            722, NULL },
-  { "Kcommaaccent",                      722, NULL },
-  { "greater",                           584, NULL },
-  { "atilde",                            556, NULL },
-  { "brokenbar",                         280, NULL },
-  { "quoteleft",                         278, NULL },
-  { "Edotaccent",                        667, NULL },
-  { "onesuperior",                       333, NULL }
+  { "Amacron",                           722, NULL },
+  { "Dcaron",                            722, NULL },
+  { "ecircumflex",                       556, NULL },
+  { "Z",                                 611, NULL }
 };
 
 static BuiltinFontWidth helveticaBoldObliqueWidthsTab[] = {
-  { "Ntilde",                            722, NULL },
-  { "rcaron",                            389, NULL },
-  { "kcommaaccent",                      556, NULL },
+  { "divide",                            584, NULL },
+  { "emacron",                           556, NULL },
+  { "numbersign",                        556, NULL },
   { "Ncommaaccent",                      722, NULL },
-  { "Zacute",                            611, NULL },
-  { "comma",                             278, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         584, NULL },
+  { "amacron",                           556, NULL },
+  { "T",                                 611, NULL },
+  { "Ograve",                            778, NULL },
+  { "M",                                 833, NULL },
+  { "odieresis",                         611, NULL },
+  { "Aogonek",                           722, NULL },
+  { "brokenbar",                         280, NULL },
+  { "ecaron",                            556, NULL },
+  { "Thorn",                             667, NULL },
+  { "space",                             278, NULL },
+  { "twosuperior",                       333, NULL },
+  { "eth",                               611, NULL },
+  { "w",                                 778, NULL },
+  { "endash",                            556, NULL },
+  { "guillemotleft",                     556, NULL },
+  { "E",                                 667, NULL },
+  { "quotedblbase",                      500, NULL },
+  { "fl",                                611, NULL },
+  { "Igrave",                            278, NULL },
+  { "Ccedilla",                          722, NULL },
+  { "period",                            278, NULL },
+  { "scedilla",                          556, NULL },
+  { "udieresis",                         611, NULL },
+  { "zero",                              556, NULL },
+  { "thorn",                             611, NULL },
+  { "Ugrave",                            722, NULL },
+  { "germandbls",                        611, NULL },
+  { "bracketright",                      333, NULL },
+  { "W",                                 944, NULL },
+  { "commaaccent",                       250, NULL },
+  { "G",                                 778, NULL },
+  { "acircumflex",                       556, NULL },
+  { "Edotaccent",                        667, NULL },
+  { "perthousand",                      1000, NULL },
+  { "Uring",                             722, NULL },
+  { "F",                                 611, NULL },
+  { "Ocircumflex",                       778, NULL },
+  { "minus",                             584, NULL },
+  { "four",                              556, NULL },
+  { "ocircumflex",                       611, NULL },
+  { "less",                              584, NULL },
+  { "ae",                                889, NULL },
+  { "cent",                              556, NULL },
+  { "idieresis",                         278, NULL },
+  { "ogonek",                            333, NULL },
+  { "Zcaron",                            611, NULL },
   { "circumflex",                        333, NULL },
+  { "D",                                 722, NULL },
+  { "mu",                                611, NULL },
+  { "racute",                            389, NULL },
+  { "underscore",                        556, NULL },
+  { "tilde",                             333, NULL },
+  { "rcommaaccent",                      389, NULL },
+  { "Kcommaaccent",                      722, NULL },
+  { "imacron",                           278, NULL },
+  { "Nacute",                            722, NULL },
+  { "v",                                 556, NULL },
   { "dotaccent",                         333, NULL },
-  { "edotaccent",                        556, NULL },
-  { "asciitilde",                        584, NULL },
-  { "colon",                             333, NULL },
-  { "onehalf",                           834, NULL },
+  { "Tcommaaccent",                      611, NULL },
   { "dollar",                            556, NULL },
-  { "Lcaron",                            611, NULL },
-  { "ntilde",                            611, NULL },
-  { "Aogonek",                           722, NULL },
-  { "ncommaaccent",                      611, NULL },
-  { "minus",                             584, NULL },
-  { "Iogonek",                           278, NULL },
-  { "zacute",                            500, NULL },
+  { "lessequal",                         549, NULL },
+  { "Ucircumflex",                       722, NULL },
+  { "Omacron",                           778, NULL },
+  { "ccaron",                            556, NULL },
   { "yen",                               556, NULL },
-  { "space",                             278, NULL },
-  { "Omacron",                           778, NULL },
-  { "questiondown",                      611, NULL },
+  { "Y",                                 667, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "Ccaron",                            722, NULL },
+  { "j",                                 278, NULL },
+  { "currency",                          556, NULL },
+  { "nine",                              556, NULL },
+  { "parenleft",                         333, NULL },
+  { "grave",                             333, NULL },
+  { "Scedilla",                          667, NULL },
+  { "quotesinglbase",                    278, NULL },
+  { "g",                                 611, NULL },
+  { "colon",                             333, NULL },
+  { "ccedilla",                          556, NULL },
+  { "quotedblright",                     500, NULL },
+  { "Eth",                               722, NULL },
+  { "plusminus",                         584, NULL },
+  { "cedilla",                           333, NULL },
+  { "Idotaccent",                        278, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 611, NULL },
+  { "Ntilde",                            722, NULL },
+  { "radical",                           549, NULL },
+  { "ring",                              333, NULL },
+  { "Egrave",                            667, NULL },
+  { "aogonek",                           556, NULL },
   { "emdash",                           1000, NULL },
-  { "Agrave",                            722, NULL },
-  { "three",                             556, NULL },
-  { "numbersign",                        556, NULL },
+  { "X",                                 667, NULL },
+  { "asciicircum",                       584, NULL },
+  { "five",                              556, NULL },
+  { "Odieresis",                         778, NULL },
+  { "oe",                                944, NULL },
+  { "aring",                             556, NULL },
+  { "Ydieresis",                         667, NULL },
   { "lcaron",                            400, NULL },
-  { "A",                                 722, NULL },
-  { "B",                                 722, NULL },
-  { "C",                                 722, NULL },
-  { "aogonek",                           556, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 667, NULL },
-  { "onequarter",                        834, NULL },
-  { "F",                                 611, NULL },
-  { "G",                                 778, NULL },
-  { "H",                                 722, NULL },
-  { "I",                                 278, NULL },
-  { "J",                                 556, NULL },
+  { "zcaron",                            500, NULL },
+  { "paragraph",                         556, NULL },
+  { "Amacron",                           722, NULL },
+  { "breve",                             333, NULL },
+  { "Z",                                 611, NULL },
+  { "ecircumflex",                       556, NULL },
+  { "Dcaron",                            722, NULL },
+  { "b",                                 611, NULL },
+  { "Scommaaccent",                      667, NULL },
+  { "Aacute",                            722, NULL },
   { "K",                                 722, NULL },
+  { "section",                           556, NULL },
+  { "Scaron",                            667, NULL },
+  { "degree",                            400, NULL },
+  { "Euro",                              556, NULL },
+  { "florin",                            556, NULL },
   { "iogonek",                           278, NULL },
-  { "backslash",                         278, NULL },
-  { "L",                                 611, NULL },
-  { "periodcentered",                    278, NULL },
-  { "M",                                 833, NULL },
+  { "o",                                 611, NULL },
+  { "percent",                           889, NULL },
+  { "onesuperior",                       333, NULL },
+  { "scommaaccent",                      556, NULL },
+  { "Emacron",                           667, NULL },
+  { "asterisk",                          389, NULL },
+  { "greater",                           584, NULL },
+  { "q",                                 611, NULL },
+  { "l",                                 278, NULL },
+  { "C",                                 722, NULL },
+  { "u",                                 611, NULL },
+  { "dagger",                            556, NULL },
+  { "equal",                             584, NULL },
   { "N",                                 722, NULL },
-  { "omacron",                           611, NULL },
-  { "Tcommaaccent",                      611, NULL },
-  { "O",                                 778, NULL },
-  { "P",                                 667, NULL },
-  { "Q",                                 778, NULL },
-  { "Uhungarumlaut",                     722, NULL },
-  { "R",                                 722, NULL },
-  { "Aacute",                            722, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 667, NULL },
-  { "T",                                 611, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            556, NULL },
-  { "V",                                 667, NULL },
-  { "W",                                 944, NULL },
-  { "X",                                 667, NULL },
-  { "question",                          611, NULL },
-  { "equal",                             584, NULL },
-  { "Y",                                 667, NULL },
-  { "Z",                                 611, NULL },
-  { "four",                              556, NULL },
-  { "a",                                 556, NULL },
-  { "Gcommaaccent",                      778, NULL },
-  { "b",                                 611, NULL },
-  { "c",                                 556, NULL },
-  { "d",                                 611, NULL },
+  { "Imacron",                           278, NULL },
+  { "abreve",                            556, NULL },
+  { "iacute",                            278, NULL },
   { "e",                                 556, NULL },
-  { "f",                                 333, NULL },
-  { "g",                                 611, NULL },
-  { "bullet",                            350, NULL },
-  { "h",                                 611, NULL },
-  { "i",                                 278, NULL },
-  { "Oslash",                            778, NULL },
-  { "dagger",                            556, NULL },
-  { "j",                                 278, NULL },
+  { "icircumflex",                       278, NULL },
+  { "copyright",                         737, NULL },
   { "k",                                 556, NULL },
-  { "l",                                 278, NULL },
-  { "m",                                 889, NULL },
+  { "Racute",                            722, NULL },
+  { "Gcommaaccent",                      778, NULL },
+  { "registered",                        737, NULL },
+  { "quoteleft",                         278, NULL },
+  { "threesuperior",                     333, NULL },
+  { "zdotaccent",                        500, NULL },
+  { "Ecaron",                            667, NULL },
   { "n",                                 611, NULL },
-  { "tcommaaccent",                      333, NULL },
-  { "o",                                 611, NULL },
-  { "ordfeminine",                       370, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 611, NULL },
-  { "q",                                 611, NULL },
+  { "gbreve",                            611, NULL },
   { "uhungarumlaut",                     611, NULL },
-  { "r",                                 389, NULL },
-  { "twosuperior",                       333, NULL },
-  { "aacute",                            556, NULL },
-  { "s",                                 556, NULL },
-  { "OE",                               1000, NULL },
-  { "t",                                 333, NULL },
-  { "divide",                            584, NULL },
-  { "u",                                 611, NULL },
-  { "Ccaron",                            722, NULL },
-  { "v",                                 556, NULL },
-  { "w",                                 778, NULL },
-  { "x",                                 556, NULL },
-  { "y",                                 556, NULL },
-  { "z",                                 500, NULL },
-  { "Gbreve",                            778, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        278, NULL },
-  { "Nacute",                            722, NULL },
-  { "quotedbl",                          474, NULL },
-  { "gcommaaccent",                      611, NULL },
-  { "mu",                                611, NULL },
+  { "lcommaaccent",                      278, NULL },
+  { "onehalf",                           834, NULL },
+  { "asciitilde",                        584, NULL },
+  { "Adieresis",                         722, NULL },
+  { "Sacute",                            667, NULL },
+  { "fraction",                          167, NULL },
+  { "atilde",                            556, NULL },
+  { "Zacute",                            611, NULL },
+  { "Uacute",                            722, NULL },
+  { "Acircumflex",                       722, NULL },
+  { "oslash",                            611, NULL },
+  { "notequal",                          549, NULL },
+  { "AE",                               1000, NULL },
+  { "Agrave",                            722, NULL },
+  { "exclam",                            333, NULL },
+  { "L",                                 611, NULL },
+  { "ohungarumlaut",                     611, NULL },
+  { "Ecircumflex",                       667, NULL },
+  { "threequarters",                     834, NULL },
+  { "J",                                 556, NULL },
   { "greaterequal",                      549, NULL },
-  { "Scaron",                            667, NULL },
+  { "at",                                975, NULL },
+  { "sterling",                          556, NULL },
+  { "H",                                 722, NULL },
   { "Lslash",                            611, NULL },
-  { "semicolon",                         333, NULL },
-  { "oslash",                            611, NULL },
-  { "lessequal",                         549, NULL },
-  { "lozenge",                           494, NULL },
+  { "Uogonek",                           722, NULL },
+  { "caron",                             333, NULL },
+  { "lacute",                            278, NULL },
+  { "sacute",                            556, NULL },
+  { "Idieresis",                         278, NULL },
+  { "Lacute",                            611, NULL },
+  { "Rcommaaccent",                      722, NULL },
+  { "ograve",                            611, NULL },
   { "parenright",                        333, NULL },
-  { "ccaron",                            556, NULL },
-  { "Ecircumflex",                       667, NULL },
-  { "gbreve",                            611, NULL },
-  { "trademark",                        1000, NULL },
-  { "daggerdbl",                         556, NULL },
-  { "nacute",                            611, NULL },
+  { "otilde",                            611, NULL },
+  { "Ohungarumlaut",                     778, NULL },
+  { "bracketleft",                       333, NULL },
+  { "gcommaaccent",                      611, NULL },
+  { "f",                                 333, NULL },
+  { "r",                                 389, NULL },
+  { "ucircumflex",                       611, NULL },
+  { "slash",                             278, NULL },
+  { "three",                             556, NULL },
+  { "Eogonek",                           667, NULL },
   { "macron",                            333, NULL },
-  { "Otilde",                            778, NULL },
-  { "Emacron",                           667, NULL },
-  { "ellipsis",                         1000, NULL },
-  { "scaron",                            556, NULL },
-  { "AE",                               1000, NULL },
-  { "Ucircumflex",                       722, NULL },
-  { "lslash",                            278, NULL },
-  { "quotedblleft",                      500, NULL },
+  { "Lcaron",                            611, NULL },
+  { "ordmasculine",                      365, NULL },
+  { "backslash",                         278, NULL },
+  { "questiondown",                      611, NULL },
+  { "semicolon",                         333, NULL },
   { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
-  { "quotesingle",                       238, NULL },
-  { "eight",                             556, NULL },
+  { "uogonek",                           611, NULL },
+  { "quoteright",                        278, NULL },
+  { "Q",                                 778, NULL },
   { "exclamdown",                        333, NULL },
-  { "endash",                            556, NULL },
-  { "oe",                                944, NULL },
-  { "Abreve",                            722, NULL },
+  { "lozenge",                           494, NULL },
+  { "V",                                 667, NULL },
+  { "ncaron",                            611, NULL },
+  { "adieresis",                         556, NULL },
+  { "zacute",                            500, NULL },
   { "Umacron",                           722, NULL },
-  { "ecircumflex",                       556, NULL },
-  { "Adieresis",                         722, NULL },
-  { "copyright",                         737, NULL },
-  { "Egrave",                            667, NULL },
-  { "slash",                             278, NULL },
-  { "Edieresis",                         667, NULL },
-  { "otilde",                            611, NULL },
-  { "Idieresis",                         278, NULL },
-  { "parenleft",                         333, NULL },
+  { "c",                                 556, NULL },
+  { "d",                                 611, NULL },
+  { "periodcentered",                    278, NULL },
+  { "eight",                             556, NULL },
+  { "I",                                 278, NULL },
   { "one",                               556, NULL },
-  { "emacron",                           556, NULL },
-  { "Odieresis",                         778, NULL },
-  { "ucircumflex",                       611, NULL },
-  { "bracketleft",                       333, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        278, NULL },
-  { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         667, NULL },
-  { "umacron",                           611, NULL },
-  { "abreve",                            556, NULL },
-  { "Eacute",                            667, NULL },
-  { "adieresis",                         556, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "z",                                 500, NULL },
+  { "uring",                             611, NULL },
+  { "s",                                 556, NULL },
   { "egrave",                            556, NULL },
-  { "edieresis",                         556, NULL },
-  { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
-  { "ae",                                889, NULL },
-  { "asterisk",                          389, NULL },
-  { "odieresis",                         611, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            611, NULL },
-  { "nine",                              556, NULL },
-  { "five",                              556, NULL },
-  { "udieresis",                         611, NULL },
-  { "Zcaron",                            611, NULL },
-  { "Scommaaccent",                      667, NULL },
-  { "threequarters",                     834, NULL },
-  { "guillemotright",                    556, NULL },
-  { "Ccedilla",                          722, NULL },
-  { "ydieresis",                         556, NULL },
-  { "tilde",                             333, NULL },
-  { "at",                                975, NULL },
-  { "eacute",                            556, NULL },
-  { "underscore",                        556, NULL },
-  { "Euro",                              556, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          584, NULL },
-  { "zero",                              556, NULL },
-  { "eth",                               611, NULL },
-  { "Scedilla",                          667, NULL },
-  { "Ograve",                            778, NULL },
-  { "Racute",                            722, NULL },
-  { "partialdiff",                       494, NULL },
-  { "uacute",                            611, NULL },
-  { "braceleft",                         389, NULL },
-  { "Thorn",                             667, NULL },
-  { "zcaron",                            500, NULL },
-  { "scommaaccent",                      556, NULL },
-  { "ccedilla",                          556, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            611, NULL },
-  { "Ocircumflex",                       778, NULL },
   { "Oacute",                            778, NULL },
-  { "scedilla",                          556, NULL },
-  { "ogonek",                            333, NULL },
-  { "ograve",                            611, NULL },
-  { "racute",                            389, NULL },
-  { "Tcaron",                            611, NULL },
-  { "Eogonek",                           667, NULL },
-  { "thorn",                             611, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        737, NULL },
-  { "radical",                           549, NULL },
+  { "quotedbl",                          474, NULL },
+  { "t",                                 333, NULL },
   { "Aring",                             722, NULL },
-  { "percent",                           889, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "agrave",                            556, NULL },
+  { "bar",                               280, NULL },
+  { "quotesingle",                       238, NULL },
+  { "multiply",                          584, NULL },
+  { "i",                                 278, NULL },
+  { "P",                                 667, NULL },
+  { "lslash",                            278, NULL },
   { "six",                               556, NULL },
-  { "paragraph",                         556, NULL },
-  { "dcaron",                            743, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               556, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            278, NULL },
-  { "Lacute",                            611, NULL },
-  { "ocircumflex",                       611, NULL },
+  { "edotaccent",                        556, NULL },
+  { "daggerdbl",                         556, NULL },
+  { "Yacute",                            667, NULL },
   { "oacute",                            611, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      611, NULL },
+  { "Edieresis",                         667, NULL },
+  { "Atilde",                            722, NULL },
+  { "onequarter",                        834, NULL },
+  { "braceright",                        389, NULL },
+  { "braceleft",                         389, NULL },
+  { "acute",                             333, NULL },
+  { "partialdiff",                       494, NULL },
+  { "U",                                 722, NULL },
+  { "m",                                 889, NULL },
+  { "OE",                               1000, NULL },
+  { "Ncaron",                            722, NULL },
+  { "x",                                 556, NULL },
+  { "edieresis",                         556, NULL },
+  { "Iogonek",                           278, NULL },
+  { "y",                                 556, NULL },
   { "tcaron",                            389, NULL },
-  { "eogonek",                           556, NULL },
+  { "rcaron",                            389, NULL },
+  { "cacute",                            556, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcommaaccent",                      333, NULL },
+  { "logicalnot",                        584, NULL },
+  { "ncommaaccent",                      611, NULL },
+  { "plus",                              584, NULL },
+  { "guilsinglleft",                     333, NULL },
+  { "h",                                 611, NULL },
+  { "Cacute",                            722, NULL },
+  { "A",                                 722, NULL },
+  { "question",                          611, NULL },
+  { "summation",                         600, NULL },
+  { "igrave",                            278, NULL },
+  { "dcroat",                            611, NULL },
+  { "Oslash",                            778, NULL },
+  { "hyphen",                            333, NULL },
+  { "a",                                 556, NULL },
+  { "ugrave",                            611, NULL },
+  { "dcaron",                            743, NULL },
+  { "Rcaron",                            722, NULL },
+  { "kcommaaccent",                      556, NULL },
+  { "yacute",                            556, NULL },
+  { "ydieresis",                         556, NULL },
+  { "R",                                 722, NULL },
+  { "B",                                 722, NULL },
+  { "aacute",                            556, NULL },
+  { "Tcaron",                            611, NULL },
+  { "Otilde",                            778, NULL },
+  { "umacron",                           611, NULL },
+  { "ordfeminine",                       370, NULL },
+  { "quotedblleft",                      500, NULL },
+  { "S",                                 667, NULL },
+  { "Gbreve",                            778, NULL },
+  { "omacron",                           611, NULL },
   { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     778, NULL },
-  { "asciicircum",                       584, NULL },
-  { "aring",                             556, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           611, NULL },
-  { "bracketright",                      333, NULL },
-  { "Iacute",                            278, NULL },
-  { "ampersand",                         722, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            278, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              584, NULL },
-  { "uring",                             611, NULL },
-  { "quotesinglbase",                    278, NULL },
-  { "lcommaaccent",                      278, NULL },
-  { "Yacute",                            667, NULL },
-  { "ohungarumlaut",                     611, NULL },
-  { "threesuperior",                     333, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           556, NULL },
+  { "comma",                             278, NULL },
+  { "O",                                 778, NULL },
+  { "Icircumflex",                       278, NULL },
+  { "nacute",                            611, NULL },
+  { "Eacute",                            667, NULL },
   { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      500, NULL },
-  { "ncaron",                            611, NULL },
-  { "florin",                            556, NULL },
-  { "yacute",                            556, NULL },
-  { "Rcommaaccent",                      722, NULL },
   { "fi",                                611, NULL },
-  { "fl",                                611, NULL },
-  { "Acircumflex",                       722, NULL },
-  { "Cacute",                            722, NULL },
-  { "Icircumflex",                       278, NULL },
-  { "guillemotleft",                     556, NULL },
-  { "germandbls",                        611, NULL },
-  { "Amacron",                           722, NULL },
+  { "ntilde",                            611, NULL },
+  { "Lcommaaccent",                      611, NULL },
+  { "trademark",                        1000, NULL },
+  { "ampersand",                         722, NULL },
+  { "Zdotaccent",                        611, NULL },
+  { "bullet",                            350, NULL },
+  { "eogonek",                           556, NULL },
+  { "eacute",                            556, NULL },
+  { "guillemotright",                    556, NULL },
+  { "scaron",                            556, NULL },
   { "seven",                             556, NULL },
-  { "Sacute",                            667, NULL },
-  { "ordmasculine",                      365, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          556, NULL },
-  { "notequal",                          549, NULL },
-  { "Imacron",                           278, NULL },
-  { "rcommaaccent",                      389, NULL },
-  { "Zdotaccent",                        611, NULL },
-  { "acircumflex",                       556, NULL },
-  { "cacute",                            556, NULL },
-  { "Ecaron",                            667, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        389, NULL },
-  { "quotedblright",                     500, NULL },
-  { "amacron",                           556, NULL },
-  { "sacute",                            556, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              556, NULL },
-  { "currency",                          556, NULL },
-  { "logicalnot",                        584, NULL },
-  { "zdotaccent",                        500, NULL },
-  { "Atilde",                            722, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               280, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              584, NULL },
-  { "ecaron",                            556, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            333, NULL },
-  { "period",                            278, NULL },
-  { "Rcaron",                            722, NULL },
-  { "Kcommaaccent",                      722, NULL },
-  { "greater",                           584, NULL },
-  { "atilde",                            556, NULL },
-  { "brokenbar",                         280, NULL },
-  { "quoteleft",                         278, NULL },
-  { "Edotaccent",                        667, NULL },
-  { "onesuperior",                       333, NULL }
+  { "two",                               556, NULL },
+  { "uacute",                            611, NULL },
+  { "Iacute",                            278, NULL },
+  { "Udieresis",                         722, NULL },
+  { "Abreve",                            722, NULL }
 };
 
 static BuiltinFontWidth helveticaObliqueWidthsTab[] = {
-  { "Ntilde",                            722, NULL },
-  { "rcaron",                            333, NULL },
+  { "dieresis",                          333, NULL },
+  { "Eacute",                            667, NULL },
+  { "Icircumflex",                       278, NULL },
+  { "O",                                 778, NULL },
+  { "nacute",                            556, NULL },
+  { "trademark",                        1000, NULL },
+  { "ampersand",                         667, NULL },
+  { "Lcommaaccent",                      556, NULL },
+  { "ntilde",                            556, NULL },
+  { "fi",                                500, NULL },
+  { "scaron",                            500, NULL },
+  { "guillemotright",                    556, NULL },
+  { "eacute",                            556, NULL },
+  { "eogonek",                           556, NULL },
+  { "bullet",                            350, NULL },
+  { "Zdotaccent",                        611, NULL },
+  { "Abreve",                            667, NULL },
+  { "Udieresis",                         722, NULL },
+  { "Iacute",                            278, NULL },
+  { "two",                               556, NULL },
+  { "uacute",                            556, NULL },
+  { "seven",                             556, NULL },
+  { "B",                                 667, NULL },
+  { "Rcaron",                            722, NULL },
   { "kcommaaccent",                      500, NULL },
-  { "Ncommaaccent",                      722, NULL },
-  { "Zacute",                            611, NULL },
+  { "yacute",                            500, NULL },
+  { "R",                                 722, NULL },
+  { "ydieresis",                         500, NULL },
+  { "ugrave",                            556, NULL },
+  { "dcaron",                            643, NULL },
+  { "Oslash",                            778, NULL },
+  { "hyphen",                            333, NULL },
+  { "a",                                 556, NULL },
+  { "umacron",                           556, NULL },
+  { "Otilde",                            778, NULL },
+  { "Tcaron",                            611, NULL },
+  { "aacute",                            556, NULL },
+  { "quotedblleft",                      333, NULL },
+  { "ordfeminine",                       370, NULL },
+  { "omacron",                           556, NULL },
+  { "Delta",                             612, NULL },
   { "comma",                             278, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         584, NULL },
-  { "circumflex",                        333, NULL },
-  { "dotaccent",                         333, NULL },
-  { "edotaccent",                        556, NULL },
-  { "asciitilde",                        584, NULL },
-  { "colon",                             278, NULL },
-  { "onehalf",                           834, NULL },
-  { "dollar",                            556, NULL },
-  { "Lcaron",                            556, NULL },
-  { "ntilde",                            556, NULL },
-  { "Aogonek",                           667, NULL },
+  { "Gbreve",                            778, NULL },
+  { "S",                                 667, NULL },
+  { "x",                                 500, NULL },
+  { "y",                                 500, NULL },
+  { "Iogonek",                           278, NULL },
+  { "edieresis",                         556, NULL },
+  { "Ncaron",                            722, NULL },
+  { "m",                                 833, NULL },
+  { "OE",                               1000, NULL },
+  { "partialdiff",                       476, NULL },
+  { "U",                                 722, NULL },
   { "ncommaaccent",                      556, NULL },
-  { "minus",                             584, NULL },
-  { "Iogonek",                           278, NULL },
-  { "zacute",                            500, NULL },
-  { "yen",                               556, NULL },
-  { "space",                             278, NULL },
-  { "Omacron",                           778, NULL },
-  { "questiondown",                      611, NULL },
-  { "emdash",                           1000, NULL },
-  { "Agrave",                            667, NULL },
-  { "three",                             556, NULL },
-  { "numbersign",                        556, NULL },
-  { "lcaron",                            299, NULL },
+  { "tcommaaccent",                      278, NULL },
+  { "logicalnot",                        584, NULL },
+  { "cacute",                            500, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcaron",                            317, NULL },
+  { "rcaron",                            333, NULL },
+  { "guilsinglleft",                     333, NULL },
+  { "Cacute",                            722, NULL },
+  { "h",                                 556, NULL },
+  { "plus",                              584, NULL },
+  { "igrave",                            278, NULL },
+  { "dcroat",                            556, NULL },
+  { "question",                          556, NULL },
+  { "summation",                         600, NULL },
   { "A",                                 667, NULL },
-  { "B",                                 667, NULL },
-  { "C",                                 722, NULL },
-  { "aogonek",                           556, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 667, NULL },
+  { "multiply",                          584, NULL },
+  { "i",                                 222, NULL },
+  { "quotesingle",                       191, NULL },
+  { "bar",                               260, NULL },
+  { "six",                               556, NULL },
+  { "edotaccent",                        556, NULL },
+  { "lslash",                            222, NULL },
+  { "P",                                 667, NULL },
+  { "Atilde",                            667, NULL },
+  { "Edieresis",                         667, NULL },
+  { "oacute",                            556, NULL },
+  { "Yacute",                            667, NULL },
+  { "daggerdbl",                         556, NULL },
+  { "braceleft",                         334, NULL },
+  { "braceright",                        334, NULL },
+  { "acute",                             333, NULL },
   { "onequarter",                        834, NULL },
-  { "F",                                 611, NULL },
-  { "G",                                 778, NULL },
-  { "H",                                 722, NULL },
+  { "one",                               556, NULL },
   { "I",                                 278, NULL },
-  { "J",                                 500, NULL },
-  { "K",                                 667, NULL },
-  { "iogonek",                           222, NULL },
-  { "backslash",                         278, NULL },
-  { "L",                                 556, NULL },
+  { "eight",                             556, NULL },
   { "periodcentered",                    278, NULL },
-  { "M",                                 833, NULL },
-  { "N",                                 722, NULL },
-  { "omacron",                           556, NULL },
-  { "Tcommaaccent",                      611, NULL },
-  { "O",                                 778, NULL },
-  { "P",                                 667, NULL },
-  { "Q",                                 778, NULL },
-  { "Uhungarumlaut",                     722, NULL },
-  { "R",                                 722, NULL },
-  { "Aacute",                            667, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 667, NULL },
-  { "T",                                 611, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            556, NULL },
-  { "V",                                 667, NULL },
-  { "W",                                 944, NULL },
-  { "X",                                 667, NULL },
-  { "question",                          556, NULL },
-  { "equal",                             584, NULL },
-  { "Y",                                 667, NULL },
-  { "Z",                                 611, NULL },
-  { "four",                              556, NULL },
-  { "a",                                 556, NULL },
-  { "Gcommaaccent",                      778, NULL },
-  { "b",                                 556, NULL },
   { "c",                                 500, NULL },
   { "d",                                 556, NULL },
-  { "e",                                 556, NULL },
-  { "f",                                 278, NULL },
-  { "g",                                 556, NULL },
-  { "bullet",                            350, NULL },
-  { "h",                                 556, NULL },
-  { "i",                                 222, NULL },
-  { "Oslash",                            778, NULL },
-  { "dagger",                            556, NULL },
-  { "j",                                 222, NULL },
-  { "k",                                 500, NULL },
-  { "l",                                 222, NULL },
-  { "m",                                 833, NULL },
-  { "n",                                 556, NULL },
-  { "tcommaaccent",                      278, NULL },
-  { "o",                                 556, NULL },
-  { "ordfeminine",                       370, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 556, NULL },
-  { "q",                                 556, NULL },
-  { "uhungarumlaut",                     556, NULL },
-  { "r",                                 333, NULL },
-  { "twosuperior",                       333, NULL },
-  { "aacute",                            556, NULL },
+  { "egrave",                            556, NULL },
+  { "uring",                             556, NULL },
   { "s",                                 500, NULL },
-  { "OE",                               1000, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "z",                                 500, NULL },
   { "t",                                 278, NULL },
-  { "divide",                            584, NULL },
-  { "u",                                 556, NULL },
-  { "Ccaron",                            722, NULL },
-  { "v",                                 500, NULL },
-  { "w",                                 722, NULL },
-  { "x",                                 500, NULL },
-  { "y",                                 500, NULL },
-  { "z",                                 500, NULL },
-  { "Gbreve",                            778, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        278, NULL },
-  { "Nacute",                            722, NULL },
   { "quotedbl",                          355, NULL },
-  { "gcommaaccent",                      556, NULL },
-  { "mu",                                556, NULL },
-  { "greaterequal",                      549, NULL },
-  { "Scaron",                            667, NULL },
-  { "Lslash",                            556, NULL },
+  { "Oacute",                            778, NULL },
+  { "agrave",                            556, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "Aring",                             667, NULL },
+  { "three",                             556, NULL },
+  { "slash",                             278, NULL },
+  { "ucircumflex",                       556, NULL },
+  { "r",                                 333, NULL },
+  { "macron",                            333, NULL },
+  { "Eogonek",                           667, NULL },
+  { "Lcaron",                            556, NULL },
+  { "questiondown",                      611, NULL },
+  { "ordmasculine",                      365, NULL },
+  { "backslash",                         278, NULL },
+  { "uogonek",                           556, NULL },
+  { "quoteright",                        222, NULL },
   { "semicolon",                         278, NULL },
-  { "oslash",                            611, NULL },
-  { "lessequal",                         549, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "Umacron",                           722, NULL },
+  { "zacute",                            500, NULL },
+  { "ncaron",                            556, NULL },
+  { "adieresis",                         556, NULL },
   { "lozenge",                           471, NULL },
+  { "V",                                 667, NULL },
+  { "Q",                                 778, NULL },
+  { "exclamdown",                        333, NULL },
+  { "Lacute",                            556, NULL },
+  { "sacute",                            500, NULL },
+  { "Idieresis",                         278, NULL },
+  { "ograve",                            556, NULL },
+  { "Rcommaaccent",                      722, NULL },
+  { "gcommaaccent",                      556, NULL },
+  { "Ohungarumlaut",                     778, NULL },
+  { "bracketleft",                       278, NULL },
+  { "otilde",                            556, NULL },
   { "parenright",                        333, NULL },
-  { "ccaron",                            500, NULL },
+  { "f",                                 278, NULL },
+  { "asciitilde",                        584, NULL },
+  { "Uacute",                            722, NULL },
+  { "atilde",                            556, NULL },
+  { "Zacute",                            611, NULL },
+  { "fraction",                          167, NULL },
+  { "Sacute",                            667, NULL },
+  { "Adieresis",                         667, NULL },
+  { "threequarters",                     834, NULL },
+  { "J",                                 500, NULL },
+  { "ohungarumlaut",                     556, NULL },
   { "Ecircumflex",                       667, NULL },
+  { "L",                                 556, NULL },
+  { "notequal",                          549, NULL },
+  { "exclam",                            278, NULL },
+  { "Agrave",                            667, NULL },
+  { "AE",                               1000, NULL },
+  { "Acircumflex",                       667, NULL },
+  { "oslash",                            611, NULL },
+  { "Uogonek",                           722, NULL },
+  { "caron",                             333, NULL },
+  { "Lslash",                            556, NULL },
+  { "lacute",                            222, NULL },
+  { "sterling",                          556, NULL },
+  { "H",                                 722, NULL },
+  { "at",                               1015, NULL },
+  { "greaterequal",                      549, NULL },
+  { "Racute",                            722, NULL },
+  { "k",                                 500, NULL },
+  { "copyright",                         737, NULL },
+  { "quoteleft",                         222, NULL },
+  { "registered",                        737, NULL },
+  { "Gcommaaccent",                      778, NULL },
+  { "n",                                 556, NULL },
+  { "Ecaron",                            667, NULL },
+  { "threesuperior",                     333, NULL },
+  { "zdotaccent",                        500, NULL },
+  { "lcommaaccent",                      222, NULL },
+  { "onehalf",                           834, NULL },
   { "gbreve",                            556, NULL },
-  { "trademark",                        1000, NULL },
-  { "daggerdbl",                         556, NULL },
-  { "nacute",                            556, NULL },
-  { "macron",                            333, NULL },
-  { "Otilde",                            778, NULL },
+  { "uhungarumlaut",                     556, NULL },
+  { "percent",                           889, NULL },
+  { "o",                                 556, NULL },
+  { "greater",                           584, NULL },
+  { "asterisk",                          389, NULL },
   { "Emacron",                           667, NULL },
-  { "ellipsis",                         1000, NULL },
-  { "scaron",                            500, NULL },
-  { "AE",                               1000, NULL },
-  { "Ucircumflex",                       722, NULL },
-  { "lslash",                            222, NULL },
-  { "quotedblleft",                      333, NULL },
-  { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
-  { "quotesingle",                       191, NULL },
-  { "eight",                             556, NULL },
-  { "exclamdown",                        333, NULL },
-  { "endash",                            556, NULL },
-  { "oe",                                944, NULL },
-  { "Abreve",                            667, NULL },
-  { "Umacron",                           722, NULL },
+  { "scommaaccent",                      500, NULL },
+  { "onesuperior",                       333, NULL },
+  { "dagger",                            556, NULL },
+  { "equal",                             584, NULL },
+  { "N",                                 722, NULL },
+  { "C",                                 722, NULL },
+  { "u",                                 556, NULL },
+  { "q",                                 556, NULL },
+  { "l",                                 222, NULL },
+  { "icircumflex",                       278, NULL },
+  { "Imacron",                           278, NULL },
+  { "abreve",                            556, NULL },
+  { "iacute",                            278, NULL },
+  { "e",                                 556, NULL },
+  { "lcaron",                            299, NULL },
+  { "paragraph",                         537, NULL },
+  { "zcaron",                            500, NULL },
+  { "aring",                             556, NULL },
+  { "Ydieresis",                         667, NULL },
+  { "Dcaron",                            722, NULL },
+  { "Z",                                 611, NULL },
   { "ecircumflex",                       556, NULL },
-  { "Adieresis",                         667, NULL },
-  { "copyright",                         737, NULL },
+  { "Amacron",                           667, NULL },
+  { "breve",                             333, NULL },
+  { "K",                                 667, NULL },
+  { "Scommaaccent",                      667, NULL },
+  { "Aacute",                            667, NULL },
+  { "b",                                 556, NULL },
+  { "Euro",                              556, NULL },
+  { "iogonek",                           222, NULL },
+  { "florin",                            556, NULL },
+  { "section",                           556, NULL },
+  { "Scaron",                            667, NULL },
+  { "degree",                            400, NULL },
+  { "plusminus",                         584, NULL },
+  { "cedilla",                           333, NULL },
+  { "Idotaccent",                        278, NULL },
+  { "quotedblright",                     333, NULL },
+  { "Eth",                               722, NULL },
+  { "colon",                             278, NULL },
+  { "g",                                 556, NULL },
+  { "ccedilla",                          500, NULL },
+  { "Ntilde",                            722, NULL },
+  { "radical",                           453, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 556, NULL },
+  { "emdash",                           1000, NULL },
+  { "aogonek",                           556, NULL },
   { "Egrave",                            667, NULL },
-  { "slash",                             278, NULL },
-  { "Edieresis",                         667, NULL },
-  { "otilde",                            556, NULL },
-  { "Idieresis",                         278, NULL },
+  { "ring",                              333, NULL },
+  { "Odieresis",                         778, NULL },
+  { "oe",                                944, NULL },
+  { "five",                              556, NULL },
+  { "X",                                 667, NULL },
+  { "asciicircum",                       469, NULL },
+  { "ccaron",                            500, NULL },
+  { "Omacron",                           778, NULL },
+  { "lessequal",                         549, NULL },
+  { "Ucircumflex",                       722, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "j",                                 222, NULL },
+  { "Ccaron",                            722, NULL },
+  { "yen",                               556, NULL },
+  { "Y",                                 667, NULL },
   { "parenleft",                         333, NULL },
-  { "one",                               556, NULL },
-  { "emacron",                           556, NULL },
-  { "Odieresis",                         778, NULL },
-  { "ucircumflex",                       556, NULL },
-  { "bracketleft",                       278, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        222, NULL },
-  { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         667, NULL },
-  { "umacron",                           556, NULL },
-  { "abreve",                            556, NULL },
-  { "Eacute",                            667, NULL },
-  { "adieresis",                         556, NULL },
-  { "egrave",                            556, NULL },
-  { "edieresis",                         556, NULL },
-  { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
+  { "currency",                          556, NULL },
+  { "nine",                              556, NULL },
+  { "quotesinglbase",                    222, NULL },
+  { "grave",                             333, NULL },
+  { "Scedilla",                          667, NULL },
   { "ae",                                889, NULL },
-  { "asterisk",                          389, NULL },
-  { "odieresis",                         556, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            556, NULL },
-  { "nine",                              556, NULL },
-  { "five",                              556, NULL },
-  { "udieresis",                         556, NULL },
+  { "cent",                              556, NULL },
+  { "ocircumflex",                       556, NULL },
+  { "less",                              584, NULL },
+  { "minus",                             584, NULL },
+  { "four",                              556, NULL },
+  { "circumflex",                        333, NULL },
   { "Zcaron",                            611, NULL },
-  { "Scommaaccent",                      667, NULL },
-  { "threequarters",                     834, NULL },
-  { "guillemotright",                    556, NULL },
-  { "Ccedilla",                          722, NULL },
-  { "ydieresis",                         500, NULL },
+  { "ogonek",                            333, NULL },
+  { "idieresis",                         278, NULL },
+  { "rcommaaccent",                      333, NULL },
+  { "Kcommaaccent",                      667, NULL },
+  { "imacron",                           278, NULL },
   { "tilde",                             333, NULL },
-  { "at",                               1015, NULL },
-  { "eacute",                            556, NULL },
   { "underscore",                        556, NULL },
-  { "Euro",                              556, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          584, NULL },
+  { "D",                                 722, NULL },
+  { "mu",                                556, NULL },
+  { "racute",                            333, NULL },
+  { "Tcommaaccent",                      611, NULL },
+  { "dollar",                            556, NULL },
+  { "v",                                 500, NULL },
+  { "Nacute",                            722, NULL },
+  { "dotaccent",                         333, NULL },
   { "zero",                              556, NULL },
-  { "eth",                               556, NULL },
-  { "Scedilla",                          667, NULL },
-  { "Ograve",                            778, NULL },
-  { "Racute",                            722, NULL },
-  { "partialdiff",                       476, NULL },
-  { "uacute",                            556, NULL },
-  { "braceleft",                         334, NULL },
-  { "Thorn",                             667, NULL },
-  { "zcaron",                            500, NULL },
-  { "scommaaccent",                      500, NULL },
-  { "ccedilla",                          500, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            556, NULL },
-  { "Ocircumflex",                       778, NULL },
-  { "Oacute",                            778, NULL },
   { "scedilla",                          500, NULL },
-  { "ogonek",                            333, NULL },
-  { "ograve",                            556, NULL },
-  { "racute",                            333, NULL },
-  { "Tcaron",                            611, NULL },
-  { "Eogonek",                           667, NULL },
-  { "thorn",                             556, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        737, NULL },
-  { "radical",                           453, NULL },
-  { "Aring",                             667, NULL },
-  { "percent",                           889, NULL },
-  { "six",                               556, NULL },
-  { "paragraph",                         537, NULL },
-  { "dcaron",                            643, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               556, NULL },
-  { "summation",                         600, NULL },
+  { "period",                            278, NULL },
+  { "udieresis",                         556, NULL },
+  { "Ccedilla",                          722, NULL },
   { "Igrave",                            278, NULL },
-  { "Lacute",                            556, NULL },
-  { "ocircumflex",                       556, NULL },
-  { "oacute",                            556, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      556, NULL },
-  { "tcaron",                            317, NULL },
-  { "eogonek",                           556, NULL },
-  { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     778, NULL },
-  { "asciicircum",                       469, NULL },
-  { "aring",                             556, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           556, NULL },
+  { "commaaccent",                       250, NULL },
+  { "W",                                 944, NULL },
   { "bracketright",                      278, NULL },
-  { "Iacute",                            278, NULL },
-  { "ampersand",                         667, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            222, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              584, NULL },
-  { "uring",                             556, NULL },
-  { "quotesinglbase",                    222, NULL },
-  { "lcommaaccent",                      222, NULL },
-  { "Yacute",                            667, NULL },
-  { "ohungarumlaut",                     556, NULL },
-  { "threesuperior",                     333, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           556, NULL },
-  { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      333, NULL },
-  { "ncaron",                            556, NULL },
-  { "florin",                            556, NULL },
-  { "yacute",                            500, NULL },
-  { "Rcommaaccent",                      722, NULL },
-  { "fi",                                500, NULL },
-  { "fl",                                500, NULL },
-  { "Acircumflex",                       667, NULL },
-  { "Cacute",                            722, NULL },
-  { "Icircumflex",                       278, NULL },
-  { "guillemotleft",                     556, NULL },
+  { "Ugrave",                            722, NULL },
   { "germandbls",                        611, NULL },
-  { "Amacron",                           667, NULL },
-  { "seven",                             556, NULL },
-  { "Sacute",                            667, NULL },
-  { "ordmasculine",                      365, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          556, NULL },
-  { "notequal",                          549, NULL },
-  { "Imacron",                           278, NULL },
-  { "rcommaaccent",                      333, NULL },
-  { "Zdotaccent",                        611, NULL },
+  { "thorn",                             556, NULL },
+  { "G",                                 778, NULL },
+  { "Ocircumflex",                       778, NULL },
+  { "F",                                 611, NULL },
+  { "Uring",                             722, NULL },
+  { "perthousand",                      1000, NULL },
+  { "Edotaccent",                        667, NULL },
   { "acircumflex",                       556, NULL },
-  { "cacute",                            500, NULL },
-  { "Ecaron",                            667, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        334, NULL },
-  { "quotedblright",                     333, NULL },
   { "amacron",                           556, NULL },
-  { "sacute",                            500, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              556, NULL },
-  { "currency",                          556, NULL },
-  { "logicalnot",                        584, NULL },
-  { "zdotaccent",                        500, NULL },
-  { "Atilde",                            667, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               260, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              584, NULL },
+  { "Ncommaaccent",                      722, NULL },
+  { "numbersign",                        556, NULL },
+  { "divide",                            584, NULL },
+  { "emacron",                           556, NULL },
+  { "M",                                 833, NULL },
+  { "odieresis",                         556, NULL },
+  { "Ograve",                            778, NULL },
+  { "T",                                 611, NULL },
+  { "w",                                 722, NULL },
+  { "Thorn",                             667, NULL },
+  { "space",                             278, NULL },
+  { "twosuperior",                       333, NULL },
+  { "eth",                               556, NULL },
   { "ecaron",                            556, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            278, NULL },
-  { "period",                            278, NULL },
-  { "Rcaron",                            722, NULL },
-  { "Kcommaaccent",                      667, NULL },
-  { "greater",                           584, NULL },
-  { "atilde",                            556, NULL },
   { "brokenbar",                         260, NULL },
-  { "quoteleft",                         222, NULL },
-  { "Edotaccent",                        667, NULL },
-  { "onesuperior",                       333, NULL }
+  { "Aogonek",                           667, NULL },
+  { "fl",                                500, NULL },
+  { "E",                                 667, NULL },
+  { "quotedblbase",                      333, NULL },
+  { "guillemotleft",                     556, NULL },
+  { "endash",                            556, NULL }
 };
 
 static BuiltinFontWidth symbolWidthsTab[] = {
-  { "bracketleftex",                     384, NULL },
-  { "alpha",                             631, NULL },
-  { "union",                             768, NULL },
-  { "infinity",                          713, NULL },
-  { "comma",                             250, NULL },
   { "copyrightsans",                     790, NULL },
+  { "Upsilon",                           690, NULL },
+  { "sigma",                             603, NULL },
+  { "kappa",                             549, NULL },
+  { "circleplus",                        768, NULL },
+  { "degree",                            400, NULL },
+  { "florin",                            500, NULL },
+  { "Euro",                              750, NULL },
+  { "phi1",                              603, NULL },
+  { "club",                              753, NULL },
+  { "radicalex",                         500, NULL },
+  { "theta",                             521, NULL },
+  { "Upsilon1",                          620, NULL },
+  { "radical",                           549, NULL },
+  { "angle",                             768, NULL },
+  { "colon",                             278, NULL },
   { "plusminus",                         549, NULL },
-  { "arrowup",                           603, NULL },
-  { "apple",                             790, NULL },
-  { "parenleftbt",                       384, NULL },
-  { "notelement",                        713, NULL },
-  { "colon",                             278, NULL },
-  { "beta",                              549, NULL },
-  { "braceleftbt",                       494, NULL },
-  { "Lambda",                            686, NULL },
-  { "Phi",                               763, NULL },
-  { "minus",                             549, NULL },
-  { "space",                             250, NULL },
-  { "Sigma",                             592, NULL },
-  { "approxequal",                       549, NULL },
+  { "five",                              500, NULL },
+  { "weierstrass",                       987, NULL },
+  { "gamma",                             411, NULL },
+  { "theta1",                            631, NULL },
+  { "Zeta",                              611, NULL },
+  { "angleleft",                         329, NULL },
+  { "copyrightserif",                    790, NULL },
+  { "logicaland",                        603, NULL },
+  { "arrowvertex",                       603, NULL },
+  { "arrowleft",                         987, NULL },
+  { "Omicron",                           722, NULL },
+  { "propersubset",                      713, NULL },
+  { "equivalence",                       549, NULL },
+  { "circlemultiply",                    768, NULL },
+  { "greater",                           549, NULL },
   { "minute",                            247, NULL },
-  { "circleplus",                        768, NULL },
-  { "Omicron",                           722, NULL },
-  { "three",                             500, NULL },
-  { "numbersign",                        500, NULL },
-  { "lambda",                            549, NULL },
-  { "phi",                               521, NULL },
-  { "aleph",                             823, NULL },
-  { "Tau",                               611, NULL },
-  { "spade",                             753, NULL },
-  { "logicaland",                        603, NULL },
-  { "sigma",                             603, NULL },
-  { "propersuperset",                    713, NULL },
+  { "integral",                          274, NULL },
+  { "percent",                           833, NULL },
+  { "omega",                             686, NULL },
+  { "Beta",                              667, NULL },
+  { "equal",                             549, NULL },
+  { "therefore",                         863, NULL },
+  { "braceleftmid",                      494, NULL },
+  { "parenrighttp",                      384, NULL },
+  { "bracketright",                      333, NULL },
   { "omicron",                           549, NULL },
-  { "question",                          444, NULL },
-  { "equal",                             549, NULL },
   { "Epsilon",                           611, NULL },
-  { "emptyset",                          823, NULL },
-  { "diamond",                           753, NULL },
-  { "four",                              500, NULL },
-  { "Mu",                                889, NULL },
-  { "parenlefttp",                       384, NULL },
-  { "club",                              753, NULL },
-  { "bullet",                            460, NULL },
-  { "Omega",                             768, NULL },
-  { "tau",                               439, NULL },
-  { "Upsilon",                           690, NULL },
-  { "bracelefttp",                       494, NULL },
+  { "Nu",                                722, NULL },
+  { "zero",                              500, NULL },
+  { "period",                            250, NULL },
+  { "Gamma",                             603, NULL },
+  { "product",                           823, NULL },
+  { "arrowboth",                        1042, NULL },
+  { "Ifraktur",                          686, NULL },
+  { "infinity",                          713, NULL },
   { "heart",                             753, NULL },
+  { "parenrightex",                      384, NULL },
+  { "arrowdown",                         603, NULL },
+  { "bracketleftbt",                     384, NULL },
+  { "logicalor",                         603, NULL },
+  { "numbersign",                        500, NULL },
   { "divide",                            549, NULL },
-  { "epsilon",                           439, NULL },
-  { "logicalor",                         603, NULL },
+  { "nu",                                521, NULL },
+  { "spade",                             753, NULL },
+  { "rho",                               549, NULL },
+  { "Sigma",                             592, NULL },
+  { "integralex",                        686, NULL },
+  { "space",                             250, NULL },
+  { "reflexsuperset",                    713, NULL },
+  { "alpha",                             631, NULL },
   { "parenleftex",                       384, NULL },
-  { "greaterequal",                      549, NULL },
-  { "mu",                                576, NULL },
-  { "Nu",                                722, NULL },
-  { "therefore",                         863, NULL },
-  { "notsubset",                         713, NULL },
-  { "omega",                             686, NULL },
-  { "semicolon",                         278, NULL },
-  { "element",                           713, NULL },
-  { "upsilon",                           576, NULL },
+  { "lessequal",                         549, NULL },
+  { "second",                            411, NULL },
+  { "integraltp",                        686, NULL },
+  { "approxequal",                       549, NULL },
   { "existential",                       549, NULL },
+  { "diamond",                           753, NULL },
+  { "phi",                               521, NULL },
+  { "nine",                              500, NULL },
+  { "Iota",                              333, NULL },
+  { "parenleft",                         333, NULL },
+  { "tau",                               439, NULL },
+  { "Tau",                               611, NULL },
+  { "less",                              549, NULL },
+  { "Eta",                               722, NULL },
+  { "minus",                             549, NULL },
+  { "four",                              500, NULL },
+  { "bracketleftex",                     384, NULL },
+  { "arrowdblboth",                     1042, NULL },
+  { "arrowup",                           603, NULL },
+  { "arrowright",                        987, NULL },
   { "integralbt",                        686, NULL },
-  { "lessequal",                         549, NULL },
-  { "phi1",                              603, NULL },
-  { "lozenge",                           494, NULL },
+  { "similar",                           549, NULL },
+  { "underscore",                        500, NULL },
+  { "dotmath",                           250, NULL },
+  { "mu",                                576, NULL },
   { "trademarkserif",                    890, NULL },
-  { "parenright",                        333, NULL },
-  { "reflexsuperset",                    713, NULL },
-  { "sigma1",                            439, NULL },
-  { "nu",                                521, NULL },
-  { "Gamma",                             603, NULL },
+  { "Chi",                               722, NULL },
   { "angleright",                        329, NULL },
-  { "ellipsis",                         1000, NULL },
-  { "Rho",                               556, NULL },
-  { "parenrightbt",                      384, NULL },
-  { "radicalex",                         500, NULL },
-  { "eight",                             500, NULL },
-  { "angleleft",                         329, NULL },
+  { "logicalnot",                        713, NULL },
+  { "parenlefttp",                       384, NULL },
+  { "partialdiff",                       494, NULL },
+  { "arrowdblright",                     987, NULL },
+  { "summation",                         713, NULL },
+  { "question",                          444, NULL },
+  { "apple",                             790, NULL },
+  { "plus",                              549, NULL },
+  { "epsilon",                           439, NULL },
+  { "reflexsubset",                      713, NULL },
+  { "six",                               500, NULL },
   { "arrowdbldown",                      603, NULL },
-  { "congruent",                         549, NULL },
-  { "Theta",                             741, NULL },
-  { "intersection",                      768, NULL },
-  { "Pi",                                768, NULL },
-  { "slash",                             278, NULL },
-  { "registerserif",                     790, NULL },
-  { "parenleft",                         333, NULL },
-  { "one",                               500, NULL },
-  { "gamma",                             411, NULL },
-  { "bracketleft",                       333, NULL },
-  { "rho",                               549, NULL },
-  { "circlemultiply",                    768, NULL },
-  { "Chi",                               722, NULL },
-  { "theta",                             521, NULL },
-  { "pi",                                549, NULL },
-  { "integraltp",                        686, NULL },
-  { "Eta",                               722, NULL },
-  { "product",                           823, NULL },
-  { "nine",                              500, NULL },
-  { "five",                              500, NULL },
-  { "propersubset",                      713, NULL },
-  { "bracketrightbt",                    384, NULL },
-  { "trademarksans",                     786, NULL },
-  { "dotmath",                           250, NULL },
-  { "integralex",                        686, NULL },
-  { "chi",                               549, NULL },
-  { "parenrighttp",                      384, NULL },
-  { "eta",                               603, NULL },
-  { "underscore",                        500, NULL },
-  { "Euro",                              750, NULL },
+  { "Omega",                             768, NULL },
+  { "bar",                               200, NULL },
   { "multiply",                          549, NULL },
-  { "zero",                              500, NULL },
-  { "partialdiff",                       494, NULL },
-  { "angle",                             768, NULL },
+  { "braceright",                        480, NULL },
+  { "braceleft",                         480, NULL },
+  { "braceleftbt",                       494, NULL },
+  { "delta",                             494, NULL },
   { "arrowdblleft",                      987, NULL },
-  { "braceleft",                         480, NULL },
-  { "parenrightex",                      384, NULL },
-  { "Rfraktur",                          795, NULL },
-  { "Zeta",                              611, NULL },
-  { "braceex",                           494, NULL },
+  { "ampersand",                         778, NULL },
   { "arrowdblup",                        603, NULL },
-  { "arrowdown",                         603, NULL },
-  { "Ifraktur",                          686, NULL },
-  { "degree",                            400, NULL },
-  { "Iota",                              333, NULL },
+  { "aleph",                             823, NULL },
+  { "two",                               500, NULL },
+  { "bracerighttp",                      494, NULL },
+  { "seven",                             500, NULL },
+  { "propersuperset",                    713, NULL },
+  { "bullet",                            460, NULL },
   { "perpendicular",                     658, NULL },
-  { "radical",                           549, NULL },
-  { "asteriskmath",                      500, NULL },
-  { "percent",                           833, NULL },
-  { "zeta",                              494, NULL },
-  { "six",                               500, NULL },
-  { "two",                               500, NULL },
-  { "weierstrass",                       987, NULL },
-  { "summation",                         713, NULL },
-  { "bracketrighttp",                    384, NULL },
+  { "Lambda",                            686, NULL },
+  { "parenrightbt",                      384, NULL },
+  { "bracerightmid",                     494, NULL },
+  { "comma",                             250, NULL },
+  { "Delta",                             612, NULL },
+  { "bracerightbt",                      494, NULL },
+  { "union",                             768, NULL },
+  { "arrowhorizex",                     1000, NULL },
+  { "omega1",                            713, NULL },
+  { "proportional",                      713, NULL },
+  { "sigma1",                            439, NULL },
   { "carriagereturn",                    658, NULL },
   { "suchthat",                          439, NULL },
-  { "arrowvertex",                       603, NULL },
-  { "Delta",                             612, NULL },
-  { "iota",                              329, NULL },
-  { "arrowhorizex",                     1000, NULL },
+  { "notelement",                        713, NULL },
+  { "beta",                              549, NULL },
+  { "parenright",                        333, NULL },
+  { "bracketleft",                       333, NULL },
+  { "fraction",                          167, NULL },
+  { "Xi",                                645, NULL },
+  { "pi",                                549, NULL },
+  { "braceex",                           494, NULL },
+  { "bracketlefttp",                     384, NULL },
+  { "notsubset",                         713, NULL },
+  { "asteriskmath",                      500, NULL },
+  { "greaterequal",                      549, NULL },
+  { "emptyset",                          823, NULL },
   { "bracketrightex",                    384, NULL },
-  { "bracketright",                      333, NULL },
-  { "ampersand",                         778, NULL },
-  { "plus",                              549, NULL },
-  { "proportional",                      713, NULL },
-  { "delta",                             494, NULL },
-  { "copyrightserif",                    790, NULL },
-  { "bracerightmid",                     494, NULL },
-  { "arrowleft",                         987, NULL },
-  { "second",                            411, NULL },
-  { "arrowdblboth",                     1042, NULL },
-  { "florin",                            500, NULL },
-  { "Psi",                               795, NULL },
-  { "bracerightbt",                      494, NULL },
-  { "bracketleftbt",                     384, NULL },
-  { "seven",                             500, NULL },
-  { "braceleftmid",                      494, NULL },
+  { "gradient",                          713, NULL },
+  { "exclam",                            333, NULL },
   { "notequal",                          549, NULL },
+  { "congruent",                         549, NULL },
+  { "Pi",                                768, NULL },
+  { "Theta",                             741, NULL },
+  { "Rfraktur",                          795, NULL },
+  { "bracketrighttp",                    384, NULL },
+  { "parenleftbt",                       384, NULL },
+  { "universal",                         713, NULL },
+  { "upsilon",                           576, NULL },
   { "psi",                               686, NULL },
-  { "equivalence",                       549, NULL },
-  { "universal",                         713, NULL },
-  { "arrowdblright",                     987, NULL },
-  { "braceright",                        480, NULL },
-  { "reflexsubset",                      713, NULL },
-  { "Xi",                                645, NULL },
-  { "theta1",                            631, NULL },
-  { "logicalnot",                        713, NULL },
+  { "eight",                             500, NULL },
+  { "one",                               500, NULL },
   { "Kappa",                             722, NULL },
-  { "similar",                           549, NULL },
-  { "bar",                               200, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              549, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "chi",                               549, NULL },
+  { "trademarksans",                     786, NULL },
+  { "Rho",                               556, NULL },
+  { "Alpha",                             722, NULL },
+  { "bracketrightbt",                    384, NULL },
+  { "intersection",                      768, NULL },
+  { "xi",                                493, NULL },
+  { "slash",                             278, NULL },
+  { "registerserif",                     790, NULL },
+  { "iota",                              329, NULL },
+  { "Psi",                               795, NULL },
+  { "three",                             500, NULL },
+  { "lozenge",                           494, NULL },
+  { "Phi",                               763, NULL },
+  { "zeta",                              494, NULL },
+  { "lambda",                            549, NULL },
+  { "Mu",                                889, NULL },
+  { "bracelefttp",                       494, NULL },
+  { "eta",                               603, NULL },
   { "registersans",                      790, NULL },
-  { "omega1",                            713, NULL },
-  { "exclam",                            333, NULL },
-  { "Upsilon1",                          620, NULL },
-  { "bracerighttp",                      494, NULL },
-  { "xi",                                493, NULL },
-  { "period",                            250, NULL },
-  { "Alpha",                             722, NULL },
-  { "arrowright",                        987, NULL },
-  { "greater",                           549, NULL },
-  { "bracketlefttp",                     384, NULL },
-  { "kappa",                             549, NULL },
-  { "gradient",                          713, NULL },
-  { "integral",                          274, NULL },
-  { "arrowboth",                        1042, NULL },
-  { "Beta",                              667, NULL }
+  { "element",                           713, NULL },
+  { "semicolon",                         278, NULL }
 };
 
 static BuiltinFontWidth timesBoldWidthsTab[] = {
-  { "Ntilde",                            722, NULL },
+  { "cacute",                            444, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcaron",                            416, NULL },
   { "rcaron",                            444, NULL },
-  { "kcommaaccent",                      556, NULL },
-  { "Ncommaaccent",                      722, NULL },
-  { "Zacute",                            667, NULL },
-  { "comma",                             250, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         570, NULL },
-  { "circumflex",                        333, NULL },
-  { "dotaccent",                         333, NULL },
-  { "edotaccent",                        444, NULL },
-  { "asciitilde",                        520, NULL },
-  { "colon",                             333, NULL },
-  { "onehalf",                           750, NULL },
-  { "dollar",                            500, NULL },
-  { "Lcaron",                            667, NULL },
-  { "ntilde",                            556, NULL },
-  { "Aogonek",                           722, NULL },
   { "ncommaaccent",                      556, NULL },
-  { "minus",                             570, NULL },
+  { "tcommaaccent",                      333, NULL },
+  { "logicalnot",                        570, NULL },
+  { "m",                                 833, NULL },
+  { "OE",                               1000, NULL },
+  { "partialdiff",                       494, NULL },
+  { "U",                                 722, NULL },
+  { "x",                                 500, NULL },
+  { "y",                                 500, NULL },
   { "Iogonek",                           389, NULL },
-  { "zacute",                            444, NULL },
-  { "yen",                               500, NULL },
-  { "space",                             250, NULL },
-  { "Omacron",                           778, NULL },
-  { "questiondown",                      500, NULL },
-  { "emdash",                           1000, NULL },
-  { "Agrave",                            722, NULL },
-  { "three",                             500, NULL },
-  { "numbersign",                        500, NULL },
-  { "lcaron",                            394, NULL },
+  { "edieresis",                         444, NULL },
+  { "Ncaron",                            722, NULL },
+  { "question",                          500, NULL },
+  { "summation",                         600, NULL },
   { "A",                                 722, NULL },
+  { "igrave",                            278, NULL },
+  { "dcroat",                            556, NULL },
+  { "guilsinglleft",                     333, NULL },
+  { "h",                                 556, NULL },
+  { "Cacute",                            722, NULL },
+  { "plus",                              570, NULL },
+  { "P",                                 611, NULL },
+  { "lslash",                            278, NULL },
+  { "six",                               500, NULL },
+  { "edotaccent",                        444, NULL },
+  { "bar",                               220, NULL },
+  { "quotesingle",                       278, NULL },
+  { "multiply",                          570, NULL },
+  { "i",                                 278, NULL },
+  { "onequarter",                        750, NULL },
+  { "braceright",                        394, NULL },
+  { "braceleft",                         394, NULL },
+  { "acute",                             333, NULL },
+  { "oacute",                            500, NULL },
+  { "Yacute",                            722, NULL },
+  { "daggerdbl",                         500, NULL },
+  { "Atilde",                            722, NULL },
+  { "Edieresis",                         667, NULL },
+  { "ntilde",                            556, NULL },
+  { "fi",                                556, NULL },
+  { "trademark",                        1000, NULL },
+  { "ampersand",                         833, NULL },
+  { "Lcommaaccent",                      667, NULL },
+  { "O",                                 778, NULL },
+  { "Icircumflex",                       389, NULL },
+  { "nacute",                            556, NULL },
+  { "dieresis",                          333, NULL },
+  { "Eacute",                            667, NULL },
+  { "two",                               500, NULL },
+  { "uacute",                            556, NULL },
+  { "seven",                             500, NULL },
+  { "Udieresis",                         722, NULL },
+  { "Abreve",                            722, NULL },
+  { "Iacute",                            389, NULL },
+  { "bullet",                            350, NULL },
+  { "eogonek",                           444, NULL },
+  { "eacute",                            444, NULL },
+  { "Zdotaccent",                        667, NULL },
+  { "scaron",                            389, NULL },
+  { "guillemotright",                    500, NULL },
+  { "aacute",                            500, NULL },
+  { "Otilde",                            778, NULL },
+  { "umacron",                           556, NULL },
+  { "Tcaron",                            667, NULL },
+  { "ugrave",                            556, NULL },
+  { "dcaron",                            672, NULL },
+  { "hyphen",                            333, NULL },
+  { "Oslash",                            778, NULL },
+  { "a",                                 500, NULL },
   { "B",                                 667, NULL },
-  { "C",                                 722, NULL },
-  { "aogonek",                           500, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 667, NULL },
-  { "onequarter",                        750, NULL },
-  { "F",                                 611, NULL },
-  { "G",                                 778, NULL },
+  { "yacute",                            500, NULL },
+  { "kcommaaccent",                      556, NULL },
+  { "Rcaron",                            722, NULL },
+  { "R",                                 722, NULL },
+  { "ydieresis",                         500, NULL },
+  { "S",                                 556, NULL },
+  { "omacron",                           500, NULL },
+  { "comma",                             250, NULL },
+  { "Delta",                             612, NULL },
+  { "Gbreve",                            778, NULL },
+  { "ordfeminine",                       300, NULL },
+  { "quotedblleft",                      500, NULL },
+  { "Rcommaaccent",                      722, NULL },
+  { "ograve",                            500, NULL },
+  { "Lacute",                            667, NULL },
+  { "Idieresis",                         389, NULL },
+  { "sacute",                            389, NULL },
+  { "f",                                 333, NULL },
+  { "otilde",                            500, NULL },
+  { "parenright",                        333, NULL },
+  { "gcommaaccent",                      500, NULL },
+  { "Ohungarumlaut",                     778, NULL },
+  { "bracketleft",                       333, NULL },
+  { "fraction",                          167, NULL },
+  { "Sacute",                            556, NULL },
+  { "Adieresis",                         722, NULL },
+  { "Uacute",                            722, NULL },
+  { "atilde",                            500, NULL },
+  { "Zacute",                            667, NULL },
+  { "asciitilde",                        520, NULL },
   { "H",                                 778, NULL },
-  { "I",                                 389, NULL },
+  { "sterling",                          500, NULL },
+  { "greaterequal",                      549, NULL },
+  { "at",                                930, NULL },
+  { "Lslash",                            667, NULL },
+  { "Uogonek",                           722, NULL },
+  { "caron",                             333, NULL },
+  { "lacute",                            278, NULL },
+  { "notequal",                          549, NULL },
+  { "Agrave",                            722, NULL },
+  { "AE",                               1000, NULL },
+  { "exclam",                            333, NULL },
+  { "Acircumflex",                       722, NULL },
+  { "oslash",                            500, NULL },
+  { "threequarters",                     750, NULL },
   { "J",                                 500, NULL },
-  { "K",                                 778, NULL },
-  { "iogonek",                           278, NULL },
-  { "backslash",                         278, NULL },
+  { "ohungarumlaut",                     500, NULL },
+  { "Ecircumflex",                       667, NULL },
   { "L",                                 667, NULL },
+  { "z",                                 444, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "egrave",                            444, NULL },
+  { "uring",                             556, NULL },
+  { "s",                                 389, NULL },
+  { "c",                                 444, NULL },
+  { "d",                                 556, NULL },
+  { "eight",                             500, NULL },
+  { "I",                                 389, NULL },
+  { "one",                               500, NULL },
   { "periodcentered",                    250, NULL },
-  { "M",                                 944, NULL },
-  { "N",                                 722, NULL },
-  { "omacron",                           500, NULL },
-  { "Tcommaaccent",                      667, NULL },
-  { "O",                                 778, NULL },
-  { "P",                                 611, NULL },
-  { "Q",                                 778, NULL },
-  { "Uhungarumlaut",                     722, NULL },
-  { "R",                                 722, NULL },
-  { "Aacute",                            722, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 556, NULL },
-  { "T",                                 667, NULL },
-  { "U",                                 722, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "Aring",                             722, NULL },
   { "agrave",                            500, NULL },
+  { "Oacute",                            778, NULL },
+  { "t",                                 333, NULL },
+  { "quotedbl",                          555, NULL },
+  { "Eogonek",                           667, NULL },
+  { "macron",                            333, NULL },
+  { "Lcaron",                            667, NULL },
+  { "ordmasculine",                      330, NULL },
+  { "questiondown",                      500, NULL },
+  { "backslash",                         278, NULL },
+  { "slash",                             278, NULL },
+  { "r",                                 444, NULL },
+  { "ucircumflex",                       556, NULL },
+  { "three",                             500, NULL },
+  { "lozenge",                           494, NULL },
   { "V",                                 722, NULL },
-  { "W",                                1000, NULL },
-  { "X",                                 722, NULL },
-  { "question",                          500, NULL },
-  { "equal",                             570, NULL },
-  { "Y",                                 722, NULL },
+  { "Q",                                 778, NULL },
+  { "exclamdown",                        333, NULL },
+  { "Umacron",                           722, NULL },
+  { "zacute",                            444, NULL },
+  { "ncaron",                            556, NULL },
+  { "adieresis",                         500, NULL },
+  { "quoteright",                        333, NULL },
+  { "uogonek",                           556, NULL },
+  { "semicolon",                         333, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "Amacron",                           722, NULL },
+  { "breve",                             333, NULL },
+  { "Dcaron",                            722, NULL },
   { "Z",                                 667, NULL },
-  { "four",                              500, NULL },
-  { "a",                                 500, NULL },
-  { "Gcommaaccent",                      778, NULL },
+  { "ecircumflex",                       444, NULL },
+  { "lcaron",                            394, NULL },
+  { "paragraph",                         540, NULL },
+  { "zcaron",                            444, NULL },
+  { "aring",                             500, NULL },
+  { "Ydieresis",                         722, NULL },
+  { "section",                           500, NULL },
+  { "Scaron",                            556, NULL },
+  { "degree",                            400, NULL },
+  { "Euro",                              500, NULL },
+  { "florin",                            500, NULL },
+  { "iogonek",                           278, NULL },
+  { "Scommaaccent",                      556, NULL },
+  { "Aacute",                            722, NULL },
   { "b",                                 556, NULL },
-  { "c",                                 444, NULL },
-  { "d",                                 556, NULL },
-  { "e",                                 444, NULL },
-  { "f",                                 333, NULL },
+  { "K",                                 778, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 556, NULL },
+  { "Ntilde",                            722, NULL },
+  { "radical",                           549, NULL },
   { "g",                                 500, NULL },
-  { "bullet",                            350, NULL },
-  { "h",                                 556, NULL },
-  { "i",                                 278, NULL },
-  { "Oslash",                            778, NULL },
-  { "dagger",                            500, NULL },
-  { "j",                                 333, NULL },
+  { "colon",                             333, NULL },
+  { "ccedilla",                          444, NULL },
+  { "plusminus",                         570, NULL },
+  { "cedilla",                           333, NULL },
+  { "Idotaccent",                        389, NULL },
+  { "quotedblright",                     500, NULL },
+  { "Eth",                               722, NULL },
+  { "five",                              500, NULL },
+  { "X",                                 722, NULL },
+  { "asciicircum",                       581, NULL },
+  { "Odieresis",                         778, NULL },
+  { "oe",                                722, NULL },
+  { "aogonek",                           500, NULL },
+  { "Egrave",                            667, NULL },
+  { "ring",                              333, NULL },
+  { "emdash",                           1000, NULL },
+  { "Gcommaaccent",                      778, NULL },
+  { "quoteleft",                         333, NULL },
+  { "registered",                        747, NULL },
   { "k",                                 556, NULL },
-  { "l",                                 278, NULL },
-  { "m",                                 833, NULL },
+  { "copyright",                         747, NULL },
+  { "Racute",                            722, NULL },
+  { "lcommaaccent",                      278, NULL },
+  { "onehalf",                           750, NULL },
+  { "uhungarumlaut",                     556, NULL },
+  { "gbreve",                            500, NULL },
+  { "Ecaron",                            667, NULL },
+  { "threesuperior",                     300, NULL },
+  { "zdotaccent",                        444, NULL },
   { "n",                                 556, NULL },
-  { "tcommaaccent",                      333, NULL },
+  { "Emacron",                           667, NULL },
+  { "asterisk",                          500, NULL },
+  { "scommaaccent",                      389, NULL },
+  { "onesuperior",                       300, NULL },
+  { "greater",                           570, NULL },
+  { "percent",                          1000, NULL },
   { "o",                                 500, NULL },
-  { "ordfeminine",                       300, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 556, NULL },
+  { "abreve",                            500, NULL },
+  { "Imacron",                           389, NULL },
+  { "iacute",                            278, NULL },
+  { "e",                                 444, NULL },
+  { "icircumflex",                       278, NULL },
   { "q",                                 556, NULL },
-  { "uhungarumlaut",                     556, NULL },
-  { "r",                                 444, NULL },
-  { "twosuperior",                       300, NULL },
-  { "aacute",                            500, NULL },
-  { "s",                                 389, NULL },
-  { "OE",                               1000, NULL },
-  { "t",                                 333, NULL },
+  { "l",                                 278, NULL },
+  { "dagger",                            500, NULL },
+  { "equal",                             570, NULL },
+  { "N",                                 722, NULL },
+  { "C",                                 722, NULL },
+  { "u",                                 556, NULL },
+  { "Ugrave",                            722, NULL },
+  { "germandbls",                        556, NULL },
+  { "thorn",                             556, NULL },
+  { "commaaccent",                       250, NULL },
+  { "bracketright",                      333, NULL },
+  { "W",                                1000, NULL },
+  { "Ccedilla",                          722, NULL },
+  { "Igrave",                            389, NULL },
+  { "zero",                              500, NULL },
+  { "period",                            250, NULL },
+  { "scedilla",                          389, NULL },
+  { "udieresis",                         556, NULL },
+  { "perthousand",                      1000, NULL },
+  { "Edotaccent",                        667, NULL },
+  { "acircumflex",                       500, NULL },
+  { "Ocircumflex",                       778, NULL },
+  { "F",                                 611, NULL },
+  { "Uring",                             722, NULL },
+  { "G",                                 778, NULL },
+  { "T",                                 667, NULL },
+  { "M",                                 944, NULL },
+  { "odieresis",                         500, NULL },
+  { "Ograve",                            778, NULL },
+  { "numbersign",                        500, NULL },
   { "divide",                            570, NULL },
-  { "u",                                 556, NULL },
-  { "Ccaron",                            722, NULL },
-  { "v",                                 500, NULL },
+  { "emacron",                           444, NULL },
+  { "amacron",                           500, NULL },
+  { "Ncommaaccent",                      722, NULL },
+  { "endash",                            500, NULL },
+  { "guillemotleft",                     500, NULL },
+  { "fl",                                556, NULL },
+  { "E",                                 667, NULL },
+  { "quotedblbase",                      500, NULL },
+  { "ecaron",                            444, NULL },
+  { "Aogonek",                           722, NULL },
+  { "brokenbar",                         220, NULL },
   { "w",                                 722, NULL },
-  { "x",                                 500, NULL },
-  { "y",                                 500, NULL },
-  { "z",                                 444, NULL },
-  { "Gbreve",                            778, NULL },
-  { "commaaccent",                       250, NULL },
+  { "Thorn",                             611, NULL },
+  { "space",                             250, NULL },
+  { "eth",                               500, NULL },
+  { "twosuperior",                       300, NULL },
+  { "Y",                                 722, NULL },
+  { "yen",                               500, NULL },
   { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        389, NULL },
-  { "Nacute",                            722, NULL },
-  { "quotedbl",                          555, NULL },
-  { "gcommaaccent",                      500, NULL },
-  { "mu",                                556, NULL },
-  { "greaterequal",                      549, NULL },
-  { "Scaron",                            556, NULL },
-  { "Lslash",                            667, NULL },
-  { "semicolon",                         333, NULL },
-  { "oslash",                            500, NULL },
+  { "Ccaron",                            722, NULL },
+  { "j",                                 333, NULL },
+  { "Omacron",                           778, NULL },
   { "lessequal",                         549, NULL },
-  { "lozenge",                           494, NULL },
-  { "parenright",                        333, NULL },
+  { "Ucircumflex",                       722, NULL },
   { "ccaron",                            444, NULL },
-  { "Ecircumflex",                       667, NULL },
-  { "gbreve",                            500, NULL },
-  { "trademark",                        1000, NULL },
-  { "daggerdbl",                         500, NULL },
-  { "nacute",                            556, NULL },
-  { "macron",                            333, NULL },
-  { "Otilde",                            778, NULL },
-  { "Emacron",                           667, NULL },
-  { "ellipsis",                         1000, NULL },
-  { "scaron",                            389, NULL },
-  { "AE",                               1000, NULL },
-  { "Ucircumflex",                       722, NULL },
-  { "lslash",                            278, NULL },
-  { "quotedblleft",                      500, NULL },
-  { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
-  { "quotesingle",                       278, NULL },
-  { "eight",                             500, NULL },
-  { "exclamdown",                        333, NULL },
-  { "endash",                            500, NULL },
-  { "oe",                                722, NULL },
-  { "Abreve",                            722, NULL },
-  { "Umacron",                           722, NULL },
-  { "ecircumflex",                       444, NULL },
-  { "Adieresis",                         722, NULL },
-  { "copyright",                         747, NULL },
-  { "Egrave",                            667, NULL },
-  { "slash",                             278, NULL },
-  { "Edieresis",                         667, NULL },
-  { "otilde",                            500, NULL },
-  { "Idieresis",                         389, NULL },
+  { "grave",                             333, NULL },
+  { "Scedilla",                          556, NULL },
+  { "quotesinglbase",                    333, NULL },
+  { "currency",                          500, NULL },
+  { "nine",                              500, NULL },
   { "parenleft",                         333, NULL },
-  { "one",                               500, NULL },
-  { "emacron",                           444, NULL },
-  { "Odieresis",                         778, NULL },
-  { "ucircumflex",                       556, NULL },
-  { "bracketleft",                       333, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        333, NULL },
-  { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         722, NULL },
-  { "umacron",                           556, NULL },
-  { "abreve",                            500, NULL },
-  { "Eacute",                            667, NULL },
-  { "adieresis",                         500, NULL },
-  { "egrave",                            444, NULL },
-  { "edieresis",                         444, NULL },
+  { "ogonek",                            333, NULL },
   { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
+  { "circumflex",                        333, NULL },
+  { "Zcaron",                            667, NULL },
+  { "ocircumflex",                       500, NULL },
+  { "less",                              570, NULL },
+  { "minus",                             570, NULL },
+  { "four",                              500, NULL },
   { "ae",                                722, NULL },
-  { "asterisk",                          500, NULL },
-  { "odieresis",                         500, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            556, NULL },
-  { "nine",                              500, NULL },
-  { "five",                              500, NULL },
-  { "udieresis",                         556, NULL },
-  { "Zcaron",                            667, NULL },
-  { "Scommaaccent",                      556, NULL },
-  { "threequarters",                     750, NULL },
-  { "guillemotright",                    500, NULL },
-  { "Ccedilla",                          722, NULL },
-  { "ydieresis",                         500, NULL },
-  { "tilde",                             333, NULL },
-  { "at",                                930, NULL },
-  { "eacute",                            444, NULL },
+  { "cent",                              500, NULL },
+  { "Tcommaaccent",                      667, NULL },
+  { "dollar",                            500, NULL },
+  { "v",                                 500, NULL },
+  { "Nacute",                            722, NULL },
+  { "dotaccent",                         333, NULL },
   { "underscore",                        500, NULL },
-  { "Euro",                              500, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          570, NULL },
-  { "zero",                              500, NULL },
-  { "eth",                               500, NULL },
-  { "Scedilla",                          556, NULL },
-  { "Ograve",                            778, NULL },
-  { "Racute",                            722, NULL },
-  { "partialdiff",                       494, NULL },
-  { "uacute",                            556, NULL },
-  { "braceleft",                         394, NULL },
-  { "Thorn",                             611, NULL },
-  { "zcaron",                            444, NULL },
-  { "scommaaccent",                      389, NULL },
-  { "ccedilla",                          444, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            556, NULL },
-  { "Ocircumflex",                       778, NULL },
-  { "Oacute",                            778, NULL },
-  { "scedilla",                          389, NULL },
-  { "ogonek",                            333, NULL },
-  { "ograve",                            500, NULL },
+  { "D",                                 722, NULL },
+  { "mu",                                556, NULL },
   { "racute",                            444, NULL },
-  { "Tcaron",                            667, NULL },
-  { "Eogonek",                           667, NULL },
-  { "thorn",                             556, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        747, NULL },
-  { "radical",                           549, NULL },
-  { "Aring",                             722, NULL },
-  { "percent",                          1000, NULL },
-  { "six",                               500, NULL },
-  { "paragraph",                         540, NULL },
-  { "dcaron",                            672, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               500, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            389, NULL },
-  { "Lacute",                            667, NULL },
-  { "ocircumflex",                       500, NULL },
-  { "oacute",                            500, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      667, NULL },
-  { "tcaron",                            416, NULL },
-  { "eogonek",                           444, NULL },
-  { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     778, NULL },
-  { "asciicircum",                       581, NULL },
-  { "aring",                             500, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           556, NULL },
-  { "bracketright",                      333, NULL },
-  { "Iacute",                            389, NULL },
-  { "ampersand",                         833, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            278, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              570, NULL },
-  { "uring",                             556, NULL },
-  { "quotesinglbase",                    333, NULL },
-  { "lcommaaccent",                      278, NULL },
-  { "Yacute",                            722, NULL },
-  { "ohungarumlaut",                     500, NULL },
-  { "threesuperior",                     300, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           500, NULL },
-  { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      500, NULL },
-  { "ncaron",                            556, NULL },
-  { "florin",                            500, NULL },
-  { "yacute",                            500, NULL },
-  { "Rcommaaccent",                      722, NULL },
-  { "fi",                                556, NULL },
-  { "fl",                                556, NULL },
-  { "Acircumflex",                       722, NULL },
-  { "Cacute",                            722, NULL },
-  { "Icircumflex",                       389, NULL },
-  { "guillemotleft",                     500, NULL },
-  { "germandbls",                        556, NULL },
-  { "Amacron",                           722, NULL },
-  { "seven",                             500, NULL },
-  { "Sacute",                            556, NULL },
-  { "ordmasculine",                      330, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          500, NULL },
-  { "notequal",                          549, NULL },
-  { "Imacron",                           389, NULL },
   { "rcommaaccent",                      444, NULL },
-  { "Zdotaccent",                        667, NULL },
-  { "acircumflex",                       500, NULL },
-  { "cacute",                            444, NULL },
-  { "Ecaron",                            667, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        394, NULL },
-  { "quotedblright",                     500, NULL },
-  { "amacron",                           500, NULL },
-  { "sacute",                            389, NULL },
   { "imacron",                           278, NULL },
-  { "cent",                              500, NULL },
-  { "currency",                          500, NULL },
-  { "logicalnot",                        570, NULL },
-  { "zdotaccent",                        444, NULL },
-  { "Atilde",                            722, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               220, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              570, NULL },
-  { "ecaron",                            444, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            333, NULL },
-  { "period",                            250, NULL },
-  { "Rcaron",                            722, NULL },
   { "Kcommaaccent",                      778, NULL },
-  { "greater",                           570, NULL },
-  { "atilde",                            500, NULL },
-  { "brokenbar",                         220, NULL },
-  { "quoteleft",                         333, NULL },
-  { "Edotaccent",                        667, NULL },
-  { "onesuperior",                       300, NULL }
+  { "tilde",                             333, NULL }
 };
 
 static BuiltinFontWidth timesBoldItalicWidthsTab[] = {
-  { "Ntilde",                            722, NULL },
-  { "rcaron",                            389, NULL },
-  { "kcommaaccent",                      500, NULL },
+  { "M",                                 889, NULL },
+  { "odieresis",                         500, NULL },
+  { "Ograve",                            722, NULL },
+  { "T",                                 611, NULL },
+  { "amacron",                           500, NULL },
   { "Ncommaaccent",                      722, NULL },
-  { "Zacute",                            611, NULL },
-  { "comma",                             250, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         570, NULL },
+  { "numbersign",                        500, NULL },
+  { "divide",                            570, NULL },
+  { "emacron",                           444, NULL },
+  { "fl",                                556, NULL },
+  { "E",                                 667, NULL },
+  { "quotedblbase",                      500, NULL },
+  { "endash",                            500, NULL },
+  { "guillemotleft",                     500, NULL },
+  { "w",                                 667, NULL },
+  { "Thorn",                             611, NULL },
+  { "space",                             250, NULL },
+  { "eth",                               500, NULL },
+  { "twosuperior",                       300, NULL },
+  { "ecaron",                            444, NULL },
+  { "Aogonek",                           667, NULL },
+  { "brokenbar",                         220, NULL },
+  { "commaaccent",                       250, NULL },
+  { "bracketright",                      333, NULL },
+  { "W",                                 889, NULL },
+  { "Ugrave",                            722, NULL },
+  { "germandbls",                        500, NULL },
+  { "thorn",                             500, NULL },
+  { "zero",                              500, NULL },
+  { "period",                            250, NULL },
+  { "scedilla",                          389, NULL },
+  { "udieresis",                         556, NULL },
+  { "Ccedilla",                          667, NULL },
+  { "Igrave",                            389, NULL },
+  { "Ocircumflex",                       722, NULL },
+  { "F",                                 667, NULL },
+  { "Uring",                             722, NULL },
+  { "Edotaccent",                        667, NULL },
+  { "perthousand",                      1000, NULL },
+  { "acircumflex",                       500, NULL },
+  { "G",                                 722, NULL },
   { "circumflex",                        333, NULL },
+  { "Zcaron",                            611, NULL },
+  { "ogonek",                            333, NULL },
+  { "idieresis",                         278, NULL },
+  { "ae",                                722, NULL },
+  { "cent",                              500, NULL },
+  { "ocircumflex",                       500, NULL },
+  { "less",                              570, NULL },
+  { "minus",                             606, NULL },
+  { "four",                              500, NULL },
+  { "dollar",                            500, NULL },
+  { "Tcommaaccent",                      611, NULL },
+  { "v",                                 444, NULL },
+  { "Nacute",                            722, NULL },
   { "dotaccent",                         333, NULL },
-  { "edotaccent",                        444, NULL },
-  { "asciitilde",                        570, NULL },
-  { "colon",                             333, NULL },
-  { "onehalf",                           750, NULL },
-  { "dollar",                            500, NULL },
-  { "Lcaron",                            611, NULL },
-  { "ntilde",                            556, NULL },
-  { "Aogonek",                           667, NULL },
-  { "ncommaaccent",                      556, NULL },
-  { "minus",                             606, NULL },
-  { "Iogonek",                           389, NULL },
-  { "zacute",                            389, NULL },
+  { "rcommaaccent",                      389, NULL },
+  { "Kcommaaccent",                      667, NULL },
+  { "imacron",                           278, NULL },
+  { "tilde",                             333, NULL },
+  { "underscore",                        500, NULL },
+  { "mu",                                576, NULL },
+  { "D",                                 722, NULL },
+  { "racute",                            389, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "j",                                 278, NULL },
+  { "Ccaron",                            667, NULL },
   { "yen",                               500, NULL },
-  { "space",                             250, NULL },
+  { "Y",                                 611, NULL },
+  { "ccaron",                            444, NULL },
+  { "lessequal",                         549, NULL },
+  { "Ucircumflex",                       722, NULL },
   { "Omacron",                           722, NULL },
-  { "questiondown",                      500, NULL },
+  { "quotesinglbase",                    333, NULL },
+  { "grave",                             333, NULL },
+  { "Scedilla",                          556, NULL },
+  { "parenleft",                         333, NULL },
+  { "currency",                          500, NULL },
+  { "nine",                              500, NULL },
+  { "Ntilde",                            722, NULL },
+  { "radical",                           549, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 500, NULL },
+  { "plusminus",                         570, NULL },
+  { "Idotaccent",                        389, NULL },
+  { "cedilla",                           333, NULL },
+  { "quotedblright",                     500, NULL },
+  { "Eth",                               722, NULL },
+  { "colon",                             333, NULL },
+  { "g",                                 500, NULL },
+  { "ccedilla",                          444, NULL },
+  { "Odieresis",                         722, NULL },
+  { "oe",                                722, NULL },
+  { "five",                              500, NULL },
+  { "X",                                 667, NULL },
+  { "asciicircum",                       570, NULL },
   { "emdash",                           1000, NULL },
-  { "Agrave",                            667, NULL },
-  { "three",                             500, NULL },
-  { "numbersign",                        500, NULL },
+  { "aogonek",                           500, NULL },
+  { "Egrave",                            667, NULL },
+  { "ring",                              333, NULL },
+  { "Dcaron",                            722, NULL },
+  { "Z",                                 611, NULL },
+  { "ecircumflex",                       444, NULL },
+  { "Amacron",                           667, NULL },
+  { "breve",                             333, NULL },
   { "lcaron",                            382, NULL },
-  { "A",                                 667, NULL },
-  { "B",                                 667, NULL },
-  { "C",                                 667, NULL },
-  { "aogonek",                           500, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 667, NULL },
-  { "onequarter",                        750, NULL },
-  { "F",                                 667, NULL },
-  { "G",                                 722, NULL },
-  { "H",                                 778, NULL },
-  { "I",                                 389, NULL },
-  { "J",                                 500, NULL },
+  { "paragraph",                         500, NULL },
+  { "zcaron",                            389, NULL },
+  { "aring",                             500, NULL },
+  { "Ydieresis",                         611, NULL },
+  { "Euro",                              500, NULL },
+  { "iogonek",                           278, NULL },
+  { "florin",                            500, NULL },
+  { "section",                           500, NULL },
+  { "Scaron",                            556, NULL },
+  { "degree",                            400, NULL },
   { "K",                                 667, NULL },
-  { "iogonek",                           278, NULL },
-  { "backslash",                         278, NULL },
-  { "L",                                 611, NULL },
-  { "periodcentered",                    250, NULL },
-  { "M",                                 889, NULL },
-  { "N",                                 722, NULL },
-  { "omacron",                           500, NULL },
-  { "Tcommaaccent",                      611, NULL },
-  { "O",                                 722, NULL },
-  { "P",                                 611, NULL },
-  { "Q",                                 722, NULL },
-  { "Uhungarumlaut",                     722, NULL },
-  { "R",                                 667, NULL },
+  { "Scommaaccent",                      556, NULL },
   { "Aacute",                            667, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 556, NULL },
-  { "T",                                 611, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            500, NULL },
-  { "V",                                 667, NULL },
-  { "W",                                 889, NULL },
-  { "X",                                 667, NULL },
-  { "question",                          500, NULL },
-  { "equal",                             570, NULL },
-  { "Y",                                 611, NULL },
-  { "Z",                                 611, NULL },
-  { "four",                              500, NULL },
-  { "a",                                 500, NULL },
-  { "Gcommaaccent",                      722, NULL },
   { "b",                                 500, NULL },
-  { "c",                                 444, NULL },
-  { "d",                                 500, NULL },
+  { "greater",                           570, NULL },
+  { "asterisk",                          500, NULL },
+  { "Emacron",                           667, NULL },
+  { "scommaaccent",                      389, NULL },
+  { "onesuperior",                       300, NULL },
+  { "percent",                           833, NULL },
+  { "o",                                 500, NULL },
+  { "icircumflex",                       278, NULL },
+  { "abreve",                            500, NULL },
+  { "Imacron",                           389, NULL },
   { "e",                                 444, NULL },
-  { "f",                                 333, NULL },
-  { "g",                                 500, NULL },
-  { "bullet",                            350, NULL },
-  { "h",                                 556, NULL },
-  { "i",                                 278, NULL },
-  { "Oslash",                            722, NULL },
+  { "iacute",                            278, NULL },
   { "dagger",                            500, NULL },
-  { "j",                                 278, NULL },
+  { "equal",                             570, NULL },
+  { "N",                                 722, NULL },
+  { "C",                                 667, NULL },
+  { "u",                                 556, NULL },
+  { "q",                                 500, NULL },
+  { "l",                                 278, NULL },
+  { "quoteleft",                         333, NULL },
+  { "registered",                        747, NULL },
+  { "Gcommaaccent",                      722, NULL },
+  { "Racute",                            667, NULL },
   { "k",                                 500, NULL },
-  { "l",                                 278, NULL },
-  { "m",                                 778, NULL },
+  { "copyright",                         747, NULL },
+  { "lcommaaccent",                      278, NULL },
+  { "onehalf",                           750, NULL },
+  { "gbreve",                            500, NULL },
+  { "uhungarumlaut",                     556, NULL },
   { "n",                                 556, NULL },
-  { "tcommaaccent",                      278, NULL },
-  { "o",                                 500, NULL },
-  { "ordfeminine",                       266, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 500, NULL },
-  { "q",                                 500, NULL },
-  { "uhungarumlaut",                     556, NULL },
-  { "r",                                 389, NULL },
-  { "twosuperior",                       300, NULL },
-  { "aacute",                            500, NULL },
-  { "s",                                 389, NULL },
-  { "OE",                                944, NULL },
-  { "t",                                 278, NULL },
-  { "divide",                            570, NULL },
-  { "u",                                 556, NULL },
-  { "Ccaron",                            667, NULL },
-  { "v",                                 444, NULL },
-  { "w",                                 667, NULL },
-  { "x",                                 500, NULL },
-  { "y",                                 444, NULL },
-  { "z",                                 389, NULL },
-  { "Gbreve",                            722, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        389, NULL },
-  { "Nacute",                            722, NULL },
-  { "quotedbl",                          555, NULL },
-  { "gcommaaccent",                      500, NULL },
-  { "mu",                                576, NULL },
+  { "Ecaron",                            667, NULL },
+  { "threesuperior",                     300, NULL },
+  { "zdotaccent",                        389, NULL },
+  { "Uacute",                            722, NULL },
+  { "atilde",                            500, NULL },
+  { "Zacute",                            611, NULL },
+  { "fraction",                          167, NULL },
+  { "Sacute",                            556, NULL },
+  { "Adieresis",                         667, NULL },
+  { "asciitilde",                        570, NULL },
+  { "Uogonek",                           722, NULL },
+  { "Lslash",                            611, NULL },
+  { "caron",                             333, NULL },
+  { "lacute",                            278, NULL },
+  { "H",                                 778, NULL },
+  { "sterling",                          500, NULL },
   { "greaterequal",                      549, NULL },
-  { "Scaron",                            556, NULL },
-  { "Lslash",                            611, NULL },
-  { "semicolon",                         333, NULL },
+  { "at",                                832, NULL },
+  { "threequarters",                     750, NULL },
+  { "J",                                 500, NULL },
+  { "ohungarumlaut",                     500, NULL },
+  { "Ecircumflex",                       667, NULL },
+  { "L",                                 611, NULL },
+  { "notequal",                          549, NULL },
+  { "Agrave",                            667, NULL },
+  { "exclam",                            389, NULL },
+  { "AE",                                944, NULL },
+  { "Acircumflex",                       667, NULL },
   { "oslash",                            500, NULL },
-  { "lessequal",                         549, NULL },
-  { "lozenge",                           494, NULL },
+  { "ograve",                            500, NULL },
+  { "Rcommaaccent",                      667, NULL },
+  { "Lacute",                            611, NULL },
+  { "sacute",                            389, NULL },
+  { "Idieresis",                         389, NULL },
+  { "f",                                 333, NULL },
+  { "gcommaaccent",                      500, NULL },
+  { "Ohungarumlaut",                     722, NULL },
+  { "bracketleft",                       333, NULL },
+  { "otilde",                            500, NULL },
   { "parenright",                        333, NULL },
-  { "ccaron",                            444, NULL },
-  { "Ecircumflex",                       667, NULL },
-  { "gbreve",                            500, NULL },
-  { "trademark",                        1000, NULL },
-  { "daggerdbl",                         500, NULL },
-  { "nacute",                            556, NULL },
+  { "Eogonek",                           667, NULL },
   { "macron",                            333, NULL },
-  { "Otilde",                            722, NULL },
-  { "Emacron",                           667, NULL },
+  { "backslash",                         278, NULL },
+  { "Lcaron",                            611, NULL },
+  { "ordmasculine",                      300, NULL },
+  { "questiondown",                      500, NULL },
+  { "three",                             500, NULL },
+  { "slash",                             278, NULL },
+  { "r",                                 389, NULL },
+  { "ucircumflex",                       556, NULL },
+  { "zacute",                            389, NULL },
+  { "Umacron",                           722, NULL },
+  { "ncaron",                            556, NULL },
+  { "adieresis",                         500, NULL },
+  { "lozenge",                           494, NULL },
+  { "V",                                 667, NULL },
+  { "Q",                                 722, NULL },
+  { "exclamdown",                        389, NULL },
+  { "quoteright",                        333, NULL },
+  { "uogonek",                           556, NULL },
+  { "semicolon",                         333, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "egrave",                            444, NULL },
+  { "uring",                             556, NULL },
+  { "s",                                 389, NULL },
+  { "z",                                 389, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "one",                               500, NULL },
+  { "I",                                 389, NULL },
+  { "eight",                             500, NULL },
+  { "periodcentered",                    250, NULL },
+  { "c",                                 444, NULL },
+  { "d",                                 500, NULL },
+  { "agrave",                            500, NULL },
   { "ellipsis",                         1000, NULL },
-  { "scaron",                            389, NULL },
-  { "AE",                                944, NULL },
-  { "Ucircumflex",                       722, NULL },
+  { "Aring",                             667, NULL },
+  { "t",                                 278, NULL },
+  { "quotedbl",                          555, NULL },
+  { "Oacute",                            722, NULL },
+  { "six",                               500, NULL },
+  { "edotaccent",                        444, NULL },
   { "lslash",                            278, NULL },
-  { "quotedblleft",                      500, NULL },
-  { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
+  { "P",                                 611, NULL },
+  { "i",                                 278, NULL },
+  { "multiply",                          570, NULL },
+  { "bar",                               220, NULL },
   { "quotesingle",                       278, NULL },
-  { "eight",                             500, NULL },
-  { "exclamdown",                        389, NULL },
-  { "endash",                            500, NULL },
-  { "oe",                                722, NULL },
-  { "Abreve",                            667, NULL },
-  { "Umacron",                           722, NULL },
-  { "ecircumflex",                       444, NULL },
-  { "Adieresis",                         667, NULL },
-  { "copyright",                         747, NULL },
-  { "Egrave",                            667, NULL },
-  { "slash",                             278, NULL },
+  { "braceleft",                         348, NULL },
+  { "braceright",                        348, NULL },
+  { "acute",                             333, NULL },
+  { "onequarter",                        750, NULL },
+  { "Atilde",                            667, NULL },
   { "Edieresis",                         667, NULL },
-  { "otilde",                            500, NULL },
-  { "Idieresis",                         389, NULL },
-  { "parenleft",                         333, NULL },
-  { "one",                               500, NULL },
-  { "emacron",                           444, NULL },
-  { "Odieresis",                         722, NULL },
-  { "ucircumflex",                       556, NULL },
-  { "bracketleft",                       333, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        333, NULL },
-  { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         611, NULL },
-  { "umacron",                           556, NULL },
-  { "abreve",                            500, NULL },
-  { "Eacute",                            667, NULL },
-  { "adieresis",                         500, NULL },
-  { "egrave",                            444, NULL },
+  { "oacute",                            500, NULL },
+  { "Yacute",                            611, NULL },
+  { "daggerdbl",                         500, NULL },
+  { "ncommaaccent",                      556, NULL },
+  { "tcommaaccent",                      278, NULL },
+  { "logicalnot",                        606, NULL },
+  { "cacute",                            444, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcaron",                            366, NULL },
+  { "rcaron",                            389, NULL },
+  { "x",                                 500, NULL },
+  { "Iogonek",                           389, NULL },
   { "edieresis",                         444, NULL },
-  { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
-  { "ae",                                722, NULL },
-  { "asterisk",                          500, NULL },
-  { "odieresis",                         500, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            556, NULL },
-  { "nine",                              500, NULL },
-  { "five",                              500, NULL },
-  { "udieresis",                         556, NULL },
-  { "Zcaron",                            611, NULL },
-  { "Scommaaccent",                      556, NULL },
-  { "threequarters",                     750, NULL },
-  { "guillemotright",                    500, NULL },
-  { "Ccedilla",                          667, NULL },
-  { "ydieresis",                         444, NULL },
-  { "tilde",                             333, NULL },
-  { "at",                                832, NULL },
-  { "eacute",                            444, NULL },
-  { "underscore",                        500, NULL },
-  { "Euro",                              500, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          570, NULL },
-  { "zero",                              500, NULL },
-  { "eth",                               500, NULL },
-  { "Scedilla",                          556, NULL },
-  { "Ograve",                            722, NULL },
-  { "Racute",                            667, NULL },
+  { "y",                                 444, NULL },
+  { "Ncaron",                            722, NULL },
+  { "m",                                 778, NULL },
+  { "OE",                                944, NULL },
+  { "U",                                 722, NULL },
   { "partialdiff",                       494, NULL },
-  { "uacute",                            556, NULL },
-  { "braceleft",                         348, NULL },
-  { "Thorn",                             611, NULL },
-  { "zcaron",                            389, NULL },
-  { "scommaaccent",                      389, NULL },
-  { "ccedilla",                          444, NULL },
-  { "Dcaron",                            722, NULL },
+  { "igrave",                            278, NULL },
   { "dcroat",                            500, NULL },
-  { "Ocircumflex",                       722, NULL },
-  { "Oacute",                            722, NULL },
-  { "scedilla",                          389, NULL },
-  { "ogonek",                            333, NULL },
-  { "ograve",                            500, NULL },
-  { "racute",                            389, NULL },
+  { "question",                          500, NULL },
+  { "summation",                         600, NULL },
+  { "A",                                 667, NULL },
+  { "guilsinglleft",                     333, NULL },
+  { "Cacute",                            667, NULL },
+  { "h",                                 556, NULL },
+  { "plus",                              570, NULL },
+  { "Otilde",                            722, NULL },
+  { "umacron",                           556, NULL },
   { "Tcaron",                            611, NULL },
-  { "Eogonek",                           667, NULL },
-  { "thorn",                             500, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        747, NULL },
-  { "radical",                           549, NULL },
-  { "Aring",                             667, NULL },
-  { "percent",                           833, NULL },
-  { "six",                               500, NULL },
-  { "paragraph",                         500, NULL },
+  { "aacute",                            500, NULL },
+  { "B",                                 667, NULL },
+  { "kcommaaccent",                      500, NULL },
+  { "Rcaron",                            667, NULL },
+  { "yacute",                            444, NULL },
+  { "ydieresis",                         444, NULL },
+  { "R",                                 667, NULL },
+  { "ugrave",                            556, NULL },
   { "dcaron",                            608, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               500, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            389, NULL },
-  { "Lacute",                            611, NULL },
-  { "ocircumflex",                       500, NULL },
-  { "oacute",                            500, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      611, NULL },
-  { "tcaron",                            366, NULL },
-  { "eogonek",                           444, NULL },
+  { "Oslash",                            722, NULL },
+  { "hyphen",                            333, NULL },
+  { "a",                                 500, NULL },
+  { "omacron",                           500, NULL },
   { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     722, NULL },
-  { "asciicircum",                       570, NULL },
-  { "aring",                             500, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           556, NULL },
-  { "bracketright",                      333, NULL },
-  { "Iacute",                            389, NULL },
+  { "comma",                             250, NULL },
+  { "Gbreve",                            722, NULL },
+  { "S",                                 556, NULL },
+  { "quotedblleft",                      500, NULL },
+  { "ordfeminine",                       266, NULL },
+  { "trademark",                        1000, NULL },
   { "ampersand",                         778, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            278, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              570, NULL },
-  { "uring",                             556, NULL },
-  { "quotesinglbase",                    333, NULL },
-  { "lcommaaccent",                      278, NULL },
-  { "Yacute",                            611, NULL },
-  { "ohungarumlaut",                     500, NULL },
-  { "threesuperior",                     300, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           500, NULL },
+  { "Lcommaaccent",                      611, NULL },
+  { "ntilde",                            556, NULL },
+  { "fi",                                556, NULL },
   { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      500, NULL },
-  { "ncaron",                            556, NULL },
-  { "florin",                            500, NULL },
-  { "yacute",                            444, NULL },
-  { "Rcommaaccent",                      667, NULL },
-  { "fi",                                556, NULL },
-  { "fl",                                556, NULL },
-  { "Acircumflex",                       667, NULL },
-  { "Cacute",                            667, NULL },
+  { "Eacute",                            667, NULL },
+  { "O",                                 722, NULL },
   { "Icircumflex",                       389, NULL },
-  { "guillemotleft",                     500, NULL },
-  { "germandbls",                        500, NULL },
-  { "Amacron",                           667, NULL },
+  { "nacute",                            556, NULL },
+  { "Abreve",                            667, NULL },
+  { "Udieresis",                         722, NULL },
+  { "Iacute",                            389, NULL },
+  { "two",                               500, NULL },
+  { "uacute",                            556, NULL },
   { "seven",                             500, NULL },
-  { "Sacute",                            556, NULL },
-  { "ordmasculine",                      300, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          500, NULL },
-  { "notequal",                          549, NULL },
-  { "Imacron",                           389, NULL },
-  { "rcommaaccent",                      389, NULL },
-  { "Zdotaccent",                        611, NULL },
-  { "acircumflex",                       500, NULL },
-  { "cacute",                            444, NULL },
-  { "Ecaron",                            667, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        348, NULL },
-  { "quotedblright",                     500, NULL },
-  { "amacron",                           500, NULL },
-  { "sacute",                            389, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              500, NULL },
-  { "currency",                          500, NULL },
-  { "logicalnot",                        606, NULL },
-  { "zdotaccent",                        389, NULL },
-  { "Atilde",                            667, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               220, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              570, NULL },
-  { "ecaron",                            444, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            389, NULL },
-  { "period",                            250, NULL },
-  { "Rcaron",                            667, NULL },
-  { "Kcommaaccent",                      667, NULL },
-  { "greater",                           570, NULL },
-  { "atilde",                            500, NULL },
-  { "brokenbar",                         220, NULL },
-  { "quoteleft",                         333, NULL },
-  { "Edotaccent",                        667, NULL },
-  { "onesuperior",                       300, NULL }
+  { "scaron",                            389, NULL },
+  { "guillemotright",                    500, NULL },
+  { "bullet",                            350, NULL },
+  { "eogonek",                           444, NULL },
+  { "eacute",                            444, NULL },
+  { "Zdotaccent",                        611, NULL }
 };
 
 static BuiltinFontWidth timesItalicWidthsTab[] = {
-  { "Ntilde",                            667, NULL },
-  { "rcaron",                            389, NULL },
-  { "kcommaaccent",                      444, NULL },
-  { "Ncommaaccent",                      667, NULL },
-  { "Zacute",                            556, NULL },
-  { "comma",                             250, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         675, NULL },
-  { "circumflex",                        333, NULL },
-  { "dotaccent",                         333, NULL },
-  { "edotaccent",                        444, NULL },
-  { "asciitilde",                        541, NULL },
-  { "colon",                             333, NULL },
-  { "onehalf",                           750, NULL },
-  { "dollar",                            500, NULL },
+  { "quoteright",                        333, NULL },
+  { "uogonek",                           500, NULL },
+  { "semicolon",                         333, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "Umacron",                           722, NULL },
+  { "zacute",                            389, NULL },
+  { "ncaron",                            500, NULL },
+  { "adieresis",                         500, NULL },
+  { "lozenge",                           471, NULL },
+  { "V",                                 611, NULL },
+  { "Q",                                 722, NULL },
+  { "exclamdown",                        389, NULL },
+  { "three",                             500, NULL },
+  { "slash",                             278, NULL },
+  { "r",                                 389, NULL },
+  { "ucircumflex",                       500, NULL },
+  { "Eogonek",                           611, NULL },
+  { "macron",                            333, NULL },
+  { "ordmasculine",                      310, NULL },
   { "Lcaron",                            611, NULL },
-  { "ntilde",                            500, NULL },
-  { "Aogonek",                           611, NULL },
-  { "ncommaaccent",                      500, NULL },
-  { "minus",                             675, NULL },
-  { "Iogonek",                           333, NULL },
-  { "zacute",                            389, NULL },
-  { "yen",                               500, NULL },
-  { "space",                             250, NULL },
-  { "Omacron",                           722, NULL },
   { "questiondown",                      500, NULL },
-  { "emdash",                            889, NULL },
-  { "Agrave",                            611, NULL },
-  { "three",                             500, NULL },
-  { "numbersign",                        500, NULL },
-  { "lcaron",                            300, NULL },
-  { "A",                                 611, NULL },
-  { "B",                                 611, NULL },
-  { "C",                                 667, NULL },
-  { "aogonek",                           500, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 611, NULL },
-  { "onequarter",                        750, NULL },
-  { "F",                                 611, NULL },
-  { "G",                                 722, NULL },
-  { "H",                                 722, NULL },
+  { "backslash",                         278, NULL },
+  { "t",                                 278, NULL },
+  { "quotedbl",                          420, NULL },
+  { "Oacute",                            722, NULL },
+  { "agrave",                            500, NULL },
+  { "ellipsis",                          889, NULL },
+  { "Aring",                             611, NULL },
   { "I",                                 333, NULL },
+  { "one",                               500, NULL },
+  { "eight",                             500, NULL },
+  { "periodcentered",                    250, NULL },
+  { "c",                                 444, NULL },
+  { "d",                                 500, NULL },
+  { "egrave",                            444, NULL },
+  { "uring",                             500, NULL },
+  { "s",                                 389, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "z",                                 389, NULL },
+  { "threequarters",                     750, NULL },
   { "J",                                 444, NULL },
-  { "K",                                 667, NULL },
-  { "iogonek",                           278, NULL },
-  { "backslash",                         278, NULL },
+  { "ohungarumlaut",                     500, NULL },
+  { "Ecircumflex",                       611, NULL },
   { "L",                                 556, NULL },
-  { "periodcentered",                    250, NULL },
-  { "M",                                 833, NULL },
-  { "N",                                 667, NULL },
+  { "notequal",                          549, NULL },
+  { "Agrave",                            611, NULL },
+  { "AE",                                889, NULL },
+  { "exclam",                            333, NULL },
+  { "Acircumflex",                       611, NULL },
+  { "oslash",                            500, NULL },
+  { "caron",                             333, NULL },
+  { "Uogonek",                           722, NULL },
+  { "Lslash",                            556, NULL },
+  { "lacute",                            278, NULL },
+  { "H",                                 722, NULL },
+  { "sterling",                          500, NULL },
+  { "at",                                920, NULL },
+  { "greaterequal",                      549, NULL },
+  { "asciitilde",                        541, NULL },
+  { "Uacute",                            722, NULL },
+  { "atilde",                            500, NULL },
+  { "Zacute",                            556, NULL },
+  { "fraction",                          167, NULL },
+  { "Adieresis",                         611, NULL },
+  { "Sacute",                            500, NULL },
+  { "gcommaaccent",                      500, NULL },
+  { "Ohungarumlaut",                     722, NULL },
+  { "bracketleft",                       389, NULL },
+  { "otilde",                            500, NULL },
+  { "parenright",                        333, NULL },
+  { "f",                                 278, NULL },
+  { "Lacute",                            556, NULL },
+  { "sacute",                            389, NULL },
+  { "Idieresis",                         333, NULL },
+  { "ograve",                            500, NULL },
+  { "Rcommaaccent",                      611, NULL },
+  { "quotedblleft",                      556, NULL },
+  { "ordfeminine",                       276, NULL },
   { "omacron",                           500, NULL },
-  { "Tcommaaccent",                      556, NULL },
-  { "O",                                 722, NULL },
-  { "P",                                 611, NULL },
-  { "Q",                                 722, NULL },
-  { "Uhungarumlaut",                     722, NULL },
+  { "Delta",                             612, NULL },
+  { "comma",                             250, NULL },
+  { "Gbreve",                            722, NULL },
+  { "S",                                 500, NULL },
+  { "B",                                 611, NULL },
+  { "kcommaaccent",                      444, NULL },
+  { "yacute",                            444, NULL },
+  { "Rcaron",                            611, NULL },
   { "R",                                 611, NULL },
-  { "Aacute",                            611, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 500, NULL },
-  { "T",                                 556, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            500, NULL },
-  { "V",                                 611, NULL },
-  { "W",                                 833, NULL },
-  { "X",                                 611, NULL },
-  { "question",                          500, NULL },
-  { "equal",                             675, NULL },
-  { "Y",                                 556, NULL },
-  { "Z",                                 556, NULL },
-  { "four",                              500, NULL },
+  { "ydieresis",                         444, NULL },
+  { "ugrave",                            500, NULL },
+  { "dcaron",                            544, NULL },
+  { "Oslash",                            722, NULL },
+  { "hyphen",                            333, NULL },
   { "a",                                 500, NULL },
-  { "Gcommaaccent",                      722, NULL },
-  { "b",                                 500, NULL },
-  { "c",                                 444, NULL },
-  { "d",                                 500, NULL },
-  { "e",                                 444, NULL },
-  { "f",                                 278, NULL },
-  { "g",                                 500, NULL },
+  { "umacron",                           500, NULL },
+  { "Otilde",                            722, NULL },
+  { "Tcaron",                            556, NULL },
+  { "aacute",                            500, NULL },
+  { "scaron",                            389, NULL },
+  { "guillemotright",                    500, NULL },
+  { "eogonek",                           444, NULL },
   { "bullet",                            350, NULL },
+  { "eacute",                            444, NULL },
+  { "Zdotaccent",                        556, NULL },
+  { "Udieresis",                         722, NULL },
+  { "Abreve",                            611, NULL },
+  { "Iacute",                            333, NULL },
+  { "two",                               500, NULL },
+  { "uacute",                            500, NULL },
+  { "seven",                             500, NULL },
+  { "dieresis",                          333, NULL },
+  { "Eacute",                            611, NULL },
+  { "O",                                 722, NULL },
+  { "Icircumflex",                       333, NULL },
+  { "nacute",                            500, NULL },
+  { "trademark",                         980, NULL },
+  { "ampersand",                         778, NULL },
+  { "Lcommaaccent",                      556, NULL },
+  { "ntilde",                            500, NULL },
+  { "fi",                                500, NULL },
+  { "Atilde",                            611, NULL },
+  { "Edieresis",                         611, NULL },
+  { "Yacute",                            556, NULL },
+  { "oacute",                            500, NULL },
+  { "daggerdbl",                         500, NULL },
+  { "braceleft",                         400, NULL },
+  { "braceright",                        400, NULL },
+  { "acute",                             333, NULL },
+  { "onequarter",                        750, NULL },
+  { "multiply",                          675, NULL },
+  { "i",                                 278, NULL },
+  { "bar",                               275, NULL },
+  { "quotesingle",                       214, NULL },
+  { "six",                               500, NULL },
+  { "edotaccent",                        444, NULL },
+  { "P",                                 611, NULL },
+  { "lslash",                            278, NULL },
+  { "guilsinglleft",                     333, NULL },
   { "h",                                 500, NULL },
-  { "i",                                 278, NULL },
-  { "Oslash",                            722, NULL },
-  { "dagger",                            500, NULL },
-  { "j",                                 278, NULL },
-  { "k",                                 444, NULL },
-  { "l",                                 278, NULL },
+  { "Cacute",                            667, NULL },
+  { "plus",                              675, NULL },
+  { "igrave",                            278, NULL },
+  { "dcroat",                            500, NULL },
+  { "question",                          500, NULL },
+  { "summation",                         600, NULL },
+  { "A",                                 611, NULL },
+  { "x",                                 444, NULL },
+  { "Iogonek",                           333, NULL },
+  { "y",                                 444, NULL },
+  { "edieresis",                         444, NULL },
+  { "Ncaron",                            667, NULL },
   { "m",                                 722, NULL },
-  { "n",                                 500, NULL },
+  { "OE",                                944, NULL },
+  { "U",                                 722, NULL },
+  { "partialdiff",                       476, NULL },
+  { "ncommaaccent",                      500, NULL },
   { "tcommaaccent",                      278, NULL },
-  { "o",                                 500, NULL },
-  { "ordfeminine",                       276, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 500, NULL },
-  { "q",                                 500, NULL },
-  { "uhungarumlaut",                     500, NULL },
-  { "r",                                 389, NULL },
-  { "twosuperior",                       300, NULL },
-  { "aacute",                            500, NULL },
-  { "s",                                 389, NULL },
-  { "OE",                                944, NULL },
-  { "t",                                 278, NULL },
-  { "divide",                            675, NULL },
-  { "u",                                 500, NULL },
-  { "Ccaron",                            667, NULL },
+  { "logicalnot",                        675, NULL },
+  { "cacute",                            444, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcaron",                            300, NULL },
+  { "rcaron",                            389, NULL },
+  { "rcommaaccent",                      389, NULL },
+  { "Kcommaaccent",                      667, NULL },
+  { "imacron",                           278, NULL },
+  { "tilde",                             333, NULL },
+  { "underscore",                        500, NULL },
+  { "mu",                                500, NULL },
+  { "D",                                 722, NULL },
+  { "racute",                            389, NULL },
+  { "Tcommaaccent",                      556, NULL },
+  { "dollar",                            500, NULL },
   { "v",                                 444, NULL },
-  { "w",                                 667, NULL },
-  { "x",                                 444, NULL },
-  { "y",                                 444, NULL },
-  { "z",                                 389, NULL },
-  { "Gbreve",                            722, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        333, NULL },
   { "Nacute",                            667, NULL },
-  { "quotedbl",                          420, NULL },
-  { "gcommaaccent",                      500, NULL },
-  { "mu",                                500, NULL },
-  { "greaterequal",                      549, NULL },
-  { "Scaron",                            500, NULL },
-  { "Lslash",                            556, NULL },
-  { "semicolon",                         333, NULL },
-  { "oslash",                            500, NULL },
+  { "dotaccent",                         333, NULL },
+  { "ae",                                667, NULL },
+  { "cent",                              500, NULL },
+  { "ocircumflex",                       500, NULL },
+  { "less",                              675, NULL },
+  { "four",                              500, NULL },
+  { "minus",                             675, NULL },
+  { "circumflex",                        333, NULL },
+  { "Zcaron",                            556, NULL },
+  { "ogonek",                            333, NULL },
+  { "idieresis",                         278, NULL },
+  { "parenleft",                         333, NULL },
+  { "currency",                          500, NULL },
+  { "nine",                              500, NULL },
+  { "quotesinglbase",                    333, NULL },
+  { "grave",                             333, NULL },
+  { "Scedilla",                          500, NULL },
+  { "ccaron",                            444, NULL },
   { "lessequal",                         549, NULL },
-  { "lozenge",                           471, NULL },
-  { "parenright",                        333, NULL },
-  { "ccaron",                            444, NULL },
-  { "Ecircumflex",                       611, NULL },
-  { "gbreve",                            500, NULL },
-  { "trademark",                         980, NULL },
-  { "daggerdbl",                         500, NULL },
-  { "nacute",                            500, NULL },
-  { "macron",                            333, NULL },
-  { "Otilde",                            722, NULL },
-  { "Emacron",                           611, NULL },
-  { "ellipsis",                          889, NULL },
-  { "scaron",                            389, NULL },
-  { "AE",                                889, NULL },
+  { "Omacron",                           722, NULL },
   { "Ucircumflex",                       722, NULL },
-  { "lslash",                            278, NULL },
-  { "quotedblleft",                      556, NULL },
-  { "guilsinglright",                    333, NULL },
-  { "hyphen",                            333, NULL },
-  { "quotesingle",                       214, NULL },
-  { "eight",                             500, NULL },
-  { "exclamdown",                        389, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "j",                                 278, NULL },
+  { "Ccaron",                            667, NULL },
+  { "Y",                                 556, NULL },
+  { "yen",                               500, NULL },
+  { "w",                                 667, NULL },
+  { "space",                             250, NULL },
+  { "Thorn",                             611, NULL },
+  { "eth",                               500, NULL },
+  { "twosuperior",                       300, NULL },
+  { "ecaron",                            444, NULL },
+  { "brokenbar",                         275, NULL },
+  { "Aogonek",                           611, NULL },
+  { "fl",                                500, NULL },
+  { "quotedblbase",                      556, NULL },
+  { "E",                                 611, NULL },
   { "endash",                            500, NULL },
-  { "oe",                                667, NULL },
-  { "Abreve",                            611, NULL },
-  { "Umacron",                           722, NULL },
-  { "ecircumflex",                       444, NULL },
-  { "Adieresis",                         611, NULL },
-  { "copyright",                         760, NULL },
-  { "Egrave",                            611, NULL },
-  { "slash",                             278, NULL },
-  { "Edieresis",                         611, NULL },
-  { "otilde",                            500, NULL },
-  { "Idieresis",                         333, NULL },
-  { "parenleft",                         333, NULL },
-  { "one",                               500, NULL },
+  { "guillemotleft",                     500, NULL },
+  { "amacron",                           500, NULL },
+  { "Ncommaaccent",                      667, NULL },
+  { "numbersign",                        500, NULL },
+  { "divide",                            675, NULL },
   { "emacron",                           444, NULL },
-  { "Odieresis",                         722, NULL },
-  { "ucircumflex",                       500, NULL },
-  { "bracketleft",                       389, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        333, NULL },
-  { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         556, NULL },
-  { "umacron",                           500, NULL },
-  { "abreve",                            500, NULL },
-  { "Eacute",                            611, NULL },
-  { "adieresis",                         500, NULL },
-  { "egrave",                            444, NULL },
-  { "edieresis",                         444, NULL },
-  { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
-  { "ae",                                667, NULL },
-  { "asterisk",                          500, NULL },
+  { "M",                                 833, NULL },
   { "odieresis",                         500, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            500, NULL },
-  { "nine",                              500, NULL },
-  { "five",                              500, NULL },
-  { "udieresis",                         500, NULL },
-  { "Zcaron",                            556, NULL },
-  { "Scommaaccent",                      500, NULL },
-  { "threequarters",                     750, NULL },
-  { "guillemotright",                    500, NULL },
-  { "Ccedilla",                          667, NULL },
-  { "ydieresis",                         444, NULL },
-  { "tilde",                             333, NULL },
-  { "at",                                920, NULL },
-  { "eacute",                            444, NULL },
-  { "underscore",                        500, NULL },
-  { "Euro",                              500, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          675, NULL },
-  { "zero",                              500, NULL },
-  { "eth",                               500, NULL },
-  { "Scedilla",                          500, NULL },
   { "Ograve",                            722, NULL },
-  { "Racute",                            611, NULL },
-  { "partialdiff",                       476, NULL },
-  { "uacute",                            500, NULL },
-  { "braceleft",                         400, NULL },
-  { "Thorn",                             611, NULL },
-  { "zcaron",                            389, NULL },
-  { "scommaaccent",                      389, NULL },
-  { "ccedilla",                          444, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            500, NULL },
+  { "T",                                 556, NULL },
+  { "G",                                 722, NULL },
+  { "F",                                 611, NULL },
   { "Ocircumflex",                       722, NULL },
-  { "Oacute",                            722, NULL },
+  { "Uring",                             722, NULL },
+  { "Edotaccent",                        611, NULL },
+  { "perthousand",                      1000, NULL },
+  { "acircumflex",                       500, NULL },
+  { "zero",                              500, NULL },
+  { "period",                            250, NULL },
   { "scedilla",                          389, NULL },
-  { "ogonek",                            333, NULL },
-  { "ograve",                            500, NULL },
-  { "racute",                            389, NULL },
-  { "Tcaron",                            556, NULL },
-  { "Eogonek",                           611, NULL },
-  { "thorn",                             500, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        760, NULL },
-  { "radical",                           453, NULL },
-  { "Aring",                             611, NULL },
-  { "percent",                           833, NULL },
-  { "six",                               500, NULL },
-  { "paragraph",                         523, NULL },
-  { "dcaron",                            544, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               500, NULL },
-  { "summation",                         600, NULL },
+  { "udieresis",                         500, NULL },
+  { "Ccedilla",                          667, NULL },
   { "Igrave",                            333, NULL },
-  { "Lacute",                            556, NULL },
-  { "ocircumflex",                       500, NULL },
-  { "oacute",                            500, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      556, NULL },
-  { "tcaron",                            300, NULL },
-  { "eogonek",                           444, NULL },
-  { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     722, NULL },
-  { "asciicircum",                       422, NULL },
-  { "aring",                             500, NULL },
-  { "grave",                             333, NULL },
-  { "uogonek",                           500, NULL },
+  { "commaaccent",                       250, NULL },
   { "bracketright",                      389, NULL },
-  { "Iacute",                            333, NULL },
-  { "ampersand",                         778, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            278, NULL },
-  { "Ncaron",                            667, NULL },
-  { "plus",                              675, NULL },
-  { "uring",                             500, NULL },
-  { "quotesinglbase",                    333, NULL },
-  { "lcommaaccent",                      278, NULL },
-  { "Yacute",                            556, NULL },
-  { "ohungarumlaut",                     500, NULL },
-  { "threesuperior",                     300, NULL },
-  { "acute",                             333, NULL },
-  { "section",                           500, NULL },
-  { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      556, NULL },
-  { "ncaron",                            500, NULL },
-  { "florin",                            500, NULL },
-  { "yacute",                            444, NULL },
-  { "Rcommaaccent",                      611, NULL },
-  { "fi",                                500, NULL },
-  { "fl",                                500, NULL },
-  { "Acircumflex",                       611, NULL },
-  { "Cacute",                            667, NULL },
-  { "Icircumflex",                       333, NULL },
-  { "guillemotleft",                     500, NULL },
+  { "W",                                 833, NULL },
+  { "Ugrave",                            722, NULL },
   { "germandbls",                        500, NULL },
-  { "Amacron",                           611, NULL },
-  { "seven",                             500, NULL },
-  { "Sacute",                            500, NULL },
-  { "ordmasculine",                      310, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          500, NULL },
-  { "notequal",                          549, NULL },
+  { "thorn",                             500, NULL },
+  { "dagger",                            500, NULL },
+  { "equal",                             675, NULL },
+  { "N",                                 667, NULL },
+  { "C",                                 667, NULL },
+  { "u",                                 500, NULL },
+  { "q",                                 500, NULL },
+  { "l",                                 278, NULL },
+  { "icircumflex",                       278, NULL },
+  { "abreve",                            500, NULL },
   { "Imacron",                           333, NULL },
-  { "rcommaaccent",                      389, NULL },
-  { "Zdotaccent",                        556, NULL },
-  { "acircumflex",                       500, NULL },
-  { "cacute",                            444, NULL },
+  { "iacute",                            278, NULL },
+  { "e",                                 444, NULL },
+  { "percent",                           833, NULL },
+  { "o",                                 500, NULL },
+  { "greater",                           675, NULL },
+  { "Emacron",                           611, NULL },
+  { "scommaaccent",                      389, NULL },
+  { "asterisk",                          500, NULL },
+  { "onesuperior",                       300, NULL },
+  { "n",                                 500, NULL },
   { "Ecaron",                            611, NULL },
-  { "icircumflex",                       278, NULL },
-  { "braceright",                        400, NULL },
-  { "quotedblright",                     556, NULL },
-  { "amacron",                           500, NULL },
-  { "sacute",                            389, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              500, NULL },
-  { "currency",                          500, NULL },
-  { "logicalnot",                        675, NULL },
+  { "threesuperior",                     300, NULL },
   { "zdotaccent",                        389, NULL },
-  { "Atilde",                            611, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               275, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              675, NULL },
-  { "ecaron",                            444, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            333, NULL },
-  { "period",                            250, NULL },
-  { "Rcaron",                            611, NULL },
-  { "Kcommaaccent",                      667, NULL },
-  { "greater",                           675, NULL },
-  { "atilde",                            500, NULL },
-  { "brokenbar",                         275, NULL },
+  { "lcommaaccent",                      278, NULL },
+  { "onehalf",                           750, NULL },
+  { "gbreve",                            500, NULL },
+  { "uhungarumlaut",                     500, NULL },
+  { "Racute",                            611, NULL },
+  { "k",                                 444, NULL },
+  { "copyright",                         760, NULL },
   { "quoteleft",                         333, NULL },
-  { "Edotaccent",                        611, NULL },
-  { "onesuperior",                       300, NULL }
+  { "registered",                        760, NULL },
+  { "Gcommaaccent",                      722, NULL },
+  { "emdash",                            889, NULL },
+  { "aogonek",                           500, NULL },
+  { "Egrave",                            611, NULL },
+  { "ring",                              333, NULL },
+  { "Odieresis",                         722, NULL },
+  { "oe",                                667, NULL },
+  { "five",                              500, NULL },
+  { "X",                                 611, NULL },
+  { "asciicircum",                       422, NULL },
+  { "plusminus",                         675, NULL },
+  { "Idotaccent",                        333, NULL },
+  { "cedilla",                           333, NULL },
+  { "quotedblright",                     556, NULL },
+  { "Eth",                               722, NULL },
+  { "g",                                 500, NULL },
+  { "colon",                             333, NULL },
+  { "ccedilla",                          444, NULL },
+  { "Ntilde",                            667, NULL },
+  { "radical",                           453, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 500, NULL },
+  { "K",                                 667, NULL },
+  { "Scommaaccent",                      500, NULL },
+  { "Aacute",                            611, NULL },
+  { "b",                                 500, NULL },
+  { "Euro",                              500, NULL },
+  { "iogonek",                           278, NULL },
+  { "florin",                            500, NULL },
+  { "section",                           500, NULL },
+  { "Scaron",                            500, NULL },
+  { "degree",                            400, NULL },
+  { "lcaron",                            300, NULL },
+  { "paragraph",                         523, NULL },
+  { "zcaron",                            389, NULL },
+  { "aring",                             500, NULL },
+  { "Ydieresis",                         556, NULL },
+  { "Dcaron",                            722, NULL },
+  { "Z",                                 556, NULL },
+  { "ecircumflex",                       444, NULL },
+  { "Amacron",                           611, NULL },
+  { "breve",                             333, NULL }
 };
 
 static BuiltinFontWidth timesRomanWidthsTab[] = {
-  { "Ntilde",                            722, NULL },
-  { "rcaron",                            333, NULL },
-  { "kcommaaccent",                      500, NULL },
-  { "Ncommaaccent",                      722, NULL },
+  { "greaterequal",                      549, NULL },
+  { "at",                                921, NULL },
+  { "sterling",                          500, NULL },
+  { "H",                                 722, NULL },
+  { "caron",                             333, NULL },
+  { "Uogonek",                           722, NULL },
+  { "Lslash",                            611, NULL },
+  { "lacute",                            278, NULL },
+  { "Acircumflex",                       722, NULL },
+  { "oslash",                            500, NULL },
+  { "notequal",                          549, NULL },
+  { "Agrave",                            722, NULL },
+  { "AE",                                889, NULL },
+  { "exclam",                            333, NULL },
+  { "ohungarumlaut",                     500, NULL },
+  { "L",                                 611, NULL },
+  { "Ecircumflex",                       611, NULL },
+  { "threequarters",                     750, NULL },
+  { "J",                                 389, NULL },
+  { "Sacute",                            556, NULL },
+  { "Adieresis",                         722, NULL },
+  { "fraction",                          167, NULL },
+  { "atilde",                            444, NULL },
   { "Zacute",                            611, NULL },
-  { "comma",                             250, NULL },
-  { "cedilla",                           333, NULL },
-  { "plusminus",                         564, NULL },
-  { "circumflex",                        333, NULL },
-  { "dotaccent",                         333, NULL },
-  { "edotaccent",                        444, NULL },
+  { "Uacute",                            722, NULL },
   { "asciitilde",                        541, NULL },
-  { "colon",                             278, NULL },
-  { "onehalf",                           750, NULL },
-  { "dollar",                            500, NULL },
+  { "f",                                 333, NULL },
+  { "parenright",                        333, NULL },
+  { "otilde",                            500, NULL },
+  { "Ohungarumlaut",                     722, NULL },
+  { "bracketleft",                       333, NULL },
+  { "gcommaaccent",                      500, NULL },
+  { "Rcommaaccent",                      667, NULL },
+  { "ograve",                            500, NULL },
+  { "sacute",                            389, NULL },
+  { "Idieresis",                         333, NULL },
+  { "Lacute",                            611, NULL },
+  { "Q",                                 722, NULL },
+  { "exclamdown",                        333, NULL },
+  { "lozenge",                           471, NULL },
+  { "V",                                 722, NULL },
+  { "ncaron",                            500, NULL },
+  { "adieresis",                         444, NULL },
+  { "zacute",                            444, NULL },
+  { "Umacron",                           722, NULL },
+  { "semicolon",                         278, NULL },
+  { "guilsinglright",                    333, NULL },
+  { "quoteright",                        333, NULL },
+  { "uogonek",                           500, NULL },
+  { "Eogonek",                           611, NULL },
+  { "macron",                            333, NULL },
+  { "ordmasculine",                      310, NULL },
   { "Lcaron",                            611, NULL },
-  { "ntilde",                            500, NULL },
-  { "Aogonek",                           722, NULL },
-  { "ncommaaccent",                      500, NULL },
-  { "minus",                             564, NULL },
-  { "Iogonek",                           333, NULL },
-  { "zacute",                            444, NULL },
-  { "yen",                               500, NULL },
-  { "space",                             250, NULL },
-  { "Omacron",                           722, NULL },
+  { "backslash",                         278, NULL },
   { "questiondown",                      444, NULL },
-  { "emdash",                           1000, NULL },
-  { "Agrave",                            722, NULL },
+  { "ucircumflex",                       500, NULL },
+  { "r",                                 333, NULL },
+  { "slash",                             278, NULL },
   { "three",                             500, NULL },
-  { "numbersign",                        500, NULL },
-  { "lcaron",                            344, NULL },
-  { "A",                                 722, NULL },
-  { "B",                                 667, NULL },
-  { "C",                                 667, NULL },
-  { "aogonek",                           444, NULL },
-  { "D",                                 722, NULL },
-  { "E",                                 611, NULL },
+  { "Aring",                             722, NULL },
+  { "ellipsis",                         1000, NULL },
+  { "agrave",                            444, NULL },
+  { "Oacute",                            722, NULL },
+  { "quotedbl",                          408, NULL },
+  { "t",                                 278, NULL },
+  { "Uhungarumlaut",                     722, NULL },
+  { "z",                                 444, NULL },
+  { "uring",                             500, NULL },
+  { "s",                                 389, NULL },
+  { "egrave",                            444, NULL },
+  { "c",                                 444, NULL },
+  { "d",                                 500, NULL },
+  { "periodcentered",                    250, NULL },
+  { "I",                                 333, NULL },
+  { "eight",                             500, NULL },
+  { "one",                               500, NULL },
   { "onequarter",                        750, NULL },
-  { "F",                                 556, NULL },
-  { "G",                                 722, NULL },
-  { "H",                                 722, NULL },
-  { "I",                                 333, NULL },
-  { "J",                                 389, NULL },
-  { "K",                                 722, NULL },
-  { "iogonek",                           278, NULL },
-  { "backslash",                         278, NULL },
-  { "L",                                 611, NULL },
-  { "periodcentered",                    250, NULL },
-  { "M",                                 889, NULL },
-  { "N",                                 722, NULL },
-  { "omacron",                           500, NULL },
-  { "Tcommaaccent",                      611, NULL },
-  { "O",                                 722, NULL },
+  { "braceright",                        480, NULL },
+  { "braceleft",                         480, NULL },
+  { "acute",                             333, NULL },
+  { "daggerdbl",                         500, NULL },
+  { "oacute",                            500, NULL },
+  { "Yacute",                            722, NULL },
+  { "Edieresis",                         611, NULL },
+  { "Atilde",                            722, NULL },
   { "P",                                 556, NULL },
-  { "Q",                                 722, NULL },
-  { "Uhungarumlaut",                     722, NULL },
-  { "R",                                 667, NULL },
-  { "Aacute",                            722, NULL },
-  { "caron",                             333, NULL },
-  { "S",                                 556, NULL },
-  { "T",                                 611, NULL },
-  { "U",                                 722, NULL },
-  { "agrave",                            444, NULL },
-  { "V",                                 722, NULL },
-  { "W",                                 944, NULL },
-  { "X",                                 722, NULL },
+  { "lslash",                            278, NULL },
+  { "six",                               500, NULL },
+  { "edotaccent",                        444, NULL },
+  { "quotesingle",                       180, NULL },
+  { "bar",                               200, NULL },
+  { "i",                                 278, NULL },
+  { "multiply",                          564, NULL },
+  { "A",                                 722, NULL },
   { "question",                          444, NULL },
-  { "equal",                             564, NULL },
-  { "Y",                                 722, NULL },
-  { "Z",                                 611, NULL },
-  { "four",                              500, NULL },
-  { "a",                                 444, NULL },
-  { "Gcommaaccent",                      722, NULL },
-  { "b",                                 500, NULL },
-  { "c",                                 444, NULL },
-  { "d",                                 500, NULL },
-  { "e",                                 444, NULL },
-  { "f",                                 333, NULL },
-  { "g",                                 500, NULL },
-  { "bullet",                            350, NULL },
+  { "summation",                         600, NULL },
+  { "igrave",                            278, NULL },
+  { "dcroat",                            500, NULL },
+  { "plus",                              564, NULL },
+  { "guilsinglleft",                     333, NULL },
   { "h",                                 500, NULL },
-  { "i",                                 278, NULL },
-  { "Oslash",                            722, NULL },
-  { "dagger",                            500, NULL },
-  { "j",                                 278, NULL },
-  { "k",                                 500, NULL },
-  { "l",                                 278, NULL },
+  { "Cacute",                            667, NULL },
+  { "rcaron",                            333, NULL },
+  { "tcaron",                            326, NULL },
+  { "cacute",                            444, NULL },
+  { "Dcroat",                            722, NULL },
+  { "tcommaaccent",                      278, NULL },
+  { "logicalnot",                        564, NULL },
+  { "ncommaaccent",                      500, NULL },
+  { "partialdiff",                       476, NULL },
+  { "U",                                 722, NULL },
   { "m",                                 778, NULL },
-  { "n",                                 500, NULL },
-  { "tcommaaccent",                      278, NULL },
-  { "o",                                 500, NULL },
-  { "ordfeminine",                       276, NULL },
-  { "ring",                              333, NULL },
-  { "p",                                 500, NULL },
-  { "q",                                 500, NULL },
-  { "uhungarumlaut",                     500, NULL },
-  { "r",                                 333, NULL },
-  { "twosuperior",                       300, NULL },
-  { "aacute",                            444, NULL },
-  { "s",                                 389, NULL },
   { "OE",                                889, NULL },
-  { "t",                                 278, NULL },
-  { "divide",                            564, NULL },
-  { "u",                                 500, NULL },
-  { "Ccaron",                            667, NULL },
-  { "v",                                 500, NULL },
-  { "w",                                 722, NULL },
+  { "Ncaron",                            722, NULL },
   { "x",                                 500, NULL },
+  { "edieresis",                         444, NULL },
+  { "Iogonek",                           333, NULL },
   { "y",                                 500, NULL },
-  { "z",                                 444, NULL },
+  { "S",                                 556, NULL },
   { "Gbreve",                            722, NULL },
-  { "commaaccent",                       250, NULL },
-  { "hungarumlaut",                      333, NULL },
-  { "Idotaccent",                        333, NULL },
-  { "Nacute",                            722, NULL },
-  { "quotedbl",                          408, NULL },
-  { "gcommaaccent",                      500, NULL },
-  { "mu",                                500, NULL },
-  { "greaterequal",                      549, NULL },
-  { "Scaron",                            556, NULL },
-  { "Lslash",                            611, NULL },
-  { "semicolon",                         278, NULL },
-  { "oslash",                            500, NULL },
-  { "lessequal",                         549, NULL },
-  { "lozenge",                           471, NULL },
-  { "parenright",                        333, NULL },
-  { "ccaron",                            444, NULL },
-  { "Ecircumflex",                       611, NULL },
-  { "gbreve",                            500, NULL },
-  { "trademark",                         980, NULL },
-  { "daggerdbl",                         500, NULL },
-  { "nacute",                            500, NULL },
-  { "macron",                            333, NULL },
+  { "omacron",                           500, NULL },
+  { "comma",                             250, NULL },
+  { "Delta",                             612, NULL },
+  { "ordfeminine",                       276, NULL },
+  { "quotedblleft",                      444, NULL },
+  { "aacute",                            444, NULL },
+  { "Tcaron",                            611, NULL },
   { "Otilde",                            722, NULL },
-  { "Emacron",                           611, NULL },
-  { "ellipsis",                         1000, NULL },
-  { "scaron",                            389, NULL },
-  { "AE",                                889, NULL },
-  { "Ucircumflex",                       722, NULL },
-  { "lslash",                            278, NULL },
-  { "quotedblleft",                      444, NULL },
-  { "guilsinglright",                    333, NULL },
+  { "umacron",                           500, NULL },
+  { "Oslash",                            722, NULL },
   { "hyphen",                            333, NULL },
-  { "quotesingle",                       180, NULL },
-  { "eight",                             500, NULL },
-  { "exclamdown",                        333, NULL },
-  { "endash",                            500, NULL },
-  { "oe",                                722, NULL },
+  { "a",                                 444, NULL },
+  { "ugrave",                            500, NULL },
+  { "dcaron",                            588, NULL },
+  { "yacute",                            500, NULL },
+  { "kcommaaccent",                      500, NULL },
+  { "Rcaron",                            667, NULL },
+  { "R",                                 667, NULL },
+  { "ydieresis",                         500, NULL },
+  { "B",                                 667, NULL },
+  { "seven",                             500, NULL },
+  { "two",                               500, NULL },
+  { "uacute",                            500, NULL },
+  { "Iacute",                            333, NULL },
   { "Abreve",                            722, NULL },
-  { "Umacron",                           722, NULL },
-  { "ecircumflex",                       444, NULL },
-  { "Adieresis",                         722, NULL },
-  { "copyright",                         760, NULL },
-  { "Egrave",                            611, NULL },
-  { "slash",                             278, NULL },
-  { "Edieresis",                         611, NULL },
-  { "otilde",                            500, NULL },
-  { "Idieresis",                         333, NULL },
-  { "parenleft",                         333, NULL },
-  { "one",                               500, NULL },
-  { "emacron",                           444, NULL },
-  { "Odieresis",                         722, NULL },
-  { "ucircumflex",                       500, NULL },
-  { "bracketleft",                       333, NULL },
-  { "Ugrave",                            722, NULL },
-  { "quoteright",                        333, NULL },
   { "Udieresis",                         722, NULL },
-  { "perthousand",                      1000, NULL },
-  { "Ydieresis",                         722, NULL },
-  { "umacron",                           500, NULL },
-  { "abreve",                            444, NULL },
+  { "Zdotaccent",                        611, NULL },
+  { "eacute",                            444, NULL },
+  { "eogonek",                           444, NULL },
+  { "bullet",                            350, NULL },
+  { "guillemotright",                    500, NULL },
+  { "scaron",                            389, NULL },
+  { "fi",                                556, NULL },
+  { "ntilde",                            500, NULL },
+  { "Lcommaaccent",                      611, NULL },
+  { "trademark",                         980, NULL },
+  { "ampersand",                         778, NULL },
+  { "O",                                 722, NULL },
+  { "Icircumflex",                       333, NULL },
+  { "nacute",                            500, NULL },
   { "Eacute",                            611, NULL },
-  { "adieresis",                         444, NULL },
-  { "egrave",                            444, NULL },
-  { "edieresis",                         444, NULL },
-  { "idieresis",                         278, NULL },
-  { "Eth",                               722, NULL },
-  { "ae",                                667, NULL },
-  { "asterisk",                          500, NULL },
-  { "odieresis",                         500, NULL },
-  { "Uacute",                            722, NULL },
-  { "ugrave",                            500, NULL },
-  { "nine",                              500, NULL },
-  { "five",                              500, NULL },
-  { "udieresis",                         500, NULL },
-  { "Zcaron",                            611, NULL },
-  { "Scommaaccent",                      556, NULL },
-  { "threequarters",                     750, NULL },
-  { "guillemotright",                    500, NULL },
-  { "Ccedilla",                          667, NULL },
-  { "ydieresis",                         500, NULL },
-  { "tilde",                             333, NULL },
-  { "at",                                921, NULL },
-  { "eacute",                            444, NULL },
-  { "underscore",                        500, NULL },
-  { "Euro",                              500, NULL },
-  { "Dcroat",                            722, NULL },
-  { "multiply",                          564, NULL },
-  { "zero",                              500, NULL },
+  { "dieresis",                          333, NULL },
+  { "endash",                            500, NULL },
+  { "guillemotleft",                     500, NULL },
+  { "E",                                 611, NULL },
+  { "quotedblbase",                      444, NULL },
+  { "fl",                                556, NULL },
+  { "brokenbar",                         200, NULL },
+  { "Aogonek",                           722, NULL },
+  { "ecaron",                            444, NULL },
+  { "Thorn",                             556, NULL },
+  { "space",                             250, NULL },
+  { "twosuperior",                       300, NULL },
   { "eth",                               500, NULL },
-  { "Scedilla",                          556, NULL },
+  { "w",                                 722, NULL },
+  { "T",                                 611, NULL },
   { "Ograve",                            722, NULL },
-  { "Racute",                            667, NULL },
-  { "partialdiff",                       476, NULL },
-  { "uacute",                            500, NULL },
-  { "braceleft",                         480, NULL },
-  { "Thorn",                             556, NULL },
-  { "zcaron",                            444, NULL },
-  { "scommaaccent",                      389, NULL },
-  { "ccedilla",                          444, NULL },
-  { "Dcaron",                            722, NULL },
-  { "dcroat",                            500, NULL },
+  { "M",                                 889, NULL },
+  { "odieresis",                         500, NULL },
+  { "divide",                            564, NULL },
+  { "emacron",                           444, NULL },
+  { "numbersign",                        500, NULL },
+  { "Ncommaaccent",                      722, NULL },
+  { "amacron",                           444, NULL },
+  { "acircumflex",                       444, NULL },
+  { "Edotaccent",                        611, NULL },
+  { "perthousand",                      1000, NULL },
+  { "Uring",                             722, NULL },
   { "Ocircumflex",                       722, NULL },
-  { "Oacute",                            722, NULL },
+  { "F",                                 556, NULL },
+  { "G",                                 722, NULL },
+  { "thorn",                             500, NULL },
+  { "Ugrave",                            722, NULL },
+  { "germandbls",                        500, NULL },
+  { "bracketright",                      333, NULL },
+  { "W",                                 944, NULL },
+  { "commaaccent",                       250, NULL },
+  { "Igrave",                            333, NULL },
+  { "Ccedilla",                          667, NULL },
+  { "period",                            250, NULL },
   { "scedilla",                          389, NULL },
+  { "udieresis",                         500, NULL },
+  { "zero",                              500, NULL },
+  { "v",                                 500, NULL },
+  { "Nacute",                            722, NULL },
+  { "dotaccent",                         333, NULL },
+  { "Tcommaaccent",                      611, NULL },
+  { "dollar",                            500, NULL },
+  { "mu",                                500, NULL },
+  { "D",                                 722, NULL },
+  { "racute",                            333, NULL },
+  { "underscore",                        500, NULL },
+  { "tilde",                             333, NULL },
+  { "rcommaaccent",                      333, NULL },
+  { "Kcommaaccent",                      722, NULL },
+  { "imacron",                           278, NULL },
+  { "idieresis",                         278, NULL },
   { "ogonek",                            333, NULL },
-  { "ograve",                            500, NULL },
-  { "racute",                            333, NULL },
-  { "Tcaron",                            611, NULL },
-  { "Eogonek",                           611, NULL },
-  { "thorn",                             500, NULL },
-  { "degree",                            400, NULL },
-  { "registered",                        760, NULL },
-  { "radical",                           453, NULL },
-  { "Aring",                             722, NULL },
-  { "percent",                           833, NULL },
-  { "six",                               500, NULL },
-  { "paragraph",                         453, NULL },
-  { "dcaron",                            588, NULL },
-  { "Uogonek",                           722, NULL },
-  { "two",                               500, NULL },
-  { "summation",                         600, NULL },
-  { "Igrave",                            333, NULL },
-  { "Lacute",                            611, NULL },
+  { "Zcaron",                            611, NULL },
+  { "circumflex",                        333, NULL },
+  { "four",                              500, NULL },
+  { "minus",                             564, NULL },
   { "ocircumflex",                       500, NULL },
-  { "oacute",                            500, NULL },
-  { "Uring",                             722, NULL },
-  { "Lcommaaccent",                      611, NULL },
-  { "tcaron",                            326, NULL },
-  { "eogonek",                           444, NULL },
-  { "Delta",                             612, NULL },
-  { "Ohungarumlaut",                     722, NULL },
-  { "asciicircum",                       469, NULL },
-  { "aring",                             444, NULL },
+  { "less",                              564, NULL },
+  { "cent",                              500, NULL },
+  { "ae",                                667, NULL },
   { "grave",                             333, NULL },
-  { "uogonek",                           500, NULL },
-  { "bracketright",                      333, NULL },
-  { "Iacute",                            333, NULL },
-  { "ampersand",                         778, NULL },
-  { "igrave",                            278, NULL },
-  { "lacute",                            278, NULL },
-  { "Ncaron",                            722, NULL },
-  { "plus",                              564, NULL },
-  { "uring",                             500, NULL },
+  { "Scedilla",                          556, NULL },
   { "quotesinglbase",                    333, NULL },
-  { "lcommaaccent",                      278, NULL },
-  { "Yacute",                            722, NULL },
-  { "ohungarumlaut",                     500, NULL },
-  { "threesuperior",                     300, NULL },
-  { "acute",                             333, NULL },
+  { "currency",                          500, NULL },
+  { "nine",                              500, NULL },
+  { "parenleft",                         333, NULL },
+  { "yen",                               500, NULL },
+  { "Y",                                 722, NULL },
+  { "hungarumlaut",                      333, NULL },
+  { "Ccaron",                            667, NULL },
+  { "j",                                 278, NULL },
+  { "lessequal",                         549, NULL },
+  { "Ucircumflex",                       722, NULL },
+  { "Omacron",                           722, NULL },
+  { "ccaron",                            444, NULL },
+  { "X",                                 722, NULL },
+  { "asciicircum",                       469, NULL },
+  { "five",                              500, NULL },
+  { "Odieresis",                         722, NULL },
+  { "oe",                                722, NULL },
+  { "ring",                              333, NULL },
+  { "Egrave",                            611, NULL },
+  { "aogonek",                           444, NULL },
+  { "emdash",                           1000, NULL },
+  { "dotlessi",                          278, NULL },
+  { "p",                                 500, NULL },
+  { "radical",                           453, NULL },
+  { "Ntilde",                            722, NULL },
+  { "g",                                 500, NULL },
+  { "colon",                             278, NULL },
+  { "ccedilla",                          444, NULL },
+  { "quotedblright",                     444, NULL },
+  { "Eth",                               722, NULL },
+  { "plusminus",                         564, NULL },
+  { "Idotaccent",                        333, NULL },
+  { "cedilla",                           333, NULL },
   { "section",                           500, NULL },
-  { "dieresis",                          333, NULL },
-  { "iacute",                            278, NULL },
-  { "quotedblbase",                      444, NULL },
-  { "ncaron",                            500, NULL },
+  { "Scaron",                            556, NULL },
+  { "degree",                            400, NULL },
+  { "Euro",                              500, NULL },
   { "florin",                            500, NULL },
-  { "yacute",                            500, NULL },
-  { "Rcommaaccent",                      667, NULL },
-  { "fi",                                556, NULL },
-  { "fl",                                556, NULL },
-  { "Acircumflex",                       722, NULL },
-  { "Cacute",                            667, NULL },
-  { "Icircumflex",                       333, NULL },
-  { "guillemotleft",                     500, NULL },
-  { "germandbls",                        500, NULL },
+  { "iogonek",                           278, NULL },
+  { "b",                                 500, NULL },
+  { "Scommaaccent",                      556, NULL },
+  { "Aacute",                            722, NULL },
+  { "K",                                 722, NULL },
   { "Amacron",                           722, NULL },
-  { "seven",                             500, NULL },
-  { "Sacute",                            556, NULL },
-  { "ordmasculine",                      310, NULL },
-  { "dotlessi",                          278, NULL },
-  { "sterling",                          500, NULL },
-  { "notequal",                          549, NULL },
+  { "breve",                             333, NULL },
+  { "Z",                                 611, NULL },
+  { "ecircumflex",                       444, NULL },
+  { "Dcaron",                            722, NULL },
+  { "aring",                             444, NULL },
+  { "Ydieresis",                         722, NULL },
+  { "lcaron",                            344, NULL },
+  { "paragraph",                         453, NULL },
+  { "zcaron",                            444, NULL },
   { "Imacron",                           333, NULL },
-  { "rcommaaccent",                      333, NULL },
-  { "Zdotaccent",                        611, NULL },
-  { "acircumflex",                       444, NULL },
-  { "cacute",                            444, NULL },
-  { "Ecaron",                            611, NULL },
+  { "abreve",                            444, NULL },
+  { "e",                                 444, NULL },
+  { "iacute",                            278, NULL },
   { "icircumflex",                       278, NULL },
-  { "braceright",                        480, NULL },
-  { "quotedblright",                     444, NULL },
-  { "amacron",                           444, NULL },
-  { "sacute",                            389, NULL },
-  { "imacron",                           278, NULL },
-  { "cent",                              500, NULL },
-  { "currency",                          500, NULL },
-  { "logicalnot",                        564, NULL },
+  { "q",                                 500, NULL },
+  { "l",                                 278, NULL },
+  { "C",                                 667, NULL },
+  { "u",                                 500, NULL },
+  { "dagger",                            500, NULL },
+  { "equal",                             564, NULL },
+  { "N",                                 722, NULL },
+  { "onesuperior",                       300, NULL },
+  { "asterisk",                          500, NULL },
+  { "Emacron",                           611, NULL },
+  { "scommaaccent",                      389, NULL },
+  { "greater",                           564, NULL },
+  { "o",                                 500, NULL },
+  { "percent",                           833, NULL },
+  { "gbreve",                            500, NULL },
+  { "uhungarumlaut",                     500, NULL },
+  { "lcommaaccent",                      278, NULL },
+  { "onehalf",                           750, NULL },
+  { "threesuperior",                     300, NULL },
   { "zdotaccent",                        444, NULL },
-  { "Atilde",                            722, NULL },
-  { "breve",                             333, NULL },
-  { "bar",                               200, NULL },
-  { "fraction",                          167, NULL },
-  { "less",                              564, NULL },
-  { "ecaron",                            444, NULL },
-  { "guilsinglleft",                     333, NULL },
-  { "exclam",                            333, NULL },
-  { "period",                            250, NULL },
-  { "Rcaron",                            667, NULL },
-  { "Kcommaaccent",                      722, NULL },
-  { "greater",                           564, NULL },
-  { "atilde",                            444, NULL },
-  { "brokenbar",                         200, NULL },
+  { "Ecaron",                            611, NULL },
+  { "n",                                 500, NULL },
+  { "Gcommaaccent",                      722, NULL },
+  { "registered",                        760, NULL },
   { "quoteleft",                         333, NULL },
-  { "Edotaccent",                        611, NULL },
-  { "onesuperior",                       300, NULL }
+  { "copyright",                         760, NULL },
+  { "k",                                 500, NULL },
+  { "Racute",                            667, NULL }
 };
 
 static BuiltinFontWidth zapfDingbatsWidthsTab[] = {
-  { "a81",                               438, NULL },
-  { "a82",                               138, NULL },
-  { "a83",                               277, NULL },
-  { "a84",                               415, NULL },
-  { "a85",                               509, NULL },
-  { "a86",                               410, NULL },
+  { "a198",                              888, NULL },
+  { "a107",                              760, NULL },
+  { "a167",                              927, NULL },
+  { "a97",                               392, NULL },
+  { "a137",                              788, NULL },
+  { "a175",                              930, NULL },
+  { "a55",                               708, NULL },
+  { "a206",                              410, NULL },
+  { "a146",                              788, NULL },
+  { "a27",                               759, NULL },
+  { "a71",                               791, NULL },
+  { "a79",                               784, NULL },
+  { "a136",                              788, NULL },
+  { "a43",                               923, NULL },
+  { "a131",                              788, NULL },
+  { "a154",                              788, NULL },
+  { "a123",                              788, NULL },
+  { "a8",                                537, NULL },
   { "a87",                               234, NULL },
-  { "a88",                               234, NULL },
-  { "a89",                               390, NULL },
+  { "a72",                               873, NULL },
+  { "a199",                              867, NULL },
+  { "a151",                              788, NULL },
+  { "a99",                               668, NULL },
+  { "a126",                              788, NULL },
+  { "a46",                               749, NULL },
+  { "a34",                               794, NULL },
+  { "a186",                              967, NULL },
+  { "a102",                              544, NULL },
+  { "a205",                              509, NULL },
+  { "a62",                               707, NULL },
   { "a140",                              788, NULL },
-  { "a141",                              788, NULL },
-  { "a142",                              788, NULL },
-  { "a143",                              788, NULL },
-  { "a144",                              788, NULL },
-  { "a145",                              788, NULL },
-  { "a146",                              788, NULL },
-  { "a147",                              788, NULL },
-  { "a148",                              788, NULL },
-  { "a149",                              788, NULL },
   { "a90",                               390, NULL },
-  { "a91",                               276, NULL },
-  { "a92",                               276, NULL },
-  { "space",                             278, NULL },
-  { "a93",                               317, NULL },
-  { "a94",                               317, NULL },
-  { "a95",                               334, NULL },
-  { "a96",                               334, NULL },
-  { "a97",                               392, NULL },
   { "a98",                               392, NULL },
-  { "a99",                               668, NULL },
+  { "a9",                                577, NULL },
+  { "a178",                              883, NULL },
+  { "a26",                               760, NULL },
+  { "a40",                               833, NULL },
+  { "a125",                              788, NULL },
+  { "a101",                              732, NULL },
+  { "a103",                              544, NULL },
   { "a150",                              788, NULL },
-  { "a151",                              788, NULL },
+  { "a57",                               701, NULL },
+  { "a18",                               974, NULL },
+  { "a184",                              946, NULL },
+  { "space",                             278, NULL },
+  { "a74",                               762, NULL },
+  { "a168",                              928, NULL },
+  { "a147",                              788, NULL },
+  { "a187",                              831, NULL },
+  { "a110",                              694, NULL },
+  { "a143",                              788, NULL },
+  { "a36",                               823, NULL },
+  { "a41",                               816, NULL },
+  { "a86",                               410, NULL },
+  { "a164",                              458, NULL },
   { "a152",                              788, NULL },
-  { "a153",                              788, NULL },
-  { "a154",                              788, NULL },
-  { "a155",                              788, NULL },
+  { "a163",                             1016, NULL },
+  { "a3",                                980, NULL },
+  { "a160",                              894, NULL },
+  { "a166",                              918, NULL },
+  { "a117",                              690, NULL },
+  { "a83",                               277, NULL },
+  { "a29",                               786, NULL },
+  { "a22",                               761, NULL },
+  { "a112",                              776, NULL },
+  { "a133",                              788, NULL },
   { "a156",                              788, NULL },
+  { "a200",                              696, NULL },
+  { "a81",                               438, NULL },
+  { "a106",                              667, NULL },
+  { "a100",                              668, NULL },
+  { "a132",                              788, NULL },
+  { "a95",                               334, NULL },
+  { "a37",                               789, NULL },
+  { "a58",                               826, NULL },
+  { "a191",                              918, NULL },
+  { "a56",                               682, NULL },
+  { "a70",                               785, NULL },
   { "a157",                              788, NULL },
-  { "a158",                              788, NULL },
-  { "a159",                              788, NULL },
-  { "a160",                              894, NULL },
-  { "a161",                              838, NULL },
-  { "a162",                              924, NULL },
-  { "a163",                             1016, NULL },
-  { "a164",                              458, NULL },
-  { "a165",                              924, NULL },
-  { "a166",                              918, NULL },
-  { "a167",                              927, NULL },
-  { "a168",                              928, NULL },
-  { "a169",                              928, NULL },
-  { "a170",                              834, NULL },
   { "a171",                              873, NULL },
-  { "a172",                              828, NULL },
-  { "a173",                              924, NULL },
-  { "a174",                              917, NULL },
-  { "a175",                              930, NULL },
-  { "a176",                              931, NULL },
-  { "a177",                              463, NULL },
-  { "a178",                              883, NULL },
-  { "a179",                              836, NULL },
-  { "a180",                              867, NULL },
-  { "a181",                              696, NULL },
-  { "a182",                              874, NULL },
-  { "a183",                              760, NULL },
-  { "a184",                              946, NULL },
-  { "a185",                              865, NULL },
-  { "a186",                              967, NULL },
-  { "a187",                              831, NULL },
   { "a188",                              873, NULL },
-  { "a189",                              927, NULL },
-  { "a1",                                974, NULL },
+  { "a47",                               790, NULL },
+  { "a14",                               855, NULL },
+  { "a23",                               571, NULL },
   { "a2",                                961, NULL },
-  { "a3",                                980, NULL },
-  { "a4",                                719, NULL },
-  { "a5",                                789, NULL },
-  { "a6",                                494, NULL },
-  { "a7",                                552, NULL },
-  { "a8",                                537, NULL },
-  { "a9",                                577, NULL },
+  { "a77",                               892, NULL },
+  { "a105",                              911, NULL },
+  { "a25",                               763, NULL },
+  { "a202",                              974, NULL },
+  { "a61",                               789, NULL },
+  { "a10",                               692, NULL },
+  { "a44",                               744, NULL },
+  { "a159",                              788, NULL },
+  { "a48",                               792, NULL },
+  { "a124",                              788, NULL },
   { "a190",                              970, NULL },
-  { "a191",                              918, NULL },
-  { "a192",                              748, NULL },
-  { "a193",                              836, NULL },
-  { "a194",                              771, NULL },
-  { "a195",                              888, NULL },
-  { "a196",                              748, NULL },
-  { "a197",                              771, NULL },
-  { "a198",                              888, NULL },
-  { "a199",                              867, NULL },
-  { "a10",                               692, NULL },
+  { "a20",                               846, NULL },
+  { "a185",                              865, NULL },
+  { "a16",                               933, NULL },
   { "a11",                               960, NULL },
-  { "a12",                               939, NULL },
+  { "a134",                              788, NULL },
+  { "a108",                              760, NULL },
+  { "a28",                               754, NULL },
+  { "a149",                              788, NULL },
+  { "a172",                              828, NULL },
+  { "a1",                                974, NULL },
+  { "a144",                              788, NULL },
+  { "a92",                               276, NULL },
+  { "a66",                               786, NULL },
+  { "a189",                              927, NULL },
+  { "a54",                               707, NULL },
+  { "a59",                               815, NULL },
   { "a13",                               549, NULL },
-  { "a14",                               855, NULL },
-  { "a15",                               911, NULL },
-  { "a16",                               933, NULL },
+  { "a4",                                719, NULL },
+  { "a82",                               138, NULL },
+  { "a109",                              626, NULL },
+  { "a170",                              834, NULL },
+  { "a201",                              874, NULL },
+  { "a204",                              759, NULL },
+  { "a39",                               823, NULL },
+  { "a197",                              771, NULL },
+  { "a49",                               695, NULL },
+  { "a139",                              788, NULL },
+  { "a96",                               334, NULL },
+  { "a7",                                552, NULL },
+  { "a183",                              760, NULL },
+  { "a118",                              791, NULL },
+  { "a155",                              788, NULL },
+  { "a148",                              788, NULL },
+  { "a73",                               761, NULL },
+  { "a75",                               759, NULL },
+  { "a76",                               892, NULL },
+  { "a135",                              788, NULL },
+  { "a177",                              463, NULL },
+  { "a104",                              910, NULL },
+  { "a88",                               234, NULL },
+  { "a142",                              788, NULL },
+  { "a179",                              836, NULL },
   { "a17",                               945, NULL },
-  { "a18",                               974, NULL },
-  { "a19",                               755, NULL },
-  { "a20",                               846, NULL },
-  { "a21",                               762, NULL },
-  { "a22",                               761, NULL },
-  { "a23",                               571, NULL },
-  { "a24",                               677, NULL },
-  { "a25",                               763, NULL },
-  { "a26",                               760, NULL },
-  { "a27",                               759, NULL },
-  { "a28",                               754, NULL },
-  { "a29",                               786, NULL },
-  { "a30",                               788, NULL },
+  { "a203",                              762, NULL },
+  { "a141",                              788, NULL },
   { "a31",                               788, NULL },
-  { "a32",                               790, NULL },
-  { "a33",                               793, NULL },
-  { "a34",                               794, NULL },
+  { "a129",                              788, NULL },
   { "a35",                               816, NULL },
-  { "a36",                               823, NULL },
-  { "a37",                               789, NULL },
+  { "a182",                              874, NULL },
+  { "a15",                               911, NULL },
   { "a38",                               841, NULL },
-  { "a39",                               823, NULL },
-  { "a40",                               833, NULL },
-  { "a41",                               816, NULL },
-  { "a42",                               831, NULL },
-  { "a43",                               923, NULL },
-  { "a44",                               744, NULL },
+  { "a169",                              928, NULL },
+  { "a67",                               787, NULL },
   { "a45",                               723, NULL },
-  { "a46",                               749, NULL },
-  { "a47",                               790, NULL },
-  { "a48",                               792, NULL },
-  { "a49",                               695, NULL },
-  { "a100",                              668, NULL },
-  { "a101",                              732, NULL },
-  { "a102",                              544, NULL },
-  { "a103",                              544, NULL },
-  { "a104",                              910, NULL },
-  { "a105",                              911, NULL },
-  { "a106",                              667, NULL },
-  { "a107",                              760, NULL },
-  { "a108",                              760, NULL },
-  { "a109",                              626, NULL },
-  { "a50",                               776, NULL },
-  { "a51",                               768, NULL },
+  { "a93",                               317, NULL },
+  { "a195",                              888, NULL },
+  { "a68",                               713, NULL },
+  { "a6",                                494, NULL },
+  { "a24",                               677, NULL },
+  { "a21",                               762, NULL },
+  { "a192",                              748, NULL },
+  { "a138",                              788, NULL },
+  { "a65",                               689, NULL },
+  { "a84",                               415, NULL },
   { "a52",                               792, NULL },
+  { "a32",                               790, NULL },
+  { "a33",                               793, NULL },
+  { "a60",                               789, NULL },
+  { "a130",                              788, NULL },
+  { "a180",                              867, NULL },
+  { "a78",                               788, NULL },
+  { "a42",                               831, NULL },
+  { "a196",                              748, NULL },
+  { "a111",                              595, NULL },
   { "a53",                               759, NULL },
-  { "a54",                               707, NULL },
-  { "a55",                               708, NULL },
-  { "a56",                               682, NULL },
-  { "a57",                               701, NULL },
-  { "a58",                               826, NULL },
-  { "a59",                               815, NULL },
-  { "a110",                              694, NULL },
-  { "a111",                              595, NULL },
-  { "a112",                              776, NULL },
-  { "a117",                              690, NULL },
-  { "a118",                              791, NULL },
-  { "a119",                              790, NULL },
-  { "a60",                               789, NULL },
-  { "a61",                               789, NULL },
-  { "a62",                               707, NULL },
-  { "a63",                               687, NULL },
-  { "a64",                               696, NULL },
-  { "a65",                               689, NULL },
-  { "a66",                               786, NULL },
-  { "a67",                               787, NULL },
-  { "a68",                               713, NULL },
-  { "a69",                               791, NULL },
-  { "a200",                              696, NULL },
-  { "a201",                              874, NULL },
+  { "a161",                              838, NULL },
+  { "a94",                               317, NULL },
+  { "a85",                               509, NULL },
+  { "a51",                               768, NULL },
+  { "a181",                              696, NULL },
+  { "a176",                              931, NULL },
+  { "a50",                               776, NULL },
+  { "a173",                              924, NULL },
+  { "a153",                              788, NULL },
   { "a120",                              788, NULL },
+  { "a122",                              788, NULL },
+  { "a193",                              836, NULL },
+  { "a165",                              924, NULL },
+  { "a19",                               755, NULL },
+  { "a30",                               788, NULL },
+  { "a89",                               390, NULL },
+  { "a158",                              788, NULL },
+  { "a145",                              788, NULL },
   { "a121",                              788, NULL },
-  { "a202",                              974, NULL },
-  { "a122",                              788, NULL },
-  { "a203",                              762, NULL },
-  { "a123",                              788, NULL },
-  { "a204",                              759, NULL },
-  { "a124",                              788, NULL },
-  { "a205",                              509, NULL },
-  { "a125",                              788, NULL },
-  { "a206",                              410, NULL },
-  { "a126",                              788, NULL },
+  { "a194",                              771, NULL },
+  { "a64",                               696, NULL },
   { "a127",                              788, NULL },
+  { "a174",                              917, NULL },
+  { "a69",                               791, NULL },
   { "a128",                              788, NULL },
-  { "a129",                              788, NULL },
-  { "a70",                               785, NULL },
-  { "a71",                               791, NULL },
-  { "a72",                               873, NULL },
-  { "a73",                               761, NULL },
-  { "a74",                               762, NULL },
-  { "a75",                               759, NULL },
-  { "a76",                               892, NULL },
-  { "a77",                               892, NULL },
-  { "a78",                               788, NULL },
-  { "a79",                               784, NULL },
-  { "a130",                              788, NULL },
-  { "a131",                              788, NULL },
-  { "a132",                              788, NULL },
-  { "a133",                              788, NULL },
-  { "a134",                              788, NULL },
-  { "a135",                              788, NULL },
-  { "a136",                              788, NULL },
-  { "a137",                              788, NULL },
-  { "a138",                              788, NULL },
-  { "a139",                              788, NULL }
+  { "a91",                               276, NULL },
+  { "a63",                               687, NULL },
+  { "a5",                                789, NULL },
+  { "a119",                              790, NULL },
+  { "a12",                               939, NULL },
+  { "a162",                              924, NULL }
 };
 
 BuiltinFont builtinFonts[] = {
-  { "Courier",               standardEncoding,            629, -157, { -23, -250,  715,  805}, NULL },
-  { "Courier-Bold",          standardEncoding,            629, -157, {-113, -250,  749,  801}, NULL },
-  { "Courier-BoldOblique",   standardEncoding,            629, -157, { -57, -250,  869,  801}, NULL },
-  { "Courier-Oblique",       standardEncoding,            629, -157, { -27, -250,  849,  805}, NULL },
-  { "Helvetica",             standardEncoding,            718, -207, {-166, -225, 1000,  931}, NULL },
-  { "Helvetica-Bold",        standardEncoding,            718, -207, {-170, -228, 1003,  962}, NULL },
-  { "Helvetica-BoldOblique", standardEncoding,            718, -207, {-174, -228, 1114,  962}, NULL },
-  { "Helvetica-Oblique",     standardEncoding,            718, -207, {-170, -225, 1116,  931}, NULL },
-  { "Symbol",                symbolEncoding,             1010, -293, {-180, -293, 1090, 1010}, NULL },
-  { "Times-Bold",            standardEncoding,            683, -217, {-168, -218, 1000,  935}, NULL },
-  { "Times-BoldItalic",      standardEncoding,            683, -217, {-200, -218,  996,  921}, NULL },
-  { "Times-Italic",          standardEncoding,            683, -217, {-169, -217, 1010,  883}, NULL },
-  { "Times-Roman",           standardEncoding,            683, -217, {-168, -218, 1000,  898}, NULL },
-  { "ZapfDingbats",          zapfDingbatsEncoding,        820, -143, {  -1, -143,  981,  820}, NULL }
+  { "Courier",               standardEncoding,            600,  629, -157, { -23, -250,  715,  805}, NULL },
+  { "Courier-Bold",          standardEncoding,            600,  629, -157, {-113, -250,  749,  801}, NULL },
+  { "Courier-BoldOblique",   standardEncoding,            600,  629, -157, { -57, -250,  869,  801}, NULL },
+  { "Courier-Oblique",       standardEncoding,            600,  629, -157, { -27, -250,  849,  805}, NULL },
+  { "Helvetica",             standardEncoding,              0,  718, -207, {-166, -225, 1000,  931}, NULL },
+  { "Helvetica-Bold",        standardEncoding,              0,  718, -207, {-170, -228, 1003,  962}, NULL },
+  { "Helvetica-BoldOblique", standardEncoding,              0,  718, -207, {-174, -228, 1114,  962}, NULL },
+  { "Helvetica-Oblique",     standardEncoding,              0,  718, -207, {-170, -225, 1116,  931}, NULL },
+  { "Symbol",                symbolEncoding,                0, 1010, -293, {-180, -293, 1090, 1010}, NULL },
+  { "Times-Bold",            standardEncoding,              0,  683, -217, {-168, -218, 1000,  935}, NULL },
+  { "Times-BoldItalic",      standardEncoding,              0,  683, -217, {-200, -218,  996,  921}, NULL },
+  { "Times-Italic",          standardEncoding,              0,  683, -217, {-169, -217, 1010,  883}, NULL },
+  { "Times-Roman",           standardEncoding,              0,  683, -217, {-168, -218, 1000,  898}, NULL },
+  { "ZapfDingbats",          zapfDingbatsEncoding,          0,  820, -143, {  -1, -143,  981,  820}, NULL }
 };
 
 BuiltinFont *builtinFontSubst[] = {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/CMakeLists.txt	2019-02-25 03:01:12 UTC (rev 50122)
@@ -56,6 +56,7 @@
   OutputDev.cc
   Page.cc
   Parser.cc
+  PDF417Barcode.cc
   PDFDoc.cc
   PDFDocEncoding.cc
   PSTokenizer.cc
@@ -63,6 +64,7 @@
   Stream.cc
   TextString.cc
   UnicodeMap.cc
+  UnicodeRemapping.cc
   UnicodeTypeTable.cc
   UTF8.cc
   XFAForm.cc
@@ -106,6 +108,7 @@
     pdftops.cc
   )
   target_link_libraries(pdftops goo fofi splash
+                        ${PAPER_LIBRARY}
                         ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
                         ${DTYPE_LIBRARY}
                         ${LCMS_LIBRARY})
@@ -116,10 +119,10 @@
     PSOutputDev.cc
     pdftops.cc
   )
-  target_link_libraries(pdftops goo fofi ${LCMS_LIBRARY})
+  target_link_libraries(pdftops goo fofi ${PAPER_LIBRARY} ${LCMS_LIBRARY})
 endif ()
-install(TARGETS pdftops RUNTIME DESTINATION bin)
-install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftops.1 DESTINATION man/man1)
+install(TARGETS pdftops RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftops.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 
 #--- pdftotext
 
@@ -128,9 +131,9 @@
   TextOutputDev.cc
   pdftotext.cc
 )
-target_link_libraries(pdftotext goo fofi ${LCMS_LIBRARY})
-install(TARGETS pdftotext RUNTIME DESTINATION bin)
-install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftotext.1 DESTINATION man/man1)
+target_link_libraries(pdftotext goo fofi ${PAPER_LIBRARY} ${LCMS_LIBRARY})
+install(TARGETS pdftotext RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftotext.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 
 #--- pdftohtml
 
@@ -143,11 +146,12 @@
     pdftohtml.cc
   )
   target_link_libraries(pdftohtml goo fofi splash
+                        ${PAPER_LIBRARY}
                         ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
                         ${DTYPE_LIBRARY}
                         ${LCMS_LIBRARY} ${PNG_LIBRARIES})
-  install(TARGETS pdftohtml RUNTIME DESTINATION bin)
-  install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftohtml.1 DESTINATION man/man1)
+  install(TARGETS pdftohtml RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+  install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftohtml.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 endif ()
 
 #--- pdfinfo
@@ -156,9 +160,9 @@
   $<TARGET_OBJECTS:xpdf_objs>
   pdfinfo.cc
 )
-target_link_libraries(pdfinfo goo fofi ${LCMS_LIBRARY})
-install(TARGETS pdfinfo RUNTIME DESTINATION bin)
-install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfinfo.1 DESTINATION man/man1)
+target_link_libraries(pdfinfo goo fofi ${PAPER_LIBRARY} ${LCMS_LIBRARY})
+install(TARGETS pdfinfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfinfo.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 
 #--- pdffonts
 
@@ -166,9 +170,9 @@
   $<TARGET_OBJECTS:xpdf_objs>
   pdffonts.cc
 )
-target_link_libraries(pdffonts goo fofi ${LCMS_LIBRARY})
-install(TARGETS pdffonts RUNTIME DESTINATION bin)
-install(FILES ${PROJECT_SOURCE_DIR}/doc/pdffonts.1 DESTINATION man/man1)
+target_link_libraries(pdffonts goo fofi ${PAPER_LIBRARY} ${LCMS_LIBRARY})
+install(TARGETS pdffonts RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/doc/pdffonts.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 
 #--- pdfdetach
 
@@ -176,9 +180,9 @@
   $<TARGET_OBJECTS:xpdf_objs>
   pdfdetach.cc
 )
-target_link_libraries(pdfdetach goo fofi ${LCMS_LIBRARY})
-install(TARGETS pdfdetach RUNTIME DESTINATION bin)
-install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfdetach.1 DESTINATION man/man1)
+target_link_libraries(pdfdetach goo fofi ${PAPER_LIBRARY} ${LCMS_LIBRARY})
+install(TARGETS pdfdetach RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfdetach.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 
 #--- pdftoppm
 
@@ -189,11 +193,12 @@
     pdftoppm.cc
   )
   target_link_libraries(pdftoppm goo fofi splash
+                        ${PAPER_LIBRARY}
                         ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
                         ${DTYPE_LIBRARY}
                         ${LCMS_LIBRARY})
-  install(TARGETS pdftoppm RUNTIME DESTINATION bin)
-  install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftoppm.1 DESTINATION man/man1)
+  install(TARGETS pdftoppm RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+  install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftoppm.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 endif ()
 
 #--- pdftopng
@@ -205,11 +210,12 @@
     pdftopng.cc
   )
   target_link_libraries(pdftopng goo fofi splash
+                        ${PAPER_LIBRARY}
                         ${FREETYPE_LIBRARY} ${FREETYPE_OTHER_LIBS}
                         ${DTYPE_LIBRARY}
                         ${LCMS_LIBRARY} ${PNG_LIBRARIES})
-  install(TARGETS pdftopng RUNTIME DESTINATION bin)
-  install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftopng.1 DESTINATION man/man1)
+  install(TARGETS pdftopng RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+  install(FILES ${PROJECT_SOURCE_DIR}/doc/pdftopng.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 endif ()
 
 #--- pdfimages
@@ -219,10 +225,10 @@
   ImageOutputDev.cc
   pdfimages.cc
 )
-target_link_libraries(pdfimages goo fofi ${LCMS_LIBRARY})
-install(TARGETS pdfimages RUNTIME DESTINATION bin)
-install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfimages.1 DESTINATION man/man1)
+target_link_libraries(pdfimages goo fofi ${PAPER_LIBRARY} ${LCMS_LIBRARY})
+install(TARGETS pdfimages RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(FILES ${PROJECT_SOURCE_DIR}/doc/pdfimages.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
 
 #--- xpdfrc man page
 
-install(FILES ${PROJECT_SOURCE_DIR}/doc/xpdfrc.5 DESTINATION man/man5)
+install(FILES ${PROJECT_SOURCE_DIR}/doc/xpdfrc.5 DESTINATION ${CMAKE_INSTALL_MANDIR}/man5)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Catalog.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -453,8 +453,13 @@
   }
   if (topPagesObj.dictLookup("Count", &countObj)->isInt()) {
     numPages = countObj.getInt();
-    if (numPages == 0) {
-      // Acrobat apparently scans the page tree if it sees a zero count
+    if (numPages == 0 || numPages > 50000) {
+      // 1. Acrobat apparently scans the page tree if it sees a zero
+      //    count.
+      // 2. Absurdly large page counts result in very slow loading,
+      //    because other code tries to fetch pages 1 through n.
+      // In both cases: ignore the given page count and scan the tree
+      // instead.
       numPages = countPageTree(&topPagesObj);
     }
   } else {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Decrypt.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -165,7 +165,7 @@
 	memcpy(test2, ownerKey->getCString(), 32);
 	for (i = 19; i >= 0; --i) {
 	  for (j = 0; j < keyLength; ++j) {
-	    tmpKey[j] = test[j] ^ i;
+	    tmpKey[j] = (Guchar)(test[j] ^ i);
 	  }
 	  rc4InitKey(tmpKey, keyLength, fState);
 	  fx = fy = 0;
@@ -274,10 +274,10 @@
     memcpy(buf, passwordPad, 32);
   }
   memcpy(buf + 32, ownerKey->getCString(), 32);
-  buf[64] = permissions & 0xff;
-  buf[65] = (permissions >> 8) & 0xff;
-  buf[66] = (permissions >> 16) & 0xff;
-  buf[67] = (permissions >> 24) & 0xff;
+  buf[64] = (Guchar)(permissions & 0xff);
+  buf[65] = (Guchar)((permissions >> 8) & 0xff);
+  buf[66] = (Guchar)((permissions >> 16) & 0xff);
+  buf[67] = (Guchar)((permissions >> 24) & 0xff);
   memcpy(buf + 68, fileID->getCString(), fileID->getLength());
   len = 68 + fileID->getLength();
   if (!encryptMetadata) {
@@ -305,7 +305,7 @@
     memcpy(test, userKey->getCString(), 32);
     for (i = 19; i >= 0; --i) {
       for (j = 0; j < keyLength; ++j) {
-	tmpKey[j] = fileKey[j] ^ i;
+	tmpKey[j] = (Guchar)(fileKey[j] ^ i);
       }
       rc4InitKey(tmpKey, keyLength, fState);
       fx = fy = 0;
@@ -348,11 +348,11 @@
   }
   switch (algo) {
   case cryptRC4:
-    objKey[keyLength] = objNum & 0xff;
-    objKey[keyLength + 1] = (objNum >> 8) & 0xff;
-    objKey[keyLength + 2] = (objNum >> 16) & 0xff;
-    objKey[keyLength + 3] = objGen & 0xff;
-    objKey[keyLength + 4] = (objGen >> 8) & 0xff;
+    objKey[keyLength] = (Guchar)(objNum & 0xff);
+    objKey[keyLength + 1] = (Guchar)((objNum >> 8) & 0xff);
+    objKey[keyLength + 2] = (Guchar)((objNum >> 16) & 0xff);
+    objKey[keyLength + 3] = (Guchar)(objGen & 0xff);
+    objKey[keyLength + 4] = (Guchar)((objGen >> 8) & 0xff);
     md5(objKey, keyLength + 5, objKey);
     if ((objKeyLength = keyLength + 5) > 16) {
       objKeyLength = 16;
@@ -359,11 +359,11 @@
     }
     break;
   case cryptAES:
-    objKey[keyLength] = objNum & 0xff;
-    objKey[keyLength + 1] = (objNum >> 8) & 0xff;
-    objKey[keyLength + 2] = (objNum >> 16) & 0xff;
-    objKey[keyLength + 3] = objGen & 0xff;
-    objKey[keyLength + 4] = (objGen >> 8) & 0xff;
+    objKey[keyLength] = (Guchar)(objNum & 0xff);
+    objKey[keyLength + 1] = (Guchar)((objNum >> 8) & 0xff);
+    objKey[keyLength + 2] = (Guchar)((objNum >> 16) & 0xff);
+    objKey[keyLength + 3] = (Guchar)(objGen & 0xff);
+    objKey[keyLength + 4] = (Guchar)((objGen >> 8) & 0xff);
     objKey[keyLength + 5] = 0x73; // 's'
     objKey[keyLength + 6] = 0x41; // 'A'
     objKey[keyLength + 7] = 0x6c; // 'l'
@@ -516,14 +516,14 @@
   int i;
 
   for (i = 0; i < 256; ++i)
-    state[i] = i;
+    state[i] = (Guchar)i;
   index1 = index2 = 0;
   for (i = 0; i < 256; ++i) {
-    index2 = (key[index1] + state[i] + index2) % 256;
+    index2 = (Guchar)(key[index1] + state[i] + index2);
     t = state[i];
     state[i] = state[index2];
     state[index2] = t;
-    index1 = (index1 + 1) % keyLen;
+    index1 = (Guchar)((index1 + 1) % keyLen);
   }
 }
 
@@ -530,8 +530,8 @@
 Guchar rc4DecryptByte(Guchar *state, Guchar *x, Guchar *y, Guchar c) {
   Guchar x1, y1, tx, ty;
 
-  x1 = *x = (*x + 1) % 256;
-  y1 = *y = (state[*x] + *y) % 256;
+  x1 = *x = (Guchar)(*x + 1);
+  y1 = *y = (Guchar)(state[*x] + *y);
   tx = state[x1];
   ty = state[y1];
   state[x1] = ty;
@@ -672,7 +672,7 @@
 static inline Guchar mul02(Guchar s) {
   Guchar s2;
 
-  s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+  s2 = (Guchar)((s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1));
   return s2;
 }
 
@@ -680,7 +680,7 @@
 static inline Guchar mul03(Guchar s) {
   Guchar s2;
 
-  s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
+  s2 = (Guchar)((s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1));
   return s ^ s2;
 }
 
@@ -688,9 +688,9 @@
 static inline Guchar mul09(Guchar s) {
   Guchar s2, s4, s8;
 
-  s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
-  s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
-  s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+  s2 = (Guchar)((s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1));
+  s4 = (Guchar)((s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1));
+  s8 = (Guchar)((s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1));
   return s ^ s8;
 }
 
@@ -698,9 +698,9 @@
 static inline Guchar mul0b(Guchar s) {
   Guchar s2, s4, s8;
 
-  s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
-  s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
-  s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+  s2 = (Guchar)((s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1));
+  s4 = (Guchar)((s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1));
+  s8 = (Guchar)((s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1));
   return s ^ s2 ^ s8;
 }
 
@@ -708,9 +708,9 @@
 static inline Guchar mul0d(Guchar s) {
   Guchar s2, s4, s8;
 
-  s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
-  s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
-  s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+  s2 = (Guchar)((s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1));
+  s4 = (Guchar)((s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1));
+  s8 = (Guchar)((s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1));
   return s ^ s4 ^ s8;
 }
 
@@ -718,9 +718,9 @@
 static inline Guchar mul0e(Guchar s) {
   Guchar s2, s4, s8;
 
-  s2 = (s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1);
-  s4 = (s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1);
-  s8 = (s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1);
+  s2 = (Guchar)((s & 0x80) ? ((s << 1) ^ 0x1b) : (s << 1));
+  s4 = (Guchar)((s2 & 0x80) ? ((s2 << 1) ^ 0x1b) : (s2 << 1));
+  s8 = (Guchar)((s4 & 0x80) ? ((s4 << 1) ^ 0x1b) : (s4 << 1));
   return s2 ^ s4 ^ s8;
 }
 
@@ -761,10 +761,10 @@
   Guchar s0, s1, s2, s3;
 
   for (c = 0; c < 4; ++c) {
-    s0 = w[c] >> 24;
-    s1 = w[c] >> 16;
-    s2 = w[c] >> 8;
-    s3 = w[c];
+    s0 = (Guchar)(w[c] >> 24);
+    s1 = (Guchar)(w[c] >> 16);
+    s2 = (Guchar)(w[c] >> 8);
+    s3 = (Guchar)w[c];
     w[c] = ((mul0e(s0) ^ mul0b(s1) ^ mul0d(s2) ^ mul09(s3)) << 24)
            | ((mul09(s0) ^ mul0e(s1) ^ mul0b(s2) ^ mul0d(s3)) << 16)
            | ((mul0d(s0) ^ mul09(s1) ^ mul0e(s2) ^ mul0b(s3)) << 8)
@@ -776,10 +776,10 @@
   int c;
 
   for (c = 0; c < 4; ++c) {
-    state[c] ^= w[c] >> 24;
-    state[4+c] ^= w[c] >> 16;
-    state[8+c] ^= w[c] >> 8;
-    state[12+c] ^= w[c];
+    state[c] ^= (Guchar)(w[c] >> 24);
+    state[4+c] ^= (Guchar)(w[c] >> 16);
+    state[8+c] ^= (Guchar)(w[c] >> 8);
+    state[12+c] ^= (Guchar)w[c];
   }
 }
 
@@ -993,22 +993,22 @@
 }
 
 static inline Gulong md5Round1(Gulong a, Gulong b, Gulong c, Gulong d,
-			       Gulong Xk,  Gulong s, Gulong Ti) {
+			       Gulong Xk, int s, Gulong Ti) {
   return b + rotateLeft((a + ((b & c) | (~b & d)) + Xk + Ti), s);
 }
 
 static inline Gulong md5Round2(Gulong a, Gulong b, Gulong c, Gulong d,
-			       Gulong Xk,  Gulong s, Gulong Ti) {
+			       Gulong Xk, int s, Gulong Ti) {
   return b + rotateLeft((a + ((b & d) | (c & ~d)) + Xk + Ti), s);
 }
 
 static inline Gulong md5Round3(Gulong a, Gulong b, Gulong c, Gulong d,
-			       Gulong Xk,  Gulong s, Gulong Ti) {
+			       Gulong Xk, int s, Gulong Ti) {
   return b + rotateLeft((a + (b ^ c ^ d) + Xk + Ti), s);
 }
 
 static inline Gulong md5Round4(Gulong a, Gulong b, Gulong c, Gulong d,
-			       Gulong Xk,  Gulong s, Gulong Ti) {
+			       Gulong Xk, int s, Gulong Ti) {
   return b + rotateLeft((a + (c ^ (b | ~d)) + Xk + Ti), s);
 }
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Dict.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -37,11 +37,11 @@
 
   // Reference counting.
 #if MULTITHREADED
-  int incRef() { return gAtomicIncrement(&ref); }
-  int decRef() { return gAtomicDecrement(&ref); }
+  long incRef() { return gAtomicIncrement(&ref); }
+  long decRef() { return gAtomicDecrement(&ref); }
 #else
-  int incRef() { return ++ref; }
-  int decRef() { return --ref; }
+  long incRef() { return ++ref; }
+  long decRef() { return --ref; }
 #endif
 
   // Get number of entries.
@@ -78,7 +78,7 @@
 #if MULTITHREADED
   GAtomicCounter ref;		// reference count
 #else
-  int ref;			// reference count
+  long ref;			// reference count
 #endif
 
   DictEntry *find(const char *key);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Function.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1169,7 +1169,7 @@
       delete s;
       return NULL;
     }
-    codeString->append(c);
+    codeString->append((char)c);
     if (comment) {
       if (c == '\x0a' || c == '\x0d') {
 	comment = gFalse;
@@ -1190,7 +1190,7 @@
 	break;
       }
       str->getChar();
-      codeString->append(c);
+      codeString->append((char)c);
     }
   } else {
     while (1) {
@@ -1200,7 +1200,7 @@
 	break;
       }
       str->getChar();
-      codeString->append(c);
+      codeString->append((char)c);
     }
   }
   return s;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Gfx.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -947,7 +947,7 @@
   GfxColor backdropColor;
   GBool haveBackdropColor;
   GfxColorSpace *blendingColorSpace;
-  GBool alpha, isolated, knockout;
+  GBool alpha, knockout;
   double opac;
   int i;
 
@@ -1041,22 +1041,37 @@
 
   // fill/stroke overprint, overprint mode
   if ((haveFillOP = (obj1.dictLookup("op", &obj2)->isBool()))) {
-    state->setFillOverprint(obj2.getBool());
-    out->updateFillOverprint(state);
+    if (!state->getInCachedT3Char()) {
+      state->setFillOverprint(obj2.getBool());
+      out->updateFillOverprint(state);
+    } else {
+      error(errSyntaxWarning, getPos(),
+	    "Ignoring overprint setting in cached Type 3 character");
+    }
   }
   obj2.free();
   if (obj1.dictLookup("OP", &obj2)->isBool()) {
-    state->setStrokeOverprint(obj2.getBool());
-    out->updateStrokeOverprint(state);
-    if (!haveFillOP) {
-      state->setFillOverprint(obj2.getBool());
-      out->updateFillOverprint(state);
+    if (!state->getInCachedT3Char()) {
+      state->setStrokeOverprint(obj2.getBool());
+      out->updateStrokeOverprint(state);
+      if (!haveFillOP) {
+	state->setFillOverprint(obj2.getBool());
+	out->updateFillOverprint(state);
+      }
+    } else {
+      error(errSyntaxWarning, getPos(),
+	    "Ignoring overprint setting in cached Type 3 character");
     }
   }
   obj2.free();
   if (obj1.dictLookup("OPM", &obj2)->isInt()) {
-    state->setOverprintMode(obj2.getInt());
-    out->updateOverprintMode(state);
+    if (!state->getInCachedT3Char()) {
+      state->setOverprintMode(obj2.getInt());
+      out->updateOverprintMode(state);
+    } else {
+      error(errSyntaxWarning, getPos(),
+	    "Ignoring overprint setting in cached Type 3 character");
+    }
   }
   obj2.free();
 
@@ -1072,32 +1087,40 @@
     obj2.free();
     obj1.dictLookup("TR", &obj2);
   }
-  if (obj2.isName("Default") ||
-      obj2.isName("Identity")) {
-    funcs[0] = funcs[1] = funcs[2] = funcs[3] = NULL;
-    state->setTransfer(funcs);
-    out->updateTransfer(state);
-  } else if (obj2.isArray() && obj2.arrayGetLength() == 4) {
-    for (i = 0; i < 4; ++i) {
-      obj2.arrayGet(i, &obj3);
-      funcs[i] = Function::parse(&obj3);
-      obj3.free();
-      if (!funcs[i]) {
-	break;
+  if (!obj2.isNull()) {
+    if (!state->getInCachedT3Char()) {
+      if (obj2.isName("Default") ||
+	  obj2.isName("Identity")) {
+	funcs[0] = funcs[1] = funcs[2] = funcs[3] = NULL;
+	state->setTransfer(funcs);
+	out->updateTransfer(state);
+      } else if (obj2.isArray() && obj2.arrayGetLength() == 4) {
+	for (i = 0; i < 4; ++i) {
+	  obj2.arrayGet(i, &obj3);
+	  funcs[i] = Function::parse(&obj3);
+	  obj3.free();
+	  if (!funcs[i]) {
+	    break;
+	  }
+	}
+	if (i == 4) {
+	  state->setTransfer(funcs);
+	  out->updateTransfer(state);
+	}
+      } else if (obj2.isName() || obj2.isDict() || obj2.isStream()) {
+	if ((funcs[0] = Function::parse(&obj2))) {
+	  funcs[1] = funcs[2] = funcs[3] = NULL;
+	  state->setTransfer(funcs);
+	  out->updateTransfer(state);
+	}
+      } else {
+	error(errSyntaxError, getPos(),
+	      "Invalid transfer function in ExtGState");
       }
+    } else {
+      error(errSyntaxWarning, getPos(),
+	    "Ignoring transfer function setting in cached Type 3 character");
     }
-    if (i == 4) {
-      state->setTransfer(funcs);
-      out->updateTransfer(state);
-    }
-  } else if (obj2.isName() || obj2.isDict() || obj2.isStream()) {
-    if ((funcs[0] = Function::parse(&obj2))) {
-      funcs[1] = funcs[2] = funcs[3] = NULL;
-      state->setTransfer(funcs);
-      out->updateTransfer(state);
-    }
-  } else if (!obj2.isNull()) {
-    error(errSyntaxError, getPos(), "Invalid transfer function in ExtGState");
   }
   obj2.free();
 
@@ -1145,16 +1168,12 @@
       if (obj2.dictLookup("G", &obj3)->isStream()) {
 	if (obj3.streamGetDict()->lookup("Group", &obj4)->isDict()) {
 	  blendingColorSpace = NULL;
-	  isolated = knockout = gFalse;
+	  knockout = gFalse;
 	  if (!obj4.dictLookup("CS", &obj5)->isNull()) {
 	    blendingColorSpace = GfxColorSpace::parse(&obj5
 						      );
 	  }
 	  obj5.free();
-	  if (obj4.dictLookup("I", &obj5)->isBool()) {
-	    isolated = obj5.getBool();
-	  }
-	  obj5.free();
 	  if (obj4.dictLookup("K", &obj5)->isBool()) {
 	    knockout = obj5.getBool();
 	  }
@@ -1170,8 +1189,11 @@
 	    }
 	  }
 	  obj2.dictLookupNF("G", &objRef3);
+	  // it doesn't make sense for softmasks to be non-isolated,
+	  // because they're blended with a backdrop color, rather
+	  // than the original backdrop
 	  doSoftMask(&obj3, &objRef3, alpha, blendingColorSpace,
-		     isolated, knockout, funcs[0], &backdropColor);
+		     gTrue, knockout, funcs[0], &backdropColor);
 	  objRef3.free();
 	  if (funcs[0]) {
 	    delete funcs[0];
@@ -1268,6 +1290,11 @@
 void Gfx::opSetRenderingIntent(Object args[], int numArgs) {
   GfxRenderingIntent ri;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring rendering intent setting in cached Type 3 character");
+    return;
+  }
   ri = parseRenderingIntent(args[0].getName());
   state->setRenderingIntent(ri);
   out->updateRenderingIntent(state);
@@ -1293,6 +1320,11 @@
 void Gfx::opSetFillGray(Object args[], int numArgs) {
   GfxColor color;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   state->setFillPattern(NULL);
   state->setFillColorSpace(GfxColorSpace::create(csDeviceGray));
   out->updateFillColorSpace(state);
@@ -1304,6 +1336,11 @@
 void Gfx::opSetStrokeGray(Object args[], int numArgs) {
   GfxColor color;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   state->setStrokePattern(NULL);
   state->setStrokeColorSpace(GfxColorSpace::create(csDeviceGray));
   out->updateStrokeColorSpace(state);
@@ -1316,6 +1353,11 @@
   GfxColor color;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   state->setFillPattern(NULL);
   state->setFillColorSpace(GfxColorSpace::create(csDeviceCMYK));
   out->updateFillColorSpace(state);
@@ -1330,6 +1372,11 @@
   GfxColor color;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   state->setStrokePattern(NULL);
   state->setStrokeColorSpace(GfxColorSpace::create(csDeviceCMYK));
   out->updateStrokeColorSpace(state);
@@ -1344,6 +1391,11 @@
   GfxColor color;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   state->setFillPattern(NULL);
   state->setFillColorSpace(GfxColorSpace::create(csDeviceRGB));
   out->updateFillColorSpace(state);
@@ -1358,6 +1410,11 @@
   GfxColor color;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   state->setStrokePattern(NULL);
   state->setStrokeColorSpace(GfxColorSpace::create(csDeviceRGB));
   out->updateStrokeColorSpace(state);
@@ -1373,6 +1430,11 @@
   GfxColorSpace *colorSpace;
   GfxColor color;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color space setting in cached Type 3 character");
+    return;
+  }
   state->setFillPattern(NULL);
   res->lookupColorSpace(args[0].getName(), &obj);
   if (obj.isNull()) {
@@ -1399,6 +1461,11 @@
   GfxColorSpace *colorSpace;
   GfxColor color;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color space setting in cached Type 3 character");
+    return;
+  }
   state->setStrokePattern(NULL);
   res->lookupColorSpace(args[0].getName(), &obj);
   if (obj.isNull()) {
@@ -1424,6 +1491,11 @@
   GfxColor color;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   if (numArgs != state->getFillColorSpace()->getNComps()) {
     error(errSyntaxError, getPos(),
 	  "Incorrect number of arguments in 'sc' command");
@@ -1459,7 +1531,17 @@
   GfxPattern *pattern;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   if (state->getFillColorSpace()->getMode() == csPattern) {
+    if (numArgs == 0 || !args[numArgs-1].isName()) {
+      error(errSyntaxError, getPos(),
+	    "Invalid arguments in 'scn' command");
+      return;
+    }
     if (numArgs > 1) {
       if (!((GfxPatternColorSpace *)state->getFillColorSpace())->getUnder() ||
 	  numArgs - 1 != ((GfxPatternColorSpace *)state->getFillColorSpace())
@@ -1476,8 +1558,7 @@
       state->setFillColor(&color);
       out->updateFillColor(state);
     }
-    if (args[numArgs-1].isName() &&
-	(pattern = res->lookupPattern(args[numArgs-1].getName()
+    if ((pattern = res->lookupPattern(args[numArgs-1].getName()
 				      ))) {
       state->setFillPattern(pattern);
     }
@@ -1504,7 +1585,17 @@
   GfxPattern *pattern;
   int i;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring color setting in cached Type 3 character");
+    return;
+  }
   if (state->getStrokeColorSpace()->getMode() == csPattern) {
+    if (numArgs == 0 || !args[numArgs-1].isName()) {
+      error(errSyntaxError, getPos(),
+	    "Invalid arguments in 'SCN' command");
+      return;
+    }
     if (numArgs > 1) {
       if (!((GfxPatternColorSpace *)state->getStrokeColorSpace())
 	       ->getUnder() ||
@@ -1522,8 +1613,7 @@
       state->setStrokeColor(&color);
       out->updateStrokeColor(state);
     }
-    if (args[numArgs-1].isName() &&
-	(pattern = res->lookupPattern(args[numArgs-1].getName()
+    if ((pattern = res->lookupPattern(args[numArgs-1].getName()
 				      ))) {
       state->setStrokePattern(pattern);
     }
@@ -2248,6 +2338,12 @@
   GfxState *savedState;
   double xMin, yMin, xMax, yMax;
 
+  if (state->getInCachedT3Char()) {
+    error(errSyntaxWarning, getPos(),
+	  "Ignoring shaded fill in cached Type 3 character");
+    return;
+  }
+
   if (!out->needNonText()) {
     return;
   }
@@ -3715,6 +3811,12 @@
   font = state->getFont();
   wMode = font->getWMode();
 
+  if (globalParams->isDroppedFont(font->getName()
+				    ? font->getName()->getCString() : "")) {
+    doIncCharCount(s);
+    return;
+  }
+
   if (out->useDrawChar()) {
     out->beginString(state, s);
   }
@@ -4294,7 +4396,7 @@
 	delete colorMap;
 	maskObj.free();
 	smaskObj.free();
-	goto err1;
+	goto err2;
       }
       maskColorSpace = new GfxDeviceGrayColorSpace();
       obj1.free();
@@ -4432,14 +4534,18 @@
     }
 
     // if drawing is disabled, skip over inline image data
-    if (!ocState) {
-      str->reset();
-      n = height * ((width * colorMap->getNumPixelComps() *
-		     colorMap->getBits() + 7) / 8);
-      for (i = 0; i < n; ++i) {
-	str->getChar();
+    if (state->getInCachedT3Char() || !ocState) {
+      if (state->getInCachedT3Char()) {
+	error(errSyntaxWarning, getPos(),
+	      "Ignoring image in cached Type 3 character");
       }
-      str->close();
+      if (inlineImg) {
+	str->reset();
+	n = height * ((width * colorMap->getNumPixelComps() *
+		       colorMap->getBits() + 7) / 8);
+	str->discardChars(n);
+	str->close();
+      }
 
     // draw it
     } else {
@@ -4829,6 +4935,7 @@
 }
 
 void Gfx::opSetCacheDevice(Object args[], int numArgs) {
+  state->setInCachedT3Char(gTrue);
   out->type3D1(state, args[0].getNum(), args[1].getNum(),
 	       args[2].getNum(), args[3].getNum(),
 	       args[4].getNum(), args[5].getNum());

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -421,8 +421,6 @@
   // assume Times-Roman by default (for substitution purposes)
   flags = fontSerif;
 
-  missingWidth = 0;
-
   if (fontDict->lookup("FontDescriptor", &obj1)->isDict()) {
 
     // get flags
@@ -933,6 +931,7 @@
 
   // default ascent/descent values
   if (builtinFont) {
+    missingWidth = builtinFont->missingWidth;
     ascent = 0.001 * builtinFont->ascent;
     descent = 0.001 * builtinFont->descent;
     fontBBox[0] = 0.001 * builtinFont->bbox[0];
@@ -940,6 +939,7 @@
     fontBBox[2] = 0.001 * builtinFont->bbox[2];
     fontBBox[3] = 0.001 * builtinFont->bbox[3];
   } else {
+    missingWidth = 0;
     ascent = 0.75;
     descent = -0.25;
     fontBBox[0] = fontBBox[1] = fontBBox[2] = fontBBox[3] = 0;
@@ -1094,7 +1094,7 @@
   // copy the base encoding
   for (i = 0; i < 256; ++i) {
     enc[i] = (char *)baseEnc[i];
-    if ((encFree[i] = baseEncFromFontFile) && enc[i]) {
+    if ((encFree[i] = (char)baseEncFromFontFile) && enc[i]) {
       enc[i] = copyString(baseEnc[i]);
     }
   }
@@ -1394,7 +1394,7 @@
   int *map;
   int cmapPlatform, cmapEncoding;
   int unicodeCmap, macRomanCmap, msSymbolCmap, cmap;
-  GBool useMacRoman, useUnicode;
+  GBool nonsymbolic, useMacRoman, useUnicode;
   char *charName;
   Unicode u;
   int code, i, n;
@@ -1404,32 +1404,9 @@
     map[i] = 0;
   }
 
-  // To match up with the Adobe-defined behaviour, we choose a cmap
-  // like this:
-  // 1. If the PDF font has an encoding:
-  //    1a. If the PDF font specified MacRomanEncoding and the
-  //        TrueType font has a Macintosh Roman cmap, use it, and
-  //        reverse map the char names through MacRomanEncoding to
-  //        get char codes.
-  //    1b. If the PDF font is not symbolic or the PDF font is not
-  //        embedded, and the TrueType font has a Microsoft Unicode
-  //        cmap or a non-Microsoft Unicode cmap, use it, and use the
-  //        Unicode indexes, not the char codes.
-  //    1c. If the PDF font is symbolic and the TrueType font has a
-  //        Microsoft Symbol cmap, use it, and use char codes
-  //        directly (possibly with an offset of 0xf000).
-  //    1d. If the TrueType font has a Macintosh Roman cmap, use it,
-  //        as in case 1a.
-  // 2. If the PDF font does not have an encoding or the PDF font is
-  //    symbolic:
-  //    2a. If the TrueType font has a Macintosh Roman cmap, use it,
-  //        and use char codes directly (possibly with an offset of
-  //        0xf000).
-  //    2b. If the TrueType font has a Microsoft Symbol cmap, use it,
-  //        and use char codes directly (possible with an offset of
-  //        0xf000).
-  // 3. If none of these rules apply, use the first cmap and hope for
-  //    the best (this shouldn't happen).
+  // This is based on the cmap/encoding selection algorithm in the PDF
+  // 2.0 spec, but with some differences to match up with Adobe's
+  // behavior.
   unicodeCmap = macRomanCmap = msSymbolCmap = -1;
   for (i = 0; i < ff->getNumCmaps(); ++i) {
     cmapPlatform = ff->getCmapPlatform(i);
@@ -1443,31 +1420,29 @@
       msSymbolCmap = i;
     }
   }
-  cmap = 0;
   useMacRoman = gFalse;
   useUnicode = gFalse;
-  if (hasEncoding) {
-    if (usesMacRomanEnc && macRomanCmap >= 0) {
-      cmap = macRomanCmap;
-      useMacRoman = gTrue;
-    } else if ((!(flags & fontSymbolic) || embFontID.num < 0) &&
-	       unicodeCmap >= 0) {
-      cmap = unicodeCmap;
-      useUnicode = gTrue;
-    } else if ((flags & fontSymbolic) && msSymbolCmap >= 0) {
-      cmap = msSymbolCmap;
-    } else if ((flags & fontSymbolic) && macRomanCmap >= 0) {
-      cmap = macRomanCmap;
-    } else if (macRomanCmap >= 0) {
-      cmap = macRomanCmap;
-      useMacRoman = gTrue;
-    }
+  nonsymbolic = !(flags & fontSymbolic);
+  if (usesMacRomanEnc && macRomanCmap >= 0) {
+    cmap = macRomanCmap;
+    useMacRoman = gTrue;
+  } else if (embFontID.num < 0 && hasEncoding && unicodeCmap >= 0) { 
+    cmap = unicodeCmap;
+    useUnicode = gTrue;
+  } else if (nonsymbolic && unicodeCmap >= 0) {
+    cmap = unicodeCmap;
+    useUnicode = gTrue;
+  } else if (nonsymbolic && macRomanCmap >= 0) {
+    cmap = macRomanCmap;
+    useMacRoman = gTrue;
+  } else if (msSymbolCmap >= 0) {
+    cmap = msSymbolCmap;
+  } else if (unicodeCmap >= 0) {
+    cmap = unicodeCmap;
+  } else if (macRomanCmap >= 0) {
+    cmap = macRomanCmap;
   } else {
-    if (msSymbolCmap >= 0) {
-      cmap = msSymbolCmap;
-    } else if (macRomanCmap >= 0) {
-      cmap = macRomanCmap;
-    }
+    cmap = 0;
   }
 
   // reverse map the char names through MacRomanEncoding, then map the
@@ -1613,6 +1588,7 @@
   int c1, c2;
   int excepsSize, i, j, k, n;
 
+  missingWidth = 0;
   ascent = 0.95;
   descent = -0.35;
   fontBBox[0] = fontBBox[1] = fontBBox[2] = fontBBox[3] = 0;
@@ -1723,6 +1699,12 @@
   if (!(cMap = CMap::parse(NULL, collection, &obj1))) {
     goto err2;
   }
+
+  // check for fonts that use the Identity-H encoding (cmap), and the
+  // Adobe-Identity character collection
+  identityEnc = obj1.isName("Identity-H") &&
+                !collection->cmp("Adobe-Identity");
+
   obj1.free();
 
   // CIDToGIDMap
@@ -1745,6 +1727,7 @@
       cidToGID[cidToGIDLen++] = (c1 << 8) + c2;
     }
     obj1.streamClose();
+    identityEnc = gFalse;
   } else if (obj1.isName("Identity")) {
     hasIdentityCIDToGID = gTrue;
   } else if (!obj1.isNull()) {
@@ -1868,7 +1851,7 @@
 		      excepsSize, sizeof(GfxFontCIDWidthExcepV));
 	}
 	j = obj2.getInt();
-	for (k = 0; k < obj3.arrayGetLength(); k += 3) {
+	for (k = 0; k + 2 < obj3.arrayGetLength(); k += 3) {
 	  if (obj3.arrayGet(k, &obj4)->isNum() &&
 	      obj3.arrayGet(k+1, &obj5)->isNum() &&
 	      obj3.arrayGet(k+2, &obj6)->isNum()) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxFont.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -336,6 +336,12 @@
   int *getCIDToGID() { return cidToGID; }
   int getCIDToGIDLen() { return cidToGIDLen; }
 
+  // Returns true if this font uses the Identity-H encoding (cmap),
+  // and the Adobe-Identity character collection, and does not have a
+  // CIDToGIDMap.  When this is true for a CID TrueType font, Adobe
+  // appears to treat char codes as raw GIDs.
+  GBool usesIdentityEncoding() { return identityEnc; }
+
   virtual GBool problematicForUnicode();
 
 private:
@@ -355,6 +361,7 @@
   int cidToGIDLen;
   GBool hasKnownCollection;
   GBool hasIdentityCIDToGID;
+  GBool identityEnc;
 };
 
 //------------------------------------------------------------------------

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -94,6 +94,7 @@
 
 
 
+
 //------------------------------------------------------------------------
 // GfxColorSpace
 //------------------------------------------------------------------------
@@ -233,6 +234,7 @@
 }
 
 
+
 void GfxDeviceGrayColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
 }
@@ -319,8 +321,8 @@
   *gray = clip01(color->c[0]);
 }
 
- void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb,
-				   GfxRenderingIntent ri) {
+void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb,
+				  GfxRenderingIntent ri) {
   rgb->r = rgb->g = rgb->b = clip01(color->c[0]);
 }
 
@@ -331,6 +333,7 @@
 }
 
 
+
 void GfxCalGrayColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
 }
@@ -388,6 +391,7 @@
 }
 
 
+
 void GfxDeviceRGBColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
   color->c[1] = 0;
@@ -534,6 +538,7 @@
 }
 
 
+
 void GfxCalRGBColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
   color->c[1] = 0;
@@ -638,6 +643,7 @@
 }
 
 
+
 void GfxDeviceCMYKColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
   color->c[1] = 0;
@@ -834,6 +840,7 @@
 }
 
 
+
 void GfxLabColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
   if (aMin > 0) {
@@ -989,6 +996,7 @@
 }
 
 
+
 void GfxICCBasedColorSpace::getDefaultColor(GfxColor *color) {
   int i;
 
@@ -1097,6 +1105,9 @@
 	  error(errSyntaxError, -1,
 		"Bad Indexed color space (lookup table stream too short)");
 	  cs->indexHigh = indexHighA = i - 1;
+	  if (cs->indexHigh < 0) {
+	    goto err3;
+	  }
 	}
 	cs->lookup[i*n + j] = (Guchar)x;
       }
@@ -1107,6 +1118,9 @@
       error(errSyntaxError, -1,
 	    "Bad Indexed color space (lookup table string too short)");
       cs->indexHigh = indexHighA = obj1.getString()->getLength() / n - 1;
+      if (cs->indexHigh < 0) {
+	goto err3;
+      }
     }
     s = obj1.getString()->getCString();
     for (i = 0; i <= indexHighA; ++i) {
@@ -1173,6 +1187,7 @@
 }
 
 
+
 void GfxIndexedColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = 0;
 }
@@ -1238,7 +1253,7 @@
   GString *nameA;
   GfxColorSpace *altA;
   Function *funcA;
-  Object obj1;
+  Object obj1, obj2;
 
   if (arr->getLength() != 4) {
     error(errSyntaxError, -1, "Bad Separation color space");
@@ -1251,6 +1266,13 @@
   nameA = new GString(obj1.getName());
   obj1.free();
   arr->get(2, &obj1);
+  // some PDF generators use an ICC profile stream here; Adobe
+  // apparently looks at the /Alternate entry in the stream dictionary
+  if (obj1.isStream() &&
+      !obj1.streamGetDict()->lookup("Alternate", &obj2)->isNull()) {
+    obj1.free();
+    obj1 = obj2;
+  }
   if (!(altA = GfxColorSpace::parse(&obj1,
 				    recursion + 1))) {
     error(errSyntaxError, -1,
@@ -1323,6 +1345,7 @@
 }
 
 
+
 void GfxSeparationColorSpace::getDefaultColor(GfxColor *color) {
   color->c[0] = gfxColorComp1;
 }
@@ -1438,6 +1461,13 @@
   }
   obj1.free();
   arr->get(2, &obj1);
+  // some PDF generators use an ICC profile stream here; Adobe
+  // apparently looks at the /Alternate entry in the stream dictionary
+  if (obj1.isStream() &&
+      !obj1.streamGetDict()->lookup("Alternate", &obj2)->isNull()) {
+    obj1.free();
+    obj1 = obj2;
+  }
   if (!(altA = GfxColorSpace::parse(&obj1,
 				    recursion + 1))) {
     error(errSyntaxError, -1,
@@ -1521,6 +1551,7 @@
 }
 
 
+
 void GfxDeviceNColorSpace::getDefaultColor(GfxColor *color) {
   int i;
 
@@ -1595,6 +1626,7 @@
 }
 
 
+
 void GfxPatternColorSpace::getDefaultColor(GfxColor *color) {
   // not used
 }
@@ -3448,7 +3480,8 @@
 //------------------------------------------------------------------------
 
 GfxImageColorMap::GfxImageColorMap(int bitsA, Object *decode,
-				   GfxColorSpace *colorSpaceA) {
+				   GfxColorSpace *colorSpaceA,
+				   int maxAllowedBits) {
   GfxIndexedColorSpace *indexedCS;
   GfxSeparationColorSpace *sepCS;
   int maxPixel, indexHigh;
@@ -3455,8 +3488,8 @@
   Guchar *indexedLookup;
   Function *sepFunc;
   Object obj;
-  double x[gfxColorMaxComps];
-  double y[gfxColorMaxComps];
+  double defaultLow[gfxColorMaxComps], defaultRange[gfxColorMaxComps];
+  double x[gfxColorMaxComps], y[gfxColorMaxComps];
   int i, j, k;
 
   ok = gTrue;
@@ -3463,10 +3496,10 @@
 
   // bits per component and color space
   bits = bitsA;
-  if (bits <= 8) {
+  if (bits <= maxAllowedBits) {
     maxPixel = (1 << bits) - 1;
   } else {
-    maxPixel = 0xff;
+    maxPixel = (1 << maxAllowedBits) - 1;
   }
   colorSpace = colorSpaceA;
 
@@ -3477,9 +3510,13 @@
   }
 
   // get decode map
+  colorSpace->getDefaultRanges(defaultLow, defaultRange, maxPixel);
   if (decode->isNull()) {
     nComps = colorSpace->getNComps();
-    colorSpace->getDefaultRanges(decodeLow, decodeRange, maxPixel);
+    for (i = 0; i < nComps; ++i) {
+      decodeLow[i] = defaultLow[i];
+      decodeRange[i] = defaultRange[i];
+    }
   } else if (decode->isArray()) {
     nComps = decode->arrayGetLength() / 2;
     if (nComps < colorSpace->getNComps()) {
@@ -3514,8 +3551,13 @@
     lookup[k] = (GfxColorComp *)gmallocn(maxPixel + 1,
 					 sizeof(GfxColorComp));
     for (i = 0; i <= maxPixel; ++i) {
-      lookup[k][i] = dblToCol(decodeLow[k] +
-			      (i * decodeRange[k]) / maxPixel);
+      double t = decodeLow[k] + (i * decodeRange[k]) / maxPixel;
+      if (t < defaultLow[k]) {
+	t = defaultLow[k];
+      } else if (t > defaultLow[k] + defaultRange[k]) {
+	t = defaultLow[k] + defaultRange[k];
+      }
+      lookup[k][i] = dblToCol(t);
     }
   }
 
@@ -3560,7 +3602,13 @@
 					    sizeof(GfxColorComp));
     }
     for (i = 0; i <= maxPixel; ++i) {
-      x[0] = decodeLow[0] + (i * decodeRange[0]) / maxPixel;
+      double t = decodeLow[0] + (i * decodeRange[0]) / maxPixel;
+      if (t < defaultLow[0]) {
+	t = defaultLow[0];
+      } else if (t > defaultLow[0] + defaultRange[0]) {
+	t = defaultLow[0] + defaultRange[0];
+      }
+      x[0] = t;
       sepFunc->transform(x, y);
       for (k = 0; k < nComps2; ++k) {
 	lookup2[k][i] = dblToCol(y[k]);
@@ -3682,15 +3730,10 @@
 
 
 void GfxImageColorMap::getColor(Guchar *x, GfxColor *color) {
-  int maxPixel, i;
+  int i;
 
-  if (bits <= 8) {
-    maxPixel = (1 << bits) - 1;
-  } else {
-    maxPixel = 0xff;
-  }
   for (i = 0; i < nComps; ++i) {
-    color->c[i] = dblToCol(decodeLow[i] + (x[i] * decodeRange[i]) / maxPixel);
+    color->c[i] = lookup[i][x[i]];
   }
 }
 
@@ -3779,6 +3822,7 @@
   }
 }
 
+
 //------------------------------------------------------------------------
 // GfxSubpath and GfxPath
 //------------------------------------------------------------------------
@@ -4078,6 +4122,8 @@
   clipXMax = pageWidth;
   clipYMax = pageHeight;
 
+  inCachedT3Char = gFalse;
+
   saved = NULL;
 }
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GfxState.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -22,6 +22,8 @@
 class Array;
 class GfxFont;
 class PDFRectangle;
+class GfxDeviceNColorSpace;
+class GfxSeparationColorSpace;
 class GfxShading;
 class GfxState;
 
@@ -80,17 +82,31 @@
 
 static inline GfxColorComp byteToCol(Guchar x) {
   // (x / 255) << 16  =  (0.0000000100000001... * x) << 16
-  //                  =  ((x << 8) + (x) + (x >> 8) + ...) << 16
+  //                  =  ((x << 8) + (x) + (x >> 8) + ...)
   //                  =  (x << 8) + (x) + (x >> 7)
   //                                      [for rounding]
   return (GfxColorComp)((x << 8) + x + (x >> 7));
 }
 
+static inline GfxColorComp wordToCol(Gushort x) {
+  // (x / 65535) << 16  =  (0.0000000000000001... * x) << 16
+  //                    =  x + (x >> 15)
+  //                           [for rounding]
+  return (GfxColorComp)(x + (x >> 15));
+}
+
 static inline Guchar colToByte(GfxColorComp x) {
-  // 255 * x + 0.5  =  256 * x - x + 0x8000
+  // 255 * x + 0.5  =  256 * x - x + 0.5
+  //                =  [256 * (x << 16) - (x << 16) + (1 << 15)] >> 16
   return (Guchar)(((x << 8) - x + 0x8000) >> 16);
 }
 
+static inline Gushort colToWord(GfxColorComp x) {
+  // 65535 * x + 0.5  =  65536 * x - x + 0.5
+  //                  =  [65536 * (x << 16) - (x << 16) + (1 << 15)] >> 16
+  return (Gushort)(((x << 16) - x + 0x8000) >> 16);
+}
+
 //------------------------------------------------------------------------
 // GfxColor
 //------------------------------------------------------------------------
@@ -126,6 +142,7 @@
 
 
 
+
 //------------------------------------------------------------------------
 // GfxColorSpace
 //------------------------------------------------------------------------
@@ -918,7 +935,8 @@
 public:
 
   // Constructor.
-  GfxImageColorMap(int bitsA, Object *decode, GfxColorSpace *colorSpaceA);
+  GfxImageColorMap(int bitsA, Object *decode, GfxColorSpace *colorSpaceA,
+		   int maxAllowedBits = 8);
 
   // Destructor.
   ~GfxImageColorMap();
@@ -1165,6 +1183,7 @@
   void getUserClipBBox(double *xMin, double *yMin, double *xMax, double *yMax);
   double getLineX() { return lineX; }
   double getLineY() { return lineY; }
+  GBool getInCachedT3Char() { return inCachedT3Char; }
 
   // Is there a current point/path?
   GBool isCurPt() { return path->isCurPt(); }
@@ -1260,6 +1279,9 @@
     { lineX = tx; lineY = ty; textTransform(tx, ty, &curX, &curY); }
   void textShift(double tx, double ty);
   void shift(double dx, double dy);
+  
+  // Cached Type 3 char status.
+  void setInCachedT3Char(GBool in) { inCachedT3Char = in; }
 
   // Push/pop GfxState on/off stack.
   GfxState *save();
@@ -1322,6 +1344,8 @@
   double clipXMin, clipYMin,	// bounding box for clip region
          clipXMax, clipYMax;
 
+  GBool inCachedT3Char;		// in a cached (uncolored) Type 3 char
+
   GfxState *saved;		// next GfxState on stack
 
   GfxState(GfxState *state, GBool copyPath);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -34,6 +34,7 @@
 #include "Error.h"
 #include "NameToCharCode.h"
 #include "CharCodeToUnicode.h"
+#include "UnicodeRemapping.h"
 #include "UnicodeMap.h"
 #include "CMap.h"
 #include "BuiltinFontTables.h"
@@ -144,6 +145,8 @@
 
 GlobalParams *globalParams = NULL;
 
+const char *GlobalParams::defaultTextEncoding = "Latin1";
+
 //------------------------------------------------------------------------
 // PSFontParam16
 //------------------------------------------------------------------------
@@ -376,7 +379,8 @@
 	data[dataLen] = '\0';
 	n = (int)strlen(data);
 	if (!strcasecmp(data + n - 4, ".ttf") ||
-	    !strcasecmp(data + n - 4, ".ttc")) {
+	    !strcasecmp(data + n - 4, ".ttc") ||
+	    !strcasecmp(data + n - 4, ".otf")) {
 	  fontPath = new GString(data);
 	  if (!(dataLen >= 3 && data[1] == ':' && data[2] == '\\')) {
 	    fontPath->insert(0, '\\');
@@ -552,6 +556,7 @@
   unicodeMaps = new GHash(gTrue);
   cMapDirs = new GHash(gTrue);
   toUnicodeDirs = new GList();
+  unicodeRemapping = new UnicodeRemapping();
   fontFiles = new GHash(gTrue);
   fontDirs = new GList();
   ccFontFiles = new GHash(gTrue);
@@ -585,7 +590,6 @@
   psCenter = gTrue;
   psDuplex = gFalse;
   psLevel = psLevel2;
-  psFile = NULL;
   psResidentFonts = new GHash(gTrue);
   psResidentFonts16 = new GList();
   psResidentFontsCC = new GList();
@@ -605,7 +609,7 @@
   psRasterSliceSize = 20000000;
   psAlwaysRasterize = gFalse;
   psNeverRasterize = gFalse;
-  textEncoding = new GString("Latin1");
+  textEncoding = new GString(defaultTextEncoding);
 #if defined(_WIN32)
   textEOL = eolDOS;
 #else
@@ -642,12 +646,15 @@
   fullScreenMatteColor = new GString("#000000");
   launchCommand = NULL;
   movieCommand = NULL;
+  defaultPrinter = NULL;
   mapNumericCharNames = gTrue;
   mapUnknownCharNames = gFalse;
   mapExtTrueTypeFontsViaUnicode = gTrue;
+  droppedFonts = new GHash(gTrue);
   enableXFA = gTrue;
   createDefaultKeyBindings();
   popupMenuCmds = new GList();
+  tabStateFile = appendToPath(getHomeDir(), ".xpdf.tab-state");
   printCommands = gFalse;
   errQuiet = gFalse;
 
@@ -925,6 +932,8 @@
       parseCMapDir(tokens, fileName, line);
     } else if (!cmd->cmp("toUnicodeDir")) {
       parseToUnicodeDir(tokens, fileName, line);
+    } else if (!cmd->cmp("unicodeRemapping")) {
+      parseUnicodeRemapping(tokens, fileName, line);
     } else if (!cmd->cmp("fontFile")) {
       parseFontFile(tokens, fileName, line);
     } else if (!cmd->cmp("fontDir")) {
@@ -931,8 +940,6 @@
       parseFontDir(tokens, fileName, line);
     } else if (!cmd->cmp("fontFileCC")) {
       parseFontFileCC(tokens, fileName, line);
-    } else if (!cmd->cmp("psFile")) {
-      parsePSFile(tokens, fileName, line);
     } else if (!cmd->cmp("psPaperSize")) {
       parsePSPaperSize(tokens, fileName, line);
     } else if (!cmd->cmp("psImageableArea")) {
@@ -1002,7 +1009,7 @@
       parseYesNo("psNeverRasterize", &psNeverRasterize,
 		 tokens, fileName, line);
     } else if (!cmd->cmp("textEncoding")) {
-      parseTextEncoding(tokens, fileName, line);
+      parseString("textEncoding", &textEncoding, tokens, fileName, line);
     } else if (!cmd->cmp("textEOL")) {
       parseTextEOL(tokens, fileName, line);
     } else if (!cmd->cmp("textPageBreaks")) {
@@ -1012,7 +1019,7 @@
       parseYesNo("textKeepTinyChars", &textKeepTinyChars,
 		 tokens, fileName, line);
     } else if (!cmd->cmp("initialZoom")) {
-      parseInitialZoom(tokens, fileName, line);
+      parseString("initialZoom", &initialZoom, tokens, fileName, line);
     } else if (!cmd->cmp("defaultFitZoom")) {
       parseInteger("defaultFitZoom", &defaultFitZoom, tokens, fileName, line);
     } else if (!cmd->cmp("initialSidebarState")) {
@@ -1073,16 +1080,18 @@
       parseYesNo("overprintPreview", &overprintPreview,
 		 tokens, fileName, line);
     } else if (!cmd->cmp("paperColor")) {
-      parseColor("paperColor", &paperColor, tokens, fileName, line);
+      parseString("paperColor", &paperColor, tokens, fileName, line);
     } else if (!cmd->cmp("matteColor")) {
-      parseColor("matteColor", &matteColor, tokens, fileName, line);
+      parseString("matteColor", &matteColor, tokens, fileName, line);
     } else if (!cmd->cmp("fullScreenMatteColor")) {
-      parseColor("fullScreenMatteColor", &fullScreenMatteColor,
-		 tokens, fileName, line);
+      parseString("fullScreenMatteColor", &fullScreenMatteColor,
+		  tokens, fileName, line);
     } else if (!cmd->cmp("launchCommand")) {
-      parseCommand("launchCommand", &launchCommand, tokens, fileName, line);
+      parseString("launchCommand", &launchCommand, tokens, fileName, line);
     } else if (!cmd->cmp("movieCommand")) {
-      parseCommand("movieCommand", &movieCommand, tokens, fileName, line);
+      parseString("movieCommand", &movieCommand, tokens, fileName, line);
+    } else if (!cmd->cmp("defaultPrinter")) {
+      parseString("defaultPrinter", &defaultPrinter, tokens, fileName, line);
     } else if (!cmd->cmp("mapNumericCharNames")) {
       parseYesNo("mapNumericCharNames", &mapNumericCharNames,
 		 tokens, fileName, line);
@@ -1093,6 +1102,8 @@
       parseYesNo("mapExtTrueTypeFontsViaUnicode",
 		 &mapExtTrueTypeFontsViaUnicode,
 		 tokens, fileName, line);
+    } else if (!cmd->cmp("dropFont")) {
+      parseDropFont(tokens, fileName, line);
     } else if (!cmd->cmp("enableXFA")) {
       parseYesNo("enableXFA", &enableXFA, tokens, fileName, line);
     } else if (!cmd->cmp("bind")) {
@@ -1101,6 +1112,8 @@
       parseUnbind(tokens, fileName, line);
     } else if (!cmd->cmp("popupMenuCmd")) {
       parsePopupMenuCmd(tokens, fileName, line);
+    } else if (!cmd->cmp("tabStateFile")) {
+      parseString("tabStateFile", &tabStateFile, tokens, fileName, line);
     } else if (!cmd->cmp("printCommands")) {
       parseYesNo("printCommands", &printCommands, tokens, fileName, line);
     } else if (!cmd->cmp("errQuiet")) {
@@ -1245,6 +1258,17 @@
   toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
 }
 
+void GlobalParams::parseUnicodeRemapping(GList *tokens, GString *fileName,
+					 int line) {
+  if (tokens->getLength() != 2) {
+    error(errConfig, -1,
+	  "Bad 'unicodeRemapping' config file command ({0:t}:{1:d})",
+	  fileName, line);
+    return;
+  }
+  unicodeRemapping->parseFile((GString *)tokens->get(1));
+}
+
 void GlobalParams::parseFontFile(GList *tokens, GString *fileName, int line) {
   if (tokens->getLength() != 3) {
     error(errConfig, -1, "Bad 'fontFile' config file command ({0:t}:{1:d})",
@@ -1275,18 +1299,6 @@
 		   ((GString *)tokens->get(2))->copy());
 }
 
-void GlobalParams::parsePSFile(GList *tokens, GString *fileName, int line) {
-  if (tokens->getLength() != 2) {
-    error(errConfig, -1, "Bad 'psFile' config file command ({0:t}:{1:d})",
-	  fileName, line);
-    return;
-  }
-  if (psFile) {
-    delete psFile;
-  }
-  psFile = ((GString *)tokens->get(1))->copy();
-}
-
 void GlobalParams::parsePSPaperSize(GList *tokens, GString *fileName,
 				    int line) {
   GString *tok;
@@ -1424,18 +1436,6 @@
   psResidentFontsCC->append(param);
 }
 
-void GlobalParams::parseTextEncoding(GList *tokens, GString *fileName,
-				     int line) {
-  if (tokens->getLength() != 2) {
-    error(errConfig, -1,
-	  "Bad 'textEncoding' config file command ({0:s}:{1:d})",
-	  fileName, line);
-    return;
-  }
-  delete textEncoding;
-  textEncoding = ((GString *)tokens->get(1))->copy();
-}
-
 void GlobalParams::parseTextEOL(GList *tokens, GString *fileName, int line) {
   GString *tok;
 
@@ -1457,17 +1457,6 @@
   }
 }
 
-void GlobalParams::parseInitialZoom(GList *tokens,
-				    GString *fileName, int line) {
-  if (tokens->getLength() != 2) {
-    error(errConfig, -1, "Bad 'initialZoom' config file command ({0:t}:{1:d})",
-	  fileName, line);
-    return;
-  }
-  delete initialZoom;
-  initialZoom = ((GString *)tokens->get(1))->copy();
-}
-
 void GlobalParams::parseStrokeAdjust(GList *tokens, GString *fileName,
 				     int line) {
   GString *tok;
@@ -1514,6 +1503,14 @@
   }
 }
 
+void GlobalParams::parseDropFont(GList *tokens, GString *fileName, int line) {
+  if (tokens->getLength() != 2) {
+    error(errConfig, -1, "Bad 'dropFont' config file command ({0:t}:{1:d})",
+	  fileName, line);
+    return;
+  }
+  droppedFonts->add(((GString *)tokens->get(1))->copy(), 1);
+}
 
 void GlobalParams::parseBind(GList *tokens, GString *fileName, int line) {
   KeyBinding *binding;
@@ -1735,19 +1732,6 @@
 					 cmds));
 }
 
-void GlobalParams::parseCommand(const char *cmdName, GString **val,
-				GList *tokens, GString *fileName, int line) {
-  if (tokens->getLength() != 2) {
-    error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})",
-	  cmdName, fileName, line);
-    return;
-  }
-  if (*val) {
-    delete *val;
-  }
-  *val = ((GString *)tokens->get(1))->copy();
-}
-
 void GlobalParams::parseYesNo(const char *cmdName, GBool *flag,
 			      GList *tokens, GString *fileName, int line) {
   GString *tok;
@@ -1775,17 +1759,17 @@
   return gTrue;
 }
 
-void GlobalParams::parseColor(const char *cmdName, GString **val,
-			      GList *tokens, GString *fileName, int line) {
+void GlobalParams::parseString(const char *cmdName, GString **s,
+			       GList *tokens, GString *fileName, int line) {
   if (tokens->getLength() != 2) {
     error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})",
 	  cmdName, fileName, line);
     return;
   }
-  if (*val) {
-    delete *val;
+  if (*s) {
+    delete *s;
   }
-  *val = ((GString *)tokens->get(1))->copy();
+  *s = ((GString *)tokens->get(1))->copy();
 }
 
 void GlobalParams::parseInteger(const char *cmdName, int *val,
@@ -1867,14 +1851,12 @@
   deleteGHash(residentUnicodeMaps, UnicodeMap);
   deleteGHash(unicodeMaps, GString);
   deleteGList(toUnicodeDirs, GString);
+  delete unicodeRemapping;
   deleteGHash(fontFiles, GString);
   deleteGList(fontDirs, GString);
   deleteGHash(ccFontFiles, GString);
   deleteGHash(base14SysFonts, Base14FontInfo);
   delete sysFonts;
-  if (psFile) {
-    delete psFile;
-  }
   deleteGHash(psResidentFonts, GString);
   deleteGList(psResidentFonts16, PSFontParam16);
   deleteGList(psResidentFontsCC, PSFontParam16);
@@ -1895,8 +1877,13 @@
   if (movieCommand) {
     delete movieCommand;
   }
+  if (defaultPrinter) {
+    delete defaultPrinter;
+  }
+  delete droppedFonts;
   deleteGList(keyBindings, KeyBinding);
   deleteGList(popupMenuCmds, PopupMenuCmd);
+  delete tabStateFile;
 
   cMapDirs->startIter(&iter);
   while (cMapDirs->getNext(&iter, &key, (void **)&list)) {
@@ -2224,8 +2211,12 @@
   return NULL;
 }
 
+UnicodeRemapping *GlobalParams::getUnicodeRemapping() {
+  return unicodeRemapping;
+}
+
 GString *GlobalParams::findFontFile(GString *fontName) {
-  static const char *exts[] = { ".pfa", ".pfb", ".ttf", ".ttc" };
+  static const char *exts[] = { ".pfa", ".pfb", ".ttf", ".ttc", ".otf" };
   GString *path, *dir;
 #ifdef _WIN32
   GString *fontNameU;
@@ -2311,15 +2302,6 @@
   return path;
 }
 
-GString *GlobalParams::getPSFile() {
-  GString *s;
-
-  lockGlobalParams;
-  s = psFile ? psFile->copy() : (GString *)NULL;
-  unlockGlobalParams;
-  return s;
-}
-
 int GlobalParams::getPSPaperWidth() {
   int w;
 
@@ -2890,6 +2872,15 @@
   return s;
 }
 
+GString *GlobalParams::getDefaultPrinter() {
+  GString *s;
+
+  lockGlobalParams;
+  s = defaultPrinter ? defaultPrinter->copy() : (GString *)NULL;
+  unlockGlobalParams;
+  return s;
+}
+
 GBool GlobalParams::getMapNumericCharNames() {
   GBool map;
 
@@ -2917,6 +2908,15 @@
   return map;
 }
 
+GBool GlobalParams::isDroppedFont(const char *fontName) {
+  GBool isDropped;
+
+  lockGlobalParams;
+  isDropped = droppedFonts->lookupInt(fontName) != 0;
+  unlockGlobalParams;
+  return isDropped;
+}
+
 GBool GlobalParams::getEnableXFA() {
   GBool enable;
 
@@ -2974,6 +2974,15 @@
   return cmd;
 }
 
+GString *GlobalParams::getTabStateFile() {
+  GString *s;
+
+  lockGlobalParams;
+  s = tabStateFile->copy();
+  unlockGlobalParams;
+  return s;
+}
+
 GBool GlobalParams::getPrintCommands() {
   GBool p;
 
@@ -3064,6 +3073,10 @@
 // functions to set parameters
 //------------------------------------------------------------------------
 
+void GlobalParams::addUnicodeRemapping(Unicode in, Unicode *out, int len) {
+  unicodeRemapping->addRemapping(in, out, len);
+}
+
 void GlobalParams::addFontFile(GString *fontName, GString *path) {
   lockGlobalParams;
   fontFiles->add(fontName, path);
@@ -3070,15 +3083,6 @@
   unlockGlobalParams;
 }
 
-void GlobalParams::setPSFile(char *file) {
-  lockGlobalParams;
-  if (psFile) {
-    delete psFile;
-  }
-  psFile = new GString(file);
-  unlockGlobalParams;
-}
-
 GBool GlobalParams::setPSPaperSize(char *size) {
   lockGlobalParams;
   if (!strcmp(size, "match")) {
@@ -3365,6 +3369,13 @@
   unlockGlobalParams;
 }
 
+void GlobalParams::setTabStateFile(char *tabStateFileA) {
+  lockGlobalParams;
+  delete tabStateFile;
+  tabStateFile = new GString(tabStateFileA);
+  unlockGlobalParams;
+}
+
 void GlobalParams::setPrintCommands(GBool printCommandsA) {
   lockGlobalParams;
   printCommands = printCommandsA;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/GlobalParams.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -37,6 +37,7 @@
 class CharCodeToUnicodeCache;
 class UnicodeMap;
 class UnicodeMapCache;
+class UnicodeRemapping;
 class CMap;
 class CMapCache;
 struct XpdfSecurityHandler;
@@ -239,6 +240,7 @@
   FILE *getUnicodeMapFile(GString *encodingName);
   FILE *findCMapFile(GString *collection, GString *cMapName);
   FILE *findToUnicodeFile(GString *name);
+  UnicodeRemapping *getUnicodeRemapping();
   GString *findFontFile(GString *fontName);
   GString *findBase14FontFile(GString *fontName, int *fontNum,
 			      double *oblique);
@@ -245,7 +247,6 @@
   GString *findSystemFontFile(GString *fontName, SysFontType *type,
 			      int *fontNum);
   GString *findCCFontFile(GString *collection);
-  GString *getPSFile();
   int getPSPaperWidth();
   int getPSPaperHeight();
   void getPSImageableArea(int *llx, int *lly, int *urx, int *ury);
@@ -309,13 +310,16 @@
   GString *getFullScreenMatteColor();
   GString *getLaunchCommand() { return launchCommand; }
   GString *getMovieCommand() { return movieCommand; }
+  GString *getDefaultPrinter();
   GBool getMapNumericCharNames();
   GBool getMapUnknownCharNames();
   GBool getMapExtTrueTypeFontsViaUnicode();
+  GBool isDroppedFont(const char *fontName);
   GBool getEnableXFA();
   GList *getKeyBinding(int code, int mods, int context);
   int getNumPopupMenuCmds();
   PopupMenuCmd *getPopupMenuCmd(int idx);
+  GString *getTabStateFile();
   GBool getPrintCommands();
   GBool getErrQuiet();
 
@@ -327,8 +331,8 @@
 
   //----- functions to set parameters
 
+  void addUnicodeRemapping(Unicode in, Unicode *out, int len);
   void addFontFile(GString *fontName, GString *path);
-  void setPSFile(char *file);
   GBool setPSPaperSize(char *size);
   void setPSPaperWidth(int width);
   void setPSPaperHeight(int height);
@@ -368,6 +372,7 @@
   void setMapUnknownCharNames(GBool map);
   void setMapExtTrueTypeFontsViaUnicode(GBool map);
   void setEnableXFA(GBool enable);
+  void setTabStateFile(char *tabStateFileA);
   void setPrintCommands(GBool printCommandsA);
   void setErrQuiet(GBool errQuietA);
 
@@ -376,6 +381,8 @@
   XpdfWin32ErrorInfo *getWin32ErrorInfo();
 #endif
 
+  static const char *defaultTextEncoding;
+
 private:
 
   void createDefaultKeyBindings();
@@ -386,11 +393,11 @@
   void parseUnicodeMap(GList *tokens, GString *fileName, int line);
   void parseCMapDir(GList *tokens, GString *fileName, int line);
   void parseToUnicodeDir(GList *tokens, GString *fileName, int line);
+  void parseUnicodeRemapping(GList *tokens, GString *fileName, int line);
   void parseFontFile(GList *tokens, GString *fileName, int line);
   void parseFontDir(GList *tokens, GString *fileName, int line);
   void parseFontFileCC(GList *tokens, GString *fileName,
 		       int line);
-  void parsePSFile(GList *tokens, GString *fileName, int line);
   void parsePSPaperSize(GList *tokens, GString *fileName, int line);
   void parsePSImageableArea(GList *tokens, GString *fileName, int line);
   void parsePSLevel(GList *tokens, GString *fileName, int line);
@@ -397,11 +404,10 @@
   void parsePSResidentFont(GList *tokens, GString *fileName, int line);
   void parsePSResidentFont16(GList *tokens, GString *fileName, int line);
   void parsePSResidentFontCC(GList *tokens, GString *fileName, int line);
-  void parseTextEncoding(GList *tokens, GString *fileName, int line);
   void parseTextEOL(GList *tokens, GString *fileName, int line);
-  void parseInitialZoom(GList *tokens, GString *fileName, int line);
   void parseStrokeAdjust(GList *tokens, GString *fileName, int line);
   void parseScreenType(GList *tokens, GString *fileName, int line);
+  void parseDropFont(GList *tokens, GString *fileName, int line);
   void parseBind(GList *tokens, GString *fileName, int line);
   void parseUnbind(GList *tokens, GString *fileName, int line);
   GBool parseKey(GString *modKeyStr, GString *contextStr,
@@ -409,13 +415,11 @@
 		 const char *cmdName,
 		 GList *tokens, GString *fileName, int line);
   void parsePopupMenuCmd(GList *tokens, GString *fileName, int line);
-  void parseCommand(const char *cmdName, GString **val,
-		    GList *tokens, GString *fileName, int line);
   void parseYesNo(const char *cmdName, GBool *flag,
 		  GList *tokens, GString *fileName, int line);
   GBool parseYesNo2(char *token, GBool *flag);
-  void parseColor(const char *cmdName, GString **val,
-		  GList *tokens, GString *fileName, int line);
+  void parseString(const char *cmdName, GString **s,
+		   GList *tokens, GString *fileName, int line);
   void parseInteger(const char *cmdName, int *val,
 		    GList *tokens, GString *fileName, int line);
   void parseFloat(const char *cmdName, double *val,
@@ -444,6 +448,8 @@
   GHash *cMapDirs;		// list of CMap dirs, indexed by collection
 				//   name [GList[GString]]
   GList *toUnicodeDirs;		// list of ToUnicode CMap dirs [GString]
+  UnicodeRemapping *		// Unicode remapping for text output
+    unicodeRemapping;
   GHash *fontFiles;		// font files: font name mapped to path
 				//   [GString]
   GList *fontDirs;		// list of font dirs [GString]
@@ -452,7 +458,6 @@
   GHash *base14SysFonts;	// Base-14 system font files: font name
 				//   mapped to path [Base14FontInfo]
   SysFontList *sysFonts;	// system fonts
-  GString *psFile;		// PostScript file or command (for xpdf)
   int psPaperWidth;		// paper size, in PostScript points, for
   int psPaperHeight;		//   PostScript output
   int psImageableLLX,		// imageable area, in PostScript points,
@@ -533,13 +538,17 @@
   GString *fullScreenMatteColor; // matte color in full-screen mode
   GString *launchCommand;	// command executed for 'launch' links
   GString *movieCommand;	// command executed for movie annotations
+  GString *defaultPrinter;	// default printer (for interactive printing
+				//   from the viewer)
   GBool mapNumericCharNames;	// map numeric char names (from font subsets)?
   GBool mapUnknownCharNames;	// map unknown char names?
   GBool mapExtTrueTypeFontsViaUnicode;  // map char codes to GID via Unicode
 				        //   for external TrueType fonts?
+  GHash *droppedFonts;		// dropped fonts [int]
   GBool enableXFA;		// enable XFA form rendering
   GList *keyBindings;		// key & mouse button bindings [KeyBinding]
   GList *popupMenuCmds;		// popup menu commands [PopupMenuCmd]
+  GString *tabStateFile;	// path for the tab state save file
   GBool printCommands;		// print the drawing commands
   GBool errQuiet;		// suppress error messages?
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/HTMLGen.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -292,8 +292,13 @@
   png_destroy_write_struct(&png, &pngInfo);
 
   // page size
-  pageW = doc->getPageCropWidth(pg);
-  pageH = doc->getPageCropHeight(pg);
+  if (doc->getPageRotate(pg) == 90 || doc->getPageRotate(pg) == 270) {
+    pageW = doc->getPageCropHeight(pg);
+    pageH = doc->getPageCropWidth(pg);
+  } else {
+    pageW = doc->getPageCropWidth(pg);
+    pageH = doc->getPageCropHeight(pg);
+  }
 
   // get the PDF text
   doc->displayPage(textOut, pg, 72, 72, 0, gFalse, gTrue, gFalse);
@@ -563,27 +568,27 @@
     s->append((char)(0xc0 + (u >> 6)));
     s->append((char)(0x80 + (u & 0x3f)));
   } else if (u <= 0xffff) {
-    s->append((char)0xe0 + (u >> 12));
-    s->append((char)0x80 + ((u >> 6) & 0x3f));
-    s->append((char)0x80 + (u & 0x3f));
+    s->append((char)(0xe0 + (u >> 12)));
+    s->append((char)(0x80 + ((u >> 6) & 0x3f)));
+    s->append((char)(0x80 + (u & 0x3f)));
   } else if (u <= 0x1fffff) {
-    s->append((char)0xf0 + (u >> 18));
-    s->append((char)0x80 + ((u >> 12) & 0x3f));
-    s->append((char)0x80 + ((u >> 6) & 0x3f));
-    s->append((char)0x80 + (u & 0x3f));
+    s->append((char)(0xf0 + (u >> 18)));
+    s->append((char)(0x80 + ((u >> 12) & 0x3f)));
+    s->append((char)(0x80 + ((u >> 6) & 0x3f)));
+    s->append((char)(0x80 + (u & 0x3f)));
   } else if (u <= 0x3ffffff) {
-    s->append((char)0xf8 + (u >> 24));
-    s->append((char)0x80 + ((u >> 18) & 0x3f));
-    s->append((char)0x80 + ((u >> 12) & 0x3f));
-    s->append((char)0x80 + ((u >> 6) & 0x3f));
-    s->append((char)0x80 + (u & 0x3f));
+    s->append((char)(0xf8 + (u >> 24)));
+    s->append((char)(0x80 + ((u >> 18) & 0x3f)));
+    s->append((char)(0x80 + ((u >> 12) & 0x3f)));
+    s->append((char)(0x80 + ((u >> 6) & 0x3f)));
+    s->append((char)(0x80 + (u & 0x3f)));
   } else if (u <= 0x7fffffff) {
-    s->append((char)0xfc + (u >> 30));
-    s->append((char)0x80 + ((u >> 24) & 0x3f));
-    s->append((char)0x80 + ((u >> 18) & 0x3f));
-    s->append((char)0x80 + ((u >> 12) & 0x3f));
-    s->append((char)0x80 + ((u >> 6) & 0x3f));
-    s->append((char)0x80 + (u & 0x3f));
+    s->append((char)(0xfc + (u >> 30)));
+    s->append((char)(0x80 + ((u >> 24) & 0x3f)));
+    s->append((char)(0x80 + ((u >> 18) & 0x3f)));
+    s->append((char)(0x80 + ((u >> 12) & 0x3f)));
+    s->append((char)(0x80 + ((u >> 6) & 0x3f)));
+    s->append((char)(0x80 + (u & 0x3f)));
   }
 }
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/ImageOutputDev.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -242,7 +242,7 @@
       i = size < (int)sizeof(buf) ? size : (int)sizeof(buf);
       n = str->getBlock(buf, i);
       for (j = 0; j < n; ++j) {
-	buf[j] ^= 0xff;
+	buf[j] = (char)(buf[j] ^ 0xff);
       }
       fwrite(buf, 1, n, f);
       if (n < i) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JArithmeticDecoder.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -48,7 +48,7 @@
 }
 
 void JArithmeticDecoderStats::setEntry(Guint cx, int i, int mps) {
-  cxTab[cx] = (i << 1) + mps;
+  cxTab[cx] = (Guchar)((i << 1) + mps);
 }
 
 //------------------------------------------------------------------------
@@ -202,13 +202,13 @@
       if (a < qe) {
 	bit = 1 - mpsCX;
 	if (switchTab[iCX]) {
-	  stats->cxTab[context] = (nlpsTab[iCX] << 1) | (1 - mpsCX);
+	  stats->cxTab[context] = (Guchar)((nlpsTab[iCX] << 1) | (1 - mpsCX));
 	} else {
-	  stats->cxTab[context] = (nlpsTab[iCX] << 1) | mpsCX;
+	  stats->cxTab[context] = (Guchar)((nlpsTab[iCX] << 1) | mpsCX);
 	}
       } else {
 	bit = mpsCX;
-	stats->cxTab[context] = (nmpsTab[iCX] << 1) | mpsCX;
+	stats->cxTab[context] = (Guchar)((nmpsTab[iCX] << 1) | mpsCX);
       }
       // RENORMD
       do {
@@ -225,13 +225,13 @@
     // LPS_EXCHANGE
     if (a < qe) {
       bit = mpsCX;
-      stats->cxTab[context] = (nmpsTab[iCX] << 1) | mpsCX;
+      stats->cxTab[context] = (Guchar)((nmpsTab[iCX] << 1) | mpsCX);
     } else {
       bit = 1 - mpsCX;
       if (switchTab[iCX]) {
-	stats->cxTab[context] = (nlpsTab[iCX] << 1) | (1 - mpsCX);
+	stats->cxTab[context] = (Guchar)((nlpsTab[iCX] << 1) | (1 - mpsCX));
       } else {
-	stats->cxTab[context] = (nlpsTab[iCX] << 1) | mpsCX;
+	stats->cxTab[context] = (Guchar)((nlpsTab[iCX] << 1) | mpsCX);
       }
     }
     a = qe;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JBIG2Stream.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -494,8 +494,8 @@
     ++nBytesRead;
     ++byteCounter;
     p = &twoDimTab1[(buf >> 1) & 0x7f];
-  } else if (bufLen == 8) {
-    p = &twoDimTab1[(buf >> 1) & 0x7f];
+  } else if (bufLen >= 7) {
+    p = &twoDimTab1[(buf >> (bufLen - 7)) & 0x7f];
   } else {
     p = &twoDimTab1[(buf << (7 - bufLen)) & 0x7f];
     if (p->bits < 0 || p->bits > (int)bufLen) {
@@ -684,9 +684,9 @@
     { return (x < 0 || x >= w || y < 0 || y >= h) ? 0 :
              (data[y * line + (x >> 3)] >> (7 - (x & 7))) & 1; }
   void setPixel(int x, int y)
-    { data[y * line + (x >> 3)] |= 1 << (7 - (x & 7)); }
+    { data[y * line + (x >> 3)] |= (Guchar)(1 << (7 - (x & 7))); }
   void clearPixel(int x, int y)
-    { data[y * line + (x >> 3)] &= 0x7f7f >> (x & 7); }
+    { data[y * line + (x >> 3)] &= (Guchar)(0x7f7f >> (x & 7)); }
   void getPixelPtr(int x, int y, JBIG2BitmapPtr *ptr);
   int nextPixel(JBIG2BitmapPtr *ptr);
   void duplicateRow(int yDest, int ySrc);
@@ -825,7 +825,8 @@
 			  Guint combOp) {
   int x0, x1, y0, y1, xx, yy;
   Guchar *srcPtr, *destPtr;
-  Guint src0, src1, src, dest, s1, s2, m1, m2, m3;
+  Guchar dest, src0, src1, src, m1, m2, m3;
+  Guint s1, s2;
   GBool oneByte;
 
   // check for the pathological case where y = -2^31
@@ -861,9 +862,9 @@
 
   s1 = x & 7;
   s2 = 8 - s1;
-  m1 = 0xff >> (x1 & 7);
-  m2 = 0xff << (((x1 & 7) == 0) ? 0 : 8 - (x1 & 7));
-  m3 = (0xff >> s1) & m2;
+  m1 = (Guchar)(0xff >> (x1 & 7));
+  m2 = (Guchar)(0xff << (((x1 & 7) == 0) ? 0 : 8 - (x1 & 7)));
+  m3 = (Guchar)((0xff >> s1) & m2);
 
   oneByte = x0 == ((x1 - 1) & ~7);
 
@@ -878,19 +879,19 @@
 	src1 = *srcPtr;
 	switch (combOp) {
 	case 0: // or
-	  dest |= (src1 >> s1) & m2;
+	  dest |= (Guchar)((src1 >> s1) & m2);
 	  break;
 	case 1: // and
-	  dest &= ((0xff00 | src1) >> s1) | m1;
+	  dest &= (Guchar)(((0xff00 | src1) >> s1) | m1);
 	  break;
 	case 2: // xor
-	  dest ^= (src1 >> s1) & m2;
+	  dest ^= (Guchar)((src1 >> s1) & m2);
 	  break;
 	case 3: // xnor
-	  dest ^= ((src1 ^ 0xff) >> s1) & m2;
+	  dest ^= (Guchar)(((src1 ^ 0xff) >> s1) & m2);
 	  break;
 	case 4: // replace
-	  dest = (dest & ~m3) | ((src1 >> s1) & m3);
+	  dest = (Guchar)((dest & ~m3) | ((src1 >> s1) & m3));
 	  break;
 	}
 	*destPtr = dest;
@@ -931,19 +932,19 @@
 	dest = *destPtr;
 	switch (combOp) {
 	case 0: // or
-	  dest |= src1 >> s1;
+	  dest |= (Guchar)(src1 >> s1);
 	  break;
 	case 1: // and
-	  dest &= (0xff00 | src1) >> s1;
+	  dest &= (Guchar)((0xff00 | src1) >> s1);
 	  break;
 	case 2: // xor
-	  dest ^= src1 >> s1;
+	  dest ^= (Guchar)(src1 >> s1);
 	  break;
 	case 3: // xnor
-	  dest ^= (src1 ^ 0xff) >> s1;
+	  dest ^= (Guchar)((src1 ^ 0xff) >> s1);
 	  break;
 	case 4: // replace
-	  dest = (dest & (0xff << s2)) | (src1 >> s1);
+	  dest = (Guchar)((dest & (0xff << s2)) | (src1 >> s1));
 	  break;
 	}
 	*destPtr++ = dest;
@@ -960,7 +961,7 @@
 	dest = *destPtr;
 	src0 = src1;
 	src1 = *srcPtr++;
-	src = (((src0 << 8) | src1) >> s1) & 0xff;
+	src = (Guchar)(((src0 << 8) | src1) >> s1);
 	switch (combOp) {
 	case 0: // or
 	  dest |= src;
@@ -989,7 +990,7 @@
       dest = *destPtr;
       src0 = src1;
       src1 = *srcPtr++;
-      src = (((src0 << 8) | src1) >> s1) & 0xff;
+      src = (Guchar)(((src0 << 8) | src1) >> s1);
       switch (combOp) {
       case 0: // or
 	dest |= src & m2;
@@ -1712,6 +1713,12 @@
 	    "Bad delta-height value in JBIG2 symbol dictionary");
       goto syntaxError;
     }
+    // sanity check to avoid extremely long run-times with damaged streams
+    if (dh > 1000000) {
+      error(errSyntaxError, getPos(),
+	    "Bogus delta-height value in JBIG2 symbol dictionary");
+      goto syntaxError;
+    }
     symHeight += dh;
     symWidth = 0;
     totalWidth = 0;
@@ -2814,17 +2821,17 @@
   if (mmr) {
 
     mmrDecoder->reset();
-    if (w > INT_MAX - 2) {
+    if (w > INT_MAX - 3) {
       error(errSyntaxError, getPos(), "Bad width in JBIG2 generic bitmap");
       // force a call to gmalloc(-1), which will throw an exception
-      w = -3;
+      w = -4;
     }
     // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = w
     // ---> max codingLine size = w + 1
-    // refLine has one extra guard entry at the end
-    // ---> max refLine size = w + 2
+    // refLine has two extra guard entries at the end
+    // ---> max refLine size = w + 3
     codingLine = (int *)gmallocn(w + 1, sizeof(int));
-    refLine = (int *)gmallocn(w + 2, sizeof(int));
+    refLine = (int *)gmallocn(w + 3, sizeof(int));
     codingLine[0] = w;
 
     for (y = 0; y < h; ++y) {
@@ -2834,6 +2841,7 @@
 	refLine[i] = codingLine[i];
       }
       refLine[i++] = w;
+      refLine[i++] = w;
       refLine[i] = w;
 
       // decode a line
@@ -3125,7 +3133,9 @@
 		atBuf3 |= *atP3++;
 	      }
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx0 = (buf0 >> 14) & 0x07;
@@ -3182,7 +3192,9 @@
 	      }
 	      buf2 |= *p2++;
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx0 = (buf0 >> 14) & 0x07;
@@ -3258,7 +3270,9 @@
 		atBuf0 |= *atP0++;
 	      }
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx0 = (buf0 >> 13) & 0x0f;
@@ -3300,7 +3314,9 @@
 	      }
 	      buf2 |= *p2++;
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx0 = (buf0 >> 13) & 0x0f;
@@ -3373,7 +3389,9 @@
 		atBuf0 |= *atP0++;
 	      }
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx0 = (buf0 >> 14) & 0x07;
@@ -3415,7 +3433,9 @@
 	      }
 	      buf2 |= *p2++;
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx0 = (buf0 >> 14) & 0x07;
@@ -3478,7 +3498,9 @@
 		atBuf0 |= *atP0++;
 	      }
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx1 = (buf1 >> 14) & 0x1f;
@@ -3515,7 +3537,9 @@
 	      }
 	      buf2 |= *p2++;
 	    }
-	    for (x1 = 0, mask = 0x80; x1 < 8 && x < w; ++x1, ++x, mask >>= 1) {
+	    for (x1 = 0, mask = 0x80;
+		 x1 < 8 && x < w;
+		 ++x1, ++x, mask = (Guchar)(mask >> 1)) {
 
 	      // build the context
 	      cx1 = (buf1 >> 14) & 0x1f;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/JPXStream.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -230,7 +230,7 @@
 JPXStream::JPXStream(Stream *strA):
   FilterStream(strA)
 {
-  bufStr = new BufStream(str, 2);
+  bufStr = new BufStream(str, 3);
 
   nComps = 0;
   bpc = NULL;
@@ -270,10 +270,11 @@
 }
 
 void JPXStream::reset() {
+  img.ySize = 0;
   bufStr->reset();
   if (readBoxes() == jpxDecodeFatalError) {
     // readBoxes reported an error, so we go immediately to EOF
-    curY = img.ySizeR;
+    curY = img.ySize >> reduction;
   } else {
     curY = img.yOffsetR;
   }
@@ -420,8 +421,12 @@
 #else
     tileComp = &img.tiles[tileIdx].tileComps[havePalette ? 0 : curComp];
 #endif
-    tx = jpxCeilDiv((curX - img.xTileOffsetR) % img.xTileSizeR, tileComp->hSep);
-    ty = jpxCeilDiv((curY - img.yTileOffsetR) % img.yTileSizeR, tileComp->vSep);
+    //~ can curX/curY be less than x/yTileOffsetR?
+    //~ if yes, we need to use tx = max(0, ....)
+    tx = jpxFloorDiv((curX - img.xTileOffsetR) % img.xTileSizeR,
+		     tileComp->hSep);
+    ty = jpxFloorDiv((curY - img.yTileOffsetR) % img.yTileSizeR,
+		     tileComp->vSep);
     pix = (int)tileComp->data[ty * tileComp->w + tx];
     pixBits = tileComp->prec;
     eol = gFalse;
@@ -589,7 +594,7 @@
   JPXDecodeResult result;
   GBool haveCodestream;
   Guint boxType, boxLen, dataLen;
-  Guint bpc1, compression, unknownColorspace, ipr;
+  Guint w, h, n, bpc1, compression, unknownColorspace, ipr;
   Guint i, j;
 
   haveImgHdr = gFalse;
@@ -627,9 +632,9 @@
       break;
     case 0x69686472:		// image header
       cover(9);
-      if (!readULong(&height) ||
-	  !readULong(&width) ||
-	  !readUWord(&nComps) ||
+      if (!readULong(&h) ||
+	  !readULong(&w) ||
+	  !readUWord(&n) ||
 	  !readUByte(&bpc1) ||
 	  !readUByte(&compression) ||
 	  !readUByte(&unknownColorspace) ||
@@ -642,6 +647,9 @@
 	      "Unknown compression type in JPX stream");
 	return jpxDecodeFatalError;
       }
+      height = h;
+      width = w;
+      nComps = n;
       bpc = (Guint *)gmallocn(nComps, sizeof(Guint));
       for (i = 0; i < nComps; ++i) {
 	bpc[i] = bpc1;
@@ -895,7 +903,9 @@
   JPXTileComp *tileComp;
   int segType;
   GBool haveSIZ, haveCOD, haveQCD, haveSOT, ok;
-  Guint precinctSize, style;
+  Guint style, progOrder, nLayers, multiComp, nDecompLevels;
+  Guint codeBlockW, codeBlockH, codeBlockStyle, transform;
+  Guint precinctSize;
   Guint segLen, capabilities, comp, i, j, r;
 
   //----- main header
@@ -941,7 +951,8 @@
 	  img.xTileOffset > img.xOffset ||
 	  img.yTileOffset > img.yOffset ||
 	  img.xTileSize + img.xTileOffset <= img.xOffset ||
-	  img.yTileSize + img.yTileOffset <= img.yOffset) {
+	  img.yTileSize + img.yTileOffset <= img.yOffset ||
+	  img.nComps == 0) {
 	error(errSyntaxError, getPos(), "Error in JPX SIZ marker segment");
 	return jpxDecodeFatalError;
       }
@@ -1010,65 +1021,54 @@
 	      "JPX COD marker segment before SIZ segment");
 	return jpxDecodeFatalError;
       }
-      if (!readUByte(&img.tiles[0].tileComps[0].style) ||
-	  !readUByte(&img.tiles[0].progOrder) ||
-	  !readUWord(&img.tiles[0].nLayers) ||
-	  !readUByte(&img.tiles[0].multiComp) ||
-	  !readUByte(&img.tiles[0].tileComps[0].nDecompLevels) ||
-	  !readUByte(&img.tiles[0].tileComps[0].codeBlockW) ||
-	  !readUByte(&img.tiles[0].tileComps[0].codeBlockH) ||
-	  !readUByte(&img.tiles[0].tileComps[0].codeBlockStyle) ||
-	  !readUByte(&img.tiles[0].tileComps[0].transform)) {
+      if (!readUByte(&style) ||
+	  !readUByte(&progOrder) ||
+	  !readUWord(&nLayers) ||
+	  !readUByte(&multiComp) ||
+	  !readUByte(&nDecompLevels) ||
+	  !readUByte(&codeBlockW) ||
+	  !readUByte(&codeBlockH) ||
+	  !readUByte(&codeBlockStyle) ||
+	  !readUByte(&transform)) {
 	error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	return jpxDecodeFatalError;
       }
-      if (img.tiles[0].tileComps[0].nDecompLevels > 32 ||
-	  img.tiles[0].tileComps[0].codeBlockW > 8 ||
-	  img.tiles[0].tileComps[0].codeBlockH > 8) {
+      if (nDecompLevels < 1 ||
+	  nDecompLevels > 31 ||
+	  codeBlockW > 8 ||
+	  codeBlockH > 8) {
 	error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	return jpxDecodeFatalError;
       }
 #if 1 //~ progression orders 2-4 are unimplemented
-      if (img.tiles[0].progOrder >= 2) {
+      if (progOrder >= 2) {
 	error(errUnimplemented, -1,
 	      "JPX progression order {0:d} is unimplemented",
-	      img.tiles[0].progOrder);
+	      progOrder);
       }
 #endif
-      img.tiles[0].tileComps[0].codeBlockW += 2;
-      img.tiles[0].tileComps[0].codeBlockH += 2;
+      codeBlockW += 2;
+      codeBlockH += 2;
       for (i = 0; i < img.nXTiles * img.nYTiles; ++i) {
-	if (i != 0) {
-	  img.tiles[i].progOrder = img.tiles[0].progOrder;
-	  img.tiles[i].nLayers = img.tiles[0].nLayers;
-	  img.tiles[i].multiComp = img.tiles[0].multiComp;
-	}
+	img.tiles[i].progOrder = progOrder;
+	img.tiles[i].nLayers = nLayers;
+	img.tiles[i].multiComp = multiComp;
 	for (comp = 0; comp < img.nComps; ++comp) {
-	  if (!(i == 0 && comp == 0)) {
-	    img.tiles[i].tileComps[comp].style =
-	        img.tiles[0].tileComps[0].style;
-	    img.tiles[i].tileComps[comp].nDecompLevels =
-	        img.tiles[0].tileComps[0].nDecompLevels;
-	    img.tiles[i].tileComps[comp].codeBlockW =
-	        img.tiles[0].tileComps[0].codeBlockW;
-	    img.tiles[i].tileComps[comp].codeBlockH =
-	        img.tiles[0].tileComps[0].codeBlockH;
-	    img.tiles[i].tileComps[comp].codeBlockStyle =
-	        img.tiles[0].tileComps[0].codeBlockStyle;
-	    img.tiles[i].tileComps[comp].transform =
-	        img.tiles[0].tileComps[0].transform;
-	  }
+	  img.tiles[i].tileComps[comp].style = style;
+	  img.tiles[i].tileComps[comp].nDecompLevels = nDecompLevels;
+	  img.tiles[i].tileComps[comp].codeBlockW = codeBlockW;
+	  img.tiles[i].tileComps[comp].codeBlockH = codeBlockH;
+	  img.tiles[i].tileComps[comp].codeBlockStyle = codeBlockStyle;
+	  img.tiles[i].tileComps[comp].transform = transform;
 	  img.tiles[i].tileComps[comp].resLevels =
-	      (JPXResLevel *)gmallocn(
-		     (img.tiles[i].tileComps[comp].nDecompLevels + 1),
-		     sizeof(JPXResLevel));
-	  for (r = 0; r <= img.tiles[i].tileComps[comp].nDecompLevels; ++r) {
+	      (JPXResLevel *)gmallocn(nDecompLevels + 1, sizeof(JPXResLevel));
+	  for (r = 0; r <= nDecompLevels; ++r) {
 	    img.tiles[i].tileComps[comp].resLevels[r].precincts = NULL;
 	  }
 	}
       }
-      for (r = 0; r <= img.tiles[0].tileComps[0].nDecompLevels; ++r) {
-	if (img.tiles[0].tileComps[0].style & 0x01) {
+      for (r = 0; r <= nDecompLevels; ++r) {
+	if (style & 0x01) {
 	  cover(91);
 	  if (!readUByte(&precinctSize)) {
 	    error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
@@ -1086,7 +1086,7 @@
       for (i = 0; i < img.nXTiles * img.nYTiles; ++i) {
 	for (comp = 0; comp < img.nComps; ++comp) {
 	  if (!(i == 0 && comp == 0)) {
-	    for (r = 0; r <= img.tiles[i].tileComps[comp].nDecompLevels; ++r) {
+	    for (r = 0; r <= nDecompLevels; ++r) {
 	      img.tiles[i].tileComps[comp].resLevels[r].precinctWidth =
 		  img.tiles[0].tileComps[0].resLevels[r].precinctWidth;
 	      img.tiles[i].tileComps[comp].resLevels[r].precinctHeight =
@@ -1108,50 +1108,42 @@
 	  (img.nComps <= 256 && !readUByte(&comp)) ||
 	  comp >= img.nComps ||
 	  !readUByte(&style) ||
-	  !readUByte(&img.tiles[0].tileComps[comp].nDecompLevels) ||
-	  !readUByte(&img.tiles[0].tileComps[comp].codeBlockW) ||
-	  !readUByte(&img.tiles[0].tileComps[comp].codeBlockH) ||
-	  !readUByte(&img.tiles[0].tileComps[comp].codeBlockStyle) ||
-	  !readUByte(&img.tiles[0].tileComps[comp].transform)) {
+	  !readUByte(&nDecompLevels) ||
+	  !readUByte(&codeBlockW) ||
+	  !readUByte(&codeBlockH) ||
+	  !readUByte(&codeBlockStyle) ||
+	  !readUByte(&transform)) {
 	error(errSyntaxError, getPos(), "Error in JPX COC marker segment");
 	return jpxDecodeFatalError;
       }
-      if (img.tiles[0].tileComps[comp].nDecompLevels > 32 ||
-	  img.tiles[0].tileComps[comp].codeBlockW > 8 ||
-	  img.tiles[0].tileComps[comp].codeBlockH > 8) {
+      if (nDecompLevels < 1 ||
+	  nDecompLevels > 31 ||
+	  codeBlockW > 8 ||
+	  codeBlockH > 8) {
 	error(errSyntaxError, getPos(), "Error in JPX COC marker segment");
 	return jpxDecodeFatalError;
       }
-      img.tiles[0].tileComps[comp].style =
-	  (img.tiles[0].tileComps[comp].style & ~1) | (style & 1);
-      img.tiles[0].tileComps[comp].codeBlockW += 2;
-      img.tiles[0].tileComps[comp].codeBlockH += 2;
+      style = (img.tiles[0].tileComps[comp].style & ~1) | (style & 1);
+      codeBlockW += 2;
+      codeBlockH += 2;
       for (i = 0; i < img.nXTiles * img.nYTiles; ++i) {
-	if (i != 0) {
-	  img.tiles[i].tileComps[comp].style =
-	      img.tiles[0].tileComps[comp].style;
-	  img.tiles[i].tileComps[comp].nDecompLevels =
-	      img.tiles[0].tileComps[comp].nDecompLevels;
-	  img.tiles[i].tileComps[comp].codeBlockW =
-	      img.tiles[0].tileComps[comp].codeBlockW;
-	  img.tiles[i].tileComps[comp].codeBlockH =
-	      img.tiles[0].tileComps[comp].codeBlockH;
-	  img.tiles[i].tileComps[comp].codeBlockStyle =
-	      img.tiles[0].tileComps[comp].codeBlockStyle;
-	  img.tiles[i].tileComps[comp].transform =
-	      img.tiles[0].tileComps[comp].transform;
-	}
+	img.tiles[i].tileComps[comp].style = style;
+	img.tiles[i].tileComps[comp].nDecompLevels = nDecompLevels;
+	img.tiles[i].tileComps[comp].codeBlockW = codeBlockW;
+	img.tiles[i].tileComps[comp].codeBlockH = codeBlockH;
+	img.tiles[i].tileComps[comp].codeBlockStyle = codeBlockStyle;
+	img.tiles[i].tileComps[comp].transform = transform;
 	img.tiles[i].tileComps[comp].resLevels =
 	    (JPXResLevel *)greallocn(
 		     img.tiles[i].tileComps[comp].resLevels,
-		     (img.tiles[i].tileComps[comp].nDecompLevels + 1),
+		     nDecompLevels + 1,
 		     sizeof(JPXResLevel));
-	for (r = 0; r <= img.tiles[i].tileComps[comp].nDecompLevels; ++r) {
+	for (r = 0; r <= nDecompLevels; ++r) {
 	  img.tiles[i].tileComps[comp].resLevels[r].precincts = NULL;
 	}
       }
-      for (r = 0; r <= img.tiles[0].tileComps[comp].nDecompLevels; ++r) {
-	if (img.tiles[0].tileComps[comp].style & 0x01) {
+      for (r = 0; r <= nDecompLevels; ++r) {
+	if (style & 0x01) {
 	  if (!readUByte(&precinctSize)) {
 	    error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	    return jpxDecodeFatalError;
@@ -1507,7 +1499,9 @@
   GBool haveSOD;
   Guint tileIdx, tilePartLen, tilePartIdx, nTileParts;
   GBool tilePartToEOC;
-  Guint precinctSize, style;
+  Guint style, progOrder, nLayers, multiComp, nDecompLevels;
+  Guint codeBlockW, codeBlockH, codeBlockStyle, transform;
+  Guint precinctSize, qStyle;
   Guint n, nSBs, nx, ny, sbx0, sby0, comp, segLen;
   Guint i, j, k, cbX, cbY, r, pre, sb, cbi, cbj;
   int segType, level;
@@ -1545,21 +1539,22 @@
     switch (segType) {
     case 0x52:			// COD - coding style default
       cover(34);
-      if (!readUByte(&img.tiles[tileIdx].tileComps[0].style) ||
-	  !readUByte(&img.tiles[tileIdx].progOrder) ||
-	  !readUWord(&img.tiles[tileIdx].nLayers) ||
-	  !readUByte(&img.tiles[tileIdx].multiComp) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[0].nDecompLevels) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[0].codeBlockW) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[0].codeBlockH) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[0].codeBlockStyle) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[0].transform)) {
+      if (!readUByte(&style) ||
+	  !readUByte(&progOrder) ||
+	  !readUWord(&nLayers) ||
+	  !readUByte(&multiComp) ||
+	  !readUByte(&nDecompLevels) ||
+	  !readUByte(&codeBlockW) ||
+	  !readUByte(&codeBlockH) ||
+	  !readUByte(&codeBlockStyle) ||
+	  !readUByte(&transform)) {
 	error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	return gFalse;
       }
-      if (img.tiles[tileIdx].tileComps[0].nDecompLevels > 32 ||
-	  img.tiles[tileIdx].tileComps[0].codeBlockW > 8 ||
-	  img.tiles[tileIdx].tileComps[0].codeBlockH > 8) {
+      if (nDecompLevels < 1 ||
+	  nDecompLevels > 31 ||
+	  codeBlockW > 8 ||
+	  codeBlockH > 8) {
 	error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	return gFalse;
       }
@@ -1570,36 +1565,29 @@
 	      img.tiles[tileIdx].progOrder);
       }
 #endif
-      img.tiles[tileIdx].tileComps[0].codeBlockW += 2;
-      img.tiles[tileIdx].tileComps[0].codeBlockH += 2;
+      codeBlockW += 2;
+      codeBlockH += 2;
+      img.tiles[tileIdx].progOrder = progOrder;
+      img.tiles[tileIdx].nLayers = nLayers;
+      img.tiles[tileIdx].multiComp = multiComp;
       for (comp = 0; comp < img.nComps; ++comp) {
-	if (comp != 0) {
-	  img.tiles[tileIdx].tileComps[comp].style =
-	      img.tiles[tileIdx].tileComps[0].style;
-	  img.tiles[tileIdx].tileComps[comp].nDecompLevels =
-	      img.tiles[tileIdx].tileComps[0].nDecompLevels;
-	  img.tiles[tileIdx].tileComps[comp].codeBlockW =
-	      img.tiles[tileIdx].tileComps[0].codeBlockW;
-	  img.tiles[tileIdx].tileComps[comp].codeBlockH =
-	      img.tiles[tileIdx].tileComps[0].codeBlockH;
-	  img.tiles[tileIdx].tileComps[comp].codeBlockStyle =
-	      img.tiles[tileIdx].tileComps[0].codeBlockStyle;
-	  img.tiles[tileIdx].tileComps[comp].transform =
-	      img.tiles[tileIdx].tileComps[0].transform;
-	}
+	img.tiles[tileIdx].tileComps[comp].style = style;
+	img.tiles[tileIdx].tileComps[comp].nDecompLevels = nDecompLevels;
+	img.tiles[tileIdx].tileComps[comp].codeBlockW = codeBlockW;
+	img.tiles[tileIdx].tileComps[comp].codeBlockH = codeBlockH;
+	img.tiles[tileIdx].tileComps[comp].codeBlockStyle = codeBlockStyle;
+	img.tiles[tileIdx].tileComps[comp].transform = transform;
 	img.tiles[tileIdx].tileComps[comp].resLevels =
 	    (JPXResLevel *)greallocn(
 		     img.tiles[tileIdx].tileComps[comp].resLevels,
-		     (img.tiles[tileIdx].tileComps[comp].nDecompLevels + 1),
+		     nDecompLevels + 1,
 		     sizeof(JPXResLevel));
-	for (r = 0;
-	     r <= img.tiles[tileIdx].tileComps[comp].nDecompLevels;
-	     ++r) {
+	for (r = 0; r <= nDecompLevels; ++r) {
 	  img.tiles[tileIdx].tileComps[comp].resLevels[r].precincts = NULL;
 	}
       }
-      for (r = 0; r <= img.tiles[tileIdx].tileComps[0].nDecompLevels; ++r) {
-	if (img.tiles[tileIdx].tileComps[0].style & 0x01) {
+      for (r = 0; r <= nDecompLevels; ++r) {
+	if (style & 0x01) {
 	  if (!readUByte(&precinctSize)) {
 	    error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	    return gFalse;
@@ -1614,9 +1602,7 @@
 	}
       }
       for (comp = 1; comp < img.nComps; ++comp) {
-	for (r = 0;
-	     r <= img.tiles[tileIdx].tileComps[comp].nDecompLevels;
-	     ++r) {
+	for (r = 0; r <= nDecompLevels; ++r) {
 	  img.tiles[tileIdx].tileComps[comp].resLevels[r].precinctWidth =
 	      img.tiles[tileIdx].tileComps[0].resLevels[r].precinctWidth;
 	  img.tiles[tileIdx].tileComps[comp].resLevels[r].precinctHeight =
@@ -1630,34 +1616,38 @@
 	  (img.nComps <= 256 && !readUByte(&comp)) ||
 	  comp >= img.nComps ||
 	  !readUByte(&style) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[comp].nDecompLevels) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[comp].codeBlockW) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[comp].codeBlockH) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[comp].codeBlockStyle) ||
-	  !readUByte(&img.tiles[tileIdx].tileComps[comp].transform)) {
+	  !readUByte(&nDecompLevels) ||
+	  !readUByte(&codeBlockW) ||
+	  !readUByte(&codeBlockH) ||
+	  !readUByte(&codeBlockStyle) ||
+	  !readUByte(&transform)) {
 	error(errSyntaxError, getPos(), "Error in JPX COC marker segment");
 	return gFalse;
       }
-      if (img.tiles[tileIdx].tileComps[comp].nDecompLevels > 32 ||
-	  img.tiles[tileIdx].tileComps[comp].codeBlockW > 8 ||
-	  img.tiles[tileIdx].tileComps[comp].codeBlockH > 8) {
+      if (nDecompLevels < 1 ||
+	  nDecompLevels > 31 ||
+	  codeBlockW > 8 ||
+	  codeBlockH > 8) {
 	error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	return gFalse;
       }
       img.tiles[tileIdx].tileComps[comp].style =
 	  (img.tiles[tileIdx].tileComps[comp].style & ~1) | (style & 1);
-      img.tiles[tileIdx].tileComps[comp].codeBlockW += 2;
-      img.tiles[tileIdx].tileComps[comp].codeBlockH += 2;
+      img.tiles[tileIdx].tileComps[comp].nDecompLevels = nDecompLevels;
+      img.tiles[tileIdx].tileComps[comp].codeBlockW = codeBlockW + 2;
+      img.tiles[tileIdx].tileComps[comp].codeBlockH = codeBlockH + 2;
+      img.tiles[tileIdx].tileComps[comp].codeBlockStyle = codeBlockStyle;
+      img.tiles[tileIdx].tileComps[comp].transform = transform;
       img.tiles[tileIdx].tileComps[comp].resLevels =
 	  (JPXResLevel *)greallocn(
 		     img.tiles[tileIdx].tileComps[comp].resLevels,
-		     (img.tiles[tileIdx].tileComps[comp].nDecompLevels + 1),
+		     nDecompLevels + 1,
 		     sizeof(JPXResLevel));
-      for (r = 0; r <= img.tiles[tileIdx].tileComps[comp].nDecompLevels; ++r) {
+      for (r = 0; r <= nDecompLevels; ++r) {
 	img.tiles[tileIdx].tileComps[comp].resLevels[r].precincts = NULL;
       }
-      for (r = 0; r <= img.tiles[tileIdx].tileComps[comp].nDecompLevels; ++r) {
-	if (img.tiles[tileIdx].tileComps[comp].style & 0x01) {
+      for (r = 0; r <= nDecompLevels; ++r) {
+	if (style & 0x01) {
 	  if (!readUByte(&precinctSize)) {
 	    error(errSyntaxError, getPos(), "Error in JPX COD marker segment");
 	    return gFalse;
@@ -1890,6 +1880,17 @@
     }
   } while (!haveSOD);
 
+  for (comp = 0; comp < img.nComps; ++comp) {
+    tileComp = &img.tiles[tileIdx].tileComps[comp];
+    qStyle = tileComp->quantStyle & 0x1f;
+    if ((qStyle == 0 && tileComp->nQuantSteps < 3 * tileComp->nDecompLevels) ||
+	(qStyle == 1 && tileComp->nQuantSteps < 1) ||
+	(qStyle == 2 && tileComp->nQuantSteps < 3 * tileComp->nDecompLevels)) {
+      error(errSyntaxError, getPos(), "Too few quant steps in JPX tile part");
+      return gFalse;
+    }
+  }
+
   //----- initialize the tile, precincts, and code-blocks
   if (tilePartIdx == 0) {
     tile = &img.tiles[tileIdx];
@@ -2083,7 +2084,8 @@
 		    }
 		  }
 		  memset(cb->touched, 0,
-			 (1 << (tileComp->codeBlockW + tileComp->codeBlockH)));
+			 ((size_t)1 << (tileComp->codeBlockW
+					+ tileComp->codeBlockH)));
 		} else {
 		  cb->coeffs = NULL;
 		  cb->touched = NULL;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Lexer.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -141,7 +141,7 @@
   // number
   case '0': case '1': case '2': case '3': case '4':
   case '5': case '6': case '7': case '8': case '9':
-  case '-': case '.':
+  case '+': case '-': case '.':
     // Adobe's number lexer has some "interesting" behavior:
     // "--123" is interpreted as 0
     // "--123.4" is interpreted as -123.4 [I've seen this in the wild]
@@ -159,7 +159,9 @@
     neg = gFalse;
     doubleMinus = gFalse;
     xf = xi = 0;
-    if (c == '-') {
+    if (c == '+') {
+      // just ignore it
+    } else if (c == '-') {
       neg = gTrue;
       if (lookChar() == '-') {
 	doubleMinus = gTrue;
@@ -373,9 +375,9 @@
       // accept longer names
       ++n;
       if (n < tokBufSize) {
-	*p++ = c;
+	*p++ = (char)c;
       } else if (n == tokBufSize) {
-	*p = c;
+	*p = (char)c;
 	s = new GString(tokBuf, n);
       } else {
 	s->append((char)c);
@@ -393,7 +395,7 @@
   // array punctuation
   case '[':
   case ']':
-    tokBuf[0] = c;
+    tokBuf[0] = (char)c;
     tokBuf[1] = '\0';
     obj->initCmd(tokBuf);
     break;
@@ -484,7 +486,7 @@
   // command
   default:
     p = tokBuf;
-    *p++ = c;
+    *p++ = (char)c;
     n = 1;
     while ((c = lookChar()) != EOF && !specialChars[c]) {
       getChar();
@@ -492,7 +494,7 @@
 	error(errSyntaxError, getPos(), "Command token too long");
 	break;
       }
-      *p++ = c;
+      *p++ = (char)c;
     }
     *p = '\0';
     if (tokBuf[0] == 't' && !strcmp(tokBuf, "true")) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/NameToUnicodeTable.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/NameToUnicodeTable.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/NameToUnicodeTable.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -2785,6 +2785,7 @@
   {0x30ce, "nokatakana"},
   {0xff89, "nokatakanahalfwidth"},
   {0x00a0, "nonbreakingspace"},
+  {0x00a0, "nobreakspace"},
   {0x0e13, "nonenthai"},
   {0x0e19, "nonuthai"},
   {0x0646, "noonarabic"},

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -46,7 +46,7 @@
 #if MULTITHREADED
 GAtomicCounter Object::numAlloc[numObjTypes] =
 #else
-int Object::numAlloc[numObjTypes] =
+long Object::numAlloc[numObjTypes] =
 #endif
   {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
 #endif
@@ -226,7 +226,7 @@
 void Object::memCheck(FILE *f) {
 #ifdef DEBUG_MEM
   int i;
-  int t;
+  long t;
 
   t = 0;
   for (i = 0; i < numObjTypes; ++i)

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Object.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -168,7 +168,7 @@
   // Array accessors.
   int arrayGetLength();
   void arrayAdd(Object *elem);
-  Object *arrayGet(int i, Object *obj);
+  Object *arrayGet(int i, Object *obj, int recursion = 0);
   Object *arrayGetNF(int i, Object *obj);
 
   // Dict accessors.
@@ -239,8 +239,8 @@
 inline void Object::arrayAdd(Object *elem)
   { array->add(elem); }
 
-inline Object *Object::arrayGet(int i, Object *obj)
-  { return array->get(i, obj); }
+inline Object *Object::arrayGet(int i, Object *obj, int recursion)
+  { return array->get(i, obj, recursion); }
 
 inline Object *Object::arrayGetNF(int i, Object *obj)
   { return array->getNF(i, obj); }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -42,10 +42,10 @@
 
 OptionalContent::OptionalContent(PDFDoc *doc) {
   Object *ocProps;
-  Object ocgList, defView, obj1, obj2;
+  Object ocgList, defView, uad, obj1, obj2, obj3, obj4;
   Ref ref1;
   OptionalContentGroup *ocg;
-  int i;
+  int i, j;
 
   xref = doc->getXRef();
   ocgs = new GList();
@@ -70,34 +70,41 @@
       //----- read the default viewing OCCD
       if (ocProps->dictLookup("D", &defView)->isDict()) {
 
-	//----- initial state from OCCD
-	if (defView.dictLookup("OFF", &obj1)->isArray()) {
+	//----- read the usage app dicts
+	if (defView.dictLookup("AS", &obj1)->isArray()) {
 	  for (i = 0; i < obj1.arrayGetLength(); ++i) {
-	    if (obj1.arrayGetNF(i, &obj2)->isRef()) {
-	      ref1 = obj2.getRef();
-	      if ((ocg = findOCG(&ref1))) {
-		ocg->setState(gFalse);
-	      } else {
-		error(errSyntaxError, -1,
-		      "Invalid OCG reference in OFF array in default viewing OCCD");
+	    if (obj1.arrayGet(i, &uad)->isDict()) {
+	      if (uad.dictLookup("Event", &obj2)->isName("View")) {
+		if (uad.dictLookup("OCGs", &obj3)->isArray()) {
+		  for (j = 0; j < obj3.arrayGetLength(); ++j) {
+		    if (obj3.arrayGetNF(j, &obj4)->isRef()) {
+		      ref1 = obj4.getRef();
+		      if ((ocg = findOCG(&ref1))) {
+			ocg->setInViewUsageAppDict();
+		      }
+		    }
+		    obj4.free();
+		  }
+		}
+		obj3.free();
 	      }
+	      obj2.free();
 	    }
-	    obj2.free();
+	    uad.free();
 	  }
 	}
 	obj1.free();
-	// the default OCCD is required to have a BaseState of ON, so
-	// the ON array is redundant -- but some (broken) PDF files
-	// include OCGs in both the OFF and ON arrays
-	if (defView.dictLookup("ON", &obj1)->isArray()) {
+
+	//----- initial state from OCCD
+	if (defView.dictLookup("OFF", &obj1)->isArray()) {
 	  for (i = 0; i < obj1.arrayGetLength(); ++i) {
 	    if (obj1.arrayGetNF(i, &obj2)->isRef()) {
 	      ref1 = obj2.getRef();
 	      if ((ocg = findOCG(&ref1))) {
-		ocg->setState(gTrue);
+		ocg->setState(gFalse);
 	      } else {
 		error(errSyntaxError, -1,
-		      "Invalid OCG reference in ON array in default viewing OCCD");
+		      "Invalid OCG reference in OFF array in default viewing OCCD");
 	      }
 	    }
 	    obj2.free();
@@ -108,10 +115,9 @@
 	//----- initial state from OCG usage dict
 	for (i = 0; i < ocgs->getLength(); ++i) {
 	  ocg = (OptionalContentGroup *)ocgs->get(i);
-	  //~ should this look at PrintState when printing, or is it
-	  //~   better to always print the ViewState?
-	  if (ocg->getViewState() == ocUsageOff) {
-	    ocg->setState(gFalse);
+	  if (ocg->getInViewUsageAppDict() &&
+	      ocg->getViewState() != ocUsageUnset) {
+	    ocg->setState(ocg->getViewState() == ocUsageOn);
 	  }
 	}
 
@@ -370,6 +376,7 @@
   viewState = viewStateA;
   printState = printStateA;
   state = gTrue;
+  inViewUsageAppDict = gFalse;
 }
 
 OptionalContentGroup::~OptionalContentGroup() {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OptionalContent.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -85,6 +85,8 @@
   OCUsageState getPrintState() { return printState; }
   GBool getState() { return state; }
   void setState(GBool stateA) { state = stateA; }
+  GBool getInViewUsageAppDict() { return inViewUsageAppDict; }
+  void setInViewUsageAppDict() { inViewUsageAppDict = gTrue; }
 
 private:
 
@@ -96,6 +98,8 @@
   OCUsageState viewState,	// suggested state when viewing
                printState;	// suggested state when printing
   GBool state;			// current state (on/off)
+  GBool inViewUsageAppDict;	// true if this OCG is listed in a
+				//   usage app dict with Event=View
 
   friend class OCDisplayNode;
 };

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/OutputDev.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -82,6 +82,7 @@
   virtual GBool needCharCount() { return gFalse; }
 
 
+
   //----- initialization and control
 
   // Set default transform matrix.

Added: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc	                        (rev 0)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -0,0 +1,1916 @@
+//========================================================================
+//
+// PDF417Barcode.cc
+//
+// Copyright 2018 Glyph & Cog, LLC
+//
+//========================================================================
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <math.h>
+#include "gtypes.h"
+#include "GString.h"
+#include "GList.h"
+#include "Error.h"
+#include "PDF417Barcode.h"
+
+//------------------------------------------------------------------------
+
+#define maxDataCodewords 928
+#define maxErrorCorrectionLevel 8
+#define maxErrorCorrectionCodewords (1 << (maxErrorCorrectionLevel + 1))
+
+// mode latches
+#define textModeLatch         900
+#define byteModeLatchMult6    924
+#define byteModeLatchNonMult6 901
+#define byteModeShift         913
+#define numericModeLatch      902
+
+// text submode latches and shifts
+#define textAlphaLowerLatch 27
+#define textAlphaMixedLatch 28
+#define textAlphaPuncShift  29
+#define textLowerAlphaShift 27
+#define textLowerMixedLatch 28
+#define textLowerPuncShift  29
+#define textMixedPuncLatch  25
+#define textMixedLowerLatch 27
+#define textMixedAlphaLatch 28
+#define textMixedPuncShift  29
+#define textPuncAlphaLatch  29
+
+#define textSubmodeAlpha      0
+#define textSubmodeLower      1
+#define textSubmodeMixed      2
+#define textSubmodePunc       3
+#define textSubmodeAlphaShift 4
+#define textSubmodePuncShift  5
+
+// textCompaction[char][submode] = base-30 value
+//                                 or 30 if char isn't available
+static char textCompaction[128][4] = {
+  { 30, 30, 30, 30 },  //   0
+  { 30, 30, 30, 30 },  //   1
+  { 30, 30, 30, 30 },  //   2
+  { 30, 30, 30, 30 },  //   3
+  { 30, 30, 30, 30 },  //   4
+  { 30, 30, 30, 30 },  //   5
+  { 30, 30, 30, 30 },  //   6
+  { 30, 30, 30, 30 },  //   7
+  { 30, 30, 30, 30 },  //   8
+  { 30, 30, 12, 12 },  //   9
+  { 30, 30, 30, 15 },  //  10
+  { 30, 30, 30, 30 },  //  11
+  { 30, 30, 30, 30 },  //  12
+  { 30, 30, 11, 11 },  //  13
+  { 30, 30, 30, 30 },  //  14
+  { 30, 30, 30, 30 },  //  15
+  { 30, 30, 30, 30 },  //  16
+  { 30, 30, 30, 30 },  //  17
+  { 30, 30, 30, 30 },  //  18
+  { 30, 30, 30, 30 },  //  19
+  { 30, 30, 30, 30 },  //  20
+  { 30, 30, 30, 30 },  //  21
+  { 30, 30, 30, 30 },  //  22
+  { 30, 30, 30, 30 },  //  23
+  { 30, 30, 30, 30 },  //  24
+  { 30, 30, 30, 30 },  //  25
+  { 30, 30, 30, 30 },  //  26
+  { 30, 30, 30, 30 },  //  27
+  { 30, 30, 30, 30 },  //  28
+  { 30, 30, 30, 30 },  //  29
+  { 30, 30, 30, 30 },  //  30
+  { 30, 30, 30, 30 },  //  31
+  { 26, 26, 26, 30 },  //  32
+  { 30, 30, 30, 10 },  //  33
+  { 30, 30, 30, 20 },  //  34
+  { 30, 30, 15, 30 },  //  35
+  { 30, 30, 18, 18 },  //  36
+  { 30, 30, 21, 30 },  //  37
+  { 30, 30, 10, 30 },  //  38
+  { 30, 30, 30, 28 },  //  39
+  { 30, 30, 30, 23 },  //  40
+  { 30, 30, 30, 24 },  //  41
+  { 30, 30, 22, 22 },  //  42
+  { 30, 30, 20, 30 },  //  43
+  { 30, 30, 13, 13 },  //  44
+  { 30, 30, 16, 16 },  //  45
+  { 30, 30, 17, 17 },  //  46
+  { 30, 30, 19, 19 },  //  47
+  { 30, 30,  0, 30 },  //  48
+  { 30, 30,  1, 30 },  //  49
+  { 30, 30,  2, 30 },  //  50
+  { 30, 30,  3, 30 },  //  51
+  { 30, 30,  4, 30 },  //  52
+  { 30, 30,  5, 30 },  //  53
+  { 30, 30,  6, 30 },  //  54
+  { 30, 30,  7, 30 },  //  55
+  { 30, 30,  8, 30 },  //  56
+  { 30, 30,  9, 30 },  //  57
+  { 30, 30, 14, 14 },  //  58
+  { 30, 30, 30,  0 },  //  59
+  { 30, 30, 30,  1 },  //  60
+  { 30, 30, 23, 30 },  //  61
+  { 30, 30, 30,  2 },  //  62
+  { 30, 30, 30, 25 },  //  63
+  { 30, 30, 30,  3 },  //  64
+  {  0, 30, 30, 30 },  //  65
+  {  1, 30, 30, 30 },  //  66
+  {  2, 30, 30, 30 },  //  67
+  {  3, 30, 30, 30 },  //  68
+  {  4, 30, 30, 30 },  //  69
+  {  5, 30, 30, 30 },  //  70
+  {  6, 30, 30, 30 },  //  71
+  {  7, 30, 30, 30 },  //  72
+  {  8, 30, 30, 30 },  //  73
+  {  9, 30, 30, 30 },  //  74
+  { 10, 30, 30, 30 },  //  75
+  { 11, 30, 30, 30 },  //  76
+  { 12, 30, 30, 30 },  //  77
+  { 13, 30, 30, 30 },  //  78
+  { 14, 30, 30, 30 },  //  79
+  { 15, 30, 30, 30 },  //  80
+  { 16, 30, 30, 30 },  //  81
+  { 17, 30, 30, 30 },  //  82
+  { 18, 30, 30, 30 },  //  83
+  { 19, 30, 30, 30 },  //  84
+  { 20, 30, 30, 30 },  //  85
+  { 21, 30, 30, 30 },  //  86
+  { 22, 30, 30, 30 },  //  87
+  { 23, 30, 30, 30 },  //  88
+  { 24, 30, 30, 30 },  //  89
+  { 25, 30, 30, 30 },  //  90
+  { 30, 30, 30,  4 },  //  91
+  { 30, 30, 30,  5 },  //  92
+  { 30, 30, 30,  6 },  //  93
+  { 30, 30, 24, 30 },  //  94
+  { 30, 30, 30,  7 },  //  95
+  { 30, 30, 30,  8 },  //  96
+  { 30,  0, 30, 30 },  //  97
+  { 30,  1, 30, 30 },  //  98
+  { 30,  2, 30, 30 },  //  30
+  { 30,  3, 30, 30 },  // 100
+  { 30,  4, 30, 30 },  // 101
+  { 30,  5, 30, 30 },  // 102
+  { 30,  6, 30, 30 },  // 103
+  { 30,  7, 30, 30 },  // 104
+  { 30,  8, 30, 30 },  // 105
+  { 30,  9, 30, 30 },  // 106
+  { 30, 10, 30, 30 },  // 107
+  { 30, 11, 30, 30 },  // 108
+  { 30, 12, 30, 30 },  // 109
+  { 30, 13, 30, 30 },  // 110
+  { 30, 14, 30, 30 },  // 111
+  { 30, 15, 30, 30 },  // 112
+  { 30, 16, 30, 30 },  // 113
+  { 30, 17, 30, 30 },  // 114
+  { 30, 18, 30, 30 },  // 115
+  { 30, 19, 30, 30 },  // 116
+  { 30, 20, 30, 30 },  // 117
+  { 30, 21, 30, 30 },  // 118
+  { 30, 22, 30, 30 },  // 119
+  { 30, 23, 30, 30 },  // 120
+  { 30, 24, 30, 30 },  // 121
+  { 30, 25, 30, 30 },  // 122
+  { 30, 30, 30, 26 },  // 123
+  { 30, 30, 30, 21 },  // 124
+  { 30, 30, 30, 27 },  // 125
+  { 30, 30, 30,  9 },  // 126
+  { 30, 30, 30, 30 }   // 127
+};
+
+static int errorCorrectionCoeffLevel0[2] = {
+  27, 917
+};
+
+static int errorCorrectionCoeffLevel1[4] = {
+  522, 568, 723, 809
+};
+
+static int errorCorrectionCoeffLevel2[8] = {
+  237, 308, 436, 284, 646, 653, 428, 379
+};
+
+static int errorCorrectionCoeffLevel3[16] = {
+  274, 562, 232, 755, 599, 524, 801, 132,
+  295, 116, 442, 428, 295,  42, 176,  65
+};
+
+static int errorCorrectionCoeffLevel4[32] = {
+  361, 575, 922, 525, 176, 586, 640, 321,
+  536, 742, 677, 742, 687, 284, 193, 517,
+  273, 494, 263, 147, 593, 800, 571, 320,
+  803, 133, 231, 390, 685, 330,  63, 410
+};
+
+static int errorCorrectionCoeffLevel5[64] = {
+  539, 422,   6,  93, 862, 771, 453, 106,
+  610, 287, 107, 505, 733, 877, 381, 612,
+  723, 476, 462, 172, 430, 609, 858, 822,
+  543, 376, 511, 400, 672, 762, 283, 184,
+  440,  35, 519,  31, 460, 594, 225, 535,
+  517, 352, 605, 158, 651, 201, 488, 502,
+  648, 733, 717,  83, 404,  97, 280, 771,
+  840, 629,   4, 381, 843, 623, 264, 543
+};
+
+static int errorCorrectionCoeffLevel6[128] = {
+  521, 310, 864, 547, 858, 580, 296, 379,
+   53, 779, 897, 444, 400, 925, 749, 415,
+  822,  93, 217, 208, 928, 244, 583, 620,
+  246, 148, 447, 631, 292, 908, 490, 704,
+  516, 258, 457, 907, 594, 723, 674, 292,
+  272,  96, 684, 432, 686, 606, 860, 569,
+  193, 219, 129, 186, 236, 287, 192, 775,
+  278, 173,  40, 379, 712, 463, 646, 776,
+  171, 491, 297, 763, 156, 732,  95, 270,
+  447,  90, 507,  48, 228, 821, 808, 898,
+  784, 663, 627, 378, 382, 262, 380, 602,
+  754, 336,  89, 614,  87, 432, 670, 616,
+  157, 374, 242, 726, 600, 269, 375, 898,
+  845, 454, 354, 130, 814, 587, 804,  34,
+  211, 330, 539, 297, 827, 865,  37, 517,
+  834, 315, 550,  86, 801,   4, 108, 539
+};
+
+static int errorCorrectionCoeffLevel7[256] = {
+  524, 894,  75, 766, 882, 857,  74, 204,
+   82, 586, 708, 250, 905, 786, 138, 720,
+  858, 194, 311, 913, 275, 190, 375, 850,
+  438, 733, 194, 280, 201, 280, 828, 757,
+  710, 814, 919,  89,  68, 569,  11, 204,
+  796, 605, 540, 913, 801, 700, 799, 137,
+  439, 418, 592, 668, 353, 859, 370, 694,
+  325, 240, 216, 257, 284, 549, 209, 884,
+  315,  70, 329, 793, 490, 274, 877, 162,
+  749, 812, 684, 461, 334, 376, 849, 521,
+  307, 291, 803, 712,  19, 358, 399, 908,
+  103, 511,  51,   8, 517, 225, 289, 470,
+  637, 731,  66, 255, 917, 269, 463, 830,
+  730, 433, 848, 585, 136, 538, 906,  90,
+    2, 290, 743, 199, 655, 903, 329,  49,
+  802, 580, 355, 588, 188, 462,  10, 134,
+  628, 320, 479, 130, 739,  71, 263, 318,
+  374, 601, 192, 605, 142, 673, 687, 234,
+  722, 384, 177, 752, 607, 640, 455, 193,
+  689, 707, 805, 641,  48,  60, 732, 621,
+  895, 544, 261, 852, 655, 309, 697, 755,
+  756,  60, 231, 773, 434, 421, 726, 528,
+  503, 118,  49, 795,  32, 144, 500, 238,
+  836, 394, 280, 566, 319,   9, 647, 550,
+   73, 914, 342, 126,  32, 681, 331, 792,
+  620,  60, 609, 441, 180, 791, 893, 754,
+  605, 383, 228, 749, 760, 213,  54, 297,
+  134,  54, 834, 299, 922, 191, 910, 532,
+  609, 829, 189,  20, 167,  29, 872, 449,
+   83, 402,  41, 656, 505, 579, 481, 173,
+  404, 251, 688,  95, 497, 555, 642, 543,
+  307, 159, 924, 558, 648,  55, 497,  10
+};
+
+static int errorCorrectionCoeffLevel8[512] = {
+  352,  77, 373, 504,  35, 599, 428, 207,
+  409, 574, 118, 498, 285, 380, 350, 492,
+  197, 265, 920, 155, 914, 299, 229, 643,
+  294, 871, 306,  88,  87, 193, 352, 781,
+  846,  75, 327, 520, 435, 543, 203, 666,
+  249, 346, 781, 621, 640, 268, 794, 534,
+  539, 781, 408, 390, 644, 102, 476, 499,
+  290, 632, 545,  37, 858, 916, 552,  41,
+  542, 289, 122, 272, 383, 800, 485,  98,
+  752, 472, 761, 107, 784, 860, 658, 741,
+  290, 204, 681, 407, 855,  85,  99,  62,
+  482, 180,  20, 297, 451, 593, 913, 142,
+  808, 684, 287, 536, 561,  76, 653, 899,
+  729, 567, 744, 390, 513, 192, 516, 258,
+  240, 518, 794, 395, 768, 848,  51, 610,
+  384, 168, 190, 826, 328, 596, 786, 303,
+  570, 381, 415, 641, 156, 237, 151, 429,
+  531, 207, 676, 710,  89, 168, 304, 402,
+   40, 708, 575, 162, 864, 229,  65, 861,
+  841, 512, 164, 477, 221,  92, 358, 785,
+  288, 357, 850, 836, 827, 736, 707,  94,
+    8, 494, 114, 521,   2, 499, 851, 543,
+  152, 729, 771,  95, 248, 361, 578, 323,
+  856, 797, 289,  51, 684, 466, 533, 820,
+  669,  45, 902, 452, 167, 342, 244, 173,
+   35, 463, 651,  51, 699, 591, 452, 578,
+   37, 124, 298, 332, 552,  43, 427, 119,
+  662, 777, 475, 850, 764, 364, 578, 911,
+  283, 711, 472, 420, 245, 288, 594, 394,
+  511, 327, 589, 777, 699, 688,  43, 408,
+  842, 383, 721, 521, 560, 644, 714, 559,
+   62, 145, 873, 663, 713, 159, 672, 729,
+  624,  59, 193, 417, 158, 209, 563, 564,
+  343, 693, 109, 608, 563, 365, 181, 772,
+  677, 310, 248, 353, 708, 410, 579, 870,
+  617, 841, 632, 860, 289, 536,  35, 777,
+  618, 586, 424, 833,  77, 597, 346, 269,
+  757, 632, 695, 751, 331, 247, 184,  45,
+  787, 680,  18,  66, 407, 369,  54, 492,
+  228, 613, 830, 922, 437, 519, 644, 905,
+  789, 420, 305, 441, 207, 300, 892, 827,
+  141, 537, 381, 662, 513,  56, 252, 341,
+  242, 797, 838, 837, 720, 224, 307, 631,
+   61,  87, 560, 310, 756, 665, 397, 808,
+  851, 309, 473, 795, 378,  31, 647, 915,
+  459, 806, 590, 731, 425, 216, 548, 249,
+  321, 881, 699, 535, 673, 782, 210, 815,
+  905, 303, 843, 922, 281,  73, 469, 791,
+  660, 162, 498, 308, 155, 422, 907, 817,
+  187,  62,  16, 425, 535, 336, 286, 437,
+  375, 273, 610, 296, 183, 923, 116, 667,
+  751, 353,  62, 366, 691, 379, 687, 842,
+   37, 357, 720, 742, 330,   5,  39, 923,
+  311, 424, 242, 749, 321,  54, 669, 316,
+  342, 299, 534, 105, 667, 488, 640, 672,
+  576, 540, 316, 486, 721, 610,  46, 656,
+  447, 171, 616, 464, 190, 531, 297, 321,
+  762, 752, 533, 175, 134,  14, 381, 433,
+  717,  45, 111,  20, 596, 284, 736, 138,
+  646, 411, 877, 669, 141, 919,  45, 780,
+  407, 164, 332, 899, 165, 726, 600, 325,
+  498, 655, 357, 752, 768, 223, 849, 647,
+   63, 310, 863, 251, 366, 304, 282, 738,
+  675, 410, 389, 244,  31, 121, 303, 263
+};
+
+static int *errorCorrectionCoeff[maxErrorCorrectionLevel + 1] = {
+  errorCorrectionCoeffLevel0,
+  errorCorrectionCoeffLevel1,
+  errorCorrectionCoeffLevel2,
+  errorCorrectionCoeffLevel3,
+  errorCorrectionCoeffLevel4,
+  errorCorrectionCoeffLevel5,
+  errorCorrectionCoeffLevel6,
+  errorCorrectionCoeffLevel7,
+  errorCorrectionCoeffLevel8
+};
+
+#define startPatternLength 8
+static char startPattern[startPatternLength] = {8,1,1,1,1,1,1,3};
+
+#define stopPatternLength 9
+static char stopPattern[stopPatternLength] = {7,1,1,3,1,1,1,2,1};
+
+#define patternLength 8
+
+// patterns[codeword][cluster][element] = element (bar or space) width
+static char patterns[929][3][patternLength] = {
+  {{3,1,1,1,1,1,3,6}, {5,1,1,1,1,1,2,5}, {2,1,1,1,1,1,5,5}},
+  {{4,1,1,1,1,1,4,4}, {6,1,1,1,1,1,3,3}, {3,1,1,1,1,1,6,3}},
+  {{5,1,1,1,1,1,5,2}, {4,1,1,1,1,2,1,6}, {1,1,1,1,1,2,4,6}},
+  {{3,1,1,1,1,2,3,5}, {5,1,1,1,1,2,2,4}, {2,1,1,1,1,2,5,4}},
+  {{4,1,1,1,1,2,4,3}, {6,1,1,1,1,2,3,2}, {3,1,1,1,1,2,6,2}},
+  {{5,1,1,1,1,2,5,1}, {4,1,1,1,1,3,1,5}, {1,1,1,1,1,3,4,5}},
+  {{2,1,1,1,1,3,2,6}, {5,1,1,1,1,3,2,3}, {2,1,1,1,1,3,5,3}},
+  {{3,1,1,1,1,3,3,4}, {6,1,1,1,1,3,3,1}, {3,1,1,1,1,3,6,1}},
+  {{2,1,1,1,1,4,2,5}, {4,1,1,1,1,4,1,4}, {1,1,1,1,1,4,4,4}},
+  {{1,1,1,1,1,5,1,6}, {5,1,1,1,1,4,2,2}, {2,1,1,1,1,4,5,2}},
+  {{2,1,1,1,1,5,2,4}, {4,1,1,1,1,5,1,3}, {1,1,1,1,1,5,4,3}},
+  {{1,1,1,1,1,6,1,5}, {5,1,1,1,1,5,2,1}, {6,1,1,1,2,1,1,4}},
+  {{2,1,1,1,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2}, {1,3,5,3,2,1,1,1}},
+  {{4,2,4,2,1,1,1,2}, {1,1,6,2,1,3,2,1}, {1,2,6,2,3,1,1,1}},
+  {{4,1,5,1,2,1,1,2}, {1,2,5,3,1,1,3,1}, {1,6,3,1,1,1,2,2}},
+  {{4,2,4,2,1,2,1,1}, {1,1,6,2,2,1,3,1}, {1,6,3,1,1,2,2,1}},
+  {{4,1,5,1,2,2,1,1}, {1,1,6,3,1,1,2,2}, {1,5,4,1,1,1,1,3}},
+  {{3,3,3,3,1,1,1,2}, {1,1,6,3,1,2,2,1}, {2,5,4,1,1,1,2,1}},
+  {{3,2,4,2,2,1,1,2}, {1,4,4,1,1,1,4,1}, {1,5,4,1,1,2,1,2}},
+  {{3,3,3,3,1,2,1,1}, {1,3,5,1,1,1,3,2}, {1,5,4,1,1,3,1,1}},
+  {{3,1,5,1,3,1,1,2}, {1,3,5,1,1,2,3,1}, {1,6,3,2,1,1,2,1}},
+  {{3,2,4,2,2,2,1,1}, {1,2,6,1,1,1,2,3}, {1,5,4,1,2,1,2,1}},
+  {{3,1,5,1,3,2,1,1}, {2,2,6,1,1,1,3,1}, {2,4,5,1,1,1,1,2}},
+  {{2,4,2,4,1,1,1,2}, {1,2,6,1,1,2,2,2}, {2,4,5,1,1,2,1,1}},
+  {{2,3,3,3,2,1,1,2}, {1,2,6,1,1,3,2,1}, {1,5,4,2,1,1,1,2}},
+  {{2,4,2,4,1,2,1,1}, {1,3,5,2,1,1,3,1}, {1,4,5,1,2,1,1,2}},
+  {{2,2,4,2,3,1,1,2}, {1,2,6,1,2,1,3,1}, {1,5,4,2,1,2,1,1}},
+  {{2,3,3,3,2,2,1,1}, {1,2,6,2,1,1,2,2}, {1,4,5,1,2,2,1,1}},
+  {{2,1,5,1,4,1,1,2}, {1,2,6,2,1,2,2,1}, {3,3,6,1,1,1,1,1}}
+};
+
+//------------------------------------------------------------------------
+
+static int makeDataCodewords(GString *value, int *codewords);
+static int countNumeric(GString *value, int start);
+static int countText(GString *value, int start);
+static int countBinary(GString *value, int start);
+static GBool makeNumericCodewords(GString *value, int start, int n,
+				  int *codewords, int &codewordIdx);
+static int divMod900(int *d, int n);
+static GBool makeByteCodewords(GString *value, int start, int n,
+			       int *codewords, int &codewordIdx);
+static GBool makeTextCodewords(GString *value, int start, int n,
+			       int *codewords, int &codewordIdx);
+static GBool appendTextHalfSymbol(int *codewords, int &codewordIdx,
+				  int halfSymbol, int &prevHalfSymbol);
+static GBool appendDataCodeword(int *codewords, int &codewordIdx,
+				int codeword);
+static void makeErrorCorrectionCodewords(int errorCorrectionLevel,
+					 int *codewords, int length);
+static void drawBarcode(int *codewords, int totalLength,
+			int nRows, int nCols,
+			int errorCorrectionLevel,
+			double moduleWidth, double moduleHeight,
+			double fieldWidth, double fieldHeight,
+			GString *appearBuf);
+static void drawPattern(int &x, int y, char *pattern, int length,
+			GString *appearBuf);
+
+//------------------------------------------------------------------------
+
+GBool drawPDF417Barcode(double fieldWidth, double fieldHeight,
+			double moduleWidth, double moduleHeight,
+			int errorCorrectionLevel, GString *value,
+			GString *appearBuf) {
+  int codewords[maxDataCodewords + maxErrorCorrectionCodewords];
+
+  if (moduleWidth <= 0 || moduleHeight <= 0) {
+    error(errSyntaxError, -1, "Invalid module size in PDF417 barcode");
+    return gFalse;
+  }
+
+  // each row contains:
+  // - left quiet zone (2 modules, minimum)
+  // - start code (17 modules)
+  // - left row indicator (17 modules)
+  // - nCols codewords (17 modules each)
+  // - right row indicator (17 modules)
+  // - stop code (18 modules)
+  // - right quiet zone (2 modules, minimum)
+  // total = 73 + nCols * 17
+  int nCols = (int)floor((fieldWidth / moduleWidth - 73) / 17);
+  if (nCols < 1) {
+    error(errSyntaxError, -1, "Invalid field size for PDF417 barcode");
+    return gFalse;
+  }
+  if (nCols > 30) {
+    nCols = 30;
+  }
+
+  int nDataCodewords = makeDataCodewords(value, codewords);
+  if (nDataCodewords == maxDataCodewords) {
+    error(errSyntaxError, -1, "Too many codewords in PDF417 barcode");
+    return gFalse;
+  }
+
+  int nErrorCorrectionCodewords = 1 << (errorCorrectionLevel + 1);
+
+  // total codewords = 1 + nDataCodewords + nPadCodewords
+  //                   + nErrorCorrectionCodewords
+  int nRows = (1 + nDataCodewords + nErrorCorrectionCodewords + (nCols - 1))
+              / nCols;
+  if (nRows < 3) {
+    nRows = 3;
+  }
+  if (nRows > 90) {
+    error(errSyntaxError, -1, "Too many rows in PDF417 barcode");
+    return gFalse;
+  }
+  int nPadCodewords = nRows * nCols
+                      - (1 + nDataCodewords + nErrorCorrectionCodewords);
+  int length = 1 + nDataCodewords + nPadCodewords;
+  if (length > maxDataCodewords) {
+    error(errSyntaxError, -1, "Too many codewords in PDF417 barcode");
+    return gFalse;
+  }
+  codewords[0] = length;
+  for (int i = 1 + nDataCodewords; i < length; ++i) {
+    codewords[i] = 900;
+  }
+
+  makeErrorCorrectionCodewords(errorCorrectionLevel, codewords, length);
+
+  // we need at least 3 modules of vertical quiet space above and below
+  // (the spec says 2, but Adobe seems to use 3)
+  if (nRows * moduleHeight + 6 * moduleWidth > fieldHeight) {
+    error(errSyntaxError, -1, "Too many rows in PDF417 barcode");
+    return gFalse;
+  }
+
+  // Adobe adjusts the module height to fill the available space
+  double moduleHeight2 = (fieldHeight - 6 * moduleWidth) / nRows;
+
+  drawBarcode(codewords, length + nErrorCorrectionCodewords,
+	      nRows, nCols, errorCorrectionLevel,
+	      moduleWidth, moduleHeight2, fieldWidth, fieldHeight,
+	      appearBuf);
+
+  return gTrue;
+}
+
+// Generate up to maxDataCodewords-1 codewords in codewords[1 .. m],
+// leaving codewords[0] unused.  Returns the number of generated
+// codewords (m), or maxDataCodewords if there are too many to fit.
+static int makeDataCodewords(GString *value, int *codewords) {
+  GBool textMode = gTrue;
+  int codewordIdx = 1;
+  int valueIdx = 0;
+  while (valueIdx < value->getLength()) {
+
+    int nNumeric = countNumeric(value, valueIdx);
+    if (nNumeric >= 13) {
+      if (!appendDataCodeword(codewords, codewordIdx, numericModeLatch) ||
+	  !makeNumericCodewords(value, valueIdx, nNumeric,
+				codewords, codewordIdx)) {
+	return maxDataCodewords;
+      }
+      valueIdx += nNumeric;
+      textMode = gFalse;
+
+    } else {
+      int nText = countText(value, valueIdx);
+      if (nText >= 5) {
+	if (!textMode) {
+	  if (!appendDataCodeword(codewords, codewordIdx, textModeLatch)) {
+	    return maxDataCodewords;
+	  }
+	}
+	if (!makeTextCodewords(value, valueIdx, nText,
+			       codewords, codewordIdx)) {
+	  return maxDataCodewords;
+	}
+	valueIdx += nText;
+	textMode = gTrue;
+
+      } else {
+	int nBinary = countBinary(value, valueIdx);
+	//~ this doesn't currently use byte mode shift when nBinary==1
+	//~   because we don't track the text submode (which is needed
+	//~   because we'll return to that submode after the byte shift)
+	int code = (nBinary % 6 == 0) ? byteModeLatchMult6
+	                              : byteModeLatchNonMult6;
+	if (!appendDataCodeword(codewords, codewordIdx, code) ||
+	    !makeByteCodewords(value, valueIdx, nBinary,
+			       codewords, codewordIdx)) {
+	  return maxDataCodewords;
+	}
+	valueIdx += nBinary;
+	textMode = gFalse;
+      }
+    }
+  }
+
+  return codewordIdx - 1;
+}
+
+static int countNumeric(GString *value, int start) {
+  int n = 0;
+  for (int i = start; i < value->getLength(); ++i) {
+    char c = value->getChar(i);
+    if (!(c >= '0' && c <= '9')) {
+      break;
+    }
+    ++n;
+  }
+  return n;
+}
+
+static int countText(GString *value, int start) {
+  int n = 0;
+  for (int i = start; i < value->getLength(); ++i) {
+    char c = value->getChar(i);
+    if ((c & 0x80) ||
+	(textCompaction[(int)c][0] == 30 &&
+	 textCompaction[(int)c][1] == 30 &&
+	 textCompaction[(int)c][2] == 30 &&
+	 textCompaction[(int)c][3] == 30) ||
+	countNumeric(value, i) >= 13) {
+      break;
+    }
+    ++n;
+  }
+  return n;
+}
+
+static int countBinary(GString *value, int start) {
+  int n = 0;
+  for (int i = start; i < value->getLength(); ++i) {
+    if (countNumeric(value, i) >= 13 ||
+	countText(value, i) >= 5) {
+      break;
+    }
+    ++n;
+  }
+  return n;
+}
+
+static GBool makeNumericCodewords(GString *value, int start, int n,
+				  int *codewords, int &codewordIdx) {
+  for (int i = 0; i < n; i += 44) {
+    int nInDigits = n - i;
+    if (nInDigits > 44) {
+      nInDigits = 44;
+    }
+    int inDigits[45];
+    inDigits[0] = 1;
+    for (int j = 0; j < nInDigits; ++j) {
+      inDigits[j+1] = value->getChar(start + i + j) - '0';
+    }
+    int nOutDigits = 1 + nInDigits / 3;
+    int outDigits[15];
+    for (int j = 0; j < nOutDigits; ++j) {
+      outDigits[nOutDigits - 1 - j] = divMod900(inDigits, nInDigits + 1);
+    }
+    for (int j = 0; j < nOutDigits; ++j) {
+      if (!appendDataCodeword(codewords, codewordIdx, outDigits[j])) {
+	return gFalse;
+      }
+    }
+  }
+  return gTrue;
+}
+
+// Given x = sum(i = 0..n-1, d[i] * 10^(n-1-i))
+// Compute x' = x / 900 and return x % 900.
+static int divMod900(int *d, int n) {
+  int r = 0;
+  for (int i = 0; i < n; ++i) {
+    int dd = r * 10 + d[i];
+    d[i] = dd / 900;
+    r = dd % 900;
+  }
+  return r;
+}
+
+static GBool makeByteCodewords(GString *value, int start, int n,
+			       int *codewords, int &codewordIdx) {
+  int i;
+  for (i = 0; i <= n - 6; i += 6) {
+    long long in = 0;
+    for (int j = 0; j < 6; ++j) {
+      in = (in << 8) | (value->getChar(start + i + j) & 0xff);
+    }
+    int outCodes[5];
+    for (int j = 4; j >= 0; --j) {
+      outCodes[j] = (int)(in % 900);
+      in /= 900;
+    }
+    for (int j = 0; j < 4; ++j) {
+      if (!appendDataCodeword(codewords, codewordIdx, outCodes[j])) {
+	return gFalse;
+      }
+    }
+  }
+  for (; i < n; ++i) {
+    if (!appendDataCodeword(codewords, codewordIdx,
+			    value->getChar(start + i) & 0xff)) {
+      return gFalse;
+    }
+  }
+  return gTrue;
+}
+
+static GBool makeTextCodewords(GString *value, int start, int n,
+			       int *codewords, int &codewordIdx) {
+  int submode = textSubmodeAlpha;
+  int prevSubmode = textSubmodeAlpha;
+  int nextSubmode;
+  int prevHalfSymbol = 30;
+  int valueIdx = start;
+  while (valueIdx < start + n) {
+    int c = value->getChar(valueIdx) & 0x7f;
+    nextSubmode = submode;
+    switch (submode) {
+    case textSubmodeAlpha:
+      if (textCompaction[c][textSubmodeAlpha] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textCompaction[c][textSubmodeAlpha],
+				  prevHalfSymbol)) {
+	  return gFalse;
+	}
+	++valueIdx;
+      } else if (textCompaction[c][textSubmodeLower] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textAlphaLowerLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeLower;
+      } else if (textCompaction[c][textSubmodeMixed] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textAlphaMixedLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeMixed;
+      } else if (textCompaction[c][textSubmodePunc] < 30) {
+	if (valueIdx < start + n - 2 &&
+	    textCompaction[value->getChar(valueIdx + 1) & 0x7f]
+	                  [textSubmodePunc] < 30 &&
+	    textCompaction[value->getChar(valueIdx + 2) & 0x7f]
+	                  [textSubmodePunc] < 30) {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textAlphaMixedLatch, prevHalfSymbol) ||
+	      !appendTextHalfSymbol(codewords, codewordIdx,
+				    textMixedPuncLatch, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodePunc;
+	} else {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textAlphaPuncShift, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodePuncShift;
+	}
+      } else {
+	// this shouldn't happen
+	++valueIdx;
+      }
+      break;
+    case textSubmodeAlphaShift:
+      if (textCompaction[c][textSubmodeAlpha] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textCompaction[c][textSubmodeAlpha],
+				  prevHalfSymbol)) {
+	  return gFalse;
+	}
+	++valueIdx;
+      } else {
+	// this shouldn't happen
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  0, prevHalfSymbol)) {
+	  return gFalse;
+	}
+      }
+      nextSubmode = prevSubmode;
+      break;
+    case textSubmodeLower:
+      if (textCompaction[c][textSubmodeAlpha] < 30) {
+	if (valueIdx < start + n - 2 &&
+	    textCompaction[value->getChar(valueIdx + 1) & 0x7f]
+	                  [textSubmodeAlpha] < 30 &&
+	    textCompaction[value->getChar(valueIdx + 2) & 0x7f]
+	                  [textSubmodeAlpha] < 30) {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textLowerMixedLatch, prevHalfSymbol) ||
+	      !appendTextHalfSymbol(codewords, codewordIdx,
+				    textMixedAlphaLatch, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodeAlpha;
+	} else {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textLowerAlphaShift, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodeAlphaShift;
+	}
+      } else if (textCompaction[c][textSubmodeLower] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textCompaction[c][textSubmodeLower],
+				  prevHalfSymbol)) {
+	  return gFalse;
+	}
+	++valueIdx;
+      } else if (textCompaction[c][textSubmodeMixed] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textLowerMixedLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeMixed;
+      } else if (textCompaction[c][textSubmodePunc] < 30) {
+	if (valueIdx < start + n - 2 &&
+	    textCompaction[value->getChar(valueIdx + 1) & 0x7f]
+	                  [textSubmodePunc] < 30 &&
+	    textCompaction[value->getChar(valueIdx + 2) & 0x7f]
+	                  [textSubmodePunc] < 30) {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textLowerMixedLatch, prevHalfSymbol) ||
+	      !appendTextHalfSymbol(codewords, codewordIdx,
+				    textMixedPuncLatch, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodePunc;
+	} else {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textLowerPuncShift, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodePuncShift;
+	}
+      } else {
+	// this shouldn't happen
+	++valueIdx;
+      }
+      break;
+    case textSubmodeMixed:
+      if (textCompaction[c][textSubmodeAlpha] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textMixedAlphaLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeAlpha;
+      } else if (textCompaction[c][textSubmodeLower] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textMixedLowerLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeLower;
+      } else if (textCompaction[c][textSubmodeMixed] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textCompaction[c][textSubmodeMixed],
+				  prevHalfSymbol)) {
+	  return gFalse;
+	}
+	++valueIdx;
+      } else if (textCompaction[c][textSubmodePunc] < 30) {
+	if (valueIdx < start + n - 1 &&
+	    textCompaction[value->getChar(valueIdx + 1) & 0x7f]
+	                  [textSubmodePunc] < 30) {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textMixedPuncLatch, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodePunc;
+	} else {
+	  if (!appendTextHalfSymbol(codewords, codewordIdx,
+				    textMixedPuncShift, prevHalfSymbol)) {
+	    return gFalse;
+	  }
+	  nextSubmode = textSubmodePuncShift;
+	}
+      } else {
+	// this shouldn't happen
+	++valueIdx;
+      }
+      break;
+    case textSubmodePunc:
+      if (textCompaction[c][textSubmodeAlpha] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textPuncAlphaLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeAlpha;
+      } else if (textCompaction[c][textSubmodeLower] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textPuncAlphaLatch, prevHalfSymbol) ||
+	    !appendTextHalfSymbol(codewords, codewordIdx,
+				  textAlphaLowerLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeLower;
+      } else if (textCompaction[c][textSubmodeMixed] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textPuncAlphaLatch, prevHalfSymbol) ||
+	    !appendTextHalfSymbol(codewords, codewordIdx,
+				  textAlphaMixedLatch, prevHalfSymbol)) {
+	  return gFalse;
+	}
+	nextSubmode = textSubmodeMixed;
+      } else if (textCompaction[c][textSubmodePunc] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textCompaction[c][textSubmodePunc],
+				  prevHalfSymbol)) {
+	  return gFalse;
+	}
+	++valueIdx;
+      } else {
+	// this shouldn't happen
+	++valueIdx;
+      }
+      break;
+    case textSubmodePuncShift:
+      if (textCompaction[c][textSubmodePunc] < 30) {
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  textCompaction[c][textSubmodePunc],
+				  prevHalfSymbol)) {
+	  return gFalse;
+	}
+	++valueIdx;
+      } else {
+	// this shouldn't happen
+	if (!appendTextHalfSymbol(codewords, codewordIdx,
+				  0, prevHalfSymbol)) {
+	  return gFalse;
+	}
+      }
+      nextSubmode = prevSubmode;
+      break;
+    }
+    prevSubmode = submode;
+    submode = nextSubmode;
+  }
+
+  // padding
+  if (prevHalfSymbol < 30) {
+    appendTextHalfSymbol(codewords, codewordIdx, 29, prevHalfSymbol);
+  }
+
+  return gTrue;
+}
+
+static GBool appendTextHalfSymbol(int *codewords, int &codewordIdx,
+				  int halfSymbol, int &prevHalfSymbol) {
+  if (prevHalfSymbol == 30) {
+    prevHalfSymbol = halfSymbol;
+  } else {
+    int codeword = prevHalfSymbol * 30 + halfSymbol;
+    if (!appendDataCodeword(codewords, codewordIdx, codeword)) {
+      return gFalse;
+    }
+    prevHalfSymbol = 30;
+  }
+  return gTrue;
+}
+
+static GBool appendDataCodeword(int *codewords, int &codewordIdx,
+				int codeword) {
+  if (codewordIdx >= maxDataCodewords) {
+    return gFalse;
+  }
+  codewords[codewordIdx++] = codeword;
+  return gTrue;
+}
+
+// Compute the error correction codewords and add to codewords[].
+static void makeErrorCorrectionCodewords(int errorCorrectionLevel,
+					 int *codewords, int length) {
+  int e[1 << (maxErrorCorrectionLevel + 1)];
+  int k = 1 << (errorCorrectionLevel + 1);
+  for (int i = 0; i < k; ++i) {
+    e[i] = 0;
+  }
+  for (int i = 0; i < length; ++i) {
+    int t1 = (codewords[i] + e[k-1]) % 929;
+    int t2, t3;
+    for (int j = k-1; j >= 1; --j) {
+      t2 = (t1 * errorCorrectionCoeff[errorCorrectionLevel][j]) % 929;
+      t3 = 929 - t2;
+      e[j] = (e[j-1] + t3) % 929;
+    }
+    t2 = (t1 * errorCorrectionCoeff[errorCorrectionLevel][0]) % 929;
+    t3 = 929 - t2;
+    e[0] = t3 % 929;
+  }
+  int j = length;
+  for (int i = k-1; i >= 0; --i) {
+    int ee = e[i] ? (929 - e[i]) : 0;
+    codewords[j++] = ee;
+  }
+}
+
+// Draw the barcode in the rectangle (0, 0, fieldWidth, fieldHeight).
+static void drawBarcode(int *codewords, int totalLength,
+			int nRows, int nCols,
+			int errorCorrectionLevel,
+			double moduleWidth, double moduleHeight,
+			double fieldWidth, double fieldHeight,
+			GString *appearBuf) {
+  double w = (73 + nCols * 17) * moduleWidth;
+  double h = nRows * moduleHeight;
+  double x0 = 0.5 * (fieldWidth - w);
+  double y0 = 0.5 * (fieldHeight - h);
+
+  appearBuf->append("0 g q\n");
+  appearBuf->appendf("{0:.4f} 0 0 {1:.4f} {2:.4f} {3:.4f} cm\n",
+		     moduleWidth, moduleHeight, x0, y0);
+
+  int i = 0;
+  for (int row = 0; row < nRows; ++row) {
+    int cluster = row % 3;
+    int y = nRows - 1 - row;
+    int left = 0;
+    int right = 0;
+    switch (cluster) {
+    case 0:
+      left = 30 * (row / 3) + (nRows - 1) / 3;
+      right = 30 * (row / 3) + (nCols - 1);
+      break;
+    case 1:
+      left = 30 * (row / 3) + (errorCorrectionLevel * 3) + (nRows - 1) % 3;
+      right = 30 * (row / 3) + (nRows - 1) / 3;
+      break;
+    case 2:
+      left = 30 * (row / 3) + (nCols - 1);
+      right = 30 * (row / 3) + (errorCorrectionLevel * 3) + (nRows - 1) % 3;
+      break;
+    }
+    int x = 0;
+    drawPattern(x, y, startPattern, startPatternLength, appearBuf);
+    drawPattern(x, y, patterns[left][cluster], patternLength, appearBuf);
+    for (int col = 0; col < nCols; ++col) {
+      drawPattern(x, y, patterns[codewords[i]][cluster], patternLength,
+		  appearBuf);
+      ++i;
+    }
+    drawPattern(x, y, patterns[right][cluster], patternLength, appearBuf);
+    drawPattern(x, y, stopPattern, stopPatternLength, appearBuf);
+  }
+
+  appearBuf->append("Q\n");
+}
+
+static void drawPattern(int &x, int y, char *pattern, int length,
+			GString *appearBuf) {
+  for (int i = 0; i < length; ++i) {
+    if (!(i & 1)) {
+      appearBuf->appendf("{0:d} {1:d} {2:d} 1 re f\n", x, y, pattern[i]);
+    }
+    x += pattern[i];
+  }
+}

Added: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h	                        (rev 0)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -0,0 +1,32 @@
+//========================================================================
+//
+// PDF417Barcode.h
+//
+// Copyright 2018 Glyph & Cog, LLC
+//
+//========================================================================
+
+#ifndef PDF417BARCODE_H
+#define PDF417BARCODE_H
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+class GString;
+
+// Draw a PDF417 barcode:
+// fieldWidth, fieldHeight = field size (in points)
+// moduleWidth, moduleHeight = requested module size (in points)
+// errorCorrectionLevel = 0 .. 8
+// value = byte string
+// output is appended to appearBuf
+// Returns true on success, false on error.
+extern GBool drawPDF417Barcode(double fieldWidth, double fieldHeight,
+			       double moduleWidth, double moduleHeight,
+			       int errorCorrectionLevel, GString *value,
+			       GString *appearBuf);
+
+#endif


Property changes on: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDF417Barcode.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -673,25 +673,23 @@
 }
 
 void PDFCore::scrollToTopEdge() {
-  scrollTo(state->getScrollX(), tileMap->getPageTopY(tileMap->getFirstPage()));
+  scrollTo(state->getScrollX(),
+	   tileMap->getPageTopY(tileMap->getFirstPage()));
 }
 
 void PDFCore::scrollToBottomEdge() {
-  int horizMax, vertMax;
-
-  tileMap->getScrollLimits(&horizMax, &vertMax);
-  scrollTo(state->getScrollX(), vertMax - state->getWinH());
+  scrollTo(state->getScrollX(),
+	   tileMap->getPageBottomY(tileMap->getLastPage()));
 }
 
 void PDFCore::scrollToTopLeft() {
-  scrollTo(0, tileMap->getPageTopY(tileMap->getFirstPage()));
+  scrollTo(tileMap->getPageLeftX(tileMap->getFirstPage()),
+	   tileMap->getPageTopY(tileMap->getFirstPage()));
 }
 
 void PDFCore::scrollToBottomRight() {
-  int horizMax, vertMax;
-
-  tileMap->getScrollLimits(&horizMax, &vertMax);
-  scrollTo(horizMax - state->getWinW(), vertMax - state->getWinH());
+  scrollTo(tileMap->getPageRightX(tileMap->getLastPage()),
+	   tileMap->getPageBottomY(tileMap->getLastPage()));
 }
 
 void PDFCore::setZoom(double zoom) {
@@ -899,6 +897,10 @@
   }
 }
 
+SplashColorPtr PDFCore::getSelectionColor() {
+  return state->getSelectColor();
+}
+
 void PDFCore::setSelectionColor(SplashColor color) {
   int wx0, wy0, wx1, wy1;
 
@@ -1648,6 +1650,11 @@
   return doc->getCatalog()->getForm()->getField(idx);
 }
 
+GBool PDFCore::overText(int pg, double x, double y) {
+  loadText(pg);
+  return text->checkPointInside(x, y);
+}
+
 void PDFCore::forceRedraw() {
   startUpdate();
   state->forceRedraw();

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFCore.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -164,6 +164,7 @@
   void setSelectMode(SelectMode mode);
 
   // Selection color.
+  SplashColorPtr getSelectionColor();
   void setSelectionColor(SplashColor color);
 
   // Modify the selection.  These functions use device coordinates.
@@ -242,6 +243,7 @@
   FormField *findFormField(int pg, double x, double y);
   int findFormFieldIdx(int pg, double x, double y);
   FormField *getFormField(int idx);
+  GBool overText(int pg, double x, double y);
   void forceRedraw();
   void setTileDoneCbk(void (*cbk)(void *data), void *data);
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -34,6 +34,7 @@
 #include "Lexer.h"
 #include "Parser.h"
 #include "SecurityHandler.h"
+#include "UTF8.h"
 #ifndef DISABLE_OUTLINE
 #include "Outline.h"
 #endif
@@ -57,20 +58,8 @@
   int n, i;
 #endif
 
-  ok = gFalse;
-  errCode = errNone;
+  init(coreA);
 
-  core = coreA;
-
-  file = NULL;
-  str = NULL;
-  xref = NULL;
-  catalog = NULL;
-#ifndef DISABLE_OUTLINE
-  outline = NULL;
-#endif
-  optContent = NULL;
-
   fileName = fileNameA;
 #ifdef _WIN32
   n = fileName->getLength();
@@ -122,20 +111,8 @@
   Object obj;
   int i;
 
-  ok = gFalse;
-  errCode = errNone;
+  init(coreA);
 
-  core = coreA;
-
-  file = NULL;
-  str = NULL;
-  xref = NULL;
-  catalog = NULL;
-#ifndef DISABLE_OUTLINE
-  outline = NULL;
-#endif
-  optContent = NULL;
-
   // save both Unicode and 8-bit copies of the file name
   fileName = new GString();
   fileNameU = (wchar_t *)gmallocn(fileNameLen + 1, sizeof(wchar_t));
@@ -147,17 +124,13 @@
 
   // try to open file
   // NB: _wfopen is only available in NT
-/*
   version.dwOSVersionInfoSize = sizeof(version);
   GetVersionEx(&version);
   if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
     file = _wfopen(fileNameU, L"rb");
   } else {
-*/
     file = fopen(fileName->getCString(), "rb");
-/*
   }
-*/
   if (!file) {
     error(errIO, -1, "Couldn't open file '{0:t}'", fileName);
     errCode = errOpenFile;
@@ -172,6 +145,69 @@
 }
 #endif
 
+PDFDoc::PDFDoc(char *fileNameA, GString *ownerPassword,
+	       GString *userPassword, PDFCore *coreA) {
+/*
+#ifdef _WIN32
+  OSVERSIONINFO version;
+#endif
+*/
+  Object obj;
+/*
+#ifdef _WIN32
+  Unicode u;
+  int n, i, j;
+#endif
+*/
+
+  init(coreA);
+
+  fileName = new GString(fileNameA);
+
+#if defined(_WIN32)
+#if 0
+  n = 0;
+  i = 0;
+  while (getUTF8(fileName, &i, &u)) {
+    ++n;
+  }
+  fileNameU = (wchar_t *)gmallocn(n + 1, sizeof(wchar_t));
+  i = j = 0;
+  while (j < n && getUTF8(fileName, &i, &u)) {
+    fileNameU[j++] = (wchar_t)u;
+  }
+  fileNameU[n] = L'\0';
+  // NB: _wfopen is only available in NT
+  version.dwOSVersionInfoSize = sizeof(version);
+  GetVersionEx(&version);
+  if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) {
+    file = _wfopen(fileNameU, L"rb");
+  } else {
+#endif /* 0 */
+    file = fopen(fileName->getCString(), "rb");
+#if 0
+  }
+#endif /* 0 */
+
+#elif defined(VMS)
+  file = fopen(fileName->getCString(), "rb", "ctx=stm");
+#else
+  file = fopen(fileName->getCString(), "rb");
+#endif
+
+  if (!file) {
+    error(errIO, -1, "Couldn't open file '{0:t}'", fileName);
+    errCode = errOpenFile;
+    return;
+  }
+
+  // create stream
+  obj.initNull();
+  str = new FileStream(file, 0, gFalse, 0, &obj);
+
+  ok = setup(ownerPassword, userPassword);
+}
+
 PDFDoc::PDFDoc(BaseStream *strA, GString *ownerPassword,
 	       GString *userPassword, PDFCore *coreA) {
 #ifdef _WIN32
@@ -178,9 +214,8 @@
   int n, i;
 #endif
 
-  ok = gFalse;
-  errCode = errNone;
-  core = coreA;
+  init(coreA);
+
   if (strA->getFileName()) {
     fileName = strA->getFileName()->copy();
 #ifdef _WIN32
@@ -197,8 +232,15 @@
     fileNameU = NULL;
 #endif
   }
+  ok = setup(ownerPassword, userPassword);
+}
+
+void PDFDoc::init(PDFCore *coreA) {
+  ok = gFalse;
+  errCode = errNone;
+  core = coreA;
   file = NULL;
-  str = strA;
+  str = NULL;
   xref = NULL;
   catalog = NULL;
 #ifndef DISABLE_OUTLINE
@@ -205,7 +247,6 @@
   outline = NULL;
 #endif
   optContent = NULL;
-  ok = setup(ownerPassword, userPassword);
 }
 
 GBool PDFDoc::setup(GString *ownerPassword, GString *userPassword) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PDFDoc.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -40,12 +40,20 @@
 
   PDFDoc(GString *fileNameA, GString *ownerPassword = NULL,
 	 GString *userPassword = NULL, PDFCore *coreA = NULL);
+
 #ifdef _WIN32
   PDFDoc(wchar_t *fileNameA, int fileNameLen, GString *ownerPassword = NULL,
 	 GString *userPassword = NULL, PDFCore *coreA = NULL);
 #endif
+
+  // This version takes a UTF-8 file name (which is only relevant on
+  // Windows).
+  PDFDoc(char *fileNameA, GString *ownerPassword = NULL,
+	 GString *userPassword = NULL, PDFCore *coreA = NULL);
+
   PDFDoc(BaseStream *strA, GString *ownerPassword = NULL,
 	 GString *userPassword = NULL, PDFCore *coreA = NULL);
+
   ~PDFDoc();
 
   // Was PDF document successfully opened?
@@ -185,6 +193,7 @@
 
 private:
 
+  void init(PDFCore *coreA);
   GBool setup(GString *ownerPassword, GString *userPassword);
   GBool setup2(GString *ownerPassword, GString *userPassword,
 	       GBool repairXRef);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -1240,7 +1240,7 @@
   for (x = 0; x < width; x += 8) {
     byte = 0;
     for (xx = 0; xx < 8; ++xx) {
-      byte <<= 1;
+      byte = (Guchar)(byte << 1);
       if (x + xx < width) {
 	for (i = 0; i < numComps; ++i) {
 	  if (linePtr[i] < maskColors[2 * i] ||
@@ -1296,7 +1296,7 @@
   fontFileInfo = new GHash();
   imgIDs = NULL;
   formIDs = NULL;
-  xobjStack = NULL;
+  visitedResources = NULL;
   saveStack = NULL;
   paperSizes = NULL;
   embFontList = NULL;
@@ -1358,7 +1358,7 @@
   fontFileInfo = new GHash();
   imgIDs = NULL;
   formIDs = NULL;
-  xobjStack = NULL;
+  visitedResources = NULL;
   saveStack = NULL;
   paperSizes = NULL;
   embFontList = NULL;
@@ -1489,7 +1489,6 @@
   formIDLen = 0;
   formIDSize = 0;
 
-  xobjStack = new GList();
   noStateChanges = gFalse;
   saveStack = new GList();
   numTilingPatterns = 0;
@@ -1561,9 +1560,6 @@
   deleteGHash(fontFileInfo, PSFontFileInfo);
   gfree(imgIDs);
   gfree(formIDs);
-  if (xobjStack) {
-    delete xobjStack;
-  }
   if (saveStack) {
     delete saveStack;
   }
@@ -1737,6 +1733,7 @@
   Form *form;
   Object obj1, obj2, obj3;
   GString *s;
+  GBool needDefaultFont;
   int pg, i, j;
 
   // check to see which pages will be rasterized
@@ -1749,6 +1746,9 @@
     rasterizePage = NULL;
   }
 
+  visitedResources = (char *)gmalloc(xref->getNumObjects());
+  memset(visitedResources, 0, xref->getNumObjects());
+
   if (mode == psModeForm) {
     // swap the form and xpdf dicts
     writePS("xpdf end begin dup begin\n");
@@ -1755,6 +1755,7 @@
   } else {
     writePS("xpdf begin\n");
   }
+  needDefaultFont = gFalse;
   for (pg = firstPage; pg <= lastPage; ++pg) {
     if (rasterizePage[pg - firstPage]) {
       continue;
@@ -1765,6 +1766,9 @@
     }
     annots = new Annots(doc, page->getAnnots(&obj1));
     obj1.free();
+    if (annots->getNumAnnots()) {
+      needDefaultFont = gTrue;
+    }
     for (i = 0; i < annots->getNumAnnots(); ++i) {
       if (annots->getAnnot(i)->getAppearance(&obj1)->isStream()) {
 	obj1.streamGetDict()->lookup("Resources", &obj2);
@@ -1778,6 +1782,9 @@
     delete annots;
   }
   if ((form = catalog->getForm())) {
+    if (form->getNumFields() > 0) {
+      needDefaultFont = gTrue;
+    }
     for (i = 0; i < form->getNumFields(); ++i) {
       form->getField(i)->getResources(&obj1);
       if (obj1.isArray()) {
@@ -1794,6 +1801,9 @@
       obj1.free();
     }
   }
+  if (needDefaultFont) {
+    setupDefaultFont();
+  }
   if (mode != psModeForm) {
     if (mode != psModeEPS && !manualCtrl) {
       writePSFmt("{0:s} pdfSetup\n",
@@ -1818,6 +1828,9 @@
   if (mode != psModeForm) {
     writePS("end\n");
   }
+
+  gfree(visitedResources);
+  visitedResources = NULL;
 }
 
 void PSOutputDev::writePageTrailer() {
@@ -1895,9 +1908,9 @@
 void PSOutputDev::setupResources(Dict *resDict) {
   Object xObjDict, xObjRef, xObj, patDict, patRef, pat;
   Object gsDict, gsRef, gs, smask, smaskGroup, resObj;
-  Ref ref0, ref1;
+  Ref ref0;
   GBool skip;
-  int i, j;
+  int i;
 
   setupFonts(resDict);
   setupImages(resDict);
@@ -1907,20 +1920,12 @@
   if (xObjDict.isDict()) {
     for (i = 0; i < xObjDict.dictGetLength(); ++i) {
 
-      // avoid infinite recursion on XObjects
+      // check for an already-visited XObject
       skip = gFalse;
       if ((xObjDict.dictGetValNF(i, &xObjRef)->isRef())) {
 	ref0 = xObjRef.getRef();
-	for (j = 0; j < xobjStack->getLength(); ++j) {
-	  ref1 = *(Ref *)xobjStack->get(j);
-	  if (ref1.num == ref0.num && ref1.gen == ref0.gen) {
-	    skip = gTrue;
-	    break;
-	  }
-	}
-	if (!skip) {
-	  xobjStack->append(&ref0);
-	}
+	skip = (GBool)visitedResources[ref0.num];
+	visitedResources[ref0.num] = 1;
       }
       if (!skip) {
 
@@ -1936,9 +1941,6 @@
 	xObj.free();
       }
 
-      if (xObjRef.isRef() && !skip) {
-	xobjStack->del(xobjStack->getLength() - 1);
-      }
       xObjRef.free();
     }
   }
@@ -1950,20 +1952,12 @@
     inType3Char = gTrue;
     for (i = 0; i < patDict.dictGetLength(); ++i) {
 
-      // avoid infinite recursion on Patterns
+      // check for an already-visited Pattern
       skip = gFalse;
       if ((patDict.dictGetValNF(i, &patRef)->isRef())) {
 	ref0 = patRef.getRef();
-	for (j = 0; j < xobjStack->getLength(); ++j) {
-	  ref1 = *(Ref *)xobjStack->get(j);
-	  if (ref1.num == ref0.num && ref1.gen == ref0.gen) {
-	    skip = gTrue;
-	    break;
-	  }
-	}
-	if (!skip) {
-	  xobjStack->append(&ref0);
-	}
+	skip = (GBool)visitedResources[ref0.num];
+	visitedResources[ref0.num] = 1;
       }
       if (!skip) {
 
@@ -1979,9 +1973,6 @@
 	pat.free();
       }
 
-      if (patRef.isRef() && !skip) {
-	xobjStack->del(xobjStack->getLength() - 1);
-      }
       patRef.free();
     }
     inType3Char = gFalse;
@@ -1993,20 +1984,12 @@
   if (gsDict.isDict()) {
     for (i = 0; i < gsDict.dictGetLength(); ++i) {
 
-      // avoid infinite recursion on ExtGStates
+      // check for an already-visited ExtGState
       skip = gFalse;
       if ((gsDict.dictGetValNF(i, &gsRef)->isRef())) {
 	ref0 = gsRef.getRef();
-	for (j = 0; j < xobjStack->getLength(); ++j) {
-	  ref1 = *(Ref *)xobjStack->get(j);
-	  if (ref1.num == ref0.num && ref1.gen == ref0.gen) {
-	    skip = gTrue;
-	    break;
-	  }
-	}
-	if (!skip) {
-	  xobjStack->append(&ref0);
-	}
+	skip = (GBool)visitedResources[ref0.num];
+	visitedResources[ref0.num] = 1;
       }
       if (!skip) {
 
@@ -2027,9 +2010,6 @@
 	gs.free();
       }
 
-      if (gsRef.isRef() && !skip) {
-	xobjStack->del(xobjStack->getLength() - 1);
-      }
       gsRef.free();
     }
   }
@@ -2149,6 +2129,9 @@
 	  fi->ff = setupExternalCIDTrueTypeFont(font, fontLoc->path,
 						fontLoc->fontNum, gTrue);
 	  break;
+	case fontCIDType0COT:
+	  fi->ff = setupExternalOpenTypeCFFFont(font, fontLoc->path);
+	  break;
 	default:
 	  break;
 	}
@@ -2194,7 +2177,7 @@
 	}
       }
       if (code < 256) {
-	w1 = ((Gfx8BitFont *)font)->getWidth(code);
+	w1 = ((Gfx8BitFont *)font)->getWidth((Guchar)code);
       } else {
 	w1 = 0;
       }
@@ -2272,8 +2255,10 @@
   int length1, length2, n;
 
   // check if font is already embedded
-  if ((ff = (PSFontFileInfo *)
-                fontFileInfo->lookup(font->getEmbeddedFontName()))) {
+  if (!font->getEmbeddedFontName()) {
+    rename = gTrue;
+  } else if ((ff = (PSFontFileInfo *)
+	             fontFileInfo->lookup(font->getEmbeddedFontName()))) {
     if (ff->loc == psFontFileEmbedded &&
 	ff->embFontID.num == id->num &&
 	ff->embFontID.gen == id->gen) {
@@ -2408,7 +2393,7 @@
 	  if ((c = fgetc(fontFile)) == EOF) {
 	    break;
 	  }
-	  writePSChar(c);
+	  writePSChar((char)c);
 	}
       } else {
 	for (i = 0; i < n; ++i) {
@@ -2438,10 +2423,10 @@
 
   // plain text (PFA) format
   } else {
-    writePSChar(buf[0]);
-    writePSChar(buf[1]);
+    writePSChar((char)buf[0]);
+    writePSChar((char)buf[1]);
     while ((c = fgetc(fontFile)) != EOF) {
-      writePSChar(c);
+      writePSChar((char)c);
     }
   }
 
@@ -2999,6 +2984,119 @@
   return ff;
 }
 
+// This assumes an OpenType CFF font that has a Unicode cmap (in the
+// OpenType section), and a CFF blob that uses an identity CID-to-GID
+// mapping.
+PSFontFileInfo *PSOutputDev::setupExternalOpenTypeCFFFont(GfxFont *font,
+							  GString *fileName) {
+  GString *psName;
+  PSFontFileInfo *ff;
+  FoFiTrueType *ffTT;
+  GHashIter *iter;
+  CharCodeToUnicode *ctu;
+  Unicode uBuf[8];
+  int *codeToGID;
+  int codeToGIDLen;
+  int cmap, cmapPlatform, cmapEncoding, code;
+
+  // create a code-to-GID mapping, via Unicode
+  if (!(ffTT = FoFiTrueType::load(fileName->getCString(), 0, gTrue))) {
+    return NULL;
+  }
+  if (!ffTT->isOpenTypeCFF()) {
+    delete ffTT;
+    return NULL;
+  }
+  if (!(ctu = ((GfxCIDFont *)font)->getToUnicode())) {
+    error(errSyntaxError, -1,
+	  "Couldn't find a mapping to Unicode for font '{0:s}'",
+	  font->getName() ? font->getName()->getCString() : "(unnamed)");
+    delete ffTT;
+    return NULL;
+  }
+  // look for a Unicode cmap
+  for (cmap = 0; cmap < ffTT->getNumCmaps(); ++cmap) {
+    cmapPlatform = ffTT->getCmapPlatform(cmap);
+    cmapEncoding = ffTT->getCmapEncoding(cmap);
+    if ((cmapPlatform == 3 && cmapEncoding == 1) ||
+	(cmapPlatform == 0 && cmapEncoding <= 4)) {
+      break;
+    }
+  }
+  if (cmap >= ffTT->getNumCmaps()) {
+    error(errSyntaxError, -1,
+	  "Couldn't find a Unicode cmap in font '{0:s}'",
+	  font->getName() ? font->getName()->getCString() : "(unnamed)");
+    ctu->decRefCnt();
+    delete ffTT;
+    return NULL;
+  }
+  // map CID -> Unicode -> GID
+  if (ctu->isIdentity()) {
+    codeToGIDLen = 65536;
+  } else {
+    codeToGIDLen = ctu->getLength();
+  }
+  codeToGID = (int *)gmallocn(codeToGIDLen, sizeof(int));
+  for (code = 0; code < codeToGIDLen; ++code) {
+    if (ctu->mapToUnicode(code, uBuf, 8) > 0) {
+      codeToGID[code] = ffTT->mapCodeToGID(cmap, uBuf[0]);
+    } else {
+      codeToGID[code] = 0;
+    }
+  }
+  ctu->decRefCnt();
+
+  // check if font is already embedded
+  fontFileInfo->startIter(&iter);
+  while (fontFileInfo->getNext(&iter, &psName, (void **)&ff)) {
+    if (ff->loc == psFontFileExternal &&
+	ff->type == font->getType() &&
+	!ff->extFileName->cmp(fileName) &&
+	ff->codeToGIDLen == codeToGIDLen &&
+	ff->codeToGID &&
+	!memcmp(ff->codeToGID, codeToGID, codeToGIDLen * sizeof(int))) {
+      fontFileInfo->killIter(&iter);
+      gfree(codeToGID);
+      delete ffTT;
+      return ff;
+    }
+  }
+
+  // generate name
+  psName = makePSFontName(font, font->getID());
+
+  // beginning comment
+  writePSFmt("%%BeginResource: font {0:t}\n", psName);
+  embFontList->append("%%+ font ");
+  embFontList->append(psName->getCString());
+  embFontList->append("\n");
+
+  // convert it to a Type 0 font
+  if (globalParams->getPSLevel() >= psLevel3) {
+    // Level 3: use a CID font
+    ffTT->convertToCIDType0(psName->getCString(),
+			    codeToGID, codeToGIDLen,
+			    outputFunc, outputStream);
+  } else {
+    // otherwise: use a non-CID composite font
+    ffTT->convertToType0(psName->getCString(),
+			 codeToGID, codeToGIDLen,
+			 outputFunc, outputStream);
+  }
+  delete ffTT;
+
+  // ending comment
+  writePS("%%EndResource\n");
+
+  ff = new PSFontFileInfo(psName, font->getType(), psFontFileExternal);
+  ff->extFileName = fileName->copy();
+  ff->codeToGID = codeToGID;
+  ff->codeToGIDLen = codeToGIDLen;
+  fontFileInfo->add(ff->psName, ff);
+  return ff;
+}
+
 PSFontFileInfo *PSOutputDev::setupType3Font(GfxFont *font,
 					    Dict *parentResDict) {
   PSFontFileInfo *ff;
@@ -3404,17 +3502,17 @@
       continue;
     }
     if (c >= '0' && c <= '9') {
-      byte += c - '0';
+      byte = (Guchar)(byte + (c - '0'));
     } else if (c >= 'A' && c <= 'F') {
-      byte += c - 'A' + 10;
+      byte = (Guchar)(byte + (c - 'A' + 10));
     } else if (c >= 'a' && c <= 'f') {
-      byte += c - 'a' + 10;
+      byte = (Guchar)(byte + (c - 'a' + 10));
     } else {
       delete out;
       return in;
     }
     if (state == 0) {
-      byte <<= 4;
+      byte = (Guchar)(byte << 4);
       state = 1;
     } else {
       out->append((char)byte);
@@ -3557,6 +3655,10 @@
   font->insert(i, name);
 }
 
+void PSOutputDev::setupDefaultFont() {
+  writePS("/xpdf_default_font /Helvetica 1 1 ISOLatin1Encoding pdfMakeFont\n");
+}
+
 void PSOutputDev::setupImages(Dict *resDict) {
   Object xObjDict, xObj, xObjRef, subtypeObj, maskObj, maskRef;
   Ref imgID;
@@ -3591,12 +3693,17 @@
 		imgIDs = (Ref *)greallocn(imgIDs, imgIDSize, sizeof(Ref));
 	      }
 	      imgIDs[imgIDLen++] = imgID;
-	      setupImage(imgID, xObj.getStream(), gFalse);
-	      if (level >= psLevel3 &&
-		  xObj.streamGetDict()->lookup("Mask", &maskObj)->isStream()) {
-		setupImage(imgID, maskObj.getStream(), gTrue);
+	      setupImage(imgID, xObj.getStream(), gFalse, NULL);
+	      if (level >= psLevel3) {
+		xObj.streamGetDict()->lookup("Mask", &maskObj);
+		if (maskObj.isStream()) {
+		  setupImage(imgID, maskObj.getStream(), gTrue, NULL);
+		} else if (level == psLevel3Gray && maskObj.isArray()) {
+		  setupImage(imgID, xObj.getStream(), gFalse,
+			     maskObj.getArray());
+		}
+	        maskObj.free();
 	      }
-	      maskObj.free();
 	    }
 	  } else {
 	    error(errSyntaxError, -1,
@@ -3612,12 +3719,12 @@
   xObjDict.free();
 }
 
-//~ this doesn't currently handle color key masks in psLevel3Gray
-//~   (which need to be converted to explicit masks)
-void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask) {
+void PSOutputDev::setupImage(Ref id, Stream *str, GBool mask,
+			     Array *colorKeyMask) {
   StreamColorSpaceMode csMode;
   GfxColorSpace *colorSpace;
   GfxImageColorMap *colorMap;
+  int maskColors[2*gfxColorMaxComps];
   Object obj1;
   GBool imageMask, useLZW, useRLE, useCompressed, useASCIIHex;
   GString *s;
@@ -3696,8 +3803,20 @@
     useCompressed = gFalse;
     useASCIIHex = gTrue;
   } else {
-    if (colorMap && (colorMap->getColorSpace()->getMode() == csDeviceN ||
-		     level == psLevel2Gray || level == psLevel3Gray)) {
+    if (colorKeyMask) {
+      if (globalParams->getPSUncompressPreloadedImages()) {
+	useLZW = useRLE = gFalse;
+      } else if (globalParams->getPSLZW()) {
+	useLZW = gTrue;
+	useRLE = gFalse;
+      } else {
+	useRLE = gTrue;
+	useLZW = gFalse;
+      }
+      useCompressed = gFalse;
+    } else if (colorMap &&
+	       (colorMap->getColorSpace()->getMode() == csDeviceN ||
+		level == psLevel2Gray || level == psLevel3Gray)) {
       if (globalParams->getPSLZW()) {
 	useLZW = gTrue;
 	useRLE = gFalse;
@@ -3731,7 +3850,17 @@
   if (useCompressed) {
     str = str->getUndecodedStream();
   }
-  if (colorMap && (level == psLevel2Gray || level == psLevel3Gray)) {
+  if (colorKeyMask) {
+    memset(maskColors, 0, sizeof(maskColors));
+    for (i = 0; i < colorKeyMask->getLength() && i < 2*gfxColorMaxComps; ++i) {
+      colorKeyMask->get(i, &obj1);
+      if (obj1.isInt()) {
+	maskColors[i] = obj1.getInt();
+      }
+      obj1.free();
+    }
+    str = new ColorKeyToMaskEncoder(str, width, height, colorMap, maskColors);
+  } else if (colorMap && (level == psLevel2Gray || level == psLevel3Gray)) {
     str = new GrayRecoder(str, width, height, colorMap);
   } else if (colorMap && colorMap->getColorSpace()->getMode() == csDeviceN) {
     str = new DeviceNRecoder(str, width, height, colorMap);
@@ -3783,7 +3912,7 @@
     ++size;
   }
   writePSFmt("{0:d} array dup /{1:s}Data_{2:d}_{3:d} exch def\n",
-	     size, mask ? "Mask" : "Im", id.num, id.gen);
+	     size, (mask || colorKeyMask) ? "Mask" : "Im", id.num, id.gen);
   str->close();
 
   // write the data into the array
@@ -3798,10 +3927,10 @@
       break;
     }
     if (c == 'z') {
-      writePSChar(c);
+      writePSChar((char)c);
       ++col;
     } else {
-      writePSChar(c);
+      writePSChar((char)c);
       ++col;
       for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) {
 	do {
@@ -3810,7 +3939,7 @@
 	if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
 	  break;
 	}
-	writePSChar(c);
+	writePSChar((char)c);
 	++col;
       }
     }
@@ -4837,10 +4966,17 @@
 
 void PSOutputDev::updateFont(GfxState *state) {
   if (state->getFont()) {
-    writePSFmt("/F{0:d}_{1:d} {2:.6g} Tf\n",
-	       state->getFont()->getID()->num, state->getFont()->getID()->gen,
-	       fabs(state->getFontSize()) < 0.0001 ? 0.0001
-	                                            : state->getFontSize());
+    if (state->getFont()->getTag() &&
+	!state->getFont()->getTag()->cmp("xpdf_default_font")) {
+      writePSFmt("/xpdf_default_font {0:.6g} Tf\n",
+		 fabs(state->getFontSize()) < 0.0001 ? 0.0001
+		                                     : state->getFontSize());
+    } else {
+      writePSFmt("/F{0:d}_{1:d} {2:.6g} Tf\n",
+		 state->getFont()->getID()->num, state->getFont()->getID()->gen,
+		 fabs(state->getFontSize()) < 0.0001 ? 0.0001
+		                                     : state->getFontSize());
+    }
     noStateChanges = gFalse;
   }
 }
@@ -5056,6 +5192,7 @@
   writePSFmt("  /XStep {0:.6g}\n", xStep);
   writePSFmt("  /YStep {0:.6g}\n", yStep);
   writePS("  /PaintProc {\n");
+  writePS("    pop\n");
   box.x1 = bbox[0];
   box.y1 = bbox[1];
   box.x2 = bbox[2];
@@ -5850,7 +5987,7 @@
 	if (c == '>' || c == EOF) {
 	  break;
 	}
-	writePSChar(c);
+	writePSChar((char)c);
 	++col;
 	// each line is: "<...data...><eol>"
 	// so max data length = 255 - 4 = 251
@@ -6061,10 +6198,10 @@
 	  break;
 	}
 	if (c == 'z') {
-	  writePSChar(c);
+	  writePSChar((char)c);
 	  ++col;
 	} else {
-	  writePSChar(c);
+	  writePSChar((char)c);
 	  ++col;
 	  for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) {
 	    do {
@@ -6073,7 +6210,7 @@
 	    if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
 	      break;
 	    }
-	    writePSChar(c);
+	    writePSChar((char)c);
 	    ++col;
 	  }
 	}
@@ -6608,14 +6745,28 @@
     // mask data source
     if (maskColors && colorMap && level == psLevel3Gray) {
       s = NULL;
-      if (globalParams->getPSLZW()) {
-	maskUseLZW = gTrue;
-	maskUseRLE = gFalse;
+      if (mode == psModeForm || inType3Char || preload) {
+	if (globalParams->getPSUncompressPreloadedImages()) {
+	  maskUseLZW = maskUseRLE = gFalse;
+	} else if (globalParams->getPSLZW()) {
+	  maskUseLZW = gTrue;
+	  maskUseRLE = gFalse;
+	} else {
+	  maskUseRLE = gTrue;
+	  maskUseLZW = gFalse;
+	}
+	maskUseASCII = gFalse;
+	maskUseCompressed = gFalse;
       } else {
-	maskUseRLE = gTrue;
-	maskUseLZW = gFalse;
+	if (globalParams->getPSLZW()) {
+	  maskUseLZW = gTrue;
+	  maskUseRLE = gFalse;
+	} else {
+	  maskUseRLE = gTrue;
+	  maskUseLZW = gFalse;
+	}
+	maskUseASCII = gTrue;
       }
-      maskUseASCII = gTrue;
       maskUseCompressed = gFalse;
       maskWidth = width;
       maskHeight = height;
@@ -6647,13 +6798,13 @@
     }
     maskFilters = new GString();
     if (maskUseASCII) {
-      maskFilters->appendf("  /ASCII{0:s}Decode filter\n",
+      maskFilters->appendf("    /ASCII{0:s}Decode filter\n",
 			   useASCIIHex ? "Hex" : "85");
     }
     if (maskUseLZW) {
-      maskFilters->append("  /LZWDecode filter\n");
+      maskFilters->append("    /LZWDecode filter\n");
     } else if (maskUseRLE) {
-      maskFilters->append("  /RunLengthDecode filter\n");
+      maskFilters->append("    /RunLengthDecode filter\n");
     }
     if (maskUseCompressed) {
       maskFilters->append(s);
@@ -6661,8 +6812,7 @@
     if (s) {
       delete s;
     }
-    if ((mode == psModeForm || inType3Char || preload) &&
-	!(maskColors && colorMap && level == psLevel3Gray)) {
+    if (mode == psModeForm || inType3Char || preload) {
       writePSFmt("MaskData_{0:d}_{1:d} pdfMaskInit\n",
 		 ref->getRefNum(), ref->getRefGen());
     } else {
@@ -6744,10 +6894,10 @@
 	  break;
 	}
 	if (c == 'z') {
-	  writePSChar(c);
+	  writePSChar((char)c);
 	  ++col;
 	} else {
-	  writePSChar(c);
+	  writePSChar((char)c);
 	  ++col;
 	  for (i = 1; i <= (useASCIIHex ? 1 : 4); ++i) {
 	    do {
@@ -6756,7 +6906,7 @@
 	    if (c == (useASCIIHex ? '>' : '~') || c == EOF) {
 	      break;
 	    }
-	    writePSChar(c);
+	    writePSChar((char)c);
 	    ++col;
 	  }
 	}
@@ -6907,8 +7057,7 @@
 	       maskInvert ? 1 : 0, maskInvert ? 0 : 1);
 
     // mask data source
-    if ((mode == psModeForm || inType3Char || preload) &&
-	!(maskColors && colorMap && level == psLevel3Gray)) {
+    if (mode == psModeForm || inType3Char || preload) {
       writePS("  /DataSource {pdfMaskSrc}\n");
       writePS(maskFilters->getCString());
     } else {
@@ -8216,7 +8365,7 @@
       writePSFmt("\\{0:03o}", c);
       j += 4;
     } else {
-      writePSChar(c);
+      writePSChar((char)c);
       ++j;
     }
   }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSOutputDev.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -259,6 +259,8 @@
   virtual void psXObject(Stream *psStream, Stream *level1Stream);
 
   //----- miscellaneous
+  void setImageableArea(int imgLLXA, int imgLLYA, int imgURXA, int imgURYA)
+    { imgLLX = imgLLXA; imgLLY = imgLLYA; imgURX = imgURXA; imgURY = imgURYA; }
   void setOffset(double x, double y)
     { tx0 = x; ty0 = y; }
   void setScale(double x, double y)
@@ -307,6 +309,8 @@
 					       int fontNum,
 					       GBool needVerticalMetrics);
   PSFontFileInfo *setupEmbeddedOpenTypeCFFFont(GfxFont *font, Ref *id);
+  PSFontFileInfo *setupExternalOpenTypeCFFFont(GfxFont *font,
+					       GString *fileName);
   PSFontFileInfo *setupType3Font(GfxFont *font, Dict *parentResDict);
   GString *makePSFontName(GfxFont *font, Ref *id);
   GString *fixType1Font(GString *font, int length1, int length2);
@@ -320,8 +324,9 @@
   GString *copyType1PFA(Guchar *font, int fontSize);
   GString *copyType1PFB(Guchar *font, int fontSize);
   void renameType1Font(GString *font, GString *name);
+  void setupDefaultFont();
   void setupImages(Dict *resDict);
-  void setupImage(Ref id, Stream *stream, GBool mask);
+  void setupImage(Ref id, Stream *str, GBool mask, Array *colorKeyMask);
   void setupForms(Dict *resDict);
   void setupForm(Object *strRef, Object *strObj);
   void addProcessColor(double c, double m, double y, double k);
@@ -455,8 +460,7 @@
   Ref *formIDs;			// list of IDs for predefined forms
   int formIDLen;		// number of entries in formIDs array
   int formIDSize;		// size of formIDs array
-  GList *xobjStack;		// stack of XObject dicts currently being
-				//   processed
+  char *visitedResources;	// vector of resource objects already visited
   GBool noStateChanges;		// true if there have been no state changes
 				//   since the last save
   GList *saveStack;		// "no state changes" flag for each

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PSTokenizer.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -77,12 +77,12 @@
 
   // read a token
   i = 0;
-  buf[i++] = c;
+  buf[i++] = (char)c;
   if (c == '(') {
     backslash = gFalse;
     while ((c = lookChar()) != EOF) {
       if (i < size - 1) {
-	buf[i++] = c;
+	buf[i++] = (char)c;
       }
       getChar();
       if (c == '\\') {
@@ -97,7 +97,7 @@
     while ((c = lookChar()) != EOF) {
       getChar();
       if (i < size - 1 && specialChars[c] != 1) {
-	buf[i++] = c;
+	buf[i++] = (char)c;
       }
       if (c == '>') {
 	break;
@@ -107,7 +107,7 @@
     while ((c = lookChar()) != EOF && !specialChars[c]) {
       getChar();
       if (i < size - 1) {
-	buf[i++] = c;
+	buf[i++] = (char)c;
       }
     }
   }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/PreScanOutputDev.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -289,6 +289,8 @@
 void PreScanOutputDev::check(GfxState *state,
 			     GfxColorSpace *colorSpace, GfxColor *color,
 			     double opacity, GfxBlendMode blendMode) {
+  GfxGray gr;
+  GfxCMYK cmyk;
   GfxRGB rgb;
 
   if (colorSpace->getMode() == csPattern) {
@@ -295,6 +297,20 @@
     mono = gFalse;
     gray = gFalse;
     gdi = gFalse;
+  } else if (colorSpace->getMode() == csDeviceGray ||
+	     colorSpace->getMode() == csCalGray) {
+    colorSpace->getGray(color, &gr, state->getRenderingIntent());
+    if (!(gr == 0 || gr == gfxColorComp1)) {
+      mono = gFalse;
+    }
+  } else if (colorSpace->getMode() == csDeviceCMYK) {
+    colorSpace->getCMYK(color, &cmyk, state->getRenderingIntent());
+    if (cmyk.c != 0 || cmyk.m != 0 || cmyk.y != 0) {
+      mono = gFalse;
+      gray = gFalse;
+    } else if (!(cmyk.k == 0 || cmyk.k == gfxColorComp1)) {
+      mono = gFalse;
+    }
   } else {
     colorSpace->getRGB(color, &rgb, state->getRenderingIntent());
     if (rgb.r != rgb.g || rgb.g != rgb.b || rgb.b != rgb.r) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -65,6 +65,14 @@
 };
 
 //------------------------------------------------------------------------
+
+// Clip x to lie in [0, 255].
+static inline Guchar clip255(int x) {
+  return x < 0 ? 0 : x > 255 ? 255 : (Guchar)x;
+}
+
+
+//------------------------------------------------------------------------
 // Blend functions
 //------------------------------------------------------------------------
 
@@ -73,7 +81,7 @@
   int i;
 
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
-    blend[i] = (dest[i] * src[i]) / 255;
+    blend[i] = (Guchar)((dest[i] * src[i]) / 255);
   }
 }
 
@@ -82,11 +90,11 @@
   int i;
 
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
-    blend[i] = dest[i] + src[i] - (dest[i] * src[i]) / 255;
+    blend[i] = (Guchar)(dest[i] + src[i] - (dest[i] * src[i]) / 255);
   }
 }
 
-// note: this is the same os HardLight
+// note: this is the same as HardLight, with src/dest reversed
 static void splashOutBlendOverlay(SplashColorPtr src, SplashColorPtr dest,
 				  SplashColorPtr blend, SplashColorMode cm) {
   int i;
@@ -94,8 +102,8 @@
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
     // the spec says "if Cs <= 0.5" -- note that 0x80 is 128/255=0.5020
     blend[i] = dest[i] < 0x80
-                 ? (src[i] * 2 * dest[i]) / 255
-                 : 255 - 2 * ((255 - src[i]) * (255 - dest[i])) / 255;
+                 ? (Guchar)((src[i] * 2 * dest[i]) / 255)
+                 : (Guchar)(255 - 2 * ((255 - src[i]) * (255 - dest[i])) / 255);
   }
 }
 
@@ -128,7 +136,7 @@
     } else if (dest[i] >= 255 - src[i]) {
       blend[i] = 255;
     } else {
-      blend[i] = (dest[i] * 255) / (255 - src[i]);
+      blend[i] = (Guchar)((dest[i] * 255) / (255 - src[i]));
     }
   }
 }
@@ -143,7 +151,7 @@
     } else if (255 - dest[i] >= src[i]) {
       blend[i] = 0;
     } else {
-      blend[i] = 255 - (((255 - dest[i]) * 255) / src[i]);
+      blend[i] = (Guchar)(255 - (((255 - dest[i]) * 255) / src[i]));
     }
   }
 }
@@ -155,8 +163,8 @@
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
     // the spec says "if Cs <= 0.5" -- note that 0x80 is 128/255=0.5020
     blend[i] = src[i] < 0x80
-                 ? (dest[i] * 2 * src[i]) / 255
-                 : 255 - 2 * ((255 - dest[i]) * (255 - src[i])) / 255;
+                 ? (Guchar)((dest[i] * 2 * src[i]) / 255)
+                 : (Guchar)(255 - 2 * ((255 - dest[i]) * (255 - src[i])) / 255);
   }
 }
 
@@ -167,8 +175,9 @@
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
     // the spec says "if Cs <= 0.5" -- note that 0x80 is 128/255=0.5020
     if (src[i] < 0x80) {
-      blend[i] = dest[i] - (255 - 2 * src[i]) * dest[i] * (255 - dest[i]) /
-	         (255 * 255);
+      blend[i] = (Guchar)(dest[i] -
+			  (255 - 2 * src[i]) * dest[i] * (255 - dest[i]) /
+			    (255 * 255));
     } else {
       // the spec says "if Cb <= 0.25" -- note that 0x40 is 64/255=0.2510
       if (dest[i] < 0x40) {
@@ -177,7 +186,7 @@
       } else {
 	x = (int)sqrt(255.0 * dest[i]);
       }
-      blend[i] = dest[i] + (2 * src[i] - 255) * (x - dest[i]) / 255;
+      blend[i] = (Guchar)(dest[i] + (2 * src[i] - 255) * (x - dest[i]) / 255);
     }
   }
 }
@@ -188,7 +197,8 @@
   int i;
 
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
-    blend[i] = dest[i] < src[i] ? src[i] - dest[i] : dest[i] - src[i];
+    blend[i] = dest[i] < src[i] ? (Guchar)(src[i] - dest[i])
+			        : (Guchar)(dest[i] - src[i]);
   }
 }
 
@@ -197,7 +207,7 @@
   int i;
 
   for (i = 0; i < splashColorModeNComps[cm]; ++i) {
-    blend[i] = dest[i] + src[i] - (2 * dest[i] * src[i]) / 255;
+    blend[i] = (Guchar)(dest[i] + src[i] - (2 * dest[i] * src[i]) / 255);
   }
 }
 
@@ -423,6 +433,7 @@
   &splashOutBlendLuminosity
 };
 
+
 //------------------------------------------------------------------------
 // SplashOutFontFileID
 //------------------------------------------------------------------------
@@ -526,7 +537,7 @@
   cacheTags = (T3FontCacheTag *)gmallocn(cacheSets * cacheAssoc,
 					 sizeof(T3FontCacheTag));
   for (i = 0; i < cacheSets * cacheAssoc; ++i) {
-    cacheTags[i].mru = i & (cacheAssoc - 1);
+    cacheTags[i].mru = (Gushort)(i & (cacheAssoc - 1));
   }
 }
 
@@ -565,6 +576,9 @@
   GfxColorSpace *blendingColorSpace;
   GBool isolated;
 
+  //----- modified region in tBitmap
+  int modXMin, modYMin, modXMax, modYMax;
+
   //----- saved state
   SplashBitmap *origBitmap;
   Splash *origSplash;
@@ -627,6 +641,7 @@
   startPageCbkData = NULL;
 }
 
+
 void SplashOutputDev::setupScreenParams(double hDPI, double vDPI) {
   screenParams.size = globalParams->getScreenSize();
   screenParams.dotRadius = globalParams->getScreenDotRadius();
@@ -906,6 +921,7 @@
 #endif
 }
 
+
 void SplashOutputDev::updateFillColor(GfxState *state) {
   GfxGray gray;
   GfxRGB rgb;
@@ -960,6 +976,7 @@
   }
 }
 
+
 SplashPattern *SplashOutputDev::getColor(GfxGray gray) {
   SplashColor color;
 
@@ -1018,6 +1035,7 @@
 #endif
 
 
+
 void SplashOutputDev::setOverprintMask(GfxState *state,
 				       GfxColorSpace *colorSpace,
 				       GBool overprintFlag,
@@ -1054,6 +1072,7 @@
   }
   splash->setOverprintMask(mask);
 #endif
+
 }
 
 void SplashOutputDev::updateBlendMode(GfxState *state) {
@@ -1474,7 +1493,8 @@
 	  memcpy(codeToGID, ((GfxCIDFont *)gfxFont)->getCIDToGID(),
 		 n * sizeof(int));
 	}
-      } else if (globalParams->getMapExtTrueTypeFontsViaUnicode()) {
+      } else if (globalParams->getMapExtTrueTypeFontsViaUnicode() &&
+		 !((GfxCIDFont *)gfxFont)->usesIdentityEncoding()) {
 	// create a CID-to-GID mapping, via Unicode
 	if ((ctu = ((GfxCIDFont *)gfxFont)->getToUnicode())) {
 #if LOAD_FONTS_FROM_MEM
@@ -1572,7 +1592,7 @@
 	  ((name[0] >= 'A' && name[0] <= 'Z') ||
 	   (name[0] >= 'a' && name[0] <= 'z') ||
 	   (name[0] >= '0' && name[0] <= '9'))) {
-	w = ((Gfx8BitFont *)gfxFont)->getWidth(code);
+	w = ((Gfx8BitFont *)gfxFont)->getWidth((Guchar)code);
 	builtinFontSubst[substIdx]->widths->getWidth(name, &ww);
 	if (w > 0.01 && ww > 10) {
 	  w /= ww * 0.001;
@@ -1685,7 +1705,7 @@
   double xStepX, xStepY, yStepX, yStepY;
   double adjXMin, adjYMin;
   double sx, sy;
-  double clipXMin, clipYMin, clipXMax, clipYMax;
+  double clipXMin, clipYMin, clipXMax, clipYMax, clipXC, clipYC;
   double tx, ty, idet, txMin, tyMin, txMax, tyMax;
   int tileW, tileH, tileSize;
   int ixMin, ixMax, iyMin, iyMax, ix, iy, x, y;
@@ -1781,15 +1801,27 @@
   state->transformDelta(xStep * mat[0], xStep * mat[1], &xStepX, &xStepY);
   state->transformDelta(yStep * mat[2], yStep * mat[3], &yStepX, &yStepY);
 
+  // get the clipping bbox (in device space)
+  state->getClipBBox(&clipXMin, &clipYMin, &clipXMax, &clipYMax);
+
   // compute tiling parameters
-  if (tilingType == 2) {
+  idet = xStepX * yStepY - yStepX * xStepY;
+  if (tilingType == 2 || idet == 0) {
     adjXMin = tileXMin;
     adjYMin = tileYMin;
     sx = 1;
     sy = 1;
   } else {
-    adjXMin = (int)floor(tileXMin + 0.5);
-    adjYMin = (int)floor(tileYMin + 0.5);
+    // reposition the pattern origin to the center of the clipping bbox
+    idet = 1 / idet;
+    clipXC = 0.5 * (clipXMin + clipXMax);
+    clipYC = 0.5 * (clipYMin + clipYMax);
+    ix = (int)((yStepX * (tileYMin - clipYC) - (tileXMin - clipXC) * yStepY)
+	       * idet + 0.5);
+    iy = (int)((xStepX * (clipYC - tileYMin) - (clipXC - tileXMin) * xStepY)
+	       * idet + 0.5);
+    adjXMin = (int)floor(tileXMin + ix * xStepX + iy * yStepX + 0.5);
+    adjYMin = (int)floor(tileYMin + ix * xStepY + iy * yStepY + 0.5);
     sx = tileW / (tileXMax - tileXMin);
     sy = tileH / (tileYMax - tileYMin);
     xStepX = (int)floor(sx * xStepX + 0.5);
@@ -1834,7 +1866,6 @@
   // - look at the four corners of the clipping bbox
   // - solve for the (ix,iy) tile position at each corner
   // - take the min and max values for ix, iy
-  state->getClipBBox(&clipXMin, &clipYMin, &clipXMax, &clipYMax);
   idet = xStepX * yStepY - xStepY * yStepX;
   if (idet == 0) {
     return;
@@ -1903,19 +1934,20 @@
   bitmap = tileBitmap = new SplashBitmap(tileW, tileH, bitmapRowPad,
 					 colorMode, gTrue, bitmapTopDown);
   splash = new Splash(bitmap, vectorAntialias, origSplash->getScreen());
+  for (i = 0; i < splashMaxColorComps; ++i) {
+    color[i] = 0;
+  }
+  splash->clear(color);
   splash->setMinLineWidth(globalParams->getMinLineWidth());
   splash->setStrokeAdjust(
 		 mapStrokeAdjustMode[globalParams->getStrokeAdjust()]);
   splash->setEnablePathSimplification(
 		 globalParams->getEnablePathSimplification());
-  for (i = 0; i < splashMaxColorComps; ++i) {
-    color[i] = 0;
-  }
-  splash->clear(color);
   ++nestCount;
 
   // copy the fill color (for uncolored tiling patterns)
   // (and stroke color, to handle buggy PDF files)
+  // -- Acrobat apparently doesn't copy the full state here
   splash->setFillPattern(origSplash->getFillPattern()->copy());
   splash->setStrokePattern(origSplash->getStrokePattern()->copy());
 
@@ -1967,6 +1999,7 @@
   SplashColorPtr sColors, sColor;
   SplashColor sColor0;
 
+
   // get the shading parameters
   shading->getCoords(&x0, &y0, &x1, &y1);
   t0 = shading->getDomain0();
@@ -1986,7 +2019,7 @@
 
   // get clip region (in user space)
   state->getUserClipBBox(&uxMin, &uyMin, &uxMax, &uyMax);
-  if (uxMin >= uxMax || uyMin >= uyMax) {
+  if (uxMin > uxMax || uyMin > uyMax) {
     return gTrue;
   }
 
@@ -2053,7 +2086,7 @@
   bitmapHeight = iyMax - iyMin;
   tBitmap = new SplashBitmap(bitmapWidth, bitmapHeight, 1,
 			     srcMode, gTrue, gTrue);
-  memset(tBitmap->getAlphaPtr(), 0, bitmapWidth * bitmapHeight);
+  memset(tBitmap->getAlphaPtr(), 0, (size_t)bitmapWidth * bitmapHeight);
   nComps = splashColorModeNComps[srcMode];
 
   // compute the inverse CTM
@@ -2266,6 +2299,7 @@
   GfxColor color;
   SplashColorPtr sColors, sColor;
 
+
   // get the shading parameters
   shading->getCoords(&x0, &y0, &r0, &x1, &y1, &r1);
   t0 = shading->getDomain0();
@@ -2277,7 +2311,7 @@
 
   // get clip region (in user space)
   state->getUserClipBBox(&uxMin, &uyMin, &uxMax, &uyMax);
-  if (uxMin >= uxMax || uyMin >= uyMax) {
+  if (uxMin > uxMax || uyMin > uyMax) {
     return gTrue;
   }
 
@@ -2370,7 +2404,7 @@
   bitmapHeight = iyMax - iyMin;
   tBitmap = new SplashBitmap(bitmapWidth, bitmapHeight, 1,
 			     srcMode, gTrue, gTrue);
-  memset(tBitmap->getAlphaPtr(), 0, bitmapWidth * bitmapHeight);
+  memset(tBitmap->getAlphaPtr(), 0, tBitmap->getAlphaRowSize() * bitmapHeight);
   nComps = splashColorModeNComps[srcMode];
 
   // compute the inverse CTM
@@ -2518,7 +2552,7 @@
   for (y = byMin; y < byMax; ++y) {
     dataPtr = tBitmap->getDataPtr()
               + y * tBitmap->getRowSize() + bxMin * nComps;
-    alphaPtr = tBitmap->getAlphaPtr() + y * bitmapWidth + bxMin;
+    alphaPtr = tBitmap->getAlphaPtr() + y * tBitmap->getAlphaRowSize() + bxMin;
     for (x = bxMin; x < bxMax; ++x) {
 
       // convert coords to user space
@@ -2646,6 +2680,7 @@
   }
 }
 
+
 void SplashOutputDev::clip(GfxState *state) {
   SplashPath *path;
 
@@ -2954,7 +2989,7 @@
   t3gs = new T3GlyphStack();
   t3gs->next = t3GlyphStack;
   t3GlyphStack = t3gs;
-  t3GlyphStack->code = code;
+  t3GlyphStack->code = (Gushort)code;
   t3GlyphStack->cache = t3Font;
   t3GlyphStack->cacheTag = NULL;
   t3GlyphStack->cacheData = NULL;
@@ -2975,6 +3010,7 @@
     delete bitmap;
     delete splash;
     bitmap = t3GlyphStack->origBitmap;
+    colorMode = bitmap->getMode();
     splash = t3GlyphStack->origSplash;
     ctm = state->getCTM();
     state->setCTM(ctm[0], ctm[1], ctm[2], ctm[3],
@@ -3093,6 +3129,7 @@
 
   // create the temporary bitmap
   if (colorMode == splashModeMono1) {
+    colorMode = splashModeMono1;
     bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1,
 			      splashModeMono1, gFalse);
     splash = new Splash(bitmap, gFalse, t3GlyphStack->origSplash->getScreen());
@@ -3100,6 +3137,7 @@
     splash->clear(color);
     color[0] = 0xff;
   } else {
+    colorMode = splashModeMono8;
     bitmap = new SplashBitmap(t3Font->glyphW, t3Font->glyphH, 1,
 			      splashModeMono8, gFalse);
     splash = new Splash(bitmap, vectorAntialias,
@@ -3112,10 +3150,9 @@
   splash->setStrokeAdjust(t3GlyphStack->origSplash->getStrokeAdjust());
   splash->setEnablePathSimplification(
 		 globalParams->getEnablePathSimplification());
+  copyState(t3GlyphStack->origSplash, gFalse);
   splash->setFillPattern(new SplashSolidColor(color));
   splash->setStrokePattern(new SplashSolidColor(color));
-  //~ this should copy other state from t3GlyphStack->origSplash?
-  //~ [this is likely the same situation as in beginTransparencyGroup()]
   state->setCTM(ctm[0], ctm[1], ctm[2], ctm[3],
 		-t3Font->glyphX, -t3Font->glyphY);
   updateCTM(state, 0, 0, 0, 0, 0, 0);
@@ -3149,11 +3186,11 @@
 
 struct SplashOutImageMaskData {
   ImageStream *imgStr;
-  GBool invert;
+  Guchar invert;
   int width, height, y;
 };
 
-GBool SplashOutputDev::imageMaskSrc(void *data, SplashColorPtr line) {
+GBool SplashOutputDev::imageMaskSrc(void *data, Guchar *line) {
   SplashOutImageMaskData *imgMaskData = (SplashOutImageMaskData *)data;
   Guchar *p;
   SplashColorPtr q;
@@ -3341,18 +3378,13 @@
 GBool SplashOutputDev::alphaImageSrc(void *data, SplashColorPtr colorLine,
 				     Guchar *alphaLine) {
   SplashOutImageData *imgData = (SplashOutImageData *)data;
-  Guchar *p, *aq;
+  Guchar *p0, *p, *aq;
   SplashColorPtr q, col;
-  GfxRGB rgb;
-  GfxGray gray;
-#if SPLASH_CMYK
-  GfxCMYK cmyk;
-#endif
   Guchar alpha;
   int nComps, x, i;
 
   if (imgData->y == imgData->height ||
-      !(p = imgData->imgStr->getLine())) {
+      !(p0 = imgData->imgStr->getLine())) {
     memset(colorLine, 0,
 	   imgData->width * splashColorModeNComps[imgData->colorMode]);
     memset(alphaLine, 0, imgData->width);
@@ -3361,67 +3393,66 @@
 
   nComps = imgData->colorMap->getNumPixelComps();
 
-  for (x = 0, q = colorLine, aq = alphaLine;
-       x < imgData->width;
-       ++x, p += nComps) {
-    alpha = 0;
-    for (i = 0; i < nComps; ++i) {
-      if (p[i] < imgData->maskColors[2*i] ||
-	  p[i] > imgData->maskColors[2*i+1]) {
-	alpha = 0xff;
-	break;
+  if (imgData->lookup) {
+    switch (imgData->colorMode) {
+    case splashModeMono1:
+    case splashModeMono8:
+      for (x = 0, p = p0, q = colorLine; x < imgData->width; ++x, ++p) {
+	*q++ = imgData->lookup[*p];
       }
-    }
-    if (imgData->lookup) {
-      switch (imgData->colorMode) {
-      case splashModeMono1:
-      case splashModeMono8:
-	*q++ = imgData->lookup[*p];
-	break;
-      case splashModeRGB8:
-      case splashModeBGR8:
+      break;
+    case splashModeRGB8:
+    case splashModeBGR8:
+      for (x = 0, p = p0, q = colorLine; x < imgData->width; ++x, ++p) {
 	col = &imgData->lookup[3 * *p];
 	*q++ = col[0];
 	*q++ = col[1];
 	*q++ = col[2];
-	break;
+      }
+      break;
 #if SPLASH_CMYK
-      case splashModeCMYK8:
+    case splashModeCMYK8:
+      for (x = 0, p = p0, q = colorLine; x < imgData->width; ++x, ++p) {
 	col = &imgData->lookup[4 * *p];
 	*q++ = col[0];
 	*q++ = col[1];
 	*q++ = col[2];
 	*q++ = col[3];
-	break;
+      }
+      break;
 #endif
-      }
-      *aq++ = alpha;
-    } else {
-      switch (imgData->colorMode) {
-      case splashModeMono1:
-      case splashModeMono8:
-	imgData->colorMap->getGray(p, &gray, imgData->ri);
-	*q++ = colToByte(gray);
-	break;
-      case splashModeRGB8:
-      case splashModeBGR8:
-	imgData->colorMap->getRGB(p, &rgb, imgData->ri);
-	*q++ = colToByte(rgb.r);
-	*q++ = colToByte(rgb.g);
-	*q++ = colToByte(rgb.b);
-	break;
+    }
+  } else {
+    switch (imgData->colorMode) {
+    case splashModeMono1:
+    case splashModeMono8:
+      imgData->colorMap->getGrayByteLine(p0, colorLine, imgData->width,
+					 imgData->ri);
+      break;
+    case splashModeRGB8:
+    case splashModeBGR8:
+      imgData->colorMap->getRGBByteLine(p0, colorLine, imgData->width,
+					imgData->ri);
+      break;
 #if SPLASH_CMYK
-      case splashModeCMYK8:
-	imgData->colorMap->getCMYK(p, &cmyk, imgData->ri);
-	*q++ = colToByte(cmyk.c);
-	*q++ = colToByte(cmyk.m);
-	*q++ = colToByte(cmyk.y);
-	*q++ = colToByte(cmyk.k);
+    case splashModeCMYK8:
+      imgData->colorMap->getCMYKByteLine(p0, colorLine, imgData->width,
+					 imgData->ri);
+      break;
+#endif
+    }
+  }
+
+  for (x = 0, p = p0, aq = alphaLine; x < imgData->width; ++x, p += nComps) {
+    alpha = 0;
+    for (i = 0; i < nComps; ++i) {
+      if (p[i] < imgData->maskColors[2*i] ||
+	  p[i] > imgData->maskColors[2*i+1]) {
+	alpha = 0xff;
 	break;
-#endif
       }
-      *aq++ = alpha;
     }
+    *aq++ = alpha;
   }
 
   ++imgData->y;
@@ -3428,6 +3459,7 @@
   return gTrue;
 }
 
+
 void SplashOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 				int width, int height,
 				GfxImageColorMap *colorMap,
@@ -3476,7 +3508,12 @@
   // build a lookup table here
   imgData.lookup = NULL;
   if (colorMap->getNumPixelComps() == 1) {
-    n = 1 << colorMap->getBits();
+    if (colorMap->getBits() <= 8) {
+      n = 1 << colorMap->getBits();
+    } else {
+      // GfxImageColorMap and ImageStream compress 16-bit samples to 8-bit
+      n = 1 << 8;
+    }
     switch (colorMode) {
     case splashModeMono1:
     case splashModeMono8:
@@ -3639,6 +3676,7 @@
   return gTrue;
 }
 
+
 void SplashOutputDev::drawMaskedImage(GfxState *state, Object *ref,
 				      Stream *str, int width, int height,
 				      GfxImageColorMap *colorMap,
@@ -3745,7 +3783,12 @@
     // build a lookup table here
     imgData.lookup = NULL;
     if (colorMap->getNumPixelComps() == 1) {
-      n = 1 << colorMap->getBits();
+      if (colorMap->getBits() <= 8) {
+	n = 1 << colorMap->getBits();
+      } else {
+	// GfxImageColorMap and ImageStream compress 16-bit samples to 8-bit
+	n = 1 << 8;
+      }
       switch (colorMode) {
       case splashModeMono1:
       case splashModeMono8:
@@ -3806,7 +3849,6 @@
   GfxImageColorMap *colorMap;
   GfxRenderingIntent ri;
   Guchar matte[gfxColorMaxComps];
-  SplashColorPtr maskLookup;
   SplashColorMode colorMode;
   int width, height, y;
 };
@@ -3846,8 +3888,8 @@
     case splashModeMono8:
       if (alpha) {
 	imgData->colorMap->getGray(p, &gray, imgData->ri);
-	*q++ = imgData->matte[0] + (255 * (colToByte(gray) -
-					   imgData->matte[0])) / alpha;
+	*q++ = clip255(imgData->matte[0] +
+		       (255 * (colToByte(gray) - imgData->matte[0])) / alpha);
       } else {
 	*q++ = 0;
       }
@@ -3856,12 +3898,12 @@
     case splashModeBGR8:
       if (alpha) {
 	imgData->colorMap->getRGB(p, &rgb, imgData->ri);
-	*q++ = imgData->matte[0] + (255 * (colToByte(rgb.r) -
-					   imgData->matte[0])) / alpha;
-	*q++ = imgData->matte[1] + (255 * (colToByte(rgb.g) -
-					   imgData->matte[1])) / alpha;
-	*q++ = imgData->matte[2] + (255 * (colToByte(rgb.b) -
-					   imgData->matte[2])) / alpha;
+	*q++ = clip255(imgData->matte[0] +
+		       (255 * (colToByte(rgb.r) - imgData->matte[0])) / alpha);
+	*q++ = clip255(imgData->matte[1] +
+		       (255 * (colToByte(rgb.g) - imgData->matte[1])) / alpha);
+	*q++ = clip255(imgData->matte[2] +
+		       (255 * (colToByte(rgb.b) - imgData->matte[2])) / alpha);
       } else {
 	*q++ = 0;
 	*q++ = 0;
@@ -3872,14 +3914,18 @@
     case splashModeCMYK8:
       if (alpha) {
 	imgData->colorMap->getCMYK(p, &cmyk, imgData->ri);
-	*q++ = imgData->matte[0] + (255 * (colToByte(cmyk.c) -
-					   imgData->matte[0])) / alpha;
-	*q++ = imgData->matte[1] + (255 * (colToByte(cmyk.m) -
-					   imgData->matte[1])) / alpha;
-	*q++ = imgData->matte[2] + (255 * (colToByte(cmyk.y) -
-					   imgData->matte[2])) / alpha;
-	*q++ = imgData->matte[3] + (255 * (colToByte(cmyk.k) -
-					   imgData->matte[3])) / alpha;
+	*q++ = clip255(imgData->matte[0] +
+		       (255 * (colToByte(cmyk.c) - imgData->matte[0]))
+			 / alpha);
+	*q++ = clip255(imgData->matte[1] +
+		       (255 * (colToByte(cmyk.m) - imgData->matte[1]))
+			 / alpha);
+	*q++ = clip255(imgData->matte[2] +
+		       (255 * (colToByte(cmyk.y) - imgData->matte[2]))
+			 / alpha);
+	*q++ = clip255(imgData->matte[3] +
+		       (255 * (colToByte(cmyk.k) - imgData->matte[3]))
+		         / alpha);
       } else {
 	*q++ = 0;
 	*q++ = 0;
@@ -3896,6 +3942,7 @@
   return gTrue;
 }
 
+
 void SplashOutputDev::drawSoftMaskedImage(GfxState *state, Object *ref,
 					  Stream *str, int width, int height,
 					  GfxImageColorMap *colorMap,
@@ -3990,13 +4037,11 @@
 #endif
     }
     //~ could add the matteImgData.lookup special case
-    n = 1 << maskColorMap->getBits();
-    matteImgData.maskLookup = (SplashColorPtr)gmalloc(n);
-    for (i = 0; i < n; ++i) {
-      pix = (Guchar)i;
-      maskColorMap->getGray(&pix, &gray,
-			    state->getRenderingIntent());
-      matteImgData.maskLookup[i] = colToByte(gray);
+    if (colorMap->getBits() <= 8) {
+      n = 1 << maskColorMap->getBits();
+    } else {
+      // GfxImageColorMap and ImageStream compress 16-bit samples to 8-bit
+      n = 1 << 8;
     }
     matteImgData.colorMode = colorMode;
     matteImgData.width = width;
@@ -4004,7 +4049,6 @@
     matteImgData.y = 0;
     splash->drawImage(&softMaskMatteImageSrc, &matteImgData,
 		      srcMode, gTrue, width, height, mat, interpolate);
-    gfree(matteImgData.maskLookup);
     delete matteImgData.maskStr;
     delete matteImgData.imgStr;
     maskStr->close();
@@ -4069,7 +4113,12 @@
     // build a lookup table here
     imgData.lookup = NULL;
     if (colorMap->getNumPixelComps() == 1) {
-      n = 1 << colorMap->getBits();
+      if (colorMap->getBits() <= 8) {
+	n = 1 << colorMap->getBits();
+      } else {
+	// GfxImageColorMap and ImageStream compress 16-bit samples to 8-bit
+	n = 1 << 8;
+      }
       switch (colorMode) {
       case splashModeMono1:
       case splashModeMono8:
@@ -4113,6 +4162,8 @@
     splash->setSoftMask(NULL);
     gfree(imgData.lookup);
     delete imgData.imgStr;
+
+
     str->close();
   }
 }
@@ -4217,7 +4268,7 @@
   SplashBitmap *backdropBitmap;
   SplashColor color;
   double xMin, yMin, xMax, yMax, x, y;
-  int tx, ty, w, h, i;
+  int bw, bh, tx, ty, w, h, i;
 
   // transform the bbox
   state->transform(bbox[0], bbox[1], &x, &y);
@@ -4276,28 +4327,30 @@
   }
 
   // convert box coords to integers
+  bw = bitmap->getWidth();
+  bh = bitmap->getHeight();
   tx = (int)floor(xMin);
   if (tx < 0) {
     tx = 0;
-  } else if (tx >= bitmap->getWidth()) {
-    tx = bitmap->getWidth() - 1;
+  } else if (tx >= bw) {
+    tx = bw - 1;
   }
   ty = (int)floor(yMin);
   if (ty < 0) {
     ty = 0;
-  } else if (ty >= bitmap->getHeight()) {
-    ty = bitmap->getHeight() - 1;
+  } else if (ty >= bh) {
+    ty = bh - 1;
   }
   w = (int)ceil(xMax) - tx + 1;
-  if (tx + w > bitmap->getWidth()) {
-    w = bitmap->getWidth() - tx;
+  if (tx + w > bw) {
+    w = bw - tx;
   }
   if (w < 1) {
     w = 1;
   }
   h = (int)ceil(yMax) - ty + 1;
-  if (ty + h > bitmap->getHeight()) {
-    h = bitmap->getHeight() - ty;
+  if (ty + h > bh) {
+    h = bh - ty;
   }
   if (h < 1) {
     h = 1;
@@ -4351,16 +4404,7 @@
 		 mapStrokeAdjustMode[globalParams->getStrokeAdjust()]);
   splash->setEnablePathSimplification(
 		 globalParams->getEnablePathSimplification());
-  //~ Acrobat apparently copies at least the fill and stroke colors, and
-  //~ maybe other state(?) -- but not the clipping path (and not sure
-  //~ what else)
-  //~ [this is likely the same situation as in type3D1()]
-  splash->setFillPattern(transpGroup->origSplash->getFillPattern()->copy());
-  splash->setStrokePattern(
-		         transpGroup->origSplash->getStrokePattern()->copy());
-  splash->setLineDash(transpGroup->origSplash->getLineDash(),
-		      transpGroup->origSplash->getLineDashLength(),
-		      transpGroup->origSplash->getLineDashPhase());
+  copyState(transpGroup->origSplash, gTrue);
   if (isolated) {
     for (i = 0; i < splashMaxColorComps; ++i) {
       color[i] = 0;
@@ -4387,7 +4431,13 @@
     splash->setInTransparencyGroup(backdropBitmap, tx, ty,
 				   !isolated, knockout);
   }
+  splash->clearModRegion();
   transpGroup->tBitmap = bitmap;
+#if 1 //~tmp
+  if (knockout) {
+    splash->setInShading(gTrue);
+  }
+#endif
   state->shiftCTM(-tx, -ty);
   updateCTM(state, 0, 0, 0, 0, 0, 0);
   ++nestCount;
@@ -4394,6 +4444,9 @@
 }
 
 void SplashOutputDev::endTransparencyGroup(GfxState *state) {
+  splash->getModRegion(&transpGroupStack->modXMin, &transpGroupStack->modYMin,
+		       &transpGroupStack->modXMax, &transpGroupStack->modYMax);
+
   // restore state
   --nestCount;
   delete splash;
@@ -4408,19 +4461,23 @@
   SplashBitmap *tBitmap;
   SplashTransparencyGroup *transpGroup;
   GBool isolated;
-  int tx, ty;
+  int xSrc, ySrc, xDest, yDest, w, h;
 
-  tx = transpGroupStack->tx;
-  ty = transpGroupStack->ty;
+  xSrc = transpGroupStack->modXMin;
+  ySrc = transpGroupStack->modYMin;
+  xDest = transpGroupStack->tx + transpGroupStack->modXMin;
+  yDest = transpGroupStack->ty + transpGroupStack->modYMin;
+  w = transpGroupStack->modXMax - transpGroupStack->modXMin + 1;
+  h = transpGroupStack->modYMax - transpGroupStack->modYMin + 1;
   tBitmap = transpGroupStack->tBitmap;
   isolated = transpGroupStack->isolated;
 
   // paint the transparency group onto the parent bitmap
   // - the clip path was set in the parent's state)
-  if (tx < bitmap->getWidth() && ty < bitmap->getHeight()) {
+  if (xDest < bitmap->getWidth() && yDest < bitmap->getHeight() &&
+      w > 0 && h > 0) {
     splash->setOverprintMask(0xffffffff);
-    splash->composite(tBitmap, 0, 0, tx, ty,
-		      tBitmap->getWidth(), tBitmap->getHeight(),
+    splash->composite(tBitmap, xSrc, ySrc, xDest, yDest, w, h,
 		      gFalse, !isolated);
   }
 
@@ -4462,13 +4519,13 @@
   if (!alpha && tBitmap->getMode() != splashModeMono1) {
     //~ need to correctly handle the case where no blending color
     //~ space is given
-    tSplash = new Splash(tBitmap, vectorAntialias,
-			 transpGroupStack->origSplash->getScreen());
-    tSplash->setStrokeAdjust(
-		    mapStrokeAdjustMode[globalParams->getStrokeAdjust()]);
-    tSplash->setEnablePathSimplification(
-		    globalParams->getEnablePathSimplification());
     if (transpGroupStack->blendingColorSpace) {
+      tSplash = new Splash(tBitmap, vectorAntialias,
+			   transpGroupStack->origSplash->getScreen());
+      tSplash->setStrokeAdjust(
+		      mapStrokeAdjustMode[globalParams->getStrokeAdjust()]);
+      tSplash->setEnablePathSimplification(
+		      globalParams->getEnablePathSimplification());
       switch (tBitmap->getMode()) {
       case splashModeMono1:
 	// transparency is not supported in mono1 mode
@@ -4562,7 +4619,7 @@
 	} else {
 	  lum2 = lum;
 	}
-	p[x] = (int)(lum2 * 255.0 + 0.5);
+	p[x] = (Guchar)(lum2 * 255.0 + 0.5);
       }
       p += softMask->getRowSize();
     }
@@ -4623,9 +4680,9 @@
   GfxCMYK cmyk;
 #endif
 
-  rgb.r = byteToCol(r);
-  rgb.g = byteToCol(g);
-  rgb.b = byteToCol(b);
+  rgb.r = byteToCol((Guchar)r);
+  rgb.g = byteToCol((Guchar)g);
+  rgb.b = byteToCol((Guchar)b);
   switch (colorMode) {
   case splashModeMono1:
   case splashModeMono8:
@@ -4784,6 +4841,25 @@
   return fontObj;
 }
 
+// This is called when initializing a temporary Splash object for Type
+// 3 characters and transparency groups.  Acrobat apparently copies at
+// least the fill and stroke colors, and the line parameters.
+//~ not sure what else should be copied -- the PDF spec is unclear
+//~   - fill and stroke alpha?
+void SplashOutputDev::copyState(Splash *oldSplash, GBool copyColors) {
+  // cached Type 3 chars set a color, so no need to copy the color here
+  if (copyColors) {
+    splash->setFillPattern(oldSplash->getFillPattern()->copy());
+    splash->setStrokePattern(oldSplash->getStrokePattern()->copy());
+  }
+  splash->setLineDash(oldSplash->getLineDash(),
+		      oldSplash->getLineDashLength(),
+		      oldSplash->getLineDashPhase());
+  splash->setLineCap(oldSplash->getLineCap());
+  splash->setLineJoin(oldSplash->getLineJoin());
+  splash->setLineWidth(oldSplash->getLineWidth());
+}
+
 #if 1 //~tmp: turn off anti-aliasing temporarily
 void SplashOutputDev::setInShading(GBool sh) {
   splash->setInShading(sh);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/SplashOutputDev.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -51,6 +51,7 @@
 		  GBool bitmapTopDownA = gTrue,
 		  GBool allowAntialiasA = gTrue);
 
+
   // Destructor.
   virtual ~SplashOutputDev();
 
@@ -78,6 +79,7 @@
   virtual GBool interpretType3Chars() { return gTrue; }
 
 
+
   //----- initialization and control
 
   // Start a page.
@@ -267,7 +269,7 @@
   void doUpdateFont(GfxState *state);
   void drawType3Glyph(GfxState *state, T3FontCache *t3Font,
 		      T3FontCacheTag *tag, Guchar *data);
-  static GBool imageMaskSrc(void *data, SplashColorPtr line);
+  static GBool imageMaskSrc(void *data, Guchar *line);
   static GBool imageSrc(void *data, SplashColorPtr colorLine,
 			Guchar *alphaLine);
   static GBool alphaImageSrc(void *data, SplashColorPtr line,
@@ -283,6 +285,7 @@
 		       Splash *maskSplash,
 		       double xMin, double yMin,
 		       double xMax, double yMax);
+  void copyState(Splash *oldSplash, GBool copyColors);
 
   SplashColorMode colorMode;
   int bitmapRowPad;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -97,7 +97,7 @@
 	getChar();
       break;
     }
-    buf[i] = c;
+    buf[i] = (char)c;
   }
   buf[i] = '\0';
   return buf;
@@ -146,9 +146,9 @@
     str = makeFilter(obj.getName(), str, &params, recursion);
   } else if (obj.isArray()) {
     for (i = 0; i < obj.arrayGetLength(); ++i) {
-      obj.arrayGet(i, &obj2);
+      obj.arrayGet(i, &obj2, recursion);
       if (params.isArray())
-	params.arrayGet(i, &params2);
+	params.arrayGet(i, &params2, recursion);
       else
 	params2.initNull();
       if (obj2.isName()) {
@@ -356,7 +356,8 @@
 
   nVals = width * nComps;
   inputLineSize = (nVals * nBits + 7) >> 3;
-  if (nVals > INT_MAX / nBits - 7) {
+  if (width > INT_MAX / nComps ||
+      nVals > (INT_MAX - 7) / nBits) {
     // force a call to gmallocn(-1,...), which will throw an exception
     inputLineSize = -1;
   }
@@ -369,10 +370,6 @@
     } else {
       imgLineSize = nVals;
     }
-    if (width > INT_MAX / nComps) {
-      // force a call to gmallocn(-1,...), which will throw an exception
-      imgLineSize = -1;
-    }
     imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar));
   }
   imgIdx = nVals;
@@ -458,6 +455,7 @@
   str->getBlock(inputLine, inputLineSize);
 }
 
+
 //------------------------------------------------------------------------
 // StreamPredictor
 //------------------------------------------------------------------------
@@ -574,14 +572,13 @@
     }
     switch (curPred) {
     case 11:			// PNG sub
-      predLine[i] = predLine[i - pixBytes] + (Guchar)c;
+      predLine[i] = (Guchar)(predLine[i - pixBytes] + c);
       break;
     case 12:			// PNG up
-      predLine[i] = predLine[i] + (Guchar)c;
+      predLine[i] = (Guchar)(predLine[i] + c);
       break;
     case 13:			// PNG average
-      predLine[i] = ((predLine[i - pixBytes] + predLine[i]) >> 1) +
-	            (Guchar)c;
+      predLine[i] = (Guchar)(((predLine[i - pixBytes] + predLine[i]) >> 1) + c);
       break;
     case 14:			// PNG Paeth
       left = predLine[i - pixBytes];
@@ -595,11 +592,11 @@
       if ((pc = p - upLeft) < 0)
 	pc = -pc;
       if (pa <= pb && pa <= pc)
-	predLine[i] = left + (Guchar)c;
+	predLine[i] = (Guchar)(left + c);
       else if (pb <= pc)
-	predLine[i] = up + (Guchar)c;
+	predLine[i] = (Guchar)(up + c);
       else
-	predLine[i] = upLeft + (Guchar)c;
+	predLine[i] = (Guchar)(upLeft + c);
       break;
     case 10:			// PNG none
     default:			// no predictor or TIFF predictor
@@ -612,7 +609,7 @@
   if (predictor == 2) {
     if (nBits == 8) {
       for (i = pixBytes; i < rowBytes; ++i) {
-	predLine[i] += predLine[i - nComps];
+	predLine[i] = (Guchar)(predLine[i] + predLine[i - nComps]);
       }
     } else if (nBits == 16) {
       for (i = pixBytes; i < rowBytes; i += 2) {
@@ -1349,7 +1346,7 @@
   // process the next code
   nextLength = seqLength + 1;
   if (code < 256) {
-    seqBuf[0] = code;
+    seqBuf[0] = (Guchar)code;
     seqLength = 1;
   } else if (code < nextCode) {
     seqLength = table[code].length;
@@ -1357,9 +1354,9 @@
       seqBuf[i] = table[j].tail;
       j = table[j].head;
     }
-    seqBuf[0] = j;
+    seqBuf[0] = (Guchar)j;
   } else if (code == nextCode) {
-    seqBuf[seqLength] = newChar;
+    seqBuf[seqLength] = (Guchar)newChar;
     ++seqLength;
   } else {
     error(errSyntaxError, getPos(), "Bad LZW stream - unexpected code");
@@ -1372,7 +1369,7 @@
   } else {
     table[nextCode].length = nextLength;
     table[nextCode].head = prevCode;
-    table[nextCode].tail = newChar;
+    table[nextCode].tail = (Guchar)newChar;
     ++nextCode;
     if (nextCode + early == 512)
       nextBits = 10;
@@ -1534,8 +1531,8 @@
   columns = columnsA;
   if (columns < 1) {
     columns = 1;
-  } else if (columns > INT_MAX - 2) {
-    columns = INT_MAX - 2;
+  } else if (columns > INT_MAX - 3) {
+    columns = INT_MAX - 3;
   }
   rows = rowsA;
   endOfBlock = endOfBlockA;
@@ -1543,10 +1540,10 @@
   blackXOR = black ? 0xff : 0x00;
   // 0 <= codingLine[0] < codingLine[1] < ... < codingLine[n] = columns
   // ---> max codingLine size = columns + 1
-  // refLine has one extra guard entry at the end
-  // ---> max refLine size = columns + 2
+  // refLine has two extra guard entries at the end
+  // ---> max refLine size = columns + 3
   codingLine = (int *)gmallocn(columns + 1, sizeof(int));
-  refLine = (int *)gmallocn(columns + 2, sizeof(int));
+  refLine = (int *)gmallocn(columns + 3, sizeof(int));
 
   eof = gFalse;
   row = 0;
@@ -1555,6 +1552,8 @@
   codingLine[0] = columns;
   nextCol = columns;
   a0i = 0;
+  err = gFalse;
+  nErrors = 0;
 }
 
 CCITTFaxStream::~CCITTFaxStream() {
@@ -1714,7 +1713,7 @@
       } while (bitsNeeded > 0);
     }
     nextCol += 8;
-    blk[bytesRead++] = c ^ blackXOR;
+    blk[bytesRead++] = (char)(c ^ blackXOR);
   }
   return bytesRead;
 }
@@ -1725,6 +1724,7 @@
       error(errSyntaxError, getPos(),
 	    "CCITTFax row is wrong length ({0:d})", a1);
       err = gTrue;
+      ++nErrors;
       a1 = columns;
     }
     if ((a0i & 1) ^ blackPixels) {
@@ -1740,6 +1740,7 @@
       error(errSyntaxError, getPos(),
 	    "CCITTFax row is wrong length ({0:d})", a1);
       err = gTrue;
+      ++nErrors;
       a1 = columns;
     }
     if ((a0i & 1) ^ blackPixels) {
@@ -1750,6 +1751,7 @@
     if (a1 < 0) {
       error(errSyntaxError, getPos(), "Invalid CCITTFax code");
       err = gTrue;
+      ++nErrors;
       a1 = 0;
     }
     while (a0i > 0 && a1 <= codingLine[a0i - 1]) {
@@ -1777,6 +1779,7 @@
       refLine[i] = codingLine[i];
     }
     refLine[i++] = columns;
+    refLine[i++] = columns;
     refLine[i] = columns;
     codingLine[0] = 0;
     a0i = 0;
@@ -1914,6 +1917,7 @@
 	      "Bad 2D code {0:04x} in CCITTFax stream", code1);
 	addPixels(columns, 0);
 	err = gTrue;
+	++nErrors;
 	break;
       }
     }
@@ -2014,6 +2018,7 @@
 	  if (code1 != 0x001) {
 	    error(errSyntaxError, getPos(),
 		  "Bad RTC code in CCITTFax stream");
+	    ++nErrors;
 	  }
 	  eatBits(12);
 	  if (encoding > 0) {
@@ -2047,6 +2052,14 @@
     }
   }
 
+  // corrupt CCITTFax streams can generate huge data expansion -- we
+  // avoid that case by aborting decode after 1000 errors
+  if (nErrors > 1000) {
+    error(errSyntaxError, getPos(), "Too many errors in CCITTFaxStream - aborting decode");
+    eof = gTrue;
+    return gFalse;
+  }
+
   // set up for output
   nextCol = 0;
   a0i = (codingLine[0] > 0) ? 0 : 1;
@@ -2087,6 +2100,7 @@
   }
   error(errSyntaxError, getPos(),
 	"Bad two dim code ({0:04x}) in CCITTFax stream", code);
+  ++nErrors;
   return EOF;
 }
 
@@ -2117,7 +2131,7 @@
 	return 1;
       }
       if (n < 9) {
-	code <<= 9 - n;
+	code = (short)(code << (9 - n));
       }
       p = &whiteTab2[code];
       if (p->bits == n) {
@@ -2131,7 +2145,7 @@
 	return 1;
       }
       if (n < 12) {
-	code <<= 12 - n;
+	code = (short)(code << (12 - n));
       }
       p = &whiteTab1[code];
       if (p->bits == n) {
@@ -2142,6 +2156,7 @@
   }
   error(errSyntaxError, getPos(),
 	"Bad white code ({0:04x}) in CCITTFax stream", code);
+  ++nErrors;
   // eat a bit and return a positive number so that the caller doesn't
   // go into an infinite loop
   eatBits(1);
@@ -2177,7 +2192,7 @@
 	return 1;
       }
       if (n < 6) {
-	code <<= 6 - n;
+	code = (short)(code << (6 - n));
       }
       p = &blackTab3[code];
       if (p->bits == n) {
@@ -2191,7 +2206,7 @@
 	return 1;
       }
       if (n < 12) {
-	code <<= 12 - n;
+	code = (short)(code << (12 - n));
       }
       if (code >= 64) {
 	p = &blackTab2[code - 64];
@@ -2207,7 +2222,7 @@
 	return 1;
       }
       if (n < 13) {
-	code <<= 13 - n;
+	code = (short)(code << (13 - n));
       }
       p = &blackTab1[code];
       if (p->bits == n) {
@@ -2218,6 +2233,7 @@
   }
   error(errSyntaxError, getPos(),
 	"Bad black code ({0:04x}) in CCITTFax stream", code);
+  ++nErrors;
   // eat a bit and return a positive number so that the caller doesn't
   // go into an infinite loop
   eatBits(1);
@@ -2236,12 +2252,12 @@
       // than are available, but there may still be a valid code in
       // however many bits are available -- we need to return correct
       // data in this case
-      return (inputBuf << (n - inputBits)) & (0xffffffff >> (32 - n));
+      return (short)((inputBuf << (n - inputBits)) & (0xffffffff >> (32 - n)));
     }
     inputBuf = (inputBuf << 8) + c;
     inputBits += 8;
   }
-  return (inputBuf >> (inputBits - n)) & (0xffffffff >> (32 - n));
+  return (short)((inputBuf >> (inputBits - n)) & (0xffffffff >> (32 - n)));
 }
 
 GString *CCITTFaxStream::getPSFilter(int psLevel, const char *indent) {
@@ -2569,7 +2585,7 @@
       dctClipData[dctClipOffset + i] = 0;
     }
     for (i = 0; i < 256; ++i) {
-      dctClipData[dctClipOffset + i] = i;
+      dctClipData[dctClipOffset + i] = (Guchar)i;
     }
     for (i = 256; i < 639; ++i) {
       dctClipData[dctClipOffset + i] = 255;
@@ -2578,7 +2594,7 @@
   }
 }
 
-static inline int dctClip(int x) {
+static inline Guchar dctClip(int x) {
   return dctClipData[(dctClipOffset + x) & dctClipMask];
 }
 
@@ -2646,7 +2662,7 @@
   gotAdobeMarker = gFalse;
   restartInterval = 0;
 
-  if (!readHeader()) {
+  if (!readHeader(gTrue)) {
     // force an EOF condition
     progressive = gTrue;
     y = height;
@@ -2707,7 +2723,7 @@
       restartMarker = 0xd0;
       restart();
       readScan();
-    } while (readHeader());
+    } while (readHeader(gFalse));
 
     // decode
     decodeImage();
@@ -2866,6 +2882,20 @@
   int x1, x2, y2, x3, y3, x4, y4, x5, y5, cc, i;
   int c;
 
+  for (cc = 0; cc < numComps; ++cc) {
+    if (scanInfo.dcHuffTable[cc] >= numDCHuffTables ||
+	scanInfo.acHuffTable[cc] >= numACHuffTables) {
+      error(errSyntaxError, getPos(),
+	    "Bad DCT data: invalid Huffman table index");
+      return gFalse;
+    }
+    if (compInfo[cc].quantTable > numQuantTables) {
+      error(errSyntaxError, getPos(),
+	    "Bad DCT data: invalid quant table index");
+      return gFalse;
+    }
+  }
+
   for (x1 = 0; x1 < width; x1 += mcuWidth) {
 
     // deal with restart marker
@@ -2974,11 +3004,11 @@
 	pCb = p1[1] - 128;
 	pCr = p1[2] - 128;
 	pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16;
-	p1[0] = 255 - dctClip(pR);
+	p1[0] = (Guchar)(255 - dctClip(pR));
 	pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32768) >> 16;
-	p1[1] = 255 - dctClip(pG);
+	p1[1] = (Guchar)(255 - dctClip(pG));
 	pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16;
-	p1[2] = 255 - dctClip(pB);
+	p1[2] = (Guchar)(255 - dctClip(pB));
       }
     }
   }
@@ -3001,6 +3031,22 @@
   int *p1;
   int c;
 
+  for (cc = 0; cc < numComps; ++cc) {
+    if (scanInfo.comp[cc] &&
+	(scanInfo.dcHuffTable[cc] >= numDCHuffTables ||
+	 ((!progressive || scanInfo.lastCoeff > 0) &&
+	  scanInfo.acHuffTable[cc] >= numACHuffTables))) {
+      error(errSyntaxError, getPos(),
+	    "Bad DCT data: invalid Huffman table index");
+      return;
+    }
+    if (compInfo[cc].quantTable > numQuantTables) {
+      error(errSyntaxError, getPos(),
+	    "Bad DCT data: invalid quant table index");
+      return;
+    }
+  }
+
   if (scanInfo.numComps == 1) {
     for (cc = 0; cc < numComps; ++cc) {
       if (scanInfo.comp[cc]) {
@@ -3175,11 +3221,7 @@
 	return gFalse;
       }
       if (bit) {
-	if (data[0] >= 0) {
-	  data[0] += 1 << scanInfo.al;
-	} else {
-	  data[0] -= 1 << scanInfo.al;
-	}
+	data[0] += 1 << scanInfo.al;
       }
     }
     ++i;
@@ -3655,7 +3697,7 @@
     if ((bit = readBit()) == EOF) {
       return 9999;
     }
-    code = (code << 1) + bit;
+    code = (Gushort)((code << 1) + bit);
     ++codeBits;
 
     // look up code
@@ -3663,7 +3705,7 @@
       break;
     }
     if (code - table->firstCode[codeBits] < table->numCodes[codeBits]) {
-      code -= table->firstCode[codeBits];
+      code = (Gushort)(code - table->firstCode[codeBits]);
       return table->sym[table->firstSym[codeBits] + code];
     }
   } while (codeBits < 16);
@@ -3711,7 +3753,7 @@
   return bit;
 }
 
-GBool DCTStream::readHeader() {
+GBool DCTStream::readHeader(GBool frame) {
   GBool doScan;
   int n;
   int c = 0;
@@ -3723,11 +3765,21 @@
     switch (c) {
     case 0xc0:			// SOF0 (sequential)
     case 0xc1:			// SOF1 (extended sequential)
+      if (!frame) {
+	error(errSyntaxError, getPos(),
+	      "Invalid DCT marker in scan <{0:02x}>", c);
+	return gFalse;
+      }
       if (!readBaselineSOF()) {
 	return gFalse;
       }
       break;
     case 0xc2:			// SOF2 (progressive)
+      if (!frame) {
+	error(errSyntaxError, getPos(),
+	      "Invalid DCT marker in scan <{0:02x}>", c);
+	return gFalse;
+      }
       if (!readProgressiveSOF()) {
 	return gFalse;
       }
@@ -3738,6 +3790,11 @@
       }
       break;
     case 0xd8:			// SOI
+      if (!frame) {
+	error(errSyntaxError, getPos(),
+	      "Invalid DCT marker in scan <{0:02x}>", c);
+	return gFalse;
+      }
       break;
     case 0xd9:			// EOI
       return gFalse;
@@ -3758,11 +3815,21 @@
       }
       break;
     case 0xe0:			// APP0
+      if (!frame) {
+	error(errSyntaxError, getPos(),
+	      "Invalid DCT marker in scan <{0:02x}>", c);
+	return gFalse;
+      }
       if (!readJFIFMarker()) {
 	return gFalse;
       }
       break;
     case 0xee:			// APP14
+      if (!frame) {
+	error(errSyntaxError, getPos(),
+	      "Invalid DCT marker in scan <{0:02x}>", c);
+	return gFalse;
+      }
       if (!readAdobeMarker()) {
 	return gFalse;
       }
@@ -3945,9 +4012,9 @@
     }
     for (i = 0; i < 64; ++i) {
       if (prec) {
-	quantTables[index][dctZigZag[i]] = read16();
+	quantTables[index][dctZigZag[i]] = (Gushort)read16();
       } else {
-	quantTables[index][dctZigZag[i]] = str->getChar();
+	quantTables[index][dctZigZag[i]] = (Gushort)str->getChar();
       }
     }
     if (prec) {
@@ -3993,13 +4060,13 @@
       c = str->getChar();
       tbl->firstSym[i] = sym;
       tbl->firstCode[i] = code;
-      tbl->numCodes[i] = c;
-      sym += c;
-      code = (code + c) << 1;
+      tbl->numCodes[i] = (Gushort)c;
+      sym = (Guchar)(sym + c);
+      code = (Gushort)((code + c) << 1);
     }
     length -= 16;
     for (i = 0; i < sym; ++i)
-      tbl->sym[i] = str->getChar();
+      tbl->sym[i] = (Guchar)str->getChar();
     length -= sym;
   }
   return gTrue;
@@ -4030,7 +4097,7 @@
 	error(errSyntaxError, getPos(), "Bad DCT APP0 marker");
 	return gFalse;
       }
-      buf[i] = c;
+      buf[i] = (char)c;
     }
     length -= 5;
     if (!memcmp(buf, "JFIF\0", 5)) {
@@ -4060,7 +4127,7 @@
     if ((c = str->getChar()) == EOF) {
       goto err;
     }
-    buf[i] = c;
+    buf[i] = (char)c;
   }
   if (!strncmp(buf, "Adobe", 5)) {
     colorXform = buf[11];
@@ -4947,7 +5014,7 @@
     if ((code1 = getHuffmanCodeWord(&litCodeTab)) == EOF)
       goto err;
     if (code1 < 256) {
-      buf[index] = code1;
+      buf[index] = (Guchar)code1;
       remain = 1;
     } else if (code1 == 256) {
       endOfBlock = gTrue;
@@ -4981,7 +5048,7 @@
 	endOfBlock = eof = gTrue;
 	break;
       }
-      buf[j] = c & 0xff;
+      buf[j] = (Guchar)c;
     }
     remain = i;
     blockLen -= len;
@@ -5569,7 +5636,7 @@
     if ((c2 = str->getChar()) == EOF) {
       eof = gTrue;
       buf[0] = 0;
-      buf[1] = c1;
+      buf[1] = (char)c1;
       bufPtr = buf;
       bufEnd = &buf[2];
       return gTrue;
@@ -5585,12 +5652,12 @@
     while (n < 128 && (c = str->getChar()) == c1)
       ++n;
     buf[0] = (char)(257 - n);
-    buf[1] = c1;
+    buf[1] = (char)c1;
     bufEnd = &buf[2];
     if (c == EOF) {
       eof = gTrue;
     } else if (n < 128) {
-      buf[2] = c;
+      buf[2] = (char)c;
       nextEnd = &buf[3];
     } else {
       nextEnd = bufEnd;
@@ -5598,8 +5665,8 @@
 
   // get up to 128 chars
   } else {
-    buf[1] = c1;
-    buf[2] = c2;
+    buf[1] = (char)c1;
+    buf[2] = (char)c2;
     n = 2;
     while (n < 128) {
       if ((c = str->getChar()) == EOF) {
@@ -5607,7 +5674,7 @@
 	break;
       }
       ++n;
-      buf[n] = c;
+      buf[n] = (char)c;
       if (buf[n] == buf[n-1])
 	break;
     }
@@ -5757,7 +5824,7 @@
     memcpy(inBuf, inBuf + inBufStart, inBufLen);
     inBufStart = 0;
     inBufLen += str->getBlock((char *)inBuf + inBufLen,
-			      sizeof(inBuf) - inBufLen);
+			      (int)sizeof(inBuf) - inBufLen);
   }
 
   // increment codeLen; generate clear-table code

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/Stream.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -248,6 +248,7 @@
   int imgIdx;			// current index in imgLine
 };
 
+
 //------------------------------------------------------------------------
 // StreamPredictor
 //------------------------------------------------------------------------
@@ -574,6 +575,7 @@
   int nextCol;			// next column to read
   int a0i;			// index into codingLine
   GBool err;			// error on current line
+  int nErrors;			// number of errors so far in this stream
 
   void addPixels(int a1, int blackPixels);
   void addPixelsNeg(int a1, int blackPixels);
@@ -726,7 +728,7 @@
   int readHuffSym(DCTHuffTable *table);
   int readAmp(int size);
   int readBit();
-  GBool readHeader();
+  GBool readHeader(GBool frame);
   GBool readBaselineSOF();
   GBool readProgressiveSOF();
   GBool readScanInfo();

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -29,6 +29,7 @@
 #include "Error.h"
 #include "GlobalParams.h"
 #include "UnicodeMap.h"
+#include "UnicodeRemapping.h"
 #include "UnicodeTypeTable.h"
 #include "GfxState.h"
 #include "Link.h"
@@ -155,6 +156,8 @@
 // rectangles, in order to work around flakey ascent values in fonts.
 #define selectionAscent 0.8
 
+#define maxUnicodeLen 16
+
 //------------------------------------------------------------------------
 // TextChar
 //------------------------------------------------------------------------
@@ -243,7 +246,7 @@
   } else if (ch1->xMin > ch2->xMin) {
     return 1;
   } else {
-    return 0;
+    return ch1->charPos - ch2->charPos;
   }
 }
 
@@ -256,7 +259,7 @@
   } else if (ch1->yMin > ch2->yMin) {
     return 1;
   } else {
-    return 0;
+    return ch1->charPos - ch2->charPos;
   }
 }
 
@@ -547,7 +550,7 @@
     for (code = 0; code < 256; ++code) {
       if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) &&
 	  name[0] == 'm' && name[1] == '\0') {
-	mWidth = ((Gfx8BitFont *)gfxFont)->getWidth(code);
+	mWidth = ((Gfx8BitFont *)gfxFont)->getWidth((Guchar)code);
 	break;
       }
     }
@@ -811,7 +814,20 @@
 }
 
 double TextLine::getBaseline() {
-  return ((TextWord *)words->get(0))->getBaseline();
+  TextWord *word0;
+
+  word0 = (TextWord *)words->get(0);
+  switch (rot) {
+  case 0:
+  default:
+    return yMax + fontSize * word0->font->descent;
+  case 1:
+    return xMin - fontSize * word0->font->descent;
+  case 2:
+    return yMin - fontSize * word0->font->descent;
+  case 3:
+    return xMax + fontSize * word0->font->descent;
+  }
 }
 
 int TextLine::cmpX(const void *p1, const void *p2) {
@@ -994,6 +1010,9 @@
 
 TextPage::TextPage(TextOutputControl *controlA) {
   control = *controlA;
+  remapping = globalParams->getUnicodeRemapping();
+  uBufSize = 16;
+  uBuf = (Unicode *)gmallocn(uBufSize, sizeof(Unicode));
   pageWidth = pageHeight = 0;
   charPos = 0;
   curFont = NULL;
@@ -1031,6 +1050,7 @@
   if (findCols) {
     deleteGList(findCols, TextColumn);
   }
+  gfree(uBuf);
 }
 
 void TextPage::startPage(GfxState *state) {
@@ -1122,20 +1142,21 @@
 	letterCode = code;
       }
       if (anyCode < 0 && name &&
-	  ((Gfx8BitFont *)gfxFont)->getWidth(code) > 0) {
+	  ((Gfx8BitFont *)gfxFont)->getWidth((Guchar)code) > 0) {
 	anyCode = code;
       }
     }
     if (mCode >= 0 &&
-	(w = ((Gfx8BitFont *)gfxFont)->getWidth(mCode)) > 0) {
+	(w = ((Gfx8BitFont *)gfxFont)->getWidth((Guchar)mCode)) > 0) {
       // 0.6 is a generic average 'm' width -- yes, this is a hack
       curFontSize *= w / 0.6;
     } else if (letterCode >= 0 &&
-	       (w = ((Gfx8BitFont *)gfxFont)->getWidth(letterCode)) > 0) {
+	       (w = ((Gfx8BitFont *)gfxFont)->getWidth((Guchar)letterCode))
+	         > 0) {
       // even more of a hack: 0.5 is a generic letter width
       curFontSize *= w / 0.5;
     } else if (anyCode >= 0 &&
-	       (w = ((Gfx8BitFont *)gfxFont)->getWidth(anyCode)) > 0) {
+	       (w = ((Gfx8BitFont *)gfxFont)->getWidth((Guchar)anyCode)) > 0) {
       // better than nothing: 0.5 is a generic character width
       curFontSize *= w / 0.5;
     }
@@ -1184,7 +1205,7 @@
   GfxRGB rgb;
   double alpha;
   GBool clipped, rtl;
-  int i, j;
+  int uBufLen, i, j;
 
   // if we're in an ActualText span, save the position info (the
   // ActualText chars will be added by TextPage::endActualText()).
@@ -1246,16 +1267,26 @@
     return;
   }
 
+  // remap Unicode
+  uBufLen = 0;
+  for (i = 0; i < uLen; ++i) {
+    if (uBufSize - uBufLen < 8 && uBufSize < 20000) {
+      uBufSize *= 2;
+      uBuf = (Unicode *)greallocn(uBuf, uBufSize, sizeof(Unicode));
+    }
+    uBufLen += remapping->map(u[i], uBuf + uBufLen, uBufSize - uBufLen);
+  }
+
   // add the characters
-  if (uLen > 0) {
+  if (uBufLen > 0) {
 
     // handle right-to-left ligatures: if there are multiple Unicode
     // characters, and they're all right-to-left, insert them in
     // right-to-left order
-    if (uLen > 1) {
+    if (uBufLen > 1) {
       rtl = gTrue;
-      for (i = 0; i < uLen; ++i) {
-	if (!unicodeTypeR(u[i])) {
+      for (i = 0; i < uBufLen; ++i) {
+	if (!unicodeTypeR(uBuf[i])) {
 	  rtl = gFalse;
 	  break;
 	}
@@ -1265,11 +1296,11 @@
     }
 
     // compute the bounding box
-    w1 /= uLen;
-    h1 /= uLen;
+    w1 /= uBufLen;
+    h1 /= uBufLen;
     ascent = curFont->ascent * curFontSize;
     descent = curFont->descent * curFontSize;
-    for (i = 0; i < uLen; ++i) {
+    for (i = 0; i < uBufLen; ++i) {
       x2 = x1 + i * w1;
       y2 = y1 + i * h1;
       switch (curRot) {
@@ -1320,11 +1351,12 @@
 	alpha = state->getFillOpacity();
       }
       if (rtl) {
-	j = uLen - 1 - i;
+	j = uBufLen - 1 - i;
       } else {
 	j = i;
       }
-      chars->append(new TextChar(u[j], charPos, nBytes, xMin, yMin, xMax, yMax,
+      chars->append(new TextChar(uBuf[j], charPos, nBytes,
+				 xMin, yMin, xMax, yMax,
 				 curRot, clipped,
 				 state->getRender() == 3 || alpha < 0.001,
 				 curFont, curFontSize,
@@ -1405,7 +1437,7 @@
     break;
   case eolDOS:
     eolLen = uMap->mapUnicode(0x0d, eol, sizeof(eol));
-    eolLen += uMap->mapUnicode(0x0a, eol + eolLen, sizeof(eol) - eolLen);
+    eolLen += uMap->mapUnicode(0x0a, eol + eolLen, (int)sizeof(eol) - eolLen);
     break;
   case eolMac:
     eolLen = uMap->mapUnicode(0x0d, eol, sizeof(eol));
@@ -4358,7 +4390,7 @@
     break;
   case eolDOS:
     eolLen = uMap->mapUnicode(0x0d, eol, sizeof(eol));
-    eolLen += uMap->mapUnicode(0x0a, eol + eolLen, sizeof(eol) - eolLen);
+    eolLen += uMap->mapUnicode(0x0a, eol + eolLen, (int)sizeof(eol) - eolLen);
     break;
   case eolMac:
     eolLen = uMap->mapUnicode(0x0d, eol, sizeof(eol));
@@ -4497,6 +4529,28 @@
   return gTrue;
 }
 
+GBool TextPage::checkPointInside(double x, double y) {
+  TextColumn *col;
+  int colIdx;
+
+  buildFindCols();
+
+  //~ this doesn't handle RtL, vertical, or rotated text
+  //~ this doesn't handle drop caps
+
+  for (colIdx = 0; colIdx < findCols->getLength(); ++colIdx) {
+    col = (TextColumn *)findCols->get(colIdx);
+    if (col->getRotation() != 0) {
+      continue;
+    }
+    if (x >= col->getXMin() && x <= col->getXMax() &&
+	y >= col->getYMin() && y <= col->getYMax()) {
+      return gTrue;
+    }
+  }
+  return gFalse;
+}
+
 GBool TextPage::findPointInside(double x, double y, TextPosition *pos) {
   TextColumn *col;
   int colIdx;
@@ -4708,6 +4762,37 @@
 }
 
 TextWordList *TextPage::makeWordList() {
+  return makeWordListForChars(chars);
+}
+
+TextWordList *TextPage::makeWordListForRect(double xMin, double yMin,
+					    double xMax, double yMax) {
+  TextWordList *words;
+  GList *chars2;
+  TextChar *ch;
+  double xx, yy;
+  int i;
+
+  // get all chars in the rectangle
+  // (i.e., all chars whose center lies inside the rectangle)
+  chars2 = new GList();
+  for (i = 0; i < chars->getLength(); ++i) {
+    ch = (TextChar *)chars->get(i);
+    xx = 0.5 * (ch->xMin + ch->xMax);
+    yy = 0.5 * (ch->yMin + ch->yMax);
+    if (xx > xMin && xx < xMax && yy > yMin && yy < yMax) {
+      chars2->append(ch);
+    }
+  }
+
+  words = makeWordListForChars(chars2);
+
+  delete chars2;
+
+  return words;
+}
+
+TextWordList *TextPage::makeWordListForChars(GList *charList) {
   TextBlock *tree;
   GList *columns;
   TextColumn *col;
@@ -4718,12 +4803,18 @@
   GBool primaryLR;
   int rot, colIdx, parIdx, lineIdx, wordIdx;
 
-  rot = rotateChars(chars);
-  primaryLR = checkPrimaryLR(chars);
-  tree = splitChars(chars);
+#if 0 //~debug
+  dumpCharList(charList);
+#endif
+  rot = rotateChars(charList);
+  primaryLR = checkPrimaryLR(charList);
+  tree = splitChars(charList);
+#if 0 //~debug
+  dumpTree(tree);
+#endif
   if (!tree) {
     // no text
-    unrotateChars(chars, rot);
+    unrotateChars(charList, rot);
     return new TextWordList(new GList(), gTrue);
   }
   columns = buildColumns(tree, primaryLR);
@@ -4731,7 +4822,7 @@
   dumpColumns(columns, gTrue);
 #endif
   delete tree;
-  unrotateChars(chars, rot);
+  unrotateChars(charList, rot);
   if (control.html) {
     rotateUnderlinesAndLinks(rot);
     generateUnderlinesAndLinks(columns);
@@ -4791,9 +4882,9 @@
 
   for (i = 0; i < charsA->getLength(); ++i) {
     ch = (TextChar *)charsA->get(i);
-    printf("char: U+%04x '%c' xMin=%g yMin=%g xMax=%g yMax=%g fontSize=%g rot=%d charPos=%d charLen=%d\n",
+    printf("char: U+%04x '%c' xMin=%g yMin=%g xMax=%g yMax=%g fontSize=%g rot=%d charPos=%d charLen=%d spaceAfter=%d\n",
 	   ch->c, ch->c & 0xff, ch->xMin, ch->yMin, ch->xMax, ch->yMax,
-	   ch->fontSize, ch->rot, ch->charPos, ch->charLen);
+	   ch->fontSize, ch->rot, ch->charPos, ch->charLen, ch->spaceAfter);
   }
 }
 
@@ -5180,6 +5271,11 @@
   return text->makeWordList();
 }
 
+TextWordList *TextOutputDev::makeWordListForRect(double xMin, double yMin,
+						 double xMax, double yMax) {
+  return text->makeWordListForRect(xMin, yMin, xMax, yMax);
+}
+
 TextPage *TextOutputDev::takeText() {
   TextPage *ret;
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TextOutputDev.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -22,6 +22,7 @@
 
 class GList;
 class UnicodeMap;
+class UnicodeRemapping;
 
 class TextBlock;
 class TextChar;
@@ -390,6 +391,9 @@
 		      double *xMin, double *yMin,
 		      double *xMax, double *yMax);
 
+  // Returns true if x,y falls inside a column.
+  GBool checkPointInside(double x, double y);
+
   // Find a point inside a column.  Returns false if x,y fall outside
   // all columns.
   GBool findPointInside(double x, double y, TextPosition *pos);
@@ -425,6 +429,11 @@
   // Build a flat word list, in the specified ordering.
   TextWordList *makeWordList();
 
+  // Build a word list containing only words inside the specified
+  // rectangle.
+  TextWordList *makeWordListForRect(double xMin, double yMin,
+				    double xMax, double yMax);
+
   // Returns true if the primary character direction is left-to-right,
   // false if it is right-to-left.
   GBool primaryDirectionIsLR();
@@ -532,8 +541,15 @@
   void dumpUnderlines();
 #endif
 
+  // word list
+  TextWordList *makeWordListForChars(GList *charList);
+
   TextOutputControl control;	// formatting parameters
 
+  UnicodeRemapping *remapping;
+  Unicode *uBuf;
+  int uBufSize;
+
   double pageWidth, pageHeight;	// width and height of current page
   int charPos;			// next character position (within content
 				//   stream)
@@ -686,6 +702,11 @@
   // order (if both flags are false).
   TextWordList *makeWordList();
 
+  // Build a word list containing only words inside the specified
+  // rectangle.
+  TextWordList *makeWordListForRect(double xMin, double yMin,
+				    double xMax, double yMax);
+
   // Returns the TextPage object for the last rasterized page,
   // transferring ownership to the caller.
   TextPage *takeText();

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileCompositor.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -231,7 +231,8 @@
 // BGR8 color modes.
 void TileCompositor::clearBitmap() {
   SplashColorPtr data, row, p;
-  int rowSize, w, h, x, y;
+  SplashBitmapRowSize rowSize;
+  int w, h, x, y;
 
   w = bitmap->getWidth();
   h = bitmap->getHeight();
@@ -299,7 +300,9 @@
   SplashColorPtr paperColor;
   Guchar *alphaData, *alphaP;
   Guchar alpha, alpha1;
-  int srcRowSize, destRowSize, alphaRowSize, x, y;
+  SplashBitmapRowSize srcRowSize, destRowSize;
+  size_t alphaRowSize;
+  int x, y;
 
   srcData = srcBitmap->getDataPtr();
   srcRowSize = srcBitmap->getRowSize();
@@ -307,7 +310,7 @@
   destRowSize = destBitmap->getRowSize();
 
   if (compositeWithPaper && (alphaData = srcBitmap->getAlphaPtr())) {
-    alphaRowSize = srcBitmap->getWidth();
+    alphaRowSize = srcBitmap->getAlphaRowSize();
     paperColor = state->getPaperColor();
     for (y = 0; y < h; ++y) {
       destP = &destData[(yDest + y) * destRowSize + 3 * xDest];
@@ -325,7 +328,7 @@
 	  destP[1] = paperColor[1];
 	  destP[2] = paperColor[2];
 	} else {
-	  alpha1 = 255 - alpha;
+	  alpha1 = (Guchar)(255 - alpha);
 	  destP[0] = div255(alpha1 * paperColor[0] + alpha * srcP[0]);
 	  destP[1] = div255(alpha1 * paperColor[1] + alpha * srcP[1]);
 	  destP[2] = div255(alpha1 * paperColor[2] + alpha * srcP[2]);
@@ -349,7 +352,8 @@
 			  SplashColorPtr color) {
   SplashColorPtr data, p;
   Guchar c0, c1, c2;
-  int rowSize, x, y;
+  SplashBitmapRowSize rowSize;
+  int x, y;
 
   if (xDest < 0) {
     w += xDest;
@@ -399,7 +403,8 @@
 				    SplashColorPtr color) {
   SplashColorPtr data, p;
   Guchar c0, c1, c2;
-  int rowSize, x, y;
+  SplashBitmapRowSize rowSize;
+  int x, y;
 
   if (xDest < 0) {
     w += xDest;
@@ -435,9 +440,9 @@
   for (y = 0; y < h; ++y) {
     p = &data[(yDest + y) * rowSize + 3 * xDest];
     for (x = 0; x < w; ++x) {
-      p[0] = (3 * p[0] + c0) / 4;
-      p[1] = (3 * p[1] + c1) / 4;
-      p[2] = (3 * p[2] + c2) / 4;
+      p[0] = (Guchar)((3 * p[0] + c0) / 4);
+      p[1] = (Guchar)((3 * p[1] + c1) / 4);
+      p[2] = (Guchar)((3 * p[2] + c2) / 4);
       p += 3;
     }
   }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -989,7 +989,6 @@
     }
     offsetX2 = offsetX + pageW1 + sideBySidePageSpacing;
     return (page == leftPage) ? offsetX : offsetX2;
-    return 0;
   case displaySideBySideContinuous:
     leftPage = ((page - 1) & ~1) + 1;
     rightPage = leftPage + 1;
@@ -1008,6 +1007,68 @@
   }
 }
 
+int TileMap::getPageRightX(int page) {
+  int leftPage, rightPage, pageW1, pageW2, offsetX, offsetX2;
+
+  if (!state->getDoc() || !state->getDoc()->getNumPages()) {
+    return 0;
+  }
+
+  updatePageParams();
+  updateContinuousModeParams();
+
+  switch (state->getDisplayMode()) {
+  case displaySingle:
+  default:
+    return pageW[page - 1] - state->getWinW();
+  case displayContinuous:
+    return (maxW + pageW[page - 1]) / 2 - state->getWinW();
+  case displaySideBySideSingle:
+    leftPage = ((page - 1) & ~1) + 1;
+    rightPage = leftPage + 1;
+    pageW1 = pageW[leftPage - 1];
+    if (rightPage <= state->getDoc()->getNumPages()) {
+      pageW2 = pageW[rightPage - 1];
+    } else {
+      // display a single page as though there were a blank facing
+      // page of the same size
+      pageW2 = pageW1;
+    }
+    if (pageW1 + sideBySidePageSpacing + pageW2 < state->getWinW()) {
+      offsetX = (state->getWinW() -
+		 (pageW1 + sideBySidePageSpacing + pageW2)) / 2;
+    } else {
+      offsetX = 0;
+    }
+    offsetX2 = offsetX + pageW1 + sideBySidePageSpacing;
+    return (page == leftPage) ? offsetX + pageW1 - state->getWinW()
+                              : offsetX2 + pageW2 - state->getWinW();
+  case displaySideBySideContinuous:
+    leftPage = ((page - 1) & ~1) + 1;
+    rightPage = leftPage + 1;
+    pageW1 = pageW[leftPage - 1];
+    if (rightPage <= state->getDoc()->getNumPages()) {
+      pageW2 = pageW[rightPage - 1];
+    } else {
+      // display a single page as though there were a blank facing
+      // page of the same size
+      pageW2 = pageW1;
+    }
+    if (maxW + sideBySidePageSpacing + maxW2 < state->getWinW()) {
+      offsetX = (state->getWinW() -
+		 (maxW + sideBySidePageSpacing + maxW2)) / 2;
+    } else {
+      offsetX = 0;
+    }
+    offsetX += maxW - pageW1;
+    offsetX2 = offsetX + pageW1 + sideBySidePageSpacing;
+    return (page == leftPage) ? offsetX + pageW1 - state->getWinW()
+                              : offsetX2 + pageW2 - state->getWinW();
+  case displayHorizontalContinuous:
+    return pageX[page - 1] + pageW[page - 1] - state->getWinW();
+  }
+}
+
 int TileMap::getFirstPage() {
   updateContinuousModeParams();
   switch (state->getDisplayMode()) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/TileMap.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -122,6 +122,10 @@
   // this just returns zero.)
   int getPageLeftX(int page);
 
+  // Return the scrollX setting that would place the right side of
+  // <page> at the right side of the window.
+  int getPageRightX(int page);
+
   // In continuous modes: return the lowest page number visible
   // anywhere in the window; in non-continuous modes: return the
   // current page.

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UTF8.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UTF8.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UTF8.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -151,7 +151,7 @@
     if (*i < s->getLength() - 1) {
       w1 = ((s->getChar(*i) & 0xff) << 8) | (s->getChar(*i + 1) & 0xff);
       *i += 2;
-      *u = 0x10000 + ((w0 - 0xd8000) << 10) + (w1 - 0xdc00);
+      *u = 0x10000 + ((w0 - 0xd800) << 10) + (w1 - 0xdc00);
     } else {
       *u = (Unicode)w0;
     }
@@ -173,7 +173,7 @@
     if (*i < s->getLength() - 1) {
       w1 = (s->getChar(*i) & 0xff) | ((s->getChar(*i + 1) & 0xff) << 8);
       *i += 2;
-      *u = 0x10000 + ((w0 - 0xd8000) << 10) + (w1 - 0xdc00);
+      *u = 0x10000 + ((w0 - 0xd800) << 10) + (w1 - 0xdc00);
     } else {
       *u = (Unicode)w0;
     }

Added: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc	                        (rev 0)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -0,0 +1,178 @@
+//========================================================================
+//
+// UnicodeRemapping.cc
+//
+// Copyright 2018 Glyph & Cog, LLC
+//
+//========================================================================
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma implementation
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include "gmem.h"
+#include "gmempp.h"
+#include "gfile.h"
+#include "GString.h"
+#include "Error.h"
+#include "UnicodeRemapping.h"
+
+//------------------------------------------------------------------------
+
+#define maxUnicodeString 8
+
+struct UnicodeRemappingString {
+  Unicode in;
+  Unicode out[maxUnicodeString];
+  int len;
+};
+
+//------------------------------------------------------------------------
+
+static int hexCharVals[256] = {
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 1x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 2x
+   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, -1, -1, -1, -1, -1, -1, // 3x
+  -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 4x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 5x
+  -1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 6x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 7x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 8x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 9x
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Ax
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Bx
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Cx
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Dx
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // Ex
+  -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1  // Fx
+};
+
+// Parse a <len>-byte hex string <s> into *<val>.  Returns false on
+// error.
+static GBool parseHex(char *s, int len, Guint *val) {
+  int i, x;
+
+  *val = 0;
+  for (i = 0; i < len; ++i) {
+    x = hexCharVals[s[i] & 0xff];
+    if (x < 0) {
+      return gFalse;
+    }
+    *val = (*val << 4) + x;
+  }
+  return gTrue;
+}
+
+//------------------------------------------------------------------------
+
+UnicodeRemapping::UnicodeRemapping() {
+  for (int i = 0; i < 256; ++i) {
+    page0[i] = (Unicode)i;
+  }
+  sMap = NULL;
+  sMapLen = sMapSize = 0;
+}
+
+UnicodeRemapping::~UnicodeRemapping() {
+  gfree(sMap);
+}
+
+void UnicodeRemapping::addRemapping(Unicode in, Unicode *out, int len) {
+  int i;
+
+  if (in < 256 && len == 1) {
+    page0[in] = out[0];
+  } else {
+    if (in < 256) {
+      page0[in] = 0xffffffff;
+    }
+    if (sMapLen == sMapSize) {
+      sMapSize += 16;
+      sMap = (UnicodeRemappingString *)
+	         greallocn(sMap, sMapSize, sizeof(UnicodeRemappingString));
+    }
+    sMap[sMapLen].in = in;
+    for (i = 0; i < len && i < maxUnicodeString; ++i) {
+      sMap[sMapLen].out[i] = out[i];
+    }
+    sMap[sMapLen].len = i;
+    ++sMapLen;
+  }
+}
+
+void UnicodeRemapping::parseFile(GString *fileName) {
+  FILE *f;
+  char buf[256];
+  Unicode in;
+  Unicode out[maxUnicodeString];
+  char *tok;
+  int line, n;
+
+  if (!(f = openFile(fileName->getCString(), "r"))) {
+    error(errSyntaxError, -1, "Couldn't open unicodeRemapping file '{0:t}'",
+	  fileName);
+    return;
+  }
+
+  line = 0;
+  while (getLine(buf, sizeof(buf), f)) {
+    ++line;
+    if (!(tok = strtok(buf, " \t\r\n")) ||
+	!parseHex(tok, (int)strlen(tok), &in)) {
+      error(errSyntaxWarning, -1,
+	    "Bad line ({0:d}) in unicodeRemapping file '{1:t}'",
+	    line, fileName);
+      continue;
+    }
+    n = 0;
+    while (n < maxUnicodeString) {
+      if (!(tok = strtok(NULL, " \t\r\n"))) {
+	break;
+      }
+      if (!parseHex(tok, (int)strlen(tok), &out[n])) {
+	error(errSyntaxWarning, -1,
+	      "Bad line ({0:d}) in unicodeRemapping file '{1:t}'",
+	      line, fileName);
+	break;
+      }
+      ++n;
+    }
+    addRemapping(in, out, n);
+  }
+
+  fclose(f);
+}
+
+int UnicodeRemapping::map(Unicode in, Unicode *out, int size) {
+  int a, b, m, i;
+
+  if (in < 256 && page0[in] != 0xffffffff) {
+    out[0] = page0[in];
+    return 1;
+  }
+
+  a = -1;
+  b = sMapLen;
+  // invariant: sMap[a].in < in < sMap[b].in
+  while (b - a > 1) {
+    m = (a + b) / 2;
+    if (sMap[m].in < in) {
+      a = m;
+    } else if (in < sMap[m].in) {
+      b = m;
+    } else {
+      for (i = 0; i < sMap[m].len && i < size; ++i) {
+	out[i] = sMap[m].out[i];
+      }
+      return i;
+    }
+  }
+
+  out[0] = in;
+  return 1;
+}

Added: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h	                        (rev 0)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -0,0 +1,51 @@
+//========================================================================
+//
+// UnicodeRemapping.h
+//
+// Sparse remapping of Unicode characters.
+//
+// Copyright 2018 Glyph & Cog, LLC
+//
+//========================================================================
+
+#ifndef UNICODEREMAPPING_H
+#define UNICODEREMAPPING_H
+
+#include <aconf.h>
+
+#ifdef USE_GCC_PRAGMAS
+#pragma interface
+#endif
+
+#include "CharTypes.h"
+
+struct UnicodeRemappingString;
+
+//------------------------------------------------------------------------
+
+class UnicodeRemapping {
+public:
+
+  // Create an empty (i.e., identity) remapping.
+  UnicodeRemapping();
+
+  ~UnicodeRemapping();
+
+  // Add a remapping for <in>.
+  void addRemapping(Unicode in, Unicode *out, int len);
+
+  // Add entries from the specified file to this UnicodeRemapping.
+  void parseFile(GString *fileName);
+
+  // Map <in> to zero or more (up to <size>) output characters in
+  // <out>.  Returns the number of output characters.
+  int map(Unicode in, Unicode *out, int size);
+
+private:
+
+  Unicode page0[256];
+  UnicodeRemappingString *sMap;
+  int sMapLen, sMapSize;
+};
+
+#endif


Property changes on: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/UnicodeRemapping.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -24,6 +24,7 @@
 #include "Gfx.h"
 #include "GfxFont.h"
 #include "Zoox.h"
+#include "PDF417Barcode.h"
 #include "XFAForm.h"
 
 #ifdef _WIN32
@@ -377,9 +378,14 @@
   GString *data;
   GBool fullXFAA;
   GString *name, *fullName;
+  GHash *nameCount, *nameIdx, *fullNameCount, *fullNameIdx;
   char buf[4096];
   int n, i;
 
+  if (catalog->getNumPages() == 0) {
+    return NULL;
+  }
+
   docA->getXRef()->getCatalog(&catDict);
   catDict.dictLookup("NeedsRendering", &obj1);
   fullXFAA = obj1.isBool() && obj1.getBool();
@@ -430,11 +436,21 @@
 
   if (xfaForm->xml->getRoot()) {
     if ((tmpl = xfaForm->xml->getRoot()->findFirstChildElement("template"))) {
-      name = new GString("form");
-      fullName = new GString("form");
       xfaForm->curPageNum = 0;
       xfaForm->curXOffset = xfaForm->curYOffset = 0;
-      xfaForm->scanNamedNode(tmpl, name, fullName, gFalse, NULL);
+      name = new GString();
+      fullName = new GString();
+      nameCount = new GHash();
+      nameIdx = new GHash();
+      fullNameCount = new GHash();
+      fullNameIdx = new GHash();
+      xfaForm->scanNode(tmpl, name, fullName, gFalse, NULL,
+			nameCount, nameIdx, fullNameCount, fullNameIdx,
+			catalog);
+      delete nameCount;
+      delete nameIdx;
+      delete fullNameCount;
+      delete fullNameIdx;
       delete name;
       delete fullName;
 
@@ -488,229 +504,302 @@
   gfree(pageOffsetY);
 }
 
-// Scan all children of <elem>, which is a named internal (non-field)
-// node, with the specified name.
-void XFAForm::scanNamedNode(ZxElement *elem, GString *name, GString *fullName,
-			    GBool inPageSet, XFATableInfo *tableInfo) {
-  GHash *childNameCount, *childNameIdx;
-  ZxNode *child;
+//~ need to handle exclGroup
+//~ - fields in an exclGroup may/must(?) not have names
+//~ - each field has an items element with the the value when that
+//~   field is selected
 
-  childNameCount = new GHash();
-  for (child = elem->getFirstChild(); child; child = child->getNextChild()) {
-    if (child->isElement()) {
-      scanNames((ZxElement *)child, childNameCount);
+// Scan <elem>.  Constructs the node's name and full name.  If <elem>
+// is a field, creates an XFAFormField; else scans <elem>'s children.
+void XFAForm::scanNode(ZxElement *elem,
+		       GString *parentName, GString *parentFullName,
+		       GBool inPageSet, XFATableInfo *tableInfo,
+		       GHash *nameCount, GHash *nameIdx,
+		       GHash *fullNameCount, GHash *fullNameIdx,
+		       Catalog *catalog) {
+  ZxAttr *attr;
+  GString *name, *fullName, *namePart, *fullNamePart;
+  GHash *childNameCount, *childNameIdx, *childFullNameCount, *childFullNameIdx;
+  int colSpan, i;
+
+  if (elem->isElement("template")) {
+    name = new GString("form");
+    fullName = new GString("form");
+    childNameCount = new GHash();
+    scanNames(elem, childNameCount);
+    childNameIdx = new GHash();
+    childFullNameCount = new GHash();
+    scanFullNames(elem, childFullNameCount);
+    childFullNameIdx = new GHash();
+  } else {
+    if ((namePart = getNodeName(elem))) {
+      name = GString::format("{0:t}.{1:t}", parentName, namePart);
+      if (nameCount->lookupInt(namePart) > 1) {
+	i = nameIdx->lookupInt(namePart);
+	name->appendf("[{0:d}]", i);
+	nameIdx->replace(namePart, i + 1);
+      }
+      childNameCount = new GHash();
+      scanNames(elem, childNameCount);
+      childNameIdx = new GHash();
+    } else {
+      name = parentName->copy();
+      childNameCount = nameCount;
+      childNameIdx = nameIdx;
     }
+    if ((fullNamePart = getNodeFullName(elem))) {
+      fullName = GString::format("{0:t}.{1:t}", parentFullName, fullNamePart);
+      if (fullNameCount->lookupInt(fullNamePart) > 1) {
+	i = fullNameIdx->lookupInt(fullNamePart);
+	fullName->appendf("[{0:d}]", i);
+	fullNameIdx->replace(fullNamePart, i + 1);
+      }
+      childFullNameCount = new GHash();
+      scanFullNames(elem, childFullNameCount);
+      childFullNameIdx = new GHash();
+    } else {
+      fullName = parentFullName->copy();
+      childFullNameCount = fullNameCount;
+      childFullNameIdx = fullNameIdx;
+    }
   }
-  childNameIdx = new GHash();
-  for (child = elem->getFirstChild(); child; child = child->getNextChild()) {
-    if (child->isElement()) {
-      scanFields((ZxElement *)child, name, fullName, inPageSet,
-		 tableInfo, childNameCount, childNameIdx);
+
+  if (tableInfo && (elem->isElement("field") || elem->isElement("draw"))) {
+    if ((attr = elem->findAttr("colSpan"))) {
+      colSpan = atoi(attr->getValue()->getCString());
+    } else {
+      colSpan = 1;
     }
+  } else {
+    colSpan = 0;
   }
-  delete childNameIdx;
-  delete childNameCount;
+
+  if (elem->isElement("field")) {
+    scanField(elem, name, fullName, inPageSet, tableInfo, colSpan, catalog);
+  } else {
+    scanNonField(elem, name, fullName, inPageSet, tableInfo, colSpan,
+		 childNameCount, childNameIdx,
+		 childFullNameCount, childFullNameIdx,
+		 catalog);
+  }
+
+  if (tableInfo) {
+    tableInfo->columnIdx += colSpan;
+  }
+
+  delete name;
+  delete fullName;
+  if (childNameCount != nameCount) {
+    delete childNameCount;
+  }
+  if (childNameIdx != nameIdx) {
+    delete childNameIdx;
+  }
+  if (childFullNameCount != fullNameCount) {
+    delete childFullNameCount;
+  }
+  if (childFullNameIdx != fullNameIdx) {
+    delete childFullNameIdx;
+  }
 }
 
 // Traverse all children of <elem>, incrementing nameCount[name] for
 // each named child.  Traversal stops at each named child.
 void XFAForm::scanNames(ZxElement *elem, GHash *nameCount) {
-  ZxNode *child;
-  GString *childName;
+  ZxNode *node;
+  ZxElement *child;
+  GString *namePart;
 
-  if ((childName = getNodeName(elem))) {
-    if (nodeIsBindGlobal(elem)) {
-      nameCount->replace(childName, 1);
-    } else {
-      nameCount->replace(childName, nameCount->lookupInt(childName) + 1);
+  for (node = elem->getFirstChild(); node; node = node->getNextChild()) {
+    if (node->isElement()) {
+      child = (ZxElement *)node;
+      if ((namePart = getNodeName(child))) {
+	if (nodeIsBindGlobal(child)) {
+	  nameCount->replace(namePart, 1);
+	} else {
+	  nameCount->replace(namePart, nameCount->lookupInt(namePart) + 1);
+	}
+      } else {
+	scanNames(child, nameCount);
+      }
     }
-  } else {
-    for (child = elem->getFirstChild(); child; child = child->getNextChild()) {
-      if (child->isElement()) {
-	scanNames((ZxElement *)child, nameCount);
+  }
+}
+
+// Traverse all children of <elem>, incrementing fullNameCount[name]
+// for each full-named child.  Traversal stops at each full-named
+// child.
+void XFAForm::scanFullNames(ZxElement *elem, GHash *fullNameCount) {
+  ZxNode *node;
+  ZxElement *child;
+  GString *fullNamePart;
+
+  for (node = elem->getFirstChild(); node; node = node->getNextChild()) {
+    if (node->isElement()) {
+      child = (ZxElement *)node;
+      if ((fullNamePart = getNodeFullName(child))) {
+	if (nodeIsBindGlobal(child)) {
+	  fullNameCount->replace(fullNamePart, 1);
+	} else {
+	  fullNameCount->replace(fullNamePart,
+				 fullNameCount->lookupInt(fullNamePart) + 1);
+	}
+      } else {
+	scanFullNames(child, fullNameCount);
       }
     }
   }
 }
 
-// Create fields for <elem> and its children.  <parentName> is the
-// name of <elem>'s parent.  <siblingNameCount> contains the number of
-// occurrences of the siblings' (parent's childrens') names.
-// <siblingNameIdx> contains the number of occurrences of each name
-// used so far.
-void XFAForm::scanFields(ZxElement *elem, GString *parentName,
-			 GString *parentFullName, GBool inPageSet,
-			 XFATableInfo *tableInfo,
-			 GHash *siblingNameCount, GHash *siblingNameIdx) {
+void XFAForm::scanField(ZxElement *elem, GString *name, GString *fullName,
+			GBool inPageSet,
+			XFATableInfo *tableInfo, int colSpan,
+			Catalog *catalog) {
+  double xSubOffset, ySubOffset, columnWidth, rowHeight;
+
+  if (curPageNum == 0) {
+    curPageNum = 1;
+  }
+
+  xSubOffset = ySubOffset = 0;
+  columnWidth = rowHeight = 0;
+  if (tableInfo) {
+    if (tableInfo->columnIdx > 0 &&
+	tableInfo->columnIdx <= tableInfo->nColumns) {
+      xSubOffset = tableInfo->columnRight[tableInfo->columnIdx - 1];
+    }
+    if (tableInfo->columnIdx + colSpan <= tableInfo->nColumns) {
+      columnWidth = tableInfo->columnRight[tableInfo->columnIdx + colSpan - 1]
+	            - xSubOffset;
+    }
+    ySubOffset = tableInfo->rowTop;
+    rowHeight = tableInfo->rowHeight;
+    curXOffset += xSubOffset;
+    curYOffset += ySubOffset;
+  }
+
+  fields->append(new XFAFormField(this, elem, name->copy(), fullName->copy(),
+				  curPageNum, curXOffset, curYOffset,
+				  columnWidth, rowHeight));
+
+  if (tableInfo) {
+    curXOffset -= xSubOffset;
+    curYOffset -= ySubOffset;
+  }
+}
+
+void XFAForm::scanNonField(ZxElement *elem, GString *name, GString *fullName,
+			   GBool inPageSet,
+			   XFATableInfo *tableInfo, int colSpan,
+			   GHash *nameCount, GHash *nameIdx,
+			   GHash *fullNameCount, GHash *fullNameIdx,
+			   Catalog *catalog) {
   XFATableInfo *newTableInfo;
   ZxElement *brk, *contentArea;
   ZxNode *child;
   ZxAttr *attr;
-  GString *elemName, *elemFullName, *name, *fullName;
-  double xSubOffset, ySubOffset, columnWidth, rowHeight;
+  PDFRectangle *box;
+  double xSubOffset, ySubOffset;
   int savedPageNum;
-  int colSpan, i;
 
-  //~ need to handle exclGroup
-  //~ - fields in an exclGroup may/must(?) not have names
-  //~ - each field has an items element with the the value when that
-  //~   field is selected
+  newTableInfo = tableInfo;
 
-  if ((elemName = getNodeName(elem))) {
-    name = GString::format("{0:t}.{1:t}", parentName, elemName);
-  } else {
-    name = parentName;
-  }
+  if (elem->isElement("subform")) {
 
-  if ((elemFullName = getNodeFullName(elem))) {
-    fullName = GString::format("{0:t}.{1:t}", parentFullName, elemFullName);
-  } else {
-    fullName = parentFullName;
-  }
+    // update page number
+    if (((brk = elem->findFirstChildElement("breakBefore")) &&
+	 (attr = brk->findAttr("targetType")) &&
+	 !attr->getValue()->cmp("pageArea")) ||
+	((brk = elem->findFirstChildElement("break")) &&
+	 (attr = brk->findAttr("before")) &&
+	 !attr->getValue()->cmp("pageArea")) ||
+	(curPageNum < nPages &&
+	 (attr = elem->findAttr("w")) &&
+	 (box = catalog->getPage(curPageNum + 1)->getMediaBox()) &&
+	 XFAFormField::getMeasurement(attr, 0) == box->x2 - box->x1 &&
+	 (attr = elem->findAttr("h")) &&
+	 XFAFormField::getMeasurement(attr, 0) == box->y2 - box->y1)) {
+      if (curPageNum < nPages) {
+	++curPageNum;
+      }
+    }
 
-  //~ do we need a separate siblingNameCount/siblingNameIndex for
-  //~   elemName and elemFullName?
-  if (elemFullName && siblingNameCount->lookupInt(elemFullName) > 1) {
-    i = siblingNameIdx->lookupInt(elemFullName);
-    fullName->appendf("[{0:d}]", i);
-    if (elemName) {
-      name->appendf("[{0:d}]", i);
+    // update tableInfo
+    if ((attr = elem->findAttr("layout"))) {
+      if (!attr->getValue()->cmp("table")) {
+	newTableInfo = new XFATableInfo(elem->findAttr("columnWidths"));
+	newTableInfo->rowIdx = -1;
+	newTableInfo->columnIdx = 0;
+      } else if (tableInfo && !attr->getValue()->cmp("row")) {
+	++tableInfo->rowIdx;
+	tableInfo->columnIdx = 0;
+	tableInfo->rowTop += tableInfo->rowHeight;
+	tableInfo->computeRowHeight(elem);
+      }
     }
-    siblingNameIdx->replace(elemFullName, i + 1);
-  }
 
-  if (tableInfo && (elem->isElement("field") || elem->isElement("draw"))) {
-    if ((attr = elem->findAttr("colSpan"))) {
-      colSpan = atoi(attr->getValue()->getCString());
-    } else {
-      colSpan = 1;
-    }
+    // update position
+    xSubOffset = XFAFormField::getMeasurement(elem->findAttr("x"), 0);
+    ySubOffset = XFAFormField::getMeasurement(elem->findAttr("y"), 0);
+    curXOffset += xSubOffset;
+    curYOffset += ySubOffset;
+
+  } else if (elem->isElement("area")) {
+    xSubOffset = XFAFormField::getMeasurement(elem->findAttr("x"), 0);
+    ySubOffset = XFAFormField::getMeasurement(elem->findAttr("y"), 0);
+    curXOffset += xSubOffset;
+    curYOffset += ySubOffset;
+
   } else {
-    colSpan = 0;
+    xSubOffset = ySubOffset = 0;
   }
 
-  if (elem->isElement("field")) {
-    if (curPageNum == 0) {
-      curPageNum = 1;
-    }
-    xSubOffset = ySubOffset = 0;
-    columnWidth = rowHeight = 0;
-    if (tableInfo) {
-      if (tableInfo->columnIdx > 0 &&
-	  tableInfo->columnIdx <= tableInfo->nColumns) {
-	xSubOffset = tableInfo->columnRight[tableInfo->columnIdx - 1];
+  savedPageNum = curPageNum;
+  if (elem->isElement("pageSet")) {
+    inPageSet = gTrue;
+    curPageNum = 0;
+
+  } else if (elem->isElement("pageArea")) {
+    if (inPageSet) {
+      if (curPageNum < nPages) {
+	++curPageNum;
       }
-      if (tableInfo->columnIdx + colSpan <= tableInfo->nColumns) {
-	columnWidth = tableInfo->columnRight[tableInfo->columnIdx + colSpan - 1]
-	              - xSubOffset;
+      if ((contentArea = elem->findFirstChildElement("contentArea"))) {
+	pageOffsetX[curPageNum - 1] =
+	    XFAFormField::getMeasurement(contentArea->findAttr("x"), 0);
+	pageOffsetY[curPageNum - 1] =
+	    XFAFormField::getMeasurement(contentArea->findAttr("y"), 0);
+	// looks like the contentArea offset (pageOffsetX/Y) should
+	// not be added to fields defined inside the pageArea
+	// element (?)
+	xSubOffset -= pageOffsetX[curPageNum - 1];
+	ySubOffset -= pageOffsetY[curPageNum - 1];
+	curXOffset -= pageOffsetX[curPageNum - 1];
+	curYOffset -= pageOffsetY[curPageNum - 1];
       }
-      ySubOffset = tableInfo->rowTop;
-      rowHeight = tableInfo->rowHeight;
-      curXOffset += xSubOffset;
-      curYOffset += ySubOffset;
     }
-    fields->append(new XFAFormField(this, elem, name->copy(), fullName->copy(),
-				    curPageNum, curXOffset, curYOffset,
-				    columnWidth, rowHeight));
-    if (tableInfo) {
-      curXOffset -= xSubOffset;
-      curYOffset -= ySubOffset;
+  }
+
+  for (child = elem->getFirstChild(); child; child = child->getNextChild()) {
+    if (child->isElement()) {
+      scanNode((ZxElement *)child, name, fullName, inPageSet,
+	       newTableInfo, nameCount, nameIdx, fullNameCount, fullNameIdx,
+	       catalog);
     }
-  } else {
-    newTableInfo = tableInfo;
-    if (elem->isElement("subform")) {
-      if (((brk = elem->findFirstChildElement("breakBefore")) &&
-	   (attr = brk->findAttr("targetType")) &&
-	   !attr->getValue()->cmp("pageArea")) ||
-	  ((brk = elem->findFirstChildElement("break")) &&
-	   (attr = brk->findAttr("before")) &&
-	   !attr->getValue()->cmp("pageArea"))) {
-	if (curPageNum < nPages) {
-	  ++curPageNum;
-	}
-      }
-      if ((attr = elem->findAttr("layout"))) {
-	if (!attr->getValue()->cmp("table")) {
-	  newTableInfo = new XFATableInfo(elem->findAttr("columnWidths"));
-	  newTableInfo->rowIdx = -1;
-	  newTableInfo->columnIdx = 0;
-	} else if (tableInfo && !attr->getValue()->cmp("row")) {
-	  ++tableInfo->rowIdx;
-	  tableInfo->columnIdx = 0;
-	  tableInfo->rowTop += tableInfo->rowHeight;
-	  tableInfo->computeRowHeight(elem);
-	}
-      }
-      xSubOffset = XFAFormField::getMeasurement(elem->findAttr("x"), 0);
-      ySubOffset = XFAFormField::getMeasurement(elem->findAttr("y"), 0);
-      curXOffset += xSubOffset;
-      curYOffset += ySubOffset;
-    } else if (elem->isElement("area")) {
-      xSubOffset = XFAFormField::getMeasurement(elem->findAttr("x"), 0);
-      ySubOffset = XFAFormField::getMeasurement(elem->findAttr("y"), 0);
-      curXOffset += xSubOffset;
-      curYOffset += ySubOffset;
-    } else {
-      xSubOffset = ySubOffset = 0;
-    }
-    savedPageNum = curPageNum;
-    if (elem->isElement("pageSet")) {
-      inPageSet = gTrue;
-      curPageNum = 0;
-    } else if (elem->isElement("pageArea")) {
-      if (inPageSet) {
-	if (curPageNum < nPages) {
-	  ++curPageNum;
-	}
-	if ((contentArea = elem->findFirstChildElement("contentArea"))) {
-	  pageOffsetX[curPageNum - 1] =
-	      XFAFormField::getMeasurement(contentArea->findAttr("x"), 0);
-	  pageOffsetY[curPageNum - 1] =
-	      XFAFormField::getMeasurement(contentArea->findAttr("y"), 0);
-	  // looks like the contentArea offset (pageOffsetX/Y) should
-	  // not be added to fields defined inside the pageArea
-	  // element (?)
-	  xSubOffset -= pageOffsetX[curPageNum - 1];
-	  ySubOffset -= pageOffsetY[curPageNum - 1];
-	  curXOffset -= pageOffsetX[curPageNum - 1];
-	  curYOffset -= pageOffsetY[curPageNum - 1];
-	}
-      }
-    }
-    if (elemName) {
-      scanNamedNode(elem, name, fullName, inPageSet, newTableInfo);
-    } else {
-      for (child = elem->getFirstChild();
-	   child;
-	   child = child->getNextChild()) {
-	if (child->isElement()) {
-	  scanFields((ZxElement *)child, name, fullName, inPageSet,
-		     newTableInfo, siblingNameCount, siblingNameIdx);
-	}
-      }
-    }
-    curXOffset -= xSubOffset;
-    curYOffset -= ySubOffset;
-    if (newTableInfo != tableInfo) {
-      delete newTableInfo;
-    }
-    if (elem->isElement("pageSet")) {
-      pageSetNPages = curPageNum;
-      curPageNum = savedPageNum;
-      inPageSet = gFalse;
-    }
   }
 
-  if (tableInfo) {
-    tableInfo->columnIdx += colSpan;
+  curXOffset -= xSubOffset;
+  curYOffset -= ySubOffset;
+
+  if (newTableInfo != tableInfo) {
+    delete newTableInfo;
   }
 
-  if (name != parentName) {
-    delete name;
+  if (elem->isElement("pageSet")) {
+    pageSetNPages = curPageNum;
+    curPageNum = savedPageNum;
+    inPageSet = gFalse;
   }
-  if (fullName != parentFullName) {
-    delete fullName;
-  }
 }
 
 GString *XFAForm::getNodeName(ZxElement *elem) {
@@ -987,6 +1076,7 @@
 			GfxFontDict *fontDict) {
   ZxElement *uiElem;
   ZxNode *node;
+  ZxAttr *attr;
   GString *appearBuf;
   MemStream *appearStream;
   Object appearDict, appearance, resourceDict, resourceSubdict;
@@ -1001,6 +1091,14 @@
     return;
   }
 
+  // check the 'presence' attribute
+  if ((attr = xml->findAttr("presence"))) {
+    if (!attr->getValue()->cmp("hidden") ||
+	!attr->getValue()->cmp("invisible")) {
+      return;
+    }
+  }
+
   getRectangle(&xfaX, &xfaY, &xfaW, &xfaH, &pdfX, &pdfY, &pdfW, &pdfH, &rot3);
 
   // generate transform matrix
@@ -1239,7 +1337,7 @@
     }
   }
 
-  // look for <para> -- add the margin
+  // look for <para> -- add the margins
   if ((paraElem = xml->findFirstChildElement("para"))) {
     if ((attr = paraElem->findAttr("marginLeft"))) {
       t = getMeasurement(attr, 0);
@@ -1250,6 +1348,15 @@
       t = getMeasurement(attr, 0);
       *xfaW -= t;
     }
+    if ((attr = paraElem->findAttr("spaceAbove"))) {
+      t = getMeasurement(attr, 0);
+      *xfaY += t;
+      *xfaH -= t;
+    }
+    if ((attr = paraElem->findAttr("spaceBelow"))) {
+      t = getMeasurement(attr, 0);
+      *xfaH -= t;
+    }
   }
 
   // get annot rect (UL corner, width, height) in XFA coords
@@ -1507,10 +1614,10 @@
   ZxAttr *attr;
   GString *value, *value2, *barcodeType, *textLocation, *fontName, *s1, *s2;
   XFAVertAlign textAlign;
-  double wideNarrowRatio, fontSize;
+  double wideNarrowRatio, moduleWidth, moduleHeight, fontSize;
   double yText, wText, yBarcode, hBarcode, wNarrow, xx;
   GBool doText;
-  int dataLength, checksum;
+  int dataLength, errorCorrectionLevel, checksum;
   GBool bold, italic;
   char *p;
   int i, j, c;
@@ -1520,10 +1627,40 @@
     return;
   }
 
+  //--- get font
+  fontName = NULL;
+  fontSize = 0.2 * h;
+  bold = gFalse;
+  italic = gFalse;
+  if ((fontElem = xml->findFirstChildElement("font"))) {
+    if ((attr = fontElem->findAttr("typeface"))) {
+      fontName = attr->getValue()->copy();
+    }
+    if ((attr = fontElem->findAttr("weight"))) {
+      if (!attr->getValue()->cmp("bold")) {
+	bold = gTrue;
+      }
+    }
+    if ((attr = fontElem->findAttr("posture"))) {
+      if (!attr->getValue()->cmp("italic")) {
+	italic = gTrue;
+      }
+    }
+    if ((attr = fontElem->findAttr("size"))) {
+      fontSize = getMeasurement(attr, fontSize);
+    }
+  }
+  if (!fontName) {
+    fontName = new GString("Courier");
+  }
+
   //--- get field attributes
   barcodeType = NULL;
   wideNarrowRatio = 3;
+  moduleWidth = 0;
+  moduleHeight = 0;
   dataLength = 0;
+  errorCorrectionLevel = 0;
   textLocation = NULL;
   if ((uiElem = xml->findFirstChildElement("ui")) &&
       (barcodeElem = uiElem->findFirstChildElement("barcode"))) {
@@ -1544,9 +1681,18 @@
 	wideNarrowRatio = atof(s1->getCString());
       }
     }
+    if ((attr = barcodeElem->findAttr("moduleWidth"))) {
+      moduleWidth = getMeasurement(attr, (0.25 / 25.4) * 72.0); // 0.25mm
+    }
+    if ((attr = barcodeElem->findAttr("moduleHeight"))) {
+      moduleHeight = getMeasurement(attr, (0.5 / 25.4) * 72.0); // 0.5mm
+    }
     if ((attr = barcodeElem->findAttr("dataLength"))) {
       dataLength = atoi(attr->getValue()->getCString());
     }
+    if ((attr = barcodeElem->findAttr("errorCorrectionLevel"))) {
+      errorCorrectionLevel = atoi(attr->getValue()->getCString());
+    }
     if ((attr = barcodeElem->findAttr("textLocation"))) {
       textLocation = attr->getValue();
     }
@@ -1553,41 +1699,10 @@
   }
   if (!barcodeType) {
     error(errSyntaxError, -1, "Missing 'type' attribute in XFA barcode field");
+    delete fontName;
     return;
   }
-  if (!dataLength) {
-    error(errSyntaxError, -1,
-	  "Missing 'dataLength' attribute in XFA barcode field");
-    return;
-  }
 
-  //--- get font
-  fontName = NULL;
-  fontSize = 0.2 * h;
-  bold = gFalse;
-  italic = gFalse;
-  if ((fontElem = xml->findFirstChildElement("font"))) {
-    if ((attr = fontElem->findAttr("typeface"))) {
-      fontName = attr->getValue()->copy();
-    }
-    if ((attr = fontElem->findAttr("weight"))) {
-      if (!attr->getValue()->cmp("bold")) {
-	bold = gTrue;
-      }
-    }
-    if ((attr = fontElem->findAttr("posture"))) {
-      if (!attr->getValue()->cmp("italic")) {
-	italic = gTrue;
-      }
-    }
-    if ((attr = fontElem->findAttr("size"))) {
-      fontSize = getMeasurement(attr, fontSize);
-    }
-  }
-  if (!fontName) {
-    fontName = new GString("Courier");
-  }
-
   //--- compute the embedded text type position
   doText = gTrue;
   yText = yBarcode = hBarcode = 0;
@@ -1631,6 +1746,11 @@
 
   //--- draw the bar code
   if (!barcodeType->cmp("code3Of9")) {
+    if (!dataLength) {
+      error(errSyntaxError, -1,
+	    "Missing 'dataLength' attribute in XFA barcode field");
+      goto err;
+    }
     appearBuf->append("0 g\n");
     wNarrow = w / ((7 + 3 * wideNarrowRatio) * (dataLength + 2));
     xx = 0;
@@ -1652,6 +1772,11 @@
     // center the text on the drawn barcode (not the max length barcode)
     wText = (value2->getLength() + 2) * (7 + 3 * wideNarrowRatio) * wNarrow;
   } else if (!barcodeType->cmp("code128B")) {
+    if (!dataLength) {
+      error(errSyntaxError, -1,
+	    "Missing 'dataLength' attribute in XFA barcode field");
+      goto err;
+    }
     appearBuf->append("0 g\n");
     wNarrow = w / (11 * (dataLength + 3) + 2);
     xx = 0;
@@ -1688,9 +1813,14 @@
 		       xx, yBarcode, 2 * wNarrow, hBarcode);
     // center the text on the drawn barcode (not the max length barcode)
     wText = (11 * (value2->getLength() + 3) + 2) * wNarrow;
+  } else if (!barcodeType->cmp("pdf417")) {
+    drawPDF417Barcode(w, h, moduleWidth, moduleHeight, errorCorrectionLevel,
+		      value2, appearBuf);
+    doText = gFalse;
   } else {
     error(errSyntaxError, -1,
-	  "Unimplemented barcode type in XFA barcode field");
+	  "Unimplemented barcode type '{0:t}' in XFA barcode field",
+	  barcodeType);
   }
   //~ add other barcode types here
 
@@ -1702,6 +1832,8 @@
 	     xfaHAlignCenter, textAlign, 0, yText, wText, h, gTrue,
 	     fontDict, appearBuf);
   }
+
+ err:
   delete fontName;
   delete value2;
 }
@@ -2011,11 +2143,11 @@
 	c = text->getChar(i) & 0xff;
 	if (c == '(' || c == ')' || c == '\\') {
 	  appearBuf->append('\\');
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	} else if (c < 0x20 || c >= 0x80) {
 	  appearBuf->appendf("\\{0:03o}", c);
 	} else {
-	  appearBuf->append(c);
+	  appearBuf->append((char)c);
 	}
       }
       appearBuf->append(") Tj\n");
@@ -2066,7 +2198,7 @@
     for (i = 0; i < text->getLength(); ++i) {
       c = text->getChar(i) & 0xff;
       if (font && !font->isCIDFont()) {
-	charWidth = fontSize * ((Gfx8BitFont *)font)->getWidth(c);
+	charWidth = fontSize * ((Gfx8BitFont *)font)->getWidth((Guchar)c);
 	appearBuf->appendf("1 0 0 1 {0:.4f} {1:.4f} Tm\n",
 			   xx + i * tw + 0.5 * (tw - charWidth), yy);
       } else {
@@ -2076,11 +2208,11 @@
       appearBuf->append('(');
       if (c == '(' || c == ')' || c == '\\') {
 	appearBuf->append('\\');
-	appearBuf->append(c);
+	appearBuf->append((char)c);
       } else if (c < 0x20 || c >= 0x80) {
 	appearBuf->appendf("{0:.4f} 0 Td\n", w);
       } else {
-	appearBuf->append(c);
+	appearBuf->append((char)c);
       }
       appearBuf->append(") Tj\n");
     }
@@ -2136,11 +2268,11 @@
       c = text->getChar(i) & 0xff;
       if (c == '(' || c == ')' || c == '\\') {
 	appearBuf->append('\\');
-	appearBuf->append(c);
+	appearBuf->append((char)c);
       } else if (c < 0x20 || c >= 0x80) {
 	appearBuf->appendf("\\{0:03o}", c);
       } else {
-	appearBuf->append(c);
+	appearBuf->append((char)c);
       }
     }
     appearBuf->append(") Tj\n");
@@ -2322,7 +2454,7 @@
       break;
     }
     if (font && !font->isCIDFont()) {
-      dw = ((Gfx8BitFont *)font)->getWidth(c) * fontSize;
+      dw = ((Gfx8BitFont *)font)->getWidth((Guchar)c) * fontSize;
     } else {
       // otherwise, make a crude estimate
       dw = 0.5 * fontSize;

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XFAForm.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -58,13 +58,24 @@
 
   XFAForm(PDFDoc *docA, int nPagesA, ZxDoc *xmlA,
 	  Object *resourceDictA, GBool fullXFAA);
-  void scanNamedNode(ZxElement *elem, GString *name, GString *fullName,
-		     GBool inPageSet, XFATableInfo *tableInfo);
+  void scanNode(ZxElement *elem,
+		GString *parentName, GString *parentFullName,
+		GBool inPageSet, XFATableInfo *tableInfo,
+		GHash *nameCount, GHash *nameIdx,
+		GHash *fullNameCount, GHash *fullNameIdx,
+		Catalog *catalog);
   void scanNames(ZxElement *elem, GHash *nameCount);
-  void scanFields(ZxElement *elem, GString *parentName,
-		  GString *parentFullName, GBool inPageSet,
-		  XFATableInfo *tableInfo,
-		  GHash *siblingNameCount, GHash *siblingNameIdx);
+  void scanFullNames(ZxElement *elem, GHash *fullNameCount);
+  void scanField(ZxElement *elem, GString *name, GString *fullName,
+		 GBool inPageSet,
+		 XFATableInfo *tableInfo, int colSpan,
+		 Catalog *catalog);
+  void scanNonField(ZxElement *elem, GString *name, GString *fullName,
+		    GBool inPageSet,
+		    XFATableInfo *tableInfo, int colSpan,
+		    GHash *nameCount, GHash *nameIdx,
+		    GHash *fullNameCount, GHash *fullNameIdx,
+		    Catalog *catalog);
   GString *getNodeName(ZxElement *elem);
   GString *getNodeFullName(ZxElement *elem);
   GBool nodeIsBindGlobal(ZxElement *elem);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -237,8 +237,8 @@
   // skip to the first object - this shouldn't be necessary because
   // the First key is supposed to be equal to offsets[0], but just in
   // case...
-  if (i < offsets[0]) {
-    objStr.getStream()->discardChars(offsets[0] - i);
+  if (first < offsets[0]) {
+    objStr.getStream()->discardChars(offsets[0] - first);
   }
 
   // parse the objects
@@ -309,7 +309,10 @@
   streamEndsLen = 0;
   for (i = 0; i < objStrCacheSize; ++i) {
     objStrs[i] = NULL;
+    objStrLastUse[i] = 0;
   }
+  objStrCacheLength = 0;
+  objStrTime = 0;
 
   encrypted = gFalse;
   permFlags = defPermFlags;
@@ -443,6 +446,13 @@
   char buf[100];
   int n, i;
 
+  // check for a loop in the xref tables
+  if (posSet->check(*pos)) {
+    error(errSyntaxWarning, -1, "Infinite loop in xref table");
+    return gFalse;
+  }
+  posSet->add(*pos);
+
   // the xref data should either be "xref ..." (for an xref table) or
   // "nn gg obj << ... >> stream ..." (for an xref stream); possibly
   // preceded by whitespace
@@ -505,12 +515,6 @@
   GBool more;
   int first, n, newSize, gen, i, c;
 
-  if (posSet->check(*pos)) {
-    error(errSyntaxWarning, -1, "Infinite loop in xref table");
-    return gFalse;
-  }
-  posSet->add(*pos);
-
   str->setPos(start + *pos + offset);
 
   while (1) {
@@ -714,9 +718,9 @@
     obj2.free();
   }
   obj.free();
-  if (w[0] < 0 || w[0] > 4 ||
-      w[1] < 0 || w[1] > (int)sizeof(GFileOffset) ||
-      w[2] < 0 || w[2] > 4) {
+  if (w[0] < 0 || w[0] > 8 ||
+      w[1] < 0 || w[1] > 8 ||
+      w[2] < 0 || w[2] > 8) {
     goto err0;
   }
 
@@ -773,8 +777,8 @@
 }
 
 GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) {
-  GFileOffset offset;
-  int type, gen, c, newSize, i, j;
+  long long type, gen, offset;
+  int c, newSize, i, j;
 
   if (first + n < 0) {
     return gFalse;
@@ -810,6 +814,9 @@
       }
       offset = (offset << 8) + c;
     }
+    if (offset < 0 || offset > GFILEOFFSET_MAX) {
+      return gFalse;
+    }
     for (gen = 0, j = 0; j < w[2]; ++j) {
       if ((c = xrefStr->getChar()) == EOF) {
 	return gFalse;
@@ -816,21 +823,24 @@
       }
       gen = (gen << 8) + c;
     }
+    if (gen < 0 || gen > INT_MAX) {
+      return gFalse;
+    }
     if (entries[i].offset == (GFileOffset)-1) {
       switch (type) {
       case 0:
-	entries[i].offset = offset;
-	entries[i].gen = gen;
+	entries[i].offset = (GFileOffset)offset;
+	entries[i].gen = (int)gen;
 	entries[i].type = xrefEntryFree;
 	break;
       case 1:
-	entries[i].offset = offset;
-	entries[i].gen = gen;
+	entries[i].offset = (GFileOffset)offset;
+	entries[i].gen = (int)gen;
 	entries[i].type = xrefEntryUncompressed;
 	break;
       case 2:
-	entries[i].offset = offset;
-	entries[i].gen = gen;
+	entries[i].offset = (GFileOffset)offset;
+	entries[i].gen = (int)gen;
 	entries[i].type = xrefEntryCompressed;
 	break;
       default:
@@ -1136,7 +1146,7 @@
 }
 
 GBool XRef::getObjectStreamObject(int objStrNum, int objIdx,
-				   int objNum, Object *obj) {
+				  int objNum, Object *obj) {
   ObjectStream *objStr;
 
 #if MULTITHREADED
@@ -1145,6 +1155,7 @@
   if (!(objStr = getObjectStream(objStrNum))) {
     return gFalse;
   }
+  cleanObjectStreamCache();
   objStr->getObject(objIdx, objNum, obj);
 #if MULTITHREADED
   gUnlockMutex(&objStrsMutex);
@@ -1160,17 +1171,20 @@
   // check the MRU entry in the cache
   if (objStrs[0] && objStrs[0]->getObjStrNum() == objStrNum) {
     objStr = objStrs[0];
+    objStrLastUse[0] = objStrTime++;
     return objStr;
   }
 
   // check the rest of the cache
-  for (i = 1; i < objStrCacheSize; ++i) {
+  for (i = 1; i < objStrCacheLength; ++i) {
     if (objStrs[i] && objStrs[i]->getObjStrNum() == objStrNum) {
       objStr = objStrs[i];
       for (j = i; j > 0; --j) {
 	objStrs[j] = objStrs[j - 1];
+	objStrLastUse[j] = objStrLastUse[j - 1];
       }
       objStrs[0] = objStr;
+      objStrLastUse[0] = objStrTime++;
       return objStr;
     }
   }
@@ -1183,17 +1197,38 @@
   }
 
   // add to the cache
-  if (objStrs[objStrCacheSize - 1]) {
+  if (objStrCacheLength == objStrCacheSize) {
     delete objStrs[objStrCacheSize - 1];
+    --objStrCacheLength;
   }
-  for (j = objStrCacheSize - 1; j > 0; --j) {
+  for (j = objStrCacheLength; j > 0; --j) {
     objStrs[j] = objStrs[j - 1];
+    objStrLastUse[j] = objStrLastUse[j - 1];
   }
+  ++objStrCacheLength;
   objStrs[0] = objStr;
+  objStrLastUse[0] = objStrTime++;
 
   return objStr;
 }
 
+// If the oldest (least recently used) entry in the object stream
+// cache is more than objStrCacheTimeout accesses old (hasn't been
+// used in the last objStrCacheTimeout accesses), eject it from the
+// cache.
+void XRef::cleanObjectStreamCache() {
+  // NB: objStrTime and objStrLastUse[] are unsigned ints, so the
+  // mod-2^32 arithmetic makes the subtraction work out, even if the
+  // time wraps around.
+  if (objStrCacheLength > 1 &&
+      objStrTime - objStrLastUse[objStrCacheLength - 1]
+        > objStrCacheTimeout) {
+    delete objStrs[objStrCacheLength - 1];
+    objStrs[objStrCacheLength - 1] = NULL;
+    --objStrCacheLength;
+  }
+}
+
 Object *XRef::getDocInfo(Object *obj) {
   return trailerDict.dictLookup("Info", obj);
 }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/XRef.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -52,7 +52,8 @@
 
 #define xrefCacheSize 16
 
-#define objStrCacheSize 4
+#define objStrCacheSize 128
+#define objStrCacheTimeout 1000
 
 class XRef {
 public:
@@ -144,6 +145,10 @@
   int streamEndsLen;		// number of valid entries in streamEnds
   ObjectStream *		// cached object streams
     objStrs[objStrCacheSize];
+  int objStrCacheLength;	// number of valid entries in objStrs[]
+  Guint				// time of last use for each obj stream
+    objStrLastUse[objStrCacheSize];
+  Guint objStrTime;		// current time for the obj stream cache
 #if MULTITHREADED
   GMutex objStrsMutex;
 #endif
@@ -169,6 +174,7 @@
   GBool getObjectStreamObject(int objStrNum, int objIdx,
 			      int objNum, Object *obj);
   ObjectStream *getObjectStream(int objStrNum);
+  void cleanObjectStreamCache();
   GFileOffset strToFileOffset(char *s);
 };
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/config.h	2019-02-25 03:01:12 UTC (rev 50122)
@@ -2,7 +2,7 @@
 //
 // config.h
 //
-// Copyright 1996-2017 Glyph & Cog, LLC
+// Copyright 1996-2019 Glyph & Cog, LLC
 //
 //========================================================================
 
@@ -14,25 +14,25 @@
 //------------------------------------------------------------------------
 
 // xpdf version
-#define xpdfVersion          "4.00"
-#define xpdfVersionNum       4.00
+#define xpdfVersion          "4.01"
+#define xpdfVersionNum       4.01
 #define xpdfMajorVersion     4
-#define xpdfMinorVersion     0
+#define xpdfMinorVersion     1
 #define xpdfUpdateVersion    0
 #define xpdfMajorVersionStr  "4"
-#define xpdfMinorVersionStr  "0"
+#define xpdfMinorVersionStr  "1"
 #define xpdfUpdateVersionStr "0"
 
 // supported PDF version
-#define supportedPDFVersionStr "1.7"
-#define supportedPDFVersionNum 1.7
+#define supportedPDFVersionStr "2.0"
+#define supportedPDFVersionNum 2.0
 
 // copyright notice
-#define xpdfCopyright "Copyright 1996-2017 Glyph & Cog, LLC"
+#define xpdfCopyright "Copyright 1996-2019 Glyph & Cog, LLC"
 
 // Windows resource file stuff
-#define winxpdfVersion "WinXpdf 4.00"
-#define xpdfCopyrightAmp "Copyright 1996-2017 Glyph && Cog, LLC"
+#define winxpdfVersion "WinXpdf 4.01"
+#define xpdfCopyrightAmp "Copyright 1996-2019 Glyph && Cog, LLC"
 
 //------------------------------------------------------------------------
 // paper size

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfdetach.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -61,7 +61,7 @@
 };
 
 int main(int argc, char *argv[]) {
-  GString *fileName;
+  char *fileName;
   UnicodeMap *uMap;
   GString *ownerPW, *userPW;
   PDFDoc *doc;
@@ -76,6 +76,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if ((doList ? 1 : 0) +
       ((saveNum != 0) ? 1 : 0) +
@@ -90,7 +91,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
 
   // read config file
   globalParams = new GlobalParams(cfgFileName);
@@ -101,7 +102,6 @@
   // get mapping to output encoding
   if (!(uMap = globalParams->getTextEncoding())) {
     error(errConfig, -1, "Couldn't get text encoding");
-    delete fileName;
     goto err1;
   }
 

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdffonts.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -95,7 +95,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   GString *ownerPW, *userPW;
   GBool ok;
   Page *page;
@@ -109,6 +109,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (!ok || argc != 2 || printVersion || printHelp) {
     fprintf(stderr, "pdffonts version %s\n", xpdfVersion);
@@ -118,7 +119,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
 
   // read config file
   globalParams = new GlobalParams(cfgFileName);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfimages.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -74,7 +74,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   char *imgRoot;
   GString *ownerPW, *userPW;
   ImageOutputDev *imgOut;
@@ -84,6 +84,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (!ok || argc != 3 || printVersion || printHelp) {
     fprintf(stderr, "pdfimages version %s\n", xpdfVersion);
@@ -93,7 +94,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
   imgRoot = argv[2];
 
   // read config file

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdfinfo.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -13,6 +13,7 @@
 #include <string.h>
 #include <time.h>
 #include <math.h>
+#include <ctype.h>
 #include "gmem.h"
 #include "gmempp.h"
 #include "parseargs.h"
@@ -30,12 +31,18 @@
 #include "CharTypes.h"
 #include "UnicodeMap.h"
 #include "TextString.h"
+#include "UTF8.h"
+#include "Zoox.h"
 #include "Error.h"
 #include "config.h"
 
-static void printInfoString(Dict *infoDict, const char *key, const char *text,
+static void printInfoString(Object *infoDict, const char *infoKey,
+			    ZxDoc *xmp, const char *xmpKey1,
+			    const char *xmpKey2,
+			    const char *text, GBool parseDate,
 			    UnicodeMap *uMap);
-static void printInfoDate(Dict *infoDict, const char *key, const char *text);
+static GString *parseInfoDate(GString *s);
+static GString *parseXMPDate(GString *s);
 static void printBox(const char *text, PDFRectangle *box);
 
 static int firstPage = 1;
@@ -84,7 +91,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   GString *ownerPW, *userPW;
   UnicodeMap *uMap;
   Page *page;
@@ -94,6 +101,7 @@
   double w, h, wISO, hISO;
   FILE *f;
   GString *metadata;
+  ZxDoc *xmp;
   GBool ok;
   int exitCode;
   int pg, i;
@@ -102,6 +110,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (!ok || argc != 2 || printVersion || printHelp) {
     fprintf(stderr, "pdfinfo version %s\n", xpdfVersion);
@@ -111,7 +120,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
 
   // read config file
   globalParams = new GlobalParams(cfgFileName);
@@ -122,7 +131,6 @@
   // get mapping to output encoding
   if (!(uMap = globalParams->getTextEncoding())) {
     error(errConfig, -1, "Couldn't get text encoding");
-    delete fileName;
     goto err1;
   }
 
@@ -165,24 +173,23 @@
 
   // print doc info
   doc->getDocInfo(&info);
-  if (info.isDict()) {
-    printInfoString(info.getDict(), "Title",        "Title:          ", uMap);
-    printInfoString(info.getDict(), "Subject",      "Subject:        ", uMap);
-    printInfoString(info.getDict(), "Keywords",     "Keywords:       ", uMap);
-    printInfoString(info.getDict(), "Author",       "Author:         ", uMap);
-    printInfoString(info.getDict(), "Creator",      "Creator:        ", uMap);
-    printInfoString(info.getDict(), "Producer",     "Producer:       ", uMap);
-    if (rawDates) {
-      printInfoString(info.getDict(), "CreationDate", "CreationDate:   ",
-		      uMap);
-      printInfoString(info.getDict(), "ModDate",      "ModDate:        ",
-		      uMap);
-    } else {
-      printInfoDate(info.getDict(),   "CreationDate", "CreationDate:   ");
-      printInfoDate(info.getDict(),   "ModDate",      "ModDate:        ");
-    }
+  if ((metadata = doc->readMetadata())) {
+    xmp = ZxDoc::loadMem(metadata->getCString(), metadata->getLength());
+  } else {
+    xmp = NULL;
   }
+  printInfoString(&info, "Title",        xmp, "dc:title",        NULL,              "Title:          ", gFalse,    uMap);
+  printInfoString(&info, "Subject",      xmp, "dc:description",  NULL,              "Subject:        ", gFalse,    uMap);
+  printInfoString(&info, "Keywords",     xmp, "pdf:Keywords",    NULL,              "Keywords:       ", gFalse,    uMap);
+  printInfoString(&info, "Author",       xmp, "dc:creator",      NULL,              "Author:         ", gFalse,    uMap);
+  printInfoString(&info, "Creator",      xmp, "xmp:CreatorTool", NULL,              "Creator:        ", gFalse,    uMap);
+  printInfoString(&info, "Producer",     xmp, "pdf:Producer",    NULL,              "Producer:       ", gFalse,    uMap);
+  printInfoString(&info, "CreationDate", xmp, "xap:CreateDate",  "xmp:CreateDate",  "CreationDate:   ", !rawDates, uMap);
+  printInfoString(&info, "ModDate",      xmp, "xap:ModifyDate",  "xmp:ModifyDate",  "ModDate:        ", !rawDates, uMap);
   info.free();
+  if (xmp) {
+    delete xmp;
+  }
 
   // print tagging info
   printf("Tagged:         %s\n",
@@ -276,11 +283,7 @@
   }
 
   // print file size
-#ifdef VMS
-  f = fopen(fileName->getCString(), "rb", "ctx=stm");
-#else
-  f = fopen(fileName->getCString(), "rb");
-#endif
+  f = openFile(fileName, "rb");
   if (f) {
     gfseek(f, 0, SEEK_END);
     printf("File size:      %u bytes\n", (Guint)gftell(f));
@@ -294,10 +297,13 @@
   printf("PDF version:    %.1f\n", doc->getPDFVersion());
 
   // print the metadata
-  if (printMetadata && (metadata = doc->readMetadata())) {
+  if (printMetadata && metadata) {
     fputs("Metadata:\n", stdout);
     fputs(metadata->getCString(), stdout);
     fputc('\n', stdout);
+  }
+
+  if (metadata) {
     delete metadata;
   }
 
@@ -318,72 +324,218 @@
   return exitCode;
 }
 
-static void printInfoString(Dict *infoDict, const char *key, const char *text,
+static void printInfoString(Object *infoDict, const char *infoKey,
+			    ZxDoc *xmp, const char *xmpKey1,
+			    const char *xmpKey2,
+			    const char *text, GBool parseDate,
 			    UnicodeMap *uMap) {
   Object obj;
   TextString *s;
   Unicode *u;
+  Unicode uu;
   char buf[8];
+  GString *value, *tmp;
+  ZxElement *rdf, *elem, *child;
+  ZxNode *node, *node2;
   int i, n;
 
-  if (infoDict->lookup(key, &obj)->isString()) {
+  value = NULL;
+
+  //-- check the info dictionary
+  if (infoDict->isDict()) {
+    if (infoDict->dictLookup(infoKey, &obj)->isString()) {
+      if (!parseDate || !(value = parseInfoDate(obj.getString()))) {
+	s = new TextString(obj.getString());
+	u = s->getUnicode();
+	value = new GString();
+	for (i = 0; i < s->getLength(); ++i) {
+	  n = uMap->mapUnicode(u[i], buf, sizeof(buf));
+	  value->append(buf, n);
+	}
+	delete s;
+      }
+    }
+    obj.free();
+  }
+
+  //-- check the XMP metadata
+  if (xmp) {
+    rdf = xmp->getRoot();
+    if (rdf->isElement("x:xmpmeta")) {
+      rdf = rdf->findFirstChildElement("rdf:RDF");
+    }
+    if (rdf && rdf->isElement("rdf:RDF")) {
+      for (node = rdf->getFirstChild(); node; node = node->getNextChild()) {
+	if (node->isElement("rdf:Description")) {
+	  if (!(elem = node->findFirstChildElement(xmpKey1)) && xmpKey2) {
+	    elem = node->findFirstChildElement(xmpKey2);
+	  }
+	  if (elem) {
+	    if ((child = elem->findFirstChildElement("rdf:Alt")) ||
+		(child = elem->findFirstChildElement("rdf:Seq"))) {
+	      if ((node2 = child->findFirstChildElement("rdf:li"))) {
+		node2 = node2->getFirstChild();
+	      }
+	    } else {
+	      node2 = elem->getFirstChild();
+	    }
+	    if (node2 && node2->isCharData()) {
+	      if (value) {
+		delete value;
+	      }
+	      if (!parseDate ||
+		  !(value = parseXMPDate(((ZxCharData *)node2)->getData()))) {
+		tmp = ((ZxCharData *)node2)->getData();
+		int i = 0;
+		value = new GString();
+		while (getUTF8(tmp, &i, &uu)) {
+		  n = uMap->mapUnicode(uu, buf, sizeof(buf));
+		  value->append(buf, n);
+		}
+	      }
+	    }
+	    break;
+	  }
+	}
+      }
+    }
+  }
+
+  if (value) {
     fputs(text, stdout);
-    s = new TextString(obj.getString());
-    u = s->getUnicode();
-    for (i = 0; i < s->getLength(); ++i) {
-      n = uMap->mapUnicode(u[i], buf, sizeof(buf));
-      fwrite(buf, 1, n, stdout);
-    }
+    fwrite(value->getCString(), 1, value->getLength(), stdout);
     fputc('\n', stdout);
-    delete s;
+    delete value;
   }
-  obj.free();
 }
 
-static void printInfoDate(Dict *infoDict, const char *key, const char *text) {
-  Object obj;
-  char *s;
+static GString *parseInfoDate(GString *s) {
   int year, mon, day, hour, min, sec, n;
   struct tm tmStruct;
   char buf[256];
+  char *p;
 
-  if (infoDict->lookup(key, &obj)->isString()) {
-    fputs(text, stdout);
-    s = obj.getString()->getCString();
-    if (s[0] == 'D' && s[1] == ':') {
-      s += 2;
-    }
-    if ((n = sscanf(s, "%4d%2d%2d%2d%2d%2d",
-		    &year, &mon, &day, &hour, &min, &sec)) >= 1) {
-      switch (n) {
-      case 1: mon = 1;
-      case 2: day = 1;
-      case 3: hour = 0;
-      case 4: min = 0;
-      case 5: sec = 0;
+  p = s->getCString();
+  if (p[0] == 'D' && p[1] == ':') {
+    p += 2;
+  }
+  if ((n = sscanf(p, "%4d%2d%2d%2d%2d%2d",
+		  &year, &mon, &day, &hour, &min, &sec)) < 1) {
+    return NULL;
+  }
+  switch (n) {
+  case 1: mon = 1;
+  case 2: day = 1;
+  case 3: hour = 0;
+  case 4: min = 0;
+  case 5: sec = 0;
+  }
+  tmStruct.tm_year = year - 1900;
+  tmStruct.tm_mon = mon - 1;
+  tmStruct.tm_mday = day;
+  tmStruct.tm_hour = hour;
+  tmStruct.tm_min = min;
+  tmStruct.tm_sec = sec;
+  tmStruct.tm_wday = -1;
+  tmStruct.tm_yday = -1;
+  tmStruct.tm_isdst = -1;
+  // compute the tm_wday and tm_yday fields
+  if (!(mktime(&tmStruct) != (time_t)-1 &&
+	strftime(buf, sizeof(buf), "%c", &tmStruct))) {
+    return NULL;
+  }
+  return new GString(buf);
+}
+
+static GString *parseXMPDate(GString *s) {
+  int year, mon, day, hour, min, sec, tz;
+  struct tm tmStruct;
+  char buf[256];
+  char *p;
+
+  p = s->getCString();
+  if (isdigit(p[0]) && isdigit(p[1]) && isdigit(p[2]) && isdigit(p[3])) {
+    buf[0] = p[0];
+    buf[1] = p[1];
+    buf[2] = p[2];
+    buf[3] = p[3];
+    buf[4] = '\0';
+    year = atoi(buf);
+    p += 4;
+  } else {
+    return NULL;
+  }
+  mon = day = 1;
+  hour = min = sec = 0;
+  tz = 2000;
+  if (p[0] == '-' && isdigit(p[1]) && isdigit(p[2])) {
+    buf[0] = p[1];
+    buf[1] = p[2];
+    buf[2] = '\0';
+    mon = atoi(buf);
+    p += 3;
+    if (p[0] == '-' && isdigit(p[1]) && isdigit(p[2])) {
+      buf[0] = p[1];
+      buf[1] = p[2];
+      buf[2] = '\0';
+      day = atoi(buf);
+      p += 3;
+      if (p[0] == 'T' && isdigit(p[1]) && isdigit(p[2]) &&
+	  p[3] == ':' && isdigit(p[4]) && isdigit(p[5])) {
+	buf[0] = p[1];
+	buf[1] = p[2];
+	buf[2] = '\0';
+	hour = atoi(buf);
+	buf[0] = p[4];
+	buf[1] = p[5];
+	buf[2] = '\0';
+	min = atoi(buf);
+	p += 6;
+	if (p[0] == ':' && isdigit(p[1]) && isdigit(p[2])) {
+	  buf[0] = p[1];
+	  buf[1] = p[2];
+	  buf[2] = '\0';
+	  sec = atoi(buf);
+	  if (p[0] == '.' && isdigit(p[1])) {
+	    p += 2;
+	  }
+	}
+	if ((p[0] == '+' || p[0] == '-') &&
+	    isdigit(p[1]) && isdigit(p[2]) && p[3] == ':' &&
+	    isdigit(p[4]) && isdigit(p[5])) {
+	  buf[0] = p[1];
+	  buf[1] = p[2];
+	  buf[2] = '\0';
+	  tz = atoi(buf);
+	  buf[0] = p[4];
+	  buf[1] = p[5];
+	  buf[2] = '\0';
+	  tz = tz * 60 + atoi(buf);
+	  tz = tz * 60;
+	  if (p[0] == '-') {
+	    tz = -tz;
+	  }
+	}
       }
-      tmStruct.tm_year = year - 1900;
-      tmStruct.tm_mon = mon - 1;
-      tmStruct.tm_mday = day;
-      tmStruct.tm_hour = hour;
-      tmStruct.tm_min = min;
-      tmStruct.tm_sec = sec;
-      tmStruct.tm_wday = -1;
-      tmStruct.tm_yday = -1;
-      tmStruct.tm_isdst = -1;
-      // compute the tm_wday and tm_yday fields
-      if (mktime(&tmStruct) != (time_t)-1 &&
-	  strftime(buf, sizeof(buf), "%c", &tmStruct)) {
-	fputs(buf, stdout);
-      } else {
-	fputs(s, stdout);
-      }
-    } else {
-      fputs(s, stdout);
     }
-    fputc('\n', stdout);
   }
-  obj.free();
+
+  tmStruct.tm_year = year - 1900;
+  tmStruct.tm_mon = mon - 1;
+  tmStruct.tm_mday = day;
+  tmStruct.tm_hour = hour;
+  tmStruct.tm_min = min;
+  tmStruct.tm_sec = sec;
+  tmStruct.tm_wday = -1;
+  tmStruct.tm_yday = -1;
+  tmStruct.tm_isdst = -1;
+  // compute the tm_wday and tm_yday fields
+  //~ this ignores the timezone
+  if (!(mktime(&tmStruct) != (time_t)-1 &&
+	strftime(buf, sizeof(buf), "%c", &tmStruct))) {
+    return NULL;
+  }
+  return new GString(buf);
 }
 
 static void printBox(const char *text, PDFRectangle *box) {

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftohtml.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -82,7 +82,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   char *htmlDir;
   GString *ownerPW, *userPW;
   HTMLGen *htmlGen;
@@ -94,6 +94,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (!ok || argc != 3 || printVersion || printHelp) {
     fprintf(stderr, "pdftohtml version %s\n", xpdfVersion);
@@ -103,7 +104,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
   htmlDir = argv[2];
 
   // read config file

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftopng.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -92,7 +92,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   char *pngRoot;
   GString *pngFile;
   GString *ownerPW, *userPW;
@@ -108,6 +108,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (mono && gray) {
     fprintf(stderr, "Specify one of -mono or -gray\n");
@@ -125,7 +126,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
   pngRoot = argv[2];
 
   // read config file

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftoppm.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -92,7 +92,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   char *ppmRoot;
   GString *ppmFile;
   GString *ownerPW, *userPW;
@@ -114,7 +114,7 @@
   // more info)
   fpu_control_t cw;
   _FPU_GETCW(cw);
-  cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
+  cw = (fpu_control_t)((cw & ~_FPU_EXTENDED) | _FPU_DOUBLE);
   _FPU_SETCW(cw);
 #endif
 
@@ -121,6 +121,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   n = 0;
   n += mono ? 1 : 0;
@@ -139,7 +140,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
   ppmRoot = argv[2];
 
   // read config file
@@ -218,7 +219,7 @@
   } else if (cmyk) {
     paperColor[0] = paperColor[1] = paperColor[2] = paperColor[3] = 0;
     splashOut = new SplashOutputDev(splashModeCMYK8, 1, gFalse, paperColor);
-#endif
+#endif // SPLASH_CMYK
   } else {
     paperColor[0] = paperColor[1] = paperColor[2] = 0xff;
     splashOut = new SplashOutputDev(splashModeRGB8, 1, gFalse, paperColor);

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftops.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -44,7 +44,6 @@
 static GBool level3Sep = gFalse;
 static GBool doEPS = gFalse;
 static GBool doForm = gFalse;
-static GBool forceMono = gFalse;
 #if OPI_SUPPORT
 static GBool doOPI = gFalse;
 #endif
@@ -95,8 +94,6 @@
    "generate Encapsulated PostScript (EPS)"},
   {"-form",       argFlag,     &doForm,         0,
    "generate a PostScript form"},
-  {"-mono",       argFlag,     &forceMono,      0,
-   "force monochrome (grayscale) output"},
 #if OPI_SUPPORT
   {"-opi",        argFlag,     &doOPI,          0,
    "generate OPI comments"},
@@ -154,7 +151,7 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   GString *psFileName;
   PSLevel level;
   PSOutMode mode;
@@ -175,7 +172,7 @@
   // more info)
   fpu_control_t cw;
   _FPU_GETCW(cw);
-  cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
+  cw = (fpu_control_t)((cw & ~_FPU_EXTENDED) | _FPU_DOUBLE);
   _FPU_SETCW(cw);
 #endif
 
@@ -182,6 +179,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (!ok || argc < 2 || argc > 3 || printVersion || printHelp) {
     fprintf(stderr, "pdftops version %s\n", xpdfVersion);
@@ -230,7 +228,7 @@
   mode = doEPS ? psModeEPS
                : doForm ? psModeForm
                         : psModePS;
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
 
   // read config file
   globalParams = new GlobalParams(cfgFileName);
@@ -240,7 +238,6 @@
   if (paperSize[0]) {
     if (!globalParams->setPSPaperSize(paperSize)) {
       fprintf(stderr, "Invalid paper size\n");
-      delete fileName;
       goto err0;
     }
   } else {
@@ -332,12 +329,11 @@
   if (argc == 3) {
     psFileName = new GString(argv[2]);
   } else {
-    p = fileName->getCString() + fileName->getLength() - 4;
-    if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
-      psFileName = new GString(fileName->getCString(),
-			       fileName->getLength() - 4);
+    p = fileName + strlen(fileName) - 4;
+    if (strlen(fileName) > 4 && (!strcmp(p, ".pdf") || !strcmp(p, ".PDF"))) {
+      psFileName = new GString(fileName, (int)strlen(fileName) - 4);
     } else {
-      psFileName = fileName->copy();
+      psFileName = new GString(fileName);
     }
     psFileName->append(doEPS ? ".eps" : ".ps");
   }

Modified: trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc
===================================================================
--- trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc	2019-02-25 01:23:42 UTC (rev 50121)
+++ trunk/Build/source/libs/xpdf/xpdf-src/xpdf/pdftotext.cc	2019-02-25 03:01:12 UTC (rev 50122)
@@ -111,13 +111,12 @@
 
 int main(int argc, char *argv[]) {
   PDFDoc *doc;
-  GString *fileName;
+  char *fileName;
   GString *textFileName;
   GString *ownerPW, *userPW;
   TextOutputControl textOutControl;
   TextOutputDev *textOut;
   UnicodeMap *uMap;
-  Object info;
   GBool ok;
   char *p;
   int exitCode;
@@ -133,7 +132,7 @@
   // more info)
   fpu_control_t cw;
   _FPU_GETCW(cw);
-  cw = (cw & ~_FPU_EXTENDED) | _FPU_DOUBLE;
+  cw = (fpu_control_t)((cw & ~_FPU_EXTENDED) | _FPU_DOUBLE);
   _FPU_SETCW(cw);
 #endif
 
@@ -140,6 +139,7 @@
   exitCode = 99;
 
   // parse args
+  fixCommandLine(&argc, &argv);
   ok = parseArgs(argDesc, &argc, argv);
   if (!ok || argc < 2 || argc > 3 || printVersion || printHelp) {
     fprintf(stderr, "pdftotext version %s\n", xpdfVersion);
@@ -149,7 +149,7 @@
     }
     goto err0;
   }
-  fileName = new GString(argv[1]);
+  fileName = argv[1];
 
   // read config file
   globalParams = new GlobalParams(cfgFileName);
@@ -171,7 +171,6 @@
   // get mapping to output encoding
   if (!(uMap = globalParams->getTextEncoding())) {
     error(errConfig, -1, "Couldn't get text encoding");
-    delete fileName;
     goto err1;
   }
 
@@ -210,12 +209,11 @@
   if (argc == 3) {
     textFileName = new GString(argv[2]);
   } else {
-    p = fileName->getCString() + fileName->getLength() - 4;
-    if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
-      textFileName = new GString(fileName->getCString(),
-				 fileName->getLength() - 4);
+    p = fileName + strlen(fileName) - 4;
+    if (strlen(fileName) > 4 && (!strcmp(p, ".pdf") || !strcmp(p, ".PDF"))) {
+      textFileName = new GString(fileName, (int)strlen(fileName) - 4);
     } else {
-      textFileName = fileName->copy();
+      textFileName = new GString(fileName);
     }
     textFileName->append(".txt");
   }



More information about the tex-live-commits mailing list