From d9f9a6449f377b4c933b75d57541b19c6d088994 Mon Sep 17 00:00:00 2001 From: Arturo Espinosa Date: Sat, 17 Apr 1999 02:59:58 +0000 Subject: [PATCH] Initial revision --- pdf/goo/GString.cc | 196 + pdf/goo/GString.h | 92 + pdf/goo/Makefile.in | 69 + pdf/goo/gfile.cc | 455 + pdf/goo/gfile.h | 108 + pdf/goo/gmem.c | 182 + pdf/goo/gmem.h | 53 + pdf/goo/gmempp.cc | 23 + pdf/goo/gtypes.h | 29 + pdf/goo/makefile.w32 | 64 + pdf/goo/parseargs.c | 190 + pdf/goo/parseargs.h | 71 + pdf/goo/vms_directory.c | 214 + pdf/goo/vms_dirent.h | 67 + pdf/goo/vms_make.com | 26 + pdf/goo/vms_sys_dirent.h | 54 + pdf/goo/vms_unix_time.h | 102 + pdf/goo/vms_unix_times.c | 42 + pdf/goo/vms_unlink.c | 22 + pdf/xpdf/Array.cc | 51 + pdf/xpdf/Array.h | 53 + pdf/xpdf/CMapInfo.h | 15630 ++++++++++++++++++++++++++++++++ pdf/xpdf/Catalog.cc | 271 + pdf/xpdf/Catalog.h | 65 + pdf/xpdf/Dict.cc | 88 + pdf/xpdf/Dict.h | 69 + pdf/xpdf/Error.cc | 45 + pdf/xpdf/Error.h | 26 + pdf/xpdf/FontInfo.h | 2068 +++++ pdf/xpdf/Gfx.cc | 1573 ++++ pdf/xpdf/Gfx.h | 214 + pdf/xpdf/GfxFont.cc | 821 ++ pdf/xpdf/GfxFont.h | 245 + pdf/xpdf/GfxState.cc | 952 ++ pdf/xpdf/GfxState.h | 472 + pdf/xpdf/ImageOutputDev.cc | 151 + pdf/xpdf/ImageOutputDev.h | 67 + pdf/xpdf/LTKOutputDev.cc | 57 + pdf/xpdf/LTKOutputDev.h | 46 + pdf/xpdf/Lexer.cc | 453 + pdf/xpdf/Lexer.h | 72 + pdf/xpdf/Link.cc | 581 ++ pdf/xpdf/Link.h | 313 + pdf/xpdf/Makefile.in | 261 + pdf/xpdf/Object.cc | 217 + pdf/xpdf/Object.h | 299 + pdf/xpdf/OutputDev.cc | 85 + pdf/xpdf/OutputDev.h | 131 + pdf/xpdf/PBMOutputDev.cc | 141 + pdf/xpdf/PBMOutputDev.h | 56 + pdf/xpdf/PDFDoc.cc | 168 + pdf/xpdf/PDFDoc.h | 107 + pdf/xpdf/PSOutputDev.cc | 1132 +++ pdf/xpdf/PSOutputDev.h | 159 + pdf/xpdf/Page.cc | 214 + pdf/xpdf/Page.h | 110 + pdf/xpdf/Params.cc | 87 + pdf/xpdf/Params.h | 37 + pdf/xpdf/Parser.cc | 161 + pdf/xpdf/Parser.h | 51 + pdf/xpdf/Stream-CCITT.h | 403 + pdf/xpdf/Stream.cc | 2987 ++++++ pdf/xpdf/Stream.h | 661 ++ pdf/xpdf/TextOutputDev.cc | 628 ++ pdf/xpdf/TextOutputDev.h | 176 + pdf/xpdf/TextOutputFontInfo.h | 514 ++ pdf/xpdf/XOutputDev.cc | 2183 +++++ pdf/xpdf/XOutputDev.h | 284 + pdf/xpdf/XOutputFontInfo.h | 1142 +++ pdf/xpdf/XRef.cc | 443 + pdf/xpdf/XRef.h | 84 + pdf/xpdf/about.xbm | 6 + pdf/xpdf/dblLeftArrow.xbm | 6 + pdf/xpdf/dblRightArrow.xbm | 6 + pdf/xpdf/find.xbm | 6 + pdf/xpdf/leftArrow.xbm | 5 + pdf/xpdf/makefile.w32 | 171 + pdf/xpdf/pdfimages.cc | 100 + pdf/xpdf/pdfinfo.cc | 121 + pdf/xpdf/pdftopbm.cc | 100 + pdf/xpdf/pdftops.cc | 132 + pdf/xpdf/pdftotext.cc | 114 + pdf/xpdf/postscript.xbm | 6 + pdf/xpdf/rightArrow.xbm | 5 + pdf/xpdf/vms_make.com | 88 + pdf/xpdf/xpdf-flip.ltk | 253 + pdf/xpdf/xpdf-ltk.h | 241 + pdf/xpdf/xpdf-top.ltk | 252 + pdf/xpdf/xpdf.cc | 1736 ++++ pdf/xpdf/xpdf.ltk | 252 + pdf/xpdf/xpdfIcon.xpm | 58 + pdf/xpdf/xpdfconfig.h | 93 + pdf/xpdf/zoomIn.xbm | 6 + pdf/xpdf/zoomOut.xbm | 6 + 94 files changed, 43126 insertions(+) create mode 100644 pdf/goo/GString.cc create mode 100644 pdf/goo/GString.h create mode 100644 pdf/goo/Makefile.in create mode 100644 pdf/goo/gfile.cc create mode 100644 pdf/goo/gfile.h create mode 100644 pdf/goo/gmem.c create mode 100644 pdf/goo/gmem.h create mode 100644 pdf/goo/gmempp.cc create mode 100644 pdf/goo/gtypes.h create mode 100644 pdf/goo/makefile.w32 create mode 100644 pdf/goo/parseargs.c create mode 100644 pdf/goo/parseargs.h create mode 100644 pdf/goo/vms_directory.c create mode 100644 pdf/goo/vms_dirent.h create mode 100644 pdf/goo/vms_make.com create mode 100644 pdf/goo/vms_sys_dirent.h create mode 100644 pdf/goo/vms_unix_time.h create mode 100644 pdf/goo/vms_unix_times.c create mode 100644 pdf/goo/vms_unlink.c create mode 100644 pdf/xpdf/Array.cc create mode 100644 pdf/xpdf/Array.h create mode 100644 pdf/xpdf/CMapInfo.h create mode 100644 pdf/xpdf/Catalog.cc create mode 100644 pdf/xpdf/Catalog.h create mode 100644 pdf/xpdf/Dict.cc create mode 100644 pdf/xpdf/Dict.h create mode 100644 pdf/xpdf/Error.cc create mode 100644 pdf/xpdf/Error.h create mode 100644 pdf/xpdf/FontInfo.h create mode 100644 pdf/xpdf/Gfx.cc create mode 100644 pdf/xpdf/Gfx.h create mode 100644 pdf/xpdf/GfxFont.cc create mode 100644 pdf/xpdf/GfxFont.h create mode 100644 pdf/xpdf/GfxState.cc create mode 100644 pdf/xpdf/GfxState.h create mode 100644 pdf/xpdf/ImageOutputDev.cc create mode 100644 pdf/xpdf/ImageOutputDev.h create mode 100644 pdf/xpdf/LTKOutputDev.cc create mode 100644 pdf/xpdf/LTKOutputDev.h create mode 100644 pdf/xpdf/Lexer.cc create mode 100644 pdf/xpdf/Lexer.h create mode 100644 pdf/xpdf/Link.cc create mode 100644 pdf/xpdf/Link.h create mode 100644 pdf/xpdf/Makefile.in create mode 100644 pdf/xpdf/Object.cc create mode 100644 pdf/xpdf/Object.h create mode 100644 pdf/xpdf/OutputDev.cc create mode 100644 pdf/xpdf/OutputDev.h create mode 100644 pdf/xpdf/PBMOutputDev.cc create mode 100644 pdf/xpdf/PBMOutputDev.h create mode 100644 pdf/xpdf/PDFDoc.cc create mode 100644 pdf/xpdf/PDFDoc.h create mode 100644 pdf/xpdf/PSOutputDev.cc create mode 100644 pdf/xpdf/PSOutputDev.h create mode 100644 pdf/xpdf/Page.cc create mode 100644 pdf/xpdf/Page.h create mode 100644 pdf/xpdf/Params.cc create mode 100644 pdf/xpdf/Params.h create mode 100644 pdf/xpdf/Parser.cc create mode 100644 pdf/xpdf/Parser.h create mode 100644 pdf/xpdf/Stream-CCITT.h create mode 100644 pdf/xpdf/Stream.cc create mode 100644 pdf/xpdf/Stream.h create mode 100644 pdf/xpdf/TextOutputDev.cc create mode 100644 pdf/xpdf/TextOutputDev.h create mode 100644 pdf/xpdf/TextOutputFontInfo.h create mode 100644 pdf/xpdf/XOutputDev.cc create mode 100644 pdf/xpdf/XOutputDev.h create mode 100644 pdf/xpdf/XOutputFontInfo.h create mode 100644 pdf/xpdf/XRef.cc create mode 100644 pdf/xpdf/XRef.h create mode 100644 pdf/xpdf/about.xbm create mode 100644 pdf/xpdf/dblLeftArrow.xbm create mode 100644 pdf/xpdf/dblRightArrow.xbm create mode 100644 pdf/xpdf/find.xbm create mode 100644 pdf/xpdf/leftArrow.xbm create mode 100644 pdf/xpdf/makefile.w32 create mode 100644 pdf/xpdf/pdfimages.cc create mode 100644 pdf/xpdf/pdfinfo.cc create mode 100644 pdf/xpdf/pdftopbm.cc create mode 100644 pdf/xpdf/pdftops.cc create mode 100644 pdf/xpdf/pdftotext.cc create mode 100644 pdf/xpdf/postscript.xbm create mode 100644 pdf/xpdf/rightArrow.xbm create mode 100644 pdf/xpdf/vms_make.com create mode 100644 pdf/xpdf/xpdf-flip.ltk create mode 100644 pdf/xpdf/xpdf-ltk.h create mode 100644 pdf/xpdf/xpdf-top.ltk create mode 100644 pdf/xpdf/xpdf.cc create mode 100644 pdf/xpdf/xpdf.ltk create mode 100644 pdf/xpdf/xpdfIcon.xpm create mode 100644 pdf/xpdf/xpdfconfig.h create mode 100644 pdf/xpdf/zoomIn.xbm create mode 100644 pdf/xpdf/zoomOut.xbm diff --git a/pdf/goo/GString.cc b/pdf/goo/GString.cc new file mode 100644 index 00000000..e0890912 --- /dev/null +++ b/pdf/goo/GString.cc @@ -0,0 +1,196 @@ +//======================================================================== +// +// GString.cc +// +// Simple variable-length string type. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "GString.h" + +static inline int size(int len) { + int delta; + + delta = len < 256 ? 7 : 255; + return ((len + 1) + delta) & ~delta; +} + +inline void GString::resize(int length1) { + char *s1; + + if (!s) { + s = new char[size(length1)]; + } else if (size(length1) != size(length)) { + s1 = new char[size(length1)]; + memcpy(s1, s, length + 1); + delete[] s; + s = s1; + } +} + +GString::GString() { + s = NULL; + resize(length = 0); + s[0] = '\0'; +} + +GString::GString(char *s1) { + int n = strlen(s1); + + s = NULL; + resize(length = n); + memcpy(s, s1, n + 1); +} + +GString::GString(char *s1, int length1) { + s = NULL; + resize(length = length1); + memcpy(s, s1, length * sizeof(char)); + s[length] = '\0'; +} + +GString::GString(GString *str) { + s = NULL; + resize(length = str->getLength()); + memcpy(s, str->getCString(), length + 1); +} + +GString::GString(GString *str1, GString *str2) { + int n1 = str1->getLength(); + int n2 = str2->getLength(); + + s = NULL; + resize(length = n1 + n2); + memcpy(s, str1->getCString(), n1); + memcpy(s + n1, str2->getCString(), n2 + 1); +} + +GString::~GString() { + delete[] s; +} + +GString *GString::clear() { + s[length = 0] = '\0'; + resize(0); + return this; +} + +GString *GString::append(char c) { + resize(length + 1); + s[length++] = c; + s[length] = '\0'; + return this; +} + +GString *GString::append(GString *str) { + int n = str->getLength(); + + resize(length + n); + memcpy(s + length, str->getCString(), n + 1); + length += n; + return this; +} + +GString *GString::append(char *str) { + int n = strlen(str); + + resize(length + n); + memcpy(s + length, str, n + 1); + length += n; + return this; +} + +GString *GString::append(char *str, int length1) { + resize(length + length1); + memcpy(s + length, str, length1); + length += length1; + s[length] = '\0'; + return this; +} + +GString *GString::insert(int i, char c) { + int j; + + resize(length + 1); + for (j = length + 1; j > i; --j) + s[j] = s[j-1]; + s[i] = c; + ++length; + return this; +} + +GString *GString::insert(int i, GString *str) { + int n = str->getLength(); + int j; + + resize(length + n); + for (j = length; j >= i; --j) + s[j+n] = s[j]; + memcpy(s+i, str->getCString(), n); + length += n; + return this; +} + +GString *GString::insert(int i, char *str) { + int n = strlen(str); + int j; + + resize(length + n); + for (j = length; j >= i; --j) + s[j+n] = s[j]; + memcpy(s+i, str, n); + length += n; + return this; +} + +GString *GString::insert(int i, char *str, int length1) { + int j; + + resize(length + length1); + for (j = length; j >= i; --j) + s[j+length1] = s[j]; + memcpy(s+i, str, length1); + length += length1; + return this; +} + +GString *GString::del(int i, int n) { + int j; + + if (n > 0) { + for (j = i; j <= length - n; ++j) + s[j] = s[j + n]; + resize(length -= n); + } + return this; +} + +GString *GString::upperCase() { + int i; + + for (i = 0; i < length; ++i) { + if (islower(s[i])) + s[i] = toupper(s[i]); + } + return this; +} + +GString *GString::lowerCase() { + int i; + + for (i = 0; i < length; ++i) { + if (isupper(s[i])) + s[i] = tolower(s[i]); + } + return this; +} diff --git a/pdf/goo/GString.h b/pdf/goo/GString.h new file mode 100644 index 00000000..904f425a --- /dev/null +++ b/pdf/goo/GString.h @@ -0,0 +1,92 @@ +//======================================================================== +// +// GString.h +// +// Simple variable-length string type. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef GSTRING_H +#define GSTRING_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include + +class GString { +public: + + // Create an empty string. + GString(); + + // Create a string from a C string. + GString(char *s1); + + // Create a string from chars at . This string + // can contain null characters. + GString (char *s1, int length1); + + // Copy a string. + GString(GString *str); + GString *copy() { return new GString(this); } + + // Concatenate two strings. + GString(GString *str1, GString *str2); + + // Destructor. + ~GString(); + + // Get length. + int getLength() { return length; } + + // Get C string. + char *getCString() { return s; } + + // Get th character. + char getChar(int i) { return s[i]; } + + // Change th character. + void setChar(int i, char c) { s[i] = c; } + + // Clear string to zero length. + GString *clear(); + + // Append a character or string. + GString *append(char c); + GString *append(GString *str); + GString *append(char *str); + GString *append(char *str, int length1); + + // Insert a character or string. + GString *insert(int i, char c); + GString *insert(int i, GString *str); + GString *insert(int i, char *str); + GString *insert(int i, char *str, int length1); + + // Delete a character or range of characters. + GString *del(int i, int n = 1); + + // Convert string to all-upper/all-lower case. + GString *upperCase(); + GString *lowerCase(); + + // Compare two strings: -1:< 0:= +1:> + // These functions assume the strings do not contain null characters. + int cmp(GString *str) { return strcmp(s, str->getCString()); } + int cmpN(GString *str, int n) { return strncmp(s, str->getCString(), n); } + int cmp(char *s1) { return strcmp(s, s1); } + int cmpN(char *s1, int n) { return strncmp(s, s1, n); } + +private: + + int length; + char *s; + + void resize(int length1); +}; + +#endif diff --git a/pdf/goo/Makefile.in b/pdf/goo/Makefile.in new file mode 100644 index 00000000..d50866d2 --- /dev/null +++ b/pdf/goo/Makefile.in @@ -0,0 +1,69 @@ +#======================================================================== +# +# Goo library Makefile +# +# Copyright 1996 Derek B. Noonburg +# +#======================================================================== + +srcdir = @srcdir@ +VPATH = @srcdir@ + +CFLAGS = @CFLAGS@ @DEFS@ @OPTIONS@ -I$(srcdir) +CXXFLAGS = @CXXFLAGS@ @DEFS@ @OPTIONS@ -I$(srcdir) + +CC = @CC@ +CXX = @CXX@ +AR = @AR@ +RANLIB = @RANLIB@ + +LIBPREFIX = @LIBPREFIX@ + +#------------------------------------------------------------------------ + +.SUFFIXES: .cc + +.cc.o: + $(CXX) $(CXXFLAGS) -c $< + +#------------------------------------------------------------------------ + +CXX_SRC = \ + $(srcdir)/GString.cc \ + $(srcdir)/gmempp.cc \ + $(srcdir)/gfile.cc + +C_SRC = \ + $(srcdir)/gmem.c \ + $(srcdir)/parseargs.c + +#------------------------------------------------------------------------ + +GOO_CXX_OBJS = GString.o gmempp.o gfile.o +GOO_C_OBJS = gmem.o parseargs.o +GOO_OBJS = $(GOO_CXX_OBJS) $(GOO_C_OBJS) + +$(LIBPREFIX)Goo.a: $(GOO_OBJS) + rm -f $(LIBPREFIX)Goo.a + $(AR) $(LIBPREFIX)Goo.a $(GOO_OBJS) + $(RANLIB) $(LIBPREFIX)Goo.a + +#------------------------------------------------------------------------ + +clean: + rm -f $(GOO_OBJS) $(LIBPREFIX)Goo.a + +#------------------------------------------------------------------------ + +distdepend: + cp Makefile.in Makefile.in.bak + sed '/^#----- dependences -----/q' Makefile.in.bak >Makefile.in + $(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >>Makefile.in + $(CC) $(CFLAGS) -MM $(C_SRC) >>Makefile.in + +#----- dependences ----- +GString.o: ./GString.cc GString.h +gmempp.o: ./gmempp.cc gmem.h +gfile.o: ./gfile.cc GString.h gfile.h gtypes.h +gmem.o: ./gmem.c gmem.h +parseargs.o: ./parseargs.c parseargs.h gtypes.h diff --git a/pdf/goo/gfile.cc b/pdf/goo/gfile.cc new file mode 100644 index 00000000..f6aac95f --- /dev/null +++ b/pdf/goo/gfile.cc @@ -0,0 +1,455 @@ +//======================================================================== +// +// gfile.cc +// +// Miscellaneous file and directory name manipulation. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef WIN32 +extern "C" { +#include +#include +} +#else // !WIN32 +#include +#include +#include +#ifndef VMS +#include +#endif +#endif // WIN32 +#if defined(VMS) && (__DECCXX_VER < 50200000) +#include +#endif +#include "GString.h" +#include "gfile.h" + +// Some systems don't define this, so just make it something reasonably +// large. +#ifndef PATH_MAX +#define PATH_MAX 1024 +#endif + +//------------------------------------------------------------------------ + +GString *getHomeDir() { +#ifdef VMS + //---------- VMS ---------- + return new GString("SYS$LOGIN:"); + +#elif defined(__EMX__) || defined(WIN32) + //---------- OS/2+EMX and Win32 ---------- + char *s; + GString *ret; + + if ((s = getenv("HOME"))) + ret = new GString(s); + else + ret = new GString("."); + return ret; + +#else + //---------- Unix ---------- + char *s; + struct passwd *pw; + GString *ret; + + if ((s = getenv("HOME"))) { + ret = new GString(s); + } else { + if ((s = getenv("USER"))) + pw = getpwnam(s); + else + pw = getpwuid(getuid()); + if (pw) + ret = new GString(pw->pw_dir); + else + ret = new GString("."); + } + return ret; +#endif +} + +GString *getCurrentDir() { + char buf[PATH_MAX+1]; + +#if defined(__EMX__) + if (!_getcwd2(buf, sizeof(buf))) +#elif defined(WIN32) + if (!GetCurrentDirectory(sizeof(buf), buf)) +#else + if (!getcwd(buf, sizeof(buf))) +#endif + return new GString(); + return new GString(buf); +} + +GString *appendToPath(GString *path, char *fileName) { +#if defined(VMS) + //---------- VMS ---------- + //~ this should handle everything necessary for file + //~ requesters, but it's certainly not complete + char *p0, *p1, *p2; + char *q1; + + p0 = path->getCString(); + p1 = p0 + path->getLength() - 1; + if (!strcmp(fileName, "-")) { + if (*p1 == ']') { + for (p2 = p1; p2 > p0 && *p2 != '.' && *p2 != '['; --p2) ; + if (*p2 == '[') + ++p2; + path->del(p2 - p0, p1 - p2); + } else if (*p1 == ':') { + path->append("[-]"); + } else { + path->clear(); + path->append("[-]"); + } + } else if ((q1 = strrchr(fileName, '.')) && !strncmp(q1, ".DIR;", 5)) { + if (*p1 == ']') { + path->insert(p1 - p0, '.'); + path->insert(p1 - p0 + 1, fileName, q1 - fileName); + } else if (*p1 == ':') { + path->append('['); + path->append(']'); + path->append(fileName, q1 - fileName); + } else { + path->clear(); + path->append(fileName, q1 - fileName); + } + } else { + if (*p1 != ']' && *p1 != ':') + path->clear(); + path->append(fileName); + } + return path; + +#elif defined(WIN32) + //---------- Win32 ---------- + GString *tmp; + char buf[256]; + char *fp; + + tmp = new GString(path); + tmp->append('/'); + tmp->append(fileName); + GetFullPathName(tmp->getCString(), sizeof(buf), buf, &fp); + delete tmp; + path->clear(); + path->append(buf); + return path; + +#else + //---------- Unix and OS/2+EMX ---------- + int i; + + // appending "." does nothing + if (!strcmp(fileName, ".")) + return path; + + // appending ".." goes up one directory + if (!strcmp(fileName, "..")) { + for (i = path->getLength() - 2; i >= 0; --i) { +#ifdef __EMX__ + if (path->getChar(i) == '/' || path->getChar(i) == '\\' || + path->getChar(i) == ':') +#else + if (path->getChar(i) == '/') +#endif + break; + } + if (i <= 0) { +#ifdef __EMX__ + if (path->getChar[0] == '/' || path->getChar[0] == '\\') { + path->del(1, path->getLength() - 1); + } else if (path->getLength() >= 2 && path->getChar[1] == ':') { + path->del(2, path->getLength() - 2); + } else { + path->clear(); + path->append(".."); + } +#else + if (path->getChar(0) == '/') { + path->del(1, path->getLength() - 1); + } else { + path->clear(); + path->append(".."); + } +#endif + } else { +#ifdef __EMX__ + if (path->getChar(i) == ':') + ++i; +#endif + path->del(i, path->getLength() - i); + } + return path; + } + + // otherwise, append "/" and new path component +#ifdef __EMX__ + if (path->getLength() > 0 && + path->getChar(path->getLength() - 1) != '/' && + path->getChar(path->getLength() - 1) != '\\') +#else + if (path->getLength() > 0 && + path->getChar(path->getLength() - 1) != '/') +#endif + path->append('/'); + path->append(fileName); + return path; +#endif +} + +GString *grabPath(char *fileName) { +#ifdef VMS + //---------- VMS ---------- + char *p; + + if ((p = strrchr(fileName, ']'))) + return new GString(fileName, p + 1 - fileName); + if ((p = strrchr(fileName, ':'))) + return new GString(fileName, p + 1 - fileName); + return new GString(); + +#elif defined(__EMX__) || defined(WIN32) + //---------- OS/2+EMX and Win32 ---------- + char *p; + + if ((p = strrchr(fileName, '/'))) + return new GString(fileName, p - fileName); + if ((p = strrchr(fileName, '\\'))) + return new GString(fileName, p - fileName); + if ((p = strrchr(fileName, ':'))) + return new GString(fileName, p + 1 - fileName); + return new GString(); + +#else + //---------- Unix ---------- + char *p; + + if ((p = strrchr(fileName, '/'))) + return new GString(fileName, p - fileName); + return new GString(); +#endif +} + +GBool isAbsolutePath(char *path) { +#ifdef VMS + //---------- VMS ---------- + return strchr(path, ':') || + (path[0] == '[' && path[1] != '.' && path[1] != '-'); + +#elif defined(__EMX__) || defined(WIN32) + //---------- OS/2+EMX and Win32 ---------- + return path[0] == '/' || path[0] == '\\' || path[1] == ':'; + +#else + //---------- Unix ---------- + return path[0] == '/'; +#endif +} + +GString *makePathAbsolute(GString *path) { +#ifdef VMS + //---------- VMS ---------- + char buf[PATH_MAX+1]; + + if (!isAbsolutePath(path->getCString())) { + if (getcwd(buf, sizeof(buf))) { + if (path->getChar(0) == '[') { + if (path->getChar(1) != '.') + path->insert(0, '.'); + path->insert(0, buf); + } else { + path->insert(0, '['); + path->insert(1, ']'); + path->insert(1, buf); + } + } + } + return path; + +#elif WIN32 + //---------- Win32 ---------- + char buf[_MAX_PATH]; + char *fp; + + buf[0] = '\0'; + if (!GetFullPathName(path->getCString(), _MAX_PATH, buf, &fp)) { + path->clear(); + return path; + } + path->clear(); + path->append(buf); + return path; + +#else + //---------- Unix and OS/2+EMX ---------- + struct passwd *pw; + char buf[PATH_MAX+1]; + GString *s; + char *p1, *p2; + int n; + + if (path->getChar(0) == '~') { + if (path->getChar(1) == '/' || +#ifdef __EMX__ + path->getChar(1) == '\\' || +#endif + path->getLength() == 1) { + path->del(0, 1); + s = getHomeDir(); + path->insert(0, s); + delete s; + } else { + p1 = path->getCString() + 1; +#ifdef __EMX__ + for (p2 = p1; *p2 && *p2 != '/' && *p2 != '\\'; ++p2) ; +#else + for (p2 = p1; *p2 && *p2 != '/'; ++p2) ; +#endif + if ((n = 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->insert(0, pw->pw_dir); + } + } + } else if (!isAbsolutePath(path->getCString())) { + if (getcwd(buf, sizeof(buf))) { + path->insert(0, '/'); + path->insert(0, buf); + } + } + return path; +#endif +} + +//------------------------------------------------------------------------ +// GDir and GDirEntry +//------------------------------------------------------------------------ + +GDirEntry::GDirEntry(char *dirPath, char *name1, GBool doStat) { +#ifdef VMS + char *p; +#elif WIN32 + int fa; + GString *s; +#else + struct stat st; + GString *s; +#endif + + name = new GString(name1); + dir = gFalse; + if (doStat) { +#ifdef VMS + if (!strcmp(name1, "-") || + ((p = strrchr(name1, '.')) && !strncmp(p, ".DIR;", 5))) + dir = gTrue; +#else + s = new GString(dirPath); + appendToPath(s, name1); +#ifdef WIN32 + fa = GetFileAttributes(s->getCString()); + dir = (fa != 0xFFFFFFFF && (fa & FILE_ATTRIBUTE_DIRECTORY)); +#else + if (stat(s->getCString(), &st) == 0) + dir = S_ISDIR(st.st_mode); +#endif + delete s; +#endif + } +} + +GDirEntry::~GDirEntry() { + delete name; +} + +GDir::GDir(char *name, GBool doStat1) { + path = new GString(name); + doStat = doStat1; +#ifdef WIN32 + GString *tmp; + + tmp = path->copy(); + tmp->append("/*.*"); + hnd = FindFirstFile(tmp->getCString(), &ffd); + delete tmp; +#else + dir = opendir(name); +#endif +#ifdef VMS + needParent = strchr(name, '[') != NULL; +#endif +} + +GDir::~GDir() { + delete path; +#ifdef WIN32 + if (hnd) { + FindClose(hnd); + hnd = NULL; + } +#else + if (dir) + closedir(dir); +#endif +} + +GDirEntry *GDir::getNextEntry() { + struct dirent *ent; + GDirEntry *e; + + e = NULL; +#ifdef WIN32 + e = new GDirEntry(path->getCString(), ffd.cFileName, doStat); + if (hnd && !FindNextFile(hnd, &ffd)) { + FindClose(hnd); + hnd = NULL; + } +#else + if (dir) { +#ifdef VMS + if (needParent) { + e = new GDirEntry(path->getCString(), "-", doStat); + needParent = gFalse; + return e; + } +#endif + ent = readdir(dir); +#ifndef VMS + if (ent && !strcmp(ent->d_name, ".")) + ent = readdir(dir); +#endif + if (ent) + e = new GDirEntry(path->getCString(), ent->d_name, doStat); + } +#endif + return e; +} + +void GDir::rewind() { +#ifdef WIN32 + GString *tmp; + + if (hnd) + FindClose(hnd); + tmp = path->copy(); + tmp->append("/*.*"); + hnd = FindFirstFile(tmp->getCString(), &ffd); +#else + if (dir) + rewinddir(dir); +#endif +#ifdef VMS + needParent = strchr(path->getCString(), '[') != NULL; +#endif +} diff --git a/pdf/goo/gfile.h b/pdf/goo/gfile.h new file mode 100644 index 00000000..f1923cde --- /dev/null +++ b/pdf/goo/gfile.h @@ -0,0 +1,108 @@ +//======================================================================== +// +// gfile.h +// +// Miscellaneous file and directory name manipulation. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef GFILE_H +#define GFILE_H + +#include +#include +#ifdef WIN32 +# include +#else +# include +# include +# ifdef VMS +# include "vms_dirent.h" +# elif HAVE_DIRENT_H +# include +# define NAMLEN(dirent) strlen((dirent)->d_name) +# else +# define dirent direct +# define NAMLEN(dirent) (dirent)->d_namlen +# if HAVE_SYS_NDIR_H +# include +# endif +# if HAVE_SYS_DIR_H +# include +# endif +# if HAVE_NDIR_H +# include +# endif +# endif +#endif +#include "gtypes.h" + +class GString; + +//------------------------------------------------------------------------ + +// Get home directory path. +extern GString *getHomeDir(); + +// Get current directory. +extern GString *getCurrentDir(); + +// Append a file name to a path string. may be an empty +// string, denoting the current directory). Returns . +extern GString *appendToPath(GString *path, char *fileName); + +// Grab the path from the front of the file name. If there is no +// directory component in , returns an empty string. +extern GString *grabPath(char *fileName); + +// Is this an absolute path or file name? +extern GBool isAbsolutePath(char *path); + +// Make this path absolute by prepending current directory (if path is +// relative) or prepending user's directory (if path starts with '~'). +GString *makePathAbsolute(GString *path); + +//------------------------------------------------------------------------ +// GDir and GDirEntry +//------------------------------------------------------------------------ + +class GDirEntry { +public: + + GDirEntry(char *dirPath, char *name1, GBool doStat); + ~GDirEntry(); + GString *getName() { return name; } + GBool isDir() { return dir; } + +private: + + GString *name; // dir/file name + GBool dir; // is it a directory? +}; + +class GDir { +public: + + GDir(char *name, GBool doStat1 = gTrue); + ~GDir(); + GDirEntry *getNextEntry(); + void rewind(); + +private: + + GString *path; // directory path + GBool doStat; // call stat() for each entry? +#ifdef VMS + GBool needParent; // need to return an entry for [-] +#endif +#ifdef WIN32 + WIN32_FIND_DATA ffd; + HANDLE hnd; +#else + DIR *dir; // the DIR structure from opendir() +#endif +}; + +#endif diff --git a/pdf/goo/gmem.c b/pdf/goo/gmem.c new file mode 100644 index 00000000..4ae54812 --- /dev/null +++ b/pdf/goo/gmem.c @@ -0,0 +1,182 @@ +/* + * gmem.c + * + * Memory routines with out-of-memory checking. + * + * Copyright 1996 Derek B. Noonburg + */ + +#include +#include +#include +#include +#include "gmem.h" + +#ifdef DEBUG_MEM +typedef struct _GMemHdr { + int size; + int index; + struct _GMemHdr *next; +} GMemHdr; + +#define gMemHdrSize ((sizeof(GMemHdr) + 7) & ~7) +#define gMemTrlSize (sizeof(long)) + +#if gmemTrlSize==8 +#define gMemDeadVal 0xdeadbeefdeadbeef +#else +#define gMemDeadVal 0xdeadbeef + +/* round data size so trailer will be aligned */ +#define gMemDataSize(size) \ + ((((size) + gMemTrlSize - 1) / gMemTrlSize) * gMemTrlSize) + +#endif + +static GMemHdr *gMemList = NULL; +static int gMemIndex = 0; +static int gMemAlloc = 0; +#endif + +void *gmalloc(int size) { +#if DEBUG_MEM + int size1; + char *mem; + GMemHdr *hdr; + void *data; + long *trl, *p; + + if (size == 0) + return NULL; + size1 = gMemDataSize(size); + if (!(mem = (char *)malloc(size1 + gMemHdrSize + gMemTrlSize))) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + hdr = (GMemHdr *)mem; + data = (void *)(mem + gMemHdrSize); + trl = (long *)(mem + gMemHdrSize + size1); + hdr->size = size; + hdr->index = gMemIndex++; + hdr->next = gMemList; + gMemList = hdr; + ++gMemAlloc; + for (p = (long *)data; p <= trl; ++p) + *p = gMemDeadVal; + return data; +#else + void *p; + + if (size == 0) + return NULL; + if (!(p = malloc(size))) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + return p; +#endif +} + +void *grealloc(void *p, int size) { +#if DEBUG_MEM + GMemHdr *hdr; + void *q; + int oldSize; + + if (size == 0) { + if (p) + gfree(p); + return NULL; + } + if (p) { + hdr = (GMemHdr *)((char *)p - gMemHdrSize); + oldSize = hdr->size; + q = gmalloc(size); + memcpy(q, p, size < oldSize ? size : oldSize); + gfree(p); + } else { + q = gmalloc(size); + } + return q; +#else + void *q; + + if (size == 0) { + if (p) + free(p); + return NULL; + } + if (p) + q = realloc(p, size); + else + q = malloc(size); + if (!q) { + fprintf(stderr, "Out of memory\n"); + exit(1); + } + return q; +#endif +} + +void gfree(void *p) { +#ifdef DEBUG_MEM + int size; + GMemHdr *hdr; + GMemHdr *prevHdr, *q; + long *trl, *clr; + + if (p) { + hdr = (GMemHdr *)((char *)p - gMemHdrSize); + for (prevHdr = NULL, q = gMemList; q; prevHdr = q, q = q->next) { + if (q == hdr) + break; + } + if (q) { + if (prevHdr) + prevHdr->next = hdr->next; + else + gMemList = hdr->next; + --gMemAlloc; + size = gMemDataSize(hdr->size); + trl = (long *)((char *)hdr + gMemHdrSize + size); + if (*trl != gMemDeadVal) { + fprintf(stderr, "Overwrite past end of block %d at address %p\n", + hdr->index, p); + } + for (clr = (long *)hdr; clr <= trl; ++clr) + *clr = gMemDeadVal; + free(hdr); + } else { + fprintf(stderr, "Attempted to free bad address %p\n", p); + } + } +#else + if (p) + free(p); +#endif +} + +#ifdef DEBUG_MEM +void gMemReport(FILE *f) { + GMemHdr *p; + + fprintf(f, "%d memory allocations in all\n", gMemIndex); + if (gMemAlloc > 0) { + fprintf(f, "%d memory blocks left allocated:\n", gMemAlloc); + fprintf(f, " index size\n"); + fprintf(f, "-------- --------\n"); + for (p = gMemList; p; p = p->next) + fprintf(f, "%8d %8d\n", p->index, p->size); + } else { + fprintf(f, "No memory blocks left allocated\n"); + } +} +#endif + +char *copyString(char *s) { + char *s1; + + s1 = (char *)gmalloc(strlen(s) + 1); + strcpy(s1, s); + return s1; +} diff --git a/pdf/goo/gmem.h b/pdf/goo/gmem.h new file mode 100644 index 00000000..7ab5ddbe --- /dev/null +++ b/pdf/goo/gmem.h @@ -0,0 +1,53 @@ +/* + * gmem.h + * + * Memory routines with out-of-memory checking. + * + * Copyright 1996 Derek B. Noonburg + */ + +#ifndef GMEM_H +#define GMEM_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Same as malloc, but prints error message and exits if malloc() + * returns NULL. + */ +extern void *gmalloc(int size); + +/* + * Same as realloc, but prints error message and exits if realloc() + * returns NULL. If

is NULL, calls malloc instead of realloc(). + */ +extern void *grealloc(void *p, int size); + +/* + * Same as free, but checks for and ignores NULL pointers. + */ +extern void gfree(void *p); + +#ifdef DEBUG_MEM +/* + * Report on unfreed memory. + */ +extern void gMemReport(FILE *f); +#else +#define gMemReport(f) +#endif + +/* + * Allocate memory and copy a string into it. + */ +extern char *copyString(char *s); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/pdf/goo/gmempp.cc b/pdf/goo/gmempp.cc new file mode 100644 index 00000000..41dd441c --- /dev/null +++ b/pdf/goo/gmempp.cc @@ -0,0 +1,23 @@ +//======================================================================== +// +// gmempp.cc +// +// Use gmalloc/gfree for C++ new/delete operators. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#include "gmem.h" + +#ifdef DEBUG_MEM +void *operator new(long size) { + return gmalloc((int)size); +} +#endif + +#ifdef DEBUG_MEM +void operator delete(void *p) { + gfree(p); +} +#endif diff --git a/pdf/goo/gtypes.h b/pdf/goo/gtypes.h new file mode 100644 index 00000000..65932674 --- /dev/null +++ b/pdf/goo/gtypes.h @@ -0,0 +1,29 @@ +/* + * gtypes.h + * + * Some useful simple types. + * + * Copyright 1996 Derek B. Noonburg + */ + +#ifndef GTYPES_H +#define GTYPES_H + +/* + * These have stupid names to avoid conflicts with some (but not all) + * C++ compilers which define them. + */ +typedef int GBool; +#define gTrue 1 +#define gFalse 0 + +/* + * These have stupid names to avoid conflicts with , + * which on various systems defines some random subset of these. + */ +typedef unsigned char Guchar; +typedef unsigned short Gushort; +typedef unsigned int Guint; +typedef unsigned long Gulong; + +#endif diff --git a/pdf/goo/makefile.w32 b/pdf/goo/makefile.w32 new file mode 100644 index 00000000..b582dcea --- /dev/null +++ b/pdf/goo/makefile.w32 @@ -0,0 +1,64 @@ +# Generated automatically from Makefile.in by configure. +#======================================================================== +# +# Goo library Makefile +# +# Copyright 1996 Derek B. Noonburg +# +#======================================================================== + +srcdir = . + +CFLAGS = -O2 -DHAVE_DIRENT_H=1 -I$(srcdir) +CXXFLAGS = -O2 -DHAVE_DIRENT_H=1 -I$(srcdir) + +CC = gcc +CXX = gcc +AR = ar rc +RANLIB = ranlib + +LIBPREFIX = lib + +#------------------------------------------------------------------------ + +.SUFFIXES: .cc + +.cc.o: + $(CXX) $(CXXFLAGS) -c $< + +#------------------------------------------------------------------------ + +CXX_SRC = \ + $(srcdir)/GString.cc \ + $(srcdir)/gmempp.cc \ + $(srcdir)/gfile.cc + +C_SRC = \ + $(srcdir)/gmem.c \ + $(srcdir)/parseargs.c + +#------------------------------------------------------------------------ + +GOO_CXX_OBJS = GString.o gmempp.o gfile.o +GOO_C_OBJS = gmem.o parseargs.o +GOO_OBJS = $(GOO_CXX_OBJS) $(GOO_C_OBJS) + +$(LIBPREFIX)Goo.a: $(GOO_OBJS) + del $(LIBPREFIX)Goo.a + $(AR) $(LIBPREFIX)Goo.a $(GOO_OBJS) + $(RANLIB) $(LIBPREFIX)Goo.a + +#------------------------------------------------------------------------ + +clean: + del *.o + del $(LIBPREFIX)Goo.a +# rm -f Makefile.bak + +#------------------------------------------------------------------------ + +depend: + $(CXX) $(CXXFLAGS) -M $(CXX_SRC) >Makefile.dep + $(CC) $(CFLAGS) -M $(C_SRC) >>Makefile.dep + +#include Makefile.dep diff --git a/pdf/goo/parseargs.c b/pdf/goo/parseargs.c new file mode 100644 index 00000000..ceba8877 --- /dev/null +++ b/pdf/goo/parseargs.c @@ -0,0 +1,190 @@ +/* + * parseargs.h + * + * Command line argument parser. + * + * Copyright 1996 Derek B. Noonburg + */ + +#include +#include +#include +#include +#include +#include "parseargs.h" + +static ArgDesc *findArg(ArgDesc *args, char *arg); +static GBool grabArg(ArgDesc *arg, int i, int *argc, char *argv[]); + +GBool parseArgs(ArgDesc *args, int *argc, char *argv[]) { + ArgDesc *arg; + int i, j; + GBool ok; + + ok = gTrue; + i = 1; + while (i < *argc) { + if (!strcmp(argv[i], "--")) { + --*argc; + for (j = i; j < *argc; ++j) + argv[j] = argv[j+1]; + break; + } else if ((arg = findArg(args, argv[i]))) { + if (!grabArg(arg, i, argc, argv)) + ok = gFalse; + } else { + ++i; + } + } + return ok; +} + +void printUsage(char *program, char *otherArgs, ArgDesc *args) { + ArgDesc *arg; + char *typ; + int w, w1; + + w = 0; + for (arg = args; arg->arg; ++arg) { + if ((w1 = strlen(arg->arg)) > w) + w = w1; + } + + fprintf(stderr, "Usage: %s [options]", program); + if (otherArgs) + fprintf(stderr, " %s", otherArgs); + fprintf(stderr, "\n"); + + for (arg = args; arg->arg; ++arg) { + fprintf(stderr, " %s", arg->arg); + w1 = 9 + w - strlen(arg->arg); + switch (arg->kind) { + case argInt: + case argIntDummy: + typ = " "; + break; + case argFP: + case argFPDummy: + typ = " "; + break; + case argString: + case argStringDummy: + typ = " "; + break; + case argFlag: + case argFlagDummy: + default: + typ = ""; + break; + } + fprintf(stderr, "%-*s", w1, typ); + if (arg->usage) + fprintf(stderr, ": %s", arg->usage); + fprintf(stderr, "\n"); + } +} + +static ArgDesc *findArg(ArgDesc *args, char *arg) { + ArgDesc *p; + + for (p = args; p->arg; ++p) { + if (p->kind < argFlagDummy && !strcmp(p->arg, arg)) + return p; + } + return NULL; +} + +static GBool grabArg(ArgDesc *arg, int i, int *argc, char *argv[]) { + int n; + int j; + GBool ok; + + ok = gTrue; + n = 0; + switch (arg->kind) { + case argFlag: + *(GBool *)arg->val = gTrue; + n = 1; + break; + case argInt: + if (i + 1 < *argc && isInt(argv[i+1])) { + *(int *)arg->val = atoi(argv[i+1]); + n = 2; + } else { + ok = gFalse; + n = 1; + } + break; + case argFP: + if (i + 1 < *argc && isFP(argv[i+1])) { + *(double *)arg->val = atof(argv[i+1]); + n = 2; + } else { + ok = gFalse; + n = 1; + } + break; + case argString: + if (i + 1 < *argc) { + strncpy((char *)arg->val, argv[i+1], arg->size - 1); + ((char *)arg->val)[arg->size - 1] = '\0'; + n = 2; + } else { + ok = gFalse; + n = 1; + } + break; + default: + fprintf(stderr, "Internal error in arg table\n"); + n = 1; + break; + } + if (n > 0) { + *argc -= n; + for (j = i; j < *argc; ++j) + argv[j] = argv[j+n]; + } + return ok; +} + +GBool isInt(char *s) { + if (*s == '-' || *s == '+') + ++s; + while (isdigit(*s)) + ++s; + if (*s) + return gFalse; + return gTrue; +} + +GBool isFP(char *s) { + int n; + + if (*s == '-' || *s == '+') + ++s; + n = 0; + while (isdigit(*s)) { + ++s; + ++n; + } + if (*s == '.') + ++s; + while (isdigit(*s)) { + ++s; + ++n; + } + if (n > 0 && (*s == 'e' || *s == 'E')) { + ++s; + if (*s == '-' || *s == '+') + ++s; + n = 0; + if (!isdigit(*s)) + return gFalse; + do { + ++s; + } while (isdigit(*s)); + } + if (*s) + return gFalse; + return gTrue; +} diff --git a/pdf/goo/parseargs.h b/pdf/goo/parseargs.h new file mode 100644 index 00000000..e0aa2be3 --- /dev/null +++ b/pdf/goo/parseargs.h @@ -0,0 +1,71 @@ +/* + * parseargs.h + * + * Command line argument parser. + * + * Copyright 1996 Derek B. Noonburg + */ + +#ifndef PARSEARGS_H +#define PARSEARGS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "gtypes.h" + +/* + * Argument kinds. + */ +typedef enum { + argFlag, /* flag (present / not-present) */ + /* [val: GBool *] */ + argInt, /* integer arg */ + /* [val: int *] */ + argFP, /* floating point arg */ + /* [val: double *] */ + argString, /* string arg */ + /* [val: char *] */ + /* dummy entries -- these show up in the usage listing only; */ + /* useful for X args, for example */ + argFlagDummy, + argIntDummy, + argFPDummy, + argStringDummy +} ArgKind; + +/* + * Argument descriptor. + */ +typedef struct { + char *arg; /* the command line switch */ + ArgKind kind; /* kind of arg */ + void *val; /* place to store value */ + int size; /* for argString: size of string */ + char *usage; /* usage string */ +} ArgDesc; + +/* + * Parse command line. Removes all args which are found in the arg + * descriptor list . Stops parsing if "--" is found (and removes + * it). Returns gFalse if there was an error. + */ +extern GBool parseArgs(ArgDesc *args, int *argc, char *argv[]); + +/* + * Print usage message, based on arg descriptor list. + */ +extern void printUsage(char *program, char *otherArgs, ArgDesc *args); + +/* + * Check if a string is a valid integer or floating point number. + */ +extern GBool isInt(char *s); +extern GBool isFP(char *s); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/pdf/goo/vms_directory.c b/pdf/goo/vms_directory.c new file mode 100644 index 00000000..92d94932 --- /dev/null +++ b/pdf/goo/vms_directory.c @@ -0,0 +1,214 @@ +/* + * DIRECTORY.C - VMS emulation routines for UNIX Directory + * callable routines + * + * Author: Patrick L. Mahan + * Location: TGV, Inc + * Date: 19-November-1991 + * + * Purpose: Provides emulation of the BSD directory routines + * which are used by some of the X11 R4 release + * software. + * + * Side effects: This is only a partial emulation. Not all of + * the required information is passed to the user. + * + * Modification History + * + * Date | Who | Version | History + * ------------+-----------+---------------+---------------------------- + * 19-Nov-1991 | PLM | 1.0 | First Write + * 20-Apr-1992 | PLM | 1.1 | Added validation check for + * | | | for the directory + */ + +#include +#include +#include +#include +#include +#include +#include "vms_dirent.h" + +#define NOWILD 0x00000001 +#define MULTIPLE 0x00000002 + +static unsigned long context = 0; + +static struct dsc$descriptor_s *create_descriptor ( name ) +char *name; +{ + struct dsc$descriptor_s *retdescrip; + + retdescrip = (struct dsc$descriptor_s *)calloc(1, sizeof(struct dsc$descriptor_s)); + + if (retdescrip == NULL) return ((struct dsc$descriptor_s *)NULL); + + retdescrip->dsc$b_dtype = DSC$K_DTYPE_T; + retdescrip->dsc$b_class = DSC$K_CLASS_S; + retdescrip->dsc$w_length = strlen(name); + retdescrip->dsc$a_pointer = name; + + return (retdescrip); +} + +static int Check_Directory( dirname ) +char *dirname; +{ + static char *tmpdir, *cp; + FILE *tfp; + int status; + + status = 1; + + tmpdir = calloc(strlen(dirname)+15,sizeof(char)); + + strcpy(tmpdir, dirname); + + cp = strrchr(tmpdir, '.'); + + if (cp != NULL) { + *cp = ']'; + cp = strrchr(tmpdir, ']'); + *cp = '.'; + strcat(tmpdir, "dir"); + } + else { + char *tmp1; + tmp1 = calloc(strlen(dirname)+1,sizeof(char)); + cp = strchr(tmpdir, '['); + cp++; + strcpy(tmp1, cp); + cp = strrchr(tmp1, ']'); + *cp = '\0'; + cp = strchr(tmpdir, '['); + cp++; + *cp = '\0'; + strcat(tmpdir, "000000]"); + strcat(tmpdir, tmp1); + strcat(tmpdir, ".dir"); + } + + tfp = fopen(tmpdir, "r"); + + if (tfp == NULL) status = 0; + + fclose(tfp); + + return (status); +} + +DIR *opendir( dirname ) +char *dirname; +{ + DIR *retdir; + struct dsc$descriptor_s filedescriptor; + char *filepathname; + + retdir = (DIR *) calloc(1, sizeof(DIR)); + + if (retdir == NULL) return ((DIR *)NULL); + + if (!Check_Directory(dirname)) return ((DIR *)NULL); + + filepathname = (char *)calloc(256, sizeof(char)); + + strcpy(filepathname, dirname); + strcat(filepathname, "*.*.*"); + + retdir->dd_fd = (unsigned long) create_descriptor(filepathname); + retdir->dd_loc = 0; + retdir->dd_size = strlen(filepathname); + retdir->dd_bsize = 0; + retdir->dd_off = 0; + retdir->dd_buf = filepathname; + + return (retdir); +} + +struct dirent *readdir( dirp ) +DIR *dirp; +{ + static struct dirent *retdirent; + struct dsc$descriptor_s retfilenamedesc; + struct dsc$descriptor_s searchpathdesc = *((struct dsc$descriptor_s *)dirp->dd_fd); + char retfilename[256]; + char *sp; + unsigned long istatus; + unsigned long rms_status; + unsigned long flags; + + retdirent = (struct dirent *)NULL; + + flags = MULTIPLE; + + retfilenamedesc.dsc$b_dtype = DSC$K_DTYPE_T; + retfilenamedesc.dsc$b_class = DSC$K_CLASS_S; + retfilenamedesc.dsc$w_length = 255; + retfilenamedesc.dsc$a_pointer= retfilename; + + istatus = lib$find_file (&searchpathdesc, + &retfilenamedesc, + &dirp->dd_loc, + 0, 0, + &rms_status, + &flags); + + if (!(istatus & 1) && (istatus != RMS$_NMF) && (istatus != RMS$_FNF)) + { + lib$signal (istatus); + return (retdirent); + } + else if ((istatus == RMS$_NMF) || (istatus == RMS$_FNF)) + return (retdirent); + + retfilename[retfilenamedesc.dsc$w_length] = '\0'; + + sp = strchr(retfilename, ' '); + if (sp != NULL) *sp = '\0'; + + sp = strrchr(retfilename, ']'); + if (sp != NULL) + sp++; + else + sp = retfilename; + + retdirent = (struct dirent *)calloc(1, sizeof(struct dirent)); + + strcpy(retdirent->d_name, sp); + retdirent->d_namlen = strlen(sp); + retdirent->d_fileno = 0; + retdirent->d_off = 0; + retdirent->d_reclen = DIRSIZ(retdirent); + + return (retdirent); +} + +long telldir( dirp ) +DIR *dirp; +{ + return(0); +} + +void seekdir( dirp, loc ) +DIR *dirp; +int loc; +{ + return; +} + +void rewinddir( dirp ) +DIR *dirp; +{ + lib$find_file_end (&dirp->dd_loc); +} + +void closedir( dirp ) +DIR *dirp; +{ + lib$find_file_end (&dirp->dd_loc); + + cfree ((void *) dirp->dd_fd); + cfree (dirp->dd_buf); + cfree (dirp); +} diff --git a/pdf/goo/vms_dirent.h b/pdf/goo/vms_dirent.h new file mode 100644 index 00000000..13e21a07 --- /dev/null +++ b/pdf/goo/vms_dirent.h @@ -0,0 +1,67 @@ +/* @(#)dirent.h 1.7 89/06/25 SMI */ + +/* + * Filesystem-independent directory information. + */ + +#ifndef __dirent_h +#define __dirent_h + +#ifdef __cplusplus +extern "C" { +#endif + +/* Make sure we don't get the V7 RTL dirent functions. These are broken. */ + +#ifndef __CRTL_VER +# define __CRTL_VER __VMS_VER +#endif +#if __CRTL_VER >= 70000000 +#include +#endif + +#include + +#define opendir goo_opendir +#define readdir goo_readdir +#define closedir goo_closedir +#define seekdir goo_seekdir +#define telldir goo_telldir +#define rewinddir goo_rewindir +#define DIR GOO_DIR + +#ifndef _POSIX_SOURCE +#define d_ino d_fileno /* compatability */ +#ifndef NULL +#define NULL 0 +#endif +#endif /* !_POSIX_SOURCE */ + +/* + * Definitions for library routines operating on directories. + */ +typedef struct __dirdesc { + unsigned long dd_fd; /* file descriptor */ + long dd_loc; /* buf offset of entry from last readddir() */ + long dd_size; /* amount of valid data in buffer */ + long dd_bsize; /* amount of entries read at a time */ + long dd_off; /* Current offset in dir (for telldir) */ + char *dd_buf; /* directory data buffer */ +} DIR; + +#include "vms_sys_dirent.h" + +extern DIR *opendir(char *dirname); +extern struct dirent *readdir(DIR *dirp); +extern void closedir(DIR *dirp); +#ifndef _POSIX_SOURCE +extern void seekdir(DIR *dirp, int loc); +extern long telldir(DIR *dirp); +#endif /* POSIX_SOURCE */ +extern void rewinddir(DIR *dirp); + +#ifdef __cplusplus +} +#endif + +#endif /* !__dirent_h */ diff --git a/pdf/goo/vms_make.com b/pdf/goo/vms_make.com new file mode 100644 index 00000000..88b6458b --- /dev/null +++ b/pdf/goo/vms_make.com @@ -0,0 +1,26 @@ +$!======================================================================== +$! +$! Goo library compile script for VMS. +$! +$! Copyright 1996 Derek B. Noonburg +$! +$!======================================================================== +$! +$ GOO_OBJS = "GString.obj,gmempp.obj,gfile.obj,gmem.obj,parseargs.obj" + - + ",vms_directory.obj,vms_unix_times.obj" +$ if f$extract(1,3,f$getsyi("Version")) .lts. "7.0" +$ then +$ GOO_OBJS = GOO_OBJS + ",vms_unlink.obj" +$ CCOMP vms_unlink.c +$ endif +$! +$ CXXCOMP GString.cc +$ CXXCOMP gmempp.cc +$ CXXCOMP gfile.cc +$ CCOMP gmem.c +$ CCOMP parseargs.c +$ CCOMP vms_directory.c +$ CCOMP vms_unix_times.c +$! +$ lib/cre libgoo.olb +$ lib libgoo 'GOO_OBJS diff --git a/pdf/goo/vms_sys_dirent.h b/pdf/goo/vms_sys_dirent.h new file mode 100644 index 00000000..2c20d714 --- /dev/null +++ b/pdf/goo/vms_sys_dirent.h @@ -0,0 +1,54 @@ +/* @(#)dirent.h 1.4 89/06/16 SMI */ + +/* + * Filesystem-independent directory information. + * Directory entry structures are of variable length. + * Each directory entry is a struct dirent containing its file number, the + * offset of the next entry (a cookie interpretable only the filesystem + * type that generated it), the length of the entry, and the length of the + * name contained in the entry. These are followed by the name. The + * entire entry is padded with null bytes to a 4 byte boundary. All names + * are guaranteed null terminated. The maximum length of a name in a + * directory is MAXNAMLEN, plus a null byte. + */ + +#ifndef __sys_dirent_h +#define __sys_dirent_h + +#ifdef __cplusplus +extern "C" { +#endif + +#define dirent GOO_dirent + +struct dirent { + long d_off; /* offset of next disk dir entry */ + unsigned long d_fileno; /* file number of entry */ + unsigned short d_reclen; /* length of this record */ + unsigned short d_namlen; /* length of string in d_name */ + char d_name[255+1]; /* name (up to MAXNAMLEN + 1) */ +}; + +#ifndef _POSIX_SOURCE +/* + * It's unlikely to change, but make sure that sizeof d_name above is + * at least MAXNAMLEN + 1 (more may be added for padding). + */ +#define MAXNAMLEN 255 +/* + * The macro DIRSIZ(dp) gives the minimum amount of space required to represent + * a directory entry. For any directory entry dp->d_reclen >= DIRSIZ(dp). + * Specific filesystem types may use this macro to construct the value + * for d_reclen. + */ +#undef DIRSIZ +#define DIRSIZ(dp) \ + (((sizeof(struct dirent) - (MAXNAMLEN+1) + ((dp)->d_namlen+1)) +3) & ~3) + +#endif /* !_POSIX_SOURCE */ + +#ifdef __cplusplus +} +#endif + +#endif /* !__sys_dirent_h */ diff --git a/pdf/goo/vms_unix_time.h b/pdf/goo/vms_unix_time.h new file mode 100644 index 00000000..f8e83825 --- /dev/null +++ b/pdf/goo/vms_unix_time.h @@ -0,0 +1,102 @@ +/* @(#)time.h 2.9 87/01/17 SMI; from UCB 7.1 6/4/86 */ + +/* + Definitions of various structures used on UNIX for + time-related syscalls. +*/ + +/* + * Copyright (c) 1982, 1986 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef _UNIX_TIME_ +#define _UNIX_TIME_ + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Structure returned by gettimeofday(2) system call, + * and used in other calls. + */ +#ifndef __DECC +struct timeval +{ + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; +#else +#if (__DECC_VER < 50200000) && (__VMS_VER < 70000000) +struct timeval +{ + long tv_sec; /* seconds */ + long tv_usec; /* and microseconds */ +}; +#endif /* __DECC_VER */ +#endif /* __DECC */ +struct timezone +{ + int tz_minuteswest; /* minutes west of Greenwich */ + int tz_dsttime; /* type of dst correction */ +}; + +#define DST_NONE 0 /* not on dst */ +#define DST_USA 1 /* USA style dst */ +#define DST_AUST 2 /* Australian style dst */ +#define DST_WET 3 /* Western European dst */ +#define DST_MET 4 /* Middle European dst */ +#define DST_EET 5 /* Eastern European dst */ +#define DST_CAN 6 /* Canada */ +#define DST_GB 7 /* Great Britain and Eire */ +#define DST_RUM 8 /* Rumania */ +#define DST_TUR 9 /* Turkey */ +#define DST_AUSTALT 10 /* Australian style with shift in 1986 */ + +/* + * Operations on timevals. + * + * NB: timercmp does not work for >= or <=. + */ +#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec) +#define timercmp(tvp, uvp, cmp) \ + ((tvp)->tv_sec cmp (uvp)->tv_sec || \ + (tvp)->tv_sec == (uvp)->tv_sec && (tvp)->tv_usec cmp (uvp)->tv_usec) +#define timerclear(tvp) (tvp)->tv_sec = (tvp)->tv_usec = 0 + +/* + * Names of the interval timers, and structure + * defining a timer setting. + */ +#define ITIMER_REAL 0 +#define ITIMER_VIRTUAL 1 +#define ITIMER_PROF 2 + +#ifndef __DECC +struct itimerval +{ + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; +#else +#if (__DECC_VER < 50200000) && (__VMS_VER < 70000000) +struct itimerval +{ + struct timeval it_interval; /* timer interval */ + struct timeval it_value; /* current value */ +}; +#endif /* __DECC_VER */ +#endif /* __DECC */ + +#ifndef KERNEL +#include +#endif + +#ifdef __cplusplus +} +#endif + +#endif /*!_UNIX_TIME_*/ + diff --git a/pdf/goo/vms_unix_times.c b/pdf/goo/vms_unix_times.c new file mode 100644 index 00000000..004c0d04 --- /dev/null +++ b/pdf/goo/vms_unix_times.c @@ -0,0 +1,42 @@ +/* + * UNIX-style Time Functions + * + */ +#include +#include +#include +#include "vms_unix_time.h" + +/* + * gettimeofday(2) - Returns the current time + * + * NOTE: The timezone portion is useless on VMS. + * Even on UNIX, it is only provided for backwards + * compatibilty and is not guaranteed to be correct. + */ + +#if (__VMS_VER < 70000000) +int gettimeofday(tv, tz) +struct timeval *tv; +struct timezone *tz; +{ + timeb_t tmp_time; + + ftime(&tmp_time); + + if (tv != NULL) + { + tv->tv_sec = tmp_time.time; + tv->tv_usec = tmp_time.millitm * 1000; + } + + if (tz != NULL) + { + tz->tz_minuteswest = tmp_time.timezone; + tz->tz_dsttime = tmp_time.dstflag; + } + + return (0); + +} /*** End gettimeofday() ***/ +#endif diff --git a/pdf/goo/vms_unlink.c b/pdf/goo/vms_unlink.c new file mode 100644 index 00000000..e2cf687d --- /dev/null +++ b/pdf/goo/vms_unlink.c @@ -0,0 +1,22 @@ +/* + * vms_unlink.c + * + * A UNIX-style unlink() function for VMS. + * + * Thanks to Patrick Moreau (pmoreau@cena.dgac.fr). + */ + +#include +#include +#include + +int unlink(char *filename) { + static struct dsc$descriptor_s file_desc; + + file_desc.dsc$w_length = strlen(filename); + file_desc.dsc$b_dtype = DSC$K_DTYPE_T; + file_desc.dsc$b_class = DSC$K_CLASS_S; + file_desc.dsc$a_pointer= filename; + + return (lib$delete_file(&file_desc)); +} diff --git a/pdf/xpdf/Array.cc b/pdf/xpdf/Array.cc new file mode 100644 index 00000000..9681b685 --- /dev/null +++ b/pdf/xpdf/Array.cc @@ -0,0 +1,51 @@ +//======================================================================== +// +// Array.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include "gmem.h" +#include "Object.h" +#include "Array.h" + +//------------------------------------------------------------------------ +// Array +//------------------------------------------------------------------------ + +Array::Array() { + elems = NULL; + size = length = 0; + ref = 1; +} + +Array::~Array() { + int i; + + for (i = 0; i < length; ++i) + elems[i].free(); + gfree(elems); +} + +void Array::add(Object *elem) { + if (length + 1 > size) { + size += 8; + elems = (Object *)grealloc(elems, size * sizeof(Object)); + } + elems[length] = *elem; + ++length; +} + +Object *Array::get(int i, Object *obj) { + return elems[i].fetch(obj); +} + +Object *Array::getNF(int i, Object *obj) { + return elems[i].copy(obj); +} diff --git a/pdf/xpdf/Array.h b/pdf/xpdf/Array.h new file mode 100644 index 00000000..ecf2eea6 --- /dev/null +++ b/pdf/xpdf/Array.h @@ -0,0 +1,53 @@ +//======================================================================== +// +// Array.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef ARRAY_H +#define ARRAY_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "Object.h" + +//------------------------------------------------------------------------ +// Array +//------------------------------------------------------------------------ + +class Array { +public: + + // Constructor. + Array(); + + // Destructor. + ~Array(); + + // Reference counting. + int incRef() { return ++ref; } + int decRef() { return --ref; } + + // Get number of elements. + int getLength() { return length; } + + // Add an element. + void add(Object *elem); + + // Accessors. + Object *get(int i, Object *obj); + Object *getNF(int i, Object *obj); + +private: + + Object *elems; // array of elements + int size; // size of array + int length; // number of elements in array + int ref; // reference count +}; + +#endif diff --git a/pdf/xpdf/CMapInfo.h b/pdf/xpdf/CMapInfo.h new file mode 100644 index 00000000..ef92c78f --- /dev/null +++ b/pdf/xpdf/CMapInfo.h @@ -0,0 +1,15630 @@ +//======================================================================== +// +// CMapInfo.h +// +// This file was automatically generated by makeCMapInfo. +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifndef CMAPINFO_H +#define CMAPINFO_H + +static Gushort japan1278EUCHMap2[1252] = { + 0x0000, 0x0000, + 0x8ea0, 0x0146, + 0xa1a1, 0x0279, + 0xa2a1, 0x02d7, + 0xa3b0, 0x030c, + 0xa3c1, 0x0316, + 0xa3e1, 0x0330, + 0xa4a1, 0x034a, + 0xa5a1, 0x039d, + 0xa6a1, 0x03f3, + 0xa6c1, 0x040b, + 0xa7a1, 0x0423, + 0xa7d1, 0x0444, + 0xb0a1, 0x0465, + 0xb0a2, 0x1dd1, + 0xb0a3, 0x0467, + 0xb0a9, 0x204a, + 0xb0aa, 0x046e, + 0xb0b2, 0x1f19, + 0xb0b3, 0x1ca2, + 0xb0b4, 0x0478, + 0xb0bb, 0x1dd2, + 0xb0bc, 0x0480, + 0xb0ee, 0x1dd3, + 0xb0ef, 0x04b3, + 0xb0f3, 0x1dd4, + 0xb0f4, 0x04b8, + 0xb0fc, 0x1dd5, + 0xb0fd, 0x04c1, + 0xb1a1, 0x04c3, + 0xb1aa, 0x1dd6, + 0xb1ab, 0x04cd, + 0xb1b5, 0x1dd7, + 0xb1b6, 0x04d8, + 0xb1b9, 0x1dd8, + 0xb1ba, 0x04dc, + 0xb1bd, 0x1dda, + 0xb1be, 0x04e0, + 0xb1c2, 0x1ddb, + 0xb1c3, 0x04e5, + 0xb1eb, 0x1ddc, + 0xb1ec, 0x050e, + 0xb2a1, 0x0521, + 0xb2a8, 0x1ddd, + 0xb2a9, 0x1cc9, + 0xb2aa, 0x1dde, + 0xb2ab, 0x052b, + 0xb2e0, 0x1ddf, + 0xb2e1, 0x0561, + 0xb2fa, 0x1de0, + 0xb2fb, 0x057b, + 0xb2fd, 0x1de1, + 0xb2fe, 0x057e, + 0xb3a1, 0x057f, + 0xb3a2, 0x1de2, + 0xb3a3, 0x0581, + 0xb3c2, 0x1961, + 0xb3c3, 0x05a1, + 0xb3c9, 0x139f, + 0xb3ca, 0x05a8, + 0xb3e5, 0x1de3, + 0xb3e6, 0x05c4, + 0xb3eb, 0x1de4, + 0xb3ec, 0x05ca, + 0xb3f3, 0x1de5, + 0xb3f4, 0x05d2, + 0xb3f6, 0x1731, + 0xb3f7, 0x05d5, + 0xb3fa, 0x1de6, + 0xb3fb, 0x05d9, + 0xb4a1, 0x05dd, + 0xb4c2, 0x1de7, + 0xb4c3, 0x1572, + 0xb4c4, 0x0600, + 0xb4cd, 0x1de8, + 0xb4ce, 0x060a, + 0xb4d2, 0x1a20, + 0xb4d3, 0x060f, + 0xb4e5, 0x1de9, + 0xb4e6, 0x0622, + 0xb5a1, 0x063b, + 0xb5ab, 0x1dea, + 0xb5ac, 0x0646, + 0xb5c0, 0x1deb, + 0xb5c1, 0x065b, + 0xb6a1, 0x0699, + 0xb6a2, 0x1dec, + 0xb6a3, 0x069b, + 0xb6aa, 0x1ded, + 0xb6ab, 0x06a3, + 0xb6c6, 0x1d32, + 0xb6c7, 0x06bf, + 0xb6cf, 0x1dee, + 0xb6d0, 0x06c8, + 0xb6ed, 0x1def, + 0xb6ee, 0x06e6, + 0xb6f4, 0x1df0, + 0xb6f5, 0x06ed, + 0xb6fb, 0x1df1, + 0xb6fc, 0x06f4, + 0xb6fd, 0x1df2, + 0xb6fe, 0x06f6, + 0xb7a1, 0x06f7, + 0xb7a4, 0x1df3, + 0xb7a5, 0x06fb, + 0xb7b7, 0x1df4, + 0xb7b8, 0x070e, + 0xb7c5, 0x1df5, + 0xb7c6, 0x071c, + 0xb7ce, 0x1df6, + 0xb7cf, 0x0725, + 0xb7d2, 0x1df7, + 0xb7d3, 0x0729, + 0xb7d5, 0x1df8, + 0xb7d6, 0x072c, + 0xb7db, 0x1c0d, + 0xb7dc, 0x0732, + 0xb7e4, 0x1df9, + 0xb7e5, 0x073b, + 0xb7f1, 0x1dfa, + 0xb7f2, 0x0748, + 0xb7f9, 0x1dfb, + 0xb7fa, 0x0750, + 0xb7fe, 0x1dfc, + 0xb8a1, 0x0755, + 0xb8b4, 0x1dfd, + 0xb8b5, 0x0769, + 0xb8c1, 0x1dfe, + 0xb8c2, 0x0776, + 0xb9a1, 0x07b3, + 0xb9ab, 0x1dff, + 0xb9ac, 0x07be, + 0xb9b7, 0x1e00, + 0xb9b8, 0x07ca, + 0xb9c2, 0x1e01, + 0xb9c3, 0x07d5, + 0xb9dc, 0x16dd, + 0xb9dd, 0x07ef, + 0xb9ed, 0x1e02, + 0xb9ee, 0x0800, + 0xb9f4, 0x1e03, + 0xb9f5, 0x0807, + 0xb9f9, 0x1e04, + 0xb9fa, 0x080c, + 0xbaa1, 0x0811, + 0xbad3, 0x1e05, + 0xbad4, 0x0844, + 0xbae7, 0x1e06, + 0xbae8, 0x0858, + 0xbaf4, 0x1e07, + 0xbaf5, 0x0865, + 0xbba1, 0x086f, + 0xbba7, 0x1e08, + 0xbba8, 0x0876, + 0xbbaa, 0x1e09, + 0xbbab, 0x0879, + 0xbbac, 0x1e0a, + 0xbbad, 0x087b, + 0xbbb9, 0x1e0b, + 0xbbba, 0x0888, + 0xbca1, 0x08cd, + 0xbcc8, 0x1e0d, + 0xbcc9, 0x1929, + 0xbcca, 0x08f6, + 0xbcd7, 0x1e0e, + 0xbcd8, 0x0904, + 0xbcdd, 0x1e0f, + 0xbcdf, 0x090b, + 0xbda1, 0x092b, + 0xbdab, 0x1e11, + 0xbdac, 0x0936, + 0xbdb6, 0x1e12, + 0xbdb7, 0x0941, + 0xbdec, 0x1e13, + 0xbdee, 0x0978, + 0xbdf2, 0x1e15, + 0xbdf4, 0x097e, + 0xbea1, 0x0989, + 0xbea5, 0x1e17, + 0xbea6, 0x098e, + 0xbeb3, 0x1e18, + 0xbeb4, 0x099c, + 0xbebf, 0x1e19, + 0xbec0, 0x09a8, + 0xbed5, 0x1e1a, + 0xbed6, 0x09be, + 0xbedf, 0x1e1b, + 0xbee0, 0x09c8, + 0xbee4, 0x1e1c, + 0xbee5, 0x09cd, + 0xbfa1, 0x09e7, + 0xbfaa, 0x1e1d, + 0xbfab, 0x09f1, + 0xbfd9, 0x1e1e, + 0xbfda, 0x0a20, + 0xbfe0, 0x1e1f, + 0xbfe1, 0x0a27, + 0xbfe9, 0x1e20, + 0xbfea, 0x0a30, + 0xc0a1, 0x0a45, + 0xc0a2, 0x1e21, + 0xc0a3, 0x0a47, + 0xc0c2, 0x1e22, + 0xc0c3, 0x0a67, + 0xc0e6, 0x1e23, + 0xc0e7, 0x0a8b, + 0xc0f1, 0x1e24, + 0xc0f3, 0x0a97, + 0xc0f9, 0x1e26, + 0xc0fb, 0x0a9f, + 0xc1a1, 0x0aa3, + 0xc1a7, 0x1e28, + 0xc1a8, 0x1a6e, + 0xc1a9, 0x0aab, + 0xc1b9, 0x1e29, + 0xc1ba, 0x0abc, + 0xc1cc, 0x1e2a, + 0xc1cd, 0x0acf, + 0xc1cf, 0x1e2b, + 0xc1d0, 0x0ad2, + 0xc1df, 0x1e2c, + 0xc1e0, 0x0ae2, + 0xc1e9, 0x1e2d, + 0xc1ea, 0x0aec, + 0xc2a1, 0x0b01, + 0xc2bd, 0x1e2e, + 0xc2be, 0x0b1e, + 0xc2cd, 0x1e2f, + 0xc2ce, 0x0b2e, + 0xc2dc, 0x1e30, + 0xc2dd, 0x0b3d, + 0xc2e3, 0x1e31, + 0xc2e4, 0x0b44, + 0xc2ef, 0x1e32, + 0xc2f0, 0x0b50, + 0xc2f5, 0x1e33, + 0xc2f7, 0x0b57, + 0xc2fd, 0x1e35, + 0xc2fe, 0x0b5e, + 0xc3a1, 0x0b5f, + 0xc3a7, 0x1e36, + 0xc3a8, 0x0b66, + 0xc3a9, 0x1e37, + 0xc3ab, 0x0b69, + 0xc3ad, 0x1e39, + 0xc3af, 0x0b6d, + 0xc3bd, 0x1e3b, + 0xc3be, 0x0b7c, + 0xc3f0, 0x1e3c, + 0xc3f1, 0x0baf, + 0xc3f5, 0x1e3d, + 0xc3f6, 0x0bb4, + 0xc3fc, 0x1e3e, + 0xc3fd, 0x0bbb, + 0xc4a1, 0x0bbd, + 0xc4bd, 0x1e3f, + 0xc4be, 0x0bda, + 0xc4c8, 0x1e40, + 0xc4c9, 0x0be5, + 0xc4ca, 0x1e41, + 0xc4cb, 0x0be7, + 0xc4cd, 0x1e42, + 0xc4ce, 0x0bea, + 0xc4cf, 0x1e43, + 0xc4d0, 0x0bec, + 0xc4d4, 0x204b, + 0xc4d5, 0x0bf1, + 0xc4db, 0x11b5, + 0xc4dc, 0x0bf8, + 0xc5a1, 0x0c1b, + 0xc5a2, 0x1e44, + 0xc5a3, 0x0c1d, + 0xc5a7, 0x1e45, + 0xc5a8, 0x0c22, + 0xc5ae, 0x1e46, + 0xc5af, 0x0c29, + 0xc5b6, 0x1e47, + 0xc5b7, 0x0c31, + 0xc5bf, 0x1e48, + 0xc5c0, 0x0c3a, + 0xc5c8, 0x1e49, + 0xc5c9, 0x0c43, + 0xc5cb, 0x1e4a, + 0xc5cc, 0x0c46, + 0xc5d1, 0x1e4b, + 0xc5d3, 0x0c4d, + 0xc5d7, 0x16df, + 0xc5d8, 0x0c52, + 0xc5e4, 0x1e4d, + 0xc5e5, 0x0c5f, + 0xc5ee, 0x1450, + 0xc5ef, 0x0c69, + 0xc5f3, 0x1536, + 0xc5f4, 0x0c6e, + 0xc5f8, 0x1e4e, + 0xc5f9, 0x0c73, + 0xc6a1, 0x0c79, + 0xc6be, 0x1e4f, + 0xc6bf, 0x0c97, + 0xc6c2, 0x1e50, + 0xc6c3, 0x0c9b, + 0xc6d4, 0x1e51, + 0xc6d6, 0x0cae, + 0xc6db, 0x1e53, + 0xc6dd, 0x0cb5, + 0xc6e1, 0x1e55, + 0xc6e2, 0x0cba, + 0xc6e6, 0x1e56, + 0xc6e8, 0x0cc0, + 0xc6ea, 0x1e58, + 0xc6eb, 0x0cc3, + 0xc6f6, 0x1aed, + 0xc6f7, 0x0ccf, + 0xc7a1, 0x0cd7, + 0xc7a9, 0x1e59, + 0xc7aa, 0x0ce0, + 0xc7b9, 0x1e5a, + 0xc7ba, 0x0cf0, + 0xc7d7, 0x1e5b, + 0xc7d8, 0x0d0e, + 0xc7e7, 0x1e5c, + 0xc7e8, 0x1989, + 0xc7e9, 0x1e5d, + 0xc7ea, 0x0d20, + 0xc7ed, 0x1e5e, + 0xc7ee, 0x0d24, + 0xc8a1, 0x0d35, + 0xc8a4, 0x1e5f, + 0xc8a5, 0x0d39, + 0xc8ae, 0x1e60, + 0xc8af, 0x0d43, + 0xc8b0, 0x1e61, + 0xc8b1, 0x0d45, + 0xc8d4, 0x1e62, + 0xc8d5, 0x0d69, + 0xc8e2, 0x1e63, + 0xc8e3, 0x0d77, + 0xc8f5, 0x1e64, + 0xc8f6, 0x0d8a, + 0xc9a1, 0x0d93, + 0xc9a2, 0x1e65, + 0xc9a4, 0x0d96, + 0xc9af, 0x1e67, + 0xc9b0, 0x143b, + 0xc9b1, 0x0da3, + 0xc9b2, 0x1e68, + 0xc9b3, 0x0da5, + 0xc9b5, 0x1e69, + 0xc9b6, 0x0da8, + 0xc9c0, 0x1e6a, + 0xc9c1, 0x0db3, + 0xc9ce, 0x1e6b, + 0xc9cf, 0x0dc1, + 0xc9d1, 0x1e6c, + 0xc9d2, 0x0dc4, + 0xcaa1, 0x0df1, + 0xcac3, 0x1e6d, + 0xcac4, 0x0e14, + 0xcacd, 0x1e6e, + 0xcace, 0x0e1e, + 0xcada, 0x1e6f, + 0xcadb, 0x0e2b, + 0xcaf9, 0x1e70, + 0xcafa, 0x0e4a, + 0xcba1, 0x0e4f, + 0xcba2, 0x1e71, + 0xcba3, 0x0e51, + 0xcba9, 0x1e72, + 0xcbaa, 0x0e58, + 0xcbcb, 0x1e73, + 0xcbcc, 0x0e7a, + 0xcbea, 0x1d33, + 0xcbeb, 0x0e99, + 0xcbf0, 0x1e74, + 0xcbf1, 0x0e9f, + 0xcbf8, 0x1f2c, + 0xcbf9, 0x102f, + 0xcbfa, 0x0ea8, + 0xcca1, 0x0ead, + 0xcccd, 0x1e75, + 0xccce, 0x0eda, + 0xccd9, 0x1e76, + 0xccda, 0x0ee6, + 0xccdf, 0x1e77, + 0xcce0, 0x0eec, + 0xcce2, 0x1e78, + 0xcce3, 0x0eef, + 0xccf9, 0x1935, + 0xccfa, 0x1e79, + 0xccfb, 0x0f07, + 0xccfc, 0x1e7a, + 0xccfd, 0x0f09, + 0xccfe, 0x1e7b, + 0xcda1, 0x0f0b, + 0xcdb2, 0x1e7c, + 0xcdb3, 0x0f1d, + 0xcdd0, 0x1e7d, + 0xcdd1, 0x0f3b, + 0xcdd4, 0x1e7e, + 0xcdd5, 0x0f3f, + 0xcdda, 0x1d34, + 0xcddb, 0x0f45, + 0xcde9, 0x1e7f, + 0xcdea, 0x0f54, + 0xcea1, 0x0f69, + 0xcecb, 0x1e80, + 0xcecc, 0x0f94, + 0xcefa, 0x1e81, + 0xcefc, 0x0fc4, + 0xcfa1, 0x1e83, + 0xcfa2, 0x0fc8, + 0xcfb1, 0x1e84, + 0xcfb2, 0x0fd8, + 0xcfb6, 0x1777, + 0xcfb7, 0x0fdd, + 0xcfb9, 0x1e85, + 0xcfba, 0x0fe0, + 0xd0a1, 0x0ffa, + 0xd0d6, 0x0ea7, + 0xd0d7, 0x1030, + 0xd1a1, 0x1058, + 0xd1bd, 0x1e86, + 0xd1be, 0x1075, + 0xd1c7, 0x1e87, + 0xd1c8, 0x107f, + 0xd1cb, 0x1e88, + 0xd1cc, 0x1083, + 0xd1cd, 0x1e89, + 0xd1ce, 0x1085, + 0xd2a1, 0x10b6, + 0xd3a1, 0x1114, + 0xd3b0, 0x1e8a, + 0xd3b1, 0x1124, + 0xd3ba, 0x1e8b, + 0xd3bb, 0x112e, + 0xd3de, 0x1e8d, + 0xd3df, 0x1152, + 0xd3eb, 0x1e8e, + 0xd3ec, 0x115f, + 0xd4a1, 0x1172, + 0xd4c4, 0x1e8f, + 0xd4c5, 0x1196, + 0xd4e4, 0x0bf7, + 0xd4e5, 0x11b6, + 0xd5a1, 0x11d0, + 0xd5bd, 0x1e90, + 0xd5be, 0x11ed, + 0xd5e3, 0x1e91, + 0xd5e4, 0x1213, + 0xd6a1, 0x122e, + 0xd6a2, 0x1e92, + 0xd6a3, 0x1230, + 0xd7a1, 0x128c, + 0xd8a1, 0x12ea, + 0xd8a4, 0x1e94, + 0xd8a5, 0x12ee, + 0xd9a1, 0x1348, + 0xd9e0, 0x1e95, + 0xd9e1, 0x1388, + 0xd9ec, 0x1e96, + 0xd9ed, 0x1394, + 0xd9f8, 0x05a7, + 0xd9f9, 0x13a0, + 0xdaa1, 0x13a6, + 0xdab9, 0x1e97, + 0xdaba, 0x13bf, + 0xdacd, 0x1e98, + 0xdace, 0x13d3, + 0xdba1, 0x1404, + 0xdbc5, 0x1e99, + 0xdbc6, 0x1429, + 0xdbca, 0x1e9a, + 0xdbcb, 0x142e, + 0xdbd8, 0x0da2, + 0xdbd9, 0x143c, + 0xdbeb, 0x1e9b, + 0xdbec, 0x144f, + 0xdbed, 0x0c68, + 0xdbee, 0x1451, + 0xdbf4, 0x1e9c, + 0xdbf5, 0x1458, + 0xdca1, 0x1462, + 0xdda1, 0x14c0, + 0xdea1, 0x151e, + 0xdeb9, 0x0c6d, + 0xdeba, 0x1537, + 0xded0, 0x1e9d, + 0xded1, 0x154e, + 0xdef5, 0x05ff, + 0xdef6, 0x1573, + 0xdfa1, 0x157c, + 0xe0a1, 0x15da, + 0xe0a6, 0x1e9f, + 0xe0a7, 0x15e0, + 0xe0df, 0x1ea0, + 0xe0e0, 0x1619, + 0xe0f6, 0x1d35, + 0xe0f7, 0x1630, + 0xe1a1, 0x1638, + 0xe1ab, 0x1ea1, + 0xe1ac, 0x1643, + 0xe1b0, 0x1ea2, + 0xe1b2, 0x1649, + 0xe2a1, 0x1696, + 0xe2ab, 0x1ea4, + 0xe2ac, 0x16a1, + 0xe2e8, 0x07ee, + 0xe2e9, 0x16de, + 0xe2ea, 0x0c51, + 0xe2eb, 0x16e0, + 0xe2ef, 0x1ea5, + 0xe2f0, 0x16e5, + 0xe3a1, 0x16f4, + 0xe3ca, 0x1ea6, + 0xe3cb, 0x171e, + 0xe3d4, 0x1ea7, + 0xe3d5, 0x1728, + 0xe3de, 0x05d4, + 0xe3df, 0x1732, + 0xe4a1, 0x1752, + 0xe4b9, 0x1ea8, + 0xe4ba, 0x176b, + 0xe4c6, 0x0fdc, + 0xe4c7, 0x1778, + 0xe4e4, 0x1ea9, + 0xe4e5, 0x1796, + 0xe4ee, 0x1eaa, + 0xe4ef, 0x17a0, + 0xe5a1, 0x17b0, + 0xe5b9, 0x1eab, + 0xe5ba, 0x17c9, + 0xe5bb, 0x1eac, + 0xe5bc, 0x17cb, + 0xe5c6, 0x1ead, + 0xe5c7, 0x17d6, + 0xe6a1, 0x180e, + 0xe6c6, 0x1eae, + 0xe6c7, 0x1834, + 0xe7a1, 0x186c, + 0xe7e4, 0x1eaf, + 0xe7e5, 0x18b0, + 0xe7e9, 0x1eb0, + 0xe7ea, 0x18b5, + 0xe7f2, 0x1eb1, + 0xe7f3, 0x18be, + 0xe8a1, 0x18ca, + 0xe8b4, 0x1eb2, + 0xe8b5, 0x18de, + 0xe8bb, 0x1eb3, + 0xe8bc, 0x18e5, + 0xe8f4, 0x1eb4, + 0xe8f5, 0x191e, + 0xe9a1, 0x1928, + 0xe9a2, 0x08f5, + 0xe9a3, 0x192a, + 0xe9ae, 0x0f05, + 0xe9af, 0x1936, + 0xe9da, 0x05a0, + 0xe9db, 0x1962, + 0xeaa1, 0x1986, + 0xeaa4, 0x0d1e, + 0xeaa5, 0x198a, + 0xeaa7, 0x1eb6, + 0xeaa8, 0x198d, + 0xeabd, 0x1eb7, + 0xeabe, 0x19a3, + 0xeaef, 0x1eb8, + 0xeaf0, 0x19d5, + 0xeba1, 0x19e4, + 0xebb2, 0x1eb9, + 0xebb3, 0x19f6, + 0xebdd, 0x060e, + 0xebde, 0x1a21, + 0xebe6, 0x1eba, + 0xebe7, 0x1a2a, + 0xebf6, 0x1ebb, + 0xebf7, 0x1a3a, + 0xeca1, 0x1a42, + 0xeccd, 0x0aaa, + 0xecce, 0x1a6f, + 0xece9, 0x1ebc, + 0xecea, 0x1a8b, + 0xecf4, 0x1ebd, + 0xecf5, 0x1a96, + 0xeda1, 0x1aa0, + 0xedce, 0x1ebe, + 0xedcf, 0x1ace, + 0xedec, 0x1ebf, + 0xeded, 0x1aec, + 0xedee, 0x1ec0, + 0xedef, 0x1aee, + 0xeea1, 0x1afe, + 0xeea9, 0x1ec1, + 0xeeaa, 0x1b07, + 0xeebd, 0x1ec2, + 0xeebe, 0x1b1b, + 0xeed7, 0x1ec3, + 0xeed8, 0x1b35, + 0xefa1, 0x1b5c, + 0xf0a1, 0x1bba, + 0xf0c5, 0x1ec6, + 0xf0c6, 0x1bdf, + 0xf0d1, 0x1ec7, + 0xf0d2, 0x1beb, + 0xf0d7, 0x1ec8, + 0xf0d8, 0x1bf1, + 0xf0f4, 0x0731, + 0xf0f5, 0x1ec9, + 0xf0f6, 0x1c0f, + 0xf1a1, 0x1c18, + 0xf2a1, 0x1c76, + 0xf2ad, 0x1eca, + 0xf2ae, 0x1c83, + 0xf2bc, 0x1ecb, + 0xf2bd, 0x1c92, + 0xf2cd, 0x0477, + 0xf2ce, 0x1ecc, + 0xf2cf, 0x1ca4, + 0xf2f4, 0x0529, + 0xf2f5, 0x1cca, + 0xf3a1, 0x1cd4, + 0xf3d1, 0x1ecd, + 0xf3d2, 0x1d05, + 0xf3fd, 0x1ece, + 0xf3fe, 0x1d31, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1278EUCHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan1278EUCHMap2, 626 +}; + +static Gushort japan1278HMap2[1250] = { + 0x0000, 0x0000, + 0x2121, 0x0279, + 0x2221, 0x02d7, + 0x2330, 0x030c, + 0x2341, 0x0316, + 0x2361, 0x0330, + 0x2421, 0x034a, + 0x2521, 0x039d, + 0x2621, 0x03f3, + 0x2641, 0x040b, + 0x2721, 0x0423, + 0x2751, 0x0444, + 0x3021, 0x0465, + 0x3022, 0x1dd1, + 0x3023, 0x0467, + 0x3029, 0x204a, + 0x302a, 0x046e, + 0x3032, 0x1f19, + 0x3033, 0x1ca2, + 0x3034, 0x0478, + 0x303b, 0x1dd2, + 0x303c, 0x0480, + 0x306e, 0x1dd3, + 0x306f, 0x04b3, + 0x3073, 0x1dd4, + 0x3074, 0x04b8, + 0x307c, 0x1dd5, + 0x307d, 0x04c1, + 0x3121, 0x04c3, + 0x312a, 0x1dd6, + 0x312b, 0x04cd, + 0x3135, 0x1dd7, + 0x3136, 0x04d8, + 0x3139, 0x1dd8, + 0x313a, 0x04dc, + 0x313d, 0x1dda, + 0x313e, 0x04e0, + 0x3142, 0x1ddb, + 0x3143, 0x04e5, + 0x316b, 0x1ddc, + 0x316c, 0x050e, + 0x3221, 0x0521, + 0x3228, 0x1ddd, + 0x3229, 0x1cc9, + 0x322a, 0x1dde, + 0x322b, 0x052b, + 0x3260, 0x1ddf, + 0x3261, 0x0561, + 0x327a, 0x1de0, + 0x327b, 0x057b, + 0x327d, 0x1de1, + 0x327e, 0x057e, + 0x3321, 0x057f, + 0x3322, 0x1de2, + 0x3323, 0x0581, + 0x3342, 0x1961, + 0x3343, 0x05a1, + 0x3349, 0x139f, + 0x334a, 0x05a8, + 0x3365, 0x1de3, + 0x3366, 0x05c4, + 0x336b, 0x1de4, + 0x336c, 0x05ca, + 0x3373, 0x1de5, + 0x3374, 0x05d2, + 0x3376, 0x1731, + 0x3377, 0x05d5, + 0x337a, 0x1de6, + 0x337b, 0x05d9, + 0x3421, 0x05dd, + 0x3442, 0x1de7, + 0x3443, 0x1572, + 0x3444, 0x0600, + 0x344d, 0x1de8, + 0x344e, 0x060a, + 0x3452, 0x1a20, + 0x3453, 0x060f, + 0x3465, 0x1de9, + 0x3466, 0x0622, + 0x3521, 0x063b, + 0x352b, 0x1dea, + 0x352c, 0x0646, + 0x3540, 0x1deb, + 0x3541, 0x065b, + 0x3621, 0x0699, + 0x3622, 0x1dec, + 0x3623, 0x069b, + 0x362a, 0x1ded, + 0x362b, 0x06a3, + 0x3646, 0x1d32, + 0x3647, 0x06bf, + 0x364f, 0x1dee, + 0x3650, 0x06c8, + 0x366d, 0x1def, + 0x366e, 0x06e6, + 0x3674, 0x1df0, + 0x3675, 0x06ed, + 0x367b, 0x1df1, + 0x367c, 0x06f4, + 0x367d, 0x1df2, + 0x367e, 0x06f6, + 0x3721, 0x06f7, + 0x3724, 0x1df3, + 0x3725, 0x06fb, + 0x3737, 0x1df4, + 0x3738, 0x070e, + 0x3745, 0x1df5, + 0x3746, 0x071c, + 0x374e, 0x1df6, + 0x374f, 0x0725, + 0x3752, 0x1df7, + 0x3753, 0x0729, + 0x3755, 0x1df8, + 0x3756, 0x072c, + 0x375b, 0x1c0d, + 0x375c, 0x0732, + 0x3764, 0x1df9, + 0x3765, 0x073b, + 0x3771, 0x1dfa, + 0x3772, 0x0748, + 0x3779, 0x1dfb, + 0x377a, 0x0750, + 0x377e, 0x1dfc, + 0x3821, 0x0755, + 0x3834, 0x1dfd, + 0x3835, 0x0769, + 0x3841, 0x1dfe, + 0x3842, 0x0776, + 0x3921, 0x07b3, + 0x392b, 0x1dff, + 0x392c, 0x07be, + 0x3937, 0x1e00, + 0x3938, 0x07ca, + 0x3942, 0x1e01, + 0x3943, 0x07d5, + 0x395c, 0x16dd, + 0x395d, 0x07ef, + 0x396d, 0x1e02, + 0x396e, 0x0800, + 0x3974, 0x1e03, + 0x3975, 0x0807, + 0x3979, 0x1e04, + 0x397a, 0x080c, + 0x3a21, 0x0811, + 0x3a53, 0x1e05, + 0x3a54, 0x0844, + 0x3a67, 0x1e06, + 0x3a68, 0x0858, + 0x3a74, 0x1e07, + 0x3a75, 0x0865, + 0x3b21, 0x086f, + 0x3b27, 0x1e08, + 0x3b28, 0x0876, + 0x3b2a, 0x1e09, + 0x3b2b, 0x0879, + 0x3b2c, 0x1e0a, + 0x3b2d, 0x087b, + 0x3b39, 0x1e0b, + 0x3b3a, 0x0888, + 0x3c21, 0x08cd, + 0x3c48, 0x1e0d, + 0x3c49, 0x1929, + 0x3c4a, 0x08f6, + 0x3c57, 0x1e0e, + 0x3c58, 0x0904, + 0x3c5d, 0x1e0f, + 0x3c5f, 0x090b, + 0x3d21, 0x092b, + 0x3d2b, 0x1e11, + 0x3d2c, 0x0936, + 0x3d36, 0x1e12, + 0x3d37, 0x0941, + 0x3d6c, 0x1e13, + 0x3d6e, 0x0978, + 0x3d72, 0x1e15, + 0x3d74, 0x097e, + 0x3e21, 0x0989, + 0x3e25, 0x1e17, + 0x3e26, 0x098e, + 0x3e33, 0x1e18, + 0x3e34, 0x099c, + 0x3e3f, 0x1e19, + 0x3e40, 0x09a8, + 0x3e55, 0x1e1a, + 0x3e56, 0x09be, + 0x3e5f, 0x1e1b, + 0x3e60, 0x09c8, + 0x3e64, 0x1e1c, + 0x3e65, 0x09cd, + 0x3f21, 0x09e7, + 0x3f2a, 0x1e1d, + 0x3f2b, 0x09f1, + 0x3f59, 0x1e1e, + 0x3f5a, 0x0a20, + 0x3f60, 0x1e1f, + 0x3f61, 0x0a27, + 0x3f69, 0x1e20, + 0x3f6a, 0x0a30, + 0x4021, 0x0a45, + 0x4022, 0x1e21, + 0x4023, 0x0a47, + 0x4042, 0x1e22, + 0x4043, 0x0a67, + 0x4066, 0x1e23, + 0x4067, 0x0a8b, + 0x4071, 0x1e24, + 0x4073, 0x0a97, + 0x4079, 0x1e26, + 0x407b, 0x0a9f, + 0x4121, 0x0aa3, + 0x4127, 0x1e28, + 0x4128, 0x1a6e, + 0x4129, 0x0aab, + 0x4139, 0x1e29, + 0x413a, 0x0abc, + 0x414c, 0x1e2a, + 0x414d, 0x0acf, + 0x414f, 0x1e2b, + 0x4150, 0x0ad2, + 0x415f, 0x1e2c, + 0x4160, 0x0ae2, + 0x4169, 0x1e2d, + 0x416a, 0x0aec, + 0x4221, 0x0b01, + 0x423d, 0x1e2e, + 0x423e, 0x0b1e, + 0x424d, 0x1e2f, + 0x424e, 0x0b2e, + 0x425c, 0x1e30, + 0x425d, 0x0b3d, + 0x4263, 0x1e31, + 0x4264, 0x0b44, + 0x426f, 0x1e32, + 0x4270, 0x0b50, + 0x4275, 0x1e33, + 0x4277, 0x0b57, + 0x427d, 0x1e35, + 0x427e, 0x0b5e, + 0x4321, 0x0b5f, + 0x4327, 0x1e36, + 0x4328, 0x0b66, + 0x4329, 0x1e37, + 0x432b, 0x0b69, + 0x432d, 0x1e39, + 0x432f, 0x0b6d, + 0x433d, 0x1e3b, + 0x433e, 0x0b7c, + 0x4370, 0x1e3c, + 0x4371, 0x0baf, + 0x4375, 0x1e3d, + 0x4376, 0x0bb4, + 0x437c, 0x1e3e, + 0x437d, 0x0bbb, + 0x4421, 0x0bbd, + 0x443d, 0x1e3f, + 0x443e, 0x0bda, + 0x4448, 0x1e40, + 0x4449, 0x0be5, + 0x444a, 0x1e41, + 0x444b, 0x0be7, + 0x444d, 0x1e42, + 0x444e, 0x0bea, + 0x444f, 0x1e43, + 0x4450, 0x0bec, + 0x4454, 0x204b, + 0x4455, 0x0bf1, + 0x445b, 0x11b5, + 0x445c, 0x0bf8, + 0x4521, 0x0c1b, + 0x4522, 0x1e44, + 0x4523, 0x0c1d, + 0x4527, 0x1e45, + 0x4528, 0x0c22, + 0x452e, 0x1e46, + 0x452f, 0x0c29, + 0x4536, 0x1e47, + 0x4537, 0x0c31, + 0x453f, 0x1e48, + 0x4540, 0x0c3a, + 0x4548, 0x1e49, + 0x4549, 0x0c43, + 0x454b, 0x1e4a, + 0x454c, 0x0c46, + 0x4551, 0x1e4b, + 0x4553, 0x0c4d, + 0x4557, 0x16df, + 0x4558, 0x0c52, + 0x4564, 0x1e4d, + 0x4565, 0x0c5f, + 0x456e, 0x1450, + 0x456f, 0x0c69, + 0x4573, 0x1536, + 0x4574, 0x0c6e, + 0x4578, 0x1e4e, + 0x4579, 0x0c73, + 0x4621, 0x0c79, + 0x463e, 0x1e4f, + 0x463f, 0x0c97, + 0x4642, 0x1e50, + 0x4643, 0x0c9b, + 0x4654, 0x1e51, + 0x4656, 0x0cae, + 0x465b, 0x1e53, + 0x465d, 0x0cb5, + 0x4661, 0x1e55, + 0x4662, 0x0cba, + 0x4666, 0x1e56, + 0x4668, 0x0cc0, + 0x466a, 0x1e58, + 0x466b, 0x0cc3, + 0x4676, 0x1aed, + 0x4677, 0x0ccf, + 0x4721, 0x0cd7, + 0x4729, 0x1e59, + 0x472a, 0x0ce0, + 0x4739, 0x1e5a, + 0x473a, 0x0cf0, + 0x4757, 0x1e5b, + 0x4758, 0x0d0e, + 0x4767, 0x1e5c, + 0x4768, 0x1989, + 0x4769, 0x1e5d, + 0x476a, 0x0d20, + 0x476d, 0x1e5e, + 0x476e, 0x0d24, + 0x4821, 0x0d35, + 0x4824, 0x1e5f, + 0x4825, 0x0d39, + 0x482e, 0x1e60, + 0x482f, 0x0d43, + 0x4830, 0x1e61, + 0x4831, 0x0d45, + 0x4854, 0x1e62, + 0x4855, 0x0d69, + 0x4862, 0x1e63, + 0x4863, 0x0d77, + 0x4875, 0x1e64, + 0x4876, 0x0d8a, + 0x4921, 0x0d93, + 0x4922, 0x1e65, + 0x4924, 0x0d96, + 0x492f, 0x1e67, + 0x4930, 0x143b, + 0x4931, 0x0da3, + 0x4932, 0x1e68, + 0x4933, 0x0da5, + 0x4935, 0x1e69, + 0x4936, 0x0da8, + 0x4940, 0x1e6a, + 0x4941, 0x0db3, + 0x494e, 0x1e6b, + 0x494f, 0x0dc1, + 0x4951, 0x1e6c, + 0x4952, 0x0dc4, + 0x4a21, 0x0df1, + 0x4a43, 0x1e6d, + 0x4a44, 0x0e14, + 0x4a4d, 0x1e6e, + 0x4a4e, 0x0e1e, + 0x4a5a, 0x1e6f, + 0x4a5b, 0x0e2b, + 0x4a79, 0x1e70, + 0x4a7a, 0x0e4a, + 0x4b21, 0x0e4f, + 0x4b22, 0x1e71, + 0x4b23, 0x0e51, + 0x4b29, 0x1e72, + 0x4b2a, 0x0e58, + 0x4b4b, 0x1e73, + 0x4b4c, 0x0e7a, + 0x4b6a, 0x1d33, + 0x4b6b, 0x0e99, + 0x4b70, 0x1e74, + 0x4b71, 0x0e9f, + 0x4b78, 0x1f2c, + 0x4b79, 0x102f, + 0x4b7a, 0x0ea8, + 0x4c21, 0x0ead, + 0x4c4d, 0x1e75, + 0x4c4e, 0x0eda, + 0x4c59, 0x1e76, + 0x4c5a, 0x0ee6, + 0x4c5f, 0x1e77, + 0x4c60, 0x0eec, + 0x4c62, 0x1e78, + 0x4c63, 0x0eef, + 0x4c79, 0x1935, + 0x4c7a, 0x1e79, + 0x4c7b, 0x0f07, + 0x4c7c, 0x1e7a, + 0x4c7d, 0x0f09, + 0x4c7e, 0x1e7b, + 0x4d21, 0x0f0b, + 0x4d32, 0x1e7c, + 0x4d33, 0x0f1d, + 0x4d50, 0x1e7d, + 0x4d51, 0x0f3b, + 0x4d54, 0x1e7e, + 0x4d55, 0x0f3f, + 0x4d5a, 0x1d34, + 0x4d5b, 0x0f45, + 0x4d69, 0x1e7f, + 0x4d6a, 0x0f54, + 0x4e21, 0x0f69, + 0x4e4b, 0x1e80, + 0x4e4c, 0x0f94, + 0x4e7a, 0x1e81, + 0x4e7c, 0x0fc4, + 0x4f21, 0x1e83, + 0x4f22, 0x0fc8, + 0x4f31, 0x1e84, + 0x4f32, 0x0fd8, + 0x4f36, 0x1777, + 0x4f37, 0x0fdd, + 0x4f39, 0x1e85, + 0x4f3a, 0x0fe0, + 0x5021, 0x0ffa, + 0x5056, 0x0ea7, + 0x5057, 0x1030, + 0x5121, 0x1058, + 0x513d, 0x1e86, + 0x513e, 0x1075, + 0x5147, 0x1e87, + 0x5148, 0x107f, + 0x514b, 0x1e88, + 0x514c, 0x1083, + 0x514d, 0x1e89, + 0x514e, 0x1085, + 0x5221, 0x10b6, + 0x5321, 0x1114, + 0x5330, 0x1e8a, + 0x5331, 0x1124, + 0x533a, 0x1e8b, + 0x533b, 0x112e, + 0x535e, 0x1e8d, + 0x535f, 0x1152, + 0x536b, 0x1e8e, + 0x536c, 0x115f, + 0x5421, 0x1172, + 0x5444, 0x1e8f, + 0x5445, 0x1196, + 0x5464, 0x0bf7, + 0x5465, 0x11b6, + 0x5521, 0x11d0, + 0x553d, 0x1e90, + 0x553e, 0x11ed, + 0x5563, 0x1e91, + 0x5564, 0x1213, + 0x5621, 0x122e, + 0x5622, 0x1e92, + 0x5623, 0x1230, + 0x5721, 0x128c, + 0x5821, 0x12ea, + 0x5824, 0x1e94, + 0x5825, 0x12ee, + 0x5921, 0x1348, + 0x5960, 0x1e95, + 0x5961, 0x1388, + 0x596c, 0x1e96, + 0x596d, 0x1394, + 0x5978, 0x05a7, + 0x5979, 0x13a0, + 0x5a21, 0x13a6, + 0x5a39, 0x1e97, + 0x5a3a, 0x13bf, + 0x5a4d, 0x1e98, + 0x5a4e, 0x13d3, + 0x5b21, 0x1404, + 0x5b45, 0x1e99, + 0x5b46, 0x1429, + 0x5b4a, 0x1e9a, + 0x5b4b, 0x142e, + 0x5b58, 0x0da2, + 0x5b59, 0x143c, + 0x5b6b, 0x1e9b, + 0x5b6c, 0x144f, + 0x5b6d, 0x0c68, + 0x5b6e, 0x1451, + 0x5b74, 0x1e9c, + 0x5b75, 0x1458, + 0x5c21, 0x1462, + 0x5d21, 0x14c0, + 0x5e21, 0x151e, + 0x5e39, 0x0c6d, + 0x5e3a, 0x1537, + 0x5e50, 0x1e9d, + 0x5e51, 0x154e, + 0x5e75, 0x05ff, + 0x5e76, 0x1573, + 0x5f21, 0x157c, + 0x6021, 0x15da, + 0x6026, 0x1e9f, + 0x6027, 0x15e0, + 0x605f, 0x1ea0, + 0x6060, 0x1619, + 0x6076, 0x1d35, + 0x6077, 0x1630, + 0x6121, 0x1638, + 0x612b, 0x1ea1, + 0x612c, 0x1643, + 0x6130, 0x1ea2, + 0x6132, 0x1649, + 0x6221, 0x1696, + 0x622b, 0x1ea4, + 0x622c, 0x16a1, + 0x6268, 0x07ee, + 0x6269, 0x16de, + 0x626a, 0x0c51, + 0x626b, 0x16e0, + 0x626f, 0x1ea5, + 0x6270, 0x16e5, + 0x6321, 0x16f4, + 0x634a, 0x1ea6, + 0x634b, 0x171e, + 0x6354, 0x1ea7, + 0x6355, 0x1728, + 0x635e, 0x05d4, + 0x635f, 0x1732, + 0x6421, 0x1752, + 0x6439, 0x1ea8, + 0x643a, 0x176b, + 0x6446, 0x0fdc, + 0x6447, 0x1778, + 0x6464, 0x1ea9, + 0x6465, 0x1796, + 0x646e, 0x1eaa, + 0x646f, 0x17a0, + 0x6521, 0x17b0, + 0x6539, 0x1eab, + 0x653a, 0x17c9, + 0x653b, 0x1eac, + 0x653c, 0x17cb, + 0x6546, 0x1ead, + 0x6547, 0x17d6, + 0x6621, 0x180e, + 0x6646, 0x1eae, + 0x6647, 0x1834, + 0x6721, 0x186c, + 0x6764, 0x1eaf, + 0x6765, 0x18b0, + 0x6769, 0x1eb0, + 0x676a, 0x18b5, + 0x6772, 0x1eb1, + 0x6773, 0x18be, + 0x6821, 0x18ca, + 0x6834, 0x1eb2, + 0x6835, 0x18de, + 0x683b, 0x1eb3, + 0x683c, 0x18e5, + 0x6874, 0x1eb4, + 0x6875, 0x191e, + 0x6921, 0x1928, + 0x6922, 0x08f5, + 0x6923, 0x192a, + 0x692e, 0x0f05, + 0x692f, 0x1936, + 0x695a, 0x05a0, + 0x695b, 0x1962, + 0x6a21, 0x1986, + 0x6a24, 0x0d1e, + 0x6a25, 0x198a, + 0x6a27, 0x1eb6, + 0x6a28, 0x198d, + 0x6a3d, 0x1eb7, + 0x6a3e, 0x19a3, + 0x6a6f, 0x1eb8, + 0x6a70, 0x19d5, + 0x6b21, 0x19e4, + 0x6b32, 0x1eb9, + 0x6b33, 0x19f6, + 0x6b5d, 0x060e, + 0x6b5e, 0x1a21, + 0x6b66, 0x1eba, + 0x6b67, 0x1a2a, + 0x6b76, 0x1ebb, + 0x6b77, 0x1a3a, + 0x6c21, 0x1a42, + 0x6c4d, 0x0aaa, + 0x6c4e, 0x1a6f, + 0x6c69, 0x1ebc, + 0x6c6a, 0x1a8b, + 0x6c74, 0x1ebd, + 0x6c75, 0x1a96, + 0x6d21, 0x1aa0, + 0x6d4e, 0x1ebe, + 0x6d4f, 0x1ace, + 0x6d6c, 0x1ebf, + 0x6d6d, 0x1aec, + 0x6d6e, 0x1ec0, + 0x6d6f, 0x1aee, + 0x6e21, 0x1afe, + 0x6e29, 0x1ec1, + 0x6e2a, 0x1b07, + 0x6e3d, 0x1ec2, + 0x6e3e, 0x1b1b, + 0x6e57, 0x1ec3, + 0x6e58, 0x1b35, + 0x6f21, 0x1b5c, + 0x7021, 0x1bba, + 0x7045, 0x1ec6, + 0x7046, 0x1bdf, + 0x7051, 0x1ec7, + 0x7052, 0x1beb, + 0x7057, 0x1ec8, + 0x7058, 0x1bf1, + 0x7074, 0x0731, + 0x7075, 0x1ec9, + 0x7076, 0x1c0f, + 0x7121, 0x1c18, + 0x7221, 0x1c76, + 0x722d, 0x1eca, + 0x722e, 0x1c83, + 0x723c, 0x1ecb, + 0x723d, 0x1c92, + 0x724d, 0x0477, + 0x724e, 0x1ecc, + 0x724f, 0x1ca4, + 0x7274, 0x0529, + 0x7275, 0x1cca, + 0x7321, 0x1cd4, + 0x7351, 0x1ecd, + 0x7352, 0x1d05, + 0x737d, 0x1ece, + 0x737e, 0x1d31, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1278HEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan1278HMap2, 625 +}; + +static Gushort japan1278RKSJHMap2[1252] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x889f, 0x0465, + 0x88a0, 0x1dd1, + 0x88a1, 0x0467, + 0x88a7, 0x204a, + 0x88a8, 0x046e, + 0x88b0, 0x1f19, + 0x88b1, 0x1ca2, + 0x88b2, 0x0478, + 0x88b9, 0x1dd2, + 0x88ba, 0x0480, + 0x88ec, 0x1dd3, + 0x88ed, 0x04b3, + 0x88f1, 0x1dd4, + 0x88f2, 0x04b8, + 0x88fa, 0x1dd5, + 0x88fb, 0x04c1, + 0x8940, 0x04c3, + 0x8949, 0x1dd6, + 0x894a, 0x04cd, + 0x8954, 0x1dd7, + 0x8955, 0x04d8, + 0x8958, 0x1dd8, + 0x8959, 0x04dc, + 0x895c, 0x1dda, + 0x895d, 0x04e0, + 0x8961, 0x1ddb, + 0x8962, 0x04e5, + 0x8980, 0x0502, + 0x898b, 0x1ddc, + 0x898c, 0x050e, + 0x89a6, 0x1ddd, + 0x89a7, 0x1cc9, + 0x89a8, 0x1dde, + 0x89a9, 0x052b, + 0x89de, 0x1ddf, + 0x89df, 0x0561, + 0x89f8, 0x1de0, + 0x89f9, 0x057b, + 0x89fb, 0x1de1, + 0x89fc, 0x057e, + 0x8a40, 0x057f, + 0x8a41, 0x1de2, + 0x8a42, 0x0581, + 0x8a61, 0x1961, + 0x8a62, 0x05a1, + 0x8a68, 0x139f, + 0x8a69, 0x05a8, + 0x8a80, 0x05be, + 0x8a85, 0x1de3, + 0x8a86, 0x05c4, + 0x8a8b, 0x1de4, + 0x8a8c, 0x05ca, + 0x8a93, 0x1de5, + 0x8a94, 0x05d2, + 0x8a96, 0x1731, + 0x8a97, 0x05d5, + 0x8a9a, 0x1de6, + 0x8a9b, 0x05d9, + 0x8ac0, 0x1de7, + 0x8ac1, 0x1572, + 0x8ac2, 0x0600, + 0x8acb, 0x1de8, + 0x8acc, 0x060a, + 0x8ad0, 0x1a20, + 0x8ad1, 0x060f, + 0x8ae3, 0x1de9, + 0x8ae4, 0x0622, + 0x8b40, 0x063b, + 0x8b4a, 0x1dea, + 0x8b4b, 0x0646, + 0x8b5f, 0x1deb, + 0x8b60, 0x065b, + 0x8b80, 0x067a, + 0x8ba0, 0x1dec, + 0x8ba1, 0x069b, + 0x8ba8, 0x1ded, + 0x8ba9, 0x06a3, + 0x8bc4, 0x1d32, + 0x8bc5, 0x06bf, + 0x8bcd, 0x1dee, + 0x8bce, 0x06c8, + 0x8beb, 0x1def, + 0x8bec, 0x06e6, + 0x8bf2, 0x1df0, + 0x8bf3, 0x06ed, + 0x8bf9, 0x1df1, + 0x8bfa, 0x06f4, + 0x8bfb, 0x1df2, + 0x8bfc, 0x06f6, + 0x8c40, 0x06f7, + 0x8c43, 0x1df3, + 0x8c44, 0x06fb, + 0x8c56, 0x1df4, + 0x8c57, 0x070e, + 0x8c64, 0x1df5, + 0x8c65, 0x071c, + 0x8c6d, 0x1df6, + 0x8c6e, 0x0725, + 0x8c71, 0x1df7, + 0x8c72, 0x0729, + 0x8c74, 0x1df8, + 0x8c75, 0x072c, + 0x8c7a, 0x1c0d, + 0x8c7b, 0x0732, + 0x8c80, 0x0736, + 0x8c84, 0x1df9, + 0x8c85, 0x073b, + 0x8c91, 0x1dfa, + 0x8c92, 0x0748, + 0x8c99, 0x1dfb, + 0x8c9a, 0x0750, + 0x8c9e, 0x1dfc, + 0x8c9f, 0x0755, + 0x8cb2, 0x1dfd, + 0x8cb3, 0x0769, + 0x8cbf, 0x1dfe, + 0x8cc0, 0x0776, + 0x8d40, 0x07b3, + 0x8d4a, 0x1dff, + 0x8d4b, 0x07be, + 0x8d56, 0x1e00, + 0x8d57, 0x07ca, + 0x8d61, 0x1e01, + 0x8d62, 0x07d5, + 0x8d7b, 0x16dd, + 0x8d7c, 0x07ef, + 0x8d80, 0x07f2, + 0x8d8d, 0x1e02, + 0x8d8e, 0x0800, + 0x8d94, 0x1e03, + 0x8d95, 0x0807, + 0x8d99, 0x1e04, + 0x8d9a, 0x080c, + 0x8dd1, 0x1e05, + 0x8dd2, 0x0844, + 0x8de5, 0x1e06, + 0x8de6, 0x0858, + 0x8df2, 0x1e07, + 0x8df3, 0x0865, + 0x8e40, 0x086f, + 0x8e46, 0x1e08, + 0x8e47, 0x0876, + 0x8e49, 0x1e09, + 0x8e4a, 0x0879, + 0x8e4b, 0x1e0a, + 0x8e4c, 0x087b, + 0x8e58, 0x1e0b, + 0x8e59, 0x0888, + 0x8e80, 0x08ae, + 0x8ec6, 0x1e0d, + 0x8ec7, 0x1929, + 0x8ec8, 0x08f6, + 0x8ed5, 0x1e0e, + 0x8ed6, 0x0904, + 0x8edb, 0x1e0f, + 0x8edd, 0x090b, + 0x8f40, 0x092b, + 0x8f4a, 0x1e11, + 0x8f4b, 0x0936, + 0x8f55, 0x1e12, + 0x8f56, 0x0941, + 0x8f80, 0x096a, + 0x8f8c, 0x1e13, + 0x8f8e, 0x0978, + 0x8f92, 0x1e15, + 0x8f94, 0x097e, + 0x8fa3, 0x1e17, + 0x8fa4, 0x098e, + 0x8fb1, 0x1e18, + 0x8fb2, 0x099c, + 0x8fbd, 0x1e19, + 0x8fbe, 0x09a8, + 0x8fd3, 0x1e1a, + 0x8fd4, 0x09be, + 0x8fdd, 0x1e1b, + 0x8fde, 0x09c8, + 0x8fe2, 0x1e1c, + 0x8fe3, 0x09cd, + 0x9040, 0x09e7, + 0x9049, 0x1e1d, + 0x904a, 0x09f1, + 0x9078, 0x1e1e, + 0x9079, 0x0a20, + 0x9080, 0x1e1f, + 0x9081, 0x0a27, + 0x9089, 0x1e20, + 0x908a, 0x0a30, + 0x90a0, 0x1e21, + 0x90a1, 0x0a47, + 0x90c0, 0x1e22, + 0x90c1, 0x0a67, + 0x90e4, 0x1e23, + 0x90e5, 0x0a8b, + 0x90ef, 0x1e24, + 0x90f1, 0x0a97, + 0x90f7, 0x1e26, + 0x90f9, 0x0a9f, + 0x9140, 0x0aa3, + 0x9146, 0x1e28, + 0x9147, 0x1a6e, + 0x9148, 0x0aab, + 0x9158, 0x1e29, + 0x9159, 0x0abc, + 0x916b, 0x1e2a, + 0x916c, 0x0acf, + 0x916e, 0x1e2b, + 0x916f, 0x0ad2, + 0x917e, 0x1e2c, + 0x9180, 0x0ae2, + 0x9189, 0x1e2d, + 0x918a, 0x0aec, + 0x91bb, 0x1e2e, + 0x91bc, 0x0b1e, + 0x91cb, 0x1e2f, + 0x91cc, 0x0b2e, + 0x91da, 0x1e30, + 0x91db, 0x0b3d, + 0x91e1, 0x1e31, + 0x91e2, 0x0b44, + 0x91ed, 0x1e32, + 0x91ee, 0x0b50, + 0x91f3, 0x1e33, + 0x91f5, 0x0b57, + 0x91fb, 0x1e35, + 0x91fc, 0x0b5e, + 0x9240, 0x0b5f, + 0x9246, 0x1e36, + 0x9247, 0x0b66, + 0x9248, 0x1e37, + 0x924a, 0x0b69, + 0x924c, 0x1e39, + 0x924e, 0x0b6d, + 0x925c, 0x1e3b, + 0x925d, 0x0b7c, + 0x9280, 0x0b9e, + 0x9290, 0x1e3c, + 0x9291, 0x0baf, + 0x9295, 0x1e3d, + 0x9296, 0x0bb4, + 0x929c, 0x1e3e, + 0x929d, 0x0bbb, + 0x92bb, 0x1e3f, + 0x92bc, 0x0bda, + 0x92c6, 0x1e40, + 0x92c7, 0x0be5, + 0x92c8, 0x1e41, + 0x92c9, 0x0be7, + 0x92cb, 0x1e42, + 0x92cc, 0x0bea, + 0x92cd, 0x1e43, + 0x92ce, 0x0bec, + 0x92d2, 0x204b, + 0x92d3, 0x0bf1, + 0x92d9, 0x11b5, + 0x92da, 0x0bf8, + 0x9340, 0x0c1b, + 0x9341, 0x1e44, + 0x9342, 0x0c1d, + 0x9346, 0x1e45, + 0x9347, 0x0c22, + 0x934d, 0x1e46, + 0x934e, 0x0c29, + 0x9355, 0x1e47, + 0x9356, 0x0c31, + 0x935e, 0x1e48, + 0x935f, 0x0c3a, + 0x9367, 0x1e49, + 0x9368, 0x0c43, + 0x936a, 0x1e4a, + 0x936b, 0x0c46, + 0x9370, 0x1e4b, + 0x9372, 0x0c4d, + 0x9376, 0x16df, + 0x9377, 0x0c52, + 0x9380, 0x0c5a, + 0x9384, 0x1e4d, + 0x9385, 0x0c5f, + 0x938e, 0x1450, + 0x938f, 0x0c69, + 0x9393, 0x1536, + 0x9394, 0x0c6e, + 0x9398, 0x1e4e, + 0x9399, 0x0c73, + 0x93bc, 0x1e4f, + 0x93bd, 0x0c97, + 0x93c0, 0x1e50, + 0x93c1, 0x0c9b, + 0x93d2, 0x1e51, + 0x93d4, 0x0cae, + 0x93d9, 0x1e53, + 0x93db, 0x0cb5, + 0x93df, 0x1e55, + 0x93e0, 0x0cba, + 0x93e4, 0x1e56, + 0x93e6, 0x0cc0, + 0x93e8, 0x1e58, + 0x93e9, 0x0cc3, + 0x93f4, 0x1aed, + 0x93f5, 0x0ccf, + 0x9440, 0x0cd7, + 0x9448, 0x1e59, + 0x9449, 0x0ce0, + 0x9458, 0x1e5a, + 0x9459, 0x0cf0, + 0x9476, 0x1e5b, + 0x9477, 0x0d0e, + 0x9480, 0x0d16, + 0x9487, 0x1e5c, + 0x9488, 0x1989, + 0x9489, 0x1e5d, + 0x948a, 0x0d20, + 0x948d, 0x1e5e, + 0x948e, 0x0d24, + 0x94a2, 0x1e5f, + 0x94a3, 0x0d39, + 0x94ac, 0x1e60, + 0x94ad, 0x0d43, + 0x94ae, 0x1e61, + 0x94af, 0x0d45, + 0x94d2, 0x1e62, + 0x94d3, 0x0d69, + 0x94e0, 0x1e63, + 0x94e1, 0x0d77, + 0x94f3, 0x1e64, + 0x94f4, 0x0d8a, + 0x9540, 0x0d93, + 0x9541, 0x1e65, + 0x9543, 0x0d96, + 0x954e, 0x1e67, + 0x954f, 0x143b, + 0x9550, 0x0da3, + 0x9551, 0x1e68, + 0x9552, 0x0da5, + 0x9554, 0x1e69, + 0x9555, 0x0da8, + 0x955f, 0x1e6a, + 0x9560, 0x0db3, + 0x956d, 0x1e6b, + 0x956e, 0x0dc1, + 0x9570, 0x1e6c, + 0x9571, 0x0dc4, + 0x9580, 0x0dd2, + 0x95c1, 0x1e6d, + 0x95c2, 0x0e14, + 0x95cb, 0x1e6e, + 0x95cc, 0x0e1e, + 0x95d8, 0x1e6f, + 0x95d9, 0x0e2b, + 0x95f7, 0x1e70, + 0x95f8, 0x0e4a, + 0x9640, 0x0e4f, + 0x9641, 0x1e71, + 0x9642, 0x0e51, + 0x9648, 0x1e72, + 0x9649, 0x0e58, + 0x966a, 0x1e73, + 0x966b, 0x0e7a, + 0x9680, 0x0e8e, + 0x968a, 0x1d33, + 0x968b, 0x0e99, + 0x9690, 0x1e74, + 0x9691, 0x0e9f, + 0x9698, 0x1f2c, + 0x9699, 0x102f, + 0x969a, 0x0ea8, + 0x96cb, 0x1e75, + 0x96cc, 0x0eda, + 0x96d7, 0x1e76, + 0x96d8, 0x0ee6, + 0x96dd, 0x1e77, + 0x96de, 0x0eec, + 0x96e0, 0x1e78, + 0x96e1, 0x0eef, + 0x96f7, 0x1935, + 0x96f8, 0x1e79, + 0x96f9, 0x0f07, + 0x96fa, 0x1e7a, + 0x96fb, 0x0f09, + 0x96fc, 0x1e7b, + 0x9740, 0x0f0b, + 0x9751, 0x1e7c, + 0x9752, 0x0f1d, + 0x976f, 0x1e7d, + 0x9770, 0x0f3b, + 0x9773, 0x1e7e, + 0x9774, 0x0f3f, + 0x9779, 0x1d34, + 0x977a, 0x0f45, + 0x9780, 0x0f4a, + 0x9789, 0x1e7f, + 0x978a, 0x0f54, + 0x97c9, 0x1e80, + 0x97ca, 0x0f94, + 0x97f8, 0x1e81, + 0x97fa, 0x0fc4, + 0x9840, 0x1e83, + 0x9841, 0x0fc8, + 0x9850, 0x1e84, + 0x9851, 0x0fd8, + 0x9855, 0x1777, + 0x9856, 0x0fdd, + 0x9858, 0x1e85, + 0x9859, 0x0fe0, + 0x989f, 0x0ffa, + 0x98d4, 0x0ea7, + 0x98d5, 0x1030, + 0x9940, 0x1058, + 0x995c, 0x1e86, + 0x995d, 0x1075, + 0x9966, 0x1e87, + 0x9967, 0x107f, + 0x996a, 0x1e88, + 0x996b, 0x1083, + 0x996c, 0x1e89, + 0x996d, 0x1085, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a4f, 0x1e8a, + 0x9a50, 0x1124, + 0x9a59, 0x1e8b, + 0x9a5a, 0x112e, + 0x9a7d, 0x1e8d, + 0x9a7e, 0x1152, + 0x9a80, 0x1153, + 0x9a8b, 0x1e8e, + 0x9a8c, 0x115f, + 0x9ac2, 0x1e8f, + 0x9ac3, 0x1196, + 0x9ae2, 0x0bf7, + 0x9ae3, 0x11b6, + 0x9b40, 0x11d0, + 0x9b5c, 0x1e90, + 0x9b5d, 0x11ed, + 0x9b80, 0x120f, + 0x9b83, 0x1e91, + 0x9b84, 0x1213, + 0x9ba0, 0x1e92, + 0x9ba1, 0x1230, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9ca2, 0x1e94, + 0x9ca3, 0x12ee, + 0x9d40, 0x1348, + 0x9d80, 0x1e95, + 0x9d81, 0x1388, + 0x9d8c, 0x1e96, + 0x9d8d, 0x1394, + 0x9d98, 0x05a7, + 0x9d99, 0x13a0, + 0x9db7, 0x1e97, + 0x9db8, 0x13bf, + 0x9dcb, 0x1e98, + 0x9dcc, 0x13d3, + 0x9e40, 0x1404, + 0x9e64, 0x1e99, + 0x9e65, 0x1429, + 0x9e69, 0x1e9a, + 0x9e6a, 0x142e, + 0x9e77, 0x0da2, + 0x9e78, 0x143c, + 0x9e80, 0x1443, + 0x9e8b, 0x1e9b, + 0x9e8c, 0x144f, + 0x9e8d, 0x0c68, + 0x9e8e, 0x1451, + 0x9e94, 0x1e9c, + 0x9e95, 0x1458, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0x9fb7, 0x0c6d, + 0x9fb8, 0x1537, + 0x9fce, 0x1e9d, + 0x9fcf, 0x154e, + 0x9ff3, 0x05ff, + 0x9ff4, 0x1573, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe0a4, 0x1e9f, + 0xe0a5, 0x15e0, + 0xe0dd, 0x1ea0, + 0xe0de, 0x1619, + 0xe0f4, 0x1d35, + 0xe0f5, 0x1630, + 0xe140, 0x1638, + 0xe14a, 0x1ea1, + 0xe14b, 0x1643, + 0xe14f, 0x1ea2, + 0xe151, 0x1649, + 0xe180, 0x1677, + 0xe1a9, 0x1ea4, + 0xe1aa, 0x16a1, + 0xe1e6, 0x07ee, + 0xe1e7, 0x16de, + 0xe1e8, 0x0c51, + 0xe1e9, 0x16e0, + 0xe1ed, 0x1ea5, + 0xe1ee, 0x16e5, + 0xe240, 0x16f4, + 0xe269, 0x1ea6, + 0xe26a, 0x171e, + 0xe273, 0x1ea7, + 0xe274, 0x1728, + 0xe27d, 0x05d4, + 0xe27e, 0x1732, + 0xe280, 0x1733, + 0xe2b7, 0x1ea8, + 0xe2b8, 0x176b, + 0xe2c4, 0x0fdc, + 0xe2c5, 0x1778, + 0xe2e2, 0x1ea9, + 0xe2e3, 0x1796, + 0xe2ec, 0x1eaa, + 0xe2ed, 0x17a0, + 0xe340, 0x17b0, + 0xe358, 0x1eab, + 0xe359, 0x17c9, + 0xe35a, 0x1eac, + 0xe35b, 0x17cb, + 0xe365, 0x1ead, + 0xe366, 0x17d6, + 0xe380, 0x17ef, + 0xe3c4, 0x1eae, + 0xe3c5, 0x1834, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe484, 0x1eaf, + 0xe485, 0x18b0, + 0xe489, 0x1eb0, + 0xe48a, 0x18b5, + 0xe492, 0x1eb1, + 0xe493, 0x18be, + 0xe4b2, 0x1eb2, + 0xe4b3, 0x18de, + 0xe4b9, 0x1eb3, + 0xe4ba, 0x18e5, + 0xe4f2, 0x1eb4, + 0xe4f3, 0x191e, + 0xe540, 0x1928, + 0xe541, 0x08f5, + 0xe542, 0x192a, + 0xe54d, 0x0f05, + 0xe54e, 0x1936, + 0xe579, 0x05a0, + 0xe57a, 0x1962, + 0xe580, 0x1967, + 0xe5a2, 0x0d1e, + 0xe5a3, 0x198a, + 0xe5a5, 0x1eb6, + 0xe5a6, 0x198d, + 0xe5bb, 0x1eb7, + 0xe5bc, 0x19a3, + 0xe5ed, 0x1eb8, + 0xe5ee, 0x19d5, + 0xe640, 0x19e4, + 0xe651, 0x1eb9, + 0xe652, 0x19f6, + 0xe67c, 0x060e, + 0xe67d, 0x1a21, + 0xe680, 0x1a23, + 0xe686, 0x1eba, + 0xe687, 0x1a2a, + 0xe696, 0x1ebb, + 0xe697, 0x1a3a, + 0xe6cb, 0x0aaa, + 0xe6cc, 0x1a6f, + 0xe6e7, 0x1ebc, + 0xe6e8, 0x1a8b, + 0xe6f2, 0x1ebd, + 0xe6f3, 0x1a96, + 0xe740, 0x1aa0, + 0xe76d, 0x1ebe, + 0xe76e, 0x1ace, + 0xe780, 0x1adf, + 0xe78c, 0x1ebf, + 0xe78d, 0x1aec, + 0xe78e, 0x1ec0, + 0xe78f, 0x1aee, + 0xe7a7, 0x1ec1, + 0xe7a8, 0x1b07, + 0xe7bb, 0x1ec2, + 0xe7bc, 0x1b1b, + 0xe7d5, 0x1ec3, + 0xe7d6, 0x1b35, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe8c3, 0x1ec6, + 0xe8c4, 0x1bdf, + 0xe8cf, 0x1ec7, + 0xe8d0, 0x1beb, + 0xe8d5, 0x1ec8, + 0xe8d6, 0x1bf1, + 0xe8f2, 0x0731, + 0xe8f3, 0x1ec9, + 0xe8f4, 0x1c0f, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xe9ab, 0x1eca, + 0xe9ac, 0x1c83, + 0xe9ba, 0x1ecb, + 0xe9bb, 0x1c92, + 0xe9cb, 0x0477, + 0xe9cc, 0x1ecc, + 0xe9cd, 0x1ca4, + 0xe9f2, 0x0529, + 0xe9f3, 0x1cca, + 0xea40, 0x1cd4, + 0xea70, 0x1ecd, + 0xea71, 0x1d05, + 0xea80, 0x1d13, + 0xea9d, 0x1ece, + 0xea9e, 0x1d31, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1278RKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan1278RKSJHMap2, 626 +}; + +static Gushort japan1278msRKSJHMap2[1424] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x8740, 0x1d83, + 0x875f, 0x1da1, + 0x8761, 0x1f66, + 0x8762, 0x1da4, + 0x8763, 0x1f68, + 0x8764, 0x1da6, + 0x8765, 0x1f6a, + 0x8766, 0x1da8, + 0x8768, 0x1f6c, + 0x8769, 0x1dab, + 0x876b, 0x1f6b, + 0x876c, 0x1dae, + 0x876e, 0x1f6f, + 0x876f, 0x1db1, + 0x877e, 0x2083, + 0x8780, 0x1db8, + 0x8784, 0x1f77, + 0x8785, 0x1dbd, + 0x8790, 0x02fa, + 0x8791, 0x02f9, + 0x8792, 0x0301, + 0x8793, 0x1dc8, + 0x879a, 0x0300, + 0x879b, 0x1dcf, + 0x889f, 0x0465, + 0x88a0, 0x1dd1, + 0x88a1, 0x0467, + 0x88a7, 0x204a, + 0x88a8, 0x046e, + 0x88b0, 0x1f19, + 0x88b1, 0x1ca2, + 0x88b2, 0x0478, + 0x88b9, 0x1dd2, + 0x88ba, 0x0480, + 0x88ec, 0x1dd3, + 0x88ed, 0x04b3, + 0x88f1, 0x1dd4, + 0x88f2, 0x04b8, + 0x88fa, 0x1dd5, + 0x88fb, 0x04c1, + 0x8940, 0x04c3, + 0x8949, 0x1dd6, + 0x894a, 0x04cd, + 0x8954, 0x1dd7, + 0x8955, 0x04d8, + 0x8958, 0x1dd8, + 0x8959, 0x04dc, + 0x895c, 0x1dda, + 0x895d, 0x04e0, + 0x8961, 0x1ddb, + 0x8962, 0x04e5, + 0x8980, 0x0502, + 0x898b, 0x1ddc, + 0x898c, 0x050e, + 0x89a6, 0x1ddd, + 0x89a7, 0x1cc9, + 0x89a8, 0x1dde, + 0x89a9, 0x052b, + 0x89de, 0x1ddf, + 0x89df, 0x0561, + 0x89f8, 0x1de0, + 0x89f9, 0x057b, + 0x89fb, 0x1de1, + 0x89fc, 0x057e, + 0x8a40, 0x057f, + 0x8a41, 0x1de2, + 0x8a42, 0x0581, + 0x8a61, 0x1961, + 0x8a62, 0x05a1, + 0x8a68, 0x139f, + 0x8a69, 0x05a8, + 0x8a80, 0x05be, + 0x8a85, 0x1de3, + 0x8a86, 0x05c4, + 0x8a8b, 0x1de4, + 0x8a8c, 0x05ca, + 0x8a93, 0x1de5, + 0x8a94, 0x05d2, + 0x8a96, 0x1731, + 0x8a97, 0x05d5, + 0x8a9a, 0x1de6, + 0x8a9b, 0x05d9, + 0x8ac0, 0x1de7, + 0x8ac1, 0x1572, + 0x8ac2, 0x0600, + 0x8acb, 0x1de8, + 0x8acc, 0x060a, + 0x8ad0, 0x1a20, + 0x8ad1, 0x060f, + 0x8ae3, 0x1de9, + 0x8ae4, 0x0622, + 0x8b40, 0x063b, + 0x8b4a, 0x1dea, + 0x8b4b, 0x0646, + 0x8b5f, 0x1deb, + 0x8b60, 0x065b, + 0x8b80, 0x067a, + 0x8ba0, 0x1dec, + 0x8ba1, 0x069b, + 0x8ba8, 0x1ded, + 0x8ba9, 0x06a3, + 0x8bc4, 0x1d32, + 0x8bc5, 0x06bf, + 0x8bcd, 0x1dee, + 0x8bce, 0x06c8, + 0x8beb, 0x1def, + 0x8bec, 0x06e6, + 0x8bf2, 0x1df0, + 0x8bf3, 0x06ed, + 0x8bf9, 0x1df1, + 0x8bfa, 0x06f4, + 0x8bfb, 0x1df2, + 0x8bfc, 0x06f6, + 0x8c40, 0x06f7, + 0x8c43, 0x1df3, + 0x8c44, 0x06fb, + 0x8c56, 0x1df4, + 0x8c57, 0x070e, + 0x8c64, 0x1df5, + 0x8c65, 0x071c, + 0x8c6d, 0x1df6, + 0x8c6e, 0x0725, + 0x8c71, 0x1df7, + 0x8c72, 0x0729, + 0x8c74, 0x1df8, + 0x8c75, 0x072c, + 0x8c7a, 0x1c0d, + 0x8c7b, 0x0732, + 0x8c80, 0x0736, + 0x8c84, 0x1df9, + 0x8c85, 0x073b, + 0x8c91, 0x1dfa, + 0x8c92, 0x0748, + 0x8c99, 0x1dfb, + 0x8c9a, 0x0750, + 0x8c9e, 0x1dfc, + 0x8c9f, 0x0755, + 0x8cb2, 0x1dfd, + 0x8cb3, 0x0769, + 0x8cbf, 0x1dfe, + 0x8cc0, 0x0776, + 0x8d40, 0x07b3, + 0x8d4a, 0x1dff, + 0x8d4b, 0x07be, + 0x8d56, 0x1e00, + 0x8d57, 0x07ca, + 0x8d61, 0x1e01, + 0x8d62, 0x07d5, + 0x8d7b, 0x16dd, + 0x8d7c, 0x07ef, + 0x8d80, 0x07f2, + 0x8d8d, 0x1e02, + 0x8d8e, 0x0800, + 0x8d94, 0x1e03, + 0x8d95, 0x0807, + 0x8d99, 0x1e04, + 0x8d9a, 0x080c, + 0x8dd1, 0x1e05, + 0x8dd2, 0x0844, + 0x8de5, 0x1e06, + 0x8de6, 0x0858, + 0x8df2, 0x1e07, + 0x8df3, 0x0865, + 0x8e40, 0x086f, + 0x8e46, 0x1e08, + 0x8e47, 0x0876, + 0x8e49, 0x1e09, + 0x8e4a, 0x0879, + 0x8e4b, 0x1e0a, + 0x8e4c, 0x087b, + 0x8e58, 0x1e0b, + 0x8e59, 0x0888, + 0x8e80, 0x08ae, + 0x8ec6, 0x1e0d, + 0x8ec7, 0x1929, + 0x8ec8, 0x08f6, + 0x8ed5, 0x1e0e, + 0x8ed6, 0x0904, + 0x8edb, 0x1e0f, + 0x8edd, 0x090b, + 0x8f40, 0x092b, + 0x8f4a, 0x1e11, + 0x8f4b, 0x0936, + 0x8f55, 0x1e12, + 0x8f56, 0x0941, + 0x8f80, 0x096a, + 0x8f8c, 0x1e13, + 0x8f8e, 0x0978, + 0x8f92, 0x1e15, + 0x8f94, 0x097e, + 0x8fa3, 0x1e17, + 0x8fa4, 0x098e, + 0x8fb1, 0x1e18, + 0x8fb2, 0x099c, + 0x8fbd, 0x1e19, + 0x8fbe, 0x09a8, + 0x8fd3, 0x1e1a, + 0x8fd4, 0x09be, + 0x8fdd, 0x1e1b, + 0x8fde, 0x09c8, + 0x8fe2, 0x1e1c, + 0x8fe3, 0x09cd, + 0x9040, 0x09e7, + 0x9049, 0x1e1d, + 0x904a, 0x09f1, + 0x9078, 0x1e1e, + 0x9079, 0x0a20, + 0x9080, 0x1e1f, + 0x9081, 0x0a27, + 0x9089, 0x1e20, + 0x908a, 0x0a30, + 0x90a0, 0x1e21, + 0x90a1, 0x0a47, + 0x90c0, 0x1e22, + 0x90c1, 0x0a67, + 0x90e4, 0x1e23, + 0x90e5, 0x0a8b, + 0x90ef, 0x1e24, + 0x90f1, 0x0a97, + 0x90f7, 0x1e26, + 0x90f9, 0x0a9f, + 0x9140, 0x0aa3, + 0x9146, 0x1e28, + 0x9147, 0x1a6e, + 0x9148, 0x0aab, + 0x9158, 0x1e29, + 0x9159, 0x0abc, + 0x916b, 0x1e2a, + 0x916c, 0x0acf, + 0x916e, 0x1e2b, + 0x916f, 0x0ad2, + 0x917e, 0x1e2c, + 0x9180, 0x0ae2, + 0x9189, 0x1e2d, + 0x918a, 0x0aec, + 0x91bb, 0x1e2e, + 0x91bc, 0x0b1e, + 0x91cb, 0x1e2f, + 0x91cc, 0x0b2e, + 0x91da, 0x1e30, + 0x91db, 0x0b3d, + 0x91e1, 0x1e31, + 0x91e2, 0x0b44, + 0x91ed, 0x1e32, + 0x91ee, 0x0b50, + 0x91f3, 0x1e33, + 0x91f5, 0x0b57, + 0x91fb, 0x1e35, + 0x91fc, 0x0b5e, + 0x9240, 0x0b5f, + 0x9246, 0x1e36, + 0x9247, 0x0b66, + 0x9248, 0x1e37, + 0x924a, 0x0b69, + 0x924c, 0x1e39, + 0x924e, 0x0b6d, + 0x925c, 0x1e3b, + 0x925d, 0x0b7c, + 0x9280, 0x0b9e, + 0x9290, 0x1e3c, + 0x9291, 0x0baf, + 0x9295, 0x1e3d, + 0x9296, 0x0bb4, + 0x929c, 0x1e3e, + 0x929d, 0x0bbb, + 0x92bb, 0x1e3f, + 0x92bc, 0x0bda, + 0x92c6, 0x1e40, + 0x92c7, 0x0be5, + 0x92c8, 0x1e41, + 0x92c9, 0x0be7, + 0x92cb, 0x1e42, + 0x92cc, 0x0bea, + 0x92cd, 0x1e43, + 0x92ce, 0x0bec, + 0x92d2, 0x204b, + 0x92d3, 0x0bf1, + 0x92d9, 0x11b5, + 0x92da, 0x0bf8, + 0x9340, 0x0c1b, + 0x9341, 0x1e44, + 0x9342, 0x0c1d, + 0x9346, 0x1e45, + 0x9347, 0x0c22, + 0x934d, 0x1e46, + 0x934e, 0x0c29, + 0x9355, 0x1e47, + 0x9356, 0x0c31, + 0x935e, 0x1e48, + 0x935f, 0x0c3a, + 0x9367, 0x1e49, + 0x9368, 0x0c43, + 0x936a, 0x1e4a, + 0x936b, 0x0c46, + 0x9370, 0x1e4b, + 0x9372, 0x0c4d, + 0x9376, 0x16df, + 0x9377, 0x0c52, + 0x9380, 0x0c5a, + 0x9384, 0x1e4d, + 0x9385, 0x0c5f, + 0x938e, 0x1450, + 0x938f, 0x0c69, + 0x9393, 0x1536, + 0x9394, 0x0c6e, + 0x9398, 0x1e4e, + 0x9399, 0x0c73, + 0x93bc, 0x1e4f, + 0x93bd, 0x0c97, + 0x93c0, 0x1e50, + 0x93c1, 0x0c9b, + 0x93d2, 0x1e51, + 0x93d4, 0x0cae, + 0x93d9, 0x1e53, + 0x93db, 0x0cb5, + 0x93df, 0x1e55, + 0x93e0, 0x0cba, + 0x93e4, 0x1e56, + 0x93e6, 0x0cc0, + 0x93e8, 0x1e58, + 0x93e9, 0x0cc3, + 0x93f4, 0x1aed, + 0x93f5, 0x0ccf, + 0x9440, 0x0cd7, + 0x9448, 0x1e59, + 0x9449, 0x0ce0, + 0x9458, 0x1e5a, + 0x9459, 0x0cf0, + 0x9476, 0x1e5b, + 0x9477, 0x0d0e, + 0x9480, 0x0d16, + 0x9487, 0x1e5c, + 0x9488, 0x1989, + 0x9489, 0x1e5d, + 0x948a, 0x0d20, + 0x948d, 0x1e5e, + 0x948e, 0x0d24, + 0x94a2, 0x1e5f, + 0x94a3, 0x0d39, + 0x94ac, 0x1e60, + 0x94ad, 0x0d43, + 0x94ae, 0x1e61, + 0x94af, 0x0d45, + 0x94d2, 0x1e62, + 0x94d3, 0x0d69, + 0x94e0, 0x1e63, + 0x94e1, 0x0d77, + 0x94f3, 0x1e64, + 0x94f4, 0x0d8a, + 0x9540, 0x0d93, + 0x9541, 0x1e65, + 0x9543, 0x0d96, + 0x954e, 0x1e67, + 0x954f, 0x143b, + 0x9550, 0x0da3, + 0x9551, 0x1e68, + 0x9552, 0x0da5, + 0x9554, 0x1e69, + 0x9555, 0x0da8, + 0x955f, 0x1e6a, + 0x9560, 0x0db3, + 0x956d, 0x1e6b, + 0x956e, 0x0dc1, + 0x9570, 0x1e6c, + 0x9571, 0x0dc4, + 0x9580, 0x0dd2, + 0x95c1, 0x1e6d, + 0x95c2, 0x0e14, + 0x95cb, 0x1e6e, + 0x95cc, 0x0e1e, + 0x95d8, 0x1e6f, + 0x95d9, 0x0e2b, + 0x95f7, 0x1e70, + 0x95f8, 0x0e4a, + 0x9640, 0x0e4f, + 0x9641, 0x1e71, + 0x9642, 0x0e51, + 0x9648, 0x1e72, + 0x9649, 0x0e58, + 0x966a, 0x1e73, + 0x966b, 0x0e7a, + 0x9680, 0x0e8e, + 0x968a, 0x1d33, + 0x968b, 0x0e99, + 0x9690, 0x1e74, + 0x9691, 0x0e9f, + 0x9698, 0x1f2c, + 0x9699, 0x102f, + 0x969a, 0x0ea8, + 0x96cb, 0x1e75, + 0x96cc, 0x0eda, + 0x96d7, 0x1e76, + 0x96d8, 0x0ee6, + 0x96dd, 0x1e77, + 0x96de, 0x0eec, + 0x96e0, 0x1e78, + 0x96e1, 0x0eef, + 0x96f7, 0x1935, + 0x96f8, 0x1e79, + 0x96f9, 0x0f07, + 0x96fa, 0x1e7a, + 0x96fb, 0x0f09, + 0x96fc, 0x1e7b, + 0x9740, 0x0f0b, + 0x9751, 0x1e7c, + 0x9752, 0x0f1d, + 0x976f, 0x1e7d, + 0x9770, 0x0f3b, + 0x9773, 0x1e7e, + 0x9774, 0x0f3f, + 0x9779, 0x1d34, + 0x977a, 0x0f45, + 0x9780, 0x0f4a, + 0x9789, 0x1e7f, + 0x978a, 0x0f54, + 0x97c9, 0x1e80, + 0x97ca, 0x0f94, + 0x97f8, 0x1e81, + 0x97fa, 0x0fc4, + 0x9840, 0x1e83, + 0x9841, 0x0fc8, + 0x9850, 0x1e84, + 0x9851, 0x0fd8, + 0x9855, 0x1777, + 0x9856, 0x0fdd, + 0x9858, 0x1e85, + 0x9859, 0x0fe0, + 0x989f, 0x0ffa, + 0x98d4, 0x0ea7, + 0x98d5, 0x1030, + 0x9940, 0x1058, + 0x995c, 0x1e86, + 0x995d, 0x1075, + 0x9966, 0x1e87, + 0x9967, 0x107f, + 0x996a, 0x1e88, + 0x996b, 0x1083, + 0x996c, 0x1e89, + 0x996d, 0x1085, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a4f, 0x1e8a, + 0x9a50, 0x1124, + 0x9a59, 0x1e8b, + 0x9a5a, 0x112e, + 0x9a7d, 0x1e8d, + 0x9a7e, 0x1152, + 0x9a80, 0x1153, + 0x9a8b, 0x1e8e, + 0x9a8c, 0x115f, + 0x9ac2, 0x1e8f, + 0x9ac3, 0x1196, + 0x9ae2, 0x0bf7, + 0x9ae3, 0x11b6, + 0x9b40, 0x11d0, + 0x9b5c, 0x1e90, + 0x9b5d, 0x11ed, + 0x9b80, 0x120f, + 0x9b83, 0x1e91, + 0x9b84, 0x1213, + 0x9ba0, 0x1e92, + 0x9ba1, 0x1230, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9ca2, 0x1e94, + 0x9ca3, 0x12ee, + 0x9d40, 0x1348, + 0x9d80, 0x1e95, + 0x9d81, 0x1388, + 0x9d8c, 0x1e96, + 0x9d8d, 0x1394, + 0x9d98, 0x05a7, + 0x9d99, 0x13a0, + 0x9db7, 0x1e97, + 0x9db8, 0x13bf, + 0x9dcb, 0x1e98, + 0x9dcc, 0x13d3, + 0x9e40, 0x1404, + 0x9e64, 0x1e99, + 0x9e65, 0x1429, + 0x9e69, 0x1e9a, + 0x9e6a, 0x142e, + 0x9e77, 0x0da2, + 0x9e78, 0x143c, + 0x9e80, 0x1443, + 0x9e8b, 0x1e9b, + 0x9e8c, 0x144f, + 0x9e8d, 0x0c68, + 0x9e8e, 0x1451, + 0x9e94, 0x1e9c, + 0x9e95, 0x1458, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0x9fb7, 0x0c6d, + 0x9fb8, 0x1537, + 0x9fce, 0x1e9d, + 0x9fcf, 0x154e, + 0x9ff3, 0x05ff, + 0x9ff4, 0x1573, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe0a4, 0x1e9f, + 0xe0a5, 0x15e0, + 0xe0dd, 0x1ea0, + 0xe0de, 0x1619, + 0xe0f4, 0x1d35, + 0xe0f5, 0x1630, + 0xe140, 0x1638, + 0xe14a, 0x1ea1, + 0xe14b, 0x1643, + 0xe14f, 0x1ea2, + 0xe151, 0x1649, + 0xe180, 0x1677, + 0xe1a9, 0x1ea4, + 0xe1aa, 0x16a1, + 0xe1e6, 0x07ee, + 0xe1e7, 0x16de, + 0xe1e8, 0x0c51, + 0xe1e9, 0x16e0, + 0xe1ed, 0x1ea5, + 0xe1ee, 0x16e5, + 0xe240, 0x16f4, + 0xe269, 0x1ea6, + 0xe26a, 0x171e, + 0xe273, 0x1ea7, + 0xe274, 0x1728, + 0xe27d, 0x05d4, + 0xe27e, 0x1732, + 0xe280, 0x1733, + 0xe2b7, 0x1ea8, + 0xe2b8, 0x176b, + 0xe2c4, 0x0fdc, + 0xe2c5, 0x1778, + 0xe2e2, 0x1ea9, + 0xe2e3, 0x1796, + 0xe2ec, 0x1eaa, + 0xe2ed, 0x17a0, + 0xe340, 0x17b0, + 0xe358, 0x1eab, + 0xe359, 0x17c9, + 0xe35a, 0x1eac, + 0xe35b, 0x17cb, + 0xe365, 0x1ead, + 0xe366, 0x17d6, + 0xe380, 0x17ef, + 0xe3c4, 0x1eae, + 0xe3c5, 0x1834, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe484, 0x1eaf, + 0xe485, 0x18b0, + 0xe489, 0x1eb0, + 0xe48a, 0x18b5, + 0xe492, 0x1eb1, + 0xe493, 0x18be, + 0xe4b2, 0x1eb2, + 0xe4b3, 0x18de, + 0xe4b9, 0x1eb3, + 0xe4ba, 0x18e5, + 0xe4f2, 0x1eb4, + 0xe4f3, 0x191e, + 0xe540, 0x1928, + 0xe541, 0x08f5, + 0xe542, 0x192a, + 0xe54d, 0x0f05, + 0xe54e, 0x1936, + 0xe579, 0x05a0, + 0xe57a, 0x1962, + 0xe580, 0x1967, + 0xe5a2, 0x0d1e, + 0xe5a3, 0x198a, + 0xe5a5, 0x1eb6, + 0xe5a6, 0x198d, + 0xe5bb, 0x1eb7, + 0xe5bc, 0x19a3, + 0xe5ed, 0x1eb8, + 0xe5ee, 0x19d5, + 0xe640, 0x19e4, + 0xe651, 0x1eb9, + 0xe652, 0x19f6, + 0xe67c, 0x060e, + 0xe67d, 0x1a21, + 0xe680, 0x1a23, + 0xe686, 0x1eba, + 0xe687, 0x1a2a, + 0xe696, 0x1ebb, + 0xe697, 0x1a3a, + 0xe6cb, 0x0aaa, + 0xe6cc, 0x1a6f, + 0xe6e7, 0x1ebc, + 0xe6e8, 0x1a8b, + 0xe6f2, 0x1ebd, + 0xe6f3, 0x1a96, + 0xe740, 0x1aa0, + 0xe76d, 0x1ebe, + 0xe76e, 0x1ace, + 0xe780, 0x1adf, + 0xe78c, 0x1ebf, + 0xe78d, 0x1aec, + 0xe78e, 0x1ec0, + 0xe78f, 0x1aee, + 0xe7a7, 0x1ec1, + 0xe7a8, 0x1b07, + 0xe7bb, 0x1ec2, + 0xe7bc, 0x1b1b, + 0xe7d5, 0x1ec3, + 0xe7d6, 0x1b35, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe8c3, 0x1ec6, + 0xe8c4, 0x1bdf, + 0xe8cf, 0x1ec7, + 0xe8d0, 0x1beb, + 0xe8d5, 0x1ec8, + 0xe8d6, 0x1bf1, + 0xe8f2, 0x0731, + 0xe8f3, 0x1ec9, + 0xe8f4, 0x1c0f, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xe9ab, 0x1eca, + 0xe9ac, 0x1c83, + 0xe9ba, 0x1ecb, + 0xe9bb, 0x1c92, + 0xe9cb, 0x0477, + 0xe9cc, 0x1ecc, + 0xe9cd, 0x1ca4, + 0xe9f2, 0x0529, + 0xe9f3, 0x1cca, + 0xea40, 0x1cd4, + 0xea70, 0x1ecd, + 0xea71, 0x1d05, + 0xea80, 0x1d13, + 0xea9d, 0x1ece, + 0xea9e, 0x1d31, + 0xeaa3, 0x205c, + 0xed40, 0x20a7, + 0xed80, 0x20e6, + 0xedb4, 0x07c9, + 0xedb5, 0x211a, + 0xee40, 0x2162, + 0xee80, 0x21a1, + 0xeeef, 0x1f9c, + 0xeef9, 0x02ef, + 0xeefa, 0x1f45, + 0xfa40, 0x1f9c, + 0xfa4a, 0x1d97, + 0xfa54, 0x02ef, + 0xfa55, 0x1f45, + 0xfa58, 0x1dc2, + 0xfa59, 0x1dba, + 0xfa5a, 0x1f77, + 0xfa5b, 0x0300, + 0xfa5c, 0x20a7, + 0xfa80, 0x20ca, + 0xfad0, 0x07c9, + 0xfad1, 0x211a, + 0xfb40, 0x2146, + 0xfb80, 0x2185, + 0xfc40, 0x2202, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1278msRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0277, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan1278msRKSJHMap2, 712 +}; + +static Gushort japan1283pvRKSJHMap2[436] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x8540, 0x00e8, + 0x8580, 0x0186, + 0x8581, 0x0128, + 0x859f, 0x0147, + 0x85de, 0x0187, + 0x8640, 0x01a6, + 0x8680, 0x01e5, + 0x8692, 0x0127, + 0x8693, 0x01f7, + 0x86a2, 0x1d37, + 0x8740, 0x1d83, + 0x875f, 0x1da1, + 0x8780, 0x1db8, + 0x8790, 0x02fa, + 0x8791, 0x02f9, + 0x8792, 0x0301, + 0x8793, 0x1dc8, + 0x879a, 0x0300, + 0x879b, 0x1dcf, + 0x889f, 0x0465, + 0x8940, 0x04c3, + 0x8980, 0x0502, + 0x8a40, 0x057f, + 0x8a80, 0x05be, + 0x8b40, 0x063b, + 0x8b80, 0x067a, + 0x8c40, 0x06f7, + 0x8c80, 0x0736, + 0x8d40, 0x07b3, + 0x8d80, 0x07f2, + 0x8e40, 0x086f, + 0x8e80, 0x08ae, + 0x8f40, 0x092b, + 0x8f80, 0x096a, + 0x9040, 0x09e7, + 0x9080, 0x0a26, + 0x9140, 0x0aa3, + 0x9180, 0x0ae2, + 0x9240, 0x0b5f, + 0x9280, 0x0b9e, + 0x9340, 0x0c1b, + 0x9380, 0x0c5a, + 0x9440, 0x0cd7, + 0x9480, 0x0d16, + 0x9540, 0x0d93, + 0x9580, 0x0dd2, + 0x9640, 0x0e4f, + 0x9680, 0x0e8e, + 0x9740, 0x0f0b, + 0x9780, 0x0f4a, + 0x9840, 0x0fc7, + 0x989f, 0x0ffa, + 0x9940, 0x1058, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a80, 0x1153, + 0x9b40, 0x11d0, + 0x9b80, 0x120f, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9d40, 0x1348, + 0x9d80, 0x1387, + 0x9e40, 0x1404, + 0x9e80, 0x1443, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe140, 0x1638, + 0xe180, 0x1677, + 0xe240, 0x16f4, + 0xe280, 0x1733, + 0xe340, 0x17b0, + 0xe380, 0x17ef, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe540, 0x1928, + 0xe580, 0x1967, + 0xe640, 0x19e4, + 0xe680, 0x1a23, + 0xe740, 0x1aa0, + 0xe780, 0x1adf, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xea40, 0x1cd4, + 0xea80, 0x1d13, + 0xeaa3, 0x205c, + 0xeb40, 0x0279, + 0xeb41, 0x1ecf, + 0xeb43, 0x027c, + 0xeb50, 0x1ed1, + 0xeb52, 0x028b, + 0xeb5b, 0x1ed3, + 0xeb5e, 0x0297, + 0xeb60, 0x1ed6, + 0xeb65, 0x029e, + 0xeb69, 0x1edb, + 0xeb7b, 0x02b4, + 0xeb80, 0x02b8, + 0xeb81, 0x1eed, + 0xeb82, 0x02ba, + 0xebb8, 0x02e5, + 0xebc8, 0x02ed, + 0xebda, 0x02f4, + 0xebf0, 0x0303, + 0xebfc, 0x030b, + 0xec4f, 0x030c, + 0xec60, 0x0316, + 0xec81, 0x0330, + 0xec9f, 0x1eee, + 0xeca0, 0x034b, + 0xeca1, 0x1eef, + 0xeca2, 0x034d, + 0xeca3, 0x1ef0, + 0xeca4, 0x034f, + 0xeca5, 0x1ef1, + 0xeca6, 0x0351, + 0xeca7, 0x1ef2, + 0xeca8, 0x0353, + 0xecc1, 0x1ef3, + 0xecc2, 0x036d, + 0xece1, 0x1ef4, + 0xece2, 0x038d, + 0xece3, 0x1ef5, + 0xece4, 0x038f, + 0xece5, 0x1ef6, + 0xece6, 0x0391, + 0xecec, 0x1ef7, + 0xeced, 0x0398, + 0xed40, 0x1ef8, + 0xed41, 0x039e, + 0xed42, 0x1ef9, + 0xed43, 0x03a0, + 0xed44, 0x1efa, + 0xed45, 0x03a2, + 0xed46, 0x1efb, + 0xed47, 0x03a4, + 0xed48, 0x1efc, + 0xed49, 0x03a6, + 0xed62, 0x1efd, + 0xed63, 0x03c0, + 0xed80, 0x03dc, + 0xed83, 0x1efe, + 0xed84, 0x03e0, + 0xed85, 0x1eff, + 0xed86, 0x03e2, + 0xed87, 0x1f00, + 0xed88, 0x03e4, + 0xed8e, 0x1f01, + 0xed8f, 0x03eb, + 0xed95, 0x1f02, + 0xed9f, 0x03f3, + 0xedbf, 0x040b, + 0xee40, 0x1d83, + 0xee5f, 0x1f04, + 0xee6f, 0x1db1, + 0xee80, 0x1f14, + 0xee82, 0x1dba, + 0xee90, 0x02fa, + 0xee91, 0x02f9, + 0xee92, 0x0301, + 0xee93, 0x1dc8, + 0xee9a, 0x0300, + 0xee9b, 0x1dcf, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1283pvRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, + 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, + 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, + 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, + 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, + 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, + 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, + 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, + 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, + 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, + 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0000, + 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0098, 0x00e4, 0x007c }, + japan1283pvRKSJHMap2, 218 +}; + +static Gushort japan1290msRKSJHMap2[340] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x8740, 0x1d83, + 0x875f, 0x1da1, + 0x8761, 0x1f66, + 0x8762, 0x1da4, + 0x8763, 0x1f68, + 0x8764, 0x1da6, + 0x8765, 0x1f6a, + 0x8766, 0x1da8, + 0x8768, 0x1f6c, + 0x8769, 0x1dab, + 0x876b, 0x1f6b, + 0x876c, 0x1dae, + 0x876e, 0x1f6f, + 0x876f, 0x1db1, + 0x877e, 0x2083, + 0x8780, 0x1db8, + 0x8784, 0x1f77, + 0x8785, 0x1dbd, + 0x8790, 0x02fa, + 0x8791, 0x02f9, + 0x8792, 0x0301, + 0x8793, 0x1dc8, + 0x879a, 0x0300, + 0x879b, 0x1dcf, + 0x889f, 0x0465, + 0x8940, 0x04c3, + 0x8980, 0x0502, + 0x8a40, 0x057f, + 0x8a80, 0x05be, + 0x8b40, 0x063b, + 0x8b80, 0x067a, + 0x8c40, 0x06f7, + 0x8c80, 0x0736, + 0x8d40, 0x07b3, + 0x8d80, 0x07f2, + 0x8e40, 0x086f, + 0x8e80, 0x08ae, + 0x8f40, 0x092b, + 0x8f80, 0x096a, + 0x9040, 0x09e7, + 0x9080, 0x0a26, + 0x9140, 0x0aa3, + 0x9180, 0x0ae2, + 0x9240, 0x0b5f, + 0x9280, 0x0b9e, + 0x9340, 0x0c1b, + 0x9380, 0x0c5a, + 0x9440, 0x0cd7, + 0x9480, 0x0d16, + 0x9540, 0x0d93, + 0x9580, 0x0dd2, + 0x9640, 0x0e4f, + 0x9680, 0x0e8e, + 0x9740, 0x0f0b, + 0x9780, 0x0f4a, + 0x9840, 0x0fc7, + 0x989f, 0x0ffa, + 0x9940, 0x1058, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a80, 0x1153, + 0x9b40, 0x11d0, + 0x9b80, 0x120f, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9d40, 0x1348, + 0x9d80, 0x1387, + 0x9e40, 0x1404, + 0x9e80, 0x1443, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe140, 0x1638, + 0xe180, 0x1677, + 0xe240, 0x16f4, + 0xe280, 0x1733, + 0xe340, 0x17b0, + 0xe380, 0x17ef, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe540, 0x1928, + 0xe580, 0x1967, + 0xe640, 0x19e4, + 0xe680, 0x1a23, + 0xe740, 0x1aa0, + 0xe780, 0x1adf, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xea40, 0x1cd4, + 0xea80, 0x1d13, + 0xeaa3, 0x205c, + 0xed40, 0x20a7, + 0xed80, 0x20e6, + 0xedb4, 0x07c9, + 0xedb5, 0x211a, + 0xee40, 0x2162, + 0xee80, 0x21a1, + 0xeeef, 0x1f9c, + 0xeef9, 0x02ef, + 0xeefa, 0x1f45, + 0xfa40, 0x1f9c, + 0xfa4a, 0x1d97, + 0xfa54, 0x02ef, + 0xfa55, 0x1f45, + 0xfa58, 0x1dc2, + 0xfa59, 0x1dba, + 0xfa5a, 0x1f77, + 0xfa5b, 0x0300, + 0xfa5c, 0x20a7, + 0xfa80, 0x20ca, + 0xfad0, 0x07c9, + 0xfad1, 0x211a, + 0xfb40, 0x2146, + 0xfb80, 0x2185, + 0xfc40, 0x2202, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1290msRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0277, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan1290msRKSJHMap2, 170 +}; + +static Gushort japan1290mspRKSJHMap2[340] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x8740, 0x1d83, + 0x875f, 0x1da1, + 0x8761, 0x1f66, + 0x8762, 0x1da4, + 0x8763, 0x1f68, + 0x8764, 0x1da6, + 0x8765, 0x1f6a, + 0x8766, 0x1da8, + 0x8768, 0x1f6c, + 0x8769, 0x1dab, + 0x876b, 0x1f6b, + 0x876c, 0x1dae, + 0x876e, 0x1f6f, + 0x876f, 0x1db1, + 0x877e, 0x2083, + 0x8780, 0x1db8, + 0x8784, 0x1f77, + 0x8785, 0x1dbd, + 0x8790, 0x02fa, + 0x8791, 0x02f9, + 0x8792, 0x0301, + 0x8793, 0x1dc8, + 0x879a, 0x0300, + 0x879b, 0x1dcf, + 0x889f, 0x0465, + 0x8940, 0x04c3, + 0x8980, 0x0502, + 0x8a40, 0x057f, + 0x8a80, 0x05be, + 0x8b40, 0x063b, + 0x8b80, 0x067a, + 0x8c40, 0x06f7, + 0x8c80, 0x0736, + 0x8d40, 0x07b3, + 0x8d80, 0x07f2, + 0x8e40, 0x086f, + 0x8e80, 0x08ae, + 0x8f40, 0x092b, + 0x8f80, 0x096a, + 0x9040, 0x09e7, + 0x9080, 0x0a26, + 0x9140, 0x0aa3, + 0x9180, 0x0ae2, + 0x9240, 0x0b5f, + 0x9280, 0x0b9e, + 0x9340, 0x0c1b, + 0x9380, 0x0c5a, + 0x9440, 0x0cd7, + 0x9480, 0x0d16, + 0x9540, 0x0d93, + 0x9580, 0x0dd2, + 0x9640, 0x0e4f, + 0x9680, 0x0e8e, + 0x9740, 0x0f0b, + 0x9780, 0x0f4a, + 0x9840, 0x0fc7, + 0x989f, 0x0ffa, + 0x9940, 0x1058, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a80, 0x1153, + 0x9b40, 0x11d0, + 0x9b80, 0x120f, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9d40, 0x1348, + 0x9d80, 0x1387, + 0x9e40, 0x1404, + 0x9e80, 0x1443, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe140, 0x1638, + 0xe180, 0x1677, + 0xe240, 0x16f4, + 0xe280, 0x1733, + 0xe340, 0x17b0, + 0xe380, 0x17ef, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe540, 0x1928, + 0xe580, 0x1967, + 0xe640, 0x19e4, + 0xe680, 0x1a23, + 0xe740, 0x1aa0, + 0xe780, 0x1adf, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xea40, 0x1cd4, + 0xea80, 0x1d13, + 0xeaa3, 0x205c, + 0xed40, 0x20a7, + 0xed80, 0x20e6, + 0xedb4, 0x07c9, + 0xedb5, 0x211a, + 0xee40, 0x2162, + 0xee80, 0x21a1, + 0xeeef, 0x1f9c, + 0xeef9, 0x02ef, + 0xeefa, 0x1f45, + 0xfa40, 0x1f9c, + 0xfa4a, 0x1d97, + 0xfa54, 0x02ef, + 0xfa55, 0x1f45, + 0xfa58, 0x1dc2, + 0xfa59, 0x1dba, + 0xfa5a, 0x1f77, + 0xfa5b, 0x0300, + 0xfa5c, 0x20a7, + 0xfa80, 0x20ca, + 0xfad0, 0x07c9, + 0xfad1, 0x211a, + 0xfb40, 0x2146, + 0xfb80, 0x2185, + 0xfc40, 0x2202, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1290mspRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, + 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, + 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, + 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, + 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, + 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, + 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, + 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, + 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, + 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, + 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan1290mspRKSJHMap2, 170 +}; + +static Gushort japan1290pvRKSJHMap2[518] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x8540, 0x1d83, + 0x855e, 0x1f87, + 0x857c, 0x205e, + 0x8580, 0x2061, + 0x8591, 0x1f7d, + 0x859f, 0x1d97, + 0x85a9, 0x2021, + 0x85ab, 0x2067, + 0x85b3, 0x1f9c, + 0x85bd, 0x206a, + 0x85db, 0x1fb0, + 0x8640, 0x1db1, + 0x8641, 0x1ffa, + 0x8642, 0x1db2, + 0x8643, 0x1f54, + 0x8644, 0x1f56, + 0x8645, 0x206f, + 0x8646, 0x1db7, + 0x8647, 0x1f57, + 0x8648, 0x1db3, + 0x8649, 0x1f55, + 0x864a, 0x1db4, + 0x864b, 0x2070, + 0x864c, 0x1db5, + 0x864e, 0x1f65, + 0x864f, 0x1f58, + 0x8656, 0x2071, + 0x8657, 0x1f64, + 0x8658, 0x1f62, + 0x865a, 0x1f5f, + 0x865d, 0x2072, + 0x869b, 0x1dba, + 0x869e, 0x2073, + 0x869f, 0x1f52, + 0x86a0, 0x1f50, + 0x86a2, 0x1f53, + 0x86a3, 0x2013, + 0x86a4, 0x2015, + 0x86a5, 0x2014, + 0x86a6, 0x2016, + 0x86b3, 0x1f7a, + 0x86b4, 0x1f78, + 0x86b5, 0x2074, + 0x86c7, 0x201b, + 0x86cb, 0x2075, + 0x86cf, 0x1f4e, + 0x86d0, 0x1f4d, + 0x86d1, 0x1f4c, + 0x86d2, 0x1f4b, + 0x86d3, 0x200e, + 0x8740, 0x2005, + 0x8747, 0x1fd6, + 0x8748, 0x200c, + 0x8749, 0x1fd1, + 0x874a, 0x1fca, + 0x874b, 0x1dc4, + 0x874c, 0x1fd7, + 0x874d, 0x1dc2, + 0x874e, 0x1fd2, + 0x874f, 0x1fcd, + 0x8750, 0x1dc3, + 0x8751, 0x1fd5, + 0x8752, 0x1fd3, + 0x8753, 0x1fcf, + 0x8754, 0x1fd4, + 0x8755, 0x1fd0, + 0x8756, 0x1fcb, + 0x8758, 0x1fce, + 0x8791, 0x207d, + 0x8793, 0x1dbd, + 0x8798, 0x1fda, + 0x8799, 0x1fe5, + 0x879a, 0x207f, + 0x879b, 0x1fde, + 0x879c, 0x1fff, + 0x879d, 0x2080, + 0x879e, 0x201f, + 0x879f, 0x1da1, + 0x87a0, 0x1f66, + 0x87a1, 0x1da4, + 0x87a2, 0x1da2, + 0x87a3, 0x1f67, + 0x87a4, 0x1ff7, + 0x87a5, 0x2087, + 0x87a7, 0x1f6a, + 0x87a8, 0x1da8, + 0x87a9, 0x1f68, + 0x87ab, 0x1da6, + 0x87ac, 0x1da9, + 0x87ad, 0x1daf, + 0x87ae, 0x1f6e, + 0x87af, 0x1f6c, + 0x87b0, 0x1dab, + 0x87b1, 0x1f6d, + 0x87b2, 0x1f6b, + 0x87b3, 0x1dac, + 0x87b4, 0x1f6f, + 0x87b5, 0x1dae, + 0x87bd, 0x1f70, + 0x87be, 0x1f73, + 0x87c0, 0x1f71, + 0x87e5, 0x1dc5, + 0x87e8, 0x2083, + 0x87fa, 0x1f76, + 0x87fb, 0x2081, + 0x8840, 0x1dc8, + 0x8841, 0x1dcd, + 0x8854, 0x1db8, + 0x8868, 0x1f16, + 0x886a, 0x2079, + 0x889f, 0x0465, + 0x8940, 0x04c3, + 0x8980, 0x0502, + 0x8a40, 0x057f, + 0x8a80, 0x05be, + 0x8b40, 0x063b, + 0x8b80, 0x067a, + 0x8c40, 0x06f7, + 0x8c80, 0x0736, + 0x8d40, 0x07b3, + 0x8d80, 0x07f2, + 0x8e40, 0x086f, + 0x8e80, 0x08ae, + 0x8f40, 0x092b, + 0x8f80, 0x096a, + 0x9040, 0x09e7, + 0x9080, 0x0a26, + 0x9140, 0x0aa3, + 0x9180, 0x0ae2, + 0x9240, 0x0b5f, + 0x9280, 0x0b9e, + 0x9340, 0x0c1b, + 0x9380, 0x0c5a, + 0x9440, 0x0cd7, + 0x9480, 0x0d16, + 0x9540, 0x0d93, + 0x9580, 0x0dd2, + 0x9640, 0x0e4f, + 0x9680, 0x0e8e, + 0x9740, 0x0f0b, + 0x9780, 0x0f4a, + 0x9840, 0x0fc7, + 0x989f, 0x0ffa, + 0x9940, 0x1058, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a80, 0x1153, + 0x9b40, 0x11d0, + 0x9b80, 0x120f, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9d40, 0x1348, + 0x9d80, 0x1387, + 0x9e40, 0x1404, + 0x9e80, 0x1443, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe140, 0x1638, + 0xe180, 0x1677, + 0xe240, 0x16f4, + 0xe280, 0x1733, + 0xe340, 0x17b0, + 0xe380, 0x17ef, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe540, 0x1928, + 0xe580, 0x1967, + 0xe640, 0x19e4, + 0xe680, 0x1a23, + 0xe740, 0x1aa0, + 0xe780, 0x1adf, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xea40, 0x1cd4, + 0xea80, 0x1d13, + 0xeaa3, 0x205c, + 0xeb41, 0x1ecf, + 0xeb50, 0x1ed1, + 0xeb5b, 0x1ed3, + 0xeb60, 0x1ed6, + 0xeb69, 0x1edb, + 0xeb81, 0x1eed, + 0xec9f, 0x1eee, + 0xeca1, 0x1eef, + 0xeca3, 0x1ef0, + 0xeca5, 0x1ef1, + 0xeca7, 0x1ef2, + 0xecc1, 0x1ef3, + 0xece1, 0x1ef4, + 0xece3, 0x1ef5, + 0xece5, 0x1ef6, + 0xecec, 0x1ef7, + 0xed40, 0x1ef8, + 0xed42, 0x1ef9, + 0xed44, 0x1efa, + 0xed46, 0x1efb, + 0xed48, 0x1efc, + 0xed62, 0x1efd, + 0xed83, 0x1efe, + 0xed85, 0x1eff, + 0xed87, 0x1f00, + 0xed8e, 0x1f01, + 0xed95, 0x1f02, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan1290pvRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, + 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, 0x0010, + 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, + 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, 0x0020, + 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, + 0x0029, 0x002a, 0x002b, 0x002c, 0x002d, 0x002e, 0x002f, 0x0030, + 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, + 0x0039, 0x003a, 0x003b, 0x003c, 0x003d, 0x003e, 0x003f, 0x0040, + 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, + 0x0049, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, + 0x0051, 0x0052, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, + 0x0059, 0x005a, 0x005b, 0x005c, 0x005d, 0x005e, 0x005f, 0x0000, + 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0098, 0x00e4, 0x007c }, + japan1290pvRKSJHMap2, 259 +}; + +static Gushort japan12AddHMap2[1266] = { + 0x0000, 0x0000, + 0x2121, 0x0279, + 0x2221, 0x02d7, + 0x223a, 0x02e5, + 0x224a, 0x02ed, + 0x225c, 0x02f4, + 0x2272, 0x0303, + 0x227e, 0x030b, + 0x2330, 0x030c, + 0x2341, 0x0316, + 0x2361, 0x0330, + 0x2421, 0x034a, + 0x2474, 0x1f16, + 0x2521, 0x039d, + 0x2621, 0x03f3, + 0x2641, 0x040b, + 0x2721, 0x0423, + 0x2751, 0x0444, + 0x2821, 0x1d37, + 0x2822, 0x1d39, + 0x2823, 0x1d43, + 0x2824, 0x1d47, + 0x2825, 0x1d4f, + 0x2826, 0x1d4b, + 0x2827, 0x1d53, + 0x2828, 0x1d63, + 0x2829, 0x1d5b, + 0x282a, 0x1d6b, + 0x282b, 0x1d73, + 0x282c, 0x1d38, + 0x282d, 0x1d3a, + 0x282e, 0x1d46, + 0x282f, 0x1d4a, + 0x2830, 0x1d52, + 0x2831, 0x1d4e, + 0x2832, 0x1d5a, + 0x2833, 0x1d6a, + 0x2834, 0x1d62, + 0x2835, 0x1d72, + 0x2836, 0x1d82, + 0x2837, 0x1d57, + 0x2838, 0x1d66, + 0x2839, 0x1d5f, + 0x283a, 0x1d6e, + 0x283b, 0x1d76, + 0x283c, 0x1d54, + 0x283d, 0x1d67, + 0x283e, 0x1d5c, + 0x283f, 0x1d6f, + 0x2840, 0x1d79, + 0x3021, 0x0465, + 0x3022, 0x1dd1, + 0x3023, 0x0467, + 0x3032, 0x1f19, + 0x3033, 0x0477, + 0x303b, 0x1dd2, + 0x303c, 0x0480, + 0x306e, 0x1dd3, + 0x306f, 0x04b3, + 0x3071, 0x1f1a, + 0x3072, 0x04b6, + 0x3073, 0x1dd4, + 0x3074, 0x04b8, + 0x307c, 0x1dd5, + 0x307d, 0x04c1, + 0x3121, 0x04c3, + 0x312a, 0x1dd6, + 0x312b, 0x04cd, + 0x3133, 0x1f1b, + 0x3134, 0x04d6, + 0x3135, 0x1dd7, + 0x3136, 0x04d8, + 0x3139, 0x1f1c, + 0x313a, 0x04dc, + 0x313d, 0x1dda, + 0x313e, 0x04e0, + 0x3142, 0x1ddb, + 0x3143, 0x04e5, + 0x316b, 0x1ddc, + 0x316c, 0x050e, + 0x3221, 0x0521, + 0x3228, 0x1ddd, + 0x3229, 0x0529, + 0x322a, 0x1dde, + 0x322b, 0x052b, + 0x3260, 0x1ddf, + 0x3261, 0x0561, + 0x3267, 0x1f1d, + 0x3268, 0x0568, + 0x327a, 0x1de0, + 0x327b, 0x057b, + 0x3321, 0x057f, + 0x3322, 0x1de2, + 0x3323, 0x0581, + 0x336b, 0x1de4, + 0x336c, 0x05ca, + 0x3373, 0x1de5, + 0x3374, 0x05d2, + 0x337a, 0x1de6, + 0x337b, 0x05d9, + 0x3421, 0x05dd, + 0x3442, 0x1de7, + 0x3443, 0x05ff, + 0x344d, 0x1de8, + 0x344e, 0x060a, + 0x3465, 0x1de9, + 0x3466, 0x0622, + 0x3521, 0x063b, + 0x352b, 0x1dea, + 0x352c, 0x0646, + 0x3540, 0x1deb, + 0x3541, 0x065b, + 0x3562, 0x1f1e, + 0x3563, 0x067d, + 0x3568, 0x1f1f, + 0x3569, 0x0683, + 0x3621, 0x0699, + 0x3622, 0x1dec, + 0x3623, 0x069b, + 0x362a, 0x1ded, + 0x362b, 0x06a3, + 0x3642, 0x1f20, + 0x3643, 0x06bb, + 0x364f, 0x1dee, + 0x3650, 0x06c8, + 0x366d, 0x1def, + 0x366e, 0x06e6, + 0x3674, 0x1df0, + 0x3675, 0x06ed, + 0x367b, 0x1df1, + 0x367c, 0x06f4, + 0x367d, 0x1df2, + 0x367e, 0x06f6, + 0x3721, 0x06f7, + 0x3737, 0x1df4, + 0x3738, 0x070e, + 0x3752, 0x1df7, + 0x3753, 0x0729, + 0x3771, 0x1dfa, + 0x3772, 0x0748, + 0x377d, 0x1f21, + 0x377e, 0x1dfc, + 0x3821, 0x0755, + 0x3834, 0x1dfd, + 0x3835, 0x0769, + 0x3841, 0x1dfe, + 0x3842, 0x0776, + 0x3921, 0x07b3, + 0x392b, 0x1dff, + 0x392c, 0x07be, + 0x396d, 0x1e02, + 0x396e, 0x0800, + 0x3974, 0x1e03, + 0x3975, 0x0807, + 0x3979, 0x1e04, + 0x397a, 0x080c, + 0x3a21, 0x0811, + 0x3a53, 0x1e05, + 0x3a54, 0x0844, + 0x3a67, 0x1e06, + 0x3a68, 0x0858, + 0x3a74, 0x1e07, + 0x3a75, 0x0865, + 0x3b21, 0x086f, + 0x3b27, 0x1e08, + 0x3b28, 0x0876, + 0x3b2a, 0x1e09, + 0x3b2b, 0x0879, + 0x3b2c, 0x1e0a, + 0x3b2d, 0x087b, + 0x3b39, 0x1e0b, + 0x3b3a, 0x0888, + 0x3b41, 0x1f22, + 0x3b42, 0x0890, + 0x3c21, 0x08cd, + 0x3c48, 0x1e0d, + 0x3c49, 0x08f5, + 0x3c5d, 0x1e0f, + 0x3c5f, 0x090b, + 0x3d21, 0x092b, + 0x3d2b, 0x1e11, + 0x3d2c, 0x0936, + 0x3d36, 0x1e12, + 0x3d37, 0x0941, + 0x3d6c, 0x1e13, + 0x3d6d, 0x0977, + 0x3d72, 0x1e15, + 0x3d74, 0x097e, + 0x3e21, 0x0989, + 0x3e25, 0x1e17, + 0x3e26, 0x098e, + 0x3e33, 0x1e18, + 0x3e34, 0x099c, + 0x3e55, 0x1e1a, + 0x3e56, 0x09be, + 0x3e5f, 0x1e1b, + 0x3e60, 0x09c8, + 0x3e64, 0x1e1c, + 0x3e65, 0x09cd, + 0x3f21, 0x09e7, + 0x3f2a, 0x1e1d, + 0x3f2b, 0x09f1, + 0x3f59, 0x1f23, + 0x3f5a, 0x0a20, + 0x3f60, 0x1e1f, + 0x3f61, 0x0a27, + 0x4021, 0x0a45, + 0x4022, 0x1e21, + 0x4023, 0x0a47, + 0x4066, 0x1e23, + 0x4067, 0x0a8b, + 0x4071, 0x1e24, + 0x4072, 0x0a96, + 0x4079, 0x1e26, + 0x407a, 0x1f24, + 0x407b, 0x0a9f, + 0x407c, 0x1f25, + 0x407e, 0x0aa2, + 0x4121, 0x0aa3, + 0x4127, 0x1e28, + 0x4128, 0x0aaa, + 0x4139, 0x1e29, + 0x413a, 0x0abc, + 0x414c, 0x1e2a, + 0x414d, 0x0acf, + 0x414f, 0x1e2b, + 0x4150, 0x0ad2, + 0x415f, 0x1e2c, + 0x4160, 0x0ae2, + 0x4169, 0x1e2d, + 0x416a, 0x0aec, + 0x4221, 0x0b01, + 0x4237, 0x1f27, + 0x4238, 0x0b18, + 0x423d, 0x1e2e, + 0x423e, 0x0b1e, + 0x424d, 0x1e2f, + 0x424e, 0x0b2e, + 0x425c, 0x1e30, + 0x425d, 0x0b3d, + 0x4263, 0x1e31, + 0x4264, 0x0b44, + 0x426f, 0x1e32, + 0x4270, 0x0b50, + 0x427d, 0x1e35, + 0x427e, 0x0b5e, + 0x4321, 0x0b5f, + 0x4327, 0x1e36, + 0x4328, 0x0b66, + 0x4329, 0x1e37, + 0x432a, 0x0b68, + 0x432d, 0x1e39, + 0x432f, 0x0b6d, + 0x433d, 0x1e3b, + 0x433e, 0x0b7c, + 0x4370, 0x1e3c, + 0x4371, 0x0baf, + 0x4375, 0x1e3d, + 0x4376, 0x0bb4, + 0x437c, 0x1e3e, + 0x437d, 0x0bbb, + 0x4421, 0x0bbd, + 0x443d, 0x1e3f, + 0x443e, 0x0bda, + 0x4448, 0x1e40, + 0x4449, 0x0be5, + 0x444a, 0x1e41, + 0x444b, 0x0be7, + 0x444f, 0x1e43, + 0x4450, 0x0bec, + 0x4521, 0x0c1b, + 0x4522, 0x1e44, + 0x4523, 0x0c1d, + 0x4527, 0x1e45, + 0x4528, 0x0c22, + 0x452e, 0x1e46, + 0x452f, 0x0c29, + 0x4536, 0x1e47, + 0x4537, 0x0c31, + 0x453f, 0x1e48, + 0x4540, 0x0c3a, + 0x4548, 0x1e49, + 0x4549, 0x0c43, + 0x454b, 0x1e4a, + 0x454c, 0x0c46, + 0x4551, 0x1f28, + 0x4552, 0x1e4c, + 0x4553, 0x0c4d, + 0x4564, 0x1e4d, + 0x4565, 0x0c5f, + 0x4578, 0x1e4e, + 0x4579, 0x0c73, + 0x4621, 0x0c79, + 0x4642, 0x1e50, + 0x4643, 0x0c9b, + 0x4654, 0x1e51, + 0x4655, 0x0cad, + 0x465b, 0x1e53, + 0x465c, 0x0cb4, + 0x4666, 0x1e56, + 0x4668, 0x0cc0, + 0x466a, 0x1e58, + 0x466b, 0x0cc3, + 0x4676, 0x1ec0, + 0x4677, 0x0ccf, + 0x4721, 0x0cd7, + 0x4729, 0x1e59, + 0x472a, 0x1f29, + 0x472b, 0x0ce1, + 0x4739, 0x1e5a, + 0x473a, 0x0cf0, + 0x4757, 0x1e5b, + 0x4758, 0x0d0e, + 0x4767, 0x1e5c, + 0x4768, 0x0d1e, + 0x4769, 0x1e5d, + 0x476a, 0x0d20, + 0x476d, 0x1e5e, + 0x476e, 0x0d24, + 0x4821, 0x0d35, + 0x4824, 0x1e5f, + 0x4825, 0x0d39, + 0x482e, 0x1e60, + 0x482f, 0x0d43, + 0x4830, 0x1e61, + 0x4831, 0x0d45, + 0x4840, 0x1f2a, + 0x4841, 0x0d55, + 0x4854, 0x1e62, + 0x4855, 0x0d69, + 0x4875, 0x1e64, + 0x4876, 0x0d8a, + 0x4921, 0x0d93, + 0x4922, 0x1e65, + 0x4924, 0x0d96, + 0x492f, 0x1e67, + 0x4930, 0x0da2, + 0x4932, 0x1e68, + 0x4933, 0x0da5, + 0x4935, 0x1e69, + 0x4936, 0x0da8, + 0x4940, 0x1e6a, + 0x4941, 0x0db3, + 0x494e, 0x1e6b, + 0x494f, 0x0dc1, + 0x4a21, 0x0df1, + 0x4a43, 0x1e6d, + 0x4a44, 0x0e14, + 0x4a4d, 0x1e6e, + 0x4a4e, 0x0e1e, + 0x4a53, 0x1f2b, + 0x4a54, 0x0e24, + 0x4a5a, 0x1e6f, + 0x4a5b, 0x0e2b, + 0x4a79, 0x1e70, + 0x4a7a, 0x0e4a, + 0x4b21, 0x0e4f, + 0x4b29, 0x1e72, + 0x4b2a, 0x0e58, + 0x4b4b, 0x1e73, + 0x4b4c, 0x0e7a, + 0x4b70, 0x1e74, + 0x4b71, 0x0e9f, + 0x4b78, 0x1f2c, + 0x4b79, 0x0ea7, + 0x4c21, 0x0ead, + 0x4c4d, 0x1e75, + 0x4c4e, 0x0eda, + 0x4c59, 0x1e76, + 0x4c5a, 0x0ee6, + 0x4c5f, 0x1e77, + 0x4c60, 0x0eec, + 0x4c62, 0x1e78, + 0x4c63, 0x0eef, + 0x4c7a, 0x1e79, + 0x4c7b, 0x0f07, + 0x4c7c, 0x1e7a, + 0x4c7d, 0x0f09, + 0x4d21, 0x0f0b, + 0x4d32, 0x1e7c, + 0x4d33, 0x0f1d, + 0x4d50, 0x1e7d, + 0x4d51, 0x0f3b, + 0x4d54, 0x1e7e, + 0x4d55, 0x0f3f, + 0x4d69, 0x1e7f, + 0x4d6a, 0x0f54, + 0x4e21, 0x0f69, + 0x4e7a, 0x1e81, + 0x4e7c, 0x1f2d, + 0x4e7d, 0x0fc5, + 0x4f21, 0x1e83, + 0x4f22, 0x0fc8, + 0x4f31, 0x1e84, + 0x4f32, 0x0fd8, + 0x4f39, 0x1e85, + 0x4f3a, 0x0fe0, + 0x5021, 0x0ffa, + 0x5121, 0x1058, + 0x5122, 0x1f2e, + 0x5123, 0x105a, + 0x513d, 0x1e86, + 0x513e, 0x1075, + 0x514d, 0x1e89, + 0x514e, 0x1085, + 0x5221, 0x10b6, + 0x5238, 0x1f2f, + 0x5239, 0x10ce, + 0x5321, 0x1114, + 0x5330, 0x1e8a, + 0x5331, 0x1124, + 0x533a, 0x1e8b, + 0x533b, 0x112e, + 0x5348, 0x1f30, + 0x5349, 0x113c, + 0x535e, 0x1e8d, + 0x535f, 0x1152, + 0x536b, 0x1e8e, + 0x536c, 0x1f31, + 0x536d, 0x1160, + 0x5421, 0x1172, + 0x5444, 0x1e8f, + 0x5445, 0x1f32, + 0x5446, 0x1197, + 0x546c, 0x1f33, + 0x546d, 0x11be, + 0x5521, 0x11d0, + 0x553d, 0x1e90, + 0x553e, 0x11ed, + 0x5563, 0x1e91, + 0x5564, 0x1213, + 0x5578, 0x1f34, + 0x5579, 0x1228, + 0x5621, 0x122e, + 0x5622, 0x1e92, + 0x5623, 0x1230, + 0x567d, 0x1f35, + 0x5721, 0x128c, + 0x5821, 0x12ea, + 0x5824, 0x1e94, + 0x5825, 0x12ee, + 0x5921, 0x1348, + 0x5928, 0x1f37, + 0x5929, 0x1350, + 0x5960, 0x1e95, + 0x5961, 0x1388, + 0x596c, 0x1e96, + 0x596d, 0x1394, + 0x5a21, 0x13a6, + 0x5a39, 0x1e97, + 0x5a3a, 0x13bf, + 0x5a7a, 0x1f38, + 0x5a7b, 0x1400, + 0x5b21, 0x1404, + 0x5b45, 0x1e99, + 0x5b46, 0x1429, + 0x5b6b, 0x1e9b, + 0x5b6c, 0x144f, + 0x5c21, 0x1462, + 0x5d21, 0x14c0, + 0x5d61, 0x1f39, + 0x5d62, 0x1501, + 0x5e21, 0x151e, + 0x5e50, 0x1e9d, + 0x5e51, 0x154e, + 0x5e56, 0x1f3a, + 0x5e57, 0x1554, + 0x5e76, 0x1f3b, + 0x5e77, 0x1574, + 0x5f21, 0x157c, + 0x5f73, 0x1e9e, + 0x5f74, 0x15cf, + 0x6021, 0x15da, + 0x6026, 0x1e9f, + 0x6027, 0x15e0, + 0x605f, 0x1ea0, + 0x6060, 0x1619, + 0x6121, 0x1638, + 0x612b, 0x1ea1, + 0x612c, 0x1643, + 0x6221, 0x1696, + 0x626f, 0x1ea5, + 0x6270, 0x16e5, + 0x6321, 0x16f4, + 0x634a, 0x1ea6, + 0x634b, 0x171e, + 0x6354, 0x1ea7, + 0x6355, 0x1728, + 0x6359, 0x1f3c, + 0x635a, 0x172d, + 0x6421, 0x1752, + 0x6439, 0x1ea8, + 0x643a, 0x176b, + 0x6440, 0x1f3d, + 0x6441, 0x1772, + 0x6464, 0x1ea9, + 0x6465, 0x1796, + 0x646e, 0x1eaa, + 0x646f, 0x17a0, + 0x6521, 0x17b0, + 0x6539, 0x1eab, + 0x653a, 0x17c9, + 0x653b, 0x1eac, + 0x653c, 0x17cb, + 0x6546, 0x1ead, + 0x6547, 0x17d6, + 0x6621, 0x180e, + 0x6649, 0x1f3e, + 0x664a, 0x1837, + 0x6721, 0x186c, + 0x6764, 0x1eaf, + 0x6765, 0x18b0, + 0x6769, 0x1eb0, + 0x676a, 0x18b5, + 0x6772, 0x1eb1, + 0x6773, 0x18be, + 0x6821, 0x18ca, + 0x683b, 0x1eb3, + 0x683c, 0x18e5, + 0x684d, 0x1f3f, + 0x684e, 0x18f7, + 0x6921, 0x1928, + 0x697e, 0x1f40, + 0x6a21, 0x1986, + 0x6a3c, 0x1f41, + 0x6a3e, 0x19a3, + 0x6a6f, 0x1eb8, + 0x6a70, 0x19d5, + 0x6b21, 0x19e4, + 0x6b32, 0x1eb9, + 0x6b33, 0x19f6, + 0x6b66, 0x1eba, + 0x6b67, 0x1a2a, + 0x6c21, 0x1a42, + 0x6c69, 0x1ebc, + 0x6c6a, 0x1a8b, + 0x6d21, 0x1aa0, + 0x6d4e, 0x1ebe, + 0x6d4f, 0x1ace, + 0x6e21, 0x1afe, + 0x6e29, 0x1ec1, + 0x6e2a, 0x1b07, + 0x6e3d, 0x1ec2, + 0x6e3e, 0x1b1b, + 0x6f21, 0x1b5c, + 0x7021, 0x1bba, + 0x7051, 0x1ec7, + 0x7052, 0x1beb, + 0x7121, 0x1c18, + 0x7159, 0x1f43, + 0x715a, 0x1c51, + 0x7221, 0x1c76, + 0x722d, 0x1eca, + 0x722e, 0x1c83, + 0x723c, 0x1ecb, + 0x723d, 0x1c92, + 0x724e, 0x1ecc, + 0x724f, 0x1ca4, + 0x7321, 0x1cd4, + 0x7351, 0x1ecd, + 0x7352, 0x1f44, + 0x7353, 0x1d06, + 0x737d, 0x1ece, + 0x737e, 0x1d31, + 0x7421, 0x1d32, + 0x7425, 0x205c, + 0x7721, 0x1f45, + 0x7727, 0x1f48, + 0x7728, 0x0300, + 0x7729, 0x02fa, + 0x772a, 0x02f9, + 0x772e, 0x1f49, + 0x773c, 0x1db1, + 0x773f, 0x1f54, + 0x7740, 0x1db7, + 0x7741, 0x1f55, + 0x7744, 0x1db4, + 0x7747, 0x1f58, + 0x7751, 0x0303, + 0x7752, 0x1f62, + 0x7753, 0x0304, + 0x7754, 0x1f63, + 0x7757, 0x1f65, + 0x7759, 0x1da4, + 0x775a, 0x1da1, + 0x775b, 0x1f66, + 0x775c, 0x1da2, + 0x775d, 0x1f67, + 0x7760, 0x1da6, + 0x7761, 0x1f6a, + 0x7762, 0x1da8, + 0x7763, 0x1dac, + 0x7764, 0x1f6b, + 0x7765, 0x1dae, + 0x7766, 0x1dab, + 0x7767, 0x1f6c, + 0x7769, 0x1daf, + 0x776a, 0x1f6e, + 0x7774, 0x1f75, + 0x777a, 0x1dba, + 0x777b, 0x1f7b, + 0x777e, 0x1f7c, + 0x7829, 0x1f7d, + 0x7834, 0x1f87, + 0x7849, 0x1d83, + 0x785d, 0x1f9b, + 0x785e, 0x1d97, + 0x786b, 0x1f9c, + 0x7921, 0x1fb0, + 0x7945, 0x1f16, + 0x7949, 0x1fca, + 0x794b, 0x1dc4, + 0x794c, 0x1fcc, + 0x794f, 0x1dc3, + 0x7950, 0x1fcf, + 0x7955, 0x1dc2, + 0x7956, 0x1fd4, + 0x795d, 0x1fd8, + 0x796f, 0x1fe6, + 0x7d21, 0x1ecf, + 0x7d23, 0x204c, + 0x7d24, 0x2052, + 0x7d25, 0x1ed1, + 0x7d2f, 0x205a, + 0x7d30, 0x2053, + 0x7d31, 0x2058, + 0x7d32, 0x2055, + 0x7d33, 0x1edb, + 0x7d45, 0x1eee, + 0x7d5b, 0x2048, + 0x7d6d, 0x02e0, + 0x7d71, 0x1ff6, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12AddHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12AddHMap2, 633 +}; + +static Gushort japan12AddRKSJHMap2[1270] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x82f2, 0x1f16, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x889f, 0x0465, + 0x88a0, 0x1dd1, + 0x88a1, 0x0467, + 0x88b0, 0x1f19, + 0x88b1, 0x0477, + 0x88b9, 0x1dd2, + 0x88ba, 0x0480, + 0x88ec, 0x1dd3, + 0x88ed, 0x04b3, + 0x88ef, 0x1f1a, + 0x88f0, 0x04b6, + 0x88f1, 0x1dd4, + 0x88f2, 0x04b8, + 0x88fa, 0x1dd5, + 0x88fb, 0x04c1, + 0x8940, 0x04c3, + 0x8949, 0x1dd6, + 0x894a, 0x04cd, + 0x8952, 0x1f1b, + 0x8953, 0x04d6, + 0x8954, 0x1dd7, + 0x8955, 0x04d8, + 0x8958, 0x1f1c, + 0x8959, 0x04dc, + 0x895c, 0x1dda, + 0x895d, 0x04e0, + 0x8961, 0x1ddb, + 0x8962, 0x04e5, + 0x8980, 0x0502, + 0x898b, 0x1ddc, + 0x898c, 0x050e, + 0x89a6, 0x1ddd, + 0x89a7, 0x0529, + 0x89a8, 0x1dde, + 0x89a9, 0x052b, + 0x89de, 0x1ddf, + 0x89df, 0x0561, + 0x89e5, 0x1f1d, + 0x89e6, 0x0568, + 0x89f8, 0x1de0, + 0x89f9, 0x057b, + 0x8a40, 0x057f, + 0x8a41, 0x1de2, + 0x8a42, 0x0581, + 0x8a80, 0x05be, + 0x8a8b, 0x1de4, + 0x8a8c, 0x05ca, + 0x8a93, 0x1de5, + 0x8a94, 0x05d2, + 0x8a9a, 0x1de6, + 0x8a9b, 0x05d9, + 0x8ac0, 0x1de7, + 0x8ac1, 0x05ff, + 0x8acb, 0x1de8, + 0x8acc, 0x060a, + 0x8ae3, 0x1de9, + 0x8ae4, 0x0622, + 0x8b40, 0x063b, + 0x8b4a, 0x1dea, + 0x8b4b, 0x0646, + 0x8b5f, 0x1deb, + 0x8b60, 0x065b, + 0x8b80, 0x067a, + 0x8b82, 0x1f1e, + 0x8b83, 0x067d, + 0x8b88, 0x1f1f, + 0x8b89, 0x0683, + 0x8ba0, 0x1dec, + 0x8ba1, 0x069b, + 0x8ba8, 0x1ded, + 0x8ba9, 0x06a3, + 0x8bc0, 0x1f20, + 0x8bc1, 0x06bb, + 0x8bcd, 0x1dee, + 0x8bce, 0x06c8, + 0x8beb, 0x1def, + 0x8bec, 0x06e6, + 0x8bf2, 0x1df0, + 0x8bf3, 0x06ed, + 0x8bf9, 0x1df1, + 0x8bfa, 0x06f4, + 0x8bfb, 0x1df2, + 0x8bfc, 0x06f6, + 0x8c40, 0x06f7, + 0x8c56, 0x1df4, + 0x8c57, 0x070e, + 0x8c71, 0x1df7, + 0x8c72, 0x0729, + 0x8c80, 0x0736, + 0x8c91, 0x1dfa, + 0x8c92, 0x0748, + 0x8c9d, 0x1f21, + 0x8c9e, 0x1dfc, + 0x8c9f, 0x0755, + 0x8cb2, 0x1dfd, + 0x8cb3, 0x0769, + 0x8cbf, 0x1dfe, + 0x8cc0, 0x0776, + 0x8d40, 0x07b3, + 0x8d4a, 0x1dff, + 0x8d4b, 0x07be, + 0x8d80, 0x07f2, + 0x8d8d, 0x1e02, + 0x8d8e, 0x0800, + 0x8d94, 0x1e03, + 0x8d95, 0x0807, + 0x8d99, 0x1e04, + 0x8d9a, 0x080c, + 0x8dd1, 0x1e05, + 0x8dd2, 0x0844, + 0x8de5, 0x1e06, + 0x8de6, 0x0858, + 0x8df2, 0x1e07, + 0x8df3, 0x0865, + 0x8e40, 0x086f, + 0x8e46, 0x1e08, + 0x8e47, 0x0876, + 0x8e49, 0x1e09, + 0x8e4a, 0x0879, + 0x8e4b, 0x1e0a, + 0x8e4c, 0x087b, + 0x8e58, 0x1e0b, + 0x8e59, 0x0888, + 0x8e60, 0x1f22, + 0x8e61, 0x0890, + 0x8e80, 0x08ae, + 0x8ec6, 0x1e0d, + 0x8ec7, 0x08f5, + 0x8edb, 0x1e0f, + 0x8edd, 0x090b, + 0x8f40, 0x092b, + 0x8f4a, 0x1e11, + 0x8f4b, 0x0936, + 0x8f55, 0x1e12, + 0x8f56, 0x0941, + 0x8f80, 0x096a, + 0x8f8c, 0x1e13, + 0x8f8d, 0x0977, + 0x8f92, 0x1e15, + 0x8f94, 0x097e, + 0x8fa3, 0x1e17, + 0x8fa4, 0x098e, + 0x8fb1, 0x1e18, + 0x8fb2, 0x099c, + 0x8fd3, 0x1e1a, + 0x8fd4, 0x09be, + 0x8fdd, 0x1e1b, + 0x8fde, 0x09c8, + 0x8fe2, 0x1e1c, + 0x8fe3, 0x09cd, + 0x9040, 0x09e7, + 0x9049, 0x1e1d, + 0x904a, 0x09f1, + 0x9078, 0x1f23, + 0x9079, 0x0a20, + 0x9080, 0x1e1f, + 0x9081, 0x0a27, + 0x90a0, 0x1e21, + 0x90a1, 0x0a47, + 0x90e4, 0x1e23, + 0x90e5, 0x0a8b, + 0x90ef, 0x1e24, + 0x90f0, 0x0a96, + 0x90f7, 0x1e26, + 0x90f8, 0x1f24, + 0x90f9, 0x0a9f, + 0x90fa, 0x1f25, + 0x90fc, 0x0aa2, + 0x9140, 0x0aa3, + 0x9146, 0x1e28, + 0x9147, 0x0aaa, + 0x9158, 0x1e29, + 0x9159, 0x0abc, + 0x916b, 0x1e2a, + 0x916c, 0x0acf, + 0x916e, 0x1e2b, + 0x916f, 0x0ad2, + 0x917e, 0x1e2c, + 0x9180, 0x0ae2, + 0x9189, 0x1e2d, + 0x918a, 0x0aec, + 0x91b5, 0x1f27, + 0x91b6, 0x0b18, + 0x91bb, 0x1e2e, + 0x91bc, 0x0b1e, + 0x91cb, 0x1e2f, + 0x91cc, 0x0b2e, + 0x91da, 0x1e30, + 0x91db, 0x0b3d, + 0x91e1, 0x1e31, + 0x91e2, 0x0b44, + 0x91ed, 0x1e32, + 0x91ee, 0x0b50, + 0x91fb, 0x1e35, + 0x91fc, 0x0b5e, + 0x9240, 0x0b5f, + 0x9246, 0x1e36, + 0x9247, 0x0b66, + 0x9248, 0x1e37, + 0x9249, 0x0b68, + 0x924c, 0x1e39, + 0x924e, 0x0b6d, + 0x925c, 0x1e3b, + 0x925d, 0x0b7c, + 0x9280, 0x0b9e, + 0x9290, 0x1e3c, + 0x9291, 0x0baf, + 0x9295, 0x1e3d, + 0x9296, 0x0bb4, + 0x929c, 0x1e3e, + 0x929d, 0x0bbb, + 0x92bb, 0x1e3f, + 0x92bc, 0x0bda, + 0x92c6, 0x1e40, + 0x92c7, 0x0be5, + 0x92c8, 0x1e41, + 0x92c9, 0x0be7, + 0x92cd, 0x1e43, + 0x92ce, 0x0bec, + 0x9340, 0x0c1b, + 0x9341, 0x1e44, + 0x9342, 0x0c1d, + 0x9346, 0x1e45, + 0x9347, 0x0c22, + 0x934d, 0x1e46, + 0x934e, 0x0c29, + 0x9355, 0x1e47, + 0x9356, 0x0c31, + 0x935e, 0x1e48, + 0x935f, 0x0c3a, + 0x9367, 0x1e49, + 0x9368, 0x0c43, + 0x936a, 0x1e4a, + 0x936b, 0x0c46, + 0x9370, 0x1f28, + 0x9371, 0x1e4c, + 0x9372, 0x0c4d, + 0x9380, 0x0c5a, + 0x9384, 0x1e4d, + 0x9385, 0x0c5f, + 0x9398, 0x1e4e, + 0x9399, 0x0c73, + 0x93c0, 0x1e50, + 0x93c1, 0x0c9b, + 0x93d2, 0x1e51, + 0x93d3, 0x0cad, + 0x93d9, 0x1e53, + 0x93da, 0x0cb4, + 0x93e4, 0x1e56, + 0x93e6, 0x0cc0, + 0x93e8, 0x1e58, + 0x93e9, 0x0cc3, + 0x93f4, 0x1ec0, + 0x93f5, 0x0ccf, + 0x9440, 0x0cd7, + 0x9448, 0x1e59, + 0x9449, 0x1f29, + 0x944a, 0x0ce1, + 0x9458, 0x1e5a, + 0x9459, 0x0cf0, + 0x9476, 0x1e5b, + 0x9477, 0x0d0e, + 0x9480, 0x0d16, + 0x9487, 0x1e5c, + 0x9488, 0x0d1e, + 0x9489, 0x1e5d, + 0x948a, 0x0d20, + 0x948d, 0x1e5e, + 0x948e, 0x0d24, + 0x94a2, 0x1e5f, + 0x94a3, 0x0d39, + 0x94ac, 0x1e60, + 0x94ad, 0x0d43, + 0x94ae, 0x1e61, + 0x94af, 0x0d45, + 0x94be, 0x1f2a, + 0x94bf, 0x0d55, + 0x94d2, 0x1e62, + 0x94d3, 0x0d69, + 0x94f3, 0x1e64, + 0x94f4, 0x0d8a, + 0x9540, 0x0d93, + 0x9541, 0x1e65, + 0x9543, 0x0d96, + 0x954e, 0x1e67, + 0x954f, 0x0da2, + 0x9551, 0x1e68, + 0x9552, 0x0da5, + 0x9554, 0x1e69, + 0x9555, 0x0da8, + 0x955f, 0x1e6a, + 0x9560, 0x0db3, + 0x956d, 0x1e6b, + 0x956e, 0x0dc1, + 0x9580, 0x0dd2, + 0x95c1, 0x1e6d, + 0x95c2, 0x0e14, + 0x95cb, 0x1e6e, + 0x95cc, 0x0e1e, + 0x95d1, 0x1f2b, + 0x95d2, 0x0e24, + 0x95d8, 0x1e6f, + 0x95d9, 0x0e2b, + 0x95f7, 0x1e70, + 0x95f8, 0x0e4a, + 0x9640, 0x0e4f, + 0x9648, 0x1e72, + 0x9649, 0x0e58, + 0x966a, 0x1e73, + 0x966b, 0x0e7a, + 0x9680, 0x0e8e, + 0x9690, 0x1e74, + 0x9691, 0x0e9f, + 0x9698, 0x1f2c, + 0x9699, 0x0ea7, + 0x96cb, 0x1e75, + 0x96cc, 0x0eda, + 0x96d7, 0x1e76, + 0x96d8, 0x0ee6, + 0x96dd, 0x1e77, + 0x96de, 0x0eec, + 0x96e0, 0x1e78, + 0x96e1, 0x0eef, + 0x96f8, 0x1e79, + 0x96f9, 0x0f07, + 0x96fa, 0x1e7a, + 0x96fb, 0x0f09, + 0x9740, 0x0f0b, + 0x9751, 0x1e7c, + 0x9752, 0x0f1d, + 0x976f, 0x1e7d, + 0x9770, 0x0f3b, + 0x9773, 0x1e7e, + 0x9774, 0x0f3f, + 0x9780, 0x0f4a, + 0x9789, 0x1e7f, + 0x978a, 0x0f54, + 0x97f8, 0x1e81, + 0x97fa, 0x1f2d, + 0x97fb, 0x0fc5, + 0x9840, 0x1e83, + 0x9841, 0x0fc8, + 0x9850, 0x1e84, + 0x9851, 0x0fd8, + 0x9858, 0x1e85, + 0x9859, 0x0fe0, + 0x989f, 0x0ffa, + 0x9940, 0x1058, + 0x9941, 0x1f2e, + 0x9942, 0x105a, + 0x995c, 0x1e86, + 0x995d, 0x1075, + 0x996c, 0x1e89, + 0x996d, 0x1085, + 0x9980, 0x1097, + 0x99b6, 0x1f2f, + 0x99b7, 0x10ce, + 0x9a40, 0x1114, + 0x9a4f, 0x1e8a, + 0x9a50, 0x1124, + 0x9a59, 0x1e8b, + 0x9a5a, 0x112e, + 0x9a67, 0x1f30, + 0x9a68, 0x113c, + 0x9a7d, 0x1e8d, + 0x9a7e, 0x1152, + 0x9a80, 0x1153, + 0x9a8b, 0x1e8e, + 0x9a8c, 0x1f31, + 0x9a8d, 0x1160, + 0x9ac2, 0x1e8f, + 0x9ac3, 0x1f32, + 0x9ac4, 0x1197, + 0x9aea, 0x1f33, + 0x9aeb, 0x11be, + 0x9b40, 0x11d0, + 0x9b5c, 0x1e90, + 0x9b5d, 0x11ed, + 0x9b80, 0x120f, + 0x9b83, 0x1e91, + 0x9b84, 0x1213, + 0x9b98, 0x1f34, + 0x9b99, 0x1228, + 0x9ba0, 0x1e92, + 0x9ba1, 0x1230, + 0x9bfb, 0x1f35, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9ca2, 0x1e94, + 0x9ca3, 0x12ee, + 0x9d40, 0x1348, + 0x9d47, 0x1f37, + 0x9d48, 0x1350, + 0x9d80, 0x1e95, + 0x9d81, 0x1388, + 0x9d8c, 0x1e96, + 0x9d8d, 0x1394, + 0x9db7, 0x1e97, + 0x9db8, 0x13bf, + 0x9df8, 0x1f38, + 0x9df9, 0x1400, + 0x9e40, 0x1404, + 0x9e64, 0x1e99, + 0x9e65, 0x1429, + 0x9e80, 0x1443, + 0x9e8b, 0x1e9b, + 0x9e8c, 0x144f, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0x9f81, 0x1f39, + 0x9f82, 0x1501, + 0x9fce, 0x1e9d, + 0x9fcf, 0x154e, + 0x9fd4, 0x1f3a, + 0x9fd5, 0x1554, + 0x9ff4, 0x1f3b, + 0x9ff5, 0x1574, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe093, 0x1e9e, + 0xe094, 0x15cf, + 0xe0a4, 0x1e9f, + 0xe0a5, 0x15e0, + 0xe0dd, 0x1ea0, + 0xe0de, 0x1619, + 0xe140, 0x1638, + 0xe14a, 0x1ea1, + 0xe14b, 0x1643, + 0xe180, 0x1677, + 0xe1ed, 0x1ea5, + 0xe1ee, 0x16e5, + 0xe240, 0x16f4, + 0xe269, 0x1ea6, + 0xe26a, 0x171e, + 0xe273, 0x1ea7, + 0xe274, 0x1728, + 0xe278, 0x1f3c, + 0xe279, 0x172d, + 0xe280, 0x1733, + 0xe2b7, 0x1ea8, + 0xe2b8, 0x176b, + 0xe2be, 0x1f3d, + 0xe2bf, 0x1772, + 0xe2e2, 0x1ea9, + 0xe2e3, 0x1796, + 0xe2ec, 0x1eaa, + 0xe2ed, 0x17a0, + 0xe340, 0x17b0, + 0xe358, 0x1eab, + 0xe359, 0x17c9, + 0xe35a, 0x1eac, + 0xe35b, 0x17cb, + 0xe365, 0x1ead, + 0xe366, 0x17d6, + 0xe380, 0x17ef, + 0xe3c7, 0x1f3e, + 0xe3c8, 0x1837, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe484, 0x1eaf, + 0xe485, 0x18b0, + 0xe489, 0x1eb0, + 0xe48a, 0x18b5, + 0xe492, 0x1eb1, + 0xe493, 0x18be, + 0xe4b9, 0x1eb3, + 0xe4ba, 0x18e5, + 0xe4cb, 0x1f3f, + 0xe4cc, 0x18f7, + 0xe540, 0x1928, + 0xe580, 0x1967, + 0xe59e, 0x1f40, + 0xe59f, 0x1986, + 0xe5ba, 0x1f41, + 0xe5bc, 0x19a3, + 0xe5ed, 0x1eb8, + 0xe5ee, 0x19d5, + 0xe640, 0x19e4, + 0xe651, 0x1eb9, + 0xe652, 0x19f6, + 0xe680, 0x1a23, + 0xe686, 0x1eba, + 0xe687, 0x1a2a, + 0xe6e7, 0x1ebc, + 0xe6e8, 0x1a8b, + 0xe740, 0x1aa0, + 0xe76d, 0x1ebe, + 0xe76e, 0x1ace, + 0xe780, 0x1adf, + 0xe7a7, 0x1ec1, + 0xe7a8, 0x1b07, + 0xe7bb, 0x1ec2, + 0xe7bc, 0x1b1b, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe8cf, 0x1ec7, + 0xe8d0, 0x1beb, + 0xe940, 0x1c18, + 0xe978, 0x1f43, + 0xe979, 0x1c51, + 0xe980, 0x1c57, + 0xe9ab, 0x1eca, + 0xe9ac, 0x1c83, + 0xe9ba, 0x1ecb, + 0xe9bb, 0x1c92, + 0xe9cc, 0x1ecc, + 0xe9cd, 0x1ca4, + 0xea40, 0x1cd4, + 0xea70, 0x1ecd, + 0xea71, 0x1f44, + 0xea72, 0x1d06, + 0xea80, 0x1d13, + 0xea9d, 0x1ece, + 0xea9e, 0x1d31, + 0xeaa3, 0x205c, + 0xec40, 0x1f45, + 0xec46, 0x1f48, + 0xec47, 0x0300, + 0xec48, 0x02fa, + 0xec49, 0x02f9, + 0xec4d, 0x1f49, + 0xec5b, 0x1db1, + 0xec5e, 0x1f54, + 0xec5f, 0x1db7, + 0xec60, 0x1f55, + 0xec63, 0x1db4, + 0xec66, 0x1f58, + 0xec70, 0x0303, + 0xec71, 0x1f62, + 0xec72, 0x0304, + 0xec73, 0x1f63, + 0xec76, 0x1f65, + 0xec78, 0x1da4, + 0xec79, 0x1da1, + 0xec7a, 0x1f66, + 0xec7b, 0x1da2, + 0xec7c, 0x1f67, + 0xec80, 0x1da6, + 0xec81, 0x1f6a, + 0xec82, 0x1da8, + 0xec83, 0x1dac, + 0xec84, 0x1f6b, + 0xec85, 0x1dae, + 0xec86, 0x1dab, + 0xec87, 0x1f6c, + 0xec89, 0x1daf, + 0xec8a, 0x1f6e, + 0xec94, 0x1f75, + 0xec9a, 0x1dba, + 0xec9b, 0x1f7b, + 0xec9e, 0x1f7c, + 0xeca7, 0x1f7d, + 0xecb2, 0x1f87, + 0xecc7, 0x1d83, + 0xecdb, 0x1f9b, + 0xecdc, 0x1d97, + 0xece9, 0x1f9c, + 0xed40, 0x1fb0, + 0xed64, 0x1f16, + 0xed68, 0x1fca, + 0xed6a, 0x1dc4, + 0xed6b, 0x1fcc, + 0xed6e, 0x1dc3, + 0xed6f, 0x1fcf, + 0xed74, 0x1dc2, + 0xed75, 0x1fd4, + 0xed7c, 0x1fd8, + 0xed80, 0x1fdb, + 0xed8f, 0x1fe6, + 0xef40, 0x1ecf, + 0xef42, 0x204c, + 0xef43, 0x2052, + 0xef44, 0x1ed1, + 0xef4e, 0x205a, + 0xef4f, 0x2053, + 0xef50, 0x2058, + 0xef51, 0x2055, + 0xef52, 0x1edb, + 0xef64, 0x1eee, + 0xef7a, 0x2048, + 0xef8d, 0x02e0, + 0xef91, 0x1ff6, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12AddRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12AddRKSJHMap2, 635 +}; + +static Gushort japan12AdobeJapan10Map2[70] = { + 0x0000, 0x0000, + 0x0000, 0x0000, + 0x0100, 0x0100, + 0x0200, 0x0200, + 0x0300, 0x0300, + 0x0400, 0x0400, + 0x0500, 0x0500, + 0x0600, 0x0600, + 0x0700, 0x0700, + 0x0800, 0x0800, + 0x0900, 0x0900, + 0x0a00, 0x0a00, + 0x0b00, 0x0b00, + 0x0c00, 0x0c00, + 0x0d00, 0x0d00, + 0x0e00, 0x0e00, + 0x0f00, 0x0f00, + 0x1000, 0x1000, + 0x1100, 0x1100, + 0x1200, 0x1200, + 0x1300, 0x1300, + 0x1400, 0x1400, + 0x1500, 0x1500, + 0x1600, 0x1600, + 0x1700, 0x1700, + 0x1800, 0x1800, + 0x1900, 0x1900, + 0x1a00, 0x1a00, + 0x1b00, 0x1b00, + 0x1c00, 0x1c00, + 0x1d00, 0x1d00, + 0x1e00, 0x1e00, + 0x1f00, 0x1f00, + 0x2000, 0x2000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12AdobeJapan10Enc16 = { + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12AdobeJapan10Map2, 35 +}; + +static Gushort japan12AdobeJapan11Map2[70] = { + 0x0000, 0x0000, + 0x0000, 0x0000, + 0x0100, 0x0100, + 0x0200, 0x0200, + 0x0300, 0x0300, + 0x0400, 0x0400, + 0x0500, 0x0500, + 0x0600, 0x0600, + 0x0700, 0x0700, + 0x0800, 0x0800, + 0x0900, 0x0900, + 0x0a00, 0x0a00, + 0x0b00, 0x0b00, + 0x0c00, 0x0c00, + 0x0d00, 0x0d00, + 0x0e00, 0x0e00, + 0x0f00, 0x0f00, + 0x1000, 0x1000, + 0x1100, 0x1100, + 0x1200, 0x1200, + 0x1300, 0x1300, + 0x1400, 0x1400, + 0x1500, 0x1500, + 0x1600, 0x1600, + 0x1700, 0x1700, + 0x1800, 0x1800, + 0x1900, 0x1900, + 0x1a00, 0x1a00, + 0x1b00, 0x1b00, + 0x1c00, 0x1c00, + 0x1d00, 0x1d00, + 0x1e00, 0x1e00, + 0x1f00, 0x1f00, + 0x2000, 0x2000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12AdobeJapan11Enc16 = { + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12AdobeJapan11Map2, 35 +}; + +static Gushort japan12AdobeJapan12Map2[74] = { + 0x0000, 0x0000, + 0x0000, 0x0000, + 0x0100, 0x0100, + 0x0200, 0x0200, + 0x0300, 0x0300, + 0x0400, 0x0400, + 0x0500, 0x0500, + 0x0600, 0x0600, + 0x0700, 0x0700, + 0x0800, 0x0800, + 0x0900, 0x0900, + 0x0a00, 0x0a00, + 0x0b00, 0x0b00, + 0x0c00, 0x0c00, + 0x0d00, 0x0d00, + 0x0e00, 0x0e00, + 0x0f00, 0x0f00, + 0x1000, 0x1000, + 0x1100, 0x1100, + 0x1200, 0x1200, + 0x1300, 0x1300, + 0x1400, 0x1400, + 0x1500, 0x1500, + 0x1600, 0x1600, + 0x1700, 0x1700, + 0x1800, 0x1800, + 0x1900, 0x1900, + 0x1a00, 0x1a00, + 0x1b00, 0x1b00, + 0x1c00, 0x1c00, + 0x1d00, 0x1d00, + 0x1e00, 0x1e00, + 0x1f00, 0x1f00, + 0x2000, 0x2000, + 0x2100, 0x2100, + 0x2200, 0x2200, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12AdobeJapan12Enc16 = { + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12AdobeJapan12Map2, 37 +}; + +static Gushort japan12EUCHMap2[242] = { + 0x0000, 0x0000, + 0x8ea0, 0x0146, + 0xa1a1, 0x0279, + 0xa2a1, 0x02d7, + 0xa2ba, 0x02e5, + 0xa2ca, 0x02ed, + 0xa2dc, 0x02f4, + 0xa2f2, 0x0303, + 0xa2fe, 0x030b, + 0xa3b0, 0x030c, + 0xa3c1, 0x0316, + 0xa3e1, 0x0330, + 0xa4a1, 0x034a, + 0xa5a1, 0x039d, + 0xa6a1, 0x03f3, + 0xa6c1, 0x040b, + 0xa7a1, 0x0423, + 0xa7d1, 0x0444, + 0xa8a1, 0x1d37, + 0xa8a2, 0x1d39, + 0xa8a3, 0x1d43, + 0xa8a4, 0x1d47, + 0xa8a5, 0x1d4f, + 0xa8a6, 0x1d4b, + 0xa8a7, 0x1d53, + 0xa8a8, 0x1d63, + 0xa8a9, 0x1d5b, + 0xa8aa, 0x1d6b, + 0xa8ab, 0x1d73, + 0xa8ac, 0x1d38, + 0xa8ad, 0x1d3a, + 0xa8ae, 0x1d46, + 0xa8af, 0x1d4a, + 0xa8b0, 0x1d52, + 0xa8b1, 0x1d4e, + 0xa8b2, 0x1d5a, + 0xa8b3, 0x1d6a, + 0xa8b4, 0x1d62, + 0xa8b5, 0x1d72, + 0xa8b6, 0x1d82, + 0xa8b7, 0x1d57, + 0xa8b8, 0x1d66, + 0xa8b9, 0x1d5f, + 0xa8ba, 0x1d6e, + 0xa8bb, 0x1d76, + 0xa8bc, 0x1d54, + 0xa8bd, 0x1d67, + 0xa8be, 0x1d5c, + 0xa8bf, 0x1d6f, + 0xa8c0, 0x1d79, + 0xb0a1, 0x0465, + 0xb1a1, 0x04c3, + 0xb2a1, 0x0521, + 0xb3a1, 0x057f, + 0xb4a1, 0x05dd, + 0xb5a1, 0x063b, + 0xb6a1, 0x0699, + 0xb7a1, 0x06f7, + 0xb8a1, 0x0755, + 0xb9a1, 0x07b3, + 0xbaa1, 0x0811, + 0xbba1, 0x086f, + 0xbca1, 0x08cd, + 0xbda1, 0x092b, + 0xbea1, 0x0989, + 0xbfa1, 0x09e7, + 0xc0a1, 0x0a45, + 0xc1a1, 0x0aa3, + 0xc2a1, 0x0b01, + 0xc3a1, 0x0b5f, + 0xc4a1, 0x0bbd, + 0xc5a1, 0x0c1b, + 0xc6a1, 0x0c79, + 0xc7a1, 0x0cd7, + 0xc8a1, 0x0d35, + 0xc9a1, 0x0d93, + 0xcaa1, 0x0df1, + 0xcba1, 0x0e4f, + 0xcca1, 0x0ead, + 0xcda1, 0x0f0b, + 0xcea1, 0x0f69, + 0xcfa1, 0x0fc7, + 0xd0a1, 0x0ffa, + 0xd1a1, 0x1058, + 0xd2a1, 0x10b6, + 0xd3a1, 0x1114, + 0xd4a1, 0x1172, + 0xd5a1, 0x11d0, + 0xd6a1, 0x122e, + 0xd7a1, 0x128c, + 0xd8a1, 0x12ea, + 0xd9a1, 0x1348, + 0xdaa1, 0x13a6, + 0xdba1, 0x1404, + 0xdca1, 0x1462, + 0xdda1, 0x14c0, + 0xdea1, 0x151e, + 0xdfa1, 0x157c, + 0xe0a1, 0x15da, + 0xe1a1, 0x1638, + 0xe2a1, 0x1696, + 0xe3a1, 0x16f4, + 0xe4a1, 0x1752, + 0xe5a1, 0x17b0, + 0xe6a1, 0x180e, + 0xe7a1, 0x186c, + 0xe8a1, 0x18ca, + 0xe9a1, 0x1928, + 0xeaa1, 0x1986, + 0xeba1, 0x19e4, + 0xeca1, 0x1a42, + 0xeda1, 0x1aa0, + 0xeea1, 0x1afe, + 0xefa1, 0x1b5c, + 0xf0a1, 0x1bba, + 0xf1a1, 0x1c18, + 0xf2a1, 0x1c76, + 0xf3a1, 0x1cd4, + 0xf4a1, 0x1d32, + 0xf4a5, 0x205c, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12EUCHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12EUCHMap2, 121 +}; + +static Gushort japan12ExtHMap2[1326] = { + 0x0000, 0x0000, + 0x2121, 0x0279, + 0x2169, 0x1d36, + 0x216a, 0x02c2, + 0x2221, 0x02d7, + 0x2330, 0x030c, + 0x2341, 0x0316, + 0x2361, 0x0330, + 0x2421, 0x034a, + 0x2521, 0x039d, + 0x2621, 0x03f3, + 0x2641, 0x040b, + 0x2721, 0x0423, + 0x2751, 0x0444, + 0x2921, 0x00e8, + 0x2960, 0x0186, + 0x2961, 0x0128, + 0x2a21, 0x0147, + 0x2a60, 0x0187, + 0x2b21, 0x01a6, + 0x2b72, 0x0127, + 0x2b73, 0x01f7, + 0x2c24, 0x1d37, + 0x2d21, 0x1d83, + 0x2d40, 0x1da1, + 0x2d5f, 0x2083, + 0x2d60, 0x1db8, + 0x2d70, 0x02fa, + 0x2d71, 0x02f9, + 0x2d72, 0x0301, + 0x2d73, 0x1dc8, + 0x2d7a, 0x0300, + 0x2d7b, 0x1dcf, + 0x3021, 0x0465, + 0x3022, 0x1dd1, + 0x3023, 0x0467, + 0x3033, 0x1ca2, + 0x3034, 0x0478, + 0x303b, 0x1dd2, + 0x303c, 0x0480, + 0x306e, 0x1dd3, + 0x306f, 0x04b3, + 0x3073, 0x1dd4, + 0x3074, 0x04b8, + 0x307c, 0x1dd5, + 0x307d, 0x04c1, + 0x3121, 0x04c3, + 0x312a, 0x1dd6, + 0x312b, 0x04cd, + 0x3135, 0x1dd7, + 0x3136, 0x04d8, + 0x3139, 0x1dd8, + 0x313a, 0x04dc, + 0x313c, 0x1dd9, + 0x313e, 0x04e0, + 0x3142, 0x1ddb, + 0x3143, 0x04e5, + 0x316b, 0x1ddc, + 0x316c, 0x050e, + 0x3221, 0x0521, + 0x3228, 0x1ddd, + 0x3229, 0x1cc9, + 0x322a, 0x1dde, + 0x322b, 0x052b, + 0x3260, 0x1ddf, + 0x3261, 0x0561, + 0x327a, 0x1de0, + 0x327b, 0x057b, + 0x327d, 0x1de1, + 0x327e, 0x057e, + 0x3321, 0x057f, + 0x3322, 0x1de2, + 0x3323, 0x0581, + 0x3342, 0x1961, + 0x3343, 0x05a1, + 0x3349, 0x139f, + 0x334a, 0x05a8, + 0x3365, 0x1de3, + 0x3366, 0x05c4, + 0x336b, 0x1de4, + 0x336c, 0x05ca, + 0x3373, 0x1de5, + 0x3374, 0x05d2, + 0x3376, 0x1731, + 0x3377, 0x05d5, + 0x337a, 0x1de6, + 0x337b, 0x05d9, + 0x3421, 0x05dd, + 0x3442, 0x1de7, + 0x3443, 0x1572, + 0x3444, 0x0600, + 0x344d, 0x1de8, + 0x344e, 0x060a, + 0x3452, 0x1a20, + 0x3453, 0x060f, + 0x3465, 0x1de9, + 0x3466, 0x0622, + 0x3521, 0x063b, + 0x352b, 0x1dea, + 0x352c, 0x0646, + 0x3540, 0x1deb, + 0x3541, 0x065b, + 0x3621, 0x0699, + 0x3622, 0x1dec, + 0x3623, 0x069b, + 0x362a, 0x1ded, + 0x362b, 0x06a3, + 0x3646, 0x1d32, + 0x3647, 0x06bf, + 0x364f, 0x1dee, + 0x3650, 0x06c8, + 0x366d, 0x1def, + 0x366e, 0x06e6, + 0x3674, 0x1df0, + 0x3675, 0x06ed, + 0x367b, 0x1df1, + 0x367c, 0x06f4, + 0x367d, 0x1df2, + 0x367e, 0x06f6, + 0x3721, 0x06f7, + 0x3724, 0x1df3, + 0x3725, 0x06fb, + 0x3737, 0x1df4, + 0x3738, 0x070e, + 0x3745, 0x1df5, + 0x3746, 0x071c, + 0x374e, 0x1df6, + 0x374f, 0x0725, + 0x3752, 0x1df7, + 0x3753, 0x0729, + 0x3755, 0x1df8, + 0x3756, 0x072c, + 0x375b, 0x1c0d, + 0x375c, 0x0732, + 0x3764, 0x1df9, + 0x3765, 0x073b, + 0x3771, 0x1dfa, + 0x3772, 0x0748, + 0x3779, 0x1dfb, + 0x377a, 0x0750, + 0x377e, 0x1dfc, + 0x3821, 0x0755, + 0x3834, 0x1dfd, + 0x3835, 0x0769, + 0x3841, 0x1dfe, + 0x3842, 0x0776, + 0x3921, 0x07b3, + 0x392b, 0x1dff, + 0x392c, 0x07be, + 0x3937, 0x1e00, + 0x3938, 0x07ca, + 0x3942, 0x1e01, + 0x3943, 0x07d5, + 0x395c, 0x16dd, + 0x395d, 0x07ef, + 0x396d, 0x1e02, + 0x396e, 0x0800, + 0x3974, 0x1e03, + 0x3975, 0x0807, + 0x3979, 0x1e04, + 0x397a, 0x080c, + 0x3a21, 0x0811, + 0x3a53, 0x1e05, + 0x3a54, 0x0844, + 0x3a67, 0x1e06, + 0x3a68, 0x0858, + 0x3a74, 0x1e07, + 0x3a75, 0x0865, + 0x3b21, 0x086f, + 0x3b27, 0x1e08, + 0x3b28, 0x0876, + 0x3b2a, 0x1e09, + 0x3b2b, 0x0879, + 0x3b2c, 0x1e0a, + 0x3b2d, 0x087b, + 0x3b39, 0x1e0b, + 0x3b3a, 0x0888, + 0x3c21, 0x08cd, + 0x3c38, 0x1e0c, + 0x3c39, 0x08e5, + 0x3c48, 0x1e0d, + 0x3c49, 0x1929, + 0x3c4a, 0x08f6, + 0x3c57, 0x1e0e, + 0x3c58, 0x0904, + 0x3c5d, 0x1e0f, + 0x3c5f, 0x090b, + 0x3d21, 0x092b, + 0x3d2b, 0x1e11, + 0x3d2c, 0x0936, + 0x3d36, 0x1e12, + 0x3d37, 0x0941, + 0x3d6c, 0x1e13, + 0x3d6e, 0x0978, + 0x3d72, 0x1e15, + 0x3d74, 0x097e, + 0x3e21, 0x0989, + 0x3e25, 0x1e17, + 0x3e26, 0x098e, + 0x3e33, 0x1e18, + 0x3e34, 0x099c, + 0x3e3f, 0x1e19, + 0x3e40, 0x09a8, + 0x3e55, 0x1e1a, + 0x3e56, 0x09be, + 0x3e5f, 0x1e1b, + 0x3e60, 0x09c8, + 0x3e64, 0x1e1c, + 0x3e65, 0x09cd, + 0x3f21, 0x09e7, + 0x3f2a, 0x1e1d, + 0x3f2b, 0x09f1, + 0x3f59, 0x1e1e, + 0x3f5a, 0x0a20, + 0x3f60, 0x1e1f, + 0x3f61, 0x0a27, + 0x3f69, 0x1e20, + 0x3f6a, 0x0a30, + 0x4021, 0x0a45, + 0x4022, 0x1e21, + 0x4023, 0x0a47, + 0x4042, 0x1e22, + 0x4043, 0x0a67, + 0x4066, 0x1e23, + 0x4067, 0x0a8b, + 0x4071, 0x1e24, + 0x4073, 0x0a97, + 0x4079, 0x1e26, + 0x407b, 0x0a9f, + 0x4121, 0x0aa3, + 0x4127, 0x1e28, + 0x4128, 0x1a6e, + 0x4129, 0x0aab, + 0x4139, 0x1e29, + 0x413a, 0x0abc, + 0x414c, 0x1e2a, + 0x414d, 0x0acf, + 0x414f, 0x1e2b, + 0x4150, 0x0ad2, + 0x415f, 0x1e2c, + 0x4160, 0x0ae2, + 0x4169, 0x1e2d, + 0x416a, 0x0aec, + 0x4221, 0x0b01, + 0x423d, 0x1e2e, + 0x423e, 0x0b1e, + 0x424d, 0x1e2f, + 0x424e, 0x0b2e, + 0x425c, 0x1e30, + 0x425d, 0x0b3d, + 0x4263, 0x1e31, + 0x4264, 0x0b44, + 0x426f, 0x1e32, + 0x4270, 0x0b50, + 0x4275, 0x1e33, + 0x4277, 0x0b57, + 0x427d, 0x1e35, + 0x427e, 0x0b5e, + 0x4321, 0x0b5f, + 0x4327, 0x1e36, + 0x4328, 0x0b66, + 0x4329, 0x1e37, + 0x432b, 0x0b69, + 0x432d, 0x1e39, + 0x432f, 0x0b6d, + 0x433d, 0x1e3b, + 0x433e, 0x0b7c, + 0x4370, 0x1e3c, + 0x4371, 0x0baf, + 0x4375, 0x1e3d, + 0x4376, 0x0bb4, + 0x437c, 0x1e3e, + 0x437d, 0x0bbb, + 0x4421, 0x0bbd, + 0x443d, 0x1e3f, + 0x443e, 0x0bda, + 0x4448, 0x1e40, + 0x4449, 0x0be5, + 0x444a, 0x1e41, + 0x444b, 0x0be7, + 0x444d, 0x1e42, + 0x444e, 0x0bea, + 0x444f, 0x1e43, + 0x4450, 0x0bec, + 0x445b, 0x11b5, + 0x445c, 0x0bf8, + 0x4521, 0x0c1b, + 0x4522, 0x1e44, + 0x4523, 0x0c1d, + 0x4527, 0x1e45, + 0x4528, 0x0c22, + 0x452e, 0x1e46, + 0x452f, 0x0c29, + 0x4536, 0x1e47, + 0x4537, 0x0c31, + 0x453f, 0x1e48, + 0x4540, 0x0c3a, + 0x4548, 0x1e49, + 0x4549, 0x0c43, + 0x454b, 0x1e4a, + 0x454c, 0x0c46, + 0x4551, 0x1e4b, + 0x4553, 0x0c4d, + 0x4557, 0x16df, + 0x4558, 0x0c52, + 0x4564, 0x1e4d, + 0x4565, 0x0c5f, + 0x456e, 0x1450, + 0x456f, 0x0c69, + 0x4573, 0x1536, + 0x4574, 0x0c6e, + 0x4578, 0x1e4e, + 0x4579, 0x0c73, + 0x4621, 0x0c79, + 0x463e, 0x1e4f, + 0x463f, 0x0c97, + 0x4642, 0x1e50, + 0x4643, 0x0c9b, + 0x4654, 0x1e51, + 0x4656, 0x0cae, + 0x465b, 0x1e53, + 0x465d, 0x0cb5, + 0x4661, 0x1e55, + 0x4662, 0x0cba, + 0x4666, 0x1e56, + 0x4668, 0x0cc0, + 0x466a, 0x1e58, + 0x466b, 0x0cc3, + 0x4676, 0x1aed, + 0x4677, 0x0ccf, + 0x4721, 0x0cd7, + 0x4729, 0x1e59, + 0x472a, 0x0ce0, + 0x4739, 0x1e5a, + 0x473a, 0x0cf0, + 0x4757, 0x1e5b, + 0x4758, 0x0d0e, + 0x4767, 0x1e5c, + 0x4768, 0x1989, + 0x4769, 0x1e5d, + 0x476a, 0x0d20, + 0x476d, 0x1e5e, + 0x476e, 0x0d24, + 0x4821, 0x0d35, + 0x4824, 0x1e5f, + 0x4825, 0x0d39, + 0x482e, 0x1e60, + 0x482f, 0x0d43, + 0x4830, 0x1e61, + 0x4831, 0x0d45, + 0x4854, 0x1e62, + 0x4855, 0x0d69, + 0x4862, 0x1e63, + 0x4863, 0x0d77, + 0x4875, 0x1e64, + 0x4876, 0x0d8a, + 0x4921, 0x0d93, + 0x4922, 0x1e65, + 0x4924, 0x0d96, + 0x492f, 0x1e67, + 0x4930, 0x143b, + 0x4931, 0x0da3, + 0x4932, 0x1e68, + 0x4933, 0x0da5, + 0x4935, 0x1e69, + 0x4936, 0x0da8, + 0x4940, 0x1e6a, + 0x4941, 0x0db3, + 0x494e, 0x1e6b, + 0x494f, 0x0dc1, + 0x4951, 0x1e6c, + 0x4952, 0x0dc4, + 0x4a21, 0x0df1, + 0x4a43, 0x1e6d, + 0x4a44, 0x0e14, + 0x4a4d, 0x1e6e, + 0x4a4e, 0x0e1e, + 0x4a5a, 0x1e6f, + 0x4a5b, 0x0e2b, + 0x4a79, 0x1e70, + 0x4a7a, 0x0e4a, + 0x4b21, 0x0e4f, + 0x4b22, 0x1e71, + 0x4b23, 0x0e51, + 0x4b29, 0x1e72, + 0x4b2a, 0x0e58, + 0x4b4b, 0x1e73, + 0x4b4c, 0x0e7a, + 0x4b6a, 0x1d33, + 0x4b6b, 0x0e99, + 0x4b70, 0x1e74, + 0x4b71, 0x0e9f, + 0x4b79, 0x102f, + 0x4b7a, 0x0ea8, + 0x4c21, 0x0ead, + 0x4c4d, 0x1e75, + 0x4c4e, 0x0eda, + 0x4c59, 0x1e76, + 0x4c5a, 0x0ee6, + 0x4c5f, 0x1e77, + 0x4c60, 0x0eec, + 0x4c62, 0x1e78, + 0x4c63, 0x0eef, + 0x4c79, 0x1935, + 0x4c7a, 0x1e79, + 0x4c7b, 0x0f07, + 0x4c7c, 0x1e7a, + 0x4c7d, 0x0f09, + 0x4c7e, 0x1e7b, + 0x4d21, 0x0f0b, + 0x4d32, 0x1e7c, + 0x4d33, 0x0f1d, + 0x4d50, 0x1e7d, + 0x4d51, 0x0f3b, + 0x4d54, 0x1e7e, + 0x4d55, 0x0f3f, + 0x4d5a, 0x1d34, + 0x4d5b, 0x0f45, + 0x4d69, 0x1e7f, + 0x4d6a, 0x0f54, + 0x4e21, 0x0f69, + 0x4e4b, 0x1e80, + 0x4e4c, 0x0f94, + 0x4e7a, 0x1e81, + 0x4e7c, 0x0fc4, + 0x4f21, 0x1e83, + 0x4f22, 0x0fc8, + 0x4f31, 0x1e84, + 0x4f32, 0x0fd8, + 0x4f36, 0x1777, + 0x4f37, 0x0fdd, + 0x4f39, 0x1e85, + 0x4f3a, 0x0fe0, + 0x5021, 0x0ffa, + 0x5056, 0x0ea7, + 0x5057, 0x1030, + 0x5121, 0x1058, + 0x513d, 0x1e86, + 0x513e, 0x1075, + 0x5147, 0x1e87, + 0x5148, 0x107f, + 0x514b, 0x1e88, + 0x514c, 0x1083, + 0x514d, 0x1e89, + 0x514e, 0x1085, + 0x5221, 0x10b6, + 0x5321, 0x1114, + 0x5330, 0x1e8a, + 0x5331, 0x1124, + 0x533a, 0x1e8b, + 0x533b, 0x112e, + 0x5350, 0x1e8c, + 0x5351, 0x1144, + 0x535e, 0x1e8d, + 0x535f, 0x1152, + 0x536b, 0x1e8e, + 0x536c, 0x115f, + 0x5421, 0x1172, + 0x5444, 0x1e8f, + 0x5445, 0x1196, + 0x5464, 0x0bf7, + 0x5465, 0x11b6, + 0x5521, 0x11d0, + 0x553d, 0x1e90, + 0x553e, 0x11ed, + 0x5563, 0x1e91, + 0x5564, 0x1213, + 0x5621, 0x122e, + 0x5622, 0x1e92, + 0x5623, 0x1230, + 0x5672, 0x1e93, + 0x5673, 0x1280, + 0x5721, 0x128c, + 0x5821, 0x12ea, + 0x5824, 0x1e94, + 0x5825, 0x12ee, + 0x5921, 0x1348, + 0x5960, 0x1e95, + 0x5961, 0x1388, + 0x596c, 0x1e96, + 0x596d, 0x1394, + 0x5978, 0x05a7, + 0x5979, 0x13a0, + 0x5a21, 0x13a6, + 0x5a39, 0x1e97, + 0x5a3a, 0x13bf, + 0x5a4d, 0x1e98, + 0x5a4e, 0x13d3, + 0x5b21, 0x1404, + 0x5b45, 0x1e99, + 0x5b46, 0x1429, + 0x5b4a, 0x1e9a, + 0x5b4b, 0x142e, + 0x5b58, 0x0da2, + 0x5b59, 0x143c, + 0x5b6b, 0x1e9b, + 0x5b6c, 0x144f, + 0x5b6d, 0x0c68, + 0x5b6e, 0x1451, + 0x5b74, 0x1e9c, + 0x5b75, 0x1458, + 0x5c21, 0x1462, + 0x5d21, 0x14c0, + 0x5e21, 0x151e, + 0x5e39, 0x0c6d, + 0x5e3a, 0x1537, + 0x5e50, 0x1e9d, + 0x5e51, 0x154e, + 0x5e75, 0x05ff, + 0x5e76, 0x1573, + 0x5f21, 0x157c, + 0x5f73, 0x1e9e, + 0x5f74, 0x15cf, + 0x6021, 0x15da, + 0x6026, 0x1e9f, + 0x6027, 0x15e0, + 0x605f, 0x1ea0, + 0x6060, 0x1619, + 0x6076, 0x1d35, + 0x6077, 0x1630, + 0x6121, 0x1638, + 0x612b, 0x1ea1, + 0x612c, 0x1643, + 0x6130, 0x1ea2, + 0x6132, 0x1649, + 0x6221, 0x1696, + 0x622b, 0x1ea4, + 0x622c, 0x16a1, + 0x6268, 0x07ee, + 0x6269, 0x16de, + 0x626a, 0x0c51, + 0x626b, 0x16e0, + 0x626f, 0x1ea5, + 0x6270, 0x16e5, + 0x6321, 0x16f4, + 0x634a, 0x1ea6, + 0x634b, 0x171e, + 0x6354, 0x1ea7, + 0x6355, 0x1728, + 0x635e, 0x05d4, + 0x635f, 0x1732, + 0x6421, 0x1752, + 0x6439, 0x1ea8, + 0x643a, 0x176b, + 0x6446, 0x0fdc, + 0x6447, 0x1778, + 0x6464, 0x1ea9, + 0x6465, 0x1796, + 0x646e, 0x1eaa, + 0x646f, 0x17a0, + 0x6521, 0x17b0, + 0x6539, 0x1eab, + 0x653a, 0x17c9, + 0x653b, 0x1eac, + 0x653c, 0x17cb, + 0x6546, 0x1ead, + 0x6547, 0x17d6, + 0x6621, 0x180e, + 0x6646, 0x1eae, + 0x6647, 0x1834, + 0x6721, 0x186c, + 0x6764, 0x1eaf, + 0x6765, 0x18b0, + 0x6769, 0x1eb0, + 0x676a, 0x18b5, + 0x6772, 0x1eb1, + 0x6773, 0x18be, + 0x6821, 0x18ca, + 0x6834, 0x1eb2, + 0x6835, 0x18de, + 0x683b, 0x1eb3, + 0x683c, 0x18e5, + 0x6874, 0x1eb4, + 0x6875, 0x191e, + 0x6921, 0x1928, + 0x6922, 0x08f5, + 0x6923, 0x192a, + 0x692e, 0x0f05, + 0x692f, 0x1936, + 0x693c, 0x1eb5, + 0x693d, 0x1944, + 0x695a, 0x05a0, + 0x695b, 0x1962, + 0x6a21, 0x1986, + 0x6a24, 0x0d1e, + 0x6a25, 0x198a, + 0x6a27, 0x1eb6, + 0x6a28, 0x198d, + 0x6a3d, 0x1eb7, + 0x6a3e, 0x19a3, + 0x6a6f, 0x1eb8, + 0x6a70, 0x19d5, + 0x6b21, 0x19e4, + 0x6b32, 0x1eb9, + 0x6b33, 0x19f6, + 0x6b5d, 0x060e, + 0x6b5e, 0x1a21, + 0x6b66, 0x1eba, + 0x6b67, 0x1a2a, + 0x6b76, 0x1ebb, + 0x6b77, 0x1a3a, + 0x6c21, 0x1a42, + 0x6c4d, 0x0aaa, + 0x6c4e, 0x1a6f, + 0x6c69, 0x1ebc, + 0x6c6a, 0x1a8b, + 0x6c74, 0x1ebd, + 0x6c75, 0x1a96, + 0x6d21, 0x1aa0, + 0x6d4e, 0x1ebe, + 0x6d4f, 0x1ace, + 0x6d6c, 0x1ebf, + 0x6d6d, 0x1aec, + 0x6d6e, 0x1ec0, + 0x6d6f, 0x1aee, + 0x6e21, 0x1afe, + 0x6e29, 0x1ec1, + 0x6e2a, 0x1b07, + 0x6e3d, 0x1ec2, + 0x6e3e, 0x1b1b, + 0x6e57, 0x1ec3, + 0x6e58, 0x1b35, + 0x6f21, 0x1b5c, + 0x6f65, 0x1ec4, + 0x6f66, 0x1ba1, + 0x7021, 0x1bba, + 0x7033, 0x1ec5, + 0x7034, 0x1bcd, + 0x7045, 0x1ec6, + 0x7046, 0x1bdf, + 0x7051, 0x1ec7, + 0x7052, 0x1beb, + 0x7057, 0x1ec8, + 0x7058, 0x1bf1, + 0x7074, 0x0731, + 0x7075, 0x1ec9, + 0x7076, 0x1c0f, + 0x7121, 0x1c18, + 0x7221, 0x1c76, + 0x722d, 0x1eca, + 0x722e, 0x1c83, + 0x723c, 0x1ecb, + 0x723d, 0x1c92, + 0x724d, 0x0477, + 0x724e, 0x1ecc, + 0x724f, 0x1ca4, + 0x7274, 0x0529, + 0x7275, 0x1cca, + 0x7321, 0x1cd4, + 0x7351, 0x1ecd, + 0x7352, 0x1d05, + 0x737d, 0x1ece, + 0x737e, 0x1d31, + 0x7921, 0x20a7, + 0x7a21, 0x2105, + 0x7a36, 0x07c9, + 0x7a37, 0x211a, + 0x7b21, 0x2162, + 0x7c21, 0x21c0, + 0x7c71, 0x1f9c, + 0x7c7b, 0x02ef, + 0x7c7c, 0x1f45, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12ExtHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12ExtHMap2, 663 +}; + +static Gushort japan12ExtRKSJHMap2[1330] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x8189, 0x1d36, + 0x818a, 0x02c2, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x8540, 0x00e8, + 0x8580, 0x0186, + 0x8581, 0x0128, + 0x859f, 0x0147, + 0x85de, 0x0187, + 0x8640, 0x01a6, + 0x8680, 0x01e5, + 0x8692, 0x0127, + 0x8693, 0x01f7, + 0x86a2, 0x1d37, + 0x8740, 0x1d83, + 0x875f, 0x1da1, + 0x877e, 0x2083, + 0x8780, 0x1db8, + 0x8790, 0x02fa, + 0x8791, 0x02f9, + 0x8792, 0x0301, + 0x8793, 0x1dc8, + 0x879a, 0x0300, + 0x879b, 0x1dcf, + 0x889f, 0x0465, + 0x88a0, 0x1dd1, + 0x88a1, 0x0467, + 0x88b1, 0x1ca2, + 0x88b2, 0x0478, + 0x88b9, 0x1dd2, + 0x88ba, 0x0480, + 0x88ec, 0x1dd3, + 0x88ed, 0x04b3, + 0x88f1, 0x1dd4, + 0x88f2, 0x04b8, + 0x88fa, 0x1dd5, + 0x88fb, 0x04c1, + 0x8940, 0x04c3, + 0x8949, 0x1dd6, + 0x894a, 0x04cd, + 0x8954, 0x1dd7, + 0x8955, 0x04d8, + 0x8958, 0x1dd8, + 0x8959, 0x04dc, + 0x895b, 0x1dd9, + 0x895d, 0x04e0, + 0x8961, 0x1ddb, + 0x8962, 0x04e5, + 0x8980, 0x0502, + 0x898b, 0x1ddc, + 0x898c, 0x050e, + 0x89a6, 0x1ddd, + 0x89a7, 0x1cc9, + 0x89a8, 0x1dde, + 0x89a9, 0x052b, + 0x89de, 0x1ddf, + 0x89df, 0x0561, + 0x89f8, 0x1de0, + 0x89f9, 0x057b, + 0x89fb, 0x1de1, + 0x89fc, 0x057e, + 0x8a40, 0x057f, + 0x8a41, 0x1de2, + 0x8a42, 0x0581, + 0x8a61, 0x1961, + 0x8a62, 0x05a1, + 0x8a68, 0x139f, + 0x8a69, 0x05a8, + 0x8a80, 0x05be, + 0x8a85, 0x1de3, + 0x8a86, 0x05c4, + 0x8a8b, 0x1de4, + 0x8a8c, 0x05ca, + 0x8a93, 0x1de5, + 0x8a94, 0x05d2, + 0x8a96, 0x1731, + 0x8a97, 0x05d5, + 0x8a9a, 0x1de6, + 0x8a9b, 0x05d9, + 0x8ac0, 0x1de7, + 0x8ac1, 0x1572, + 0x8ac2, 0x0600, + 0x8acb, 0x1de8, + 0x8acc, 0x060a, + 0x8ad0, 0x1a20, + 0x8ad1, 0x060f, + 0x8ae3, 0x1de9, + 0x8ae4, 0x0622, + 0x8b40, 0x063b, + 0x8b4a, 0x1dea, + 0x8b4b, 0x0646, + 0x8b5f, 0x1deb, + 0x8b60, 0x065b, + 0x8b80, 0x067a, + 0x8ba0, 0x1dec, + 0x8ba1, 0x069b, + 0x8ba8, 0x1ded, + 0x8ba9, 0x06a3, + 0x8bc4, 0x1d32, + 0x8bc5, 0x06bf, + 0x8bcd, 0x1dee, + 0x8bce, 0x06c8, + 0x8beb, 0x1def, + 0x8bec, 0x06e6, + 0x8bf2, 0x1df0, + 0x8bf3, 0x06ed, + 0x8bf9, 0x1df1, + 0x8bfa, 0x06f4, + 0x8bfb, 0x1df2, + 0x8bfc, 0x06f6, + 0x8c40, 0x06f7, + 0x8c43, 0x1df3, + 0x8c44, 0x06fb, + 0x8c56, 0x1df4, + 0x8c57, 0x070e, + 0x8c64, 0x1df5, + 0x8c65, 0x071c, + 0x8c6d, 0x1df6, + 0x8c6e, 0x0725, + 0x8c71, 0x1df7, + 0x8c72, 0x0729, + 0x8c74, 0x1df8, + 0x8c75, 0x072c, + 0x8c7a, 0x1c0d, + 0x8c7b, 0x0732, + 0x8c80, 0x0736, + 0x8c84, 0x1df9, + 0x8c85, 0x073b, + 0x8c91, 0x1dfa, + 0x8c92, 0x0748, + 0x8c99, 0x1dfb, + 0x8c9a, 0x0750, + 0x8c9e, 0x1dfc, + 0x8c9f, 0x0755, + 0x8cb2, 0x1dfd, + 0x8cb3, 0x0769, + 0x8cbf, 0x1dfe, + 0x8cc0, 0x0776, + 0x8d40, 0x07b3, + 0x8d4a, 0x1dff, + 0x8d4b, 0x07be, + 0x8d56, 0x1e00, + 0x8d57, 0x07ca, + 0x8d61, 0x1e01, + 0x8d62, 0x07d5, + 0x8d7b, 0x16dd, + 0x8d7c, 0x07ef, + 0x8d80, 0x07f2, + 0x8d8d, 0x1e02, + 0x8d8e, 0x0800, + 0x8d94, 0x1e03, + 0x8d95, 0x0807, + 0x8d99, 0x1e04, + 0x8d9a, 0x080c, + 0x8dd1, 0x1e05, + 0x8dd2, 0x0844, + 0x8de5, 0x1e06, + 0x8de6, 0x0858, + 0x8df2, 0x1e07, + 0x8df3, 0x0865, + 0x8e40, 0x086f, + 0x8e46, 0x1e08, + 0x8e47, 0x0876, + 0x8e49, 0x1e09, + 0x8e4a, 0x0879, + 0x8e4b, 0x1e0a, + 0x8e4c, 0x087b, + 0x8e58, 0x1e0b, + 0x8e59, 0x0888, + 0x8e80, 0x08ae, + 0x8eb6, 0x1e0c, + 0x8eb7, 0x08e5, + 0x8ec6, 0x1e0d, + 0x8ec7, 0x1929, + 0x8ec8, 0x08f6, + 0x8ed5, 0x1e0e, + 0x8ed6, 0x0904, + 0x8edb, 0x1e0f, + 0x8edd, 0x090b, + 0x8f40, 0x092b, + 0x8f4a, 0x1e11, + 0x8f4b, 0x0936, + 0x8f55, 0x1e12, + 0x8f56, 0x0941, + 0x8f80, 0x096a, + 0x8f8c, 0x1e13, + 0x8f8e, 0x0978, + 0x8f92, 0x1e15, + 0x8f94, 0x097e, + 0x8fa3, 0x1e17, + 0x8fa4, 0x098e, + 0x8fb1, 0x1e18, + 0x8fb2, 0x099c, + 0x8fbd, 0x1e19, + 0x8fbe, 0x09a8, + 0x8fd3, 0x1e1a, + 0x8fd4, 0x09be, + 0x8fdd, 0x1e1b, + 0x8fde, 0x09c8, + 0x8fe2, 0x1e1c, + 0x8fe3, 0x09cd, + 0x9040, 0x09e7, + 0x9049, 0x1e1d, + 0x904a, 0x09f1, + 0x9078, 0x1e1e, + 0x9079, 0x0a20, + 0x9080, 0x1e1f, + 0x9081, 0x0a27, + 0x9089, 0x1e20, + 0x908a, 0x0a30, + 0x90a0, 0x1e21, + 0x90a1, 0x0a47, + 0x90c0, 0x1e22, + 0x90c1, 0x0a67, + 0x90e4, 0x1e23, + 0x90e5, 0x0a8b, + 0x90ef, 0x1e24, + 0x90f1, 0x0a97, + 0x90f7, 0x1e26, + 0x90f9, 0x0a9f, + 0x9140, 0x0aa3, + 0x9146, 0x1e28, + 0x9147, 0x1a6e, + 0x9148, 0x0aab, + 0x9158, 0x1e29, + 0x9159, 0x0abc, + 0x916b, 0x1e2a, + 0x916c, 0x0acf, + 0x916e, 0x1e2b, + 0x916f, 0x0ad2, + 0x917e, 0x1e2c, + 0x9180, 0x0ae2, + 0x9189, 0x1e2d, + 0x918a, 0x0aec, + 0x91bb, 0x1e2e, + 0x91bc, 0x0b1e, + 0x91cb, 0x1e2f, + 0x91cc, 0x0b2e, + 0x91da, 0x1e30, + 0x91db, 0x0b3d, + 0x91e1, 0x1e31, + 0x91e2, 0x0b44, + 0x91ed, 0x1e32, + 0x91ee, 0x0b50, + 0x91f3, 0x1e33, + 0x91f5, 0x0b57, + 0x91fb, 0x1e35, + 0x91fc, 0x0b5e, + 0x9240, 0x0b5f, + 0x9246, 0x1e36, + 0x9247, 0x0b66, + 0x9248, 0x1e37, + 0x924a, 0x0b69, + 0x924c, 0x1e39, + 0x924e, 0x0b6d, + 0x925c, 0x1e3b, + 0x925d, 0x0b7c, + 0x9280, 0x0b9e, + 0x9290, 0x1e3c, + 0x9291, 0x0baf, + 0x9295, 0x1e3d, + 0x9296, 0x0bb4, + 0x929c, 0x1e3e, + 0x929d, 0x0bbb, + 0x92bb, 0x1e3f, + 0x92bc, 0x0bda, + 0x92c6, 0x1e40, + 0x92c7, 0x0be5, + 0x92c8, 0x1e41, + 0x92c9, 0x0be7, + 0x92cb, 0x1e42, + 0x92cc, 0x0bea, + 0x92cd, 0x1e43, + 0x92ce, 0x0bec, + 0x92d9, 0x11b5, + 0x92da, 0x0bf8, + 0x9340, 0x0c1b, + 0x9341, 0x1e44, + 0x9342, 0x0c1d, + 0x9346, 0x1e45, + 0x9347, 0x0c22, + 0x934d, 0x1e46, + 0x934e, 0x0c29, + 0x9355, 0x1e47, + 0x9356, 0x0c31, + 0x935e, 0x1e48, + 0x935f, 0x0c3a, + 0x9367, 0x1e49, + 0x9368, 0x0c43, + 0x936a, 0x1e4a, + 0x936b, 0x0c46, + 0x9370, 0x1e4b, + 0x9372, 0x0c4d, + 0x9376, 0x16df, + 0x9377, 0x0c52, + 0x9380, 0x0c5a, + 0x9384, 0x1e4d, + 0x9385, 0x0c5f, + 0x938e, 0x1450, + 0x938f, 0x0c69, + 0x9393, 0x1536, + 0x9394, 0x0c6e, + 0x9398, 0x1e4e, + 0x9399, 0x0c73, + 0x93bc, 0x1e4f, + 0x93bd, 0x0c97, + 0x93c0, 0x1e50, + 0x93c1, 0x0c9b, + 0x93d2, 0x1e51, + 0x93d4, 0x0cae, + 0x93d9, 0x1e53, + 0x93db, 0x0cb5, + 0x93df, 0x1e55, + 0x93e0, 0x0cba, + 0x93e4, 0x1e56, + 0x93e6, 0x0cc0, + 0x93e8, 0x1e58, + 0x93e9, 0x0cc3, + 0x93f4, 0x1aed, + 0x93f5, 0x0ccf, + 0x9440, 0x0cd7, + 0x9448, 0x1e59, + 0x9449, 0x0ce0, + 0x9458, 0x1e5a, + 0x9459, 0x0cf0, + 0x9476, 0x1e5b, + 0x9477, 0x0d0e, + 0x9480, 0x0d16, + 0x9487, 0x1e5c, + 0x9488, 0x1989, + 0x9489, 0x1e5d, + 0x948a, 0x0d20, + 0x948d, 0x1e5e, + 0x948e, 0x0d24, + 0x94a2, 0x1e5f, + 0x94a3, 0x0d39, + 0x94ac, 0x1e60, + 0x94ad, 0x0d43, + 0x94ae, 0x1e61, + 0x94af, 0x0d45, + 0x94d2, 0x1e62, + 0x94d3, 0x0d69, + 0x94e0, 0x1e63, + 0x94e1, 0x0d77, + 0x94f3, 0x1e64, + 0x94f4, 0x0d8a, + 0x9540, 0x0d93, + 0x9541, 0x1e65, + 0x9543, 0x0d96, + 0x954e, 0x1e67, + 0x954f, 0x143b, + 0x9550, 0x0da3, + 0x9551, 0x1e68, + 0x9552, 0x0da5, + 0x9554, 0x1e69, + 0x9555, 0x0da8, + 0x955f, 0x1e6a, + 0x9560, 0x0db3, + 0x956d, 0x1e6b, + 0x956e, 0x0dc1, + 0x9570, 0x1e6c, + 0x9571, 0x0dc4, + 0x9580, 0x0dd2, + 0x95c1, 0x1e6d, + 0x95c2, 0x0e14, + 0x95cb, 0x1e6e, + 0x95cc, 0x0e1e, + 0x95d8, 0x1e6f, + 0x95d9, 0x0e2b, + 0x95f7, 0x1e70, + 0x95f8, 0x0e4a, + 0x9640, 0x0e4f, + 0x9641, 0x1e71, + 0x9642, 0x0e51, + 0x9648, 0x1e72, + 0x9649, 0x0e58, + 0x966a, 0x1e73, + 0x966b, 0x0e7a, + 0x9680, 0x0e8e, + 0x968a, 0x1d33, + 0x968b, 0x0e99, + 0x9690, 0x1e74, + 0x9691, 0x0e9f, + 0x9699, 0x102f, + 0x969a, 0x0ea8, + 0x96cb, 0x1e75, + 0x96cc, 0x0eda, + 0x96d7, 0x1e76, + 0x96d8, 0x0ee6, + 0x96dd, 0x1e77, + 0x96de, 0x0eec, + 0x96e0, 0x1e78, + 0x96e1, 0x0eef, + 0x96f7, 0x1935, + 0x96f8, 0x1e79, + 0x96f9, 0x0f07, + 0x96fa, 0x1e7a, + 0x96fb, 0x0f09, + 0x96fc, 0x1e7b, + 0x9740, 0x0f0b, + 0x9751, 0x1e7c, + 0x9752, 0x0f1d, + 0x976f, 0x1e7d, + 0x9770, 0x0f3b, + 0x9773, 0x1e7e, + 0x9774, 0x0f3f, + 0x9779, 0x1d34, + 0x977a, 0x0f45, + 0x9780, 0x0f4a, + 0x9789, 0x1e7f, + 0x978a, 0x0f54, + 0x97c9, 0x1e80, + 0x97ca, 0x0f94, + 0x97f8, 0x1e81, + 0x97fa, 0x0fc4, + 0x9840, 0x1e83, + 0x9841, 0x0fc8, + 0x9850, 0x1e84, + 0x9851, 0x0fd8, + 0x9855, 0x1777, + 0x9856, 0x0fdd, + 0x9858, 0x1e85, + 0x9859, 0x0fe0, + 0x989f, 0x0ffa, + 0x98d4, 0x0ea7, + 0x98d5, 0x1030, + 0x9940, 0x1058, + 0x995c, 0x1e86, + 0x995d, 0x1075, + 0x9966, 0x1e87, + 0x9967, 0x107f, + 0x996a, 0x1e88, + 0x996b, 0x1083, + 0x996c, 0x1e89, + 0x996d, 0x1085, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a4f, 0x1e8a, + 0x9a50, 0x1124, + 0x9a59, 0x1e8b, + 0x9a5a, 0x112e, + 0x9a6f, 0x1e8c, + 0x9a70, 0x1144, + 0x9a7d, 0x1e8d, + 0x9a7e, 0x1152, + 0x9a80, 0x1153, + 0x9a8b, 0x1e8e, + 0x9a8c, 0x115f, + 0x9ac2, 0x1e8f, + 0x9ac3, 0x1196, + 0x9ae2, 0x0bf7, + 0x9ae3, 0x11b6, + 0x9b40, 0x11d0, + 0x9b5c, 0x1e90, + 0x9b5d, 0x11ed, + 0x9b80, 0x120f, + 0x9b83, 0x1e91, + 0x9b84, 0x1213, + 0x9ba0, 0x1e92, + 0x9ba1, 0x1230, + 0x9bf0, 0x1e93, + 0x9bf1, 0x1280, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9ca2, 0x1e94, + 0x9ca3, 0x12ee, + 0x9d40, 0x1348, + 0x9d80, 0x1e95, + 0x9d81, 0x1388, + 0x9d8c, 0x1e96, + 0x9d8d, 0x1394, + 0x9d98, 0x05a7, + 0x9d99, 0x13a0, + 0x9db7, 0x1e97, + 0x9db8, 0x13bf, + 0x9dcb, 0x1e98, + 0x9dcc, 0x13d3, + 0x9e40, 0x1404, + 0x9e64, 0x1e99, + 0x9e65, 0x1429, + 0x9e69, 0x1e9a, + 0x9e6a, 0x142e, + 0x9e77, 0x0da2, + 0x9e78, 0x143c, + 0x9e80, 0x1443, + 0x9e8b, 0x1e9b, + 0x9e8c, 0x144f, + 0x9e8d, 0x0c68, + 0x9e8e, 0x1451, + 0x9e94, 0x1e9c, + 0x9e95, 0x1458, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0x9fb7, 0x0c6d, + 0x9fb8, 0x1537, + 0x9fce, 0x1e9d, + 0x9fcf, 0x154e, + 0x9ff3, 0x05ff, + 0x9ff4, 0x1573, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe093, 0x1e9e, + 0xe094, 0x15cf, + 0xe0a4, 0x1e9f, + 0xe0a5, 0x15e0, + 0xe0dd, 0x1ea0, + 0xe0de, 0x1619, + 0xe0f4, 0x1d35, + 0xe0f5, 0x1630, + 0xe140, 0x1638, + 0xe14a, 0x1ea1, + 0xe14b, 0x1643, + 0xe14f, 0x1ea2, + 0xe151, 0x1649, + 0xe180, 0x1677, + 0xe1a9, 0x1ea4, + 0xe1aa, 0x16a1, + 0xe1e6, 0x07ee, + 0xe1e7, 0x16de, + 0xe1e8, 0x0c51, + 0xe1e9, 0x16e0, + 0xe1ed, 0x1ea5, + 0xe1ee, 0x16e5, + 0xe240, 0x16f4, + 0xe269, 0x1ea6, + 0xe26a, 0x171e, + 0xe273, 0x1ea7, + 0xe274, 0x1728, + 0xe27d, 0x05d4, + 0xe27e, 0x1732, + 0xe280, 0x1733, + 0xe2b7, 0x1ea8, + 0xe2b8, 0x176b, + 0xe2c4, 0x0fdc, + 0xe2c5, 0x1778, + 0xe2e2, 0x1ea9, + 0xe2e3, 0x1796, + 0xe2ec, 0x1eaa, + 0xe2ed, 0x17a0, + 0xe340, 0x17b0, + 0xe358, 0x1eab, + 0xe359, 0x17c9, + 0xe35a, 0x1eac, + 0xe35b, 0x17cb, + 0xe365, 0x1ead, + 0xe366, 0x17d6, + 0xe380, 0x17ef, + 0xe3c4, 0x1eae, + 0xe3c5, 0x1834, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe484, 0x1eaf, + 0xe485, 0x18b0, + 0xe489, 0x1eb0, + 0xe48a, 0x18b5, + 0xe492, 0x1eb1, + 0xe493, 0x18be, + 0xe4b2, 0x1eb2, + 0xe4b3, 0x18de, + 0xe4b9, 0x1eb3, + 0xe4ba, 0x18e5, + 0xe4f2, 0x1eb4, + 0xe4f3, 0x191e, + 0xe540, 0x1928, + 0xe541, 0x08f5, + 0xe542, 0x192a, + 0xe54d, 0x0f05, + 0xe54e, 0x1936, + 0xe55b, 0x1eb5, + 0xe55c, 0x1944, + 0xe579, 0x05a0, + 0xe57a, 0x1962, + 0xe580, 0x1967, + 0xe5a2, 0x0d1e, + 0xe5a3, 0x198a, + 0xe5a5, 0x1eb6, + 0xe5a6, 0x198d, + 0xe5bb, 0x1eb7, + 0xe5bc, 0x19a3, + 0xe5ed, 0x1eb8, + 0xe5ee, 0x19d5, + 0xe640, 0x19e4, + 0xe651, 0x1eb9, + 0xe652, 0x19f6, + 0xe67c, 0x060e, + 0xe67d, 0x1a21, + 0xe680, 0x1a23, + 0xe686, 0x1eba, + 0xe687, 0x1a2a, + 0xe696, 0x1ebb, + 0xe697, 0x1a3a, + 0xe6cb, 0x0aaa, + 0xe6cc, 0x1a6f, + 0xe6e7, 0x1ebc, + 0xe6e8, 0x1a8b, + 0xe6f2, 0x1ebd, + 0xe6f3, 0x1a96, + 0xe740, 0x1aa0, + 0xe76d, 0x1ebe, + 0xe76e, 0x1ace, + 0xe780, 0x1adf, + 0xe78c, 0x1ebf, + 0xe78d, 0x1aec, + 0xe78e, 0x1ec0, + 0xe78f, 0x1aee, + 0xe7a7, 0x1ec1, + 0xe7a8, 0x1b07, + 0xe7bb, 0x1ec2, + 0xe7bc, 0x1b1b, + 0xe7d5, 0x1ec3, + 0xe7d6, 0x1b35, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe885, 0x1ec4, + 0xe886, 0x1ba1, + 0xe8b1, 0x1ec5, + 0xe8b2, 0x1bcd, + 0xe8c3, 0x1ec6, + 0xe8c4, 0x1bdf, + 0xe8cf, 0x1ec7, + 0xe8d0, 0x1beb, + 0xe8d5, 0x1ec8, + 0xe8d6, 0x1bf1, + 0xe8f2, 0x0731, + 0xe8f3, 0x1ec9, + 0xe8f4, 0x1c0f, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xe9ab, 0x1eca, + 0xe9ac, 0x1c83, + 0xe9ba, 0x1ecb, + 0xe9bb, 0x1c92, + 0xe9cb, 0x0477, + 0xe9cc, 0x1ecc, + 0xe9cd, 0x1ca4, + 0xe9f2, 0x0529, + 0xe9f3, 0x1cca, + 0xea40, 0x1cd4, + 0xea70, 0x1ecd, + 0xea71, 0x1d05, + 0xea80, 0x1d13, + 0xea9d, 0x1ece, + 0xea9e, 0x1d31, + 0xed40, 0x20a7, + 0xed80, 0x20e6, + 0xedb4, 0x07c9, + 0xedb5, 0x211a, + 0xee40, 0x2162, + 0xee80, 0x21a1, + 0xeeef, 0x1f9c, + 0xeef9, 0x02ef, + 0xeefa, 0x1f45, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12ExtRKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12ExtRKSJHMap2, 665 +}; + +static Gushort japan12HMap2[240] = { + 0x0000, 0x0000, + 0x2121, 0x0279, + 0x2221, 0x02d7, + 0x223a, 0x02e5, + 0x224a, 0x02ed, + 0x225c, 0x02f4, + 0x2272, 0x0303, + 0x227e, 0x030b, + 0x2330, 0x030c, + 0x2341, 0x0316, + 0x2361, 0x0330, + 0x2421, 0x034a, + 0x2521, 0x039d, + 0x2621, 0x03f3, + 0x2641, 0x040b, + 0x2721, 0x0423, + 0x2751, 0x0444, + 0x2821, 0x1d37, + 0x2822, 0x1d39, + 0x2823, 0x1d43, + 0x2824, 0x1d47, + 0x2825, 0x1d4f, + 0x2826, 0x1d4b, + 0x2827, 0x1d53, + 0x2828, 0x1d63, + 0x2829, 0x1d5b, + 0x282a, 0x1d6b, + 0x282b, 0x1d73, + 0x282c, 0x1d38, + 0x282d, 0x1d3a, + 0x282e, 0x1d46, + 0x282f, 0x1d4a, + 0x2830, 0x1d52, + 0x2831, 0x1d4e, + 0x2832, 0x1d5a, + 0x2833, 0x1d6a, + 0x2834, 0x1d62, + 0x2835, 0x1d72, + 0x2836, 0x1d82, + 0x2837, 0x1d57, + 0x2838, 0x1d66, + 0x2839, 0x1d5f, + 0x283a, 0x1d6e, + 0x283b, 0x1d76, + 0x283c, 0x1d54, + 0x283d, 0x1d67, + 0x283e, 0x1d5c, + 0x283f, 0x1d6f, + 0x2840, 0x1d79, + 0x3021, 0x0465, + 0x3121, 0x04c3, + 0x3221, 0x0521, + 0x3321, 0x057f, + 0x3421, 0x05dd, + 0x3521, 0x063b, + 0x3621, 0x0699, + 0x3721, 0x06f7, + 0x3821, 0x0755, + 0x3921, 0x07b3, + 0x3a21, 0x0811, + 0x3b21, 0x086f, + 0x3c21, 0x08cd, + 0x3d21, 0x092b, + 0x3e21, 0x0989, + 0x3f21, 0x09e7, + 0x4021, 0x0a45, + 0x4121, 0x0aa3, + 0x4221, 0x0b01, + 0x4321, 0x0b5f, + 0x4421, 0x0bbd, + 0x4521, 0x0c1b, + 0x4621, 0x0c79, + 0x4721, 0x0cd7, + 0x4821, 0x0d35, + 0x4921, 0x0d93, + 0x4a21, 0x0df1, + 0x4b21, 0x0e4f, + 0x4c21, 0x0ead, + 0x4d21, 0x0f0b, + 0x4e21, 0x0f69, + 0x4f21, 0x0fc7, + 0x5021, 0x0ffa, + 0x5121, 0x1058, + 0x5221, 0x10b6, + 0x5321, 0x1114, + 0x5421, 0x1172, + 0x5521, 0x11d0, + 0x5621, 0x122e, + 0x5721, 0x128c, + 0x5821, 0x12ea, + 0x5921, 0x1348, + 0x5a21, 0x13a6, + 0x5b21, 0x1404, + 0x5c21, 0x1462, + 0x5d21, 0x14c0, + 0x5e21, 0x151e, + 0x5f21, 0x157c, + 0x6021, 0x15da, + 0x6121, 0x1638, + 0x6221, 0x1696, + 0x6321, 0x16f4, + 0x6421, 0x1752, + 0x6521, 0x17b0, + 0x6621, 0x180e, + 0x6721, 0x186c, + 0x6821, 0x18ca, + 0x6921, 0x1928, + 0x6a21, 0x1986, + 0x6b21, 0x19e4, + 0x6c21, 0x1a42, + 0x6d21, 0x1aa0, + 0x6e21, 0x1afe, + 0x6f21, 0x1b5c, + 0x7021, 0x1bba, + 0x7121, 0x1c18, + 0x7221, 0x1c76, + 0x7321, 0x1cd4, + 0x7421, 0x1d32, + 0x7425, 0x205c, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12HEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12HMap2, 120 +}; + +static Gushort japan12HankakuMap2[4] = { + 0x0000, 0x0000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12HankakuEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x00e7, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x0204, 0x0205, + 0x0206, 0x0207, 0x0208, 0x0209, 0x020a, 0x020b, 0x020c, 0x020d, + 0x0156, 0x020e, 0x020f, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, + 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021a, 0x021b, 0x021c, + 0x0000, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x021d, 0x021e, 0x021f, 0x0220, 0x0221, 0x0222, 0x0223, 0x0224, + 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022a, 0x022b, 0x022c, + 0x022d, 0x022e, 0x022f, 0x0230, 0x0231, 0x0232, 0x0233, 0x0234, + 0x0235, 0x0236, 0x0237, 0x0238, 0x0239, 0x023a, 0x0184, 0x0185 }, + japan12HankakuMap2, 2 +}; + +static Gushort japan12HiraganaMap2[4] = { + 0x0000, 0x0000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12HiraganaEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0203, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x0204, 0x0205, + 0x0206, 0x0207, 0x0208, 0x0209, 0x020a, 0x020b, 0x020c, 0x020d, + 0x0156, 0x020e, 0x020f, 0x0210, 0x0211, 0x0212, 0x0213, 0x0214, + 0x0215, 0x0216, 0x0217, 0x0218, 0x0219, 0x021a, 0x021b, 0x021c, + 0x021d, 0x021e, 0x021f, 0x0220, 0x0221, 0x0222, 0x0223, 0x0224, + 0x0225, 0x0226, 0x0227, 0x0228, 0x0229, 0x022a, 0x022b, 0x022c, + 0x022d, 0x022e, 0x022f, 0x0230, 0x0231, 0x0232, 0x0233, 0x0234, + 0x0235, 0x0236, 0x0237, 0x0238, 0x0239, 0x023a, 0x0184, 0x0185, + 0x023b, 0x023c, 0x023d, 0x0000, 0x0000, 0x0000, 0x023e, 0x023f, + 0x0240, 0x0241, 0x0242, 0x0243, 0x0244, 0x0245, 0x0246, 0x0247, + 0x0248, 0x0249, 0x024a, 0x024b, 0x024c, 0x024d, 0x024e, 0x024f, + 0x0250, 0x0251, 0x0252, 0x0253, 0x0254, 0x0255, 0x0256, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12HiraganaMap2, 2 +}; + +static Gushort japan12KatakanaMap2[4] = { + 0x0000, 0x0000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12KatakanaEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0187, 0x0188, 0x0189, 0x018a, 0x018b, 0x018c, 0x018d, 0x018e, + 0x018f, 0x0190, 0x0191, 0x0192, 0x0193, 0x0194, 0x0195, 0x0196, + 0x0197, 0x0198, 0x0199, 0x019a, 0x019b, 0x019c, 0x019d, 0x019e, + 0x019f, 0x01a0, 0x01a1, 0x01a2, 0x01a3, 0x01a4, 0x01a5, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12KatakanaMap2, 2 +}; + +static Gushort japan12NWPHMap2[1522] = { + 0x0000, 0x0000, + 0x2121, 0x0279, + 0x2169, 0x1d36, + 0x216a, 0x02c2, + 0x2221, 0x02d7, + 0x223a, 0x02e5, + 0x224a, 0x02ed, + 0x225c, 0x02f4, + 0x2272, 0x0303, + 0x227e, 0x030b, + 0x2330, 0x030c, + 0x2341, 0x0316, + 0x2361, 0x0330, + 0x2421, 0x034a, + 0x2521, 0x039d, + 0x2621, 0x03f3, + 0x2641, 0x040b, + 0x2721, 0x0423, + 0x2751, 0x0444, + 0x2921, 0x00e8, + 0x2960, 0x0186, + 0x2961, 0x0128, + 0x2a21, 0x0147, + 0x2a60, 0x0187, + 0x2b21, 0x01a6, + 0x2b72, 0x0127, + 0x2b73, 0x01f7, + 0x2c24, 0x1d37, + 0x2d21, 0x1d83, + 0x2d40, 0x1da1, + 0x2d60, 0x1db8, + 0x2d70, 0x02fa, + 0x2d71, 0x02f9, + 0x2d72, 0x0301, + 0x2d73, 0x1dc8, + 0x2d7a, 0x0300, + 0x2d7b, 0x1dcf, + 0x2e21, 0x0282, + 0x2e22, 0x02a1, + 0x2e23, 0x0305, + 0x2e24, 0x02c8, + 0x2e25, 0x02cb, + 0x2e26, 0x02cd, + 0x2e27, 0x029f, + 0x2e28, 0x02a2, + 0x2e2a, 0x02ce, + 0x2e2b, 0x02b4, + 0x2e2c, 0x027c, + 0x2e2d, 0x02b5, + 0x2e2e, 0x027d, + 0x2e2f, 0x0297, + 0x2e30, 0x030c, + 0x2e3a, 0x027f, + 0x2e3c, 0x02bb, + 0x2e3d, 0x02b9, + 0x2e3e, 0x02bc, + 0x2e3f, 0x0281, + 0x2e40, 0x02cf, + 0x2e41, 0x0316, + 0x2e5b, 0x02a6, + 0x2e5c, 0x02c7, + 0x2e5d, 0x02a7, + 0x2e5e, 0x0288, + 0x2e5f, 0x028a, + 0x2e60, 0x0286, + 0x2e61, 0x0330, + 0x2e7b, 0x02a8, + 0x2e7c, 0x029b, + 0x2e7d, 0x02a9, + 0x2e7e, 0x0289, + 0x2f21, 0x027b, + 0x2f22, 0x02ae, + 0x2f24, 0x027a, + 0x2f25, 0x027e, + 0x2f26, 0x03ee, + 0x2f27, 0x039d, + 0x2f28, 0x039f, + 0x2f29, 0x03a1, + 0x2f2a, 0x03a3, + 0x2f2b, 0x03a5, + 0x2f2c, 0x03df, + 0x2f2d, 0x03e1, + 0x2f2e, 0x03e3, + 0x2f2f, 0x03bf, + 0x2f30, 0x0294, + 0x2f31, 0x039e, + 0x2f32, 0x03a0, + 0x2f33, 0x03a2, + 0x2f34, 0x03a4, + 0x2f35, 0x03a6, + 0x2f37, 0x03a9, + 0x2f38, 0x03ab, + 0x2f39, 0x03ad, + 0x2f3a, 0x03af, + 0x2f3b, 0x03b1, + 0x2f3c, 0x03b3, + 0x2f3d, 0x03b5, + 0x2f3e, 0x03b7, + 0x2f3f, 0x03b9, + 0x2f40, 0x03bb, + 0x2f41, 0x03bd, + 0x2f42, 0x03c0, + 0x2f43, 0x03c2, + 0x2f44, 0x03c4, + 0x2f45, 0x03c6, + 0x2f4b, 0x03ce, + 0x2f4c, 0x03d1, + 0x2f4d, 0x03d4, + 0x2f4e, 0x03d7, + 0x2f4f, 0x03da, + 0x2f54, 0x03e0, + 0x2f55, 0x03e2, + 0x2f56, 0x03e4, + 0x2f5c, 0x03eb, + 0x2f5d, 0x03ef, + 0x2f5e, 0x0283, + 0x2f60, 0x03ec, + 0x2f62, 0x03ea, + 0x2f63, 0x03f1, + 0x2f65, 0x03f0, + 0x2f66, 0x03a8, + 0x2f67, 0x03aa, + 0x2f68, 0x03ac, + 0x2f69, 0x03ae, + 0x2f6a, 0x03b0, + 0x2f6b, 0x03b2, + 0x2f6c, 0x03b4, + 0x2f6d, 0x03b6, + 0x2f6e, 0x03b8, + 0x2f6f, 0x03ba, + 0x2f70, 0x03bc, + 0x2f71, 0x03be, + 0x2f72, 0x03c1, + 0x2f73, 0x03c3, + 0x2f74, 0x03c5, + 0x2f75, 0x03cc, + 0x2f77, 0x03cf, + 0x2f79, 0x03d2, + 0x2f7b, 0x03d5, + 0x2f7d, 0x03d8, + 0x3021, 0x0465, + 0x3022, 0x1dd1, + 0x3023, 0x0467, + 0x3033, 0x1ca2, + 0x3034, 0x0478, + 0x303b, 0x1dd2, + 0x303c, 0x0480, + 0x306e, 0x1dd3, + 0x306f, 0x04b3, + 0x3073, 0x1dd4, + 0x3074, 0x04b8, + 0x307c, 0x1dd5, + 0x307d, 0x04c1, + 0x3121, 0x04c3, + 0x312a, 0x1dd6, + 0x312b, 0x04cd, + 0x3135, 0x1dd7, + 0x3136, 0x04d8, + 0x3139, 0x1dd8, + 0x313a, 0x04dc, + 0x313c, 0x1dd9, + 0x313e, 0x04e0, + 0x3142, 0x1ddb, + 0x3143, 0x04e5, + 0x316b, 0x1ddc, + 0x316c, 0x050e, + 0x3221, 0x0521, + 0x3228, 0x1ddd, + 0x3229, 0x1cc9, + 0x322a, 0x1dde, + 0x322b, 0x052b, + 0x3260, 0x1ddf, + 0x3261, 0x0561, + 0x327a, 0x1de0, + 0x327b, 0x057b, + 0x327d, 0x1de1, + 0x327e, 0x057e, + 0x3321, 0x057f, + 0x3322, 0x1de2, + 0x3323, 0x0581, + 0x3342, 0x1961, + 0x3343, 0x05a1, + 0x3349, 0x139f, + 0x334a, 0x05a8, + 0x3365, 0x1de3, + 0x3366, 0x05c4, + 0x336b, 0x1de4, + 0x336c, 0x05ca, + 0x3373, 0x1de5, + 0x3374, 0x05d2, + 0x3376, 0x1731, + 0x3377, 0x05d5, + 0x337a, 0x1de6, + 0x337b, 0x05d9, + 0x3421, 0x05dd, + 0x3442, 0x1de7, + 0x3443, 0x1572, + 0x3444, 0x0600, + 0x344d, 0x1de8, + 0x344e, 0x060a, + 0x3452, 0x1a20, + 0x3453, 0x060f, + 0x3465, 0x1de9, + 0x3466, 0x0622, + 0x3521, 0x063b, + 0x352b, 0x1dea, + 0x352c, 0x0646, + 0x3540, 0x1deb, + 0x3541, 0x065b, + 0x3621, 0x0699, + 0x3622, 0x1dec, + 0x3623, 0x069b, + 0x362a, 0x1ded, + 0x362b, 0x06a3, + 0x3646, 0x1d32, + 0x3647, 0x06bf, + 0x364f, 0x1dee, + 0x3650, 0x06c8, + 0x366d, 0x1def, + 0x366e, 0x06e6, + 0x3674, 0x1df0, + 0x3675, 0x06ed, + 0x367b, 0x1df1, + 0x367c, 0x06f4, + 0x367d, 0x1df2, + 0x367e, 0x06f6, + 0x3721, 0x06f7, + 0x3724, 0x1df3, + 0x3725, 0x06fb, + 0x3737, 0x1df4, + 0x3738, 0x070e, + 0x3745, 0x1df5, + 0x3746, 0x071c, + 0x374e, 0x1df6, + 0x374f, 0x0725, + 0x3752, 0x1df7, + 0x3753, 0x0729, + 0x3755, 0x1df8, + 0x3756, 0x072c, + 0x375b, 0x1c0d, + 0x375c, 0x0732, + 0x3764, 0x1df9, + 0x3765, 0x073b, + 0x3771, 0x1dfa, + 0x3772, 0x0748, + 0x3779, 0x1dfb, + 0x377a, 0x0750, + 0x377e, 0x1dfc, + 0x3821, 0x0755, + 0x3834, 0x1dfd, + 0x3835, 0x0769, + 0x3841, 0x1dfe, + 0x3842, 0x0776, + 0x3921, 0x07b3, + 0x392b, 0x1dff, + 0x392c, 0x07be, + 0x3937, 0x1e00, + 0x3938, 0x07ca, + 0x3942, 0x1e01, + 0x3943, 0x07d5, + 0x395c, 0x16dd, + 0x395d, 0x07ef, + 0x396d, 0x1e02, + 0x396e, 0x0800, + 0x3974, 0x1e03, + 0x3975, 0x0807, + 0x3979, 0x1e04, + 0x397a, 0x080c, + 0x3a21, 0x0811, + 0x3a53, 0x1e05, + 0x3a54, 0x0844, + 0x3a67, 0x1e06, + 0x3a68, 0x0858, + 0x3a74, 0x1e07, + 0x3a75, 0x0865, + 0x3b21, 0x086f, + 0x3b27, 0x1e08, + 0x3b28, 0x0876, + 0x3b2a, 0x1e09, + 0x3b2b, 0x0879, + 0x3b2c, 0x1e0a, + 0x3b2d, 0x087b, + 0x3b39, 0x1e0b, + 0x3b3a, 0x0888, + 0x3c21, 0x08cd, + 0x3c38, 0x1e0c, + 0x3c39, 0x08e5, + 0x3c48, 0x1e0d, + 0x3c49, 0x1929, + 0x3c4a, 0x08f6, + 0x3c57, 0x1e0e, + 0x3c58, 0x0904, + 0x3c5d, 0x1e0f, + 0x3c5f, 0x090b, + 0x3d21, 0x092b, + 0x3d2b, 0x1e11, + 0x3d2c, 0x0936, + 0x3d36, 0x1e12, + 0x3d37, 0x0941, + 0x3d6c, 0x1e13, + 0x3d6e, 0x0978, + 0x3d72, 0x1e15, + 0x3d74, 0x097e, + 0x3e21, 0x0989, + 0x3e25, 0x1e17, + 0x3e26, 0x098e, + 0x3e33, 0x1e18, + 0x3e34, 0x099c, + 0x3e3f, 0x1e19, + 0x3e40, 0x09a8, + 0x3e55, 0x1e1a, + 0x3e56, 0x09be, + 0x3e5f, 0x1e1b, + 0x3e60, 0x09c8, + 0x3e64, 0x1e1c, + 0x3e65, 0x09cd, + 0x3f21, 0x09e7, + 0x3f2a, 0x1e1d, + 0x3f2b, 0x09f1, + 0x3f59, 0x1e1e, + 0x3f5a, 0x0a20, + 0x3f60, 0x1e1f, + 0x3f61, 0x0a27, + 0x3f69, 0x1e20, + 0x3f6a, 0x0a30, + 0x4021, 0x0a45, + 0x4022, 0x1e21, + 0x4023, 0x0a47, + 0x4042, 0x1e22, + 0x4043, 0x0a67, + 0x4066, 0x1e23, + 0x4067, 0x0a8b, + 0x4071, 0x1e24, + 0x4073, 0x0a97, + 0x4079, 0x1e26, + 0x407b, 0x0a9f, + 0x4121, 0x0aa3, + 0x4127, 0x1e28, + 0x4128, 0x1a6e, + 0x4129, 0x0aab, + 0x4139, 0x1e29, + 0x413a, 0x0abc, + 0x414c, 0x1e2a, + 0x414d, 0x0acf, + 0x414f, 0x1e2b, + 0x4150, 0x0ad2, + 0x415f, 0x1e2c, + 0x4160, 0x0ae2, + 0x4169, 0x1e2d, + 0x416a, 0x0aec, + 0x4221, 0x0b01, + 0x423d, 0x1e2e, + 0x423e, 0x0b1e, + 0x424d, 0x1e2f, + 0x424e, 0x0b2e, + 0x425c, 0x1e30, + 0x425d, 0x0b3d, + 0x4263, 0x1e31, + 0x4264, 0x0b44, + 0x426f, 0x1e32, + 0x4270, 0x0b50, + 0x4275, 0x1e33, + 0x4277, 0x0b57, + 0x427d, 0x1e35, + 0x427e, 0x0b5e, + 0x4321, 0x0b5f, + 0x4327, 0x1e36, + 0x4328, 0x0b66, + 0x4329, 0x1e37, + 0x432b, 0x0b69, + 0x432d, 0x1e39, + 0x432f, 0x0b6d, + 0x433d, 0x1e3b, + 0x433e, 0x0b7c, + 0x4370, 0x1e3c, + 0x4371, 0x0baf, + 0x4375, 0x1e3d, + 0x4376, 0x0bb4, + 0x437c, 0x1e3e, + 0x437d, 0x0bbb, + 0x4421, 0x0bbd, + 0x443d, 0x1e3f, + 0x443e, 0x0bda, + 0x4448, 0x1e40, + 0x4449, 0x0be5, + 0x444a, 0x1e41, + 0x444b, 0x0be7, + 0x444d, 0x1e42, + 0x444e, 0x0bea, + 0x444f, 0x1e43, + 0x4450, 0x0bec, + 0x445b, 0x11b5, + 0x445c, 0x0bf8, + 0x4521, 0x0c1b, + 0x4522, 0x1e44, + 0x4523, 0x0c1d, + 0x4527, 0x1e45, + 0x4528, 0x0c22, + 0x452e, 0x1e46, + 0x452f, 0x0c29, + 0x4536, 0x1e47, + 0x4537, 0x0c31, + 0x453f, 0x1e48, + 0x4540, 0x0c3a, + 0x4548, 0x1e49, + 0x4549, 0x0c43, + 0x454b, 0x1e4a, + 0x454c, 0x0c46, + 0x4551, 0x1e4b, + 0x4553, 0x0c4d, + 0x4557, 0x16df, + 0x4558, 0x0c52, + 0x4564, 0x1e4d, + 0x4565, 0x0c5f, + 0x456e, 0x1450, + 0x456f, 0x0c69, + 0x4573, 0x1536, + 0x4574, 0x0c6e, + 0x4578, 0x1e4e, + 0x4579, 0x0c73, + 0x4621, 0x0c79, + 0x463e, 0x1e4f, + 0x463f, 0x0c97, + 0x4642, 0x1e50, + 0x4643, 0x0c9b, + 0x4654, 0x1e51, + 0x4656, 0x0cae, + 0x465b, 0x1e53, + 0x465d, 0x0cb5, + 0x4661, 0x1e55, + 0x4662, 0x0cba, + 0x4666, 0x1e56, + 0x4668, 0x0cc0, + 0x466a, 0x1e58, + 0x466b, 0x0cc3, + 0x4676, 0x1aed, + 0x4677, 0x0ccf, + 0x4721, 0x0cd7, + 0x4729, 0x1e59, + 0x472a, 0x0ce0, + 0x4739, 0x1e5a, + 0x473a, 0x0cf0, + 0x4757, 0x1e5b, + 0x4758, 0x0d0e, + 0x4767, 0x1e5c, + 0x4768, 0x1989, + 0x4769, 0x1e5d, + 0x476a, 0x0d20, + 0x476d, 0x1e5e, + 0x476e, 0x0d24, + 0x4821, 0x0d35, + 0x4824, 0x1e5f, + 0x4825, 0x0d39, + 0x482e, 0x1e60, + 0x482f, 0x0d43, + 0x4830, 0x1e61, + 0x4831, 0x0d45, + 0x4854, 0x1e62, + 0x4855, 0x0d69, + 0x4862, 0x1e63, + 0x4863, 0x0d77, + 0x4875, 0x1e64, + 0x4876, 0x0d8a, + 0x4921, 0x0d93, + 0x4922, 0x1e65, + 0x4924, 0x0d96, + 0x492f, 0x1e67, + 0x4930, 0x143b, + 0x4931, 0x0da3, + 0x4932, 0x1e68, + 0x4933, 0x0da5, + 0x4935, 0x1e69, + 0x4936, 0x0da8, + 0x4940, 0x1e6a, + 0x4941, 0x0db3, + 0x494e, 0x1e6b, + 0x494f, 0x0dc1, + 0x4951, 0x1e6c, + 0x4952, 0x0dc4, + 0x4a21, 0x0df1, + 0x4a43, 0x1e6d, + 0x4a44, 0x0e14, + 0x4a4d, 0x1e6e, + 0x4a4e, 0x0e1e, + 0x4a5a, 0x1e6f, + 0x4a5b, 0x0e2b, + 0x4a79, 0x1e70, + 0x4a7a, 0x0e4a, + 0x4b21, 0x0e4f, + 0x4b22, 0x1e71, + 0x4b23, 0x0e51, + 0x4b29, 0x1e72, + 0x4b2a, 0x0e58, + 0x4b4b, 0x1e73, + 0x4b4c, 0x0e7a, + 0x4b6a, 0x1d33, + 0x4b6b, 0x0e99, + 0x4b70, 0x1e74, + 0x4b71, 0x0e9f, + 0x4b79, 0x102f, + 0x4b7a, 0x0ea8, + 0x4c21, 0x0ead, + 0x4c4d, 0x1e75, + 0x4c4e, 0x0eda, + 0x4c59, 0x1e76, + 0x4c5a, 0x0ee6, + 0x4c5f, 0x1e77, + 0x4c60, 0x0eec, + 0x4c62, 0x1e78, + 0x4c63, 0x0eef, + 0x4c79, 0x1935, + 0x4c7a, 0x1e79, + 0x4c7b, 0x0f07, + 0x4c7c, 0x1e7a, + 0x4c7d, 0x0f09, + 0x4c7e, 0x1e7b, + 0x4d21, 0x0f0b, + 0x4d32, 0x1e7c, + 0x4d33, 0x0f1d, + 0x4d50, 0x1e7d, + 0x4d51, 0x0f3b, + 0x4d54, 0x1e7e, + 0x4d55, 0x0f3f, + 0x4d5a, 0x1d34, + 0x4d5b, 0x0f45, + 0x4d69, 0x1e7f, + 0x4d6a, 0x0f54, + 0x4e21, 0x0f69, + 0x4e4b, 0x1e80, + 0x4e4c, 0x0f94, + 0x4e7a, 0x1e81, + 0x4e7c, 0x0fc4, + 0x4f21, 0x1e83, + 0x4f22, 0x0fc8, + 0x4f31, 0x1e84, + 0x4f32, 0x0fd8, + 0x4f36, 0x1777, + 0x4f37, 0x0fdd, + 0x4f39, 0x1e85, + 0x4f3a, 0x0fe0, + 0x5021, 0x0ffa, + 0x5056, 0x0ea7, + 0x5057, 0x1030, + 0x5121, 0x1058, + 0x513d, 0x1e86, + 0x513e, 0x1075, + 0x5147, 0x1e87, + 0x5148, 0x107f, + 0x514b, 0x1e88, + 0x514c, 0x1083, + 0x514d, 0x1e89, + 0x514e, 0x1085, + 0x5221, 0x10b6, + 0x5321, 0x1114, + 0x5330, 0x1e8a, + 0x5331, 0x1124, + 0x533a, 0x1e8b, + 0x533b, 0x112e, + 0x5350, 0x1e8c, + 0x5351, 0x1144, + 0x535e, 0x1e8d, + 0x535f, 0x1152, + 0x536b, 0x1e8e, + 0x536c, 0x115f, + 0x5421, 0x1172, + 0x5444, 0x1e8f, + 0x5445, 0x1196, + 0x5464, 0x0bf7, + 0x5465, 0x11b6, + 0x5521, 0x11d0, + 0x553d, 0x1e90, + 0x553e, 0x11ed, + 0x5563, 0x1e91, + 0x5564, 0x1213, + 0x5621, 0x122e, + 0x5622, 0x1e92, + 0x5623, 0x1230, + 0x5672, 0x1e93, + 0x5673, 0x1280, + 0x5721, 0x128c, + 0x5821, 0x12ea, + 0x5824, 0x1e94, + 0x5825, 0x12ee, + 0x5921, 0x1348, + 0x5960, 0x1e95, + 0x5961, 0x1388, + 0x596c, 0x1e96, + 0x596d, 0x1394, + 0x5978, 0x05a7, + 0x5979, 0x13a0, + 0x5a21, 0x13a6, + 0x5a39, 0x1e97, + 0x5a3a, 0x13bf, + 0x5a4d, 0x1e98, + 0x5a4e, 0x13d3, + 0x5b21, 0x1404, + 0x5b45, 0x1e99, + 0x5b46, 0x1429, + 0x5b4a, 0x1e9a, + 0x5b4b, 0x142e, + 0x5b58, 0x0da2, + 0x5b59, 0x143c, + 0x5b6b, 0x1e9b, + 0x5b6c, 0x144f, + 0x5b6d, 0x0c68, + 0x5b6e, 0x1451, + 0x5b74, 0x1e9c, + 0x5b75, 0x1458, + 0x5c21, 0x1462, + 0x5d21, 0x14c0, + 0x5e21, 0x151e, + 0x5e39, 0x0c6d, + 0x5e3a, 0x1537, + 0x5e50, 0x1e9d, + 0x5e51, 0x154e, + 0x5e75, 0x05ff, + 0x5e76, 0x1573, + 0x5f21, 0x157c, + 0x5f73, 0x1e9e, + 0x5f74, 0x15cf, + 0x6021, 0x15da, + 0x6026, 0x1e9f, + 0x6027, 0x15e0, + 0x605f, 0x1ea0, + 0x6060, 0x1619, + 0x6076, 0x1d35, + 0x6077, 0x1630, + 0x6121, 0x1638, + 0x612b, 0x1ea1, + 0x612c, 0x1643, + 0x6130, 0x1ea2, + 0x6132, 0x1649, + 0x6221, 0x1696, + 0x622b, 0x1ea4, + 0x622c, 0x16a1, + 0x6268, 0x07ee, + 0x6269, 0x16de, + 0x626a, 0x0c51, + 0x626b, 0x16e0, + 0x626f, 0x1ea5, + 0x6270, 0x16e5, + 0x6321, 0x16f4, + 0x634a, 0x1ea6, + 0x634b, 0x171e, + 0x6354, 0x1ea7, + 0x6355, 0x1728, + 0x635e, 0x05d4, + 0x635f, 0x1732, + 0x6421, 0x1752, + 0x6439, 0x1ea8, + 0x643a, 0x176b, + 0x6446, 0x0fdc, + 0x6447, 0x1778, + 0x6464, 0x1ea9, + 0x6465, 0x1796, + 0x646e, 0x1eaa, + 0x646f, 0x17a0, + 0x6521, 0x17b0, + 0x6539, 0x1eab, + 0x653a, 0x17c9, + 0x653b, 0x1eac, + 0x653c, 0x17cb, + 0x6546, 0x1ead, + 0x6547, 0x17d6, + 0x6621, 0x180e, + 0x6646, 0x1eae, + 0x6647, 0x1834, + 0x6721, 0x186c, + 0x6764, 0x1eaf, + 0x6765, 0x18b0, + 0x6769, 0x1eb0, + 0x676a, 0x18b5, + 0x6772, 0x1eb1, + 0x6773, 0x18be, + 0x6821, 0x18ca, + 0x6834, 0x1eb2, + 0x6835, 0x18de, + 0x683b, 0x1eb3, + 0x683c, 0x18e5, + 0x6874, 0x1eb4, + 0x6875, 0x191e, + 0x6921, 0x1928, + 0x6922, 0x08f5, + 0x6923, 0x192a, + 0x692e, 0x0f05, + 0x692f, 0x1936, + 0x693c, 0x1eb5, + 0x693d, 0x1944, + 0x695a, 0x05a0, + 0x695b, 0x1962, + 0x6a21, 0x1986, + 0x6a24, 0x0d1e, + 0x6a25, 0x198a, + 0x6a27, 0x1eb6, + 0x6a28, 0x198d, + 0x6a3d, 0x1eb7, + 0x6a3e, 0x19a3, + 0x6a6f, 0x1eb8, + 0x6a70, 0x19d5, + 0x6b21, 0x19e4, + 0x6b32, 0x1eb9, + 0x6b33, 0x19f6, + 0x6b5d, 0x060e, + 0x6b5e, 0x1a21, + 0x6b66, 0x1eba, + 0x6b67, 0x1a2a, + 0x6b76, 0x1ebb, + 0x6b77, 0x1a3a, + 0x6c21, 0x1a42, + 0x6c4d, 0x0aaa, + 0x6c4e, 0x1a6f, + 0x6c69, 0x1ebc, + 0x6c6a, 0x1a8b, + 0x6c74, 0x1ebd, + 0x6c75, 0x1a96, + 0x6d21, 0x1aa0, + 0x6d4e, 0x1ebe, + 0x6d4f, 0x1ace, + 0x6d6c, 0x1ebf, + 0x6d6d, 0x1aec, + 0x6d6e, 0x1ec0, + 0x6d6f, 0x1aee, + 0x6e21, 0x1afe, + 0x6e29, 0x1ec1, + 0x6e2a, 0x1b07, + 0x6e3d, 0x1ec2, + 0x6e3e, 0x1b1b, + 0x6e57, 0x1ec3, + 0x6e58, 0x1b35, + 0x6f21, 0x1b5c, + 0x6f65, 0x1ec4, + 0x6f66, 0x1ba1, + 0x7021, 0x1bba, + 0x7033, 0x1ec5, + 0x7034, 0x1bcd, + 0x7045, 0x1ec6, + 0x7046, 0x1bdf, + 0x7051, 0x1ec7, + 0x7052, 0x1beb, + 0x7057, 0x1ec8, + 0x7058, 0x1bf1, + 0x7074, 0x0731, + 0x7075, 0x1ec9, + 0x7076, 0x1c0f, + 0x7121, 0x1c18, + 0x7221, 0x1c76, + 0x722d, 0x1eca, + 0x722e, 0x1c83, + 0x723c, 0x1ecb, + 0x723d, 0x1c92, + 0x724d, 0x0477, + 0x724e, 0x1ecc, + 0x724f, 0x1ca4, + 0x7274, 0x0529, + 0x7275, 0x1cca, + 0x7321, 0x1cd4, + 0x7351, 0x1ecd, + 0x7352, 0x1d05, + 0x737d, 0x1ece, + 0x737e, 0x1d31, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12NWPHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12NWPHMap2, 761 +}; + +static Gushort japan12RKSJHMap2[244] = { + 0x0000, 0x0000, + 0x8140, 0x0279, + 0x8180, 0x02b8, + 0x81b8, 0x02e5, + 0x81c8, 0x02ed, + 0x81da, 0x02f4, + 0x81f0, 0x0303, + 0x81fc, 0x030b, + 0x824f, 0x030c, + 0x8260, 0x0316, + 0x8281, 0x0330, + 0x829f, 0x034a, + 0x8340, 0x039d, + 0x8380, 0x03dc, + 0x839f, 0x03f3, + 0x83bf, 0x040b, + 0x8440, 0x0423, + 0x8470, 0x0444, + 0x8480, 0x0453, + 0x849f, 0x1d37, + 0x84a0, 0x1d39, + 0x84a1, 0x1d43, + 0x84a2, 0x1d47, + 0x84a3, 0x1d4f, + 0x84a4, 0x1d4b, + 0x84a5, 0x1d53, + 0x84a6, 0x1d63, + 0x84a7, 0x1d5b, + 0x84a8, 0x1d6b, + 0x84a9, 0x1d73, + 0x84aa, 0x1d38, + 0x84ab, 0x1d3a, + 0x84ac, 0x1d46, + 0x84ad, 0x1d4a, + 0x84ae, 0x1d52, + 0x84af, 0x1d4e, + 0x84b0, 0x1d5a, + 0x84b1, 0x1d6a, + 0x84b2, 0x1d62, + 0x84b3, 0x1d72, + 0x84b4, 0x1d82, + 0x84b5, 0x1d57, + 0x84b6, 0x1d66, + 0x84b7, 0x1d5f, + 0x84b8, 0x1d6e, + 0x84b9, 0x1d76, + 0x84ba, 0x1d54, + 0x84bb, 0x1d67, + 0x84bc, 0x1d5c, + 0x84bd, 0x1d6f, + 0x84be, 0x1d79, + 0x889f, 0x0465, + 0x8940, 0x04c3, + 0x8980, 0x0502, + 0x8a40, 0x057f, + 0x8a80, 0x05be, + 0x8b40, 0x063b, + 0x8b80, 0x067a, + 0x8c40, 0x06f7, + 0x8c80, 0x0736, + 0x8d40, 0x07b3, + 0x8d80, 0x07f2, + 0x8e40, 0x086f, + 0x8e80, 0x08ae, + 0x8f40, 0x092b, + 0x8f80, 0x096a, + 0x9040, 0x09e7, + 0x9080, 0x0a26, + 0x9140, 0x0aa3, + 0x9180, 0x0ae2, + 0x9240, 0x0b5f, + 0x9280, 0x0b9e, + 0x9340, 0x0c1b, + 0x9380, 0x0c5a, + 0x9440, 0x0cd7, + 0x9480, 0x0d16, + 0x9540, 0x0d93, + 0x9580, 0x0dd2, + 0x9640, 0x0e4f, + 0x9680, 0x0e8e, + 0x9740, 0x0f0b, + 0x9780, 0x0f4a, + 0x9840, 0x0fc7, + 0x989f, 0x0ffa, + 0x9940, 0x1058, + 0x9980, 0x1097, + 0x9a40, 0x1114, + 0x9a80, 0x1153, + 0x9b40, 0x11d0, + 0x9b80, 0x120f, + 0x9c40, 0x128c, + 0x9c80, 0x12cb, + 0x9d40, 0x1348, + 0x9d80, 0x1387, + 0x9e40, 0x1404, + 0x9e80, 0x1443, + 0x9f40, 0x14c0, + 0x9f80, 0x14ff, + 0xe040, 0x157c, + 0xe080, 0x15bb, + 0xe140, 0x1638, + 0xe180, 0x1677, + 0xe240, 0x16f4, + 0xe280, 0x1733, + 0xe340, 0x17b0, + 0xe380, 0x17ef, + 0xe440, 0x186c, + 0xe480, 0x18ab, + 0xe540, 0x1928, + 0xe580, 0x1967, + 0xe640, 0x19e4, + 0xe680, 0x1a23, + 0xe740, 0x1aa0, + 0xe780, 0x1adf, + 0xe840, 0x1b5c, + 0xe880, 0x1b9b, + 0xe940, 0x1c18, + 0xe980, 0x1c57, + 0xea40, 0x1cd4, + 0xea80, 0x1d13, + 0xeaa3, 0x205c, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12RKSJHEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0146, 0x0147, 0x0148, 0x0149, 0x014a, 0x014b, 0x014c, 0x014d, + 0x014e, 0x014f, 0x0150, 0x0151, 0x0152, 0x0153, 0x0154, 0x0155, + 0x0156, 0x0157, 0x0158, 0x0159, 0x015a, 0x015b, 0x015c, 0x015d, + 0x015e, 0x015f, 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, + 0x0166, 0x0167, 0x0168, 0x0169, 0x016a, 0x016b, 0x016c, 0x016d, + 0x016e, 0x016f, 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, + 0x0176, 0x0177, 0x0178, 0x0179, 0x017a, 0x017b, 0x017c, 0x017d, + 0x017e, 0x017f, 0x0180, 0x0181, 0x0182, 0x0183, 0x0184, 0x0185, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12RKSJHMap2, 122 +}; + +static Gushort japan12RomanMap2[4] = { + 0x0000, 0x0000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12RomanEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00e7, 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, + 0x00ef, 0x00f0, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, + 0x00f7, 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, + 0x00ff, 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, + 0x0107, 0x0108, 0x0109, 0x010a, 0x010b, 0x010c, 0x010d, 0x010e, + 0x010f, 0x0110, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, + 0x0117, 0x0118, 0x0119, 0x011a, 0x011b, 0x011c, 0x011d, 0x011e, + 0x011f, 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0126, + 0x0127, 0x0128, 0x0129, 0x012a, 0x012b, 0x012c, 0x012d, 0x012e, + 0x012f, 0x0130, 0x0131, 0x0132, 0x0133, 0x0134, 0x0135, 0x0136, + 0x0137, 0x0138, 0x0139, 0x013a, 0x013b, 0x013c, 0x013d, 0x013e, + 0x013f, 0x0140, 0x0141, 0x0142, 0x0143, 0x0144, 0x0145, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12RomanMap2, 2 +}; + +static Gushort japan12UniJISUCS2HMap2[13926] = { + 0x0000, 0x0000, + 0x0020, 0x0001, + 0x005c, 0x0061, + 0x005d, 0x003e, + 0x00a1, 0x0065, + 0x00a4, 0x006b, + 0x00a5, 0x003d, + 0x00a6, 0x0063, + 0x00a7, 0x02d0, + 0x00a8, 0x0287, + 0x00a9, 0x0098, + 0x00aa, 0x008c, + 0x00ab, 0x006d, + 0x00ac, 0x0099, + 0x00ad, 0x0097, + 0x00ae, 0x009a, + 0x00af, 0x0081, + 0x00b0, 0x02c3, + 0x00b1, 0x02b6, + 0x00b2, 0x009d, + 0x00b4, 0x0285, + 0x00b5, 0x009f, + 0x00b6, 0x030a, + 0x00b7, 0x0075, + 0x00b8, 0x0086, + 0x00b9, 0x00a0, + 0x00ba, 0x0090, + 0x00bb, 0x007b, + 0x00bc, 0x00a1, + 0x00bf, 0x007e, + 0x00c0, 0x00a4, + 0x00c6, 0x008b, + 0x00c7, 0x00aa, + 0x00d7, 0x02b7, + 0x00d8, 0x008e, + 0x00d9, 0x00bb, + 0x00df, 0x0096, + 0x00e0, 0x00c1, + 0x00e6, 0x0091, + 0x00e7, 0x00c7, + 0x00f7, 0x02b8, + 0x00f8, 0x0094, + 0x00f9, 0x00d8, + 0x0131, 0x0092, + 0x0141, 0x008d, + 0x0142, 0x0093, + 0x0152, 0x008f, + 0x0153, 0x0095, + 0x0160, 0x00df, + 0x0161, 0x00e3, + 0x0178, 0x00e0, + 0x017d, 0x00e1, + 0x017e, 0x00e5, + 0x01c0, 0x0063, + 0x0300, 0x0041, + 0x0301, 0x007f, + 0x0303, 0x005f, + 0x0304, 0x0081, + 0x0305, 0x00e2, + 0x0306, 0x0082, + 0x030a, 0x0085, + 0x030b, 0x0087, + 0x030c, 0x0089, + 0x0327, 0x0086, + 0x0328, 0x0088, + 0x0332, 0x0040, + 0x0336, 0x008a, + 0x0361, 0x02f6, + 0x0391, 0x03f3, + 0x03a3, 0x0404, + 0x03b1, 0x040b, + 0x03c3, 0x041c, + 0x0401, 0x0429, + 0x0410, 0x0423, + 0x0416, 0x042a, + 0x0436, 0x044b, + 0x0451, 0x044a, + 0x2002, 0x00e7, + 0x2003, 0x0279, + 0x2010, 0x000e, + 0x2011, 0x000e, + 0x2012, 0x0072, + 0x2013, 0x0072, + 0x2014, 0x008a, + 0x2015, 0x0295, + 0x2016, 0x029a, + 0x2018, 0x029e, + 0x201a, 0x0078, + 0x201c, 0x02a0, + 0x201e, 0x0079, + 0x2020, 0x0308, + 0x2022, 0x0077, + 0x2025, 0x029d, + 0x2026, 0x029c, + 0x2030, 0x0304, + 0x2032, 0x02c4, + 0x2039, 0x006e, + 0x203b, 0x02de, + 0x203e, 0x0145, + 0x2044, 0x0068, + 0x20dd, 0x030b, + 0x2103, 0x02c6, + 0x2109, 0x2071, + 0x2113, 0x1f59, + 0x2116, 0x1dba, + 0x2121, 0x1f77, + 0x2122, 0x00e4, + 0x212b, 0x0303, + 0x2160, 0x1d97, + 0x216a, 0x2021, + 0x2170, 0x1f9c, + 0x217a, 0x206a, + 0x217f, 0x206f, + 0x2190, 0x02e1, + 0x2192, 0x02e0, + 0x2193, 0x02e3, + 0x21c4, 0x2076, + 0x21c6, 0x2075, + 0x21d2, 0x02f0, + 0x21d4, 0x02f1, + 0x21e6, 0x1f4d, + 0x21e7, 0x1f4c, + 0x21e8, 0x1f4e, + 0x21e9, 0x1f4b, + 0x2200, 0x02f2, + 0x2202, 0x02f7, + 0x2203, 0x02f3, + 0x2207, 0x02f8, + 0x2208, 0x02e5, + 0x220b, 0x02e6, + 0x2211, 0x1dc9, + 0x2212, 0x02b5, + 0x221a, 0x02fd, + 0x221d, 0x02ff, + 0x221e, 0x02bf, + 0x221f, 0x1dcd, + 0x2220, 0x02f4, + 0x2225, 0x029a, + 0x2227, 0x02ed, + 0x2229, 0x02ec, + 0x222a, 0x02eb, + 0x222b, 0x0301, + 0x222d, 0x2003, + 0x222e, 0x1dc8, + 0x2234, 0x02c0, + 0x2235, 0x0300, + 0x223c, 0x0299, + 0x223d, 0x02fe, + 0x2252, 0x02fa, + 0x2260, 0x02ba, + 0x2261, 0x02f9, + 0x2266, 0x02bd, + 0x226a, 0x02fb, + 0x2282, 0x02e9, + 0x2286, 0x02e7, + 0x22a5, 0x02f5, + 0x22bf, 0x1dce, + 0x22ee, 0x1ed9, + 0x22ef, 0x029c, + 0x2312, 0x02f6, + 0x2460, 0x1d83, + 0x2474, 0x1f87, + 0x2488, 0x1f7e, + 0x249c, 0x1fb0, + 0x24ea, 0x2020, + 0x2500, 0x1d37, + 0x2550, 0x203b, + 0x255e, 0x203c, + 0x2561, 0x203e, + 0x256a, 0x203d, + 0x256d, 0x2037, + 0x256f, 0x203a, + 0x2570, 0x2039, + 0x2571, 0x2045, + 0x2581, 0x2026, + 0x2589, 0x2034, + 0x258a, 0x2033, + 0x258b, 0x2032, + 0x258c, 0x2031, + 0x258d, 0x2030, + 0x258e, 0x202f, + 0x258f, 0x202e, + 0x2594, 0x2035, + 0x25a0, 0x02d9, + 0x25a1, 0x02d8, + 0x25a2, 0x1f4f, + 0x25b2, 0x02db, + 0x25b3, 0x02da, + 0x25b7, 0x1f4a, + 0x25bc, 0x02dd, + 0x25bd, 0x02dc, + 0x25c1, 0x1f49, + 0x25c6, 0x02d7, + 0x25c7, 0x02d6, + 0x25c9, 0x2012, + 0x25cb, 0x02d3, + 0x25ce, 0x02d5, + 0x25cf, 0x02d4, + 0x25e2, 0x203f, + 0x25e4, 0x2042, + 0x25e5, 0x2041, + 0x25ef, 0x030b, + 0x2600, 0x2017, + 0x2605, 0x02d2, + 0x2606, 0x02d1, + 0x260e, 0x1f78, + 0x261c, 0x201c, + 0x261e, 0x201b, + 0x261f, 0x201e, + 0x2640, 0x02c2, + 0x2642, 0x02c1, + 0x2660, 0x2013, + 0x2661, 0x1f51, + 0x2662, 0x1f53, + 0x2663, 0x2015, + 0x2664, 0x1f52, + 0x2665, 0x2014, + 0x2666, 0x2016, + 0x2667, 0x1f50, + 0x266a, 0x0307, + 0x266d, 0x0306, + 0x266f, 0x0305, + 0x2776, 0x205e, + 0x27a1, 0x200e, + 0x3000, 0x0279, + 0x3003, 0x028f, + 0x3004, 0x2074, + 0x3005, 0x0291, + 0x3008, 0x02aa, + 0x3012, 0x02df, + 0x3013, 0x02e4, + 0x3014, 0x02a4, + 0x301c, 0x0299, + 0x301d, 0x1db8, + 0x301f, 0x1db9, + 0x3020, 0x1f7a, + 0x3036, 0x1f79, + 0x3041, 0x034a, + 0x3094, 0x1f16, + 0x309b, 0x0283, + 0x309d, 0x028d, + 0x30a1, 0x039d, + 0x30f7, 0x2079, + 0x30fb, 0x027e, + 0x30fc, 0x0294, + 0x30fd, 0x028b, + 0x322a, 0x2006, + 0x3230, 0x2005, + 0x3231, 0x1dc2, + 0x3233, 0x1fcf, + 0x3234, 0x1fcd, + 0x3235, 0x1fd4, + 0x3236, 0x1fd3, + 0x3237, 0x200c, + 0x3238, 0x1fce, + 0x3239, 0x1dc4, + 0x323a, 0x1fd7, + 0x323b, 0x1fd5, + 0x323c, 0x1fd0, + 0x323d, 0x1fcb, + 0x323e, 0x1fd2, + 0x323f, 0x1fcc, + 0x3240, 0x1fd6, + 0x3241, 0x200d, + 0x3242, 0x1fd1, + 0x3243, 0x1fca, + 0x3291, 0x1fe1, + 0x3292, 0x1fe0, + 0x3293, 0x1fe2, + 0x3294, 0x1fdc, + 0x3296, 0x1fe5, + 0x3298, 0x1fde, + 0x3299, 0x201f, + 0x329d, 0x207f, + 0x329e, 0x1fff, + 0x32a4, 0x1dbd, + 0x32a9, 0x1fda, + 0x32aa, 0x1fdd, + 0x32ab, 0x1fdf, + 0x32ac, 0x1fe3, + 0x32ad, 0x1fd9, + 0x32ae, 0x1fe4, + 0x32af, 0x1fdb, + 0x32b0, 0x1fd8, + 0x3300, 0x1f70, + 0x3303, 0x1f6a, + 0x3305, 0x1ff7, + 0x330d, 0x1dab, + 0x3314, 0x1da2, + 0x3315, 0x1f69, + 0x3316, 0x1f67, + 0x3318, 0x1f68, + 0x331e, 0x1f73, + 0x3322, 0x1f66, + 0x3323, 0x1f6b, + 0x3326, 0x1dac, + 0x3327, 0x1da6, + 0x332a, 0x1f74, + 0x332b, 0x1dae, + 0x3331, 0x1f71, + 0x3333, 0x2087, + 0x3336, 0x1da8, + 0x3339, 0x1f6e, + 0x333b, 0x1f6f, + 0x3342, 0x1f6d, + 0x3347, 0x1f72, + 0x3349, 0x1da1, + 0x334a, 0x1daf, + 0x334d, 0x1da4, + 0x334e, 0x2088, + 0x3351, 0x1da9, + 0x3357, 0x1f6c, + 0x337b, 0x2083, + 0x337c, 0x1dc7, + 0x337d, 0x1dc6, + 0x337e, 0x1dc5, + 0x337f, 0x1f76, + 0x3385, 0x1f5f, + 0x3388, 0x2000, + 0x338e, 0x1db4, + 0x3390, 0x1f63, + 0x3396, 0x1f65, + 0x3397, 0x1f58, + 0x3398, 0x1f5a, + 0x339c, 0x1db1, + 0x339f, 0x1ffa, + 0x33a0, 0x1f54, + 0x33a1, 0x1db7, + 0x33a2, 0x1f55, + 0x33a3, 0x1ffb, + 0x33a4, 0x1f56, + 0x33a6, 0x1ffc, + 0x33b0, 0x1f5e, + 0x33b1, 0x1f5d, + 0x33b2, 0x1f5c, + 0x33b3, 0x1f5b, + 0x33c4, 0x1db6, + 0x33c8, 0x2002, + 0x33cb, 0x1f62, + 0x33cc, 0x1ff6, + 0x33cd, 0x1dbb, + 0x33d4, 0x1f64, + 0x4e00, 0x04b0, + 0x4e01, 0x0bb8, + 0x4e03, 0x08e3, + 0x4e07, 0x0eaa, + 0x4e08, 0x09ce, + 0x4e09, 0x087e, + 0x4e0a, 0x09cd, + 0x4e0b, 0x053c, + 0x4e0d, 0x0dc6, + 0x4e0e, 0x0f29, + 0x4e10, 0x0ffb, + 0x4e11, 0x04d1, + 0x4e14, 0x05cc, + 0x4e15, 0x0ffc, + 0x4e16, 0x0a48, + 0x4e17, 0x10d7, + 0x4e18, 0x0670, + 0x4e19, 0x0e0a, + 0x4e1e, 0x09cf, + 0x4e21, 0x0f86, + 0x4e26, 0x0e12, + 0x4e28, 0x20b3, + 0x4e2a, 0x0ffd, + 0x4e2d, 0x0ba4, + 0x4e31, 0x0ffe, + 0x4e32, 0x06f2, + 0x4e36, 0x0fff, + 0x4e38, 0x0619, + 0x4e39, 0x0b6e, + 0x4e3b, 0x0913, + 0x4e3c, 0x1000, + 0x4e3f, 0x1001, + 0x4e42, 0x1002, + 0x4e43, 0x0ceb, + 0x4e45, 0x0671, + 0x4e4b, 0x0ced, + 0x4e4d, 0x0cbb, + 0x4e4e, 0x0777, + 0x4e4f, 0x0e61, + 0x4e55, 0x1950, + 0x4e56, 0x1003, + 0x4e57, 0x09d0, + 0x4e58, 0x1004, + 0x4e59, 0x0535, + 0x4e5d, 0x06dd, + 0x4e5e, 0x07a4, + 0x4e5f, 0x0ef5, + 0x4e62, 0x1233, + 0x4e71, 0x0f5a, + 0x4e73, 0x0cd5, + 0x4e7e, 0x05e1, + 0x4e80, 0x064f, + 0x4e82, 0x1005, + 0x4e85, 0x1006, + 0x4e86, 0x0f83, + 0x4e88, 0x0f27, + 0x4e89, 0x0aea, + 0x4e8a, 0x1008, + 0x4e8b, 0x08c4, + 0x4e8c, 0x0ccb, + 0x4e8e, 0x100b, + 0x4e91, 0x04e0, + 0x4e92, 0x0793, + 0x4e94, 0x0792, + 0x4e95, 0x04aa, + 0x4e98, 0x0ff1, + 0x4e99, 0x0ff0, + 0x4e9b, 0x0823, + 0x4e9c, 0x0465, + 0x4e9e, 0x100c, + 0x4ea1, 0x0e62, + 0x4ea2, 0x100f, + 0x4ea4, 0x07a6, + 0x4ea5, 0x04ab, + 0x4ea6, 0x0ea0, + 0x4ea8, 0x0696, + 0x4eab, 0x0697, + 0x4ead, 0x0bfe, + 0x4eae, 0x0f84, + 0x4eb0, 0x1010, + 0x4eb3, 0x1011, + 0x4eb6, 0x1012, + 0x4eba, 0x0a13, + 0x4ec0, 0x0944, + 0x4ec1, 0x0a14, + 0x4ec2, 0x1017, + 0x4ec4, 0x1015, + 0x4ec6, 0x1016, + 0x4ec7, 0x0672, + 0x4eca, 0x0813, + 0x4ecb, 0x0570, + 0x4ecd, 0x1014, + 0x4ece, 0x1013, + 0x4ecf, 0x0df9, + 0x4ed4, 0x0894, + 0x4ed5, 0x0893, + 0x4ed6, 0x0b1e, + 0x4ed7, 0x1018, + 0x4ed8, 0x0dc7, + 0x4ed9, 0x0a8b, + 0x4edd, 0x0290, + 0x4ede, 0x1019, + 0x4edf, 0x101b, + 0x4ee1, 0x20b4, + 0x4ee3, 0x0b45, + 0x4ee4, 0x0fa9, + 0x4ee5, 0x048e, + 0x4eed, 0x101a, + 0x4eee, 0x053e, + 0x4ef0, 0x06bc, + 0x4ef2, 0x0ba5, + 0x4ef6, 0x0745, + 0x4ef7, 0x101c, + 0x4efb, 0x0cda, + 0x4efc, 0x20b5, + 0x4f00, 0x20b6, + 0x4f01, 0x0627, + 0x4f03, 0x20b7, + 0x4f09, 0x101d, + 0x4f0a, 0x048f, + 0x4f0d, 0x0794, + 0x4f0e, 0x0628, + 0x4f0f, 0x0dec, + 0x4f10, 0x0d46, + 0x4f11, 0x0673, + 0x4f1a, 0x0571, + 0x4f1c, 0x1040, + 0x4f1d, 0x0c3b, + 0x4f2f, 0x0d22, + 0x4f30, 0x101f, + 0x4f34, 0x0d50, + 0x4f36, 0x0faa, + 0x4f38, 0x09f3, + 0x4f39, 0x20b8, + 0x4f3a, 0x0895, + 0x4f3c, 0x08c5, + 0x4f3d, 0x0540, + 0x4f43, 0x0bed, + 0x4f46, 0x0b60, + 0x4f47, 0x1023, + 0x4f4d, 0x0490, + 0x4f4e, 0x0bff, + 0x4f4f, 0x0945, + 0x4f50, 0x0824, + 0x4f51, 0x0f0e, + 0x4f53, 0x0b2e, + 0x4f55, 0x053f, + 0x4f56, 0x20b9, + 0x4f57, 0x1022, + 0x4f59, 0x0f28, + 0x4f5a, 0x101e, + 0x4f5b, 0x1020, + 0x4f5c, 0x085e, + 0x4f5d, 0x1021, + 0x4f5e, 0x11d3, + 0x4f69, 0x1029, + 0x4f6f, 0x102c, + 0x4f70, 0x102a, + 0x4f73, 0x0542, + 0x4f75, 0x0e0b, + 0x4f76, 0x1024, + 0x4f7b, 0x1028, + 0x4f7c, 0x07a7, + 0x4f7f, 0x0896, + 0x4f83, 0x05e2, + 0x4f86, 0x102d, + 0x4f88, 0x1025, + 0x4f8a, 0x20bb, + 0x4f8b, 0x0fab, + 0x4f8d, 0x08c6, + 0x4f8f, 0x1026, + 0x4f91, 0x102b, + 0x4f92, 0x20ba, + 0x4f94, 0x20bd, + 0x4f96, 0x102e, + 0x4f98, 0x1027, + 0x4f9a, 0x20bc, + 0x4f9b, 0x0699, + 0x4f9d, 0x0491, + 0x4fa0, 0x069a, + 0x4fa1, 0x0541, + 0x4fab, 0x11d4, + 0x4fad, 0x0ea7, + 0x4fae, 0x0de0, + 0x4faf, 0x07a8, + 0x4fb5, 0x09f5, + 0x4fb6, 0x0f7f, + 0x4fbf, 0x0e28, + 0x4fc2, 0x070e, + 0x4fc3, 0x0b05, + 0x4fc4, 0x0564, + 0x4fc9, 0x20ac, + 0x4fca, 0x095d, + 0x4fcd, 0x20be, + 0x4fce, 0x1032, + 0x4fd0, 0x1037, + 0x4fd1, 0x1035, + 0x4fd4, 0x1030, + 0x4fd7, 0x0b0f, + 0x4fd8, 0x1033, + 0x4fda, 0x1036, + 0x4fdb, 0x1034, + 0x4fdd, 0x0e2d, + 0x4fdf, 0x1031, + 0x4fe0, 0x1dec, + 0x4fe1, 0x09f4, + 0x4fe3, 0x0ea1, + 0x4fe4, 0x1038, + 0x4fee, 0x092e, + 0x4fef, 0x1046, + 0x4ff3, 0x0d06, + 0x4ff5, 0x0da8, + 0x4ff6, 0x1041, + 0x4ff8, 0x0e40, + 0x4ffa, 0x0536, + 0x4ffe, 0x1045, + 0x4fff, 0x20c1, + 0x5005, 0x103f, + 0x5006, 0x1048, + 0x5009, 0x0ad4, + 0x500b, 0x0778, + 0x500d, 0x0d12, + 0x500f, 0x1600, + 0x5011, 0x1047, + 0x5012, 0x0c57, + 0x5014, 0x103c, + 0x5016, 0x07aa, + 0x5019, 0x07a9, + 0x501a, 0x103a, + 0x501e, 0x20c2, + 0x501f, 0x0906, + 0x5021, 0x1042, + 0x5022, 0x20c0, + 0x5023, 0x0e3f, + 0x5024, 0x0b8b, + 0x5025, 0x103e, + 0x5026, 0x0747, + 0x5028, 0x103b, + 0x5029, 0x1043, + 0x502a, 0x103d, + 0x502b, 0x0f99, + 0x502c, 0x1044, + 0x502d, 0x0fe7, + 0x5036, 0x06de, + 0x5039, 0x0746, + 0x5040, 0x20bf, + 0x5042, 0x20c5, + 0x5043, 0x1049, + 0x5046, 0x20c3, + 0x5047, 0x104a, + 0x5048, 0x104e, + 0x5049, 0x0492, + 0x504f, 0x0e20, + 0x5050, 0x104d, + 0x5055, 0x104c, + 0x5056, 0x1050, + 0x505a, 0x104f, + 0x505c, 0x0c00, + 0x5065, 0x0748, + 0x506c, 0x1051, + 0x5070, 0x20c4, + 0x5072, 0x08f1, + 0x5074, 0x0b06, + 0x5075, 0x0c01, + 0x5076, 0x06ee, + 0x5078, 0x1052, + 0x507d, 0x0650, + 0x5080, 0x1053, + 0x5085, 0x1055, + 0x508d, 0x0e63, + 0x5091, 0x073c, + 0x5094, 0x20c6, + 0x5098, 0x087f, + 0x5099, 0x0d8b, + 0x509a, 0x1054, + 0x50ac, 0x0835, + 0x50ad, 0x0f2d, + 0x50b2, 0x1057, + 0x50b3, 0x105a, + 0x50b4, 0x1056, + 0x50b5, 0x0834, + 0x50b7, 0x0987, + 0x50be, 0x070f, + 0x50c2, 0x105b, + 0x50c5, 0x06c7, + 0x50c9, 0x1058, + 0x50cd, 0x0c87, + 0x50cf, 0x0afe, + 0x50d1, 0x069b, + 0x50d5, 0x0e7b, + 0x50d6, 0x105c, + 0x50d8, 0x20c8, + 0x50da, 0x0f85, + 0x50de, 0x105d, + 0x50e3, 0x1060, + 0x50e5, 0x105e, + 0x50e7, 0x0ad0, + 0x50ed, 0x105f, + 0x50ee, 0x1061, + 0x50f4, 0x20c7, + 0x50f5, 0x1063, + 0x50f9, 0x1062, + 0x50fb, 0x0e18, + 0x5100, 0x0651, + 0x5101, 0x1065, + 0x5104, 0x052f, + 0x5109, 0x1064, + 0x5112, 0x0920, + 0x5114, 0x1069, + 0x5115, 0x1068, + 0x5116, 0x1067, + 0x5118, 0x102f, + 0x511a, 0x106a, + 0x511f, 0x0988, + 0x5121, 0x106b, + 0x512a, 0x0f0f, + 0x5132, 0x0ee5, + 0x5137, 0x106d, + 0x513a, 0x106c, + 0x513b, 0x106f, + 0x513c, 0x106e, + 0x513f, 0x1070, + 0x5141, 0x04b8, + 0x5143, 0x0769, + 0x5144, 0x0711, + 0x5145, 0x0946, + 0x5146, 0x0bb9, + 0x5147, 0x069c, + 0x5148, 0x0a8c, + 0x5149, 0x07ab, + 0x514a, 0x20c9, + 0x514b, 0x0800, + 0x514c, 0x1073, + 0x514d, 0x0ed4, + 0x514e, 0x0c40, + 0x5150, 0x08c7, + 0x5152, 0x1072, + 0x5154, 0x1074, + 0x515a, 0x0c58, + 0x515c, 0x05d3, + 0x5162, 0x1075, + 0x5164, 0x20ca, + 0x5165, 0x0cd6, + 0x5168, 0x0ab6, + 0x5169, 0x1077, + 0x516b, 0x0d40, + 0x516c, 0x07ac, + 0x516d, 0x0fe1, + 0x516e, 0x1079, + 0x5171, 0x069e, + 0x5175, 0x0e0c, + 0x5176, 0x0b16, + 0x5177, 0x06e9, + 0x5178, 0x0c2f, + 0x517c, 0x0749, + 0x5180, 0x107a, + 0x5182, 0x107b, + 0x5185, 0x0cba, + 0x5186, 0x0501, + 0x5189, 0x107e, + 0x518a, 0x086d, + 0x518c, 0x107d, + 0x518d, 0x0836, + 0x518f, 0x107f, + 0x5190, 0x185b, + 0x5191, 0x1080, + 0x5192, 0x0e6f, + 0x5193, 0x1081, + 0x5195, 0x1082, + 0x5197, 0x09d1, + 0x5199, 0x08f8, + 0x519d, 0x20cb, + 0x51a0, 0x05e3, + 0x51a2, 0x1086, + 0x51a4, 0x1084, + 0x51a5, 0x0ec9, + 0x51a6, 0x1085, + 0x51a8, 0x0dcc, + 0x51a9, 0x1087, + 0x51ac, 0x0c59, + 0x51b0, 0x108d, + 0x51b1, 0x108b, + 0x51b3, 0x108a, + 0x51b4, 0x0853, + 0x51b5, 0x108e, + 0x51b6, 0x0ef6, + 0x51b7, 0x0fac, + 0x51bd, 0x108f, + 0x51be, 0x20cc, + 0x51c4, 0x0a4c, + 0x51c5, 0x1090, + 0x51c6, 0x0964, + 0x51c9, 0x1091, + 0x51cb, 0x0bba, + 0x51cc, 0x0f87, + 0x51cd, 0x0c5a, + 0x51d6, 0x10da, + 0x51db, 0x1092, + 0x51dc, 0x205c, + 0x51dd, 0x06bd, + 0x51e0, 0x1093, + 0x51e1, 0x0e8c, + 0x51e6, 0x0972, + 0x51e7, 0x0b5c, + 0x51e9, 0x1095, + 0x51ea, 0x0cbc, + 0x51ec, 0x20cd, + 0x51ed, 0x1096, + 0x51f0, 0x1097, + 0x51f1, 0x058c, + 0x51f5, 0x1098, + 0x51f6, 0x069f, + 0x51f8, 0x0ca4, + 0x51f9, 0x051c, + 0x51fa, 0x095a, + 0x51fd, 0x0d35, + 0x51fe, 0x1099, + 0x5200, 0x0c5b, + 0x5203, 0x0a15, + 0x5204, 0x109a, + 0x5206, 0x0dfc, + 0x5207, 0x0a7e, + 0x5208, 0x05de, + 0x520a, 0x05e5, + 0x520b, 0x109b, + 0x520e, 0x109d, + 0x5211, 0x0710, + 0x5214, 0x109c, + 0x5215, 0x20ce, + 0x5217, 0x0fbb, + 0x521d, 0x0973, + 0x5224, 0x0d51, + 0x5225, 0x0e1c, + 0x5227, 0x109e, + 0x5229, 0x0f62, + 0x522a, 0x109f, + 0x522e, 0x10a0, + 0x5230, 0x0c78, + 0x5233, 0x10a1, + 0x5236, 0x0a4d, + 0x5237, 0x086e, + 0x5238, 0x074a, + 0x5239, 0x10a2, + 0x523a, 0x0897, + 0x523b, 0x0801, + 0x5243, 0x0c02, + 0x5244, 0x10a4, + 0x5247, 0x0b07, + 0x524a, 0x085f, + 0x524b, 0x10a5, + 0x524d, 0x0ab2, + 0x524f, 0x10a3, + 0x5254, 0x10a8, + 0x5256, 0x0e64, + 0x525b, 0x07f6, + 0x525d, 0x1e5e, + 0x525e, 0x10a7, + 0x5263, 0x074b, + 0x5264, 0x084e, + 0x5265, 0x0d23, + 0x5269, 0x10ab, + 0x526a, 0x10a9, + 0x526f, 0x0ded, + 0x5270, 0x09d2, + 0x5271, 0x10b2, + 0x5272, 0x05c2, + 0x5273, 0x10ac, + 0x5274, 0x10aa, + 0x5275, 0x0ad1, + 0x527d, 0x10ae, + 0x527f, 0x10ad, + 0x5283, 0x05a2, + 0x5287, 0x0736, + 0x5288, 0x10b3, + 0x5289, 0x0f75, + 0x528d, 0x10af, + 0x5291, 0x10b4, + 0x5292, 0x10b1, + 0x5294, 0x10b0, + 0x529b, 0x0f97, + 0x529c, 0x20cf, + 0x529f, 0x07ad, + 0x52a0, 0x0543, + 0x52a3, 0x0fbc, + 0x52a6, 0x20d0, + 0x52a9, 0x097f, + 0x52aa, 0x0c52, + 0x52ab, 0x07f7, + 0x52ac, 0x10b7, + 0x52af, 0x217d, + 0x52b1, 0x0fad, + 0x52b4, 0x0fd1, + 0x52b5, 0x10ba, + 0x52b9, 0x07ae, + 0x52bc, 0x10b9, + 0x52be, 0x058d, + 0x52c0, 0x20d1, + 0x52c1, 0x10bb, + 0x52c3, 0x0e84, + 0x52c5, 0x0bd8, + 0x52c7, 0x0f10, + 0x52c9, 0x0e29, + 0x52cd, 0x10bc, + 0x52d2, 0x1bee, + 0x52d5, 0x0c88, + 0x52d7, 0x10bd, + 0x52d8, 0x05e6, + 0x52d9, 0x0ebf, + 0x52db, 0x20d2, + 0x52dd, 0x0989, + 0x52de, 0x10be, + 0x52df, 0x0e37, + 0x52e0, 0x10c2, + 0x52e2, 0x0a4e, + 0x52e3, 0x10bf, + 0x52e4, 0x06c8, + 0x52e6, 0x10c0, + 0x52e7, 0x05e7, + 0x52f2, 0x0704, + 0x52f3, 0x10c3, + 0x52f5, 0x10c4, + 0x52f8, 0x10c5, + 0x52fa, 0x0907, + 0x52fe, 0x07af, + 0x52ff, 0x0eea, + 0x5300, 0x20d3, + 0x5301, 0x0ef4, + 0x5302, 0x0ccf, + 0x5305, 0x0e41, + 0x5306, 0x10c7, + 0x5307, 0x20d4, + 0x5308, 0x10c8, + 0x530d, 0x10ca, + 0x530f, 0x10cc, + 0x5310, 0x10cb, + 0x5315, 0x10cd, + 0x5316, 0x053d, + 0x5317, 0x0e7a, + 0x5319, 0x086c, + 0x531a, 0x10ce, + 0x531d, 0x0adb, + 0x5320, 0x098a, + 0x5321, 0x06a1, + 0x5323, 0x10cf, + 0x5324, 0x20d5, + 0x532a, 0x0d6f, + 0x532f, 0x10d0, + 0x5331, 0x10d1, + 0x5333, 0x10d2, + 0x5338, 0x10d3, + 0x5339, 0x0d96, + 0x533a, 0x06e0, + 0x533b, 0x04a9, + 0x533f, 0x0c97, + 0x5340, 0x10d4, + 0x5341, 0x0947, + 0x5343, 0x0a8d, + 0x5345, 0x10d6, + 0x5346, 0x10d5, + 0x5347, 0x098b, + 0x5348, 0x0795, + 0x5349, 0x10d8, + 0x534a, 0x0d52, + 0x534d, 0x10d9, + 0x5351, 0x0d70, + 0x5352, 0x0b14, + 0x5353, 0x0b4e, + 0x5354, 0x06a0, + 0x5357, 0x0cc6, + 0x5358, 0x0b6f, + 0x535a, 0x0d24, + 0x535c, 0x0e7c, + 0x535e, 0x10db, + 0x5360, 0x0a8e, + 0x5366, 0x070b, + 0x5369, 0x10dc, + 0x536e, 0x10dd, + 0x536f, 0x04ce, + 0x5370, 0x04b9, + 0x5371, 0x0629, + 0x5372, 0x20d6, + 0x5373, 0x0b08, + 0x5374, 0x066b, + 0x5375, 0x0f5b, + 0x5377, 0x10e0, + 0x5378, 0x0537, + 0x537b, 0x10df, + 0x537f, 0x06a2, + 0x5382, 0x10e1, + 0x5384, 0x0efd, + 0x5393, 0x20d7, + 0x5396, 0x10e2, + 0x5398, 0x0f9a, + 0x539a, 0x07b0, + 0x539f, 0x076a, + 0x53a0, 0x10e3, + 0x53a5, 0x10e5, + 0x53a6, 0x10e4, + 0x53a8, 0x0a25, + 0x53a9, 0x04db, + 0x53ad, 0x0500, + 0x53ae, 0x10e6, + 0x53b0, 0x10e7, + 0x53b2, 0x20d8, + 0x53b3, 0x076b, + 0x53b6, 0x10e8, + 0x53bb, 0x0688, + 0x53c2, 0x0880, + 0x53c3, 0x10e9, + 0x53c8, 0x0ea2, + 0x53c9, 0x0825, + 0x53ca, 0x0674, + 0x53cb, 0x0f11, + 0x53cc, 0x0ad2, + 0x53cd, 0x0d53, + 0x53ce, 0x0929, + 0x53d4, 0x0951, + 0x53d6, 0x0914, + 0x53d7, 0x0921, + 0x53d9, 0x0980, + 0x53db, 0x0d54, + 0x53dd, 0x20d9, + 0x53df, 0x10ec, + 0x53e1, 0x04e5, + 0x53e2, 0x0ad3, + 0x53e3, 0x07b1, + 0x53e4, 0x0779, + 0x53e5, 0x06df, + 0x53e8, 0x10f0, + 0x53e9, 0x0b5f, + 0x53ea, 0x0b5e, + 0x53eb, 0x06a3, + 0x53ec, 0x098c, + 0x53ed, 0x10f1, + 0x53ee, 0x10ef, + 0x53ef, 0x0544, + 0x53f0, 0x0b46, + 0x53f1, 0x08e4, + 0x53f2, 0x0899, + 0x53f3, 0x04c8, + 0x53f6, 0x05ce, + 0x53f7, 0x07f8, + 0x53f8, 0x0898, + 0x53fa, 0x10f2, + 0x5401, 0x10f3, + 0x5403, 0x0663, + 0x5404, 0x05a4, + 0x5408, 0x07f9, + 0x5409, 0x0662, + 0x540a, 0x0bfb, + 0x540b, 0x04c7, + 0x540c, 0x0c89, + 0x540d, 0x0eca, + 0x540e, 0x07b3, + 0x540f, 0x0f63, + 0x5410, 0x0c41, + 0x5411, 0x07b2, + 0x541b, 0x0705, + 0x541d, 0x10fc, + 0x541f, 0x06db, + 0x5420, 0x0e78, + 0x5426, 0x0d71, + 0x5429, 0x10fb, + 0x542b, 0x061a, + 0x542c, 0x10f6, + 0x542e, 0x10f9, + 0x5436, 0x10fa, + 0x5438, 0x0675, + 0x5439, 0x0a27, + 0x543b, 0x0dfd, + 0x543c, 0x10f8, + 0x543d, 0x10f4, + 0x543e, 0x0797, + 0x5440, 0x10f5, + 0x5442, 0x0fca, + 0x5446, 0x0e42, + 0x5448, 0x0c04, + 0x5449, 0x0796, + 0x544a, 0x0802, + 0x544e, 0x10fd, + 0x5451, 0x0cb5, + 0x545f, 0x1101, + 0x5468, 0x092a, + 0x546a, 0x0922, + 0x5470, 0x1104, + 0x5471, 0x1102, + 0x5473, 0x0eaf, + 0x5475, 0x10ff, + 0x5476, 0x1108, + 0x5477, 0x1103, + 0x547b, 0x1106, + 0x547c, 0x077a, + 0x547d, 0x0ecb, + 0x5480, 0x1107, + 0x5484, 0x1109, + 0x5486, 0x110b, + 0x548a, 0x20dc, + 0x548b, 0x0860, + 0x548c, 0x0fe8, + 0x548e, 0x1100, + 0x548f, 0x10fe, + 0x5490, 0x110a, + 0x5492, 0x1105, + 0x549c, 0x20db, + 0x54a2, 0x110d, + 0x54a4, 0x1116, + 0x54a5, 0x110f, + 0x54a8, 0x1113, + 0x54a9, 0x20dd, + 0x54ab, 0x1114, + 0x54ac, 0x1110, + 0x54af, 0x1131, + 0x54b2, 0x0859, + 0x54b3, 0x058f, + 0x54b8, 0x110e, + 0x54bc, 0x1118, + 0x54bd, 0x04ba, + 0x54be, 0x1117, + 0x54c0, 0x0469, + 0x54c1, 0x0dbc, + 0x54c2, 0x1115, + 0x54c4, 0x1111, + 0x54c7, 0x110c, + 0x54c8, 0x1112, + 0x54c9, 0x0838, + 0x54d8, 0x1119, + 0x54e1, 0x04bb, + 0x54e2, 0x1122, + 0x54e5, 0x111a, + 0x54e8, 0x098d, + 0x54e9, 0x0e97, + 0x54ed, 0x1120, + 0x54ee, 0x111f, + 0x54f2, 0x0c29, + 0x54fa, 0x1121, + 0x54fd, 0x111e, + 0x54ff, 0x20de, + 0x5504, 0x04d6, + 0x5506, 0x0826, + 0x5507, 0x09f6, + 0x550f, 0x111c, + 0x5510, 0x0c5c, + 0x5514, 0x111d, + 0x5516, 0x0466, + 0x552e, 0x1127, + 0x552f, 0x0f0d, + 0x5531, 0x098f, + 0x5533, 0x112d, + 0x5538, 0x112c, + 0x5539, 0x1123, + 0x553e, 0x0b23, + 0x5540, 0x1124, + 0x5544, 0x0b4f, + 0x5545, 0x1129, + 0x5546, 0x098e, + 0x554c, 0x1126, + 0x554f, 0x0ef0, + 0x5553, 0x0712, + 0x5556, 0x112a, + 0x555c, 0x1128, + 0x555d, 0x112e, + 0x555e, 0x1dd1, + 0x5563, 0x1125, + 0x557b, 0x1134, + 0x557c, 0x1139, + 0x557e, 0x1135, + 0x5580, 0x1130, + 0x5583, 0x113a, + 0x5584, 0x0ab3, + 0x5586, 0x20df, + 0x5587, 0x113c, + 0x5589, 0x07b4, + 0x558a, 0x1132, + 0x558b, 0x0bbb, + 0x5598, 0x1136, + 0x5599, 0x112f, + 0x559a, 0x05e9, + 0x559c, 0x062a, + 0x559d, 0x05c3, + 0x559e, 0x1137, + 0x559f, 0x1133, + 0x55a7, 0x074c, + 0x55a8, 0x113d, + 0x55a9, 0x113b, + 0x55aa, 0x0ad5, + 0x55ab, 0x0664, + 0x55ac, 0x06a4, + 0x55ae, 0x1138, + 0x55b0, 0x06ec, + 0x55b6, 0x04e6, + 0x55c4, 0x1141, + 0x55c5, 0x113f, + 0x55c7, 0x1178, + 0x55d4, 0x1144, + 0x55da, 0x113e, + 0x55dc, 0x1142, + 0x55df, 0x1140, + 0x55e3, 0x089a, + 0x55e4, 0x1143, + 0x55f7, 0x1146, + 0x55f9, 0x114b, + 0x55fd, 0x1149, + 0x55fe, 0x1148, + 0x5606, 0x0b70, + 0x5609, 0x0545, + 0x5614, 0x1145, + 0x5616, 0x1147, + 0x5617, 0x0990, + 0x5618, 0x04d5, + 0x561b, 0x114a, + 0x5629, 0x055e, + 0x562f, 0x1155, + 0x5631, 0x09e4, + 0x5632, 0x1151, + 0x5634, 0x114f, + 0x5636, 0x1150, + 0x5638, 0x1152, + 0x5642, 0x04df, + 0x564c, 0x0abb, + 0x564e, 0x114c, + 0x5650, 0x114d, + 0x5653, 0x1f1b, + 0x565b, 0x05d8, + 0x5664, 0x1154, + 0x5668, 0x062b, + 0x566a, 0x1157, + 0x566b, 0x1153, + 0x566c, 0x1156, + 0x5674, 0x0dfe, + 0x5678, 0x0cad, + 0x567a, 0x0d4c, + 0x5680, 0x1159, + 0x5686, 0x1158, + 0x5687, 0x05a3, + 0x568a, 0x115a, + 0x568f, 0x115d, + 0x5694, 0x115c, + 0x5699, 0x1de6, + 0x56a0, 0x115b, + 0x56a2, 0x0cef, + 0x56a5, 0x115e, + 0x56ae, 0x115f, + 0x56b4, 0x1161, + 0x56b6, 0x1160, + 0x56bc, 0x1163, + 0x56c0, 0x1166, + 0x56c1, 0x1164, + 0x56c2, 0x1162, + 0x56c3, 0x1165, + 0x56c8, 0x1167, + 0x56ca, 0x1e5a, + 0x56ce, 0x1168, + 0x56d1, 0x1169, + 0x56d3, 0x116a, + 0x56d7, 0x116b, + 0x56d8, 0x107c, + 0x56da, 0x0928, + 0x56db, 0x089b, + 0x56de, 0x0573, + 0x56e0, 0x04bc, + 0x56e3, 0x0b82, + 0x56ee, 0x116c, + 0x56f0, 0x0814, + 0x56f2, 0x0493, + 0x56f3, 0x0a24, + 0x56f9, 0x116d, + 0x56fa, 0x077b, + 0x56fd, 0x0803, + 0x56ff, 0x116f, + 0x5700, 0x116e, + 0x5703, 0x0e30, + 0x5704, 0x1170, + 0x5708, 0x1172, + 0x5709, 0x1171, + 0x570b, 0x1173, + 0x570d, 0x1174, + 0x570f, 0x074d, + 0x5712, 0x0502, + 0x5713, 0x1175, + 0x5716, 0x1177, + 0x5718, 0x1176, + 0x571c, 0x1179, + 0x571f, 0x0c54, + 0x5726, 0x117a, + 0x5727, 0x0479, + 0x5728, 0x084f, + 0x572d, 0x0713, + 0x5730, 0x0b8d, + 0x5737, 0x117b, + 0x573b, 0x117e, + 0x5740, 0x117f, + 0x5742, 0x0854, + 0x5747, 0x06c9, + 0x574a, 0x0e65, + 0x574e, 0x117d, + 0x574f, 0x1180, + 0x5750, 0x0831, + 0x5751, 0x07b5, + 0x5759, 0x20e0, + 0x5761, 0x1184, + 0x5764, 0x0815, + 0x5765, 0x20e1, + 0x5766, 0x0b71, + 0x5769, 0x1181, + 0x576a, 0x0bf6, + 0x577f, 0x1185, + 0x5782, 0x0a28, + 0x5788, 0x1183, + 0x5789, 0x1186, + 0x578b, 0x0715, + 0x5793, 0x1187, + 0x57a0, 0x1188, + 0x57a2, 0x07b6, + 0x57a3, 0x059e, + 0x57a4, 0x118a, + 0x57aa, 0x118b, + 0x57ac, 0x20e2, + 0x57b0, 0x118c, + 0x57b3, 0x1189, + 0x57c0, 0x1182, + 0x57c3, 0x118d, + 0x57c6, 0x118e, + 0x57c7, 0x20e4, + 0x57c8, 0x20e3, + 0x57cb, 0x0e92, + 0x57ce, 0x09d3, + 0x57d2, 0x1190, + 0x57d4, 0x118f, + 0x57d6, 0x1193, + 0x57dc, 0x0cee, + 0x57df, 0x04ac, + 0x57e0, 0x0dc8, + 0x57e3, 0x1194, + 0x57f4, 0x09e5, + 0x57f7, 0x08e5, + 0x57f9, 0x0d13, + 0x57fa, 0x062c, + 0x57fc, 0x085b, + 0x5800, 0x0e87, + 0x5802, 0x0c8a, + 0x5805, 0x074e, + 0x5806, 0x0b2f, + 0x580a, 0x1192, + 0x580b, 0x1195, + 0x5815, 0x0b24, + 0x5819, 0x1196, + 0x581d, 0x1197, + 0x5821, 0x1199, + 0x5824, 0x0c05, + 0x582a, 0x05ea, + 0x582f, 0x1d32, + 0x5830, 0x0503, + 0x5831, 0x0e43, + 0x5834, 0x09d4, + 0x5835, 0x0c42, + 0x583a, 0x0856, + 0x583d, 0x119f, + 0x5840, 0x0e0d, + 0x5841, 0x0fa5, + 0x584a, 0x0574, + 0x584b, 0x119b, + 0x5851, 0x0abc, + 0x5852, 0x119e, + 0x5854, 0x0c5d, + 0x5857, 0x0c43, + 0x5858, 0x0c5e, + 0x5859, 0x0d4d, + 0x585a, 0x0be9, + 0x585e, 0x0839, + 0x5861, 0x1e47, + 0x5862, 0x119a, + 0x5869, 0x0518, + 0x586b, 0x0c30, + 0x5870, 0x119c, + 0x5872, 0x1198, + 0x5875, 0x0a16, + 0x5879, 0x11a0, + 0x587e, 0x0958, + 0x5883, 0x06a5, + 0x5885, 0x11a1, + 0x5893, 0x0e38, + 0x5897, 0x0aff, + 0x589c, 0x0be2, + 0x589e, 0x20e7, + 0x589f, 0x11a3, + 0x58a8, 0x0e7d, + 0x58ab, 0x11a4, + 0x58ae, 0x11a9, + 0x58b2, 0x20e8, + 0x58b3, 0x0dff, + 0x58b8, 0x11a8, + 0x58b9, 0x11a2, + 0x58ba, 0x11a5, + 0x58bb, 0x11a7, + 0x58be, 0x0816, + 0x58c1, 0x0e19, + 0x58c5, 0x11aa, + 0x58c7, 0x0b83, + 0x58ca, 0x0575, + 0x58cc, 0x09d5, + 0x58d1, 0x11ac, + 0x58d3, 0x11ab, + 0x58d5, 0x07fa, + 0x58d7, 0x11ad, + 0x58d8, 0x11af, + 0x58d9, 0x11ae, + 0x58dc, 0x11b1, + 0x58de, 0x11a6, + 0x58df, 0x11b3, + 0x58e4, 0x11b2, + 0x58e5, 0x11b0, + 0x58eb, 0x089c, + 0x58ec, 0x0a17, + 0x58ee, 0x0ad6, + 0x58ef, 0x11b4, + 0x58f0, 0x0a60, + 0x58f1, 0x04b1, + 0x58f2, 0x0d1a, + 0x58f7, 0x0bf7, + 0x58f9, 0x11b6, + 0x58fa, 0x11b5, + 0x58fb, 0x11b7, + 0x5902, 0x11ba, + 0x5909, 0x0e21, + 0x590a, 0x11bb, + 0x590b, 0x20e9, + 0x590f, 0x0546, + 0x5910, 0x11bc, + 0x5915, 0x0f26, + 0x5916, 0x058e, + 0x5918, 0x10de, + 0x5919, 0x0952, + 0x591a, 0x0b1f, + 0x591b, 0x11bd, + 0x591c, 0x0ef7, + 0x5922, 0x0ec0, + 0x5925, 0x11bf, + 0x5927, 0x0b47, + 0x5929, 0x0c31, + 0x592a, 0x0b20, + 0x592b, 0x0dc9, + 0x592c, 0x11c0, + 0x592e, 0x051d, + 0x5931, 0x08e6, + 0x5932, 0x11c2, + 0x5937, 0x0494, + 0x5938, 0x11c3, + 0x593e, 0x11c4, + 0x5944, 0x0504, + 0x5947, 0x062d, + 0x5948, 0x0cb8, + 0x5949, 0x0e44, + 0x594e, 0x11c8, + 0x594f, 0x0ad7, + 0x5950, 0x11c7, + 0x5951, 0x0716, + 0x5953, 0x20ea, + 0x5954, 0x0e89, + 0x5955, 0x11c6, + 0x5957, 0x0c5f, + 0x5958, 0x11ca, + 0x595a, 0x11c9, + 0x595b, 0x20eb, + 0x595d, 0x20ec, + 0x5960, 0x11cc, + 0x5962, 0x11cb, + 0x5963, 0x20ed, + 0x5965, 0x051e, + 0x5967, 0x11cd, + 0x5968, 0x0991, + 0x5969, 0x11cf, + 0x596a, 0x0b63, + 0x596c, 0x11ce, + 0x596e, 0x0e03, + 0x5973, 0x0981, + 0x5974, 0x0c55, + 0x5978, 0x11d0, + 0x597d, 0x07b7, + 0x5981, 0x11d1, + 0x5982, 0x0cd7, + 0x5983, 0x0d72, + 0x5984, 0x0edd, + 0x598a, 0x0cdb, + 0x598d, 0x11da, + 0x5993, 0x0652, + 0x5996, 0x0f2f, + 0x5999, 0x0ebb, + 0x599b, 0x1239, + 0x599d, 0x11d2, + 0x59a3, 0x11d5, + 0x59a4, 0x20ee, + 0x59a5, 0x0b25, + 0x59a8, 0x0e66, + 0x59ac, 0x0c44, + 0x59b2, 0x11d6, + 0x59b9, 0x0e93, + 0x59ba, 0x20ef, + 0x59bb, 0x083a, + 0x59be, 0x0992, + 0x59c6, 0x11d7, + 0x59c9, 0x089e, + 0x59cb, 0x089d, + 0x59d0, 0x047d, + 0x59d1, 0x077c, + 0x59d3, 0x0a4f, + 0x59d4, 0x0495, + 0x59d9, 0x11db, + 0x59dc, 0x11d9, + 0x59e5, 0x04da, + 0x59e6, 0x05eb, + 0x59e8, 0x11d8, + 0x59ea, 0x0ed1, + 0x59eb, 0x0da3, + 0x59f6, 0x046c, + 0x59fb, 0x04bd, + 0x59ff, 0x089f, + 0x5a01, 0x0496, + 0x5a03, 0x0467, + 0x5a09, 0x11e1, + 0x5a11, 0x11df, + 0x5a18, 0x0ec8, + 0x5a1a, 0x11e2, + 0x5a1c, 0x11e0, + 0x5a1f, 0x11de, + 0x5a20, 0x09f7, + 0x5a25, 0x11dd, + 0x5a29, 0x0e2a, + 0x5a2f, 0x0798, + 0x5a35, 0x11e6, + 0x5a3c, 0x0993, + 0x5a40, 0x11e3, + 0x5a41, 0x0fd2, + 0x5a46, 0x0d02, + 0x5a49, 0x11e5, + 0x5a5a, 0x0817, + 0x5a62, 0x11e8, + 0x5a66, 0x0dca, + 0x5a6a, 0x11e9, + 0x5a6c, 0x11e4, + 0x5a7f, 0x0ec7, + 0x5a92, 0x0d14, + 0x5a9a, 0x11ea, + 0x5a9b, 0x0da4, + 0x5abc, 0x11eb, + 0x5abd, 0x11ef, + 0x5abe, 0x11ec, + 0x5ac1, 0x0547, + 0x5ac2, 0x11ee, + 0x5ac9, 0x08e7, + 0x5acb, 0x11ed, + 0x5acc, 0x074f, + 0x5ad0, 0x11fb, + 0x5ad6, 0x11f4, + 0x5ad7, 0x11f1, + 0x5ae1, 0x0ba2, + 0x5ae3, 0x11f0, + 0x5ae6, 0x11f2, + 0x5ae9, 0x11f3, + 0x5afa, 0x11f5, + 0x5b09, 0x062e, + 0x5b0b, 0x11f8, + 0x5b0c, 0x11f7, + 0x5b16, 0x11f9, + 0x5b22, 0x09d6, + 0x5b2a, 0x11fc, + 0x5b2c, 0x0bf8, + 0x5b30, 0x04e7, + 0x5b32, 0x11fa, + 0x5b36, 0x11fd, + 0x5b3e, 0x11fe, + 0x5b40, 0x1201, + 0x5b43, 0x11ff, + 0x5b45, 0x1200, + 0x5b50, 0x08a0, + 0x5b51, 0x1202, + 0x5b54, 0x07b8, + 0x5b55, 0x1203, + 0x5b56, 0x20f0, + 0x5b57, 0x08c8, + 0x5b58, 0x0b18, + 0x5b5a, 0x1204, + 0x5b5c, 0x08a8, + 0x5b5d, 0x07b9, + 0x5b5f, 0x0ede, + 0x5b63, 0x0642, + 0x5b64, 0x077d, + 0x5b65, 0x1206, + 0x5b66, 0x05b6, + 0x5b69, 0x1207, + 0x5b6b, 0x0b19, + 0x5b70, 0x1208, + 0x5b71, 0x1230, + 0x5b73, 0x1209, + 0x5b75, 0x120a, + 0x5b78, 0x120b, + 0x5b7a, 0x120d, + 0x5b80, 0x120e, + 0x5b83, 0x120f, + 0x5b85, 0x0b50, + 0x5b87, 0x04c9, + 0x5b88, 0x0915, + 0x5b89, 0x0486, + 0x5b8b, 0x0ad9, + 0x5b8c, 0x05ec, + 0x5b8d, 0x08e1, + 0x5b8f, 0x07ba, + 0x5b95, 0x0c60, + 0x5b97, 0x092b, + 0x5b98, 0x05ed, + 0x5b99, 0x0ba6, + 0x5b9a, 0x0c06, + 0x5b9b, 0x047c, + 0x5b9c, 0x0653, + 0x5b9d, 0x0e45, + 0x5b9f, 0x08ee, + 0x5ba2, 0x066c, + 0x5ba3, 0x0a8f, + 0x5ba4, 0x08e8, + 0x5ba5, 0x0f12, + 0x5ba6, 0x1210, + 0x5bae, 0x0676, + 0x5bb0, 0x083b, + 0x5bb3, 0x0590, + 0x5bb4, 0x0505, + 0x5bb5, 0x0994, + 0x5bb6, 0x0548, + 0x5bb8, 0x1211, + 0x5bb9, 0x0f30, + 0x5bbf, 0x0953, + 0x5bc0, 0x20f1, + 0x5bc2, 0x0910, + 0x5bc3, 0x1212, + 0x5bc4, 0x062f, + 0x5bc5, 0x0caa, + 0x5bc6, 0x0eb5, + 0x5bc7, 0x1213, + 0x5bc9, 0x1214, + 0x5bcc, 0x0dcb, + 0x5bd0, 0x1216, + 0x5bd2, 0x05e4, + 0x5bd3, 0x06ef, + 0x5bd4, 0x1215, + 0x5bd8, 0x20f3, + 0x5bdb, 0x05ee, + 0x5bdd, 0x09f8, + 0x5bde, 0x121a, + 0x5bdf, 0x086f, + 0x5be1, 0x0549, + 0x5be2, 0x1219, + 0x5be4, 0x1217, + 0x5be5, 0x121b, + 0x5be6, 0x1218, + 0x5be7, 0x0ce1, + 0x5be8, 0x148e, + 0x5be9, 0x09f9, + 0x5beb, 0x121c, + 0x5bec, 0x20f4, + 0x5bee, 0x0f88, + 0x5bf0, 0x121d, + 0x5bf3, 0x121f, + 0x5bf5, 0x0bbc, + 0x5bf6, 0x121e, + 0x5bf8, 0x0a47, + 0x5bfa, 0x08c9, + 0x5bfe, 0x0b30, + 0x5bff, 0x0923, + 0x5c01, 0x0de7, + 0x5c02, 0x0a90, + 0x5c04, 0x08f9, + 0x5c05, 0x1220, + 0x5c06, 0x0995, + 0x5c07, 0x1221, + 0x5c09, 0x0497, + 0x5c0a, 0x0b1a, + 0x5c0b, 0x0a18, + 0x5c0d, 0x1223, + 0x5c0e, 0x0c8b, + 0x5c0f, 0x0996, + 0x5c11, 0x0997, + 0x5c13, 0x1224, + 0x5c16, 0x0a91, + 0x5c1a, 0x0998, + 0x5c1e, 0x20f5, + 0x5c20, 0x1225, + 0x5c22, 0x1226, + 0x5c24, 0x0eec, + 0x5c28, 0x1227, + 0x5c2d, 0x06be, + 0x5c31, 0x092c, + 0x5c38, 0x1228, + 0x5c3a, 0x0908, + 0x5c3b, 0x09f2, + 0x5c3c, 0x0ccc, + 0x5c3d, 0x0a1a, + 0x5c3e, 0x0d8c, + 0x5c3f, 0x0cd8, + 0x5c40, 0x06c1, + 0x5c41, 0x122a, + 0x5c45, 0x0689, + 0x5c46, 0x122b, + 0x5c48, 0x06f6, + 0x5c4a, 0x0ca7, + 0x5c4b, 0x0530, + 0x5c4d, 0x08a1, + 0x5c4e, 0x122c, + 0x5c4f, 0x122f, + 0x5c50, 0x122e, + 0x5c51, 0x06f5, + 0x5c53, 0x122d, + 0x5c55, 0x0c32, + 0x5c5b, 0x1e92, + 0x5c5e, 0x0b10, + 0x5c60, 0x0c45, + 0x5c61, 0x08f4, + 0x5c62, 0x1e0d, + 0x5c64, 0x0ada, + 0x5c65, 0x0f64, + 0x5c6c, 0x1231, + 0x5c6e, 0x1232, + 0x5c6f, 0x0cae, + 0x5c71, 0x0881, + 0x5c76, 0x1234, + 0x5c79, 0x1235, + 0x5c8c, 0x1236, + 0x5c90, 0x0630, + 0x5c91, 0x1237, + 0x5c94, 0x1238, + 0x5ca1, 0x052c, + 0x5ca6, 0x20f6, + 0x5ca8, 0x0abd, + 0x5ca9, 0x0620, + 0x5cab, 0x123a, + 0x5cac, 0x0eb4, + 0x5cb1, 0x0b32, + 0x5cb3, 0x05b7, + 0x5cb6, 0x123c, + 0x5cb7, 0x123e, + 0x5cb8, 0x061b, + 0x5cba, 0x20f7, + 0x5cbb, 0x123b, + 0x5cbc, 0x123d, + 0x5cbe, 0x1240, + 0x5cc5, 0x123f, + 0x5cc7, 0x1241, + 0x5cd9, 0x1242, + 0x5ce0, 0x0c95, + 0x5ce1, 0x06a6, + 0x5ce8, 0x0565, + 0x5ce9, 0x1243, + 0x5cea, 0x1248, + 0x5ced, 0x1246, + 0x5cef, 0x0e47, + 0x5cf0, 0x0e46, + 0x5cf5, 0x20f8, + 0x5cf6, 0x0c61, + 0x5cfa, 0x1245, + 0x5cfb, 0x095e, + 0x5cfd, 0x1244, + 0x5d07, 0x0a38, + 0x5d0b, 0x1249, + 0x5d0e, 0x085a, + 0x5d11, 0x124f, + 0x5d14, 0x1250, + 0x5d15, 0x124a, + 0x5d16, 0x0591, + 0x5d17, 0x124b, + 0x5d18, 0x1254, + 0x5d19, 0x1253, + 0x5d1a, 0x1252, + 0x5d1b, 0x124e, + 0x5d1f, 0x124d, + 0x5d22, 0x1251, + 0x5d27, 0x20f9, + 0x5d29, 0x0e48, + 0x5d42, 0x20fc, + 0x5d4b, 0x1258, + 0x5d4c, 0x1255, + 0x5d4e, 0x1257, + 0x5d50, 0x0f5c, + 0x5d52, 0x1256, + 0x5d53, 0x20fa, + 0x5d5c, 0x124c, + 0x5d69, 0x0a39, + 0x5d6c, 0x1259, + 0x5d6d, 0x20fd, + 0x5d6f, 0x0827, + 0x5d73, 0x125a, + 0x5d76, 0x125b, + 0x5d82, 0x125e, + 0x5d84, 0x125d, + 0x5d87, 0x125c, + 0x5d8b, 0x0c62, + 0x5d8c, 0x1247, + 0x5d90, 0x1264, + 0x5d9d, 0x1260, + 0x5da2, 0x125f, + 0x5dac, 0x1261, + 0x5dae, 0x1262, + 0x5db7, 0x1265, + 0x5db8, 0x20fe, + 0x5dba, 0x0fae, + 0x5dbc, 0x1266, + 0x5dbd, 0x1263, + 0x5dc9, 0x1267, + 0x5dcc, 0x061c, + 0x5dcd, 0x1268, + 0x5dd0, 0x2100, + 0x5dd2, 0x126a, + 0x5dd3, 0x1269, + 0x5dd6, 0x126b, + 0x5ddb, 0x126c, + 0x5ddd, 0x0a92, + 0x5dde, 0x092d, + 0x5de1, 0x096e, + 0x5de3, 0x0ae5, + 0x5de5, 0x07bb, + 0x5de6, 0x0828, + 0x5de7, 0x07bc, + 0x5de8, 0x068a, + 0x5deb, 0x126d, + 0x5dee, 0x0829, + 0x5df1, 0x077e, + 0x5df2, 0x126e, + 0x5df3, 0x0eb2, + 0x5df4, 0x0cf9, + 0x5df5, 0x126f, + 0x5df7, 0x07bd, + 0x5dfb, 0x05e8, + 0x5dfd, 0x0b65, + 0x5dfe, 0x06ca, + 0x5e02, 0x08a2, + 0x5e03, 0x0dcd, + 0x5e06, 0x0d55, + 0x5e0b, 0x1270, + 0x5e0c, 0x0631, + 0x5e11, 0x1273, + 0x5e16, 0x0bbd, + 0x5e19, 0x1272, + 0x5e1a, 0x1271, + 0x5e1b, 0x1274, + 0x5e1d, 0x0c07, + 0x5e25, 0x0a29, + 0x5e2b, 0x08a3, + 0x5e2d, 0x0a6e, + 0x5e2f, 0x0b33, + 0x5e30, 0x063c, + 0x5e33, 0x0bbe, + 0x5e36, 0x1275, + 0x5e38, 0x09d7, + 0x5e3d, 0x0e67, + 0x5e40, 0x1279, + 0x5e43, 0x1278, + 0x5e44, 0x1277, + 0x5e45, 0x0def, + 0x5e47, 0x1280, + 0x5e4c, 0x0e88, + 0x5e4e, 0x127a, + 0x5e54, 0x127c, + 0x5e55, 0x0e99, + 0x5e57, 0x127b, + 0x5e5f, 0x127d, + 0x5e61, 0x0d3c, + 0x5e62, 0x127e, + 0x5e63, 0x0e0e, + 0x5e64, 0x127f, + 0x5e72, 0x05ef, + 0x5e73, 0x0e0f, + 0x5e74, 0x0ce5, + 0x5e75, 0x1281, + 0x5e78, 0x07be, + 0x5e79, 0x05f0, + 0x5e7a, 0x1283, + 0x5e7b, 0x076c, + 0x5e7c, 0x0f2e, + 0x5e7d, 0x0f13, + 0x5e7e, 0x0632, + 0x5e7f, 0x1285, + 0x5e81, 0x0bbf, + 0x5e83, 0x07bf, + 0x5e84, 0x0999, + 0x5e87, 0x0d73, + 0x5e8a, 0x099a, + 0x5e8f, 0x0982, + 0x5e95, 0x0c08, + 0x5e96, 0x0e49, + 0x5e97, 0x0c33, + 0x5e9a, 0x07c0, + 0x5e9c, 0x0dce, + 0x5ea0, 0x1286, + 0x5ea6, 0x0c53, + 0x5ea7, 0x0832, + 0x5eab, 0x077f, + 0x5ead, 0x0c09, + 0x5eb5, 0x0487, + 0x5eb6, 0x0978, + 0x5eb7, 0x07c1, + 0x5eb8, 0x0f31, + 0x5ec1, 0x1287, + 0x5ec3, 0x0d07, + 0x5ec8, 0x1289, + 0x5ec9, 0x0fbf, + 0x5eca, 0x0fd3, + 0x5ecf, 0x128b, + 0x5ed0, 0x128a, + 0x5ed3, 0x05a5, + 0x5ed6, 0x128c, + 0x5eda, 0x128f, + 0x5edd, 0x128e, + 0x5edf, 0x0db2, + 0x5ee0, 0x099b, + 0x5ee1, 0x1292, + 0x5ee2, 0x1291, + 0x5ee3, 0x128d, + 0x5ee8, 0x1293, + 0x5eec, 0x1295, + 0x5ef0, 0x1298, + 0x5ef1, 0x1296, + 0x5ef3, 0x1297, + 0x5ef4, 0x1299, + 0x5ef6, 0x0506, + 0x5ef7, 0x0c0a, + 0x5ef8, 0x129a, + 0x5efa, 0x0750, + 0x5efb, 0x0576, + 0x5efc, 0x0cec, + 0x5efe, 0x129b, + 0x5eff, 0x0cd3, + 0x5f01, 0x0e2b, + 0x5f03, 0x129c, + 0x5f04, 0x0fd4, + 0x5f09, 0x129d, + 0x5f0a, 0x0e10, + 0x5f0b, 0x12a0, + 0x5f0c, 0x0ffa, + 0x5f0d, 0x100a, + 0x5f0f, 0x08dc, + 0x5f10, 0x0ccd, + 0x5f11, 0x12a1, + 0x5f13, 0x0677, + 0x5f14, 0x0bc0, + 0x5f15, 0x04be, + 0x5f16, 0x12a2, + 0x5f17, 0x0df6, + 0x5f18, 0x07c2, + 0x5f1b, 0x0b8e, + 0x5f1f, 0x0c0b, + 0x5f21, 0x2101, + 0x5f25, 0x0efb, + 0x5f26, 0x076d, + 0x5f27, 0x0780, + 0x5f29, 0x12a3, + 0x5f2d, 0x12a4, + 0x5f2f, 0x12aa, + 0x5f31, 0x0911, + 0x5f34, 0x2102, + 0x5f35, 0x0bc1, + 0x5f37, 0x06a7, + 0x5f38, 0x12a5, + 0x5f3c, 0x0d9d, + 0x5f3e, 0x0b84, + 0x5f41, 0x12a6, + 0x5f45, 0x20b2, + 0x5f48, 0x12a7, + 0x5f4a, 0x06a8, + 0x5f4c, 0x12a8, + 0x5f4e, 0x12a9, + 0x5f51, 0x12ab, + 0x5f53, 0x0c70, + 0x5f56, 0x12ac, + 0x5f59, 0x12ae, + 0x5f5c, 0x129f, + 0x5f5d, 0x129e, + 0x5f61, 0x12af, + 0x5f62, 0x0717, + 0x5f66, 0x0d99, + 0x5f67, 0x2103, + 0x5f69, 0x083c, + 0x5f6a, 0x0da9, + 0x5f6b, 0x0bc2, + 0x5f6c, 0x0dbd, + 0x5f6d, 0x12b0, + 0x5f70, 0x099c, + 0x5f71, 0x04e8, + 0x5f73, 0x12b1, + 0x5f77, 0x12b2, + 0x5f79, 0x0efe, + 0x5f7c, 0x0d74, + 0x5f7f, 0x12b5, + 0x5f80, 0x051f, + 0x5f81, 0x0a50, + 0x5f82, 0x12b4, + 0x5f83, 0x12b3, + 0x5f84, 0x0718, + 0x5f85, 0x0b34, + 0x5f87, 0x12b9, + 0x5f88, 0x12b7, + 0x5f8a, 0x12b6, + 0x5f8b, 0x0f6f, + 0x5f8c, 0x0799, + 0x5f90, 0x0983, + 0x5f91, 0x12b8, + 0x5f92, 0x0c46, + 0x5f93, 0x0948, + 0x5f97, 0x0c98, + 0x5f98, 0x12bc, + 0x5f99, 0x12bb, + 0x5f9e, 0x12ba, + 0x5fa0, 0x12bd, + 0x5fa1, 0x079a, + 0x5fa8, 0x12be, + 0x5fa9, 0x0dee, + 0x5faa, 0x0965, + 0x5fad, 0x12bf, + 0x5fae, 0x0d8d, + 0x5fb3, 0x0c99, + 0x5fb4, 0x0bc3, + 0x5fb7, 0x2104, + 0x5fb9, 0x0c2a, + 0x5fbc, 0x12c0, + 0x5fbd, 0x0645, + 0x5fc3, 0x09fa, + 0x5fc5, 0x0d9e, + 0x5fcc, 0x0633, + 0x5fcd, 0x0cdc, + 0x5fd6, 0x12c1, + 0x5fd7, 0x08a4, + 0x5fd8, 0x0e68, + 0x5fdc, 0x0520, + 0x5fdd, 0x12c6, + 0x5fde, 0x2105, + 0x5fe0, 0x0ba7, + 0x5fe4, 0x12c3, + 0x5feb, 0x0577, + 0x5ff0, 0x12f6, + 0x5ff1, 0x12c5, + 0x5ff5, 0x0ce6, + 0x5ff8, 0x12c4, + 0x5ffb, 0x12c2, + 0x5ffd, 0x080c, + 0x5fff, 0x12c8, + 0x600e, 0x12ce, + 0x600f, 0x12d4, + 0x6010, 0x12cc, + 0x6012, 0x0c56, + 0x6015, 0x12d1, + 0x6016, 0x0dcf, + 0x6019, 0x12cb, + 0x601b, 0x12d0, + 0x601c, 0x0faf, + 0x601d, 0x08a5, + 0x6020, 0x0b35, + 0x6021, 0x12c9, + 0x6025, 0x0678, + 0x6026, 0x12d3, + 0x6027, 0x0a51, + 0x6028, 0x0507, + 0x6029, 0x12cd, + 0x602a, 0x0578, + 0x602b, 0x12d2, + 0x602f, 0x06a9, + 0x6031, 0x12cf, + 0x603a, 0x12d5, + 0x6041, 0x12d7, + 0x6042, 0x12e1, + 0x6043, 0x12df, + 0x6046, 0x12dc, + 0x604a, 0x12db, + 0x604b, 0x0fc0, + 0x604d, 0x12dd, + 0x6050, 0x06aa, + 0x6052, 0x07c3, + 0x6055, 0x0984, + 0x6059, 0x12e4, + 0x605a, 0x12d6, + 0x605d, 0x2106, + 0x605f, 0x12da, + 0x6060, 0x12ca, + 0x6062, 0x057a, + 0x6063, 0x12de, + 0x6064, 0x12e0, + 0x6065, 0x0b8f, + 0x6068, 0x0818, + 0x6069, 0x0538, + 0x606a, 0x12d8, + 0x606b, 0x12e3, + 0x606c, 0x12e2, + 0x606d, 0x06ab, + 0x606f, 0x0b09, + 0x6070, 0x05c4, + 0x6075, 0x0719, + 0x6077, 0x12d9, + 0x6081, 0x12e5, + 0x6083, 0x12e8, + 0x6084, 0x12ea, + 0x6085, 0x2107, + 0x6089, 0x08e9, + 0x608a, 0x2108, + 0x608b, 0x12f0, + 0x608c, 0x0c0c, + 0x608d, 0x12e6, + 0x6092, 0x12ee, + 0x6094, 0x0579, + 0x6096, 0x12ec, + 0x609a, 0x12e9, + 0x609b, 0x12eb, + 0x609f, 0x079b, + 0x60a0, 0x0f14, + 0x60a3, 0x05f1, + 0x60a6, 0x04fb, + 0x60a7, 0x12ef, + 0x60a9, 0x0cf0, + 0x60aa, 0x0471, + 0x60b2, 0x0d75, + 0x60b3, 0x12c7, + 0x60b4, 0x12f5, + 0x60b5, 0x12f9, + 0x60b6, 0x0ef1, + 0x60b8, 0x12f2, + 0x60bc, 0x0c63, + 0x60bd, 0x12f7, + 0x60c5, 0x09d8, + 0x60c6, 0x12f8, + 0x60c7, 0x0caf, + 0x60d1, 0x0fed, + 0x60d3, 0x12f4, + 0x60d5, 0x210a, + 0x60d8, 0x12fa, + 0x60da, 0x080d, + 0x60dc, 0x0a6f, + 0x60de, 0x2109, + 0x60df, 0x0498, + 0x60e0, 0x12f3, + 0x60e1, 0x12f1, + 0x60e3, 0x0adc, + 0x60e7, 0x12e7, + 0x60e8, 0x0882, + 0x60f0, 0x0b26, + 0x60f1, 0x1306, + 0x60f2, 0x210c, + 0x60f3, 0x0add, + 0x60f4, 0x1301, + 0x60f6, 0x12fe, + 0x60f9, 0x0912, + 0x60fa, 0x1302, + 0x60fb, 0x1305, + 0x6100, 0x1300, + 0x6101, 0x092f, + 0x6103, 0x1303, + 0x6106, 0x12fd, + 0x6108, 0x0f08, + 0x6109, 0x0f07, + 0x610d, 0x1307, + 0x610f, 0x0499, + 0x6111, 0x210d, + 0x6115, 0x12fc, + 0x611a, 0x06ea, + 0x611b, 0x046a, + 0x611f, 0x05f2, + 0x6120, 0x210b, + 0x6121, 0x1304, + 0x6127, 0x130c, + 0x6128, 0x130b, + 0x612c, 0x1310, + 0x6130, 0x210f, + 0x6134, 0x1311, + 0x6137, 0x210e, + 0x613c, 0x130f, + 0x613d, 0x1312, + 0x613e, 0x130a, + 0x613f, 0x130e, + 0x6142, 0x1313, + 0x6144, 0x1314, + 0x6147, 0x1309, + 0x6148, 0x08ca, + 0x614a, 0x130d, + 0x614b, 0x0b36, + 0x614c, 0x07c4, + 0x614d, 0x12fb, + 0x614e, 0x09fb, + 0x6153, 0x1321, + 0x6155, 0x0e39, + 0x6158, 0x1317, + 0x615d, 0x1320, + 0x615f, 0x131f, + 0x6162, 0x0eab, + 0x6163, 0x05f3, + 0x6165, 0x131d, + 0x6167, 0x071b, + 0x6168, 0x0592, + 0x616b, 0x131a, + 0x616e, 0x0f80, + 0x616f, 0x131c, + 0x6170, 0x049a, + 0x6171, 0x131e, + 0x6173, 0x1315, + 0x6174, 0x131b, + 0x6175, 0x1322, + 0x6176, 0x071a, + 0x6177, 0x1316, + 0x617e, 0x0f47, + 0x6182, 0x0f15, + 0x6187, 0x1325, + 0x618a, 0x1329, + 0x618e, 0x0b00, + 0x6190, 0x0fc1, + 0x6191, 0x132a, + 0x6194, 0x1327, + 0x6196, 0x1324, + 0x6198, 0x2110, + 0x6199, 0x1323, + 0x619a, 0x1328, + 0x61a4, 0x0e00, + 0x61a7, 0x0c8c, + 0x61a9, 0x071c, + 0x61ab, 0x132b, + 0x61ac, 0x1326, + 0x61ae, 0x132c, + 0x61b2, 0x0751, + 0x61b6, 0x0531, + 0x61ba, 0x1334, + 0x61be, 0x05f4, + 0x61c3, 0x1332, + 0x61c6, 0x1333, + 0x61c7, 0x0819, + 0x61c8, 0x1331, + 0x61c9, 0x132f, + 0x61ca, 0x132e, + 0x61cb, 0x1335, + 0x61cc, 0x132d, + 0x61cd, 0x1337, + 0x61d0, 0x057b, + 0x61e3, 0x1339, + 0x61e6, 0x1338, + 0x61f2, 0x0bc4, + 0x61f4, 0x133c, + 0x61f6, 0x133a, + 0x61f7, 0x1330, + 0x61f8, 0x0752, + 0x61fa, 0x133b, + 0x61fc, 0x133f, + 0x61fd, 0x133e, + 0x61fe, 0x1340, + 0x61ff, 0x133d, + 0x6200, 0x1341, + 0x6208, 0x1342, + 0x620a, 0x0e3a, + 0x620c, 0x1345, + 0x620d, 0x1344, + 0x620e, 0x0949, + 0x6210, 0x0a52, + 0x6211, 0x0566, + 0x6212, 0x057c, + 0x6213, 0x2111, + 0x6214, 0x1346, + 0x6216, 0x0483, + 0x621a, 0x0a70, + 0x621b, 0x1347, + 0x621d, 0x1a64, + 0x621e, 0x1348, + 0x621f, 0x0737, + 0x6221, 0x1349, + 0x6226, 0x0a93, + 0x622a, 0x134a, + 0x622e, 0x134b, + 0x622f, 0x0654, + 0x6230, 0x134c, + 0x6232, 0x134d, + 0x6234, 0x0b37, + 0x6238, 0x0781, + 0x623b, 0x0eed, + 0x623f, 0x0e6a, + 0x6240, 0x0974, + 0x6241, 0x134f, + 0x6247, 0x0a94, + 0x6248, 0x1b1a, + 0x6249, 0x0d76, + 0x624b, 0x0916, + 0x624d, 0x083d, + 0x624e, 0x1350, + 0x6253, 0x0b27, + 0x6255, 0x0df7, + 0x6258, 0x0b51, + 0x625b, 0x1353, + 0x625e, 0x1351, + 0x6260, 0x1354, + 0x6263, 0x1352, + 0x6268, 0x1355, + 0x626e, 0x0e01, + 0x6271, 0x047b, + 0x6276, 0x0dd0, + 0x6279, 0x0d77, + 0x627c, 0x1356, + 0x627e, 0x1359, + 0x627f, 0x099d, + 0x6280, 0x0655, + 0x6282, 0x1357, + 0x6283, 0x135e, + 0x6284, 0x099e, + 0x6289, 0x1358, + 0x628a, 0x0cfa, + 0x6291, 0x0f48, + 0x6292, 0x135a, + 0x6294, 0x135f, + 0x6295, 0x0c64, + 0x6296, 0x135c, + 0x6297, 0x07c5, + 0x6298, 0x0a82, + 0x629b, 0x136d, + 0x629c, 0x0d48, + 0x629e, 0x0b52, + 0x62a6, 0x2112, + 0x62ab, 0x0d78, + 0x62ac, 0x13b2, + 0x62b1, 0x0e4a, + 0x62b5, 0x0c0d, + 0x62b9, 0x0ea3, + 0x62bb, 0x1362, + 0x62bc, 0x0521, + 0x62bd, 0x0ba8, + 0x62c2, 0x136b, + 0x62c5, 0x0b72, + 0x62c6, 0x1365, + 0x62c7, 0x136c, + 0x62c8, 0x1367, + 0x62c9, 0x136e, + 0x62ca, 0x136a, + 0x62cc, 0x1369, + 0x62cd, 0x0d25, + 0x62cf, 0x1363, + 0x62d0, 0x057d, + 0x62d1, 0x1361, + 0x62d2, 0x068b, + 0x62d3, 0x0b53, + 0x62d4, 0x135d, + 0x62d7, 0x1360, + 0x62d8, 0x07c6, + 0x62d9, 0x0a7f, + 0x62db, 0x099f, + 0x62dc, 0x1368, + 0x62dd, 0x0d08, + 0x62e0, 0x068c, + 0x62e1, 0x05a6, + 0x62ec, 0x05c5, + 0x62ed, 0x09e7, + 0x62ee, 0x1370, + 0x62ef, 0x1375, + 0x62f1, 0x1371, + 0x62f3, 0x0753, + 0x62f5, 0x1376, + 0x62f6, 0x0870, + 0x62f7, 0x07fb, + 0x62fe, 0x0930, + 0x62ff, 0x1364, + 0x6301, 0x08cb, + 0x6302, 0x1373, + 0x6307, 0x08a6, + 0x6308, 0x1374, + 0x6309, 0x0488, + 0x630c, 0x136f, + 0x6311, 0x0bc5, + 0x6319, 0x068d, + 0x631f, 0x06ac, + 0x6327, 0x1372, + 0x6328, 0x046b, + 0x632b, 0x0833, + 0x632f, 0x09fc, + 0x633a, 0x0c0e, + 0x633d, 0x0d68, + 0x633e, 0x1378, + 0x633f, 0x0ae0, + 0x6349, 0x0b0a, + 0x634c, 0x0879, + 0x634d, 0x1379, + 0x634f, 0x137b, + 0x6350, 0x1377, + 0x6355, 0x0e31, + 0x6357, 0x0bd9, + 0x635c, 0x0ade, + 0x6367, 0x0e4b, + 0x6368, 0x08fa, + 0x6369, 0x1387, + 0x636b, 0x1386, + 0x636e, 0x0a3e, + 0x6372, 0x0754, + 0x6376, 0x1380, + 0x6377, 0x09a1, + 0x637a, 0x0cc0, + 0x637b, 0x0ce7, + 0x6380, 0x137e, + 0x6383, 0x0adf, + 0x6388, 0x0924, + 0x6389, 0x1383, + 0x638c, 0x09a0, + 0x638e, 0x137d, + 0x638f, 0x1382, + 0x6392, 0x0d09, + 0x6396, 0x137c, + 0x6398, 0x06f7, + 0x639b, 0x05bb, + 0x639f, 0x1384, + 0x63a0, 0x0f73, + 0x63a1, 0x083e, + 0x63a2, 0x0b73, + 0x63a3, 0x1381, + 0x63a5, 0x0a80, + 0x63a7, 0x07c7, + 0x63a8, 0x0a2a, + 0x63a9, 0x0508, + 0x63aa, 0x0abe, + 0x63ab, 0x137f, + 0x63ac, 0x065f, + 0x63b2, 0x071d, + 0x63b4, 0x0beb, + 0x63b5, 0x1385, + 0x63bb, 0x0ae1, + 0x63be, 0x1388, + 0x63c0, 0x138a, + 0x63c3, 0x0b17, + 0x63c4, 0x1390, + 0x63c6, 0x138b, + 0x63c9, 0x138d, + 0x63cf, 0x0db3, + 0x63d0, 0x0c0f, + 0x63d2, 0x138e, + 0x63d6, 0x0f16, + 0x63da, 0x0f32, + 0x63db, 0x05f5, + 0x63e1, 0x0472, + 0x63e3, 0x138c, + 0x63e9, 0x1389, + 0x63ee, 0x0634, + 0x63f4, 0x0509, + 0x63f5, 0x2113, + 0x63f6, 0x138f, + 0x63fa, 0x0f33, + 0x6406, 0x1393, + 0x640d, 0x0b1b, + 0x640f, 0x139a, + 0x6413, 0x1394, + 0x6414, 0x1e2c, + 0x6416, 0x1391, + 0x6417, 0x1398, + 0x641c, 0x137a, + 0x6426, 0x1395, + 0x6428, 0x1399, + 0x642c, 0x0d56, + 0x642d, 0x0c65, + 0x6434, 0x1392, + 0x6436, 0x1396, + 0x643a, 0x071e, + 0x643e, 0x0861, + 0x6442, 0x0a81, + 0x644e, 0x139e, + 0x6451, 0x1e43, + 0x6458, 0x0c20, + 0x6460, 0x2114, + 0x6467, 0x139b, + 0x6469, 0x0e8e, + 0x646f, 0x139c, + 0x6476, 0x139d, + 0x6478, 0x0eda, + 0x647a, 0x0a46, + 0x6483, 0x0738, + 0x6488, 0x13a4, + 0x6492, 0x0883, + 0x6493, 0x13a1, + 0x6495, 0x13a0, + 0x649a, 0x0ce8, + 0x649d, 0x2115, + 0x649e, 0x0c8d, + 0x64a4, 0x0c2b, + 0x64a5, 0x13a2, + 0x64a9, 0x13a3, + 0x64ab, 0x0de1, + 0x64ad, 0x0cfb, + 0x64ae, 0x0871, + 0x64b0, 0x0a95, + 0x64b2, 0x0e7e, + 0x64b9, 0x05a7, + 0x64bb, 0x13aa, + 0x64bc, 0x13a5, + 0x64c1, 0x0f34, + 0x64c2, 0x13ac, + 0x64c5, 0x13a8, + 0x64c7, 0x13a9, + 0x64cd, 0x0ae2, + 0x64ce, 0x2116, + 0x64d2, 0x13a7, + 0x64d4, 0x1366, + 0x64d8, 0x13ab, + 0x64da, 0x13a6, + 0x64e0, 0x13b0, + 0x64e2, 0x0c21, + 0x64e3, 0x13b3, + 0x64e6, 0x0872, + 0x64e7, 0x13ae, + 0x64ec, 0x0656, + 0x64ef, 0x13b4, + 0x64f1, 0x13ad, + 0x64f2, 0x13b8, + 0x64f4, 0x13b7, + 0x64f6, 0x13b6, + 0x64fa, 0x13b9, + 0x64fd, 0x13bb, + 0x64fe, 0x09d9, + 0x6500, 0x13ba, + 0x6505, 0x13be, + 0x6518, 0x13bc, + 0x651c, 0x13bd, + 0x651d, 0x1397, + 0x6522, 0x1e97, + 0x6523, 0x13c0, + 0x6524, 0x13bf, + 0x652a, 0x139f, + 0x652b, 0x13c1, + 0x652c, 0x13b5, + 0x652f, 0x08a7, + 0x6534, 0x13c2, + 0x6536, 0x13c5, + 0x6537, 0x13c4, + 0x6538, 0x13c6, + 0x6539, 0x057e, + 0x653b, 0x07c8, + 0x653e, 0x0e4c, + 0x653f, 0x0a53, + 0x6545, 0x0782, + 0x6548, 0x13c8, + 0x654d, 0x13cb, + 0x654e, 0x2117, + 0x654f, 0x0dc4, + 0x6551, 0x0679, + 0x6555, 0x13ca, + 0x6556, 0x13c9, + 0x6557, 0x0d0a, + 0x6558, 0x13cc, + 0x6559, 0x06ad, + 0x655d, 0x13ce, + 0x655e, 0x13cd, + 0x6562, 0x05f6, + 0x6563, 0x0884, + 0x6566, 0x0cb0, + 0x656c, 0x071f, + 0x6570, 0x0a3a, + 0x6572, 0x13cf, + 0x6574, 0x0a54, + 0x6575, 0x0c22, + 0x6577, 0x0dd1, + 0x6578, 0x13d0, + 0x6582, 0x13d1, + 0x6587, 0x0e08, + 0x6588, 0x120c, + 0x6589, 0x0a6a, + 0x658c, 0x0dbe, + 0x658e, 0x0848, + 0x6590, 0x0d79, + 0x6591, 0x0d57, + 0x6597, 0x0c47, + 0x6599, 0x0f89, + 0x659b, 0x13d4, + 0x659c, 0x08fc, + 0x659f, 0x13d5, + 0x65a1, 0x047a, + 0x65a4, 0x06cc, + 0x65a5, 0x0a71, + 0x65a7, 0x0dd2, + 0x65ab, 0x13d6, + 0x65ac, 0x0890, + 0x65ad, 0x0b85, + 0x65af, 0x08a9, + 0x65b0, 0x09fd, + 0x65b7, 0x13d7, + 0x65b9, 0x0e4d, + 0x65bc, 0x0519, + 0x65bd, 0x08aa, + 0x65c1, 0x13da, + 0x65c3, 0x13d8, + 0x65c4, 0x13db, + 0x65c5, 0x0f81, + 0x65c6, 0x13d9, + 0x65cb, 0x0a9f, + 0x65cc, 0x13dc, + 0x65cf, 0x0b12, + 0x65d2, 0x13dd, + 0x65d7, 0x0636, + 0x65d9, 0x13df, + 0x65db, 0x13de, + 0x65e0, 0x13e0, + 0x65e2, 0x0637, + 0x65e5, 0x0cd4, + 0x65e6, 0x0b74, + 0x65e7, 0x0686, + 0x65e8, 0x08ab, + 0x65e9, 0x0ae3, + 0x65ec, 0x0966, + 0x65ed, 0x0474, + 0x65f1, 0x13e2, + 0x65fa, 0x0522, + 0x65fb, 0x13e6, + 0x6600, 0x2118, + 0x6602, 0x07c9, + 0x6603, 0x13e5, + 0x6606, 0x081b, + 0x6607, 0x09a2, + 0x6609, 0x211a, + 0x660a, 0x13e4, + 0x660c, 0x09a3, + 0x660e, 0x0ecc, + 0x660f, 0x081a, + 0x6613, 0x049b, + 0x6614, 0x0a72, + 0x6615, 0x2119, + 0x661c, 0x13eb, + 0x661e, 0x211c, + 0x661f, 0x0a55, + 0x6620, 0x04e9, + 0x6624, 0x211d, + 0x6625, 0x095f, + 0x6627, 0x0e94, + 0x6628, 0x0862, + 0x662d, 0x09a4, + 0x662e, 0x211b, + 0x662f, 0x0a4b, + 0x6631, 0x20ae, + 0x6634, 0x13ea, + 0x6635, 0x13e8, + 0x663b, 0x1e00, + 0x663c, 0x0ba9, + 0x663f, 0x1409, + 0x6641, 0x13ef, + 0x6642, 0x08cc, + 0x6643, 0x07ca, + 0x6644, 0x13ed, + 0x6649, 0x13ee, + 0x664b, 0x09fe, + 0x664f, 0x13ec, + 0x6652, 0x087d, + 0x6657, 0x211f, + 0x6659, 0x2120, + 0x665d, 0x13f1, + 0x665e, 0x13f0, + 0x665f, 0x13f5, + 0x6662, 0x13f6, + 0x6664, 0x13f2, + 0x6665, 0x211e, + 0x6666, 0x0580, + 0x6667, 0x13f3, + 0x6669, 0x0d69, + 0x666e, 0x0dd3, + 0x666f, 0x0720, + 0x6670, 0x13f7, + 0x6673, 0x2122, + 0x6674, 0x0a56, + 0x6676, 0x09a5, + 0x667a, 0x0b90, + 0x6681, 0x06bf, + 0x6683, 0x13f8, + 0x6684, 0x13fc, + 0x6687, 0x054b, + 0x6688, 0x13f9, + 0x6689, 0x13fb, + 0x668e, 0x13fa, + 0x6691, 0x0975, + 0x6696, 0x0b86, + 0x6697, 0x0489, + 0x6698, 0x13fd, + 0x6699, 0x2123, + 0x669d, 0x13fe, + 0x66a0, 0x2124, + 0x66a2, 0x0bc6, + 0x66a6, 0x0fb9, + 0x66ab, 0x0891, + 0x66ae, 0x0e3b, + 0x66b2, 0x2125, + 0x66b4, 0x0e6b, + 0x66b8, 0x1405, + 0x66b9, 0x1400, + 0x66bc, 0x1403, + 0x66be, 0x1402, + 0x66bf, 0x2126, + 0x66c1, 0x13ff, + 0x66c4, 0x1404, + 0x66c7, 0x0cb6, + 0x66c9, 0x1401, + 0x66d6, 0x1406, + 0x66d9, 0x0976, + 0x66da, 0x1407, + 0x66dc, 0x0f35, + 0x66dd, 0x0d2e, + 0x66e0, 0x1408, + 0x66e6, 0x140a, + 0x66e9, 0x140b, + 0x66f0, 0x140c, + 0x66f2, 0x06c2, + 0x66f3, 0x04ea, + 0x66f4, 0x07cb, + 0x66f5, 0x140d, + 0x66f7, 0x140e, + 0x66f8, 0x097b, + 0x66f9, 0x0ae4, + 0x66fa, 0x2127, + 0x66fb, 0x20b1, + 0x66fc, 0x10ed, + 0x66fd, 0x0ac0, + 0x66fe, 0x0abf, + 0x66ff, 0x0b38, + 0x6700, 0x0837, + 0x6703, 0x104b, + 0x6708, 0x0744, + 0x6709, 0x0f17, + 0x670b, 0x0e4e, + 0x670d, 0x0df0, + 0x670e, 0x2128, + 0x670f, 0x140f, + 0x6714, 0x0863, + 0x6715, 0x0bdb, + 0x6716, 0x1410, + 0x6717, 0x0fd5, + 0x671b, 0x0e6c, + 0x671d, 0x0bc7, + 0x671e, 0x1411, + 0x671f, 0x0638, + 0x6726, 0x1412, + 0x6728, 0x0ee6, + 0x672a, 0x0eb0, + 0x672b, 0x0ea4, + 0x672c, 0x0e8a, + 0x672d, 0x0873, + 0x672e, 0x1415, + 0x6731, 0x0917, + 0x6734, 0x0e7f, + 0x6736, 0x1417, + 0x6737, 0x141a, + 0x6738, 0x1419, + 0x673a, 0x0635, + 0x673d, 0x067a, + 0x673f, 0x1416, + 0x6741, 0x1418, + 0x6746, 0x141b, + 0x6749, 0x0a3f, + 0x674e, 0x0f65, + 0x674f, 0x048d, + 0x6750, 0x0850, + 0x6751, 0x0b1c, + 0x6753, 0x0909, + 0x6756, 0x09db, + 0x6759, 0x141e, + 0x675c, 0x0c48, + 0x675e, 0x141c, + 0x675f, 0x0b0b, + 0x6760, 0x141d, + 0x6761, 0x09da, + 0x6762, 0x0ee9, + 0x6763, 0x141f, + 0x6765, 0x0f52, + 0x6766, 0x212a, + 0x676a, 0x1425, + 0x676d, 0x07cc, + 0x676f, 0x0d0b, + 0x6770, 0x1422, + 0x6771, 0x0c66, + 0x6772, 0x13e3, + 0x6773, 0x13e7, + 0x6775, 0x0669, + 0x6777, 0x0cfd, + 0x677c, 0x1424, + 0x677e, 0x09a6, + 0x677f, 0x0d58, + 0x6785, 0x142a, + 0x6787, 0x0d8e, + 0x6789, 0x1421, + 0x678b, 0x1427, + 0x678c, 0x1426, + 0x6790, 0x0a73, + 0x6795, 0x0e9b, + 0x6797, 0x0f9b, + 0x679a, 0x0e95, + 0x679c, 0x054c, + 0x679d, 0x08ac, + 0x67a0, 0x0fee, + 0x67a1, 0x1429, + 0x67a2, 0x0a3b, + 0x67a6, 0x1428, + 0x67a9, 0x1423, + 0x67af, 0x0783, + 0x67b3, 0x142f, + 0x67b4, 0x142d, + 0x67b6, 0x054d, + 0x67b7, 0x142b, + 0x67b8, 0x1431, + 0x67b9, 0x1437, + 0x67bb, 0x212b, + 0x67c0, 0x212d, + 0x67c1, 0x0b28, + 0x67c4, 0x0e11, + 0x67c6, 0x1439, + 0x67ca, 0x0d94, + 0x67ce, 0x1438, + 0x67cf, 0x0d26, + 0x67d0, 0x0e6d, + 0x67d1, 0x05f7, + 0x67d3, 0x0a9b, + 0x67d4, 0x094a, + 0x67d8, 0x0bef, + 0x67da, 0x0f18, + 0x67dd, 0x1434, + 0x67de, 0x1433, + 0x67e2, 0x1435, + 0x67e4, 0x1432, + 0x67e7, 0x143a, + 0x67e9, 0x1430, + 0x67ec, 0x142e, + 0x67ee, 0x1436, + 0x67ef, 0x142c, + 0x67f1, 0x0baa, + 0x67f3, 0x0f04, + 0x67f4, 0x08f2, + 0x67f5, 0x0864, + 0x67fb, 0x082a, + 0x67fe, 0x0e9d, + 0x67ff, 0x059f, + 0x6801, 0x212e, + 0x6802, 0x0bea, + 0x6803, 0x0ca2, + 0x6804, 0x04eb, + 0x6805, 0x1e07, + 0x6813, 0x0a96, + 0x6816, 0x0a58, + 0x6817, 0x0700, + 0x681e, 0x143c, + 0x6821, 0x07cd, + 0x6822, 0x05da, + 0x6829, 0x143e, + 0x682a, 0x05d2, + 0x682b, 0x1444, + 0x6832, 0x1441, + 0x6834, 0x0a97, + 0x6838, 0x05a9, + 0x6839, 0x081c, + 0x683c, 0x05a8, + 0x683d, 0x083f, + 0x6840, 0x143f, + 0x6841, 0x073b, + 0x6842, 0x0721, + 0x6843, 0x0c67, + 0x6844, 0x212f, + 0x6846, 0x143d, + 0x6848, 0x048a, + 0x684d, 0x1440, + 0x684e, 0x1442, + 0x6850, 0x06c5, + 0x6851, 0x0702, + 0x6852, 0x212c, + 0x6853, 0x05f8, + 0x6854, 0x0665, + 0x6859, 0x1445, + 0x685c, 0x0869, + 0x685d, 0x0e9f, + 0x685f, 0x0885, + 0x6863, 0x1446, + 0x6867, 0x0da2, + 0x6874, 0x1452, + 0x6876, 0x0533, + 0x6877, 0x1447, + 0x687e, 0x1458, + 0x687f, 0x1448, + 0x6881, 0x0f8a, + 0x6883, 0x144f, + 0x6885, 0x0d15, + 0x688d, 0x1457, + 0x688e, 0x1e9c, + 0x688f, 0x144a, + 0x6893, 0x0478, + 0x6894, 0x144c, + 0x6897, 0x07ce, + 0x689b, 0x144e, + 0x689d, 0x144d, + 0x689f, 0x1449, + 0x68a0, 0x1454, + 0x68a2, 0x09a7, + 0x68a6, 0x11be, + 0x68a7, 0x079c, + 0x68a8, 0x0f66, + 0x68ad, 0x144b, + 0x68af, 0x0c10, + 0x68b0, 0x0581, + 0x68b1, 0x081d, + 0x68b3, 0x1443, + 0x68b5, 0x1453, + 0x68b6, 0x05bf, + 0x68b9, 0x1451, + 0x68ba, 0x1455, + 0x68bc, 0x0c68, + 0x68c4, 0x063a, + 0x68c6, 0x1473, + 0x68c8, 0x20af, + 0x68c9, 0x0ed5, + 0x68ca, 0x145a, + 0x68cb, 0x0639, + 0x68cd, 0x1461, + 0x68cf, 0x2130, + 0x68d2, 0x0e6e, + 0x68d4, 0x1462, + 0x68d5, 0x1464, + 0x68d7, 0x1468, + 0x68d8, 0x145c, + 0x68da, 0x0b68, + 0x68df, 0x0c69, + 0x68e0, 0x146c, + 0x68e1, 0x145f, + 0x68e3, 0x1469, + 0x68e7, 0x1463, + 0x68ee, 0x09ff, + 0x68ef, 0x146d, + 0x68f2, 0x0a57, + 0x68f9, 0x146b, + 0x68fa, 0x05f9, + 0x6900, 0x0ff6, + 0x6901, 0x1459, + 0x6904, 0x1467, + 0x6905, 0x049c, + 0x6908, 0x145b, + 0x690b, 0x0ec6, + 0x690c, 0x1460, + 0x690d, 0x09e8, + 0x690e, 0x0be3, + 0x690f, 0x1456, + 0x6912, 0x1466, + 0x6919, 0x0a40, + 0x691a, 0x1470, + 0x691b, 0x05cf, + 0x691c, 0x0755, + 0x6921, 0x1472, + 0x6922, 0x145d, + 0x6923, 0x1471, + 0x6925, 0x146a, + 0x6926, 0x145e, + 0x6928, 0x146e, + 0x692a, 0x146f, + 0x6930, 0x1480, + 0x6934, 0x0ca6, + 0x6936, 0x1465, + 0x6939, 0x147c, + 0x693d, 0x147e, + 0x693f, 0x0bf4, + 0x694a, 0x0f36, + 0x6953, 0x0de8, + 0x6954, 0x1479, + 0x6955, 0x0b2a, + 0x6959, 0x147f, + 0x695a, 0x0ac1, + 0x695c, 0x1476, + 0x695d, 0x1483, + 0x695e, 0x1482, + 0x6960, 0x0cc7, + 0x6961, 0x1481, + 0x6962, 0x0cc2, + 0x6968, 0x2132, + 0x696a, 0x1485, + 0x696b, 0x1478, + 0x696d, 0x06c0, + 0x696e, 0x147b, + 0x696f, 0x0967, + 0x6973, 0x0d16, + 0x6974, 0x147d, + 0x6975, 0x06c3, + 0x6977, 0x1475, + 0x6978, 0x1477, + 0x6979, 0x1474, + 0x697c, 0x0fd6, + 0x697d, 0x05b8, + 0x697e, 0x147a, + 0x6981, 0x1484, + 0x6982, 0x0593, + 0x698a, 0x0857, + 0x698e, 0x04ff, + 0x6991, 0x1495, + 0x6994, 0x0fd7, + 0x6995, 0x1498, + 0x6998, 0x2134, + 0x699b, 0x0a00, + 0x699c, 0x1497, + 0x69a0, 0x1496, + 0x69a7, 0x1493, + 0x69ae, 0x1487, + 0x69b1, 0x14a4, + 0x69b2, 0x1486, + 0x69b4, 0x1499, + 0x69bb, 0x1491, + 0x69be, 0x148c, + 0x69bf, 0x1489, + 0x69c1, 0x148a, + 0x69c3, 0x1492, + 0x69c7, 0x1d33, + 0x69ca, 0x148f, + 0x69cb, 0x07cf, + 0x69cc, 0x0be4, + 0x69cd, 0x0ae6, + 0x69ce, 0x148d, + 0x69d0, 0x1488, + 0x69d3, 0x148b, + 0x69d8, 0x0f37, + 0x69d9, 0x0e98, + 0x69dd, 0x1490, + 0x69de, 0x149a, + 0x69e2, 0x2135, + 0x69e7, 0x14a2, + 0x69e8, 0x149b, + 0x69eb, 0x14a8, + 0x69ed, 0x14a6, + 0x69f2, 0x14a1, + 0x69f9, 0x14a0, + 0x69fb, 0x0bec, + 0x69fd, 0x0ae7, + 0x69ff, 0x149e, + 0x6a02, 0x149c, + 0x6a05, 0x14a3, + 0x6a0a, 0x14a9, + 0x6a0b, 0x0d89, + 0x6a0c, 0x14af, + 0x6a12, 0x14aa, + 0x6a13, 0x14ad, + 0x6a14, 0x14a7, + 0x6a17, 0x0bb2, + 0x6a19, 0x0daa, + 0x6a1b, 0x149d, + 0x6a1e, 0x14a5, + 0x6a1f, 0x09a8, + 0x6a21, 0x0edb, + 0x6a22, 0x14b9, + 0x6a23, 0x14ac, + 0x6a29, 0x0756, + 0x6a2a, 0x0523, + 0x6a2b, 0x05bd, + 0x6a2e, 0x1494, + 0x6a30, 0x2136, + 0x6a35, 0x09a9, + 0x6a36, 0x14b1, + 0x6a38, 0x14b8, + 0x6a39, 0x0925, + 0x6a3a, 0x05d0, + 0x6a3d, 0x0b6c, + 0x6a44, 0x14ae, + 0x6a46, 0x2138, + 0x6a47, 0x14b3, + 0x6a48, 0x14b7, + 0x6a4b, 0x06ae, + 0x6a58, 0x0666, + 0x6a59, 0x14b5, + 0x6a5f, 0x063b, + 0x6a61, 0x0ca3, + 0x6a62, 0x14b4, + 0x6a66, 0x14b6, + 0x6a6b, 0x2137, + 0x6a72, 0x14b0, + 0x6a73, 0x2139, + 0x6a78, 0x14b2, + 0x6a7e, 0x213a, + 0x6a7f, 0x05be, + 0x6a80, 0x0b87, + 0x6a84, 0x14bd, + 0x6a8d, 0x14bb, + 0x6a8e, 0x079d, + 0x6a90, 0x14ba, + 0x6a97, 0x14c0, + 0x6a9c, 0x143b, + 0x6aa0, 0x14bc, + 0x6aa2, 0x14be, + 0x6aaa, 0x14cb, + 0x6aac, 0x14c7, + 0x6aae, 0x1450, + 0x6ab3, 0x14c6, + 0x6ab8, 0x14c5, + 0x6abb, 0x14c2, + 0x6ac1, 0x14ab, + 0x6ac2, 0x14c4, + 0x6ac3, 0x14c3, + 0x6ad1, 0x14c9, + 0x6ad3, 0x0fcc, + 0x6ada, 0x14cc, + 0x6adb, 0x06f3, + 0x6ade, 0x14c8, + 0x6adf, 0x14ca, + 0x6ae2, 0x213b, + 0x6ae4, 0x213c, + 0x6ae8, 0x0d3b, + 0x6aea, 0x14cd, + 0x6afa, 0x14d1, + 0x6afb, 0x14ce, + 0x6b04, 0x0f5d, + 0x6b05, 0x14cf, + 0x6b0a, 0x149f, + 0x6b12, 0x14d2, + 0x6b16, 0x14d3, + 0x6b1d, 0x04d7, + 0x6b1f, 0x14d5, + 0x6b20, 0x073d, + 0x6b21, 0x08cd, + 0x6b23, 0x06cd, + 0x6b27, 0x0524, + 0x6b32, 0x0f49, + 0x6b37, 0x14d7, + 0x6b38, 0x14d6, + 0x6b39, 0x14d9, + 0x6b3a, 0x0657, + 0x6b3d, 0x06ce, + 0x6b3e, 0x05fa, + 0x6b43, 0x14dc, + 0x6b47, 0x14db, + 0x6b49, 0x14dd, + 0x6b4c, 0x054e, + 0x6b4e, 0x0b75, + 0x6b50, 0x14de, + 0x6b53, 0x05fb, + 0x6b54, 0x14e0, + 0x6b59, 0x14df, + 0x6b5b, 0x14e1, + 0x6b5f, 0x14e2, + 0x6b61, 0x14e3, + 0x6b62, 0x08ad, + 0x6b63, 0x0a59, + 0x6b64, 0x0811, + 0x6b66, 0x0de2, + 0x6b69, 0x0e32, + 0x6b6a, 0x0fea, + 0x6b6f, 0x08c3, + 0x6b73, 0x0840, + 0x6b74, 0x0fba, + 0x6b78, 0x14e4, + 0x6b7b, 0x08ae, + 0x6b7f, 0x14e6, + 0x6b83, 0x14e9, + 0x6b84, 0x14e8, + 0x6b86, 0x0e86, + 0x6b89, 0x0968, + 0x6b8a, 0x0918, + 0x6b8b, 0x0892, + 0x6b8d, 0x14ea, + 0x6b95, 0x14ec, + 0x6b96, 0x09e9, + 0x6b98, 0x14eb, + 0x6b9e, 0x14ed, + 0x6ba4, 0x14ee, + 0x6baa, 0x14ef, + 0x6baf, 0x14f1, + 0x6bb1, 0x14f3, + 0x6bb2, 0x14f2, + 0x6bb3, 0x14f4, + 0x6bb4, 0x0525, + 0x6bb5, 0x0b88, + 0x6bb7, 0x14f5, + 0x6bba, 0x0874, + 0x6bbb, 0x05aa, + 0x6bbc, 0x14f6, + 0x6bbf, 0x0c3c, + 0x6bc0, 0x119d, + 0x6bc5, 0x063d, + 0x6bc6, 0x14f7, + 0x6bcb, 0x14f8, + 0x6bcd, 0x0e3c, + 0x6bce, 0x0e96, + 0x6bd2, 0x0c9f, + 0x6bd3, 0x14f9, + 0x6bd4, 0x0d7a, + 0x6bd6, 0x213d, + 0x6bd8, 0x0d8f, + 0x6bdb, 0x0edf, + 0x6bdf, 0x14fa, + 0x6beb, 0x14fc, + 0x6bec, 0x14fb, + 0x6bef, 0x14fe, + 0x6bf3, 0x14fd, + 0x6c08, 0x1500, + 0x6c0f, 0x08af, + 0x6c11, 0x0ebd, + 0x6c13, 0x1501, + 0x6c17, 0x063e, + 0x6c1b, 0x1503, + 0x6c23, 0x1505, + 0x6c24, 0x1504, + 0x6c34, 0x0a2b, + 0x6c37, 0x0dab, + 0x6c38, 0x04ec, + 0x6c3e, 0x0d59, + 0x6c3f, 0x213e, + 0x6c40, 0x0c11, + 0x6c41, 0x094b, + 0x6c42, 0x067b, + 0x6c4e, 0x0d5a, + 0x6c50, 0x08da, + 0x6c55, 0x1507, + 0x6c57, 0x05fc, + 0x6c5a, 0x051a, + 0x6c5c, 0x213f, + 0x6c5d, 0x0cca, + 0x6c5e, 0x1506, + 0x6c5f, 0x07d0, + 0x6c60, 0x0b91, + 0x6c62, 0x1508, + 0x6c68, 0x1510, + 0x6c6a, 0x1509, + 0x6c6f, 0x2141, + 0x6c70, 0x0b21, + 0x6c72, 0x067c, + 0x6c73, 0x1511, + 0x6c7a, 0x073e, + 0x6c7d, 0x063f, + 0x6c7e, 0x150f, + 0x6c81, 0x150d, + 0x6c82, 0x150a, + 0x6c83, 0x0f4a, + 0x6c86, 0x2140, + 0x6c88, 0x0bdc, + 0x6c8c, 0x0cb1, + 0x6c8d, 0x150b, + 0x6c90, 0x1513, + 0x6c92, 0x1512, + 0x6c93, 0x06f9, + 0x6c96, 0x052d, + 0x6c99, 0x082b, + 0x6c9a, 0x150c, + 0x6c9b, 0x150e, + 0x6ca1, 0x0e85, + 0x6ca2, 0x0b54, + 0x6cab, 0x0ea5, + 0x6cae, 0x151b, + 0x6cb1, 0x151c, + 0x6cb3, 0x054f, + 0x6cb8, 0x0df8, + 0x6cb9, 0x0f09, + 0x6cba, 0x151e, + 0x6cbb, 0x08cf, + 0x6cbc, 0x09aa, + 0x6cbd, 0x1517, + 0x6cbe, 0x151d, + 0x6cbf, 0x050a, + 0x6cc1, 0x06af, + 0x6cc4, 0x1514, + 0x6cc5, 0x1519, + 0x6cc9, 0x0a98, + 0x6cca, 0x0d27, + 0x6ccc, 0x0d7b, + 0x6cd3, 0x1516, + 0x6cd5, 0x0e4f, + 0x6cd7, 0x1518, + 0x6cd9, 0x1521, + 0x6cda, 0x2142, + 0x6cdb, 0x151f, + 0x6cdd, 0x151a, + 0x6ce1, 0x0e50, + 0x6ce2, 0x0cfe, + 0x6ce3, 0x067d, + 0x6ce5, 0x0c1f, + 0x6ce8, 0x0bab, + 0x6cea, 0x1522, + 0x6cef, 0x1520, + 0x6cf0, 0x0b39, + 0x6cf1, 0x1515, + 0x6cf3, 0x04ed, + 0x6d04, 0x2143, + 0x6d0b, 0x0f38, + 0x6d0c, 0x152d, + 0x6d12, 0x152c, + 0x6d17, 0x0a9a, + 0x6d19, 0x1529, + 0x6d1b, 0x0f56, + 0x6d1e, 0x0c8e, + 0x6d1f, 0x1523, + 0x6d25, 0x0be1, + 0x6d29, 0x04ee, + 0x6d2a, 0x07d1, + 0x6d2b, 0x1526, + 0x6d32, 0x0931, + 0x6d33, 0x152b, + 0x6d35, 0x152a, + 0x6d36, 0x1525, + 0x6d38, 0x1528, + 0x6d3b, 0x05c6, + 0x6d3d, 0x1527, + 0x6d3e, 0x0cff, + 0x6d41, 0x0f76, + 0x6d44, 0x09dc, + 0x6d45, 0x0a99, + 0x6d59, 0x1533, + 0x6d5a, 0x1531, + 0x6d5c, 0x0dbf, + 0x6d63, 0x152e, + 0x6d64, 0x1530, + 0x6d66, 0x04dc, + 0x6d69, 0x07d2, + 0x6d6a, 0x0fd8, + 0x6d6c, 0x059b, + 0x6d6e, 0x0dd4, + 0x6d6f, 0x2145, + 0x6d74, 0x0f4b, + 0x6d77, 0x0582, + 0x6d78, 0x0a01, + 0x6d79, 0x1532, + 0x6d85, 0x1537, + 0x6d87, 0x2144, + 0x6d88, 0x09ab, + 0x6d8c, 0x0f1a, + 0x6d8e, 0x1534, + 0x6d93, 0x152f, + 0x6d95, 0x1535, + 0x6d96, 0x2146, + 0x6d99, 0x0fa6, + 0x6d9b, 0x0c6d, + 0x6d9c, 0x0c9a, + 0x6dac, 0x2147, + 0x6daf, 0x0594, + 0x6db2, 0x04f7, + 0x6db5, 0x153b, + 0x6db8, 0x153e, + 0x6dbc, 0x0f8b, + 0x6dc0, 0x0f4e, + 0x6dc5, 0x1545, + 0x6dc6, 0x153f, + 0x6dc7, 0x153c, + 0x6dcb, 0x0f9c, + 0x6dcc, 0x1542, + 0x6dcf, 0x2148, + 0x6dd1, 0x0954, + 0x6dd2, 0x1544, + 0x6dd5, 0x1549, + 0x6dd8, 0x0c6b, + 0x6dd9, 0x1547, + 0x6dde, 0x1541, + 0x6de1, 0x0b76, + 0x6de4, 0x1548, + 0x6de6, 0x153d, + 0x6de8, 0x1543, + 0x6dea, 0x154a, + 0x6deb, 0x04c0, + 0x6dec, 0x1540, + 0x6dee, 0x154b, + 0x6df1, 0x0a02, + 0x6df2, 0x214a, + 0x6df3, 0x0969, + 0x6df5, 0x0df5, + 0x6df7, 0x081e, + 0x6df8, 0x2149, + 0x6df9, 0x1538, + 0x6dfa, 0x1546, + 0x6dfb, 0x0c34, + 0x6dfc, 0x214b, + 0x6e05, 0x0a5a, + 0x6e07, 0x05c7, + 0x6e08, 0x0841, + 0x6e09, 0x09ac, + 0x6e0a, 0x153a, + 0x6e0b, 0x094c, + 0x6e13, 0x0722, + 0x6e15, 0x1539, + 0x6e19, 0x154f, + 0x6e1a, 0x0977, + 0x6e1b, 0x076e, + 0x6e1d, 0x155e, + 0x6e1f, 0x1558, + 0x6e20, 0x068e, + 0x6e21, 0x0c49, + 0x6e23, 0x1553, + 0x6e24, 0x155c, + 0x6e25, 0x0473, + 0x6e26, 0x04d4, + 0x6e27, 0x214e, + 0x6e29, 0x0539, + 0x6e2b, 0x1555, + 0x6e2c, 0x0b0c, + 0x6e2d, 0x154c, + 0x6e2e, 0x154e, + 0x6e2f, 0x07d3, + 0x6e38, 0x155f, + 0x6e39, 0x214c, + 0x6e3a, 0x155a, + 0x6e3c, 0x214f, + 0x6e3e, 0x1552, + 0x6e43, 0x1559, + 0x6e4a, 0x0eb7, + 0x6e4d, 0x1557, + 0x6e4e, 0x155b, + 0x6e56, 0x0784, + 0x6e58, 0x09ad, + 0x6e5b, 0x0b77, + 0x6e5c, 0x214d, + 0x6e5f, 0x1551, + 0x6e67, 0x0f19, + 0x6e6b, 0x1554, + 0x6e6e, 0x154d, + 0x6e6f, 0x0c6c, + 0x6e72, 0x1550, + 0x6e76, 0x1556, + 0x6e7e, 0x0ff7, + 0x6e7f, 0x08ea, + 0x6e80, 0x0eac, + 0x6e82, 0x1560, + 0x6e8c, 0x0d42, + 0x6e8f, 0x156c, + 0x6e90, 0x076f, + 0x6e96, 0x096a, + 0x6e98, 0x1562, + 0x6e9c, 0x0f77, + 0x6e9d, 0x07d4, + 0x6e9f, 0x156f, + 0x6ea2, 0x04b2, + 0x6ea5, 0x156d, + 0x6eaa, 0x1561, + 0x6eaf, 0x1567, + 0x6eb2, 0x1569, + 0x6eb6, 0x0f39, + 0x6eb7, 0x1564, + 0x6eba, 0x0c28, + 0x6ebd, 0x1566, + 0x6ebf, 0x2150, + 0x6ec2, 0x156e, + 0x6ec4, 0x1568, + 0x6ec5, 0x0ed3, + 0x6ec9, 0x1563, + 0x6ecb, 0x08ce, + 0x6ecc, 0x157b, + 0x6ed1, 0x05c8, + 0x6ed3, 0x1565, + 0x6ed4, 0x156a, + 0x6edd, 0x0b4c, + 0x6ede, 0x0b3a, + 0x6eec, 0x1573, + 0x6eef, 0x1579, + 0x6ef2, 0x1577, + 0x6ef4, 0x0c23, + 0x6ef7, 0x157e, + 0x6ef8, 0x1574, + 0x6efe, 0x1575, + 0x6eff, 0x155d, + 0x6f01, 0x0693, + 0x6f02, 0x0dac, + 0x6f06, 0x08eb, + 0x6f09, 0x0809, + 0x6f0f, 0x0fd9, + 0x6f11, 0x1571, + 0x6f13, 0x157d, + 0x6f14, 0x050b, + 0x6f15, 0x0ae8, + 0x6f20, 0x0d2f, + 0x6f22, 0x05fd, + 0x6f23, 0x0fc2, + 0x6f2b, 0x0ead, + 0x6f2c, 0x0bee, + 0x6f31, 0x1578, + 0x6f32, 0x157a, + 0x6f38, 0x0ab4, + 0x6f3e, 0x157c, + 0x6f3f, 0x1576, + 0x6f41, 0x1570, + 0x6f45, 0x05ff, + 0x6f51, 0x1e60, + 0x6f54, 0x073f, + 0x6f58, 0x158a, + 0x6f5b, 0x1585, + 0x6f5c, 0x0a9c, + 0x6f5f, 0x05c1, + 0x6f64, 0x096b, + 0x6f66, 0x158e, + 0x6f6d, 0x1587, + 0x6f6e, 0x0bc8, + 0x6f6f, 0x1584, + 0x6f70, 0x0bf5, + 0x6f74, 0x15a7, + 0x6f78, 0x1581, + 0x6f7a, 0x1580, + 0x6f7c, 0x1589, + 0x6f80, 0x1583, + 0x6f81, 0x1582, + 0x6f82, 0x1588, + 0x6f84, 0x0a45, + 0x6f86, 0x157f, + 0x6f88, 0x2151, + 0x6f8e, 0x158b, + 0x6f91, 0x158c, + 0x6f97, 0x05fe, + 0x6fa1, 0x1591, + 0x6fa3, 0x1590, + 0x6fa4, 0x1592, + 0x6faa, 0x1595, + 0x6fb1, 0x0c3d, + 0x6fb3, 0x158f, + 0x6fb5, 0x2152, + 0x6fb9, 0x1593, + 0x6fc0, 0x0739, + 0x6fc1, 0x0b59, + 0x6fc2, 0x158d, + 0x6fc3, 0x0cf1, + 0x6fc6, 0x1594, + 0x6fd4, 0x1599, + 0x6fd5, 0x1597, + 0x6fd8, 0x159a, + 0x6fdb, 0x159d, + 0x6fdf, 0x1596, + 0x6fe0, 0x07fc, + 0x6fe1, 0x0cde, + 0x6fe4, 0x1536, + 0x6feb, 0x0f5e, + 0x6fec, 0x1598, + 0x6fee, 0x159c, + 0x6fef, 0x0b55, + 0x6ff1, 0x159b, + 0x6ff3, 0x1586, + 0x6ff5, 0x2153, + 0x6ff6, 0x1ba4, + 0x6ffa, 0x15a0, + 0x6ffe, 0x15a4, + 0x7001, 0x15a2, + 0x7005, 0x2154, + 0x7006, 0x1e50, + 0x7007, 0x2155, + 0x7009, 0x159e, + 0x700b, 0x159f, + 0x700f, 0x15a3, + 0x7011, 0x15a1, + 0x7015, 0x0dc0, + 0x7018, 0x15a9, + 0x701a, 0x15a6, + 0x701b, 0x15a5, + 0x701d, 0x15a8, + 0x701e, 0x0cac, + 0x701f, 0x15aa, + 0x7026, 0x0bb3, + 0x7027, 0x0b4d, + 0x7028, 0x2156, + 0x702c, 0x0a49, + 0x7030, 0x15ab, + 0x7032, 0x15ad, + 0x703e, 0x15ac, + 0x704c, 0x1572, + 0x7051, 0x15ae, + 0x7058, 0x0cbf, + 0x7063, 0x15af, + 0x706b, 0x0550, + 0x706f, 0x0c6e, + 0x7070, 0x0583, + 0x7078, 0x067e, + 0x707c, 0x090a, + 0x707d, 0x0842, + 0x7085, 0x2157, + 0x7089, 0x0fcd, + 0x708a, 0x0a2c, + 0x708e, 0x050c, + 0x7092, 0x15b1, + 0x7099, 0x15b0, + 0x70ab, 0x2158, + 0x70ac, 0x15b4, + 0x70ad, 0x0b78, + 0x70ae, 0x15b7, + 0x70af, 0x15b2, + 0x70b3, 0x15b6, + 0x70b8, 0x15b5, + 0x70b9, 0x0c3a, + 0x70ba, 0x049d, + 0x70bb, 0x20ad, + 0x70c8, 0x0fbd, + 0x70cb, 0x15b9, + 0x70cf, 0x04ca, + 0x70d9, 0x15bb, + 0x70dd, 0x15ba, + 0x70df, 0x15b8, + 0x70f1, 0x15b3, + 0x70f9, 0x0e51, + 0x70fd, 0x15bd, + 0x7104, 0x215a, + 0x7109, 0x15bc, + 0x710f, 0x2159, + 0x7114, 0x050d, + 0x7119, 0x15bf, + 0x711a, 0x0e02, + 0x711c, 0x15be, + 0x7121, 0x0ec1, + 0x7126, 0x09af, + 0x7130, 0x1ddc, + 0x7136, 0x0ab5, + 0x713c, 0x09ae, + 0x7146, 0x215c, + 0x7149, 0x0fc3, + 0x714c, 0x15c5, + 0x714e, 0x0a9d, + 0x7155, 0x15c1, + 0x7156, 0x15c6, + 0x7159, 0x050e, + 0x715c, 0x215b, + 0x7162, 0x15c4, + 0x7164, 0x0d17, + 0x7165, 0x15c0, + 0x7166, 0x15c3, + 0x7167, 0x09b0, + 0x7169, 0x0d65, + 0x716c, 0x15c7, + 0x716e, 0x08fd, + 0x717d, 0x0a9e, + 0x7184, 0x15ca, + 0x7188, 0x15c2, + 0x718a, 0x06fd, + 0x718f, 0x15c8, + 0x7194, 0x0f3a, + 0x7195, 0x15cb, + 0x7199, 0x205d, + 0x719f, 0x0959, + 0x71a8, 0x15cc, + 0x71ac, 0x15cd, + 0x71b1, 0x0ce4, + 0x71b9, 0x15cf, + 0x71be, 0x15d0, + 0x71c1, 0x215f, + 0x71c3, 0x0ce9, + 0x71c8, 0x0c6f, + 0x71c9, 0x15d2, + 0x71ce, 0x15d4, + 0x71d0, 0x0f9d, + 0x71d2, 0x15d1, + 0x71d4, 0x15d3, + 0x71d5, 0x050f, + 0x71d7, 0x15ce, + 0x71df, 0x114e, + 0x71e0, 0x15d5, + 0x71e5, 0x0ae9, + 0x71e6, 0x0886, + 0x71e7, 0x15d7, + 0x71ec, 0x15d6, + 0x71ed, 0x09ea, + 0x71ee, 0x10ee, + 0x71f5, 0x15d8, + 0x71f9, 0x15da, + 0x71fb, 0x15c9, + 0x71fc, 0x15d9, + 0x71fe, 0x2160, + 0x71ff, 0x15db, + 0x7206, 0x0d30, + 0x720d, 0x15dc, + 0x7210, 0x15dd, + 0x721b, 0x15de, + 0x7228, 0x15df, + 0x722a, 0x0bfa, + 0x722c, 0x15e1, + 0x722d, 0x15e0, + 0x7230, 0x15e2, + 0x7232, 0x15e3, + 0x7235, 0x090b, + 0x7236, 0x0dd5, + 0x723a, 0x0ef8, + 0x723b, 0x15e4, + 0x723d, 0x0ad8, + 0x723e, 0x08d0, + 0x723f, 0x15e6, + 0x7246, 0x15e8, + 0x7247, 0x0e22, + 0x7248, 0x0d5b, + 0x724b, 0x15e9, + 0x724c, 0x0d0d, + 0x7252, 0x0bc9, + 0x7258, 0x15ea, + 0x7259, 0x0567, + 0x725b, 0x0687, + 0x725d, 0x0ed2, + 0x725f, 0x0ec2, + 0x7261, 0x0534, + 0x7262, 0x0fda, + 0x7267, 0x0e80, + 0x7269, 0x0dfa, + 0x7272, 0x0a5b, + 0x7274, 0x15eb, + 0x7279, 0x0c9b, + 0x727d, 0x0757, + 0x727e, 0x15ec, + 0x7280, 0x0844, + 0x7281, 0x15ee, + 0x7282, 0x15ed, + 0x7287, 0x15ef, + 0x7292, 0x15f0, + 0x7296, 0x15f1, + 0x72a0, 0x0658, + 0x72a2, 0x15f2, + 0x72a7, 0x15f3, + 0x72ac, 0x0758, + 0x72af, 0x0d5c, + 0x72b1, 0x2161, + 0x72b2, 0x15f5, + 0x72b6, 0x09dd, + 0x72b9, 0x15f4, + 0x72be, 0x2162, + 0x72c2, 0x06b0, + 0x72c3, 0x15f6, + 0x72c4, 0x15f8, + 0x72c6, 0x15f7, + 0x72ce, 0x15f9, + 0x72d0, 0x0785, + 0x72d2, 0x15fa, + 0x72d7, 0x06e1, + 0x72d9, 0x0ac2, + 0x72db, 0x080f, + 0x72e0, 0x15fc, + 0x72e2, 0x15fb, + 0x72e9, 0x0919, + 0x72ec, 0x0ca0, + 0x72ed, 0x06b1, + 0x72f7, 0x15ff, + 0x72f8, 0x0b6a, + 0x72f9, 0x15fe, + 0x72fc, 0x0fdb, + 0x72fd, 0x0d18, + 0x730a, 0x1602, + 0x7316, 0x1604, + 0x7317, 0x1601, + 0x731b, 0x0ee0, + 0x731c, 0x1603, + 0x731d, 0x1605, + 0x731f, 0x0f8c, + 0x7324, 0x2163, + 0x7325, 0x1609, + 0x7329, 0x1608, + 0x732a, 0x0bb4, + 0x732b, 0x0ce3, + 0x732e, 0x0759, + 0x732f, 0x1607, + 0x7334, 0x1606, + 0x7336, 0x0f1b, + 0x733e, 0x160a, + 0x733f, 0x0510, + 0x7344, 0x0808, + 0x7345, 0x08b0, + 0x734e, 0x160b, + 0x7357, 0x160e, + 0x7363, 0x094d, + 0x7368, 0x1610, + 0x736a, 0x160f, + 0x7370, 0x1611, + 0x7372, 0x05ab, + 0x7375, 0x1613, + 0x7377, 0x2165, + 0x7378, 0x1612, + 0x737a, 0x1615, + 0x737b, 0x1614, + 0x7384, 0x0770, + 0x7387, 0x0f70, + 0x7389, 0x06c4, + 0x738b, 0x0526, + 0x7396, 0x06e2, + 0x73a9, 0x061d, + 0x73b2, 0x0fb0, + 0x73b3, 0x1617, + 0x73bb, 0x1619, + 0x73bd, 0x2166, + 0x73c0, 0x161a, + 0x73c2, 0x0551, + 0x73c8, 0x1616, + 0x73c9, 0x2167, + 0x73ca, 0x0887, + 0x73cd, 0x0bdd, + 0x73ce, 0x1618, + 0x73d2, 0x216a, + 0x73d6, 0x2168, + 0x73de, 0x161d, + 0x73e0, 0x091a, + 0x73e3, 0x2169, + 0x73e5, 0x161b, + 0x73ea, 0x0714, + 0x73ed, 0x0d5d, + 0x73ee, 0x161c, + 0x73f1, 0x1637, + 0x73f5, 0x216c, + 0x73f8, 0x1622, + 0x73fe, 0x0771, + 0x7403, 0x067f, + 0x7405, 0x161f, + 0x7406, 0x0f67, + 0x7407, 0x216b, + 0x7409, 0x0f78, + 0x7422, 0x0b56, + 0x7425, 0x1621, + 0x7426, 0x216d, + 0x7429, 0x216f, + 0x742a, 0x216e, + 0x742e, 0x2170, + 0x7432, 0x1623, + 0x7433, 0x0f9e, + 0x7434, 0x06cf, + 0x7435, 0x0d90, + 0x7436, 0x0d00, + 0x743a, 0x1624, + 0x743f, 0x1626, + 0x7441, 0x1629, + 0x7455, 0x1625, + 0x7459, 0x1628, + 0x745a, 0x079e, + 0x745b, 0x04ef, + 0x745c, 0x162a, + 0x745e, 0x0a36, + 0x745f, 0x1627, + 0x7460, 0x0fa4, + 0x7462, 0x2171, + 0x7463, 0x162d, + 0x7464, 0x1d35, + 0x7469, 0x162b, + 0x746a, 0x162e, + 0x746f, 0x1620, + 0x7470, 0x162c, + 0x7473, 0x082c, + 0x7476, 0x162f, + 0x747e, 0x1630, + 0x7483, 0x0f68, + 0x7489, 0x2172, + 0x748b, 0x1631, + 0x749e, 0x1632, + 0x749f, 0x2173, + 0x74a2, 0x161e, + 0x74a7, 0x1633, + 0x74b0, 0x0600, + 0x74bd, 0x08d1, + 0x74ca, 0x1634, + 0x74cf, 0x1635, + 0x74d4, 0x1636, + 0x74dc, 0x04dd, + 0x74e0, 0x1638, + 0x74e2, 0x0dad, + 0x74e3, 0x1639, + 0x74e6, 0x05e0, + 0x74e7, 0x163a, + 0x74e9, 0x163b, + 0x74ee, 0x163c, + 0x74f0, 0x163e, + 0x74f2, 0x163d, + 0x74f6, 0x0dc5, + 0x74f7, 0x1641, + 0x74f8, 0x1640, + 0x7501, 0x2174, + 0x7503, 0x1643, + 0x7504, 0x1642, + 0x7505, 0x1644, + 0x750c, 0x1645, + 0x750d, 0x1647, + 0x750e, 0x1646, + 0x7511, 0x080b, + 0x7513, 0x1649, + 0x7515, 0x1648, + 0x7518, 0x0601, + 0x751a, 0x0a19, + 0x751c, 0x0c36, + 0x751e, 0x164a, + 0x751f, 0x0a5c, + 0x7523, 0x0888, + 0x7525, 0x051b, + 0x7526, 0x164b, + 0x7528, 0x0f3b, + 0x752b, 0x0e33, + 0x752c, 0x164c, + 0x752f, 0x20f2, + 0x7530, 0x0c3e, + 0x7531, 0x0f1d, + 0x7532, 0x07d5, + 0x7533, 0x0a03, + 0x7537, 0x0b89, + 0x7538, 0x10c9, + 0x753a, 0x0bca, + 0x753b, 0x0568, + 0x753c, 0x164d, + 0x7544, 0x164e, + 0x7546, 0x1653, + 0x7549, 0x1651, + 0x754a, 0x1650, + 0x754b, 0x13c7, + 0x754c, 0x0584, + 0x754d, 0x164f, + 0x754f, 0x049e, + 0x7551, 0x0d3e, + 0x7554, 0x0d5e, + 0x7559, 0x0f79, + 0x755a, 0x1654, + 0x755b, 0x1652, + 0x755c, 0x0b9a, + 0x755d, 0x0a4a, + 0x7560, 0x0d3f, + 0x7562, 0x0d9f, + 0x7564, 0x1656, + 0x7565, 0x0f74, + 0x7566, 0x0723, + 0x7567, 0x1657, + 0x7569, 0x1655, + 0x756a, 0x0d6a, + 0x756b, 0x1658, + 0x756d, 0x1659, + 0x756f, 0x2175, + 0x7570, 0x049f, + 0x7573, 0x09de, + 0x7574, 0x165e, + 0x7576, 0x165b, + 0x7577, 0x0cc5, + 0x7578, 0x165a, + 0x757f, 0x0640, + 0x7582, 0x1661, + 0x7586, 0x165c, + 0x7589, 0x1660, + 0x758a, 0x165f, + 0x758b, 0x0d97, + 0x758e, 0x0ac4, + 0x758f, 0x0ac3, + 0x7591, 0x0659, + 0x7594, 0x1662, + 0x759a, 0x1663, + 0x759d, 0x1664, + 0x75a3, 0x1666, + 0x75a5, 0x1665, + 0x75ab, 0x04f8, + 0x75b1, 0x166e, + 0x75b2, 0x0d7c, + 0x75b3, 0x1668, + 0x75b5, 0x166a, + 0x75b8, 0x166c, + 0x75b9, 0x0a04, + 0x75bc, 0x166d, + 0x75bd, 0x166b, + 0x75be, 0x08ec, + 0x75c2, 0x1667, + 0x75c3, 0x1669, + 0x75c5, 0x0db4, + 0x75c7, 0x09b1, + 0x75ca, 0x1670, + 0x75cd, 0x166f, + 0x75d2, 0x1671, + 0x75d4, 0x08d2, + 0x75d5, 0x081f, + 0x75d8, 0x0c71, + 0x75d9, 0x1672, + 0x75db, 0x0be7, + 0x75de, 0x1674, + 0x75e2, 0x0f69, + 0x75e3, 0x1673, + 0x75e9, 0x0aeb, + 0x75f0, 0x1679, + 0x75f2, 0x167b, + 0x75f4, 0x0b92, + 0x75fa, 0x167a, + 0x75fc, 0x1677, + 0x75fe, 0x1675, + 0x7601, 0x1678, + 0x7609, 0x167f, + 0x760b, 0x167d, + 0x760d, 0x167e, + 0x761f, 0x1680, + 0x7620, 0x1682, + 0x7624, 0x1685, + 0x7626, 0x1e2d, + 0x7627, 0x1681, + 0x7630, 0x1687, + 0x7634, 0x1686, + 0x763b, 0x1688, + 0x7642, 0x0f8d, + 0x7646, 0x168b, + 0x7647, 0x1689, + 0x764c, 0x061e, + 0x7652, 0x0f0a, + 0x7656, 0x0e1a, + 0x7658, 0x168d, + 0x765c, 0x168c, + 0x7661, 0x168e, + 0x7667, 0x1693, + 0x7668, 0x1690, + 0x766c, 0x1694, + 0x7670, 0x1695, + 0x7672, 0x1696, + 0x7676, 0x1697, + 0x7678, 0x1698, + 0x767a, 0x0d43, + 0x767b, 0x0c4a, + 0x767c, 0x1699, + 0x767d, 0x0d28, + 0x767e, 0x0da6, + 0x7680, 0x169a, + 0x7682, 0x2176, + 0x7683, 0x169b, + 0x7684, 0x0c24, + 0x7686, 0x0585, + 0x7687, 0x07d6, + 0x7688, 0x169c, + 0x768b, 0x169d, + 0x768e, 0x169e, + 0x7690, 0x0877, + 0x7693, 0x16a0, + 0x7696, 0x169f, + 0x7699, 0x16a1, + 0x769b, 0x2179, + 0x769c, 0x2177, + 0x769e, 0x2178, + 0x76a6, 0x217a, + 0x76ae, 0x0d7d, + 0x76b0, 0x16a3, + 0x76b4, 0x16a4, + 0x76b7, 0x1d1c, + 0x76b8, 0x16a5, + 0x76bf, 0x087c, + 0x76c2, 0x16a8, + 0x76c3, 0x0d0c, + 0x76c6, 0x0e8d, + 0x76c8, 0x04f0, + 0x76ca, 0x04f9, + 0x76cd, 0x16a9, + 0x76d2, 0x16ab, + 0x76d6, 0x16aa, + 0x76d7, 0x0c6a, + 0x76db, 0x0a5d, + 0x76dc, 0x14d8, + 0x76de, 0x16ac, + 0x76df, 0x0ecd, + 0x76e1, 0x16ad, + 0x76e3, 0x0602, + 0x76e4, 0x0d6b, + 0x76e5, 0x16ae, + 0x76e7, 0x16af, + 0x76ea, 0x16b0, + 0x76ee, 0x0ee8, + 0x76f2, 0x0ee1, + 0x76f4, 0x0bda, + 0x76f8, 0x0aec, + 0x76fb, 0x16b2, + 0x76fe, 0x096c, + 0x7701, 0x09b2, + 0x7704, 0x16b5, + 0x7707, 0x16b4, + 0x7708, 0x16b3, + 0x7709, 0x0d91, + 0x770b, 0x0603, + 0x770c, 0x075d, + 0x771b, 0x16bb, + 0x771e, 0x16b8, + 0x771f, 0x0a05, + 0x7720, 0x0ebe, + 0x7724, 0x16b7, + 0x7725, 0x16b9, + 0x7729, 0x16b6, + 0x7737, 0x16bc, + 0x773a, 0x0bcb, + 0x773c, 0x061f, + 0x7740, 0x0ba3, + 0x7746, 0x217c, + 0x7747, 0x16be, + 0x775a, 0x16bf, + 0x775b, 0x16c2, + 0x7761, 0x0a2d, + 0x7762, 0x1ec5, + 0x7763, 0x0c9c, + 0x7765, 0x16c3, + 0x7766, 0x0e81, + 0x7768, 0x16c0, + 0x776b, 0x16c1, + 0x7779, 0x16c6, + 0x777e, 0x16c5, + 0x777f, 0x16c4, + 0x778b, 0x16c8, + 0x778e, 0x16c7, + 0x7791, 0x16c9, + 0x779e, 0x16cb, + 0x77a0, 0x16ca, + 0x77a5, 0x0e1d, + 0x77ac, 0x0960, + 0x77ad, 0x0f8e, + 0x77b0, 0x16cc, + 0x77b3, 0x0c8f, + 0x77b6, 0x16cd, + 0x77b9, 0x16ce, + 0x77bb, 0x16d2, + 0x77bc, 0x16d0, + 0x77bf, 0x16cf, + 0x77c7, 0x16d3, + 0x77cd, 0x16d4, + 0x77d7, 0x16d5, + 0x77da, 0x16d6, + 0x77db, 0x0ec3, + 0x77dc, 0x16d7, + 0x77e2, 0x0efc, + 0x77e3, 0x16d8, + 0x77e5, 0x0b8c, + 0x77e7, 0x0d20, + 0x77e9, 0x06e3, + 0x77ed, 0x0b79, + 0x77ee, 0x16d9, + 0x77ef, 0x06b2, + 0x77f3, 0x0a74, + 0x77fc, 0x16da, + 0x7802, 0x082d, + 0x780c, 0x16db, + 0x7812, 0x16dc, + 0x7814, 0x075a, + 0x7815, 0x0845, + 0x7820, 0x16de, + 0x7821, 0x217e, + 0x7825, 0x0c50, + 0x7826, 0x0846, + 0x7827, 0x0668, + 0x7832, 0x0e52, + 0x7834, 0x0d01, + 0x783a, 0x0c51, + 0x783f, 0x07ee, + 0x7845, 0x16e0, + 0x784e, 0x217f, + 0x785d, 0x09b3, + 0x7864, 0x2180, + 0x786b, 0x0f7a, + 0x786c, 0x07d7, + 0x786f, 0x075b, + 0x7872, 0x0d37, + 0x7874, 0x16e2, + 0x787a, 0x2181, + 0x787c, 0x16e4, + 0x7881, 0x079f, + 0x7886, 0x16e3, + 0x7887, 0x0c12, + 0x788c, 0x16e6, + 0x788d, 0x0595, + 0x788e, 0x16e1, + 0x7891, 0x0d7e, + 0x7893, 0x04d2, + 0x7895, 0x085c, + 0x7897, 0x0ff8, + 0x789a, 0x16e5, + 0x78a3, 0x16e7, + 0x78a7, 0x0e1b, + 0x78a9, 0x0a7d, + 0x78aa, 0x16e9, + 0x78af, 0x16ea, + 0x78b5, 0x16e8, + 0x78ba, 0x05ac, + 0x78bc, 0x16f0, + 0x78be, 0x16ef, + 0x78c1, 0x08d3, + 0x78c5, 0x16f1, + 0x78c6, 0x16ec, + 0x78ca, 0x16f2, + 0x78cb, 0x16ed, + 0x78d0, 0x0d6c, + 0x78d1, 0x16eb, + 0x78d4, 0x16ee, + 0x78da, 0x16f5, + 0x78e7, 0x16f4, + 0x78e8, 0x0e8f, + 0x78ec, 0x16f3, + 0x78ef, 0x04af, + 0x78f4, 0x16f7, + 0x78fd, 0x16f6, + 0x7901, 0x09b4, + 0x7907, 0x16f8, + 0x790e, 0x0ac5, + 0x7911, 0x16fa, + 0x7912, 0x16f9, + 0x7919, 0x16fb, + 0x7926, 0x16dd, + 0x792a, 0x16df, + 0x792b, 0x16fd, + 0x792c, 0x16fc, + 0x7930, 0x2182, + 0x793a, 0x08d4, + 0x793c, 0x0fb1, + 0x793e, 0x08fe, + 0x7940, 0x16fe, + 0x7941, 0x070d, + 0x7947, 0x065a, + 0x7948, 0x0641, + 0x7949, 0x08b1, + 0x7950, 0x0f1e, + 0x7953, 0x1704, + 0x7955, 0x1703, + 0x7956, 0x0ac6, + 0x7957, 0x1700, + 0x795a, 0x1702, + 0x795d, 0x0955, + 0x795e, 0x0a06, + 0x795f, 0x1701, + 0x7960, 0x16ff, + 0x7962, 0x0ce0, + 0x7965, 0x09b5, + 0x7968, 0x0dae, + 0x796d, 0x0847, + 0x7977, 0x0c72, + 0x797a, 0x1705, + 0x797f, 0x1706, + 0x7980, 0x171c, + 0x7981, 0x06d0, + 0x7984, 0x0fe3, + 0x7985, 0x0ab7, + 0x798a, 0x1707, + 0x798d, 0x0552, + 0x798e, 0x0c13, + 0x798f, 0x0df1, + 0x7994, 0x2186, + 0x799b, 0x2188, + 0x799d, 0x1708, + 0x79a6, 0x0694, + 0x79a7, 0x1709, + 0x79aa, 0x170b, + 0x79ae, 0x170c, + 0x79b0, 0x0cdf, + 0x79b1, 0x1e4e, + 0x79b3, 0x170d, + 0x79b9, 0x170e, + 0x79bd, 0x06d1, + 0x79be, 0x0553, + 0x79bf, 0x0c9d, + 0x79c0, 0x0932, + 0x79c1, 0x08b2, + 0x79c9, 0x1710, + 0x79cb, 0x0933, + 0x79d1, 0x054a, + 0x79d2, 0x0db5, + 0x79d5, 0x1711, + 0x79d8, 0x0d7f, + 0x79df, 0x0ac7, + 0x79e1, 0x1714, + 0x79e3, 0x1715, + 0x79e4, 0x0d1f, + 0x79e6, 0x0a07, + 0x79e7, 0x1712, + 0x79e9, 0x0b9f, + 0x79ec, 0x1713, + 0x79f0, 0x09b6, + 0x79fb, 0x04a0, + 0x7a00, 0x0643, + 0x7a08, 0x1716, + 0x7a0b, 0x0c14, + 0x7a0d, 0x1717, + 0x7a0e, 0x0a6b, + 0x7a14, 0x0eb9, + 0x7a17, 0x0d95, + 0x7a18, 0x1718, + 0x7a1a, 0x0b93, + 0x7a1c, 0x0f8f, + 0x7a1f, 0x171b, + 0x7a20, 0x171a, + 0x7a2e, 0x091b, + 0x7a31, 0x171d, + 0x7a32, 0x04b4, + 0x7a37, 0x1720, + 0x7a3b, 0x171e, + 0x7a3c, 0x0554, + 0x7a3d, 0x0724, + 0x7a3e, 0x171f, + 0x7a3f, 0x07d8, + 0x7a40, 0x0804, + 0x7a42, 0x0e36, + 0x7a43, 0x1721, + 0x7a46, 0x0e82, + 0x7a49, 0x1723, + 0x7a4d, 0x0a75, + 0x7a4e, 0x04f1, + 0x7a4f, 0x053a, + 0x7a50, 0x0470, + 0x7a57, 0x1722, + 0x7a61, 0x1724, + 0x7a63, 0x09df, + 0x7a69, 0x1726, + 0x7a6b, 0x05ad, + 0x7a70, 0x1728, + 0x7a74, 0x0740, + 0x7a76, 0x0680, + 0x7a79, 0x1729, + 0x7a7a, 0x06ed, + 0x7a7d, 0x172a, + 0x7a7f, 0x0aa0, + 0x7a81, 0x0ca5, + 0x7a83, 0x0a84, + 0x7a84, 0x0865, + 0x7a88, 0x172b, + 0x7a92, 0x0ba0, + 0x7a93, 0x0aed, + 0x7a95, 0x172d, + 0x7a96, 0x172f, + 0x7a97, 0x172c, + 0x7a98, 0x172e, + 0x7a9f, 0x06f8, + 0x7aa9, 0x1730, + 0x7aaa, 0x06fc, + 0x7aae, 0x0681, + 0x7aaf, 0x0f3c, + 0x7ab0, 0x1732, + 0x7ab6, 0x1733, + 0x7aba, 0x04d0, + 0x7abf, 0x1736, + 0x7ac3, 0x05d4, + 0x7ac4, 0x1735, + 0x7ac5, 0x1734, + 0x7ac7, 0x1738, + 0x7ac8, 0x1731, + 0x7aca, 0x1739, + 0x7acb, 0x0f71, + 0x7acd, 0x173a, + 0x7acf, 0x173b, + 0x7ad1, 0x2189, + 0x7ad2, 0x11c5, + 0x7ad3, 0x173d, + 0x7ad5, 0x173c, + 0x7ad9, 0x173e, + 0x7adc, 0x0f7d, + 0x7add, 0x1740, + 0x7adf, 0x1c08, + 0x7ae0, 0x09b7, + 0x7ae1, 0x1741, + 0x7ae3, 0x0961, + 0x7ae5, 0x0c90, + 0x7ae6, 0x1743, + 0x7ae7, 0x218a, + 0x7aea, 0x0b66, + 0x7aeb, 0x218c, + 0x7aed, 0x1744, + 0x7aef, 0x0b7a, + 0x7af0, 0x1745, + 0x7af6, 0x069d, + 0x7af8, 0x1076, + 0x7af9, 0x0b9b, + 0x7afa, 0x08df, + 0x7aff, 0x0604, + 0x7b02, 0x1746, + 0x7b04, 0x1753, + 0x7b06, 0x1749, + 0x7b08, 0x0682, + 0x7b0a, 0x1748, + 0x7b0b, 0x1755, + 0x7b0f, 0x1747, + 0x7b11, 0x09b8, + 0x7b18, 0x174b, + 0x7b1b, 0x0c25, + 0x7b1e, 0x174d, + 0x7b20, 0x05bc, + 0x7b25, 0x0a20, + 0x7b26, 0x0dd6, + 0x7b28, 0x174f, + 0x7b2c, 0x0b48, + 0x7b33, 0x174a, + 0x7b35, 0x174e, + 0x7b36, 0x1750, + 0x7b39, 0x086b, + 0x7b45, 0x1757, + 0x7b46, 0x0da0, + 0x7b48, 0x0d3a, + 0x7b49, 0x0c73, + 0x7b4b, 0x06d2, + 0x7b4c, 0x1756, + 0x7b4d, 0x1754, + 0x7b4f, 0x0d49, + 0x7b50, 0x1751, + 0x7b51, 0x0b9c, + 0x7b52, 0x0c75, + 0x7b54, 0x0c74, + 0x7b56, 0x0866, + 0x7b5d, 0x1769, + 0x7b65, 0x1759, + 0x7b67, 0x175b, + 0x7b6c, 0x175e, + 0x7b6e, 0x175f, + 0x7b70, 0x175c, + 0x7b74, 0x175a, + 0x7b75, 0x1758, + 0x7b7a, 0x1752, + 0x7b86, 0x0e1f, + 0x7b87, 0x0555, + 0x7b8b, 0x1766, + 0x7b8d, 0x1763, + 0x7b8f, 0x1768, + 0x7b92, 0x1767, + 0x7b94, 0x0d29, + 0x7b95, 0x0eb3, + 0x7b97, 0x0889, + 0x7b98, 0x1761, + 0x7b99, 0x176a, + 0x7b9a, 0x1765, + 0x7b9c, 0x1764, + 0x7b9d, 0x1760, + 0x7b9e, 0x218d, + 0x7b9f, 0x1762, + 0x7ba1, 0x0605, + 0x7baa, 0x0b7b, + 0x7bad, 0x0aa1, + 0x7bb1, 0x0d36, + 0x7bb4, 0x176f, + 0x7bb8, 0x0d38, + 0x7bc0, 0x0a85, + 0x7bc1, 0x176c, + 0x7bc4, 0x0d63, + 0x7bc6, 0x1770, + 0x7bc7, 0x0e23, + 0x7bc9, 0x0b99, + 0x7bcb, 0x176b, + 0x7bcc, 0x176d, + 0x7bcf, 0x176e, + 0x7bdd, 0x1771, + 0x7be0, 0x08f0, + 0x7be4, 0x0c9e, + 0x7be5, 0x1776, + 0x7be6, 0x1775, + 0x7be9, 0x1772, + 0x7bed, 0x0fdc, + 0x7bf3, 0x177b, + 0x7bf6, 0x177f, + 0x7bf7, 0x177c, + 0x7c00, 0x1778, + 0x7c07, 0x1779, + 0x7c0d, 0x177e, + 0x7c11, 0x1773, + 0x7c12, 0x10ea, + 0x7c13, 0x177a, + 0x7c14, 0x1774, + 0x7c17, 0x177d, + 0x7c1e, 0x1e3b, + 0x7c1f, 0x1783, + 0x7c21, 0x0606, + 0x7c23, 0x1780, + 0x7c27, 0x1781, + 0x7c2a, 0x1782, + 0x7c2b, 0x1785, + 0x7c37, 0x1784, + 0x7c38, 0x0d8a, + 0x7c3d, 0x1786, + 0x7c3e, 0x0fc4, + 0x7c3f, 0x0e3d, + 0x7c40, 0x178b, + 0x7c43, 0x1788, + 0x7c4c, 0x1787, + 0x7c4d, 0x0a76, + 0x7c4f, 0x178a, + 0x7c50, 0x178c, + 0x7c54, 0x1789, + 0x7c56, 0x1790, + 0x7c58, 0x178d, + 0x7c5f, 0x178e, + 0x7c60, 0x1777, + 0x7c64, 0x178f, + 0x7c65, 0x1791, + 0x7c6c, 0x1792, + 0x7c73, 0x0e16, + 0x7c75, 0x1793, + 0x7c7e, 0x0eee, + 0x7c81, 0x06c6, + 0x7c82, 0x06ff, + 0x7c83, 0x1794, + 0x7c89, 0x0e04, + 0x7c8b, 0x0a2e, + 0x7c8d, 0x0ebc, + 0x7c90, 0x1795, + 0x7c92, 0x0f7b, + 0x7c95, 0x0d2a, + 0x7c97, 0x0ac8, + 0x7c98, 0x0cea, + 0x7c9b, 0x0957, + 0x7c9f, 0x0484, + 0x7ca1, 0x179a, + 0x7ca2, 0x1798, + 0x7ca4, 0x1796, + 0x7ca5, 0x05dd, + 0x7ca7, 0x09b9, + 0x7ca8, 0x179b, + 0x7cab, 0x1799, + 0x7cad, 0x1797, + 0x7cae, 0x179f, + 0x7cb1, 0x179e, + 0x7cb2, 0x179d, + 0x7cb3, 0x179c, + 0x7cb9, 0x17a0, + 0x7cbd, 0x17a1, + 0x7cbe, 0x0a5e, + 0x7cc0, 0x17a2, + 0x7cc2, 0x17a4, + 0x7cc5, 0x17a3, + 0x7cca, 0x0786, + 0x7cce, 0x0aba, + 0x7cd2, 0x17a6, + 0x7cd6, 0x0c76, + 0x7cd8, 0x17a5, + 0x7cdc, 0x17a7, + 0x7cde, 0x0e05, + 0x7cdf, 0x0aee, + 0x7ce0, 0x07d9, + 0x7ce2, 0x17a8, + 0x7ce7, 0x0f90, + 0x7cef, 0x17aa, + 0x7cf2, 0x17ab, + 0x7cf4, 0x17ac, + 0x7cf6, 0x17ad, + 0x7cf8, 0x08b3, + 0x7cfa, 0x17ae, + 0x7cfb, 0x0725, + 0x7cfe, 0x0684, + 0x7d00, 0x0644, + 0x7d02, 0x17b0, + 0x7d04, 0x0eff, + 0x7d05, 0x07da, + 0x7d06, 0x17af, + 0x7d0a, 0x17b3, + 0x7d0b, 0x0ef2, + 0x7d0d, 0x0cf2, + 0x7d10, 0x0da5, + 0x7d14, 0x096d, + 0x7d15, 0x17b2, + 0x7d17, 0x08ff, + 0x7d18, 0x07db, + 0x7d19, 0x08b4, + 0x7d1a, 0x0683, + 0x7d1b, 0x0e06, + 0x7d1c, 0x17b1, + 0x7d20, 0x0ac9, + 0x7d21, 0x0e70, + 0x7d22, 0x0867, + 0x7d2b, 0x08b5, + 0x7d2c, 0x0bf9, + 0x7d2e, 0x17b6, + 0x7d2f, 0x0fa7, + 0x7d30, 0x0849, + 0x7d32, 0x17b7, + 0x7d33, 0x0a08, + 0x7d35, 0x17b9, + 0x7d39, 0x09ba, + 0x7d3a, 0x0820, + 0x7d3f, 0x17b8, + 0x7d42, 0x0934, + 0x7d43, 0x0772, + 0x7d44, 0x0aca, + 0x7d45, 0x17b4, + 0x7d46, 0x17ba, + 0x7d48, 0x218f, + 0x7d4b, 0x17b5, + 0x7d4c, 0x0726, + 0x7d4e, 0x17bd, + 0x7d4f, 0x17c1, + 0x7d50, 0x0741, + 0x7d56, 0x17bc, + 0x7d5b, 0x17c5, + 0x7d5c, 0x2190, + 0x7d5e, 0x07dc, + 0x7d61, 0x0f57, + 0x7d62, 0x0480, + 0x7d63, 0x17c2, + 0x7d66, 0x0685, + 0x7d68, 0x17bf, + 0x7d6e, 0x17c0, + 0x7d71, 0x0c77, + 0x7d72, 0x17be, + 0x7d73, 0x17bb, + 0x7d75, 0x0586, + 0x7d76, 0x0a88, + 0x7d79, 0x075c, + 0x7d7d, 0x17c7, + 0x7d89, 0x17c4, + 0x7d8f, 0x17c6, + 0x7d93, 0x17c3, + 0x7d99, 0x0727, + 0x7d9a, 0x0b13, + 0x7d9b, 0x17c8, + 0x7d9c, 0x0af0, + 0x7d9f, 0x17d5, + 0x7da0, 0x2192, + 0x7da2, 0x17d1, + 0x7da3, 0x17cb, + 0x7dab, 0x17cf, + 0x7dac, 0x0926, + 0x7dad, 0x04a1, + 0x7dae, 0x17ca, + 0x7daf, 0x17d2, + 0x7db0, 0x17d6, + 0x7db1, 0x07dd, + 0x7db2, 0x0ee2, + 0x7db4, 0x0bf2, + 0x7db5, 0x17cc, + 0x7db7, 0x2191, + 0x7db8, 0x17d4, + 0x7dba, 0x17c9, + 0x7dbb, 0x0b7c, + 0x7dbd, 0x17ce, + 0x7dbe, 0x0481, + 0x7dbf, 0x0ed6, + 0x7dc7, 0x17cd, + 0x7dca, 0x06d3, + 0x7dcb, 0x0d80, + 0x7dcf, 0x0aef, + 0x7dd1, 0x0f98, + 0x7dd2, 0x0979, + 0x7dd5, 0x17fd, + 0x7dd6, 0x2193, + 0x7dd8, 0x17d7, + 0x7dda, 0x0aa2, + 0x7ddc, 0x17d3, + 0x7ddd, 0x17d8, + 0x7dde, 0x17da, + 0x7de0, 0x0c15, + 0x7de1, 0x17dd, + 0x7de4, 0x17d9, + 0x7de8, 0x0e24, + 0x7de9, 0x0607, + 0x7dec, 0x0ed7, + 0x7def, 0x04a2, + 0x7df2, 0x17dc, + 0x7df4, 0x0fc5, + 0x7dfb, 0x17db, + 0x7e01, 0x0511, + 0x7e04, 0x0cc4, + 0x7e05, 0x17de, + 0x7e09, 0x17e5, + 0x7e0a, 0x17df, + 0x7e0b, 0x17e6, + 0x7e12, 0x17e2, + 0x7e1b, 0x0d31, + 0x7e1e, 0x08f6, + 0x7e1f, 0x17e4, + 0x7e21, 0x17e1, + 0x7e22, 0x17e7, + 0x7e23, 0x17e0, + 0x7e26, 0x094e, + 0x7e2b, 0x0e53, + 0x7e2e, 0x0956, + 0x7e31, 0x17e3, + 0x7e32, 0x17ef, + 0x7e35, 0x17eb, + 0x7e37, 0x17ee, + 0x7e39, 0x17ec, + 0x7e3a, 0x17f0, + 0x7e3b, 0x17ea, + 0x7e3d, 0x17d0, + 0x7e3e, 0x0a77, + 0x7e41, 0x0d5f, + 0x7e43, 0x17ed, + 0x7e46, 0x17e8, + 0x7e4a, 0x0aa3, + 0x7e4b, 0x0728, + 0x7e4d, 0x0935, + 0x7e52, 0x2194, + 0x7e54, 0x09eb, + 0x7e55, 0x0ab8, + 0x7e56, 0x17f3, + 0x7e59, 0x17f5, + 0x7e5d, 0x17f2, + 0x7e5e, 0x17f4, + 0x7e61, 0x1e11, + 0x7e66, 0x17e9, + 0x7e67, 0x17f1, + 0x7e69, 0x17f9, + 0x7e6a, 0x17f8, + 0x7e6b, 0x1df7, + 0x7e6d, 0x0ea8, + 0x7e70, 0x0701, + 0x7e79, 0x17f7, + 0x7e7b, 0x17fb, + 0x7e7c, 0x17fa, + 0x7e7d, 0x17fe, + 0x7e7f, 0x1800, + 0x7e82, 0x088a, + 0x7e83, 0x17fc, + 0x7e88, 0x1801, + 0x7e8a, 0x20a7, + 0x7e8c, 0x1803, + 0x7e8e, 0x1809, + 0x7e8f, 0x0c35, + 0x7e90, 0x1805, + 0x7e92, 0x1804, + 0x7e93, 0x1806, + 0x7e96, 0x1808, + 0x7e9b, 0x180a, + 0x7f36, 0x0608, + 0x7f38, 0x180c, + 0x7f3a, 0x180d, + 0x7f45, 0x180e, + 0x7f47, 0x2195, + 0x7f4c, 0x180f, + 0x7f50, 0x1812, + 0x7f54, 0x1815, + 0x7f55, 0x1814, + 0x7f58, 0x1816, + 0x7f5f, 0x1817, + 0x7f67, 0x181b, + 0x7f68, 0x1819, + 0x7f6a, 0x0851, + 0x7f6b, 0x0729, + 0x7f6e, 0x0b94, + 0x7f70, 0x0d47, + 0x7f72, 0x097a, + 0x7f75, 0x0d03, + 0x7f77, 0x0d81, + 0x7f78, 0x181c, + 0x7f79, 0x1336, + 0x7f82, 0x181d, + 0x7f83, 0x181f, + 0x7f85, 0x0f4f, + 0x7f86, 0x181e, + 0x7f87, 0x1821, + 0x7f88, 0x1820, + 0x7f8a, 0x0f3d, + 0x7f8c, 0x1822, + 0x7f8e, 0x0d92, + 0x7f94, 0x1823, + 0x7f9a, 0x1826, + 0x7f9d, 0x1825, + 0x7f9e, 0x1824, + 0x7fa1, 0x2196, + 0x7fa3, 0x1827, + 0x7fa4, 0x0708, + 0x7fa8, 0x0aa4, + 0x7fa9, 0x065b, + 0x7fae, 0x182b, + 0x7faf, 0x1828, + 0x7fb2, 0x1829, + 0x7fb6, 0x182c, + 0x7fb8, 0x182d, + 0x7fb9, 0x182a, + 0x7fbd, 0x04cb, + 0x7fc1, 0x0527, + 0x7fc5, 0x182f, + 0x7fca, 0x1831, + 0x7fcc, 0x0f4c, + 0x7fd2, 0x0936, + 0x7fd4, 0x1833, + 0x7fd5, 0x1832, + 0x7fe0, 0x0a2f, + 0x7fe1, 0x1834, + 0x7fe6, 0x1835, + 0x7fe9, 0x1836, + 0x7feb, 0x0621, + 0x7ff0, 0x0609, + 0x7ff3, 0x1837, + 0x7ff9, 0x1838, + 0x7ffb, 0x0e8b, + 0x7ffc, 0x0f4d, + 0x8000, 0x0f3e, + 0x8001, 0x0fdd, + 0x8003, 0x07df, + 0x8004, 0x183b, + 0x8005, 0x0900, + 0x8006, 0x183a, + 0x800b, 0x183c, + 0x800c, 0x08d5, + 0x8010, 0x0b31, + 0x8012, 0x183d, + 0x8015, 0x07de, + 0x8017, 0x0ee3, + 0x8018, 0x183e, + 0x801c, 0x1840, + 0x8021, 0x1841, + 0x8028, 0x1842, + 0x8033, 0x08d6, + 0x8036, 0x0ef9, + 0x803b, 0x1844, + 0x803d, 0x0b7d, + 0x803f, 0x1843, + 0x8046, 0x1846, + 0x804a, 0x1845, + 0x8052, 0x1847, + 0x8056, 0x0a5f, + 0x8058, 0x1848, + 0x805a, 0x1849, + 0x805e, 0x0e09, + 0x805f, 0x184a, + 0x8061, 0x0af1, + 0x8062, 0x184b, + 0x8068, 0x184c, + 0x806f, 0x0fc6, + 0x8070, 0x184f, + 0x8072, 0x184e, + 0x8073, 0x184d, + 0x8074, 0x0bcc, + 0x8076, 0x1850, + 0x8077, 0x09ec, + 0x8079, 0x1851, + 0x807d, 0x1852, + 0x807e, 0x0fde, + 0x807f, 0x1853, + 0x8084, 0x1854, + 0x8085, 0x1856, + 0x8086, 0x1855, + 0x8087, 0x0d39, + 0x8089, 0x0cd1, + 0x808b, 0x0fe4, + 0x808c, 0x0d3d, + 0x8093, 0x1858, + 0x8096, 0x09bb, + 0x8098, 0x0d9c, + 0x809a, 0x1859, + 0x809b, 0x1857, + 0x809d, 0x060a, + 0x80a1, 0x0788, + 0x80a2, 0x08b6, + 0x80a5, 0x0d82, + 0x80a9, 0x075e, + 0x80aa, 0x0e71, + 0x80ac, 0x185c, + 0x80ad, 0x185a, + 0x80af, 0x07e0, + 0x80b1, 0x07e1, + 0x80b2, 0x04ad, + 0x80b4, 0x0858, + 0x80ba, 0x0d0f, + 0x80c3, 0x04a3, + 0x80c4, 0x1861, + 0x80c6, 0x0b7e, + 0x80cc, 0x0d0e, + 0x80ce, 0x0b3b, + 0x80d6, 0x1863, + 0x80d9, 0x185f, + 0x80da, 0x1862, + 0x80db, 0x185d, + 0x80dd, 0x1860, + 0x80de, 0x0e54, + 0x80e1, 0x0789, + 0x80e4, 0x04c1, + 0x80e5, 0x185e, + 0x80ef, 0x1865, + 0x80f1, 0x1866, + 0x80f4, 0x0c91, + 0x80f8, 0x06b3, + 0x80fc, 0x1871, + 0x80fd, 0x0cf3, + 0x8102, 0x08b7, + 0x8105, 0x06b4, + 0x8106, 0x0a6c, + 0x8107, 0x0fec, + 0x8108, 0x0eba, + 0x8109, 0x1864, + 0x810a, 0x0a78, + 0x811a, 0x066d, + 0x811b, 0x1867, + 0x8123, 0x1869, + 0x8129, 0x1868, + 0x812f, 0x186a, + 0x8131, 0x0b64, + 0x8133, 0x0cf4, + 0x8139, 0x0bcd, + 0x813e, 0x186e, + 0x8146, 0x186d, + 0x814b, 0x186b, + 0x814e, 0x0a1b, + 0x8150, 0x0dd7, + 0x8151, 0x1870, + 0x8153, 0x186f, + 0x8154, 0x07e2, + 0x8155, 0x0ff9, + 0x815f, 0x1880, + 0x8165, 0x1874, + 0x816b, 0x091c, + 0x816e, 0x1873, + 0x8170, 0x080a, + 0x8171, 0x1872, + 0x8174, 0x1876, + 0x8178, 0x0bce, + 0x8179, 0x0df2, + 0x817a, 0x0aa5, + 0x817f, 0x0b3c, + 0x8180, 0x187a, + 0x8182, 0x187b, + 0x8183, 0x1877, + 0x8188, 0x1878, + 0x818a, 0x1879, + 0x818f, 0x07e3, + 0x8193, 0x1881, + 0x8195, 0x187d, + 0x819a, 0x0dd8, + 0x819c, 0x0e9a, + 0x819d, 0x0d9a, + 0x81a0, 0x187c, + 0x81a3, 0x187f, + 0x81a4, 0x187e, + 0x81a8, 0x0e72, + 0x81a9, 0x1882, + 0x81b0, 0x1883, + 0x81b3, 0x0ab9, + 0x81b5, 0x1884, + 0x81b8, 0x1886, + 0x81ba, 0x188a, + 0x81bd, 0x1887, + 0x81be, 0x1885, + 0x81bf, 0x0cf5, + 0x81c0, 0x1888, + 0x81c2, 0x1889, + 0x81c6, 0x0532, + 0x81c8, 0x1890, + 0x81c9, 0x188b, + 0x81cd, 0x188c, + 0x81d1, 0x188d, + 0x81d3, 0x0b01, + 0x81d8, 0x188f, + 0x81d9, 0x188e, + 0x81da, 0x1891, + 0x81df, 0x1892, + 0x81e3, 0x0a09, + 0x81e5, 0x0569, + 0x81e7, 0x1894, + 0x81e8, 0x0f9f, + 0x81ea, 0x08d7, + 0x81ed, 0x0937, + 0x81f3, 0x08b8, + 0x81f4, 0x0b95, + 0x81fa, 0x1895, + 0x81fc, 0x04d3, + 0x81fe, 0x1897, + 0x8201, 0x1898, + 0x8205, 0x189a, + 0x8207, 0x189b, + 0x8208, 0x06b5, + 0x8209, 0x13af, + 0x820a, 0x189c, + 0x820c, 0x0a89, + 0x820d, 0x189d, + 0x820e, 0x08f7, + 0x8210, 0x189e, + 0x8212, 0x1009, + 0x8216, 0x189f, + 0x8217, 0x0e2e, + 0x8218, 0x0618, + 0x821b, 0x0aa6, + 0x821c, 0x0962, + 0x821e, 0x0de3, + 0x821f, 0x0938, + 0x8229, 0x18a0, + 0x822a, 0x07e4, + 0x822b, 0x18a1, + 0x822c, 0x0d60, + 0x822e, 0x18af, + 0x8233, 0x18a3, + 0x8235, 0x0b29, + 0x8236, 0x0d2b, + 0x8237, 0x0773, + 0x8238, 0x18a2, + 0x8239, 0x0aa7, + 0x8240, 0x18a4, + 0x8247, 0x0c16, + 0x8258, 0x18a6, + 0x8259, 0x18a5, + 0x825a, 0x18a8, + 0x825d, 0x18a7, + 0x825f, 0x18a9, + 0x8262, 0x18ab, + 0x8264, 0x18aa, + 0x8266, 0x060b, + 0x8268, 0x18ac, + 0x826a, 0x18ad, + 0x826e, 0x0821, + 0x826f, 0x0f91, + 0x8271, 0x18b0, + 0x8272, 0x09ed, + 0x8276, 0x0512, + 0x8277, 0x18b1, + 0x827e, 0x18b3, + 0x828b, 0x04b6, + 0x828d, 0x18b4, + 0x8292, 0x18b5, + 0x8299, 0x0dd9, + 0x829d, 0x08f3, + 0x829f, 0x18b7, + 0x82a5, 0x0587, + 0x82a6, 0x0476, + 0x82ab, 0x18b6, + 0x82ac, 0x18b9, + 0x82ad, 0x0d04, + 0x82af, 0x0a0a, + 0x82b1, 0x0556, + 0x82b3, 0x0e55, + 0x82b8, 0x0733, + 0x82b9, 0x06d4, + 0x82bb, 0x18b8, + 0x82bd, 0x056a, + 0x82c5, 0x05df, + 0x82d1, 0x0513, + 0x82d2, 0x18bd, + 0x82d3, 0x0fb2, + 0x82d4, 0x0b3d, + 0x82d7, 0x0db6, + 0x82d9, 0x18c9, + 0x82db, 0x0557, + 0x82dc, 0x18c7, + 0x82de, 0x18c5, + 0x82df, 0x18bc, + 0x82e1, 0x18ba, + 0x82e3, 0x18bb, + 0x82e5, 0x090f, + 0x82e6, 0x06e4, + 0x82e7, 0x0bb5, + 0x82eb, 0x0ca9, + 0x82f1, 0x04f3, + 0x82f3, 0x18bf, + 0x82f4, 0x18be, + 0x82f9, 0x18c4, + 0x82fa, 0x18c0, + 0x82fb, 0x18c3, + 0x8301, 0x2198, + 0x8302, 0x0edc, + 0x8303, 0x18c2, + 0x8304, 0x0558, + 0x8305, 0x05db, + 0x8306, 0x18c6, + 0x8309, 0x18c8, + 0x830e, 0x072a, + 0x8316, 0x18cc, + 0x8317, 0x18d5, + 0x831c, 0x046f, + 0x8323, 0x18dd, + 0x8328, 0x04b5, + 0x832b, 0x18d4, + 0x832f, 0x18d3, + 0x8331, 0x18ce, + 0x8332, 0x18cd, + 0x8334, 0x18cb, + 0x8335, 0x18ca, + 0x8336, 0x0ba1, + 0x8338, 0x0b5b, + 0x8339, 0x18d0, + 0x8340, 0x18cf, + 0x8345, 0x18d2, + 0x8349, 0x0af2, + 0x834a, 0x072b, + 0x834f, 0x04e3, + 0x8350, 0x18d1, + 0x8352, 0x07e5, + 0x8358, 0x0af3, + 0x8362, 0x2199, + 0x8373, 0x18e3, + 0x8375, 0x18e4, + 0x8377, 0x0559, + 0x837b, 0x052e, + 0x837c, 0x18e1, + 0x837f, 0x219a, + 0x8385, 0x18d7, + 0x8387, 0x18df, + 0x8389, 0x18e6, + 0x838a, 0x18e0, + 0x838e, 0x18de, + 0x8393, 0x18c1, + 0x8396, 0x18dc, + 0x839a, 0x18d8, + 0x839e, 0x060c, + 0x839f, 0x18da, + 0x83a0, 0x18e5, + 0x83a2, 0x18db, + 0x83a8, 0x18e7, + 0x83aa, 0x18d9, + 0x83ab, 0x0d32, + 0x83b1, 0x0f53, + 0x83b5, 0x18e2, + 0x83bd, 0x18f8, + 0x83c1, 0x18f0, + 0x83c5, 0x0a41, + 0x83c7, 0x219b, + 0x83ca, 0x0660, + 0x83cc, 0x06d5, + 0x83ce, 0x18eb, + 0x83d3, 0x055b, + 0x83d6, 0x09bc, + 0x83d8, 0x18ee, + 0x83dc, 0x084a, + 0x83df, 0x0c4b, + 0x83e0, 0x18f3, + 0x83e9, 0x0e3e, + 0x83eb, 0x18ea, + 0x83ef, 0x055a, + 0x83f0, 0x078a, + 0x83f1, 0x0d9b, + 0x83f2, 0x18f4, + 0x83f4, 0x18e8, + 0x83f6, 0x219c, + 0x83f7, 0x18f1, + 0x83fb, 0x18fb, + 0x83fd, 0x18ec, + 0x8403, 0x18ed, + 0x8404, 0x0c92, + 0x8407, 0x18f2, + 0x840a, 0x1e7f, + 0x840b, 0x18ef, + 0x840c, 0x0e56, + 0x840d, 0x18f5, + 0x840e, 0x04a4, + 0x8413, 0x18e9, + 0x8420, 0x18f7, + 0x8422, 0x18f6, + 0x8429, 0x0d21, + 0x842a, 0x18fd, + 0x842c, 0x1908, + 0x8431, 0x05dc, + 0x8435, 0x190b, + 0x8438, 0x18f9, + 0x843c, 0x18fe, + 0x843d, 0x0f58, + 0x8446, 0x1907, + 0x8448, 0x219d, + 0x8449, 0x0f3f, + 0x844e, 0x0f72, + 0x8457, 0x0bb6, + 0x845b, 0x05c9, + 0x8461, 0x0de4, + 0x8462, 0x190d, + 0x8463, 0x0c79, + 0x8466, 0x0475, + 0x8469, 0x1906, + 0x846b, 0x1902, + 0x846c, 0x0af4, + 0x846d, 0x18fc, + 0x846e, 0x1904, + 0x846f, 0x1909, + 0x8471, 0x0ce2, + 0x8475, 0x046e, + 0x8477, 0x1901, + 0x8479, 0x190a, + 0x847a, 0x0dea, + 0x8482, 0x1905, + 0x8484, 0x1900, + 0x848b, 0x09bd, + 0x8490, 0x0939, + 0x8494, 0x08d8, + 0x8499, 0x0ee4, + 0x849c, 0x0db9, + 0x849f, 0x1910, + 0x84a1, 0x1919, + 0x84ad, 0x1903, + 0x84b2, 0x05d5, + 0x84b4, 0x219e, + 0x84b8, 0x09e0, + 0x84b9, 0x190e, + 0x84bb, 0x1913, + 0x84bc, 0x0af5, + 0x84bf, 0x190f, + 0x84c1, 0x1916, + 0x84c4, 0x0b9d, + 0x84c6, 0x1917, + 0x84c9, 0x0f40, + 0x84ca, 0x190c, + 0x84cb, 0x0596, + 0x84cd, 0x1912, + 0x84d0, 0x1915, + 0x84d1, 0x0eb8, + 0x84d6, 0x1918, + 0x84d9, 0x1911, + 0x84da, 0x1914, + 0x84dc, 0x20ab, + 0x84ec, 0x0e57, + 0x84ee, 0x0fc7, + 0x84f4, 0x191c, + 0x84fc, 0x1923, + 0x84ff, 0x191b, + 0x8500, 0x08ef, + 0x8506, 0x18fa, + 0x8511, 0x0e1e, + 0x8513, 0x0eae, + 0x8514, 0x1922, + 0x8515, 0x1921, + 0x8517, 0x191d, + 0x851a, 0x04d8, + 0x851f, 0x1920, + 0x8521, 0x191a, + 0x8523, 0x1e1a, + 0x8526, 0x0bf1, + 0x852c, 0x191f, + 0x852d, 0x04c2, + 0x8535, 0x0b02, + 0x853d, 0x0e13, + 0x853e, 0x1eb5, + 0x8540, 0x1924, + 0x8541, 0x1928, + 0x8543, 0x0d6d, + 0x8548, 0x1927, + 0x8549, 0x09be, + 0x854a, 0x08f5, + 0x854b, 0x192a, + 0x854e, 0x06b6, + 0x8553, 0x219f, + 0x8555, 0x192b, + 0x8557, 0x0deb, + 0x8558, 0x1926, + 0x8559, 0x21a0, + 0x855a, 0x18ff, + 0x8563, 0x1925, + 0x8568, 0x0ff5, + 0x8569, 0x0c7a, + 0x856a, 0x0de5, + 0x856b, 0x21a1, + 0x856d, 0x1932, + 0x8577, 0x1938, + 0x857e, 0x1939, + 0x8580, 0x192c, + 0x8584, 0x0d2c, + 0x8587, 0x1936, + 0x8588, 0x192e, + 0x858a, 0x1930, + 0x8590, 0x193a, + 0x8591, 0x192f, + 0x8594, 0x1933, + 0x8597, 0x0514, + 0x8599, 0x0cbd, + 0x859b, 0x1934, + 0x859c, 0x1937, + 0x85a4, 0x192d, + 0x85a6, 0x0aa8, + 0x85a8, 0x1931, + 0x85a9, 0x0875, + 0x85aa, 0x0a0b, + 0x85ab, 0x0706, + 0x85ac, 0x0f00, + 0x85ae, 0x0f05, + 0x85af, 0x097c, + 0x85b0, 0x21a3, + 0x85b9, 0x193e, + 0x85ba, 0x193c, + 0x85c1, 0x0ff4, + 0x85c9, 0x193b, + 0x85cd, 0x0f5f, + 0x85cf, 0x193d, + 0x85d0, 0x193f, + 0x85d5, 0x1940, + 0x85dc, 0x1943, + 0x85dd, 0x1941, + 0x85e4, 0x0c7b, + 0x85e5, 0x1942, + 0x85e9, 0x0d61, + 0x85ea, 0x1935, + 0x85f7, 0x097d, + 0x85f9, 0x1944, + 0x85fa, 0x1949, + 0x85fb, 0x0af6, + 0x85fe, 0x1948, + 0x8602, 0x1929, + 0x8606, 0x194a, + 0x8607, 0x0acb, + 0x860a, 0x1945, + 0x860b, 0x1947, + 0x8613, 0x1946, + 0x8616, 0x14d0, + 0x8617, 0x14c1, + 0x861a, 0x194c, + 0x8622, 0x194b, + 0x862d, 0x0f60, + 0x862f, 0x16b1, + 0x8630, 0x194d, + 0x863f, 0x194e, + 0x864d, 0x194f, + 0x864e, 0x078b, + 0x8650, 0x066e, + 0x8654, 0x1951, + 0x8655, 0x1094, + 0x865a, 0x068f, + 0x865c, 0x0f82, + 0x865e, 0x06eb, + 0x865f, 0x1952, + 0x8667, 0x1953, + 0x866b, 0x0bac, + 0x8671, 0x1954, + 0x8679, 0x0cd2, + 0x867b, 0x047e, + 0x868a, 0x0563, + 0x868b, 0x1959, + 0x8693, 0x1955, + 0x8695, 0x088b, + 0x86a3, 0x1956, + 0x86a4, 0x0cf8, + 0x86a9, 0x1957, + 0x86ab, 0x1962, + 0x86af, 0x195c, + 0x86b0, 0x195f, + 0x86b6, 0x195b, + 0x86c4, 0x195d, + 0x86c6, 0x195e, + 0x86c7, 0x0904, + 0x86c9, 0x1960, + 0x86cb, 0x0b7f, + 0x86cd, 0x072c, + 0x86ce, 0x05a0, + 0x86d4, 0x1963, + 0x86d9, 0x059d, + 0x86db, 0x1968, + 0x86de, 0x1964, + 0x86df, 0x1967, + 0x86e4, 0x0d4e, + 0x86e9, 0x1965, + 0x86ec, 0x1966, + 0x86ed, 0x0dba, + 0x86ee, 0x0d6e, + 0x86ef, 0x1969, + 0x86f8, 0x0b5d, + 0x86f9, 0x1973, + 0x86fb, 0x196f, + 0x86fe, 0x056b, + 0x8700, 0x196d, + 0x8702, 0x0e58, + 0x8703, 0x196e, + 0x8706, 0x196b, + 0x8708, 0x196c, + 0x8709, 0x1971, + 0x870a, 0x1974, + 0x870d, 0x1972, + 0x8711, 0x1970, + 0x8712, 0x196a, + 0x8718, 0x0b96, + 0x871a, 0x197b, + 0x871c, 0x0eb6, + 0x8725, 0x1979, + 0x8729, 0x197a, + 0x8734, 0x1975, + 0x8737, 0x1977, + 0x873b, 0x1978, + 0x873f, 0x1976, + 0x8749, 0x0a8a, + 0x874b, 0x0fdf, + 0x874c, 0x197f, + 0x874e, 0x1980, + 0x8753, 0x1986, + 0x8755, 0x09f0, + 0x8757, 0x1982, + 0x8759, 0x1985, + 0x875f, 0x197d, + 0x8760, 0x197c, + 0x8763, 0x1987, + 0x8766, 0x055c, + 0x8768, 0x1983, + 0x876a, 0x1988, + 0x876e, 0x1984, + 0x8774, 0x1981, + 0x8776, 0x0bcf, + 0x8778, 0x197e, + 0x877f, 0x0d1e, + 0x8782, 0x198c, + 0x878d, 0x0f25, + 0x879f, 0x198b, + 0x87a2, 0x198a, + 0x87ab, 0x1993, + 0x87af, 0x198d, + 0x87b3, 0x1995, + 0x87ba, 0x0f50, + 0x87bb, 0x1998, + 0x87bd, 0x198f, + 0x87c0, 0x1990, + 0x87c4, 0x1994, + 0x87c6, 0x1997, + 0x87c7, 0x1996, + 0x87cb, 0x198e, + 0x87d0, 0x1991, + 0x87d2, 0x19a2, + 0x87e0, 0x199b, + 0x87ec, 0x1e23, + 0x87ef, 0x1999, + 0x87f2, 0x199a, + 0x87f6, 0x199f, + 0x87f9, 0x0588, + 0x87fb, 0x065c, + 0x87fe, 0x199e, + 0x8805, 0x1989, + 0x8807, 0x21a6, + 0x880d, 0x199d, + 0x880e, 0x19a1, + 0x880f, 0x199c, + 0x8811, 0x19a3, + 0x8815, 0x19a5, + 0x8816, 0x19a4, + 0x881f, 0x1e85, + 0x8821, 0x19a7, + 0x8822, 0x19a6, + 0x8823, 0x1961, + 0x8827, 0x19ab, + 0x8831, 0x19a8, + 0x8836, 0x19a9, + 0x8839, 0x19aa, + 0x883b, 0x19ac, + 0x8840, 0x0742, + 0x8842, 0x19ae, + 0x8844, 0x19ad, + 0x8846, 0x093a, + 0x884c, 0x07e6, + 0x884d, 0x1524, + 0x8852, 0x19af, + 0x8853, 0x095b, + 0x8857, 0x0597, + 0x8859, 0x19b0, + 0x885b, 0x04f4, + 0x885d, 0x09bf, + 0x885e, 0x19b1, + 0x8861, 0x07e7, + 0x8862, 0x19b2, + 0x8863, 0x04a5, + 0x8868, 0x0daf, + 0x886b, 0x19b3, + 0x8870, 0x0a30, + 0x8872, 0x19ba, + 0x8875, 0x19b7, + 0x8877, 0x0bad, + 0x887d, 0x19b8, + 0x887e, 0x19b5, + 0x887f, 0x06d6, + 0x8881, 0x19b4, + 0x8882, 0x19bb, + 0x8888, 0x070c, + 0x888b, 0x0b3e, + 0x888d, 0x19c1, + 0x8892, 0x19bd, + 0x8896, 0x0b15, + 0x8897, 0x19bc, + 0x8899, 0x19bf, + 0x889e, 0x19b6, + 0x88a2, 0x19c0, + 0x88a4, 0x19c2, + 0x88ab, 0x0d83, + 0x88ae, 0x19be, + 0x88b0, 0x19c3, + 0x88b1, 0x19c5, + 0x88b4, 0x0787, + 0x88b5, 0x19b9, + 0x88b7, 0x0485, + 0x88bf, 0x19c4, + 0x88c1, 0x084b, + 0x88c2, 0x0fbe, + 0x88c3, 0x19c6, + 0x88c5, 0x0af7, + 0x88cf, 0x0f6a, + 0x88d4, 0x19c8, + 0x88d5, 0x0f1f, + 0x88d8, 0x19c9, + 0x88dc, 0x0e34, + 0x88dd, 0x19cb, + 0x88df, 0x0830, + 0x88e1, 0x0f6b, + 0x88e8, 0x19d0, + 0x88f2, 0x19d1, + 0x88f3, 0x09c0, + 0x88f4, 0x19cf, + 0x88f5, 0x21a7, + 0x88f8, 0x0f51, + 0x88f9, 0x19cc, + 0x88fc, 0x19ce, + 0x88fd, 0x0a61, + 0x88fe, 0x0a44, + 0x8902, 0x19cd, + 0x8904, 0x19d2, + 0x8907, 0x0df3, + 0x890a, 0x19d4, + 0x890c, 0x19d3, + 0x8910, 0x05ca, + 0x8912, 0x0e59, + 0x8913, 0x19d5, + 0x891c, 0x20a8, + 0x891d, 0x19e1, + 0x891e, 0x19d7, + 0x8925, 0x19d8, + 0x892a, 0x19d9, + 0x8936, 0x19de, + 0x8938, 0x19df, + 0x893b, 0x19dd, + 0x8941, 0x19db, + 0x8943, 0x19d6, + 0x8944, 0x19dc, + 0x894c, 0x19e0, + 0x894d, 0x1bd0, + 0x8956, 0x0528, + 0x895e, 0x19e3, + 0x895f, 0x06d7, + 0x8960, 0x19e2, + 0x8964, 0x19e5, + 0x8966, 0x19e4, + 0x896a, 0x19e7, + 0x896d, 0x19e6, + 0x896f, 0x19e8, + 0x8972, 0x093b, + 0x8974, 0x19e9, + 0x8977, 0x19ea, + 0x897e, 0x19eb, + 0x897f, 0x0a62, + 0x8981, 0x0f41, + 0x8983, 0x19ec, + 0x8986, 0x0df4, + 0x8987, 0x0cfc, + 0x8988, 0x19ed, + 0x898a, 0x19ee, + 0x898b, 0x075f, + 0x898f, 0x0646, + 0x8993, 0x19ef, + 0x8996, 0x08b9, + 0x8997, 0x0cf7, + 0x8998, 0x19f0, + 0x899a, 0x05ae, + 0x89a1, 0x19f1, + 0x89a6, 0x19f3, + 0x89a7, 0x0f61, + 0x89a9, 0x19f2, + 0x89aa, 0x0a0c, + 0x89ac, 0x19f4, + 0x89af, 0x19f5, + 0x89b2, 0x19f6, + 0x89b3, 0x060d, + 0x89ba, 0x19f7, + 0x89bd, 0x19f8, + 0x89bf, 0x19f9, + 0x89d2, 0x05af, + 0x89da, 0x19fb, + 0x89dc, 0x19fc, + 0x89e3, 0x0572, + 0x89e6, 0x09ee, + 0x89e7, 0x19fe, + 0x89f4, 0x19ff, + 0x89f8, 0x1a00, + 0x8a00, 0x0774, + 0x8a02, 0x0c17, + 0x8a03, 0x1a01, + 0x8a08, 0x072d, + 0x8a0a, 0x0a1c, + 0x8a0c, 0x1a04, + 0x8a0e, 0x0c7c, + 0x8a10, 0x1a03, + 0x8a12, 0x21a8, + 0x8a13, 0x0707, + 0x8a16, 0x1a02, + 0x8a17, 0x0b57, + 0x8a18, 0x0647, + 0x8a1b, 0x1a05, + 0x8a1d, 0x1a06, + 0x8a1f, 0x09c1, + 0x8a23, 0x0743, + 0x8a25, 0x1a07, + 0x8a2a, 0x0e5a, + 0x8a2d, 0x0a83, + 0x8a31, 0x0690, + 0x8a33, 0x0f01, + 0x8a34, 0x0acc, + 0x8a36, 0x1a08, + 0x8a37, 0x21a9, + 0x8a3a, 0x0a0d, + 0x8a3b, 0x0bae, + 0x8a3c, 0x09c2, + 0x8a41, 0x1a09, + 0x8a46, 0x1a0c, + 0x8a48, 0x1a0d, + 0x8a50, 0x082e, + 0x8a51, 0x0b22, + 0x8a52, 0x1a0b, + 0x8a54, 0x09c3, + 0x8a55, 0x0db0, + 0x8a5b, 0x1a0a, + 0x8a5e, 0x08ba, + 0x8a60, 0x04f5, + 0x8a62, 0x1a11, + 0x8a63, 0x072e, + 0x8a66, 0x08bc, + 0x8a69, 0x08bb, + 0x8a6b, 0x0ff3, + 0x8a6c, 0x1a10, + 0x8a6d, 0x1a0f, + 0x8a6e, 0x0aa9, + 0x8a70, 0x0667, + 0x8a71, 0x0fe9, + 0x8a72, 0x0598, + 0x8a73, 0x09c4, + 0x8a79, 0x21aa, + 0x8a7c, 0x1a0e, + 0x8a82, 0x1a13, + 0x8a84, 0x1a14, + 0x8a85, 0x1a12, + 0x8a87, 0x078c, + 0x8a89, 0x0f2a, + 0x8a8c, 0x08bd, + 0x8a8d, 0x0cdd, + 0x8a91, 0x1a17, + 0x8a93, 0x0a64, + 0x8a95, 0x0b80, + 0x8a98, 0x0f20, + 0x8a9a, 0x1a1a, + 0x8a9e, 0x07a0, + 0x8aa0, 0x0a63, + 0x8aa1, 0x1a16, + 0x8aa3, 0x1a1b, + 0x8aa4, 0x07a1, + 0x8aa5, 0x1a18, + 0x8aa7, 0x21ab, + 0x8aa8, 0x1a15, + 0x8aac, 0x0a86, + 0x8aad, 0x0ca1, + 0x8ab0, 0x0b6d, + 0x8ab2, 0x055d, + 0x8ab9, 0x0d84, + 0x8abc, 0x065d, + 0x8abe, 0x21ac, + 0x8abf, 0x0bd0, + 0x8ac2, 0x1a1e, + 0x8ac4, 0x1a1c, + 0x8ac7, 0x0b8a, + 0x8acb, 0x0a65, + 0x8acc, 0x060e, + 0x8acd, 0x1a1d, + 0x8acf, 0x0a21, + 0x8ad2, 0x0f92, + 0x8ad6, 0x0fe6, + 0x8ada, 0x1a1f, + 0x8adb, 0x1a2a, + 0x8adc, 0x0bd1, + 0x8ade, 0x1a29, + 0x8adf, 0x21ad, + 0x8ae0, 0x1a26, + 0x8ae1, 0x1a2e, + 0x8ae2, 0x1a27, + 0x8ae4, 0x1a23, + 0x8ae6, 0x0c18, + 0x8ae7, 0x1a22, + 0x8aeb, 0x1a20, + 0x8aed, 0x0f0b, + 0x8aee, 0x08be, + 0x8af1, 0x1a24, + 0x8af3, 0x1a21, + 0x8af6, 0x21af, + 0x8af7, 0x1a28, + 0x8af8, 0x097e, + 0x8afa, 0x0775, + 0x8afe, 0x0b5a, + 0x8b00, 0x0e73, + 0x8b01, 0x04fc, + 0x8b02, 0x04a6, + 0x8b04, 0x0c7d, + 0x8b07, 0x1a2c, + 0x8b0c, 0x1a2b, + 0x8b0e, 0x0cbe, + 0x8b10, 0x1a30, + 0x8b14, 0x1a25, + 0x8b16, 0x1a2f, + 0x8b17, 0x1a31, + 0x8b19, 0x0760, + 0x8b1a, 0x1a2d, + 0x8b1b, 0x07e8, + 0x8b1d, 0x0901, + 0x8b20, 0x1a32, + 0x8b21, 0x0f42, + 0x8b26, 0x1a35, + 0x8b28, 0x1a38, + 0x8b2b, 0x1a36, + 0x8b2c, 0x0da7, + 0x8b33, 0x1a33, + 0x8b39, 0x06d8, + 0x8b3e, 0x1a37, + 0x8b41, 0x1a39, + 0x8b49, 0x1a3d, + 0x8b4c, 0x1a3a, + 0x8b4e, 0x1a3c, + 0x8b4f, 0x1a3b, + 0x8b53, 0x21b0, + 0x8b56, 0x1a3e, + 0x8b58, 0x08dd, + 0x8b5a, 0x1a40, + 0x8b5b, 0x1a3f, + 0x8b5c, 0x0dda, + 0x8b5f, 0x1a42, + 0x8b66, 0x072f, + 0x8b6b, 0x1a41, + 0x8b6c, 0x1a43, + 0x8b6f, 0x1a44, + 0x8b70, 0x065e, + 0x8b71, 0x182e, + 0x8b72, 0x09e1, + 0x8b74, 0x1a45, + 0x8b77, 0x07a2, + 0x8b7d, 0x1a46, + 0x8b7f, 0x21b1, + 0x8b80, 0x1a47, + 0x8b83, 0x088c, + 0x8b8a, 0x13d3, + 0x8b8c, 0x1a48, + 0x8b8e, 0x1a49, + 0x8b90, 0x093c, + 0x8b92, 0x1a4a, + 0x8b96, 0x1a4c, + 0x8b99, 0x1a4d, + 0x8c37, 0x0b69, + 0x8c3a, 0x1a4f, + 0x8c3f, 0x1a51, + 0x8c41, 0x1a50, + 0x8c46, 0x0c7e, + 0x8c48, 0x1a52, + 0x8c4a, 0x0e5b, + 0x8c4c, 0x1a53, + 0x8c4e, 0x1a54, + 0x8c50, 0x1a55, + 0x8c55, 0x1a56, + 0x8c5a, 0x0cb2, + 0x8c61, 0x09c5, + 0x8c62, 0x1a57, + 0x8c6a, 0x07fd, + 0x8c6b, 0x1007, + 0x8c6c, 0x1a58, + 0x8c78, 0x1a59, + 0x8c79, 0x0db1, + 0x8c7a, 0x1a5a, + 0x8c7c, 0x1a62, + 0x8c82, 0x1a5b, + 0x8c85, 0x1a5d, + 0x8c89, 0x1a5c, + 0x8c8a, 0x1a5e, + 0x8c8c, 0x0e74, + 0x8c8d, 0x1a5f, + 0x8c94, 0x1a61, + 0x8c98, 0x1a63, + 0x8c9d, 0x058b, + 0x8c9e, 0x0c03, + 0x8ca0, 0x0ddb, + 0x8ca1, 0x0852, + 0x8ca2, 0x07e9, + 0x8ca7, 0x0dc1, + 0x8ca8, 0x055f, + 0x8ca9, 0x0d62, + 0x8caa, 0x1a66, + 0x8cab, 0x060f, + 0x8cac, 0x0a79, + 0x8cad, 0x1a65, + 0x8cae, 0x1a6a, + 0x8caf, 0x0bb7, + 0x8cb0, 0x0eef, + 0x8cb2, 0x1a68, + 0x8cb4, 0x0648, + 0x8cb6, 0x1a6b, + 0x8cb7, 0x0d19, + 0x8cb8, 0x0b3f, + 0x8cbb, 0x0d85, + 0x8cbc, 0x0c37, + 0x8cbd, 0x1a67, + 0x8cbf, 0x0e75, + 0x8cc0, 0x056c, + 0x8cc1, 0x1a6d, + 0x8cc2, 0x0fce, + 0x8cc3, 0x0bde, + 0x8cc4, 0x0feb, + 0x8cc7, 0x08bf, + 0x8cc8, 0x1a6c, + 0x8cca, 0x0b11, + 0x8ccd, 0x1a7d, + 0x8cce, 0x0aaa, + 0x8cd1, 0x0cd0, + 0x8cd3, 0x0dc2, + 0x8cda, 0x1a70, + 0x8cdb, 0x088d, + 0x8cdc, 0x08c0, + 0x8cde, 0x09c6, + 0x8ce0, 0x0d1b, + 0x8ce2, 0x0761, + 0x8ce3, 0x1a6f, + 0x8ce4, 0x1a6e, + 0x8ce6, 0x0ddc, + 0x8cea, 0x08ed, + 0x8ced, 0x0c4c, + 0x8cf0, 0x21b2, + 0x8cf4, 0x21b3, + 0x8cfa, 0x1a72, + 0x8cfc, 0x07ea, + 0x8cfd, 0x1a71, + 0x8d04, 0x1a74, + 0x8d07, 0x1a77, + 0x8d08, 0x0b03, + 0x8d0a, 0x1a76, + 0x8d0b, 0x0622, + 0x8d0d, 0x1a79, + 0x8d0f, 0x1a78, + 0x8d10, 0x1a7a, + 0x8d12, 0x21b4, + 0x8d13, 0x1a7c, + 0x8d14, 0x1a7e, + 0x8d16, 0x1a7f, + 0x8d64, 0x0a7a, + 0x8d66, 0x08fb, + 0x8d67, 0x1a80, + 0x8d6b, 0x05b0, + 0x8d6d, 0x1a81, + 0x8d70, 0x0af8, + 0x8d71, 0x1a82, + 0x8d73, 0x1a83, + 0x8d74, 0x0ddd, + 0x8d76, 0x21b5, + 0x8d77, 0x0649, + 0x8d81, 0x1a84, + 0x8d85, 0x0bd2, + 0x8d8a, 0x04fd, + 0x8d99, 0x1a85, + 0x8da3, 0x091d, + 0x8da8, 0x0a3c, + 0x8db3, 0x0b0d, + 0x8dba, 0x1a88, + 0x8dbe, 0x1a87, + 0x8dc2, 0x1a86, + 0x8dcb, 0x1a8e, + 0x8dcc, 0x1a8c, + 0x8dcf, 0x1a89, + 0x8dd6, 0x1a8b, + 0x8dda, 0x1a8a, + 0x8ddb, 0x1a8d, + 0x8ddd, 0x0691, + 0x8ddf, 0x1a91, + 0x8de1, 0x0a7b, + 0x8de3, 0x1a92, + 0x8de8, 0x078d, + 0x8dea, 0x1a8f, + 0x8def, 0x0fcf, + 0x8df3, 0x0bd3, + 0x8df5, 0x0aab, + 0x8dfc, 0x1a93, + 0x8dff, 0x1a96, + 0x8e08, 0x1a94, + 0x8e0a, 0x0f43, + 0x8e0f, 0x0c7f, + 0x8e10, 0x1a99, + 0x8e1d, 0x1a97, + 0x8e1f, 0x1a9a, + 0x8e2a, 0x1aa8, + 0x8e30, 0x1a9d, + 0x8e34, 0x1a9e, + 0x8e35, 0x1a9c, + 0x8e42, 0x1a9b, + 0x8e44, 0x0c19, + 0x8e47, 0x1aa0, + 0x8e48, 0x1aa4, + 0x8e49, 0x1aa1, + 0x8e4a, 0x1a9f, + 0x8e4c, 0x1aa2, + 0x8e50, 0x1aa3, + 0x8e55, 0x1aaa, + 0x8e59, 0x1aa5, + 0x8e5f, 0x0a7c, + 0x8e60, 0x1aa7, + 0x8e63, 0x1aa9, + 0x8e64, 0x1aa6, + 0x8e72, 0x1aac, + 0x8e74, 0x093d, + 0x8e76, 0x1aab, + 0x8e7c, 0x1aad, + 0x8e81, 0x1aae, + 0x8e84, 0x1ab1, + 0x8e85, 0x1ab0, + 0x8e87, 0x1aaf, + 0x8e8a, 0x1ab3, + 0x8e8b, 0x1ab2, + 0x8e8d, 0x0f02, + 0x8e91, 0x1ab5, + 0x8e93, 0x1ab4, + 0x8e94, 0x1ab6, + 0x8e99, 0x1ab7, + 0x8ea1, 0x1ab9, + 0x8eaa, 0x1ab8, + 0x8eab, 0x0a0e, + 0x8eac, 0x1aba, + 0x8eaf, 0x06e5, + 0x8eb0, 0x1abb, + 0x8eb1, 0x1abd, + 0x8ebe, 0x1abe, + 0x8ec0, 0x1def, + 0x8ec5, 0x1abf, + 0x8ec6, 0x1abc, + 0x8ec8, 0x1ac0, + 0x8eca, 0x0902, + 0x8ecb, 0x1ac1, + 0x8ecc, 0x064a, + 0x8ecd, 0x0709, + 0x8ecf, 0x21b7, + 0x8ed2, 0x0762, + 0x8edb, 0x1ac2, + 0x8edf, 0x0cc8, + 0x8ee2, 0x0c38, + 0x8ee3, 0x1ac3, + 0x8eeb, 0x1ac6, + 0x8ef8, 0x08e0, + 0x8efb, 0x1ac5, + 0x8efc, 0x1ac4, + 0x8efd, 0x0730, + 0x8efe, 0x1ac7, + 0x8f03, 0x05b1, + 0x8f05, 0x1ac9, + 0x8f09, 0x084c, + 0x8f0a, 0x1ac8, + 0x8f0c, 0x1ad1, + 0x8f12, 0x1acb, + 0x8f13, 0x1acd, + 0x8f14, 0x0e35, + 0x8f15, 0x1aca, + 0x8f19, 0x1acc, + 0x8f1b, 0x1ad0, + 0x8f1c, 0x1ace, + 0x8f1d, 0x064b, + 0x8f1f, 0x1acf, + 0x8f26, 0x1ad2, + 0x8f29, 0x0d10, + 0x8f2a, 0x0fa0, + 0x8f2f, 0x093e, + 0x8f33, 0x1ad3, + 0x8f38, 0x0f0c, + 0x8f39, 0x1ad5, + 0x8f3b, 0x1ad4, + 0x8f3e, 0x1ad8, + 0x8f3f, 0x0f2b, + 0x8f42, 0x1ad7, + 0x8f44, 0x05cb, + 0x8f45, 0x1ad6, + 0x8f46, 0x1adb, + 0x8f49, 0x1ada, + 0x8f4c, 0x1ad9, + 0x8f4d, 0x0c2c, + 0x8f4e, 0x1adc, + 0x8f57, 0x1add, + 0x8f5c, 0x1ade, + 0x8f5f, 0x07fe, + 0x8f61, 0x06fb, + 0x8f62, 0x1adf, + 0x8f9b, 0x0a0f, + 0x8f9c, 0x1ae2, + 0x8f9e, 0x08d9, + 0x8f9f, 0x1ae3, + 0x8fa3, 0x1ae4, + 0x8fa7, 0x10b6, + 0x8fa8, 0x10b5, + 0x8fad, 0x1ae5, + 0x8fae, 0x17ff, + 0x8faf, 0x1ae6, + 0x8fb0, 0x0b62, + 0x8fb1, 0x09f1, + 0x8fb2, 0x0cf6, + 0x8fb7, 0x1ae7, + 0x8fba, 0x0e25, + 0x8fbb, 0x0bf0, + 0x8fbc, 0x0810, + 0x8fbf, 0x0b67, + 0x8fc2, 0x04cc, + 0x8fc4, 0x0ea6, + 0x8fc5, 0x0a1d, + 0x8fce, 0x0734, + 0x8fd1, 0x06d9, + 0x8fd4, 0x0e26, + 0x8fda, 0x1ae8, + 0x8fe2, 0x1aea, + 0x8fe5, 0x1ae9, + 0x8fe6, 0x0560, + 0x8fe9, 0x0cce, + 0x8fea, 0x1aeb, + 0x8feb, 0x0d2d, + 0x8fed, 0x0c2d, + 0x8fef, 0x1aec, + 0x8ff0, 0x095c, + 0x8ff4, 0x1aee, + 0x8ff7, 0x0ece, + 0x8ff8, 0x1afd, + 0x8ff9, 0x1af0, + 0x8ffd, 0x0be5, + 0x9000, 0x0b40, + 0x9001, 0x0af9, + 0x9003, 0x0c80, + 0x9005, 0x1aef, + 0x9006, 0x066f, + 0x900b, 0x1af8, + 0x900d, 0x1af5, + 0x900e, 0x1b02, + 0x900f, 0x0c81, + 0x9010, 0x0b9e, + 0x9011, 0x1af2, + 0x9013, 0x0c1a, + 0x9014, 0x0c4d, + 0x9015, 0x1af3, + 0x9016, 0x1af7, + 0x9017, 0x0a26, + 0x9019, 0x0d1d, + 0x901a, 0x0be8, + 0x901d, 0x0a66, + 0x901e, 0x1af6, + 0x901f, 0x0b0e, + 0x9020, 0x0b04, + 0x9021, 0x1af4, + 0x9022, 0x046d, + 0x9023, 0x0fc8, + 0x9027, 0x1af9, + 0x902e, 0x0b41, + 0x9031, 0x093f, + 0x9032, 0x0a10, + 0x9035, 0x1afb, + 0x9036, 0x1afa, + 0x9038, 0x04b3, + 0x9039, 0x1afc, + 0x903c, 0x0da1, + 0x903e, 0x1b04, + 0x9041, 0x0cb3, + 0x9042, 0x0a31, + 0x9045, 0x0b97, + 0x9047, 0x06f0, + 0x9049, 0x1b03, + 0x904a, 0x0f21, + 0x904b, 0x04e1, + 0x904d, 0x0e27, + 0x904e, 0x0561, + 0x904f, 0x1afe, + 0x9053, 0x0c93, + 0x9054, 0x0b61, + 0x9055, 0x04a7, + 0x9056, 0x1b05, + 0x9058, 0x1b06, + 0x9059, 0x1d34, + 0x905c, 0x0b1d, + 0x905e, 0x1b07, + 0x9060, 0x0515, + 0x9061, 0x0ace, + 0x9063, 0x0763, + 0x9065, 0x0f44, + 0x9067, 0x21ba, + 0x9068, 0x1b08, + 0x9069, 0x0c26, + 0x906d, 0x0afa, + 0x906e, 0x0903, + 0x906f, 0x1b09, + 0x9072, 0x1b0c, + 0x9075, 0x096f, + 0x9076, 0x1b0a, + 0x9077, 0x0aad, + 0x9078, 0x0aac, + 0x907a, 0x04a8, + 0x907c, 0x0f93, + 0x907d, 0x1b0e, + 0x907f, 0x0d86, + 0x9080, 0x1b10, + 0x9081, 0x1b0f, + 0x9082, 0x1b0d, + 0x9083, 0x1737, + 0x9084, 0x0610, + 0x9087, 0x1aed, + 0x9089, 0x1b12, + 0x908a, 0x1b11, + 0x908f, 0x1b13, + 0x9091, 0x0f22, + 0x90a3, 0x0cb9, + 0x90a6, 0x0e5c, + 0x90a8, 0x1b14, + 0x90aa, 0x0905, + 0x90af, 0x1b15, + 0x90b1, 0x1b16, + 0x90b5, 0x1b17, + 0x90b8, 0x0c1b, + 0x90c1, 0x04ae, + 0x90ca, 0x07eb, + 0x90ce, 0x0fe0, + 0x90db, 0x1b1b, + 0x90de, 0x21bb, + 0x90e1, 0x070a, + 0x90e2, 0x1b18, + 0x90e4, 0x1b19, + 0x90e8, 0x0de6, + 0x90ed, 0x05b2, + 0x90f5, 0x0f23, + 0x90f7, 0x06b7, + 0x90fd, 0x0c4e, + 0x9102, 0x1b1c, + 0x9112, 0x1b1d, + 0x9115, 0x21bd, + 0x9119, 0x1b1e, + 0x9127, 0x21be, + 0x912d, 0x0c1c, + 0x9130, 0x1b20, + 0x9132, 0x1b1f, + 0x9149, 0x0cab, + 0x914a, 0x1b21, + 0x914b, 0x0940, + 0x914c, 0x090c, + 0x914d, 0x0d11, + 0x914e, 0x0baf, + 0x9152, 0x091e, + 0x9154, 0x0a32, + 0x9156, 0x1b22, + 0x9158, 0x1b23, + 0x9162, 0x0a23, + 0x9163, 0x1b24, + 0x9165, 0x1b25, + 0x9169, 0x1b26, + 0x916a, 0x0f59, + 0x916c, 0x0941, + 0x9172, 0x1b28, + 0x9173, 0x1b27, + 0x9175, 0x07ec, + 0x9177, 0x0805, + 0x9178, 0x088e, + 0x9182, 0x1b2b, + 0x9187, 0x0970, + 0x9189, 0x1b2a, + 0x918b, 0x1b29, + 0x918d, 0x0b49, + 0x9190, 0x07a3, + 0x9192, 0x0a67, + 0x9197, 0x0d44, + 0x919c, 0x0943, + 0x91a2, 0x1b2c, + 0x91a4, 0x09c7, + 0x91aa, 0x1b2f, + 0x91ab, 0x1b2d, + 0x91ac, 0x1e1b, + 0x91af, 0x1b2e, + 0x91b1, 0x1e61, + 0x91b4, 0x1b31, + 0x91b5, 0x1b30, + 0x91b8, 0x09e2, + 0x91ba, 0x1b32, + 0x91c0, 0x1b33, + 0x91c6, 0x0d64, + 0x91c7, 0x0843, + 0x91c8, 0x090d, + 0x91c9, 0x1b35, + 0x91cb, 0x1b36, + 0x91cc, 0x0f6c, + 0x91cd, 0x094f, + 0x91ce, 0x0efa, + 0x91cf, 0x0f94, + 0x91d0, 0x1b37, + 0x91d1, 0x06da, + 0x91d6, 0x1b38, + 0x91d7, 0x21c0, + 0x91d8, 0x0c1d, + 0x91da, 0x21bf, + 0x91db, 0x1b3b, + 0x91dc, 0x05d6, + 0x91dd, 0x0a11, + 0x91de, 0x21c1, + 0x91df, 0x1b39, + 0x91e1, 0x1b3a, + 0x91e3, 0x0bfc, + 0x91e4, 0x21c4, + 0x91e6, 0x0e83, + 0x91e7, 0x06f4, + 0x91ed, 0x21c2, + 0x91f5, 0x1b3d, + 0x91fc, 0x1b3c, + 0x91ff, 0x1b40, + 0x9206, 0x21c6, + 0x920a, 0x21c8, + 0x920d, 0x0cb7, + 0x920e, 0x05a1, + 0x9210, 0x21c7, + 0x9211, 0x1b44, + 0x9214, 0x1b41, + 0x9215, 0x1b43, + 0x921e, 0x1b3f, + 0x9229, 0x1b8a, + 0x922c, 0x1b42, + 0x9234, 0x0fb3, + 0x9237, 0x078e, + 0x9239, 0x21cf, + 0x923a, 0x21c9, + 0x923c, 0x21cb, + 0x923f, 0x1b4c, + 0x9240, 0x21ca, + 0x9244, 0x0c2e, + 0x9245, 0x1b47, + 0x9248, 0x1b4a, + 0x9249, 0x1b48, + 0x924b, 0x1b4d, + 0x924e, 0x21cc, + 0x9250, 0x1b4e, + 0x9251, 0x21ce, + 0x9257, 0x1b46, + 0x9259, 0x21cd, + 0x925a, 0x1b53, + 0x925b, 0x0516, + 0x925e, 0x1b45, + 0x9262, 0x0d41, + 0x9264, 0x1b49, + 0x9266, 0x09c8, + 0x9267, 0x21d0, + 0x9271, 0x07ed, + 0x9277, 0x21d2, + 0x927e, 0x0e76, + 0x9280, 0x06dc, + 0x9283, 0x0950, + 0x9285, 0x0c94, + 0x9288, 0x20aa, + 0x9291, 0x0aaf, + 0x9293, 0x1b51, + 0x9295, 0x1b4b, + 0x9296, 0x1b50, + 0x9298, 0x0ecf, + 0x929a, 0x0bd4, + 0x929b, 0x1b52, + 0x929c, 0x1b4f, + 0x92a7, 0x21d1, + 0x92ad, 0x0aae, + 0x92b7, 0x1b56, + 0x92b9, 0x1b55, + 0x92cf, 0x1b54, + 0x92d0, 0x21d7, + 0x92d2, 0x0e5d, + 0x92d3, 0x21db, + 0x92d5, 0x21d9, + 0x92d7, 0x21d5, + 0x92d9, 0x21d6, + 0x92e0, 0x21da, + 0x92e4, 0x0985, + 0x92e7, 0x21d4, + 0x92e9, 0x1b57, + 0x92ea, 0x0e2f, + 0x92ed, 0x04f6, + 0x92f2, 0x0db8, + 0x92f3, 0x0bb0, + 0x92f8, 0x0692, + 0x92f9, 0x20b0, + 0x92fa, 0x1b59, + 0x92fb, 0x21de, + 0x92fc, 0x07ef, + 0x92ff, 0x21e1, + 0x9302, 0x21e3, + 0x9306, 0x087a, + 0x930f, 0x1b58, + 0x9310, 0x0a33, + 0x9318, 0x0a34, + 0x9319, 0x1b5c, + 0x931a, 0x1b5e, + 0x931d, 0x21e2, + 0x931e, 0x21e0, + 0x9320, 0x09e3, + 0x9321, 0x21dd, + 0x9322, 0x1b5d, + 0x9323, 0x1b5f, + 0x9325, 0x21dc, + 0x9326, 0x06cb, + 0x9328, 0x0db7, + 0x932b, 0x090e, + 0x932c, 0x0fc9, + 0x932e, 0x1b5b, + 0x932f, 0x0868, + 0x9332, 0x0fe5, + 0x9335, 0x1b61, + 0x933a, 0x1b60, + 0x933b, 0x1b62, + 0x9344, 0x1b5a, + 0x9348, 0x20a9, + 0x934b, 0x0cc1, + 0x934d, 0x0c4f, + 0x9354, 0x0bf3, + 0x9356, 0x1b67, + 0x9357, 0x21e5, + 0x935b, 0x0b81, + 0x935c, 0x1b63, + 0x9360, 0x1b64, + 0x936c, 0x0703, + 0x936e, 0x1b66, + 0x9370, 0x21e4, + 0x9375, 0x0764, + 0x937c, 0x1b65, + 0x937e, 0x09c9, + 0x938c, 0x05d7, + 0x9394, 0x1b6b, + 0x9396, 0x082f, + 0x9397, 0x0afb, + 0x939a, 0x0be6, + 0x93a4, 0x21e6, + 0x93a7, 0x0599, + 0x93ac, 0x1b69, + 0x93ae, 0x0bdf, + 0x93b0, 0x1b68, + 0x93b9, 0x1b6c, + 0x93c3, 0x1b72, + 0x93c6, 0x21e7, + 0x93c8, 0x1b75, + 0x93d0, 0x1b74, + 0x93d1, 0x0c27, + 0x93d6, 0x1b6d, + 0x93d8, 0x1b71, + 0x93dd, 0x1b73, + 0x93de, 0x21e8, + 0x93e1, 0x06b8, + 0x93e4, 0x1b76, + 0x93e5, 0x1b70, + 0x93e8, 0x1b6f, + 0x93f8, 0x21e9, + 0x9403, 0x1b7a, + 0x9407, 0x1b7b, + 0x9410, 0x1b7c, + 0x9413, 0x1b79, + 0x9414, 0x1b78, + 0x9418, 0x09ca, + 0x9419, 0x0c82, + 0x941a, 0x1b77, + 0x9421, 0x1b80, + 0x942b, 0x1b7e, + 0x9431, 0x21ea, + 0x9435, 0x1b7f, + 0x9436, 0x1b7d, + 0x9438, 0x0b58, + 0x943a, 0x1b81, + 0x9441, 0x1b82, + 0x9444, 0x1b84, + 0x9445, 0x21eb, + 0x9448, 0x21ec, + 0x9451, 0x0611, + 0x9452, 0x1b83, + 0x9453, 0x0f06, + 0x945a, 0x1b8f, + 0x945b, 0x1b85, + 0x945e, 0x1b88, + 0x9460, 0x1b86, + 0x9462, 0x1b87, + 0x946a, 0x1b89, + 0x9470, 0x1b8b, + 0x9475, 0x1b8c, + 0x9477, 0x1b8d, + 0x947c, 0x1b90, + 0x947d, 0x1b8e, + 0x947e, 0x1b91, + 0x947f, 0x1b93, + 0x9481, 0x1b92, + 0x9577, 0x0bd5, + 0x9580, 0x0ef3, + 0x9582, 0x1b94, + 0x9583, 0x0ab0, + 0x9587, 0x1b95, + 0x9589, 0x0e14, + 0x958a, 0x1b96, + 0x958b, 0x0589, + 0x958f, 0x04de, + 0x9591, 0x0613, + 0x9592, 0x21ed, + 0x9593, 0x0612, + 0x9594, 0x1b97, + 0x9596, 0x1b98, + 0x9598, 0x1b99, + 0x95a0, 0x1b9b, + 0x95a2, 0x0614, + 0x95a3, 0x05b3, + 0x95a4, 0x07f0, + 0x95a5, 0x0d4a, + 0x95a7, 0x1b9d, + 0x95a8, 0x1b9c, + 0x95ad, 0x1b9e, + 0x95b2, 0x04fe, + 0x95b9, 0x1ba1, + 0x95bb, 0x1ba0, + 0x95bc, 0x1b9f, + 0x95be, 0x1ba2, + 0x95c3, 0x1ba5, + 0x95c7, 0x048b, + 0x95ca, 0x1ba3, + 0x95cc, 0x1ba7, + 0x95cd, 0x1ba6, + 0x95d4, 0x1ba9, + 0x95d5, 0x1ba8, + 0x95d6, 0x1baa, + 0x95d8, 0x0c86, + 0x95dc, 0x1bab, + 0x95e1, 0x1bac, + 0x95e2, 0x1bae, + 0x95e5, 0x1bad, + 0x961c, 0x0dde, + 0x9621, 0x1baf, + 0x9628, 0x1bb0, + 0x962a, 0x0855, + 0x962e, 0x1bb1, + 0x9632, 0x0e77, + 0x963b, 0x0acd, + 0x963f, 0x0468, + 0x9640, 0x0b2b, + 0x9642, 0x1bb3, + 0x9644, 0x0ddf, + 0x964b, 0x1bb6, + 0x964c, 0x1bb4, + 0x964d, 0x07f1, + 0x964f, 0x1bb5, + 0x9650, 0x0776, + 0x965b, 0x0e15, + 0x965c, 0x1bb8, + 0x965d, 0x1bba, + 0x965e, 0x1bb9, + 0x965f, 0x1bbb, + 0x9662, 0x04c3, + 0x9663, 0x0a1e, + 0x9664, 0x0986, + 0x9665, 0x0615, + 0x9666, 0x1bbc, + 0x966a, 0x0d1c, + 0x966c, 0x1bbe, + 0x9670, 0x04c4, + 0x9672, 0x1bbd, + 0x9673, 0x0be0, + 0x9675, 0x0f95, + 0x9676, 0x0c83, + 0x9677, 0x1bb7, + 0x9678, 0x0f6e, + 0x967a, 0x0765, + 0x967d, 0x0f45, + 0x9685, 0x06f1, + 0x9686, 0x0f7c, + 0x9688, 0x06fe, + 0x968a, 0x0b42, + 0x968b, 0x186c, + 0x968d, 0x1bbf, + 0x968e, 0x058a, + 0x968f, 0x0a35, + 0x9694, 0x05b4, + 0x9695, 0x1bc1, + 0x9697, 0x1bc2, + 0x9698, 0x1bc0, + 0x9699, 0x073a, + 0x969b, 0x084d, + 0x969c, 0x09cb, + 0x969d, 0x21f0, + 0x96a0, 0x04c5, + 0x96a3, 0x0fa1, + 0x96a7, 0x1bc4, + 0x96a8, 0x1b0b, + 0x96aa, 0x1bc3, + 0x96af, 0x21f1, + 0x96b0, 0x1bc7, + 0x96b1, 0x1bc5, + 0x96b4, 0x1bc8, + 0x96b6, 0x1bc9, + 0x96b7, 0x0fb4, + 0x96b8, 0x1bca, + 0x96bb, 0x0a6d, + 0x96bc, 0x0d4f, + 0x96c0, 0x0a43, + 0x96c1, 0x0623, + 0x96c4, 0x0f24, + 0x96c5, 0x056d, + 0x96c6, 0x0942, + 0x96c7, 0x078f, + 0x96c9, 0x1bce, + 0x96cb, 0x1bcd, + 0x96cc, 0x08c1, + 0x96cd, 0x1bcf, + 0x96ce, 0x1bcc, + 0x96d1, 0x0876, + 0x96d5, 0x1bd3, + 0x96d6, 0x1992, + 0x96d9, 0x10eb, + 0x96db, 0x0a3d, + 0x96dc, 0x1bd1, + 0x96e2, 0x0f6d, + 0x96e3, 0x0cc9, + 0x96e8, 0x04cd, + 0x96ea, 0x0a87, + 0x96eb, 0x08e2, + 0x96f0, 0x0e07, + 0x96f2, 0x04e2, + 0x96f6, 0x0fb5, + 0x96f7, 0x0f55, + 0x96f9, 0x1bd4, + 0x96fb, 0x0c3f, + 0x9700, 0x0927, + 0x9704, 0x1bd5, + 0x9706, 0x1bd6, + 0x9707, 0x0a12, + 0x9708, 0x1bd7, + 0x970a, 0x0fb6, + 0x970d, 0x1bd2, + 0x970e, 0x1bd9, + 0x970f, 0x1bdb, + 0x9711, 0x1bda, + 0x9713, 0x1bd8, + 0x9716, 0x1bdc, + 0x9719, 0x1bdd, + 0x971c, 0x0afc, + 0x971e, 0x0562, + 0x9724, 0x1bde, + 0x9727, 0x0ec4, + 0x972a, 0x1bdf, + 0x9730, 0x1be0, + 0x9732, 0x0fd0, + 0x9733, 0x21f2, + 0x9738, 0x1414, + 0x9739, 0x1be1, + 0x973b, 0x21f3, + 0x973d, 0x1be2, + 0x9742, 0x1be7, + 0x9743, 0x21f4, + 0x9744, 0x1be4, + 0x9746, 0x1be5, + 0x9748, 0x1be6, + 0x9749, 0x1be8, + 0x974d, 0x21f5, + 0x974f, 0x21f6, + 0x9751, 0x21f7, + 0x9752, 0x0a68, + 0x9755, 0x21f8, + 0x9756, 0x0f03, + 0x9759, 0x0a69, + 0x975c, 0x1be9, + 0x975e, 0x0d87, + 0x9760, 0x1bea, + 0x9761, 0x1d06, + 0x9762, 0x0ed8, + 0x9764, 0x1beb, + 0x9766, 0x1bec, + 0x9768, 0x1bed, + 0x9769, 0x05b5, + 0x976b, 0x1bef, + 0x976d, 0x0a1f, + 0x9771, 0x1bf0, + 0x9774, 0x06fa, + 0x9779, 0x1bf1, + 0x977a, 0x1bf5, + 0x977c, 0x1bf3, + 0x9781, 0x1bf4, + 0x9784, 0x05d1, + 0x9785, 0x1bf2, + 0x9786, 0x1bf6, + 0x978b, 0x1bf7, + 0x978d, 0x048c, + 0x978f, 0x1bf8, + 0x9798, 0x09cc, + 0x979c, 0x1bfa, + 0x97a0, 0x0661, + 0x97a3, 0x1bfd, + 0x97a6, 0x1bfc, + 0x97a8, 0x1bfb, + 0x97ab, 0x1a34, + 0x97ad, 0x0e2c, + 0x97b3, 0x1bfe, + 0x97c3, 0x1c00, + 0x97c6, 0x1c01, + 0x97c8, 0x1c02, + 0x97cb, 0x1c03, + 0x97d3, 0x0616, + 0x97dc, 0x1c04, + 0x97ed, 0x1c05, + 0x97ee, 0x0cd9, + 0x97f2, 0x1c07, + 0x97f3, 0x053b, + 0x97f5, 0x1c0a, + 0x97f6, 0x1c09, + 0x97fb, 0x04c6, + 0x97ff, 0x06b9, + 0x9801, 0x0e17, + 0x9802, 0x0bd6, + 0x9803, 0x0812, + 0x9805, 0x07f2, + 0x9806, 0x0971, + 0x9808, 0x0a22, + 0x980c, 0x1c0c, + 0x980f, 0x1c0b, + 0x9810, 0x0f2c, + 0x9811, 0x0624, + 0x9812, 0x0d66, + 0x9813, 0x0cb4, + 0x9817, 0x0a42, + 0x9818, 0x0f96, + 0x981a, 0x0731, + 0x9821, 0x1c0f, + 0x9824, 0x1c0e, + 0x982c, 0x0e79, + 0x982d, 0x0c84, + 0x9830, 0x1e73, + 0x9834, 0x04f2, + 0x9837, 0x1c10, + 0x9838, 0x1c0d, + 0x983b, 0x0dc3, + 0x983c, 0x0f54, + 0x983d, 0x1c11, + 0x9846, 0x1c12, + 0x984b, 0x1c14, + 0x984c, 0x0b4a, + 0x984d, 0x05b9, + 0x984f, 0x1c13, + 0x9854, 0x0625, + 0x9855, 0x0766, + 0x9857, 0x21f9, + 0x9858, 0x0626, + 0x985a, 0x1e48, + 0x985b, 0x0c39, + 0x985e, 0x0fa8, + 0x9865, 0x21fa, + 0x9867, 0x0790, + 0x986b, 0x1c15, + 0x986f, 0x1c16, + 0x9873, 0x1c1a, + 0x9874, 0x1c19, + 0x98a8, 0x0de9, + 0x98aa, 0x1c1b, + 0x98af, 0x1c1c, + 0x98b1, 0x1c1d, + 0x98b6, 0x1c1e, + 0x98c3, 0x1c20, + 0x98c4, 0x1c1f, + 0x98c6, 0x1c21, + 0x98db, 0x0d88, + 0x98dc, 0x1839, + 0x98df, 0x09ef, + 0x98e2, 0x064c, + 0x98e9, 0x1c22, + 0x98eb, 0x1c23, + 0x98ed, 0x10c1, + 0x98ee, 0x14da, + 0x98ef, 0x0d67, + 0x98f2, 0x04bf, + 0x98f4, 0x047f, + 0x98fc, 0x08c2, + 0x98fd, 0x0e5e, + 0x98fe, 0x09e6, + 0x9903, 0x1c24, + 0x9905, 0x0eeb, + 0x9909, 0x1c25, + 0x990a, 0x0f46, + 0x990c, 0x04e4, + 0x9910, 0x088f, + 0x9912, 0x1c26, + 0x9913, 0x056e, + 0x9914, 0x1c27, + 0x9918, 0x1c28, + 0x991d, 0x1c2a, + 0x9920, 0x1c2d, + 0x9921, 0x1c29, + 0x9924, 0x1c2c, + 0x9927, 0x21fd, + 0x9928, 0x0617, + 0x992c, 0x1c2e, + 0x992e, 0x1c2f, + 0x993d, 0x1c30, + 0x9942, 0x1c32, + 0x9945, 0x1c34, + 0x9949, 0x1c33, + 0x994b, 0x1c36, + 0x994c, 0x1c39, + 0x9950, 0x1c35, + 0x9951, 0x1c37, + 0x9955, 0x1c3a, + 0x9957, 0x06ba, + 0x9996, 0x091f, + 0x9997, 0x1c3b, + 0x9999, 0x07f3, + 0x999e, 0x21ff, + 0x99a5, 0x1c3d, + 0x99a8, 0x059c, + 0x99ac, 0x0d05, + 0x99ad, 0x1c3e, + 0x99b3, 0x0b98, + 0x99b4, 0x0cc3, + 0x99bc, 0x1c40, + 0x99c1, 0x0d33, + 0x99c4, 0x0b2c, + 0x99c5, 0x04fa, + 0x99c6, 0x06e6, + 0x99c8, 0x06e7, + 0x99d0, 0x0bb1, + 0x99d1, 0x1c45, + 0x99d2, 0x06e8, + 0x99d5, 0x056f, + 0x99d8, 0x1c44, + 0x99db, 0x1c42, + 0x99dd, 0x1c43, + 0x99df, 0x1c41, + 0x99e2, 0x1c4f, + 0x99ed, 0x1c46, + 0x99f1, 0x1c48, + 0x99f8, 0x1c4b, + 0x99fb, 0x1c4a, + 0x99ff, 0x0963, + 0x9a01, 0x1c4c, + 0x9a05, 0x1c4e, + 0x9a0e, 0x064d, + 0x9a0f, 0x1c4d, + 0x9a12, 0x0afd, + 0x9a13, 0x0767, + 0x9a19, 0x1c50, + 0x9a28, 0x0b2d, + 0x9a2b, 0x1c51, + 0x9a30, 0x0c85, + 0x9a37, 0x1c52, + 0x9a3e, 0x1c57, + 0x9a40, 0x1c55, + 0x9a42, 0x1c54, + 0x9a43, 0x1c56, + 0x9a45, 0x1c53, + 0x9a4d, 0x1c59, + 0x9a4e, 0x2200, + 0x9a52, 0x1e2f, + 0x9a55, 0x1c58, + 0x9a57, 0x1c5b, + 0x9a5a, 0x06bb, + 0x9a5b, 0x1c5a, + 0x9a5f, 0x1c5c, + 0x9a62, 0x1c5d, + 0x9a64, 0x1c5f, + 0x9a65, 0x1c5e, + 0x9a69, 0x1c60, + 0x9a6a, 0x1c62, + 0x9a6b, 0x1c61, + 0x9aa8, 0x080e, + 0x9aad, 0x1c63, + 0x9ab0, 0x1c64, + 0x9ab8, 0x059a, + 0x9abc, 0x1c65, + 0x9ac0, 0x1c66, + 0x9ac4, 0x0a37, + 0x9acf, 0x1c67, + 0x9ad1, 0x1c68, + 0x9ad3, 0x1c69, + 0x9ad8, 0x07f4, + 0x9ad9, 0x2201, + 0x9adc, 0x2202, + 0x9ade, 0x1c6b, + 0x9ae2, 0x1c6d, + 0x9ae6, 0x1c6f, + 0x9aea, 0x0d45, + 0x9aeb, 0x1c71, + 0x9aed, 0x0d98, + 0x9aee, 0x1c72, + 0x9aef, 0x1c70, + 0x9af1, 0x1c74, + 0x9af4, 0x1c73, + 0x9af7, 0x1c75, + 0x9afb, 0x1c76, + 0x9b06, 0x1c77, + 0x9b18, 0x1c78, + 0x9b1a, 0x1c79, + 0x9b1f, 0x1c7a, + 0x9b22, 0x1c7b, + 0x9b25, 0x1c7d, + 0x9b27, 0x1c7e, + 0x9b2e, 0x1c82, + 0x9b31, 0x14d4, + 0x9b32, 0x1c84, + 0x9b3b, 0x17a9, + 0x9b3c, 0x064e, + 0x9b41, 0x057f, + 0x9b42, 0x0822, + 0x9b43, 0x1c86, + 0x9b44, 0x1c85, + 0x9b45, 0x0eb1, + 0x9b4d, 0x1c88, + 0x9b4f, 0x1c87, + 0x9b51, 0x1c8a, + 0x9b54, 0x0e90, + 0x9b58, 0x1c8b, + 0x9b5a, 0x0695, + 0x9b6f, 0x0fcb, + 0x9b72, 0x2204, + 0x9b74, 0x1c8c, + 0x9b75, 0x2203, + 0x9b83, 0x1c8e, + 0x9b8e, 0x0482, + 0x9b8f, 0x2205, + 0x9b91, 0x1c8f, + 0x9b92, 0x0dfb, + 0x9b93, 0x1c8d, + 0x9b96, 0x1c90, + 0x9b9f, 0x1c92, + 0x9ba8, 0x1c94, + 0x9baa, 0x0e9c, + 0x9bab, 0x087b, + 0x9bad, 0x086a, + 0x9bae, 0x0ab1, + 0x9bb1, 0x2206, + 0x9bb4, 0x1c95, + 0x9bb9, 0x1c98, + 0x9bbb, 0x2207, + 0x9bc0, 0x1c96, + 0x9bc6, 0x1c99, + 0x9bc9, 0x07a5, + 0x9bca, 0x1c97, + 0x9bcf, 0x1c9a, + 0x9bd1, 0x1c9b, + 0x9bd4, 0x1ca0, + 0x9bd6, 0x0878, + 0x9bdb, 0x0b44, + 0x9be1, 0x1ca1, + 0x9be2, 0x1c9e, + 0x9be3, 0x1c9d, + 0x9be4, 0x1c9f, + 0x9be8, 0x0735, + 0x9bf0, 0x1ca5, + 0x9bf1, 0x1ca4, + 0x9bf2, 0x1ca3, + 0x9bf5, 0x0477, + 0x9c00, 0x2208, + 0x9c04, 0x1caf, + 0x9c06, 0x1cab, + 0x9c08, 0x1cac, + 0x9c09, 0x1ca8, + 0x9c0a, 0x1cae, + 0x9c0c, 0x1caa, + 0x9c0d, 0x05c0, + 0x9c10, 0x0ff2, + 0x9c12, 0x1cad, + 0x9c13, 0x1ca9, + 0x9c14, 0x1ca7, + 0x9c15, 0x1ca6, + 0x9c1b, 0x1cb1, + 0x9c21, 0x1cb4, + 0x9c24, 0x1cb3, + 0x9c25, 0x1cb2, + 0x9c2d, 0x0dbb, + 0x9c2e, 0x1cb0, + 0x9c2f, 0x04b7, + 0x9c30, 0x1cb5, + 0x9c32, 0x1cb7, + 0x9c39, 0x05cd, + 0x9c3a, 0x1ca2, + 0x9c3b, 0x04d9, + 0x9c3e, 0x1cb9, + 0x9c46, 0x1cb8, + 0x9c47, 0x1cb6, + 0x9c48, 0x0b6b, + 0x9c52, 0x0e9e, + 0x9c57, 0x0fa2, + 0x9c5a, 0x1cba, + 0x9c60, 0x1cbb, + 0x9c67, 0x1cbc, + 0x9c76, 0x1cbd, + 0x9c78, 0x1cbe, + 0x9ce5, 0x0bd7, + 0x9ce7, 0x1cbf, + 0x9ce9, 0x0d4b, + 0x9ceb, 0x1cc4, + 0x9cec, 0x1cc0, + 0x9cf0, 0x1cc1, + 0x9cf3, 0x0e5f, + 0x9cf4, 0x0ed0, + 0x9cf6, 0x0ca8, + 0x9d03, 0x1cc5, + 0x9d06, 0x1cc6, + 0x9d07, 0x0c96, + 0x9d08, 0x1cc3, + 0x9d09, 0x1cc2, + 0x9d0e, 0x052a, + 0x9d12, 0x1cce, + 0x9d15, 0x1ccd, + 0x9d1b, 0x0517, + 0x9d1f, 0x1ccb, + 0x9d23, 0x1cca, + 0x9d26, 0x1cc8, + 0x9d28, 0x05d9, + 0x9d2a, 0x1cc7, + 0x9d2b, 0x08de, + 0x9d2c, 0x0529, + 0x9d3b, 0x07f5, + 0x9d3e, 0x1cd1, + 0x9d3f, 0x1cd0, + 0x9d41, 0x1ccf, + 0x9d44, 0x1ccc, + 0x9d46, 0x1cd2, + 0x9d48, 0x1cd3, + 0x9d50, 0x1cd8, + 0x9d51, 0x1cd7, + 0x9d59, 0x1cd9, + 0x9d5c, 0x04cf, + 0x9d5d, 0x1cd4, + 0x9d60, 0x0806, + 0x9d61, 0x0ec5, + 0x9d64, 0x1cd6, + 0x9d6b, 0x220a, + 0x9d6c, 0x0e60, + 0x9d6f, 0x1cde, + 0x9d70, 0x2209, + 0x9d72, 0x1cda, + 0x9d7a, 0x1cdf, + 0x9d87, 0x1cdc, + 0x9d89, 0x1cdb, + 0x9d8f, 0x0732, + 0x9d9a, 0x1ce0, + 0x9da4, 0x1ce1, + 0x9da9, 0x1ce2, + 0x9dab, 0x1cdd, + 0x9daf, 0x1cc9, + 0x9db2, 0x1ce3, + 0x9db4, 0x0bfd, + 0x9db8, 0x1ce7, + 0x9dba, 0x1ce8, + 0x9dbb, 0x1ce6, + 0x9dc1, 0x1ce5, + 0x9dc2, 0x1ceb, + 0x9dc4, 0x1ce4, + 0x9dc6, 0x1ce9, + 0x9dcf, 0x1cea, + 0x9dd3, 0x1ced, + 0x9dd7, 0x1dde, + 0x9dd9, 0x1cec, + 0x9de6, 0x1cef, + 0x9ded, 0x1cf0, + 0x9def, 0x1cf1, + 0x9df2, 0x0fef, + 0x9df8, 0x1cee, + 0x9df9, 0x0b4b, + 0x9dfa, 0x085d, + 0x9dfd, 0x1cf2, + 0x9e19, 0x220c, + 0x9e1a, 0x1cf3, + 0x9e1e, 0x1cf5, + 0x9e75, 0x1cf6, + 0x9e78, 0x0768, + 0x9e79, 0x1cf7, + 0x9e7c, 0x1dfd, + 0x9e7d, 0x1cf8, + 0x9e7f, 0x08db, + 0x9e81, 0x1cf9, + 0x9e88, 0x1cfa, + 0x9e8b, 0x1cfb, + 0x9e91, 0x1cff, + 0x9e92, 0x1cfd, + 0x9e93, 0x0fe2, + 0x9e95, 0x1cfe, + 0x9e97, 0x0fb7, + 0x9e9d, 0x1d00, + 0x9e9f, 0x0fa3, + 0x9ea5, 0x1d01, + 0x9ea6, 0x0d34, + 0x9ea9, 0x1d02, + 0x9eaa, 0x1d04, + 0x9ead, 0x1d05, + 0x9eb4, 0x1e02, + 0x9eb5, 0x1e75, + 0x9eb8, 0x1d03, + 0x9eb9, 0x07ff, + 0x9eba, 0x0ed9, + 0x9ebb, 0x0e91, + 0x9ebc, 0x1284, + 0x9ebe, 0x14ff, + 0x9ebf, 0x0ea9, + 0x9ec4, 0x052b, + 0x9ecc, 0x1d07, + 0x9ecd, 0x066a, + 0x9ece, 0x1d08, + 0x9ed1, 0x220d, + 0x9ed2, 0x0807, + 0x9ed4, 0x1d0b, + 0x9ed8, 0x160d, + 0x9ed9, 0x0ee7, + 0x9edb, 0x0b43, + 0x9edc, 0x1d0c, + 0x9edd, 0x1d0e, + 0x9ede, 0x1d0d, + 0x9ee0, 0x1d0f, + 0x9ee5, 0x1d10, + 0x9ee8, 0x1d11, + 0x9eef, 0x1d12, + 0x9ef4, 0x1d13, + 0x9ef6, 0x1d14, + 0x9ef9, 0x1d16, + 0x9efb, 0x1d17, + 0x9f07, 0x1d1a, + 0x9f0e, 0x0c1e, + 0x9f13, 0x0791, + 0x9f15, 0x1d1d, + 0x9f20, 0x0acf, + 0x9f21, 0x1d1e, + 0x9f2c, 0x1d1f, + 0x9f3b, 0x0d93, + 0x9f3e, 0x1d20, + 0x9f4a, 0x1d21, + 0x9f4b, 0x170a, + 0x9f4e, 0x1a7b, + 0x9f4f, 0x1c06, + 0x9f52, 0x1d22, + 0x9f54, 0x1d23, + 0x9f5f, 0x1d25, + 0x9f62, 0x0fb8, + 0x9f63, 0x1d24, + 0x9f66, 0x1d28, + 0x9f6a, 0x1d2b, + 0x9f6c, 0x1d2a, + 0x9f72, 0x1d2d, + 0x9f76, 0x1d2e, + 0x9f77, 0x1d2c, + 0x9f8d, 0x0f7e, + 0x9f95, 0x1d2f, + 0x9f9c, 0x1d30, + 0x9f9d, 0x1727, + 0x9fa0, 0x1d31, + 0xf929, 0x2129, + 0xf9dc, 0x21ee, + 0xfa0e, 0x20da, + 0xfa0f, 0x20e5, + 0xfa11, 0x20fb, + 0xfa12, 0x2121, + 0xfa13, 0x2131, + 0xfa14, 0x2133, + 0xfa15, 0x215e, + 0xfa16, 0x2164, + 0xfa17, 0x217b, + 0xfa18, 0x2183, + 0xfa1b, 0x2187, + 0xfa1c, 0x218b, + 0xfa1d, 0x218e, + 0xfa1e, 0x2197, + 0xfa1f, 0x21a2, + 0xfa20, 0x21a4, + 0xfa22, 0x21ae, + 0xfa23, 0x21b6, + 0xfa24, 0x21b8, + 0xfa26, 0x21bc, + 0xfa27, 0x21d8, + 0xfa28, 0x21df, + 0xfa29, 0x21ef, + 0xfa2a, 0x21fb, + 0xfa2c, 0x21fe, + 0xfa2d, 0x220b, + 0xfb01, 0x0070, + 0xfe30, 0x1eda, + 0xfe31, 0x1ed4, + 0xfe33, 0x1ed2, + 0xfe35, 0x1edb, + 0xfe37, 0x1ee1, + 0xfe39, 0x1edd, + 0xfe3b, 0x1eeb, + 0xfe3d, 0x1ee5, + 0xfe3f, 0x1ee3, + 0xfe41, 0x1ee7, + 0xff01, 0x0282, + 0xff02, 0x1f47, + 0xff03, 0x02cc, + 0xff04, 0x02c8, + 0xff05, 0x02cb, + 0xff06, 0x02cd, + 0xff07, 0x1f46, + 0xff08, 0x02a2, + 0xff0a, 0x02ce, + 0xff0b, 0x02b4, + 0xff0c, 0x027c, + 0xff0d, 0x0296, + 0xff0e, 0x027d, + 0xff0f, 0x0297, + 0xff10, 0x030c, + 0xff1a, 0x027f, + 0xff1c, 0x02bb, + 0xff1d, 0x02b9, + 0xff1e, 0x02bc, + 0xff1f, 0x0281, + 0xff20, 0x02cf, + 0xff21, 0x0316, + 0xff3b, 0x02a6, + 0xff3c, 0x0298, + 0xff3d, 0x02a7, + 0xff3e, 0x0288, + 0xff3f, 0x028a, + 0xff40, 0x0286, + 0xff41, 0x0330, + 0xff5b, 0x02a8, + 0xff5c, 0x029b, + 0xff5d, 0x02a9, + 0xff5e, 0x0299, + 0xff61, 0x0147, + 0xffe0, 0x02c9, + 0xffe2, 0x02ef, + 0xffe3, 0x0289, + 0xffe4, 0x1f45, + 0xffe5, 0x02c7, + 0xffe8, 0x0143, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12UniJISUCS2HEnc16 = { + { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 }, + { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12UniJISUCS2HMap2, 6963 +}; + +static Gushort japan12WPSymbolMap2[4] = { + 0x0000, 0x0000, + 0xffff, 0x0000 +}; + +static GfxFontEncoding16 japan12WPSymbolEnc16 = { + { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }, + { 0x0000, 0x1f78, 0x1f7a, 0x1fff, 0x2004, 0x1f7d, 0x1f7e, 0x1f7f, + 0x1f80, 0x1f81, 0x1f82, 0x1f83, 0x1f84, 0x1f85, 0x1f86, 0x1f87, + 0x1f88, 0x1f89, 0x1f8a, 0x1f8b, 0x1f8c, 0x1f8d, 0x1f8e, 0x1f8f, + 0x1f90, 0x1f9c, 0x1f9d, 0x1f9e, 0x1f9f, 0x1fa0, 0x1fa1, 0x1fa2, + 0x1fa3, 0x1fa4, 0x1fa5, 0x1ffa, 0x1f54, 0x1f55, 0x1ffb, 0x1f56, + 0x1f57, 0x1ffc, 0x1f65, 0x1f58, 0x1f59, 0x1f5a, 0x1ffd, 0x1ffe, + 0x2000, 0x2001, 0x1edb, 0x1edc, 0x1ed6, 0x2002, 0x1f63, 0x1f5b, + 0x1f5c, 0x1f5d, 0x2003, 0x1fb0, 0x1fb1, 0x1fb2, 0x1fb3, 0x1fb4, + 0x1fb5, 0x1fb6, 0x1fb7, 0x1fb8, 0x1fb9, 0x1fba, 0x1fbb, 0x1fbc, + 0x1fbd, 0x1fbe, 0x1fbf, 0x1fc0, 0x1fc1, 0x1fc2, 0x1fc3, 0x1fc4, + 0x1fc5, 0x1fc6, 0x1fc7, 0x1fc8, 0x1fc9, 0x2005, 0x2006, 0x2007, + 0x2008, 0x2009, 0x200a, 0x200b, 0x200c, 0x200d, 0x1fd7, 0x0000, + 0x0000, 0x200e, 0x200f, 0x2010, 0x2011, 0x2012, 0x2013, 0x2014, + 0x2015, 0x2016, 0x2017, 0x2018, 0x2019, 0x201a, 0x201b, 0x201c, + 0x201d, 0x201e, 0x1f79, 0x201f, 0x2020, 0x2021, 0x2022, 0x2023, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, + japan12WPSymbolMap2, 2 +}; + +struct GfxFontEnc16Entry { + char *name; + GfxFontEncoding16 *enc; +}; + +static GfxFontEnc16Entry gfxFontEnc16Tab[] = { + { "78-EUC-H", &japan1278EUCHEnc16 }, + { "78-H", &japan1278HEnc16 }, + { "78-RKSJ-H", &japan1278RKSJHEnc16 }, + { "78ms-RKSJ-H", &japan1278msRKSJHEnc16 }, + { "83pv-RKSJ-H", &japan1283pvRKSJHEnc16 }, + { "90ms-RKSJ-H", &japan1290msRKSJHEnc16 }, + { "90msp-RKSJ-H", &japan1290mspRKSJHEnc16 }, + { "90pv-RKSJ-H", &japan1290pvRKSJHEnc16 }, + { "Add-H", &japan12AddHEnc16 }, + { "Add-RKSJ-H", &japan12AddRKSJHEnc16 }, + { "Adobe-Japan1-0", &japan12AdobeJapan10Enc16 }, + { "Adobe-Japan1-1", &japan12AdobeJapan11Enc16 }, + { "Adobe-Japan1-2", &japan12AdobeJapan12Enc16 }, + { "EUC-H", &japan12EUCHEnc16 }, + { "Ext-H", &japan12ExtHEnc16 }, + { "Ext-RKSJ-H", &japan12ExtRKSJHEnc16 }, + { "H", &japan12HEnc16 }, + { "Hankaku", &japan12HankakuEnc16 }, + { "Hiragana", &japan12HiraganaEnc16 }, + { "Katakana", &japan12KatakanaEnc16 }, + { "NWP-H", &japan12NWPHEnc16 }, + { "RKSJ-H", &japan12RKSJHEnc16 }, + { "Roman", &japan12RomanEnc16 }, + { "UniJIS-UCS2-H", &japan12UniJISUCS2HEnc16 }, + { "WP-Symbol", &japan12WPSymbolEnc16 }, + { "Identity-H", &japan12AdobeJapan12Enc16 }, + { NULL, NULL } +}; + +#endif diff --git a/pdf/xpdf/Catalog.cc b/pdf/xpdf/Catalog.cc new file mode 100644 index 00000000..fded0bef --- /dev/null +++ b/pdf/xpdf/Catalog.cc @@ -0,0 +1,271 @@ +//======================================================================== +// +// Catalog.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include "gmem.h" +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "Page.h" +#include "Error.h" +#include "Link.h" +#include "Catalog.h" + +//------------------------------------------------------------------------ +// Catalog +//------------------------------------------------------------------------ + +Catalog::Catalog(Object *catDict) { + Object pagesDict; + Object obj; + int i; + + ok = gTrue; + pages = NULL; + pageRefs = NULL; + numPages = 0; + + if (!catDict->isDict("Catalog")) { + error(-1, "Catalog object is wrong type (%s)", catDict->getTypeName()); + goto err1; + } + + // read page tree + catDict->dictLookup("Pages", &pagesDict); + if (!pagesDict.isDict("Pages")) { + error(-1, "Top-level pages object is wrong type (%s)", + pagesDict.getTypeName()); + goto err2; + } + pagesDict.dictLookup("Count", &obj); + if (!obj.isInt()) { + error(-1, "Page count in top-level pages object is wrong type (%s)", + obj.getTypeName()); + goto err3; + } + numPages = obj.getInt(); + obj.free(); + pages = (Page **)gmalloc(numPages * sizeof(Page *)); + pageRefs = (Ref *)gmalloc(numPages * sizeof(Ref)); + for (i = 0; i < numPages; ++i) { + pages[i] = NULL; + pageRefs[i].num = -1; + pageRefs[i].gen = -1; + } + readPageTree(pagesDict.getDict(), NULL, 0); + pagesDict.free(); + + // read named destination dictionary + catDict->dictLookup("Dests", &dests); + + // read root of named destination tree + if (catDict->dictLookup("Names", &obj)->isDict()) + obj.dictLookup("Dests", &nameTree); + else + nameTree.initNull(); + obj.free(); + + return; + + err3: + obj.free(); + err2: + pagesDict.free(); + err1: + dests.initNull(); + nameTree.initNull(); + ok = gFalse; +} + +Catalog::~Catalog() { + int i; + + if (pages) { + for (i = 0; i < numPages; ++i) { + if (pages[i]) + delete pages[i]; + } + gfree(pages); + gfree(pageRefs); + } + dests.free(); + nameTree.free(); +} + +int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start) { + Object kids; + Object kid; + Object kidRef; + PageAttrs *attrs1, *attrs2; + Page *page; + int i; + + attrs1 = new PageAttrs(attrs, pagesDict); + pagesDict->lookup("Kids", &kids); + if (!kids.isArray()) { + error(-1, "Kids object (page %d) is wrong type (%s)", + start+1, kids.getTypeName()); + goto err1; + } + for (i = 0; i < kids.arrayGetLength(); ++i) { + kids.arrayGet(i, &kid); + if (kid.isDict("Page")) { + attrs2 = new PageAttrs(attrs1, kid.getDict()); + page = new Page(start+1, kid.getDict(), attrs2); + if (!page->isOk()) { + ++start; + goto err3; + } + pages[start] = page; + kids.arrayGetNF(i, &kidRef); + if (kidRef.isRef()) { + pageRefs[start].num = kidRef.getRefNum(); + pageRefs[start].gen = kidRef.getRefGen(); + } + kidRef.free(); + ++start; + //~ found one PDF file where a Pages object is missing the /Type entry + // } else if (kid.isDict("Pages")) { + } else if (kid.isDict()) { + if ((start = readPageTree(kid.getDict(), attrs1, start)) < 0) + goto err2; + } else { + error(-1, "Kid object (page %d) is wrong type (%s)", + start+1, kid.getTypeName()); + goto err2; + } + kid.free(); + } + delete attrs1; + kids.free(); + return start; + + err3: + delete page; + err2: + kid.free(); + err1: + kids.free(); + delete attrs1; + ok = gFalse; + return -1; +} + +int Catalog::findPage(int num, int gen) { + int i; + + for (i = 0; i < numPages; ++i) { + if (pageRefs[i].num == num && pageRefs[i].gen == gen) + return i + 1; + } + return 0; +} + +LinkDest *Catalog::findDest(GString *name) { + LinkDest *dest; + Object obj1, obj2; + GBool found; + + // try named destination dictionary then name tree + found = gFalse; + if (dests.isDict()) { + if (!dests.dictLookup(name->getCString(), &obj1)->isNull()) + found = gTrue; + else + obj1.free(); + } + if (!found && nameTree.isDict()) { + if (!findDestInTree(&nameTree, name, &obj1)->isNull()) + found = gTrue; + else + obj1.free(); + } + if (!found) + return NULL; + + // construct LinkDest + dest = NULL; + if (obj1.isArray()) { + dest = new LinkDest(obj1.getArray(), gTrue); + } else if (obj1.isDict()) { + if (obj1.dictLookup("D", &obj2)->isArray()) + dest = new LinkDest(obj2.getArray(), gTrue); + else + error(-1, "Bad named destination value"); + obj2.free(); + } else { + error(-1, "Bad named destination value"); + } + obj1.free(); + + return dest; +} + +Object *Catalog::findDestInTree(Object *tree, GString *name, Object *obj) { + Object names, name1; + Object kids, kid, limits, low, high; + GBool done, found; + int cmp, i; + + // leaf node + if (tree->dictLookup("Names", &names)->isArray()) { + done = found = gFalse; + for (i = 0; !done && i < names.arrayGetLength(); i += 2) { + if (names.arrayGet(i, &name1)->isString()) { + cmp = name->cmp(name1.getString()); + if (cmp == 0) { + names.arrayGet(i+1, obj); + found = gTrue; + done = gTrue; + } else if (cmp < 0) { + done = gTrue; + } + name1.free(); + } + } + names.free(); + if (!found) + obj->initNull(); + return obj; + } + names.free(); + + // root or intermediate node + done = gFalse; + if (tree->dictLookup("Kids", &kids)->isArray()) { + for (i = 0; !done && i < kids.arrayGetLength(); ++i) { + if (kids.arrayGet(i, &kid)->isDict()) { + if (kid.dictLookup("Limits", &limits)->isArray()) { + if (limits.arrayGet(0, &low)->isString() && + name->cmp(low.getString()) >= 0) { + if (limits.arrayGet(1, &high)->isString() && + name->cmp(high.getString()) <= 0) { + findDestInTree(&kid, name, obj); + done = gTrue; + } + high.free(); + } + low.free(); + } + limits.free(); + } + kid.free(); + } + } + kids.free(); + + // name was outside of ranges of all kids + if (!done) + obj->initNull(); + + return obj; +} diff --git a/pdf/xpdf/Catalog.h b/pdf/xpdf/Catalog.h new file mode 100644 index 00000000..72ff0a30 --- /dev/null +++ b/pdf/xpdf/Catalog.h @@ -0,0 +1,65 @@ +//======================================================================== +// +// Catalog.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef CATALOG_H +#define CATALOG_H + +#ifdef __GNUC__ +#pragma interface +#endif + +class Object; +class Page; +class PageAttrs; +struct Ref; +class LinkDest; + +//------------------------------------------------------------------------ +// Catalog +//------------------------------------------------------------------------ + +class Catalog { +public: + + // Constructor. + Catalog(Object *catDict); + + // Destructor. + ~Catalog(); + + // Is catalog valid? + GBool isOk() { return ok; } + + // Get number of pages. + int getNumPages() { return numPages; } + + // Get a page. + Page *getPage(int i) { return pages[i-1]; } + + // Find a page, given its object ID. Returns page number, or 0 if + // not found. + int findPage(int num, int gen); + + // Find a named destination. Returns the link destination, or + // NULL if is not a destination. + LinkDest *findDest(GString *name); + +private: + + Page **pages; // array of pages + Ref *pageRefs; // object ID for each page + int numPages; // number of pages + Object dests; // named destination dictionary + Object nameTree; // name tree + GBool ok; // true if catalog is valid + + int readPageTree(Dict *pages, PageAttrs *attrs, int start); + Object *findDestInTree(Object *tree, GString *name, Object *obj); +}; + +#endif diff --git a/pdf/xpdf/Dict.cc b/pdf/xpdf/Dict.cc new file mode 100644 index 00000000..c9f4feca --- /dev/null +++ b/pdf/xpdf/Dict.cc @@ -0,0 +1,88 @@ +//======================================================================== +// +// Dict.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include "gmem.h" +#include "Object.h" +#include "XRef.h" +#include "Dict.h" + +//------------------------------------------------------------------------ +// Dict +//------------------------------------------------------------------------ + +Dict::Dict() { + entries = NULL; + size = length = 0; + ref = 1; +} + +Dict::~Dict() { + int i; + + for (i = 0; i < length; ++i) { + gfree(entries[i].key); + entries[i].val.free(); + } + gfree(entries); +} + +void Dict::add(char *key, Object *val) { + if (length + 1 > size) { + size += 8; + entries = (DictEntry *)grealloc(entries, size * sizeof(DictEntry)); + } + entries[length].key = key; + entries[length].val = *val; + ++length; +} + +inline DictEntry *Dict::find(char *key) { + int i; + + for (i = 0; i < length; ++i) { + if (!strcmp(key, entries[i].key)) + return &entries[i]; + } + return NULL; +} + +GBool Dict::is(char *type) { + DictEntry *e; + + return (e = find("Type")) && e->val.isName(type); +} + +Object *Dict::lookup(char *key, Object *obj) { + DictEntry *e; + + return (e = find(key)) ? e->val.fetch(obj) : obj->initNull(); +} + +Object *Dict::lookupNF(char *key, Object *obj) { + DictEntry *e; + + return (e = find(key)) ? e->val.copy(obj) : obj->initNull(); +} + +char *Dict::getKey(int i) { + return entries[i].key; +} + +Object *Dict::getVal(int i, Object *obj) { + return entries[i].val.fetch(obj); +} + +Object *Dict::getValNF(int i, Object *obj) { + return entries[i].val.copy(obj); +} diff --git a/pdf/xpdf/Dict.h b/pdf/xpdf/Dict.h new file mode 100644 index 00000000..cfc64d3b --- /dev/null +++ b/pdf/xpdf/Dict.h @@ -0,0 +1,69 @@ +//======================================================================== +// +// Dict.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef DICT_H +#define DICT_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "Object.h" + +//------------------------------------------------------------------------ +// Dict +//------------------------------------------------------------------------ + +struct DictEntry { + char *key; + Object val; +}; + +class Dict { +public: + + // Constructor. + Dict(); + + // Destructor. + ~Dict(); + + // Reference counting. + int incRef() { return ++ref; } + int decRef() { return --ref; } + + // Get number of entries. + int getLength() { return length; } + + // Add an entry. NB: does not copy key. + void add(char *key, Object *val); + + // Check if dictionary is of specified type. + GBool is(char *type); + + // Look up an entry and return the value. Returns a null object + // if is not in the dictionary. + Object *lookup(char *key, Object *obj); + Object *lookupNF(char *key, Object *obj); + + // Iterative accessors. + char *getKey(int i); + Object *getVal(int i, Object *obj); + Object *getValNF(int i, Object *obj); + +private: + + DictEntry *entries; // array of entries + int size; // size of array + int length; // number of entries in dictionary + int ref; // reference count + + DictEntry *find(char *key); +}; + +#endif diff --git a/pdf/xpdf/Error.cc b/pdf/xpdf/Error.cc new file mode 100644 index 00000000..cbb623ba --- /dev/null +++ b/pdf/xpdf/Error.cc @@ -0,0 +1,45 @@ +//======================================================================== +// +// Error.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include "gtypes.h" +#include "Params.h" +#include "Error.h" + +// Send error messages to /dev/tty instead of stderr. +GBool errorsToTTY = gFalse; + +// File to send error (and other) messages to. +FILE *errFile; + +void errorInit() { + if (!errorsToTTY || !(errFile = fopen("/dev/tty", "w"))) + errFile = stderr; +} + +void CDECL error(int pos, char *msg, ...) { + va_list args; + + if (printCommands) + fflush(stdout); + if (pos >= 0) + fprintf(errFile, "Error (%d): ", pos); + else + fprintf(errFile, "Error: "); + va_start(args, msg); + vfprintf(errFile, msg, args); + va_end(args); + fprintf(errFile, "\n"); + fflush(errFile); +} diff --git a/pdf/xpdf/Error.h b/pdf/xpdf/Error.h new file mode 100644 index 00000000..f651678c --- /dev/null +++ b/pdf/xpdf/Error.h @@ -0,0 +1,26 @@ +//======================================================================== +// +// Error.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef ERROR_H +#define ERROR_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "config.h" + +// File to send error (and other) messages to. +extern FILE *errFile; + +extern void errorInit(); + +extern void CDECL error(int pos, char *msg, ...); + +#endif diff --git a/pdf/xpdf/FontInfo.h b/pdf/xpdf/FontInfo.h new file mode 100644 index 00000000..d4fd9a5b --- /dev/null +++ b/pdf/xpdf/FontInfo.h @@ -0,0 +1,2068 @@ +//======================================================================== +// +// FontInfo.h +// +// This file was automatically generated by makeFontInfo. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef FONTINFO_H +#define FONTINFO_H + +//------------------------------------------------------------------------ +// Character encodings. +//------------------------------------------------------------------------ + +#define standardEncodingSize 335 +static char *standardEncodingNames[standardEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "hyphen", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "exclamdown", + "cent", + "sterling", + "fraction", + "yen", + "florin", + "section", + "currency", + "quotesingle", + "quotedblleft", + "guillemotleft", + "guilsinglleft", + "guilsinglright", + "fi", + "fl", + NULL, + "endash", + "dagger", + "daggerdbl", + "periodcentered", + NULL, + "paragraph", + "bullet", + "quotesinglbase", + "quotedblbase", + "quotedblright", + "guillemotright", + "ellipsis", + "perthousand", + NULL, + "questiondown", + NULL, + "grave", + "acute", + "circumflex", + "tilde", + "macron", + "breve", + "dotaccent", + "dieresis", + NULL, + "ring", + "cedilla", + NULL, + "hungarumlaut", + "ogonek", + "caron", + "emdash", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "AE", + NULL, + "ordfeminine", + NULL, + NULL, + NULL, + NULL, + "Lslash", + "Oslash", + "OE", + "ordmasculine", + NULL, + NULL, + NULL, + NULL, + NULL, + "ae", + NULL, + NULL, + NULL, + "dotlessi", + NULL, + NULL, + "lslash", + "oslash", + "oe", + "germandbls", + NULL, + NULL, + NULL, + NULL, + "Aacute", + "Acircumflex", + "Adieresis", + "Agrave", + "Aring", + "Atilde", + "Ccedilla", + "Eacute", + "Ecircumflex", + "Edieresis", + "Egrave", + "Eth", + "Iacute", + "Icircumflex", + "Idieresis", + "Igrave", + "Ntilde", + "Oacute", + "Ocircumflex", + "Odieresis", + "Ograve", + "Otilde", + "Scaron", + "Thorn", + "Uacute", + "Ucircumflex", + "Udieresis", + "Ugrave", + "Yacute", + "Ydieresis", + "Zcaron", + "aacute", + "acircumflex", + "adieresis", + "agrave", + "aring", + "atilde", + "brokenbar", + "ccedilla", + "copyright", + "degree", + "divide", + "eacute", + "ecircumflex", + "edieresis", + "egrave", + "eth", + "iacute", + "icircumflex", + "idieresis", + "igrave", + "logicalnot", + "minus", + "mu", + "multiply", + "ntilde", + "oacute", + "ocircumflex", + "odieresis", + "ograve", + "onehalf", + "onequarter", + "onesuperior", + "otilde", + "plusminus", + "registered", + "scaron", + "thorn", + "threequarters", + "threesuperior", + "trademark", + "twosuperior", + "uacute", + "ucircumflex", + "udieresis", + "ugrave", + "yacute", + "ydieresis", + "zcaron" +}; +static GfxFontEncoding standardEncoding(standardEncodingNames, + standardEncodingSize); + +#define symbolEncodingSize 257 +static char *symbolEncodingNames[symbolEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "universal", + "numbersign", + "existential", + "percent", + "ampersand", + "suchthat", + "parenleft", + "parenright", + "asteriskmath", + "plus", + "comma", + "minus", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "congruent", + "Alpha", + "Beta", + "Chi", + "Delta", + "Epsilon", + "Phi", + "Gamma", + "Eta", + "Iota", + "theta1", + "Kappa", + "Lambda", + "Mu", + "Nu", + "Omicron", + "Pi", + "Theta", + "Rho", + "Sigma", + "Tau", + "Upsilon", + "sigma1", + "Omega", + "Xi", + "Psi", + "Zeta", + "bracketleft", + "therefore", + "bracketright", + "perpendicular", + "underscore", + "radicalex", + "alpha", + "beta", + "chi", + "delta", + "epsilon", + "phi", + "gamma", + "eta", + "iota", + "phi1", + "kappa", + "lambda", + "mu", + "nu", + "omicron", + "pi", + "theta", + "rho", + "sigma", + "tau", + "upsilon", + "omega1", + "omega", + "xi", + "psi", + "zeta", + "braceleft", + "bar", + "braceright", + "similar", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Upsilon1", + "minute", + "lessequal", + "fraction", + "infinity", + "florin", + "club", + "diamond", + "heart", + "spade", + "arrowboth", + "arrowleft", + "arrowup", + "arrowright", + "arrowdown", + "degree", + "plusminus", + "second", + "greaterequal", + "multiply", + "proportional", + "partialdiff", + "bullet", + "divide", + "notequal", + "equivalence", + "approxequal", + "ellipsis", + "arrowvertex", + "arrowhorizex", + "carriagereturn", + "aleph", + "Ifraktur", + "Rfraktur", + "weierstrass", + "circlemultiply", + "circleplus", + "emptyset", + "intersection", + "union", + "propersuperset", + "reflexsuperset", + "notsubset", + "propersubset", + "reflexsubset", + "element", + "notelement", + "angle", + "gradient", + "registerserif", + "copyrightserif", + "trademarkserif", + "product", + "radical", + "dotmath", + "logicalnot", + "logicaland", + "logicalor", + "arrowdblboth", + "arrowdblleft", + "arrowdblup", + "arrowdblright", + "arrowdbldown", + "lozenge", + "angleleft", + "registersans", + "copyrightsans", + "trademarksans", + "summation", + "parenlefttp", + "parenleftex", + "parenleftbt", + "bracketlefttp", + "bracketleftex", + "bracketleftbt", + "bracelefttp", + "braceleftmid", + "braceleftbt", + "braceex", + NULL, + "angleright", + "integral", + "integraltp", + "integralex", + "integralbt", + "parenrighttp", + "parenrightex", + "parenrightbt", + "bracketrighttp", + "bracketrightex", + "bracketrightbt", + "bracerighttp", + "bracerightmid", + "bracerightbt", + NULL, + "apple" +}; +static GfxFontEncoding symbolEncoding(symbolEncodingNames, + symbolEncodingSize); + +#define zapfDingbatsEncodingSize 270 +static char *zapfDingbatsEncodingNames[zapfDingbatsEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "a1", + "a2", + "a202", + "a3", + "a4", + "a5", + "a119", + "a118", + "a117", + "a11", + "a12", + "a13", + "a14", + "a15", + "a16", + "a105", + "a17", + "a18", + "a19", + "a20", + "a21", + "a22", + "a23", + "a24", + "a25", + "a26", + "a27", + "a28", + "a6", + "a7", + "a8", + "a9", + "a10", + "a29", + "a30", + "a31", + "a32", + "a33", + "a34", + "a35", + "a36", + "a37", + "a38", + "a39", + "a40", + "a41", + "a42", + "a43", + "a44", + "a45", + "a46", + "a47", + "a48", + "a49", + "a50", + "a51", + "a52", + "a53", + "a54", + "a55", + "a56", + "a57", + "a58", + "a59", + "a60", + "a61", + "a62", + "a63", + "a64", + "a65", + "a66", + "a67", + "a68", + "a69", + "a70", + "a71", + "a72", + "a73", + "a74", + "a203", + "a75", + "a204", + "a76", + "a77", + "a78", + "a79", + "a81", + "a82", + "a83", + "a84", + "a97", + "a98", + "a99", + "a100", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "a101", + "a102", + "a103", + "a104", + "a106", + "a107", + "a108", + "a112", + "a111", + "a110", + "a109", + "a120", + "a121", + "a122", + "a123", + "a124", + "a125", + "a126", + "a127", + "a128", + "a129", + "a130", + "a131", + "a132", + "a133", + "a134", + "a135", + "a136", + "a137", + "a138", + "a139", + "a140", + "a141", + "a142", + "a143", + "a144", + "a145", + "a146", + "a147", + "a148", + "a149", + "a150", + "a151", + "a152", + "a153", + "a154", + "a155", + "a156", + "a157", + "a158", + "a159", + "a160", + "a161", + "a163", + "a164", + "a196", + "a165", + "a192", + "a166", + "a167", + "a168", + "a169", + "a170", + "a171", + "a172", + "a173", + "a162", + "a174", + "a175", + "a176", + "a177", + "a178", + "a179", + "a193", + "a180", + "a199", + "a181", + "a200", + "a182", + NULL, + "a201", + "a183", + "a184", + "a197", + "a185", + "a194", + "a198", + "a186", + "a195", + "a187", + "a188", + "a189", + "a190", + "a191", + NULL, + "a205", + "a206", + "a85", + "a86", + "a87", + "a88", + "a89", + "a90", + "a91", + "a92", + "a93", + "a94", + "a95", + "a96" +}; +static GfxFontEncoding zapfDingbatsEncoding(zapfDingbatsEncodingNames, + zapfDingbatsEncodingSize); + +#define macRomanEncodingSize 256 +static char *macRomanEncodingNames[macRomanEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quotesingle", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "hyphen", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "grave", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + NULL, + "Adieresis", + "Aring", + "Ccedilla", + "Eacute", + "Ntilde", + "Odieresis", + "Udieresis", + "aacute", + "agrave", + "acircumflex", + "adieresis", + "atilde", + "aring", + "ccedilla", + "eacute", + "egrave", + "ecircumflex", + "edieresis", + "iacute", + "igrave", + "icircumflex", + "idieresis", + "ntilde", + "oacute", + "ograve", + "ocircumflex", + "odieresis", + "otilde", + "uacute", + "ugrave", + "ucircumflex", + "udieresis", + "dagger", + "degree", + "cent", + "sterling", + "section", + "bullet", + "paragraph", + "germandbls", + "registered", + "copyright", + "trademark", + "acute", + "dieresis", + NULL, + "AE", + "Oslash", + NULL, + "plusminus", + NULL, + NULL, + "yen", + "mu", + NULL, + NULL, + NULL, + NULL, + NULL, + "ordfeminine", + "ordmasculine", + NULL, + "ae", + "oslash", + "questiondown", + "exclamdown", + "logicalnot", + NULL, + "florin", + NULL, + NULL, + "guillemotleft", + "guillemotright", + "ellipsis", + "space", + "Agrave", + "Atilde", + "Otilde", + "OE", + "oe", + "endash", + "emdash", + "quotedblleft", + "quotedblright", + "quoteleft", + "quoteright", + "divide", + NULL, + "ydieresis", + "Ydieresis", + "fraction", + "currency", + "guilsinglleft", + "guilsinglright", + "fi", + "fl", + "daggerdbl", + "periodcentered", + "quotesinglbase", + "quotedblbase", + "perthousand", + "Acircumflex", + "Ecircumflex", + "Aacute", + "Edieresis", + "Egrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Igrave", + "Oacute", + "Ocircumflex", + NULL, + "Ograve", + "Uacute", + "Ucircumflex", + "Ugrave", + "dotlessi", + "circumflex", + "tilde", + "macron", + "breve", + "dotaccent", + "ring", + "cedilla", + "hungarumlaut", + "ogonek", + "caron" +}; +static GfxFontEncoding macRomanEncoding(macRomanEncodingNames, + macRomanEncodingSize); + +#define winAnsiEncodingSize 256 +static char *winAnsiEncodingNames[winAnsiEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quotesingle", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "hyphen", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "grave", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + "bullet", + "bullet", + "bullet", + "quotesinglbase", + "florin", + "quotedblbase", + "ellipsis", + "dagger", + "daggerdbl", + "circumflex", + "perthousand", + "Scaron", + "guilsinglleft", + "OE", + "bullet", + "bullet", + "bullet", + "bullet", + "quoteleft", + "quoteright", + "quotedblleft", + "quotedblright", + "bullet", + "endash", + "emdash", + "tilde", + "trademark", + "scaron", + "guilsinglright", + "oe", + "bullet", + "bullet", + "Ydieresis", + "space", + "exclamdown", + "cent", + "sterling", + "currency", + "yen", + "brokenbar", + "section", + "dieresis", + "copyright", + "ordfeminine", + "guillemotleft", + "logicalnot", + "hyphen", + "registered", + "macron", + "degree", + "plusminus", + "twosuperior", + "threesuperior", + "acute", + "mu", + "paragraph", + "periodcentered", + "cedilla", + "onesuperior", + "ordmasculine", + "guillemotright", + "onequarter", + "onehalf", + "threequarters", + "questiondown", + "Agrave", + "Aacute", + "Acircumflex", + "Atilde", + "Adieresis", + "Aring", + "AE", + "Ccedilla", + "Egrave", + "Eacute", + "Ecircumflex", + "Edieresis", + "Igrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Eth", + "Ntilde", + "Ograve", + "Oacute", + "Ocircumflex", + "Otilde", + "Odieresis", + "multiply", + "Oslash", + "Ugrave", + "Uacute", + "Ucircumflex", + "Udieresis", + "Yacute", + "Thorn", + "germandbls", + "agrave", + "aacute", + "acircumflex", + "atilde", + "adieresis", + "aring", + "ae", + "ccedilla", + "egrave", + "eacute", + "ecircumflex", + "edieresis", + "igrave", + "iacute", + "icircumflex", + "idieresis", + "eth", + "ntilde", + "ograve", + "oacute", + "ocircumflex", + "otilde", + "odieresis", + "divide", + "oslash", + "ugrave", + "uacute", + "ucircumflex", + "udieresis", + "yacute", + "thorn", + "ydieresis" +}; +static GfxFontEncoding winAnsiEncoding(winAnsiEncodingNames, + winAnsiEncodingSize); + +//------------------------------------------------------------------------ +// Character widths for built-in fonts. +//------------------------------------------------------------------------ + +static Gushort courierWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 0, 600, 600, 600, 600, 0, 600, 600, + 600, 600, 600, 600, 600, 600, 0, 600, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 0, 600, 600, 0, 600, 600, 600, + 600, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 0, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 0, 600, 0, 0, 0, 600, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600 +}; + +static Gushort courierBoldWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 0, 600, 600, 600, 600, 0, 600, 600, + 600, 600, 600, 600, 600, 600, 0, 600, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 0, 600, 600, 0, 600, 600, 600, + 600, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 0, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 0, 600, 0, 0, 0, 600, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600 +}; + +static Gushort courierBoldObliqueWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 0, 600, 600, 600, 600, 0, 600, 600, + 600, 600, 600, 600, 600, 600, 0, 600, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 0, 600, 600, 0, 600, 600, 600, + 600, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 0, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 0, 600, 0, 0, 0, 600, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600 +}; + +static Gushort courierObliqueWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 0, 600, 600, 600, 600, 0, 600, 600, + 600, 600, 600, 600, 600, 600, 0, 600, + 0, 600, 600, 600, 600, 600, 600, 600, + 600, 0, 600, 600, 0, 600, 600, 600, + 600, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 600, 0, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 0, 600, 0, 0, 0, 600, 0, 0, + 600, 600, 600, 600, 0, 0, 0, 0, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600, 600, + 600, 600, 600, 600, 600, 600, 600 +}; + +static Gushort helveticaWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 278, 278, 355, 556, 556, 889, 667, 222, + 333, 333, 389, 584, 278, 333, 278, 278, + 556, 556, 556, 556, 556, 556, 556, 556, + 556, 556, 278, 278, 584, 584, 584, 556, + 1015, 667, 667, 722, 722, 667, 611, 778, + 722, 278, 500, 667, 556, 833, 722, 778, + 667, 778, 722, 667, 611, 722, 667, 944, + 667, 667, 611, 278, 278, 278, 469, 556, + 222, 556, 556, 500, 556, 556, 278, 556, + 556, 222, 222, 500, 222, 833, 556, 556, + 556, 556, 333, 500, 278, 556, 500, 722, + 500, 500, 500, 334, 260, 334, 584, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 556, 556, 167, 556, 556, 556, + 556, 191, 333, 556, 333, 333, 500, 500, + 0, 556, 556, 556, 278, 0, 537, 350, + 222, 333, 333, 556, 1000, 1000, 0, 611, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1000, 0, 370, 0, 0, 0, 0, + 556, 778, 1000, 365, 0, 0, 0, 0, + 0, 889, 0, 0, 0, 278, 0, 0, + 222, 611, 944, 611, 0, 0, 0, 0, + 667, 667, 667, 667, 667, 667, 722, 667, + 667, 667, 667, 722, 278, 278, 278, 278, + 722, 778, 778, 778, 778, 778, 667, 667, + 722, 722, 722, 722, 667, 667, 611, 556, + 556, 556, 556, 556, 556, 260, 500, 737, + 400, 584, 556, 556, 556, 556, 556, 278, + 278, 278, 278, 584, 584, 556, 584, 556, + 556, 556, 556, 556, 834, 834, 333, 556, + 584, 737, 500, 556, 834, 333, 1000, 333, + 556, 556, 556, 556, 500, 500, 500 +}; + +static Gushort helveticaBoldWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 278, 333, 474, 556, 556, 889, 722, 278, + 333, 333, 389, 584, 278, 333, 278, 278, + 556, 556, 556, 556, 556, 556, 556, 556, + 556, 556, 333, 333, 584, 584, 584, 611, + 975, 722, 722, 722, 722, 667, 611, 778, + 722, 278, 556, 722, 611, 833, 722, 778, + 667, 778, 722, 667, 611, 722, 667, 944, + 667, 667, 611, 333, 278, 333, 584, 556, + 278, 556, 611, 556, 611, 556, 333, 611, + 611, 278, 278, 556, 278, 889, 611, 611, + 611, 611, 389, 556, 333, 611, 556, 778, + 556, 556, 500, 389, 280, 389, 584, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 556, 556, 167, 556, 556, 556, + 556, 238, 500, 556, 333, 333, 611, 611, + 0, 556, 556, 556, 278, 0, 556, 350, + 278, 500, 500, 556, 1000, 1000, 0, 611, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1000, 0, 370, 0, 0, 0, 0, + 611, 778, 1000, 365, 0, 0, 0, 0, + 0, 889, 0, 0, 0, 278, 0, 0, + 278, 611, 944, 611, 0, 0, 0, 0, + 722, 722, 722, 722, 722, 722, 722, 667, + 667, 667, 667, 722, 278, 278, 278, 278, + 722, 778, 778, 778, 778, 778, 667, 667, + 722, 722, 722, 722, 667, 667, 611, 556, + 556, 556, 556, 556, 556, 280, 556, 737, + 400, 584, 556, 556, 556, 556, 611, 278, + 278, 278, 278, 584, 584, 611, 584, 611, + 611, 611, 611, 611, 834, 834, 333, 611, + 584, 737, 556, 611, 834, 333, 1000, 333, + 611, 611, 611, 611, 556, 556, 500 +}; + +static Gushort helveticaBoldObliqueWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 278, 333, 474, 556, 556, 889, 722, 278, + 333, 333, 389, 584, 278, 333, 278, 278, + 556, 556, 556, 556, 556, 556, 556, 556, + 556, 556, 333, 333, 584, 584, 584, 611, + 975, 722, 722, 722, 722, 667, 611, 778, + 722, 278, 556, 722, 611, 833, 722, 778, + 667, 778, 722, 667, 611, 722, 667, 944, + 667, 667, 611, 333, 278, 333, 584, 556, + 278, 556, 611, 556, 611, 556, 333, 611, + 611, 278, 278, 556, 278, 889, 611, 611, + 611, 611, 389, 556, 333, 611, 556, 778, + 556, 556, 500, 389, 280, 389, 584, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 556, 556, 167, 556, 556, 556, + 556, 238, 500, 556, 333, 333, 611, 611, + 0, 556, 556, 556, 278, 0, 556, 350, + 278, 500, 500, 556, 1000, 1000, 0, 611, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1000, 0, 370, 0, 0, 0, 0, + 611, 778, 1000, 365, 0, 0, 0, 0, + 0, 889, 0, 0, 0, 278, 0, 0, + 278, 611, 944, 611, 0, 0, 0, 0, + 722, 722, 722, 722, 722, 722, 722, 667, + 667, 667, 667, 722, 278, 278, 278, 278, + 722, 778, 778, 778, 778, 778, 667, 667, + 722, 722, 722, 722, 667, 667, 611, 556, + 556, 556, 556, 556, 556, 280, 556, 737, + 400, 584, 556, 556, 556, 556, 611, 278, + 278, 278, 278, 584, 584, 611, 584, 611, + 611, 611, 611, 611, 834, 834, 333, 611, + 584, 737, 556, 611, 834, 333, 1000, 333, + 611, 611, 611, 611, 556, 556, 500 +}; + +static Gushort helveticaObliqueWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 278, 278, 355, 556, 556, 889, 667, 222, + 333, 333, 389, 584, 278, 333, 278, 278, + 556, 556, 556, 556, 556, 556, 556, 556, + 556, 556, 278, 278, 584, 584, 584, 556, + 1015, 667, 667, 722, 722, 667, 611, 778, + 722, 278, 500, 667, 556, 833, 722, 778, + 667, 778, 722, 667, 611, 722, 667, 944, + 667, 667, 611, 278, 278, 278, 469, 556, + 222, 556, 556, 500, 556, 556, 278, 556, + 556, 222, 222, 500, 222, 833, 556, 556, + 556, 556, 333, 500, 278, 556, 500, 722, + 500, 500, 500, 334, 260, 334, 584, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 556, 556, 167, 556, 556, 556, + 556, 191, 333, 556, 333, 333, 500, 500, + 0, 556, 556, 556, 278, 0, 537, 350, + 222, 333, 333, 556, 1000, 1000, 0, 611, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1000, 0, 370, 0, 0, 0, 0, + 556, 778, 1000, 365, 0, 0, 0, 0, + 0, 889, 0, 0, 0, 278, 0, 0, + 222, 611, 944, 611, 0, 0, 0, 0, + 667, 667, 667, 667, 667, 667, 722, 667, + 667, 667, 667, 722, 278, 278, 278, 278, + 722, 778, 778, 778, 778, 778, 667, 667, + 722, 722, 722, 722, 667, 667, 611, 556, + 556, 556, 556, 556, 556, 260, 500, 737, + 400, 584, 556, 556, 556, 556, 556, 278, + 278, 278, 278, 584, 584, 556, 584, 556, + 556, 556, 556, 556, 834, 834, 333, 556, + 584, 737, 500, 556, 834, 333, 1000, 333, + 556, 556, 556, 556, 500, 500, 500 +}; + +static Gushort symbolWidths[257] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 250, 333, 713, 500, 549, 833, 778, 439, + 333, 333, 500, 549, 250, 549, 250, 278, + 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 278, 278, 549, 549, 549, 444, + 549, 722, 667, 722, 612, 611, 763, 603, + 722, 333, 631, 722, 686, 889, 722, 722, + 768, 741, 556, 592, 611, 690, 439, 768, + 645, 795, 611, 333, 863, 333, 658, 500, + 500, 631, 549, 549, 494, 439, 521, 411, + 603, 329, 603, 549, 549, 576, 521, 549, + 549, 521, 549, 603, 439, 576, 713, 686, + 493, 686, 494, 480, 200, 480, 549, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 620, 247, 549, 167, 713, 500, 753, + 753, 753, 753, 1042, 987, 603, 987, 603, + 400, 549, 411, 549, 549, 713, 494, 460, + 549, 549, 549, 549, 1000, 603, 1000, 658, + 823, 686, 795, 987, 768, 768, 823, 768, + 768, 713, 713, 713, 713, 713, 713, 713, + 768, 713, 790, 790, 890, 823, 549, 250, + 713, 603, 603, 1042, 987, 603, 987, 603, + 494, 329, 790, 790, 786, 713, 384, 384, + 384, 384, 384, 384, 494, 494, 494, 494, + 0, 329, 274, 686, 686, 686, 384, 384, + 384, 384, 384, 384, 494, 494, 494, 0, + 790 +}; + +static Gushort timesBoldWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 250, 333, 555, 500, 500, 1000, 833, 333, + 333, 333, 500, 570, 250, 333, 250, 278, + 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 333, 333, 570, 570, 570, 500, + 930, 722, 667, 722, 722, 667, 611, 778, + 778, 389, 500, 778, 667, 944, 722, 778, + 611, 778, 722, 556, 667, 722, 722, 1000, + 722, 722, 667, 333, 278, 333, 581, 500, + 333, 500, 556, 444, 556, 444, 333, 500, + 556, 278, 333, 556, 278, 833, 556, 500, + 556, 556, 444, 389, 333, 556, 500, 722, + 500, 500, 444, 394, 220, 394, 520, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 500, 500, 167, 500, 500, 500, + 500, 278, 500, 500, 333, 333, 556, 556, + 0, 500, 500, 500, 250, 0, 540, 350, + 333, 500, 500, 500, 1000, 1000, 0, 500, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 1000, 0, 300, 0, 0, 0, 0, + 667, 778, 1000, 330, 0, 0, 0, 0, + 0, 722, 0, 0, 0, 278, 0, 0, + 278, 500, 722, 556, 0, 0, 0, 0, + 722, 722, 722, 722, 722, 722, 722, 667, + 667, 667, 667, 722, 389, 389, 389, 389, + 722, 778, 778, 778, 778, 778, 556, 611, + 722, 722, 722, 722, 722, 722, 667, 500, + 500, 500, 500, 500, 500, 220, 444, 747, + 400, 570, 444, 444, 444, 444, 500, 278, + 278, 278, 278, 570, 570, 556, 570, 556, + 500, 500, 500, 500, 750, 750, 300, 500, + 570, 747, 389, 556, 750, 300, 1000, 300, + 556, 556, 556, 556, 500, 500, 444 +}; + +static Gushort timesBoldItalicWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 250, 389, 555, 500, 500, 833, 778, 333, + 333, 333, 500, 570, 250, 333, 250, 278, + 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 333, 333, 570, 570, 570, 500, + 832, 667, 667, 667, 722, 667, 667, 722, + 778, 389, 500, 667, 611, 889, 722, 722, + 611, 722, 667, 556, 611, 722, 667, 889, + 667, 611, 611, 333, 278, 333, 570, 500, + 333, 500, 500, 444, 500, 444, 333, 500, + 556, 278, 278, 500, 278, 778, 556, 500, + 500, 500, 389, 389, 278, 556, 444, 667, + 500, 444, 389, 348, 220, 348, 570, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 389, 500, 500, 167, 500, 500, 500, + 500, 278, 500, 500, 333, 333, 556, 556, + 0, 500, 500, 500, 250, 0, 500, 350, + 333, 500, 500, 500, 1000, 1000, 0, 500, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 944, 0, 266, 0, 0, 0, 0, + 611, 722, 944, 300, 0, 0, 0, 0, + 0, 722, 0, 0, 0, 278, 0, 0, + 278, 500, 722, 500, 0, 0, 0, 0, + 667, 667, 667, 667, 667, 667, 667, 667, + 667, 667, 667, 722, 389, 389, 389, 389, + 722, 722, 722, 722, 722, 722, 556, 611, + 722, 722, 722, 722, 611, 611, 611, 500, + 500, 500, 500, 500, 500, 220, 444, 747, + 400, 570, 444, 444, 444, 444, 500, 278, + 278, 278, 278, 606, 606, 576, 570, 556, + 500, 500, 500, 500, 750, 750, 300, 500, + 570, 747, 389, 500, 750, 300, 1000, 300, + 556, 556, 556, 556, 444, 444, 389 +}; + +static Gushort timesItalicWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 250, 333, 420, 500, 500, 833, 778, 333, + 333, 333, 500, 675, 250, 333, 250, 278, + 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 333, 333, 675, 675, 675, 500, + 920, 611, 611, 667, 722, 611, 611, 722, + 722, 333, 444, 667, 556, 833, 667, 722, + 611, 722, 611, 500, 556, 722, 611, 833, + 611, 556, 556, 389, 278, 389, 422, 500, + 333, 500, 500, 444, 500, 444, 278, 500, + 500, 278, 278, 444, 278, 722, 500, 500, + 500, 500, 389, 389, 278, 500, 444, 667, + 444, 444, 389, 400, 275, 400, 541, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 389, 500, 500, 167, 500, 500, 500, + 500, 214, 556, 500, 333, 333, 500, 500, + 0, 500, 500, 500, 250, 0, 523, 350, + 333, 556, 556, 500, 889, 1000, 0, 500, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 889, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 889, 0, 276, 0, 0, 0, 0, + 556, 722, 944, 310, 0, 0, 0, 0, + 0, 667, 0, 0, 0, 278, 0, 0, + 278, 500, 667, 500, 0, 0, 0, 0, + 611, 611, 611, 611, 611, 611, 667, 611, + 611, 611, 611, 722, 333, 333, 333, 333, + 667, 722, 722, 722, 722, 722, 500, 611, + 722, 722, 722, 722, 556, 556, 556, 500, + 500, 500, 500, 500, 500, 275, 444, 760, + 400, 675, 444, 444, 444, 444, 500, 278, + 278, 278, 278, 675, 675, 500, 675, 500, + 500, 500, 500, 500, 750, 750, 300, 500, + 675, 760, 389, 500, 750, 300, 980, 300, + 500, 500, 500, 500, 444, 444, 389 +}; + +static Gushort timesRomanWidths[335] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 250, 333, 408, 500, 500, 833, 778, 333, + 333, 333, 500, 564, 250, 333, 250, 278, + 500, 500, 500, 500, 500, 500, 500, 500, + 500, 500, 278, 278, 564, 564, 564, 444, + 921, 722, 667, 667, 722, 611, 556, 722, + 722, 333, 389, 722, 611, 889, 722, 722, + 556, 722, 667, 556, 611, 722, 722, 944, + 722, 722, 611, 333, 278, 333, 469, 500, + 333, 444, 500, 444, 500, 444, 333, 500, + 500, 278, 278, 500, 278, 778, 500, 500, + 500, 500, 333, 389, 278, 500, 500, 722, + 500, 500, 444, 480, 200, 480, 541, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 333, 500, 500, 167, 500, 500, 500, + 500, 180, 444, 500, 333, 333, 556, 556, + 0, 500, 500, 500, 250, 0, 453, 350, + 333, 444, 444, 500, 1000, 1000, 0, 444, + 0, 333, 333, 333, 333, 333, 333, 333, + 333, 0, 333, 333, 0, 333, 333, 333, + 1000, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 889, 0, 276, 0, 0, 0, 0, + 611, 722, 889, 310, 0, 0, 0, 0, + 0, 667, 0, 0, 0, 278, 0, 0, + 278, 500, 722, 500, 0, 0, 0, 0, + 722, 722, 722, 722, 722, 722, 667, 611, + 611, 611, 611, 722, 333, 333, 333, 333, + 722, 722, 722, 722, 722, 722, 556, 556, + 722, 722, 722, 722, 722, 722, 611, 444, + 444, 444, 444, 444, 444, 200, 444, 760, + 400, 564, 444, 444, 444, 444, 500, 278, + 278, 278, 278, 564, 564, 500, 564, 500, + 500, 500, 500, 500, 750, 750, 300, 500, + 564, 760, 389, 500, 750, 300, 980, 300, + 500, 500, 500, 500, 500, 500, 444 +}; + +static Gushort zapfDingbatsWidths[270] = { + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 278, 974, 961, 974, 980, 719, 789, 790, + 791, 690, 960, 939, 549, 855, 911, 933, + 911, 945, 974, 755, 846, 762, 761, 571, + 677, 763, 760, 759, 754, 494, 552, 537, + 577, 692, 786, 788, 788, 790, 793, 794, + 816, 823, 789, 841, 823, 833, 816, 831, + 923, 744, 723, 749, 790, 792, 695, 776, + 768, 792, 759, 707, 708, 682, 701, 826, + 815, 789, 789, 707, 687, 696, 689, 786, + 787, 713, 791, 785, 791, 873, 761, 762, + 762, 759, 759, 892, 892, 788, 784, 438, + 138, 277, 415, 392, 392, 668, 668, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 732, 544, 544, 910, 667, 760, 760, + 776, 595, 694, 626, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 788, 788, 788, 788, + 788, 788, 788, 788, 894, 838, 1016, 458, + 748, 924, 748, 918, 927, 928, 928, 834, + 873, 828, 924, 924, 917, 930, 931, 463, + 883, 836, 836, 867, 867, 696, 696, 874, + 0, 874, 760, 946, 771, 865, 771, 888, + 967, 888, 831, 873, 927, 970, 918, 0, + 509, 410, 509, 410, 234, 234, 390, 390, + 276, 276, 317, 317, 334, 334 +}; + +//------------------------------------------------------------------------ +// Built-in font table. +//------------------------------------------------------------------------ + +struct BuiltinFont { + char *name; + Gushort *widths; + GfxFontEncoding *encoding; +}; + +#define numBuiltinFonts ((int)(sizeof(builtinFonts)/sizeof(BuiltinFont))) + +static BuiltinFont builtinFonts[] = { + {"Courier", courierWidths, &standardEncoding}, + {"Courier-Bold", courierBoldWidths, &standardEncoding}, + {"Courier-BoldOblique", courierBoldObliqueWidths, &standardEncoding}, + {"Courier-Oblique", courierObliqueWidths, &standardEncoding}, + {"Helvetica", helveticaWidths, &standardEncoding}, + {"Helvetica-Bold", helveticaBoldWidths, &standardEncoding}, + {"Helvetica-BoldOblique", helveticaBoldObliqueWidths, &standardEncoding}, + {"Helvetica-Oblique", helveticaObliqueWidths, &standardEncoding}, + {"Symbol", symbolWidths, &symbolEncoding}, + {"Times-Bold", timesBoldWidths, &standardEncoding}, + {"Times-BoldItalic", timesBoldItalicWidths, &standardEncoding}, + {"Times-Italic", timesItalicWidths, &standardEncoding}, + {"Times-Roman", timesRomanWidths, &standardEncoding}, + {"ZapfDingbats", zapfDingbatsWidths, &zapfDingbatsEncoding} +}; + +#endif diff --git a/pdf/xpdf/Gfx.cc b/pdf/xpdf/Gfx.cc new file mode 100644 index 00000000..d58ddd8a --- /dev/null +++ b/pdf/xpdf/Gfx.cc @@ -0,0 +1,1573 @@ +//======================================================================== +// +// Gfx.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include "gmem.h" +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "Stream.h" +#include "Lexer.h" +#include "Parser.h" +#include "GfxFont.h" +#include "GfxState.h" +#include "OutputDev.h" +#include "Params.h" +#include "Error.h" +#include "Gfx.h" + +//------------------------------------------------------------------------ +// Operator table +//------------------------------------------------------------------------ + +Operator Gfx::opTab[] = { + {"\"", 3, {tchkNum, tchkNum, tchkString}, + &Gfx::opMoveSetShowText}, + {"'", 1, {tchkString}, + &Gfx::opMoveShowText}, + {"B", 0, {tchkNone}, + &Gfx::opFillStroke}, + {"B*", 0, {tchkNone}, + &Gfx::opEOFillStroke}, + {"BDC", 2, {tchkName, tchkProps}, + &Gfx::opBeginMarkedContent}, + {"BI", 0, {tchkNone}, + &Gfx::opBeginImage}, + {"BMC", 1, {tchkName}, + &Gfx::opBeginMarkedContent}, + {"BT", 0, {tchkNone}, + &Gfx::opBeginText}, + {"BX", 0, {tchkNone}, + &Gfx::opBeginIgnoreUndef}, + {"CS", 1, {tchkName}, + &Gfx::opSetStrokeColorSpace}, + {"DP", 2, {tchkName, tchkProps}, + &Gfx::opMarkPoint}, + {"Do", 1, {tchkName}, + &Gfx::opXObject}, + {"EI", 0, {tchkNone}, + &Gfx::opEndImage}, + {"EMC", 0, {tchkNone}, + &Gfx::opEndMarkedContent}, + {"ET", 0, {tchkNone}, + &Gfx::opEndText}, + {"EX", 0, {tchkNone}, + &Gfx::opEndIgnoreUndef}, + {"F", 0, {tchkNone}, + &Gfx::opFill}, + {"G", 1, {tchkNum}, + &Gfx::opSetStrokeGray}, + {"ID", 0, {tchkNone}, + &Gfx::opImageData}, + {"J", 1, {tchkInt}, + &Gfx::opSetLineCap}, + {"K", 4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opSetStrokeCMYKColor}, + {"M", 1, {tchkNum}, + &Gfx::opSetMiterLimit}, + {"MP", 1, {tchkName}, + &Gfx::opMarkPoint}, + {"Q", 0, {tchkNone}, + &Gfx::opRestore}, + {"RG", 3, {tchkNum, tchkNum, tchkNum}, + &Gfx::opSetStrokeRGBColor}, + {"S", 0, {tchkNone}, + &Gfx::opStroke}, + {"SC", -4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opSetStrokeColor}, + {"SCN", -5, {tchkSCN, tchkSCN, tchkSCN, tchkSCN, + tchkSCN}, + &Gfx::opSetStrokeColorN}, + {"T*", 0, {tchkNone}, + &Gfx::opTextNextLine}, + {"TD", 2, {tchkNum, tchkNum}, + &Gfx::opTextMoveSet}, + {"TJ", 1, {tchkArray}, + &Gfx::opShowSpaceText}, + {"TL", 1, {tchkNum}, + &Gfx::opSetTextLeading}, + {"Tc", 1, {tchkNum}, + &Gfx::opSetCharSpacing}, + {"Td", 2, {tchkNum, tchkNum}, + &Gfx::opTextMove}, + {"Tf", 2, {tchkName, tchkNum}, + &Gfx::opSetFont}, + {"Tj", 1, {tchkString}, + &Gfx::opShowText}, + {"Tm", 6, {tchkNum, tchkNum, tchkNum, tchkNum, + tchkNum, tchkNum}, + &Gfx::opSetTextMatrix}, + {"Tr", 1, {tchkInt}, + &Gfx::opSetTextRender}, + {"Ts", 1, {tchkNum}, + &Gfx::opSetTextRise}, + {"Tw", 1, {tchkNum}, + &Gfx::opSetWordSpacing}, + {"Tz", 1, {tchkNum}, + &Gfx::opSetHorizScaling}, + {"W", 0, {tchkNone}, + &Gfx::opClip}, + {"W*", 0, {tchkNone}, + &Gfx::opEOClip}, + {"b", 0, {tchkNone}, + &Gfx::opCloseFillStroke}, + {"b*", 0, {tchkNone}, + &Gfx::opCloseEOFillStroke}, + {"c", 6, {tchkNum, tchkNum, tchkNum, tchkNum, + tchkNum, tchkNum}, + &Gfx::opCurveTo}, + {"cm", 6, {tchkNum, tchkNum, tchkNum, tchkNum, + tchkNum, tchkNum}, + &Gfx::opConcat}, + {"cs", 1, {tchkName}, + &Gfx::opSetFillColorSpace}, + {"d", 2, {tchkArray, tchkNum}, + &Gfx::opSetDash}, + {"d0", 2, {tchkNum, tchkNum}, + &Gfx::opSetCharWidth}, + {"d1", 6, {tchkNum, tchkNum, tchkNum, tchkNum, + tchkNum, tchkNum}, + &Gfx::opSetCacheDevice}, + {"f", 0, {tchkNone}, + &Gfx::opFill}, + {"f*", 0, {tchkNone}, + &Gfx::opEOFill}, + {"g", 1, {tchkNum}, + &Gfx::opSetFillGray}, + {"gs", 1, {tchkName}, + &Gfx::opSetExtGState}, + {"h", 0, {tchkNone}, + &Gfx::opClosePath}, + {"i", 1, {tchkNum}, + &Gfx::opSetFlat}, + {"j", 1, {tchkInt}, + &Gfx::opSetLineJoin}, + {"k", 4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opSetFillCMYKColor}, + {"l", 2, {tchkNum, tchkNum}, + &Gfx::opLineTo}, + {"m", 2, {tchkNum, tchkNum}, + &Gfx::opMoveTo}, + {"n", 0, {tchkNone}, + &Gfx::opEndPath}, + {"q", 0, {tchkNone}, + &Gfx::opSave}, + {"re", 4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opRectangle}, + {"rg", 3, {tchkNum, tchkNum, tchkNum}, + &Gfx::opSetFillRGBColor}, + {"s", 0, {tchkNone}, + &Gfx::opCloseStroke}, + {"sc", -4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opSetFillColor}, + {"scn", -5, {tchkSCN, tchkSCN, tchkSCN, tchkSCN, + tchkSCN}, + &Gfx::opSetFillColorN}, + {"v", 4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opCurveTo1}, + {"w", 1, {tchkNum}, + &Gfx::opSetLineWidth}, + {"y", 4, {tchkNum, tchkNum, tchkNum, tchkNum}, + &Gfx::opCurveTo2}, +}; + +#define numOps (sizeof(opTab) / sizeof(Operator)) + +//------------------------------------------------------------------------ +// Gfx +//------------------------------------------------------------------------ + +Gfx::Gfx(OutputDev *out1, int pageNum, Dict *resDict, + int dpi, double x1, double y1, double x2, double y2, GBool crop, + double cropX1, double cropY1, double cropX2, double cropY2, + int rotate) { + Object obj1; + + // start the resource stack + res = new GfxResources(NULL); + + // build font dictionary + res->fonts = NULL; + if (resDict) { + resDict->lookup("Font", &obj1); + if (obj1.isDict()) + res->fonts = new GfxFontDict(obj1.getDict()); + obj1.free(); + } + + // get XObject dictionary + if (resDict) + resDict->lookup("XObject", &res->xObjDict); + else + res->xObjDict.initNull(); + + // get colorspace dictionary + if (resDict) + resDict->lookup("ColorSpace", &res->colorSpaceDict); + else + res->colorSpaceDict.initNull(); + + // initialize + out = out1; + state = new GfxState(dpi, x1, y1, x2, y2, rotate, out->upsideDown()); + fontChanged = gFalse; + clip = clipNone; + ignoreUndef = 0; + out->startPage(pageNum, state); + out->setDefaultCTM(state->getCTM()); + out->updateAll(state); + + // set crop box + if (crop) { + state->moveTo(cropX1, cropY1); + state->lineTo(cropX2, cropY1); + state->lineTo(cropX2, cropY2); + state->lineTo(cropX1, cropY2); + state->closePath(); + out->clip(state); + state->clearPath(); + } +} + +Gfx::~Gfx() { + GfxResources *resPtr; + + while (state->hasSaves()) { + state = state->restore(); + out->restoreState(state); + } + out->endPage(); + while (res) { + resPtr = res->next; + delete res; + res = resPtr; + } + if (state) + delete state; +} + +GfxResources::~GfxResources() { + if (fonts) + delete fonts; + xObjDict.free(); + colorSpaceDict.free(); +} + +void Gfx::display(Object *obj) { + Object obj2; + int i; + + if (obj->isArray()) { + for (i = 0; i < obj->arrayGetLength(); ++i) { + obj->arrayGet(i, &obj2); + if (!obj2.isStream()) { + error(-1, "Weird page contents"); + obj2.free(); + return; + } + obj2.free(); + } + } else if (!obj->isStream()) { + error(-1, "Weird page contents"); + return; + } + parser = new Parser(new Lexer(obj)); + go(); +} + +void Gfx::go() { + Object obj; + Object args[maxArgs]; + int numCmds, numArgs; + int i; + + // scan a sequence of objects + numCmds = 0; + numArgs = 0; + parser->getObj(&obj); + while (!obj.isEOF()) { + + // got a command - execute it + if (obj.isCmd()) { + if (printCommands) { + obj.print(stdout); + for (i = 0; i < numArgs; ++i) { + printf(" "); + args[i].print(stdout); + } + printf("\n"); + } + execOp(&obj, args, numArgs); + obj.free(); + for (i = 0; i < numArgs; ++i) + args[i].free(); + numArgs = 0; + + // periodically update display + if (++numCmds == 200) { + out->dump(); + numCmds = 0; + } + + // got an argument - save it + } else if (numArgs < maxArgs) { + args[numArgs++] = obj; + + // too many arguments - something is wrong + } else { + error(getPos(), "Too many args in content stream"); + if (printCommands) { + printf("throwing away arg: "); + obj.print(stdout); + printf("\n"); + } + obj.free(); + } + + // grab the next object + parser->getObj(&obj); + } + obj.free(); + + // args at end with no command + if (numArgs > 0) { + error(getPos(), "Leftover args in content stream"); + if (printCommands) { + printf("%d leftovers:", numArgs); + for (i = 0; i < numArgs; ++i) { + printf(" "); + args[i].print(stdout); + } + printf("\n"); + } + for (i = 0; i < numArgs; ++i) + args[i].free(); + } + + // update display + if (numCmds > 0) + out->dump(); + + // clean up + if (parser) + delete parser; + if (printCommands) + fflush(stdout); +} + +void Gfx::execOp(Object *cmd, Object args[], int numArgs) { + Operator *op; + char *name; + int i; + + // find operator + name = cmd->getName(); + if (!(op = findOp(name))) { + if (ignoreUndef == 0) + error(getPos(), "Unknown operator '%s'", name); + return; + } + + // type check args + if (op->numArgs >= 0) { + if (numArgs != op->numArgs) { + error(getPos(), "Wrong number (%d) of args to '%s' operator", + numArgs, name); + return; + } + } else { + if (numArgs > -op->numArgs) { + error(getPos(), "Too many (%d) args to '%s' operator", + numArgs, name); + return; + } + } + for (i = 0; i < numArgs; ++i) { + if (!checkArg(&args[i], op->tchk[i])) { + error(getPos(), "Arg #%d to '%s' operator is wrong type (%s)", + i, name, args[i].getTypeName()); + return; + } + } + + // do it + (this->*op->func)(args, numArgs); +} + +Operator *Gfx::findOp(char *name) { + int a, b, m, cmp; + + a = -1; + b = numOps; + // invariant: opTab[a] < name < opTab[b] + while (b - a > 1) { + m = (a + b) / 2; + cmp = strcmp(opTab[m].name, name); + if (cmp < 0) + a = m; + else if (cmp > 0) + b = m; + else + a = b = m; + } + if (cmp != 0) + return NULL; + return &opTab[a]; +} + +GBool Gfx::checkArg(Object *arg, TchkType type) { + switch (type) { + case tchkBool: return arg->isBool(); + case tchkInt: return arg->isInt(); + case tchkNum: return arg->isNum(); + case tchkString: return arg->isString(); + case tchkName: return arg->isName(); + case tchkArray: return arg->isArray(); + case tchkProps: return arg->isDict() || arg->isName(); + case tchkSCN: return arg->isNum() || arg->isName(); + case tchkNone: return gFalse; + } + return gFalse; +} + +int Gfx::getPos() { + return parser->getPos(); +} + +GfxFont *Gfx::lookupFont(char *name) { + GfxFont *font; + GfxResources *resPtr; + + for (resPtr = res; resPtr; resPtr = resPtr->next) { + if (resPtr->fonts) { + if ((font = resPtr->fonts->lookup(name))) + return font; + } + } + error(getPos(), "unknown font tag '%s'", name); + return NULL; +} + +GBool Gfx::lookupXObject(char *name, Object *obj) { + GfxResources *resPtr; + + for (resPtr = res; resPtr; resPtr = resPtr->next) { + if (resPtr->xObjDict.isDict()) { + if (!resPtr->xObjDict.dictLookup(name, obj)->isNull()) + return gTrue; + obj->free(); + } + } + error(getPos(), "XObject '%s' is unknown", name); + return gFalse; +} + +void Gfx::lookupColorSpace(char *name, Object *obj) { + GfxResources *resPtr; + + for (resPtr = res; resPtr; resPtr = resPtr->next) { + if (resPtr->colorSpaceDict.isDict()) { + if (!resPtr->colorSpaceDict.dictLookup(name, obj)->isNull()) + return; + obj->free(); + } + } + obj->initNull(); +} + +//------------------------------------------------------------------------ +// graphics state operators +//------------------------------------------------------------------------ + +void Gfx::opSave(Object args[], int numArgs) { + out->saveState(state); + state = state->save(); +} + +void Gfx::opRestore(Object args[], int numArgs) { + state = state->restore(); + out->restoreState(state); +} + +void Gfx::opConcat(Object args[], int numArgs) { + state->concatCTM(args[0].getNum(), args[1].getNum(), + args[2].getNum(), args[3].getNum(), + args[4].getNum(), args[5].getNum()); + out->updateCTM(state, args[0].getNum(), args[1].getNum(), + args[2].getNum(), args[3].getNum(), + args[4].getNum(), args[5].getNum()); + fontChanged = gTrue; +} + +void Gfx::opSetDash(Object args[], int numArgs) { + Array *a; + int length; + Object obj; + double *dash; + int i; + + a = args[0].getArray(); + length = a->getLength(); + if (length == 0) { + dash = NULL; + } else { + dash = (double *)gmalloc(length * sizeof(double)); + for (i = 0; i < length; ++i) { + dash[i] = a->get(i, &obj)->getNum(); + obj.free(); + } + } + state->setLineDash(dash, length, args[1].getNum()); + out->updateLineDash(state); +} + +void Gfx::opSetFlat(Object args[], int numArgs) { + state->setFlatness((int)args[0].getNum()); + out->updateFlatness(state); +} + +void Gfx::opSetLineJoin(Object args[], int numArgs) { + state->setLineJoin(args[0].getInt()); + out->updateLineJoin(state); +} + +void Gfx::opSetLineCap(Object args[], int numArgs) { + state->setLineCap(args[0].getInt()); + out->updateLineCap(state); +} + +void Gfx::opSetMiterLimit(Object args[], int numArgs) { + state->setMiterLimit(args[0].getNum()); + out->updateMiterLimit(state); +} + +void Gfx::opSetLineWidth(Object args[], int numArgs) { + state->setLineWidth(args[0].getNum()); + out->updateLineWidth(state); +} + +void Gfx::opSetExtGState(Object args[], int numArgs) { +} + +//------------------------------------------------------------------------ +// color operators +//------------------------------------------------------------------------ + +void Gfx::opSetFillGray(Object args[], int numArgs) { + state->setFillColorSpace(new GfxColorSpace(colorGray)); + state->setFillGray(args[0].getNum()); + out->updateFillColor(state); +} + +void Gfx::opSetStrokeGray(Object args[], int numArgs) { + state->setStrokeColorSpace(new GfxColorSpace(colorGray)); + state->setStrokeGray(args[0].getNum()); + out->updateStrokeColor(state); +} + +void Gfx::opSetFillCMYKColor(Object args[], int numArgs) { + state->setFillColorSpace(new GfxColorSpace(colorCMYK)); + state->setFillCMYK(args[0].getNum(), args[1].getNum(), + args[2].getNum(), args[3].getNum()); + out->updateFillColor(state); +} + +void Gfx::opSetStrokeCMYKColor(Object args[], int numArgs) { + state->setStrokeColorSpace(new GfxColorSpace(colorCMYK)); + state->setStrokeCMYK(args[0].getNum(), args[1].getNum(), + args[2].getNum(), args[3].getNum()); + out->updateStrokeColor(state); +} + +void Gfx::opSetFillRGBColor(Object args[], int numArgs) { + state->setFillColorSpace(new GfxColorSpace(colorRGB)); + state->setFillRGB(args[0].getNum(), args[1].getNum(), args[2].getNum()); + out->updateFillColor(state); +} + +void Gfx::opSetStrokeRGBColor(Object args[], int numArgs) { + state->setStrokeColorSpace(new GfxColorSpace(colorRGB)); + state->setStrokeRGB(args[0].getNum(), args[1].getNum(), args[2].getNum()); + out->updateStrokeColor(state); +} + +void Gfx::opSetFillColorSpace(Object args[], int numArgs) { + Object obj; + GfxColorSpace *colorSpace; + double x[4]; + + lookupColorSpace(args[0].getName(), &obj); + if (obj.isNull()) + colorSpace = new GfxColorSpace(&args[0]); + else + colorSpace = new GfxColorSpace(&obj); + obj.free(); + if (colorSpace->isOk()) { + state->setFillColorSpace(colorSpace); + } else { + delete colorSpace; + error(getPos(), "Bad colorspace"); + } + x[0] = x[1] = x[2] = x[3] = 0; + state->setFillColor(x); + out->updateFillColor(state); +} + +void Gfx::opSetStrokeColorSpace(Object args[], int numArgs) { + Object obj; + GfxColorSpace *colorSpace; + double x[4]; + + lookupColorSpace(args[0].getName(), &obj); + if (obj.isNull()) + colorSpace = new GfxColorSpace(&args[0]); + else + colorSpace = new GfxColorSpace(&obj); + obj.free(); + if (colorSpace->isOk()) { + state->setStrokeColorSpace(colorSpace); + } else { + delete colorSpace; + error(getPos(), "Bad colorspace"); + } + x[0] = x[1] = x[2] = x[3] = 0; + state->setStrokeColor(x); + out->updateStrokeColor(state); +} + +void Gfx::opSetFillColor(Object args[], int numArgs) { + double x[4]; + int i; + + x[0] = x[1] = x[2] = x[3] = 0; + for (i = 0; i < numArgs; ++i) + x[i] = args[i].getNum(); + state->setFillColor(x); + out->updateFillColor(state); +} + +void Gfx::opSetStrokeColor(Object args[], int numArgs) { + double x[4]; + int i; + + x[0] = x[1] = x[2] = x[3] = 0; + for (i = 0; i < numArgs; ++i) + x[i] = args[i].getNum(); + state->setStrokeColor(x); + out->updateStrokeColor(state); +} + +void Gfx::opSetFillColorN(Object args[], int numArgs) { + double x[4]; + int i; + + x[0] = x[1] = x[2] = x[3] = 0; + for (i = 0; i < numArgs && i < 4; ++i) { + if (args[i].isNum()) + x[i] = args[i].getNum(); + else + break; + } + state->setFillColor(x); + out->updateFillColor(state); +} + +void Gfx::opSetStrokeColorN(Object args[], int numArgs) { + double x[4]; + int i; + + x[0] = x[1] = x[2] = x[3] = 0; + for (i = 0; i < numArgs && i < 4; ++i) { + if (args[i].isNum()) + x[i] = args[i].getNum(); + else + break; + } + state->setStrokeColor(x); + out->updateStrokeColor(state); +} + +//------------------------------------------------------------------------ +// path segment operators +//------------------------------------------------------------------------ + +void Gfx::opMoveTo(Object args[], int numArgs) { + state->moveTo(args[0].getNum(), args[1].getNum()); +} + +void Gfx::opLineTo(Object args[], int numArgs) { + if (!state->isCurPt()) { + error(getPos(), "No current point in lineto"); + return; + } + state->lineTo(args[0].getNum(), args[1].getNum()); +} + +void Gfx::opCurveTo(Object args[], int numArgs) { + double x1, y1, x2, y2, x3, y3; + + if (!state->isCurPt()) { + error(getPos(), "No current point in curveto"); + return; + } + x1 = args[0].getNum(); + y1 = args[1].getNum(); + x2 = args[2].getNum(); + y2 = args[3].getNum(); + x3 = args[4].getNum(); + y3 = args[5].getNum(); + state->curveTo(x1, y1, x2, y2, x3, y3); +} + +void Gfx::opCurveTo1(Object args[], int numArgs) { + double x1, y1, x2, y2, x3, y3; + + if (!state->isCurPt()) { + error(getPos(), "No current point in curveto1"); + return; + } + x1 = state->getCurX(); + y1 = state->getCurY(); + x2 = args[0].getNum(); + y2 = args[1].getNum(); + x3 = args[2].getNum(); + y3 = args[3].getNum(); + state->curveTo(x1, y1, x2, y2, x3, y3); +} + +void Gfx::opCurveTo2(Object args[], int numArgs) { + double x1, y1, x2, y2, x3, y3; + + if (!state->isCurPt()) { + error(getPos(), "No current point in curveto2"); + return; + } + x1 = args[0].getNum(); + y1 = args[1].getNum(); + x2 = args[2].getNum(); + y2 = args[3].getNum(); + x3 = x2; + y3 = y2; + state->curveTo(x1, y1, x2, y2, x3, y3); +} + +void Gfx::opRectangle(Object args[], int numArgs) { + double x, y, w, h; + + x = args[0].getNum(); + y = args[1].getNum(); + w = args[2].getNum(); + h = args[3].getNum(); + state->moveTo(x, y); + state->lineTo(x + w, y); + state->lineTo(x + w, y + h); + state->lineTo(x, y + h); + state->closePath(); +} + +void Gfx::opClosePath(Object args[], int numArgs) { + if (!state->isPath()) { + error(getPos(), "No current point in closepath"); + return; + } + state->closePath(); +} + +//------------------------------------------------------------------------ +// path painting operators +//------------------------------------------------------------------------ + +void Gfx::opEndPath(Object args[], int numArgs) { + doEndPath(); +} + +void Gfx::opStroke(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in stroke"); + return; + } + if (state->isPath()) + out->stroke(state); + doEndPath(); +} + +void Gfx::opCloseStroke(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in closepath/stroke"); + return; + } + if (state->isPath()) { + state->closePath(); + out->stroke(state); + } + doEndPath(); +} + +void Gfx::opFill(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in fill"); + return; + } + if (state->isPath()) + out->fill(state); + doEndPath(); +} + +void Gfx::opEOFill(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in eofill"); + return; + } + if (state->isPath()) + out->eoFill(state); + doEndPath(); +} + +void Gfx::opFillStroke(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in fill/stroke"); + return; + } + if (state->isPath()) { + out->fill(state); + out->stroke(state); + } + doEndPath(); +} + +void Gfx::opCloseFillStroke(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in closepath/fill/stroke"); + return; + } + if (state->isPath()) { + state->closePath(); + out->fill(state); + out->stroke(state); + } + doEndPath(); +} + +void Gfx::opEOFillStroke(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in eofill/stroke"); + return; + } + if (state->isPath()) { + out->eoFill(state); + out->stroke(state); + } + doEndPath(); +} + +void Gfx::opCloseEOFillStroke(Object args[], int numArgs) { + if (!state->isCurPt()) { + //error(getPos(), "No path in closepath/eofill/stroke"); + return; + } + if (state->isPath()) { + state->closePath(); + out->eoFill(state); + out->stroke(state); + } + doEndPath(); +} + +void Gfx::doEndPath() { + if (state->isPath()) { + if (clip == clipNormal) + out->clip(state); + else if (clip == clipEO) + out->eoClip(state); + } + clip = clipNone; + state->clearPath(); +} + +//------------------------------------------------------------------------ +// path clipping operators +//------------------------------------------------------------------------ + +void Gfx::opClip(Object args[], int numArgs) { + clip = clipNormal; +} + +void Gfx::opEOClip(Object args[], int numArgs) { + clip = clipEO; +} + +//------------------------------------------------------------------------ +// text object operators +//------------------------------------------------------------------------ + +void Gfx::opBeginText(Object args[], int numArgs) { + state->setTextMat(1, 0, 0, 1, 0, 0); + state->textMoveTo(0, 0); + out->updateTextMat(state); + out->updateTextPos(state); + fontChanged = gTrue; +} + +void Gfx::opEndText(Object args[], int numArgs) { +} + +//------------------------------------------------------------------------ +// text state operators +//------------------------------------------------------------------------ + +void Gfx::opSetCharSpacing(Object args[], int numArgs) { + state->setCharSpace(args[0].getNum()); + out->updateCharSpace(state); +} + +void Gfx::opSetFont(Object args[], int numArgs) { + GfxFont *font; + + if (!(font = lookupFont(args[0].getName()))) + return; + if (printCommands) { + printf(" font: '%s' %g\n", + font->getName() ? font->getName()->getCString() : "???", + args[1].getNum()); + } + state->setFont(font, args[1].getNum()); + fontChanged = gTrue; +} + +void Gfx::opSetTextLeading(Object args[], int numArgs) { + state->setLeading(args[0].getNum()); +} + +void Gfx::opSetTextRender(Object args[], int numArgs) { + state->setRender(args[0].getInt()); + out->updateRender(state); +} + +void Gfx::opSetTextRise(Object args[], int numArgs) { + state->setRise(args[0].getNum()); + out->updateRise(state); +} + +void Gfx::opSetWordSpacing(Object args[], int numArgs) { + state->setWordSpace(args[0].getNum()); + out->updateWordSpace(state); +} + +void Gfx::opSetHorizScaling(Object args[], int numArgs) { + state->setHorizScaling(args[0].getNum()); + out->updateHorizScaling(state); +} + +//------------------------------------------------------------------------ +// text positioning operators +//------------------------------------------------------------------------ + +void Gfx::opTextMove(Object args[], int numArgs) { + double tx, ty; + + tx = state->getLineX() + args[0].getNum(); + ty = state->getLineY() + args[1].getNum(); + state->textMoveTo(tx, ty); + out->updateTextPos(state); +} + +void Gfx::opTextMoveSet(Object args[], int numArgs) { + double tx, ty; + + tx = state->getLineX() + args[0].getNum(); + ty = args[1].getNum(); + state->setLeading(-ty); + ty += state->getLineY(); + state->textMoveTo(tx, ty); + out->updateTextPos(state); +} + +void Gfx::opSetTextMatrix(Object args[], int numArgs) { + state->setTextMat(args[0].getNum(), args[1].getNum(), + args[2].getNum(), args[3].getNum(), + args[4].getNum(), args[5].getNum()); + state->textMoveTo(0, 0); + out->updateTextMat(state); + out->updateTextPos(state); + fontChanged = gTrue; +} + +void Gfx::opTextNextLine(Object args[], int numArgs) { + double tx, ty; + + tx = state->getLineX(); + ty = state->getLineY() - state->getLeading(); + state->textMoveTo(tx, ty); + out->updateTextPos(state); +} + +//------------------------------------------------------------------------ +// text string operators +//------------------------------------------------------------------------ + +void Gfx::opShowText(Object args[], int numArgs) { + if (!state->getFont()) { + error(getPos(), "No font in show"); + return; + } + doShowText(args[0].getString()); +} + +void Gfx::opMoveShowText(Object args[], int numArgs) { + double tx, ty; + + if (!state->getFont()) { + error(getPos(), "No font in move/show"); + return; + } + tx = state->getLineX(); + ty = state->getLineY() - state->getLeading(); + state->textMoveTo(tx, ty); + out->updateTextPos(state); + doShowText(args[0].getString()); +} + +void Gfx::opMoveSetShowText(Object args[], int numArgs) { + double tx, ty; + + if (!state->getFont()) { + error(getPos(), "No font in move/set/show"); + return; + } + state->setWordSpace(args[0].getNum()); + state->setCharSpace(args[1].getNum()); + tx = state->getLineX(); + ty = state->getLineY() - state->getLeading(); + state->textMoveTo(tx, ty); + out->updateWordSpace(state); + out->updateCharSpace(state); + out->updateTextPos(state); + doShowText(args[2].getString()); +} + +void Gfx::opShowSpaceText(Object args[], int numArgs) { + Array *a; + Object obj; + int i; + + if (!state->getFont()) { + error(getPos(), "No font in show/space"); + return; + } + a = args[0].getArray(); + for (i = 0; i < a->getLength(); ++i) { + a->get(i, &obj); + if (obj.isNum()) { + state->textShift(-obj.getNum() * 0.001 * state->getFontSize()); + out->updateTextShift(state, obj.getNum()); + } else if (obj.isString()) { + doShowText(obj.getString()); + } else { + error(getPos(), "Element of show/space array must be number or string"); + } + obj.free(); + } +} + +void Gfx::doShowText(GString *s) { + GfxFont *font; + GfxFontEncoding16 *enc; + Guchar *p; + Guchar c8; + int c16; + GString *s16; + int m, n; + double dx, dy, width, w, h; + + if (fontChanged) { + out->updateFont(state); + fontChanged = gFalse; + } + font = state->getFont(); + + //----- 16-bit font + if (font->is16Bit()) { + enc = font->getEncoding16(); + if (out->useDrawChar()) { + out->beginString(state, s); + s16 = NULL; + } else { + s16 = new GString(" "); + } + state->textTransformDelta(0, state->getRise(), &dx, &dy); + p = (Guchar *)s->getCString(); + n = s->getLength(); + while (n > 0) { + m = getNextChar16(enc, p, &c16); + width = state->getFontSize() * state->getHorizScaling() * + font->getWidth16(c16) + + state->getCharSpace(); + if (c16 == ' ') + width += state->getWordSpace(); + state->textTransformDelta(width, 0, &w, &h); + if (out->useDrawChar()) { + out->drawChar16(state, state->getCurX() + dx, state->getCurY() + dy, + w, h, c16); + } else { + s16->setChar(0, (char)(c16 >> 8)); + s16->setChar(1, (char)c16); + out->drawString16(state, s16); + } + state->textShift(width); + n -= m; + p += m; + } + if (out->useDrawChar()) + out->endString(state); + else + delete s16; + + //----- 8-bit font + } else { + if (out->useDrawChar()) { + out->beginString(state, s); + state->textTransformDelta(0, state->getRise(), &dx, &dy); + for (p = (Guchar *)s->getCString(), n = s->getLength(); n; ++p, --n) { + c8 = *p; + width = state->getFontSize() * state->getHorizScaling() * + font->getWidth(c8) + + state->getCharSpace(); + if (c8 == ' ') + width += state->getWordSpace(); + state->textTransformDelta(width, 0, &w, &h); + out->drawChar(state, state->getCurX() + dx, state->getCurY() + dy, + w, h, c8); + state->textShift(width); + } + out->endString(state); + } else { + out->drawString(state, s); + width = state->getFontSize() * state->getHorizScaling() * + font->getWidth(s) + + s->getLength() * state->getCharSpace(); + for (p = (Guchar *)s->getCString(), n = s->getLength(); n; ++p, --n) { + if (*p == ' ') + width += state->getWordSpace(); + } + state->textShift(width); + } + } +} + +int Gfx::getNextChar16(GfxFontEncoding16 *enc, Guchar *p, int *c16) { + int n; + int code; + int a, b, m; + + n = enc->codeLen[*p]; + if (n == 1) { + *c16 = enc->map1[*p]; + } else { + code = (p[0] << 8) + p[1]; + a = 0; + b = enc->map2Len; + // invariant: map2[2*a] <= code < map2[2*b] + while (b - a > 1) { + m = (a + b) / 2; + if (enc->map2[2*m] <= code) + a = m; + else if (enc->map2[2*m] > code) + b = m; + else + break; + } + *c16 = enc->map2[2*a+1] + (code - enc->map2[2*a]); + } + return n; +} + +//------------------------------------------------------------------------ +// XObject operators +//------------------------------------------------------------------------ + +void Gfx::opXObject(Object args[], int numArgs) { + Object obj1, obj2; + + if (!lookupXObject(args[0].getName(), &obj1)) + return; + if (!obj1.isStream("XObject")) { + error(getPos(), "XObject '%s' is wrong type", args[0].getName()); + obj1.free(); + return; + } + obj1.streamGetDict()->lookup("Subtype", &obj2); + if (obj2.isName("Image")) + doImage(obj1.getStream(), gFalse); + else if (obj2.isName("Form")) + doForm(&obj1); + else if (obj2.isName()) + error(getPos(), "Unknown XObject subtype '%s'", obj2.getName()); + else + error(getPos(), "XObject subtype is missing or wrong type"); + obj2.free(); + obj1.free(); +} + +void Gfx::doImage(Stream *str, GBool inlineImg) { + Dict *dict; + Object obj1, obj2; + int width, height; + int bits; + GBool mask; + GfxColorSpace *colorSpace; + GfxImageColorMap *colorMap; + GBool invert; + + // get stream dict + dict = str->getDict(); + + // get size + dict->lookup("Width", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("W", &obj1); + } + if (!obj1.isInt()) + goto err2; + width = obj1.getInt(); + obj1.free(); + dict->lookup("Height", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("H", &obj1); + } + if (!obj1.isInt()) + goto err2; + height = obj1.getInt(); + obj1.free(); + + // image or mask? + dict->lookup("ImageMask", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("IM", &obj1); + } + mask = gFalse; + if (obj1.isBool()) + mask = obj1.getBool(); + else if (!obj1.isNull()) + goto err2; + obj1.free(); + + // bit depth + dict->lookup("BitsPerComponent", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("BPC", &obj1); + } + if (!obj1.isInt()) + goto err2; + bits = obj1.getInt(); + obj1.free(); + + // display a mask + if (mask) { + + // check for inverted mask + if (bits != 1) + goto err1; + invert = gFalse; + dict->lookup("Decode", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("D", &obj1); + } + if (obj1.isArray()) { + obj1.arrayGet(0, &obj2); + if (obj2.isInt() && obj2.getInt() == 1) + invert = gTrue; + obj2.free(); + } else if (!obj1.isNull()) { + goto err2; + } + obj1.free(); + + // draw it + out->drawImageMask(state, str, width, height, invert, inlineImg); + + } else { + + // get color space and color map + dict->lookup("ColorSpace", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("CS", &obj1); + } + if (obj1.isName()) { + lookupColorSpace(obj1.getName(), &obj2); + if (!obj2.isNull()) { + obj1.free(); + obj1 = obj2; + } else { + obj2.free(); + } + } + colorSpace = new GfxColorSpace(&obj1); + obj1.free(); + if (!colorSpace->isOk()) { + delete colorSpace; + goto err1; + } + dict->lookup("Decode", &obj1); + if (obj1.isNull()) { + obj1.free(); + dict->lookup("D", &obj1); + } + colorMap = new GfxImageColorMap(bits, &obj1, colorSpace); + obj1.free(); + if (!colorMap->isOk()) { + delete colorSpace; + goto err1; + } + + // draw it + out->drawImage(state, str, width, height, colorMap, inlineImg); + delete colorMap; + } + + return; + + err2: + obj1.free(); + err1: + error(getPos(), "Bad image parameters"); +} + +void Gfx::doForm(Object *str) { + Parser *oldParser; + GfxResources *resPtr; + Dict *dict; + Dict *resDict; + Object matrixObj, bboxObj; + double m[6]; + Object obj1, obj2; + int i; + + // get stream dict + dict = str->streamGetDict(); + + // check form type + dict->lookup("FormType", &obj1); + if (!(obj1.isInt() && obj1.getInt() == 1)) { + obj1.free(); + error(getPos(), "Unknown form type"); + return; + } + obj1.free(); + + // get matrix and bounding box + dict->lookup("Matrix", &matrixObj); + if (!matrixObj.isArray()) { + matrixObj.free(); + error(getPos(), "Bad form matrix"); + return; + } + dict->lookup("BBox", &bboxObj); + if (!bboxObj.isArray()) { + matrixObj.free(); + bboxObj.free(); + error(getPos(), "Bad form bounding box"); + return; + } + + // push new resources on stack + dict->lookup("Resources", &obj1); + if (obj1.isDict()) { + resDict = obj1.getDict(); + res = new GfxResources(res); + res->fonts = NULL; + resDict->lookup("Font", &obj2); + if (obj2.isDict()) + res->fonts = new GfxFontDict(obj2.getDict()); + obj2.free(); + resDict->lookup("XObject", &res->xObjDict); + resDict->lookup("ColorSpace", &res->colorSpaceDict); + obj1.free(); + } + + // save current graphics state + out->saveState(state); + state = state->save(); + + // save current parser + oldParser = parser; + + // set form transformation matrix + for (i = 0; i < 6; ++i) { + matrixObj.arrayGet(i, &obj1); + m[i] = obj1.getNum(); + obj1.free(); + } + state->concatCTM(m[0], m[1], m[2], m[3], m[4], m[5]); + out->updateCTM(state, m[0], m[1], m[2], m[3], m[4], m[5]); + + // set form bounding box + for (i = 0; i < 4; ++i) { + bboxObj.arrayGet(i, &obj1); + m[i] = obj1.getNum(); + obj1.free(); + } + state->moveTo(m[0], m[1]); + state->lineTo(m[0]+m[2], m[1]); + state->lineTo(m[0]+m[2], m[1]+m[3]); + state->lineTo(m[0], m[1]+m[3]); + state->closePath(); + out->clip(state); + state->clearPath(); + + // draw the form + display(str); + + // free matrix and bounding box + matrixObj.free(); + bboxObj.free(); + + // restore parser + parser = oldParser; + + // restore graphics state + state = state->restore(); + out->restoreState(state); + + // pop resource stack + resPtr = res->next; + delete res; + res = resPtr; + + return; +} + +//------------------------------------------------------------------------ +// in-line image operators +//------------------------------------------------------------------------ + +void Gfx::opBeginImage(Object args[], int numArgs) { + Stream *str; + int c1, c2; + + // build dict/stream + str = buildImageStream(); + + // display the image + if (str) { + doImage(str, gTrue); + + // skip 'EI' tag + c1 = str->getBaseStream()->getChar(); + c2 = str->getBaseStream()->getChar(); + while (!(c1 == 'E' && c2 == 'I') && c2 != EOF) { + c1 = c2; + c2 = str->getBaseStream()->getChar(); + } + delete str; + } +} + +Stream *Gfx::buildImageStream() { + Object dict; + Object obj; + char *key; + Stream *str; + + // build dictionary + dict.initDict(); + parser->getObj(&obj); + while (!obj.isCmd("ID") && !obj.isEOF()) { + if (!obj.isName()) { + error(getPos(), "Inline image dictionary key must be a name object"); + obj.free(); + parser->getObj(&obj); + } else { + key = copyString(obj.getName()); + obj.free(); + parser->getObj(&obj); + if (obj.isEOF() || obj.isError()) + break; + dict.dictAdd(key, &obj); + } + parser->getObj(&obj); + } + if (obj.isEOF()) + error(getPos(), "End of file in inline image"); + obj.free(); + + // make stream + str = new SubStream(parser->getStream(), &dict); + str = str->addFilters(&dict); + + return str; +} + +void Gfx::opImageData(Object args[], int numArgs) { + error(getPos(), "Internal: got 'ID' operator"); +} + +void Gfx::opEndImage(Object args[], int numArgs) { + error(getPos(), "Internal: got 'EI' operator"); +} + +//------------------------------------------------------------------------ +// type 3 font operators +//------------------------------------------------------------------------ + +void Gfx::opSetCharWidth(Object args[], int numArgs) { + error(getPos(), "Encountered 'd0' operator in content stream"); +} + +void Gfx::opSetCacheDevice(Object args[], int numArgs) { + error(getPos(), "Encountered 'd1' operator in content stream"); +} + +//------------------------------------------------------------------------ +// compatibility operators +//------------------------------------------------------------------------ + +void Gfx::opBeginIgnoreUndef(Object args[], int numArgs) { + ++ignoreUndef; +} + +void Gfx::opEndIgnoreUndef(Object args[], int numArgs) { + if (ignoreUndef > 0) + --ignoreUndef; +} + +//------------------------------------------------------------------------ +// marked content operators +//------------------------------------------------------------------------ + +void Gfx::opBeginMarkedContent(Object args[], int numArgs) { + if (printCommands) { + printf(" marked content: %s ", args[0].getName()); + if (numArgs == 2) + args[2].print(stdout); + printf("\n"); + } +} + +void Gfx::opEndMarkedContent(Object args[], int numArgs) { +} + +void Gfx::opMarkPoint(Object args[], int numArgs) { + if (printCommands) { + printf(" mark point: %s ", args[0].getName()); + if (numArgs == 2) + args[2].print(stdout); + printf("\n"); + } +} diff --git a/pdf/xpdf/Gfx.h b/pdf/xpdf/Gfx.h new file mode 100644 index 00000000..e1dc3d4e --- /dev/null +++ b/pdf/xpdf/Gfx.h @@ -0,0 +1,214 @@ +//======================================================================== +// +// Gfx.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef GFX_H +#define GFX_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "gtypes.h" + +class GString; +class Array; +class Stream; +class Parser; +class Dict; +class OutputDev; +class GfxFontDict; +class GfxFont; +struct GfxFontEncoding16; +class GfxState; +class Gfx; + +//------------------------------------------------------------------------ +// Gfx +//------------------------------------------------------------------------ + +enum GfxClipType { + clipNone, + clipNormal, + clipEO +}; + +enum TchkType { + tchkBool, // boolean + tchkInt, // integer + tchkNum, // number (integer or real) + tchkString, // string + tchkName, // name + tchkArray, // array + tchkProps, // properties (dictionary or name) + tchkSCN, // scn/SCN args (number of name) + tchkNone // used to avoid empty initializer lists +}; + +#define maxArgs 8 + +struct Operator { + char name[4]; + int numArgs; + TchkType tchk[maxArgs]; + void (Gfx::*func)(Object args[], int numArgs); +}; + +class GfxResources { +public: + + GfxResources(GfxResources *next1) { next = next1; } + ~GfxResources(); + + GfxFontDict *fonts; + Object xObjDict; + Object colorSpaceDict; + GfxResources *next; +}; + +class Gfx { +public: + + // Constructor for regular output. + Gfx(OutputDev *out1, int pageNum, Dict *resDict, + int dpi, double x1, double y1, double x2, double y2, GBool crop, + double cropX1, double cropY1, double cropX2, double cropY2, + int rotate); + + // Destructor. + ~Gfx(); + + // Interpret a stream or array of streams. + void display(Object *obj); + +private: + + OutputDev *out; // output device + GfxResources *res; // resource stack + + GfxState *state; // current graphics state + GBool fontChanged; // set if font or text matrix has changed + GfxClipType clip; // do a clip? + int ignoreUndef; // current BX/EX nesting level + + Parser *parser; // parser for page content stream(s) + + static Operator opTab[]; // table of operators + + void go(); + void execOp(Object *cmd, Object args[], int numArgs); + Operator *findOp(char *name); + GBool checkArg(Object *arg, TchkType type); + int getPos(); + GfxFont *lookupFont(char *name); + GBool lookupXObject(char *name, Object *obj); + void lookupColorSpace(char *name, Object *obj); + + // graphics state operators + void opSave(Object args[], int numArgs); + void opRestore(Object args[], int numArgs); + void opConcat(Object args[], int numArgs); + void opSetDash(Object args[], int numArgs); + void opSetFlat(Object args[], int numArgs); + void opSetLineJoin(Object args[], int numArgs); + void opSetLineCap(Object args[], int numArgs); + void opSetMiterLimit(Object args[], int numArgs); + void opSetLineWidth(Object args[], int numArgs); + void opSetExtGState(Object args[], int numArgs); + + // color operators + void opSetFillGray(Object args[], int numArgs); + void opSetStrokeGray(Object args[], int numArgs); + void opSetFillCMYKColor(Object args[], int numArgs); + void opSetStrokeCMYKColor(Object args[], int numArgs); + void opSetFillRGBColor(Object args[], int numArgs); + void opSetStrokeRGBColor(Object args[], int numArgs); + void opSetFillColorSpace(Object args[], int numArgs); + void opSetStrokeColorSpace(Object args[], int numArgs); + void opSetFillColor(Object args[], int numArgs); + void opSetStrokeColor(Object args[], int numArgs); + void opSetFillColorN(Object args[], int numArgs); + void opSetStrokeColorN(Object args[], int numArgs); + + // path segment operators + void opMoveTo(Object args[], int numArgs); + void opLineTo(Object args[], int numArgs); + void opCurveTo(Object args[], int numArgs); + void opCurveTo1(Object args[], int numArgs); + void opCurveTo2(Object args[], int numArgs); + void opRectangle(Object args[], int numArgs); + void opClosePath(Object args[], int numArgs); + + // path painting operators + void opEndPath(Object args[], int numArgs); + void opStroke(Object args[], int numArgs); + void opCloseStroke(Object args[], int numArgs); + void opFill(Object args[], int numArgs); + void opEOFill(Object args[], int numArgs); + void opFillStroke(Object args[], int numArgs); + void opCloseFillStroke(Object args[], int numArgs); + void opEOFillStroke(Object args[], int numArgs); + void opCloseEOFillStroke(Object args[], int numArgs); + void doEndPath(); + + // path clipping operators + void opClip(Object args[], int numArgs); + void opEOClip(Object args[], int numArgs); + + // text object operators + void opBeginText(Object args[], int numArgs); + void opEndText(Object args[], int numArgs); + + // text state operators + void opSetCharSpacing(Object args[], int numArgs); + void opSetFont(Object args[], int numArgs); + void opSetTextLeading(Object args[], int numArgs); + void opSetTextRender(Object args[], int numArgs); + void opSetTextRise(Object args[], int numArgs); + void opSetWordSpacing(Object args[], int numArgs); + void opSetHorizScaling(Object args[], int numArgs); + + // text positioning operators + void opTextMove(Object args[], int numArgs); + void opTextMoveSet(Object args[], int numArgs); + void opSetTextMatrix(Object args[], int numArgs); + void opTextNextLine(Object args[], int numArgs); + + // text string operators + void opShowText(Object args[], int numArgs); + void opMoveShowText(Object args[], int numArgs); + void opMoveSetShowText(Object args[], int numArgs); + void opShowSpaceText(Object args[], int numArgs); + void doShowText(GString *s); + int getNextChar16(GfxFontEncoding16 *enc, Guchar *p, int *c16); + + // XObject operators + void opXObject(Object args[], int numArgs); + void doImage(Stream *str, GBool inlineImg); + void doForm(Object *str); + + // in-line image operators + void opBeginImage(Object args[], int numArgs); + Stream *buildImageStream(); + void opImageData(Object args[], int numArgs); + void opEndImage(Object args[], int numArgs); + + // type 3 font operators + void opSetCharWidth(Object args[], int numArgs); + void opSetCacheDevice(Object args[], int numArgs); + + // compatibility operators + void opBeginIgnoreUndef(Object args[], int numArgs); + void opEndIgnoreUndef(Object args[], int numArgs); + + // marked content operators + void opBeginMarkedContent(Object args[], int numArgs); + void opEndMarkedContent(Object args[], int numArgs); + void opMarkPoint(Object args[], int numArgs); +}; + +#endif diff --git a/pdf/xpdf/GfxFont.cc b/pdf/xpdf/GfxFont.cc new file mode 100644 index 00000000..d1148cf2 --- /dev/null +++ b/pdf/xpdf/GfxFont.cc @@ -0,0 +1,821 @@ +//======================================================================== +// +// GfxFont.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include +#include "GString.h" +#include "gmem.h" +#include "gfile.h" +#include "config.h" +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "Error.h" +#include "Params.h" +#include "GfxFont.h" + +#include "FontInfo.h" +#if JAPANESE_SUPPORT +#include "CMapInfo.h" +#endif + +//------------------------------------------------------------------------ + +static int CDECL cmpWidthExcep(const void *w1, const void *w2); + +//------------------------------------------------------------------------ + +static Gushort *defCharWidths[12] = { + courierWidths, + courierObliqueWidths, + courierBoldWidths, + courierBoldObliqueWidths, + helveticaWidths, + helveticaObliqueWidths, + helveticaBoldWidths, + helveticaBoldObliqueWidths, + timesRomanWidths, + timesItalicWidths, + timesBoldWidths, + timesBoldItalicWidths +}; + +//------------------------------------------------------------------------ +// GfxFontEncoding +//------------------------------------------------------------------------ + +inline int GfxFontEncoding::hash(char *name) { + int h; + + h = name[0]; + if (name[1]) + h = h * 61 + name[1]; + return h % gfxFontEncHashSize; +} + +GfxFontEncoding::GfxFontEncoding() { + int i; + + encoding = (char **)gmalloc(256 * sizeof(char *)); + freeEnc = gTrue; + for (i = 0; i < 256; ++i) + encoding[i] = NULL; + for (i = 0; i < gfxFontEncHashSize; ++i) + hashTab[i] = -1; +} + +GfxFontEncoding::GfxFontEncoding(char **encoding1, int encSize) { + int i; + + encoding = encoding1; + freeEnc = gFalse; + for (i = 0; i < gfxFontEncHashSize; ++i) + hashTab[i] = -1; + for (i = 0; i < encSize; ++i) { + if (encoding[i]) + addChar1(i, encoding[i]); + } +} + +void GfxFontEncoding::addChar(int code, char *name) { + int h, i; + + // replace character associated with code + if (encoding[code]) { + h = hash(encoding[code]); + for (i = 0; i < gfxFontEncHashSize; ++i) { + if (hashTab[h] == code) { + hashTab[h] = -2; + break; + } + if (++h == gfxFontEncHashSize) + h = 0; + } + gfree(encoding[code]); + } + + // associate name with code + encoding[code] = name; + + // insert name in hash table + addChar1(code, name); +} + +void GfxFontEncoding::addChar1(int code, char *name) { + int h, i, code2; + + // insert name in hash table + h = hash(name); + for (i = 0; i < gfxFontEncHashSize; ++i) { + code2 = hashTab[h]; + if (code2 < 0) { + hashTab[h] = code; + break; + } else if (encoding[code2] && !strcmp(encoding[code2], name)) { + // keep the highest code for each char -- this is needed because + // X won't display chars with codes < 32 + if (code > code2) + hashTab[h] = code; + break; + } + if (++h == gfxFontEncHashSize) + h = 0; + } +} + +GfxFontEncoding::~GfxFontEncoding() { + int i; + + if (freeEnc) { + for (i = 0; i < 256; ++i) { + if (encoding[i]) + gfree(encoding[i]); + } + gfree(encoding); + } +} + +int GfxFontEncoding::getCharCode(char *name) { + int h, i, code; + + h = hash(name); + for (i = 0; i < gfxFontEncHashSize; ++i) { + code = hashTab[h]; + if (code == -1 || + (code > 0 && encoding[code] && !strcmp(encoding[code], name))) + return code; + if (++h >= gfxFontEncHashSize) + h = 0; + } + return -1; +} + +//------------------------------------------------------------------------ +// GfxFont +//------------------------------------------------------------------------ + +GfxFont::GfxFont(char *tag1, Ref id1, Dict *fontDict) { + BuiltinFont *builtinFont; + char buf[256]; + Object obj1, obj2, obj3; + char *p1, *p2; + int i; + + // get font tag and ID + tag = new GString(tag1); + id = id1; + + // get base font name + name = NULL; + fontDict->lookup("BaseFont", &obj1); + if (obj1.isName()) + name = new GString(obj1.getName()); + obj1.free(); + + // is it a built-in font? + builtinFont = NULL; + if (name) { + for (i = 0; i < numBuiltinFonts; ++i) { + if (!strcmp(builtinFonts[i].name, name->getCString())) { + builtinFont = &builtinFonts[i]; + break; + } + } + } + + // get font type + type = fontUnknownType; + fontDict->lookup("Subtype", &obj1); + if (obj1.isName("Type1")) + type = fontType1; + else if (obj1.isName("Type3")) + type = fontType3; + else if (obj1.isName("TrueType")) + type = fontTrueType; + else if (obj1.isName("Type0")) + type = fontType0; + obj1.free(); + is16 = gFalse; + + // get info from font descriptor + // for flags: assume Times-Roman (or TimesNewRoman), but + // explicitly check for Arial and CourierNew -- certain PDF + // generators apparently don't include FontDescriptors for Arial, + // TimesNewRoman, and CourierNew + flags = fontSerif; // assume Times-Roman by default + if (type == fontTrueType && !name->cmp("Arial")) + flags = 0; + else if (type == fontTrueType && !name->cmp("CourierNew")) + flags = fontFixedWidth; + embFontID.num = -1; + embFontID.gen = -1; + embFontName = NULL; + extFontFile = NULL; + fontDict->lookup("FontDescriptor", &obj1); + if (obj1.isDict()) { + + // flags + obj1.dictLookup("Flags", &obj2); + if (obj2.isInt()) + flags = obj2.getInt(); + obj2.free(); + + // embedded Type 1 font file and font name + if (type == fontType1) { + obj1.dictLookupNF("FontFile", &obj2); + if (obj2.isRef()) { + embFontID = obj2.getRef(); + + // get font name from the font file itself since font subsets + // sometimes use the 'AAAAAA+foo' name and sometimes use just 'foo' + obj2.fetch(&obj3); + if (obj3.isStream()) { + obj3.streamReset(); + for (i = 0; i < 64; ++i) { + obj3.streamGetLine(buf, sizeof(buf)); + if (!strncmp(buf, "/FontName", 9)) { + if ((p1 = strchr(buf+9, '/'))) { + ++p1; + for (p2 = p1; *p2 && !isspace(*p2); ++p2) ; + embFontName = new GString(p1, p2 - p1); + } + break; + } + } + } + obj3.free(); + obj2.free(); + + // couldn't find font name so just use the one in the PDF font + // descriptor + if (!embFontName) { + obj1.dictLookup("FontName", &obj2); + if (obj2.isName()) + embFontName = new GString(obj2.getName()); + } + } + obj2.free(); + + // embedded TrueType font file + } else if (type == fontTrueType) { + obj1.dictLookupNF("FontFile2", &obj2); + if (obj2.isRef()) + embFontID = obj2.getRef(); + obj2.free(); + } + } + obj1.free(); + + // get font matrix + fontMat[0] = fontMat[3] = 1; + fontMat[1] = fontMat[2] = fontMat[4] = fontMat[5] = 0; + if (fontDict->lookup("FontMatrix", &obj1)->isArray()) { + for (i = 0; i < 6 && i < obj1.arrayGetLength(); ++i) { + if (obj1.arrayGet(i, &obj2)->isNum()) + fontMat[i] = obj2.getNum(); + obj2.free(); + } + } + obj1.free(); + + // get encoding and character widths + if (type == fontType0) { + getType0EncAndWidths(fontDict); + } else if (builtinFont) { + makeEncoding(fontDict, builtinFont->encoding); + makeWidths(fontDict, builtinFont->encoding, builtinFont->widths); + } else { + makeEncoding(fontDict, NULL); + makeWidths(fontDict, NULL, NULL); + } +} + +GfxFont::~GfxFont() { + delete tag; + if (name) + delete name; + if (!is16 && encoding) + delete encoding; + if (embFontName) + delete embFontName; + if (extFontFile) + delete extFontFile; + if (is16) + gfree(widths16.exceps); +} + +double GfxFont::getWidth(GString *s) { + double w; + int i; + + w = 0; + for (i = 0; i < s->getLength(); ++i) + w += widths[s->getChar(i) & 0xff]; + return w; +} + +double GfxFont::getWidth16(int c) { + double w; + int a, b, m; + + w = widths16.defWidth; + a = -1; + b = widths16.numExceps; + // invariant: widths16.exceps[a].last < c < widths16.exceps[b].first + while (b - a > 1) { + m = (a + b) / 2; + if (widths16.exceps[m].last < c) { + a = m; + } else if (c < widths16.exceps[m].first) { + b = m; + } else { + w = widths16.exceps[m].width; + break; + } + } + return w; +} + +double GfxFont::getWidth16(GString *s) { + double w; + int c; + int i; + + w = 0; + for (i = 0; i < s->getLength(); i += 2) { + c = (s->getChar(i) << 8) + s->getChar(i+1); + w += getWidth16(c); + } + return w; +} + +void GfxFont::makeEncoding(Dict *fontDict, GfxFontEncoding *builtinEncoding) { + GfxFontEncoding *baseEnc; + Object obj1, obj2, obj3; + char *charName; + int code, i; + + // start with empty encoding + encoding = new GfxFontEncoding(); + + // get encoding from font dict + fontDict->lookup("Encoding", &obj1); + + // encoding specified by dictionary + if (obj1.isDict()) { + obj1.dictLookup("BaseEncoding", &obj2); + baseEnc = makeEncoding1(obj2, fontDict, builtinEncoding); + obj2.free(); + obj1.dictLookup("Differences", &obj2); + if (obj2.isArray()) { + code = 0; + for (i = 0; i < obj2.arrayGetLength(); ++i) { + obj2.arrayGet(i, &obj3); + if (obj3.isInt()) { + code = obj3.getInt(); + } else if (obj3.isName()) { + if (code < 256) + encoding->addChar(code, copyString(obj3.getName())); + ++code; + } else { + error(-1, "Wrong type in font encoding resource differences (%s)", + obj3.getTypeName()); + } + obj3.free(); + } + } + obj2.free(); + + // encoding specified by name or null + } else { + baseEnc = makeEncoding1(obj1, fontDict, builtinEncoding); + } + + // free the font dict encoding + obj1.free(); + + // merge base encoding and differences; + for (code = 0; code < 256; ++code) { + if (!encoding->getCharName(code)) { + if ((charName = baseEnc->getCharName(code))) + encoding->addChar(code, copyString(charName)); + } + } +} + +GfxFontEncoding *GfxFont::makeEncoding1(Object obj, Dict *fontDict, + GfxFontEncoding *builtinEncoding) { + GfxFontEncoding *enc; + GBool haveEncoding; + Object obj1, obj2; + char **path; + FILE *f; + FileStream *str; + + // MacRoman, WinAnsi, or Standard encoding + if (obj.isName("MacRomanEncoding")) { + enc = &macRomanEncoding; + } else if (obj.isName("WinAnsiEncoding")) { + enc = &winAnsiEncoding; + } else if (obj.isName("StandardEncoding")) { + enc = &standardEncoding; + + // use the built-in font encoding if possible + } else if (builtinEncoding) { + enc = builtinEncoding; + + // check font type + } else { + + // Type 1 font: try to get encoding from font file + if (type == fontType1) { + + // default to using standard encoding + enc = &standardEncoding; + + // is there an external font file? + haveEncoding = gFalse; + if (name) { + for (path = fontPath; *path; ++path) { + extFontFile = appendToPath(new GString(*path), name->getCString()); + f = fopen(extFontFile->getCString(), "rb"); + if (!f) { + extFontFile->append(".pfb"); + f = fopen(extFontFile->getCString(), "rb"); + } + if (!f) { + extFontFile->del(extFontFile->getLength() - 4, 4); + extFontFile->append(".pfa"); + f = fopen(extFontFile->getCString(), "rb"); + } + if (f) { + obj1.initNull(); + str = new FileStream(f, 0, -1, &obj1); + getType1Encoding(str); + delete str; + fclose(f); + haveEncoding = gTrue; + break; + } + delete extFontFile; + extFontFile = NULL; + } + } + + // is there an embedded font file? + // (this has to be checked after the external font because + // XOutputDev needs the encoding from the external font) + if (!haveEncoding && embFontID.num >= 0) { + obj1.initRef(embFontID.num, embFontID.gen); + obj1.fetch(&obj2); + if (obj2.isStream()) + getType1Encoding(obj2.getStream()); + obj2.free(); + obj1.free(); + } + + // TrueType font: use Mac encoding + } else if (type == fontTrueType) { + enc = &macRomanEncoding; + + // not Type 1 or TrueType: just use the standard encoding + } else { + enc = &standardEncoding; + } + } + + return enc; +} + +void GfxFont::getType1Encoding(Stream *str) { + char buf[256]; + char *p; + GBool found; + int code, i; + + // look for encoding in font file + str->reset(); + found = gFalse; + for (i = 0; i < 100; ++i) { + if (!str->getLine(buf, sizeof(buf))) + break; + if (!strncmp(buf, "/Encoding StandardEncoding def", 30)) + break; + if (!strncmp(buf, "/Encoding 256 array", 19)) { + found = gTrue; + break; + } + } + + // found the encoding, grab it + if (found) { + for (i = 0; i < 300; ++i) { + if (!str->getLine(buf, sizeof(buf))) + break; + p = strtok(buf, " \t"); + if (p && !strcmp(p, "dup")) { + if ((p = strtok(NULL, " \t"))) { + code = atoi(p); + if ((p = strtok(NULL, " \t"))) { + if (p[0] == '/') + encoding->addChar(code, copyString(p+1)); + } + } + } + } + //~ look for getinterval/putinterval junk + } +} + +void GfxFont::makeWidths(Dict *fontDict, GfxFontEncoding *builtinEncoding, + Gushort *builtinWidths) { + Object obj1, obj2; + int firstChar, lastChar; + int code, code2; + char *charName; + Gushort *defWidths; + int index; + double mult; + + // initialize all widths to zero + for (code = 0; code < 256; ++code) + widths[code] = 0; + + // use widths from built-in font + if (builtinEncoding) { + code2 = 0; // to make gcc happy + for (code = 0; code < 256; ++code) { + if ((charName = encoding->getCharName(code)) && + (code2 = builtinEncoding->getCharCode(charName)) >= 0) + widths[code] = builtinWidths[code2] * 0.001; + } + + // get widths from font dict + } else { + fontDict->lookup("FirstChar", &obj1); + firstChar = obj1.isInt() ? obj1.getInt() : 0; + obj1.free(); + fontDict->lookup("LastChar", &obj1); + lastChar = obj1.isInt() ? obj1.getInt() : 255; + obj1.free(); + if (type == fontType3) + mult = fontMat[0]; + else + mult = 0.001; + fontDict->lookup("Widths", &obj1); + if (obj1.isArray()) { + for (code = firstChar; code <= lastChar; ++code) { + obj1.arrayGet(code - firstChar, &obj2); + if (obj2.isNum()) + widths[code] = obj2.getNum() * mult; + obj2.free(); + } + } else { + + // couldn't find widths -- use defaults +#if 0 + //~ certain PDF generators apparently don't include widths + //~ for Arial and TimesNewRoman -- and this error message + //~ is a nuisance + error(-1, "No character widths resource for non-builtin font"); +#endif + if (isFixedWidth()) + index = 0; + else if (isSerif()) + index = 8; + else + index = 4; + if (isBold()) + index += 2; + if (isItalic()) + index += 1; + defWidths = defCharWidths[index]; + code2 = 0; // to make gcc happy + for (code = 0; code < 256; ++code) { + if ((charName = encoding->getCharName(code)) && + (code2 = standardEncoding.getCharCode(charName)) >= 0) + widths[code] = defWidths[code2] * 0.001; + } + } + obj1.free(); + } +} + +void GfxFont::getType0EncAndWidths(Dict *fontDict) { + Object obj1, obj2, obj3, obj4, obj5, obj6; + int excepsSize; + int i, j, k, n; + + fontDict->lookup("DescendantFonts", &obj1); + if (!obj1.isArray() || obj1.arrayGetLength() != 1) { + error(-1, "Bad DescendantFonts entry for Type 0 font"); + goto err1; + } + obj1.arrayGet(0, &obj2); + if (!obj2.isDict("Font")) { + error(-1, "Bad descendant font of Type 0 font"); + goto err2; + } + + obj2.dictLookup("CIDSystemInfo", &obj3); + if (!obj3.isDict()) { + error(-1, "Bad CIDSystemInfo in Type 0 font descendant"); + goto err3; + } + obj3.dictLookup("Registry", &obj4); + obj3.dictLookup("Ordering", &obj5); + if (obj4.isString() && obj5.isString()) { + if (obj4.getString()->cmp("Adobe") == 0 && + obj5.getString()->cmp("Japan1") == 0) { +#if JAPANESE_SUPPORT + is16 = gTrue; + enc16.charSet = font16AdobeJapan12; +#else + error(-1, "Xpdf was compiled without Japanese font support"); + goto err4; +#endif + } else { + error(-1, "Uknown Type 0 character set: %s-%s", + obj4.getString()->getCString(), obj5.getString()->getCString()); + goto err4; + } + } else { + error(-1, "Unknown Type 0 character set"); + goto err4; + } + obj5.free(); + obj4.free(); + obj3.free(); + + obj2.dictLookup("DW", &obj3); + if (obj3.isInt()) + widths16.defWidth = obj3.getInt() * 0.001; + else + widths16.defWidth = 1.0; + obj3.free(); + + widths16.exceps = NULL; + widths16.numExceps = 0; + obj2.dictLookup("W", &obj3); + if (obj3.isArray()) { + excepsSize = 0; + k = 0; + i = 0; + while (i+1 < obj3.arrayGetLength()) { + obj3.arrayGet(i, &obj4); + obj3.arrayGet(i+1, &obj5); + if (obj4.isInt() && obj5.isInt()) { + obj3.arrayGet(i+2, &obj6); + if (!obj6.isNum()) { + error(-1, "Bad widths array in Type 0 font"); + obj6.free(); + obj5.free(); + obj4.free(); + break; + } + if (k == excepsSize) { + excepsSize += 16; + widths16.exceps = (GfxFontWidthExcep *) + grealloc(widths16.exceps, + excepsSize * sizeof(GfxFontWidthExcep)); + } + widths16.exceps[k].first = obj4.getInt(); + widths16.exceps[k].last = obj5.getInt(); + widths16.exceps[k].width = obj6.getNum() * 0.001; + obj6.free(); + ++k; + i += 3; + } else if (obj4.isInt() && obj5.isArray()) { + if (k + obj5.arrayGetLength() >= excepsSize) { + excepsSize = (k + obj5.arrayGetLength() + 15) & ~15; + widths16.exceps = (GfxFontWidthExcep *) + grealloc(widths16.exceps, + excepsSize * sizeof(GfxFontWidthExcep)); + } + n = obj4.getInt(); + for (j = 0; j < obj5.arrayGetLength(); ++j) { + obj5.arrayGet(j, &obj6); + if (!obj6.isNum()) { + error(-1, "Bad widths array in Type 0 font"); + obj6.free(); + break; + } + widths16.exceps[k].first = widths16.exceps[k].last = n++; + widths16.exceps[k].width = obj6.getNum() * 0.001; + obj6.free(); + ++k; + } + i += 2; + } else { + error(-1, "Bad widths array in Type 0 font"); + obj6.free(); + obj5.free(); + obj4.free(); + break; + } + obj5.free(); + obj4.free(); + } + widths16.numExceps = k; + if (k > 0) + qsort(widths16.exceps, k, sizeof(GfxFontWidthExcep), &cmpWidthExcep); + } + obj3.free(); + + obj2.free(); + obj1.free(); + + fontDict->lookup("Encoding", &obj1); + if (!obj1.isName()) { + error(-1, "Bad encoding for Type 0 font"); + goto err1; + } +#if JAPANESE_SUPPORT + if (enc16.charSet == font16AdobeJapan12) { + for (i = 0; gfxFontEnc16Tab[i].name; ++i) { + if (!strcmp(obj1.getName(), gfxFontEnc16Tab[i].name)) + break; + } + if (!gfxFontEnc16Tab[i].name) { + error(-1, "Unknown encoding '%s' for Adobe-Japan1-2 font", + obj1.getName()); + goto err1; + } + enc16.enc = gfxFontEnc16Tab[i].enc; + } +#endif + obj1.free(); + + return; + + err4: + obj5.free(); + obj4.free(); + err3: + obj3.free(); + err2: + obj2.free(); + err1: + obj1.free(); + makeEncoding(fontDict, NULL); + makeWidths(fontDict, NULL, NULL); +} + +static int CDECL cmpWidthExcep(const void *w1, const void *w2) { + return ((GfxFontWidthExcep *)w1)->first - ((GfxFontWidthExcep *)w2)->first; +} + +//------------------------------------------------------------------------ +// GfxFontDict +//------------------------------------------------------------------------ + +GfxFontDict::GfxFontDict(Dict *fontDict) { + int i; + Object obj1, obj2; + + numFonts = fontDict->getLength(); + fonts = (GfxFont **)gmalloc(numFonts * sizeof(GfxFont *)); + for (i = 0; i < numFonts; ++i) { + fontDict->getValNF(i, &obj1); + obj1.fetch(&obj2); + if (obj1.isRef() && obj2.isDict("Font")) { + fonts[i] = new GfxFont(fontDict->getKey(i), obj1.getRef(), + obj2.getDict()); + } else { + error(-1, "font resource is not a dictionary"); + fonts[i] = NULL; + } + obj1.free(); + obj2.free(); + } +} + +GfxFontDict::~GfxFontDict() { + int i; + + for (i = 0; i < numFonts; ++i) + delete fonts[i]; + gfree(fonts); +} + +GfxFont *GfxFontDict::lookup(char *tag) { + int i; + + for (i = 0; i < numFonts; ++i) { + if (fonts[i]->matches(tag)) + return fonts[i]; + } + return NULL; +} diff --git a/pdf/xpdf/GfxFont.h b/pdf/xpdf/GfxFont.h new file mode 100644 index 00000000..0e894d9c --- /dev/null +++ b/pdf/xpdf/GfxFont.h @@ -0,0 +1,245 @@ +//======================================================================== +// +// GfxFont.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef GFXFONT_H +#define GFXFONT_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "gtypes.h" +#include "GString.h" +#include "Object.h" + +class Dict; + +//------------------------------------------------------------------------ +// GfxFontEncoding +//------------------------------------------------------------------------ + +#define gfxFontEncHashSize 419 + +class GfxFontEncoding { +public: + + // Construct an empty encoding. + GfxFontEncoding(); + + // Construct an encoding from an array of char names. + GfxFontEncoding(char **encoding1, int encSize); + + // Destructor. + ~GfxFontEncoding(); + + // Add a char to the encoding. + void addChar(int code, char *name); + + // Return the character name associated with . + char *getCharName(int code) { return encoding[code]; } + + // Return the code associated with . + int getCharCode(char *name); + +private: + + int hash(char *name); + void addChar1(int code, char *name); + + char **encoding; // code --> name mapping + GBool freeEnc; // should we free the encoding array? + short // name --> code hash table + hashTab[gfxFontEncHashSize]; +}; + +//------------------------------------------------------------------------ +// GfxFontCharSet16 +//------------------------------------------------------------------------ + +enum GfxFontCharSet16 { + font16AdobeJapan12 // Adobe-Japan1-2 +}; + +//------------------------------------------------------------------------ +// GfxFontEncoding16 +//------------------------------------------------------------------------ + +struct GfxFontEncoding16 { + Guchar codeLen[256]; // length of codes, in bytes, indexed by + // first byte of code + Gushort map1[256]; // one-byte code mapping: + // map1[code] --> 16-bit char selector + Gushort *map2; // two-byte code mapping + // map2[2*i] --> first code in range + // map2[2*i+1] --> 16-bit char selector + // for map2[2*i] + int map2Len; // length of map2 array (divided by 2) +}; + +//------------------------------------------------------------------------ +// GfxFontWidths16 +//------------------------------------------------------------------------ + +struct GfxFontWidthExcep { + int first; // chars .. have + int last; // width + double width; +}; + +struct GfxFontWidths16 { + double defWidth; // default char width + GfxFontWidthExcep *exceps; // exceptions + int numExceps; // number of valid entries in exceps +}; + +//------------------------------------------------------------------------ +// GfxFont +//------------------------------------------------------------------------ + +#define fontFixedWidth (1 << 0) +#define fontSerif (1 << 1) +#define fontSymbolic (1 << 2) +#define fontItalic (1 << 6) +#define fontBold (1 << 18) + +enum GfxFontType { + fontUnknownType, + fontType1, + fontType3, + fontTrueType, + fontType0 +}; + +class GfxFont { +public: + + // Constructor. + GfxFont(char *tag1, Ref id1, Dict *fontDict); + + // Destructor. + ~GfxFont(); + + // Get font tag. + GString *getTag() { return tag; } + + // Get font dictionary ID. + Ref getID() { return id; } + + // Does this font match the tag? + GBool matches(char *tag1) { return !tag->cmp(tag1); } + + // Get base font name. + GString *getName() { return name; } + + // Get font type. + GfxFontType getType() { return type; } + + // Does this font use 16-bit characters? + GBool is16Bit() { return is16; } + + // Get embedded font ID, i.e., a ref for the font file stream. + // Returns false if there is no embedded font. + GBool getEmbeddedFontID(Ref *embID) + { *embID = embFontID; return embFontID.num >= 0; } + + // Get the PostScript font name for the embedded font. Returns + // NULL if there is no embedded font. + char *getEmbeddedFontName() + { return embFontName ? embFontName->getCString() : (char *)NULL; } + + // Get the name of the external font file. Returns NULL if there + // is no external font file. + char *getExtFontFile() + { return extFontFile ? extFontFile->getCString() : (char *)NULL; } + + // Get font descriptor flags. + GBool isFixedWidth() { return flags & fontFixedWidth; } + GBool isSerif() { return flags & fontSerif; } + GBool isSymbolic() { return flags & fontSymbolic; } + GBool isItalic() { return flags & fontItalic; } + GBool isBold() { return flags & fontBold; } + + // Get width of a character or string. + double getWidth(Guchar c) { return widths[c]; } + double getWidth(GString *s); + double getWidth16(int c); + double getWidth16(GString *s); + + // Return the character name associated with . + char *getCharName(int code) { return encoding->getCharName(code); } + + // Return the code associated with . + int getCharCode(char *charName) { return encoding->getCharCode(charName); } + + // Return the 16-bit character set and encoding. + GfxFontCharSet16 getCharSet16() { return enc16.charSet; } + GfxFontEncoding16 *getEncoding16() { return enc16.enc; } + + // Return the font matrix. + double *getFontMatrix() { return fontMat; } + +private: + + void makeEncoding(Dict *fontDict, GfxFontEncoding *builtinEncoding); + GfxFontEncoding *makeEncoding1(Object obj, Dict *fontDesc, + GfxFontEncoding *builtinEncoding); + void getType1Encoding(Stream *str); + void makeWidths(Dict *fontDict, GfxFontEncoding *builtinEncoding, + Gushort *builtinWidths); + void getType0EncAndWidths(Dict *fontDict); + + GString *tag; // PDF font tag + Ref id; // reference (used as unique ID) + GString *name; // font name + int flags; // font descriptor flags + GfxFontType type; // type of font + GBool is16; // set if font uses 16-bit chars + GString *embFontName; // name of embedded font + Ref embFontID; // ref to embedded font file stream + GString *extFontFile; // external font file name + double fontMat[6]; // font matrix + union { + GfxFontEncoding *encoding; // 8-bit font encoding + struct { + GfxFontCharSet16 charSet; // 16-bit character set + GfxFontEncoding16 *enc; // 16-bit encoding (CMap) + } enc16; + }; + union { + double widths[256]; // width of each char for 8-bit font + GfxFontWidths16 widths16; // char widths for 16-bit font + }; +}; + +//------------------------------------------------------------------------ +// GfxFontDict +//------------------------------------------------------------------------ + +class GfxFontDict { +public: + + // Build the font dictionary, given the PDF font dictionary. + GfxFontDict(Dict *fontDict); + + // Destructor. + ~GfxFontDict(); + + // Get the specified font. + GfxFont *lookup(char *tag); + + // Iterative access. + int getNumFonts() { return numFonts; } + GfxFont *getFont(int i) { return fonts[i]; } + +private: + + GfxFont **fonts; // list of fonts + int numFonts; // number of fonts +}; + +#endif diff --git a/pdf/xpdf/GfxState.cc b/pdf/xpdf/GfxState.cc new file mode 100644 index 00000000..bf0e4de3 --- /dev/null +++ b/pdf/xpdf/GfxState.cc @@ -0,0 +1,952 @@ +//======================================================================== +// +// GfxState.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include // for memcpy() +#include "gmem.h" +#include "Error.h" +#include "Object.h" +#include "GfxState.h" + +//------------------------------------------------------------------------ +// GfxColor +//------------------------------------------------------------------------ + +void GfxColor::setCMYK(double c, double m, double y, double k) { + if ((r = 1 - (c + k)) < 0) + r = 0; + if ((g = 1 - (m + k)) < 0) + g = 0; + if ((b = 1 - (y + k)) < 0) + b = 0; +} + +//------------------------------------------------------------------------ +// GfxColorSpace +//------------------------------------------------------------------------ + +GfxColorSpace::GfxColorSpace(Object *colorSpace) { + Object csObj; + Object obj, obj2; + char *s; + int x; + int i, j; + + ok = gTrue; + lookup = NULL; + + // check for Separation colorspace + colorSpace->copy(&csObj); + sepFunc = NULL; + if (colorSpace->isArray()) { + colorSpace->arrayGet(0, &obj); + if (obj.isName("Separation")) { + csObj.free(); + colorSpace->arrayGet(2, &csObj); + sepFunc = new Function(colorSpace->arrayGet(3, &obj2)); + obj2.free(); + if (!sepFunc->isOk()) { + delete sepFunc; + sepFunc = NULL; + } + } + obj.free(); + } + + // get mode + indexed = gFalse; + if (csObj.isName()) { + setMode(&csObj); + } else if (csObj.isArray()) { + csObj.arrayGet(0, &obj); + if (obj.isName("Indexed") || obj.isName("I")) { + indexed = gTrue; + setMode(csObj.arrayGet(1, &obj2)); + obj2.free(); + } else { + setMode(&csObj); + } + obj.free(); + } else { + goto err1; + } + if (!ok) + return; + + // get lookup table for indexed colorspace + if (indexed) { + csObj.arrayGet(2, &obj); + if (!obj.isInt()) + goto err2; + indexHigh = obj.getInt(); + obj.free(); + lookup = (Guchar (*)[4])gmalloc((indexHigh + 1) * 4 * sizeof(Guchar)); + csObj.arrayGet(3, &obj); + if (obj.isStream()) { + obj.streamReset(); + for (i = 0; i <= indexHigh; ++i) { + for (j = 0; j < numComps; ++j) { + if ((x = obj.streamGetChar()) == EOF) + goto err2; + lookup[i][j] = (Guchar)x; + } + } + } else if (obj.isString()) { + s = obj.getString()->getCString(); + for (i = 0; i <= indexHigh; ++i) + for (j = 0; j < numComps; ++j) + lookup[i][j] = (Guchar)*s++; + } else { + goto err2; + } + obj.free(); + } + + csObj.free(); + return; + + err2: + obj.free(); + err1: + csObj.free(); + ok = gFalse; +} + +GfxColorSpace::GfxColorSpace(GfxColorMode mode1) { + sepFunc = NULL; + mode = mode1; + indexed = gFalse; + switch (mode) { + case colorGray: numComps = 1; break; + case colorCMYK: numComps = 4; break; + case colorRGB: numComps = 3; break; + } + lookup = NULL; + ok = gTrue; +} + +GfxColorSpace::~GfxColorSpace() { + if (sepFunc) + delete sepFunc; + gfree(lookup); +} + +GfxColorSpace::GfxColorSpace(GfxColorSpace *colorSpace) { + int size; + + if (colorSpace->sepFunc) + sepFunc = colorSpace->sepFunc->copy(); + else + sepFunc = NULL; + mode = colorSpace->mode; + indexed = colorSpace->indexed; + numComps = colorSpace->numComps; + indexHigh = colorSpace->indexHigh; + if (indexed) { + size = (indexHigh + 1) * 4 * sizeof(Guchar); + lookup = (Guchar (*)[4])gmalloc(size); + memcpy(lookup, colorSpace->lookup, size); + } else { + lookup = NULL; + } + ok = gTrue; +} + +void GfxColorSpace::setMode(Object *colorSpace) { + Object obj; + + if (colorSpace->isName("DeviceGray") || colorSpace->isName("G")) { + mode = colorGray; + numComps = 1; + } else if (colorSpace->isName("DeviceRGB") || colorSpace->isName("RGB")) { + mode = colorRGB; + numComps = 3; + } else if (colorSpace->isName("DeviceCMYK") || colorSpace->isName("CMYK")) { + mode = colorCMYK; + numComps = 4; + } else if (colorSpace->isArray()) { + colorSpace->arrayGet(0, &obj); + if (obj.isName("CalGray")) { + mode = colorGray; + numComps = 1; + } else if (obj.isName("CalRGB")) { + mode = colorRGB; + numComps = 3; + } else if (obj.isName("CalCMYK")) { + mode = colorCMYK; + numComps = 4; + } else { + ok = gFalse; + } + obj.free(); + } else { + ok = gFalse; + } +} + +void GfxColorSpace::getColor(double x[4], GfxColor *color) { + double y[4]; + Guchar *p; + + if (sepFunc) { + sepFunc->transform(x, y); + } else { + y[0] = x[0]; + y[1] = x[1]; + y[2] = x[2]; + y[3] = x[3]; + } + if (indexed) { + p = lookup[(int)(y[0] + 0.5)]; + switch (mode) { + case colorGray: + color->setGray(p[0] / 255.0); + break; + case colorCMYK: + color->setCMYK(p[0] / 255.0, p[1] / 255.0, p[2] / 255.0, p[3] / 255.0); + break; + case colorRGB: + color->setRGB(p[0] / 255.0, p[1] / 255.0, p[2] / 255.0); + break; + } + } else { + switch (mode) { + case colorGray: + color->setGray(y[0]); + break; + case colorCMYK: + color->setCMYK(y[0], y[1], y[2], y[3]); + break; + case colorRGB: + color->setRGB(y[0], y[1], y[2]); + break; + } + } +} + +//------------------------------------------------------------------------ +// Function +//------------------------------------------------------------------------ + +Function::Function(Object *funcObj) { + Stream *str; + Dict *dict; + int nSamples, sampleBits; + double sampleMul; + Object obj1, obj2; + Guint buf, bitMask; + int bits; + int s; + int i; + + ok = gFalse; + samples = NULL; + + if (!funcObj->isStream()) { + error(-1, "Expected function dictionary"); + goto err3; + } + str = funcObj->getStream(); + dict = str->getDict(); + + //----- FunctionType + if (!dict->lookup("FunctionType", &obj1)->isInt() || + obj1.getInt() != 0) { + error(-1, "Unknown function type"); + goto err2; + } + obj1.free(); + + //----- Domain + if (!dict->lookup("Domain", &obj1)->isArray()) { + error(-1, "Function is missing domain"); + goto err2; + } + m = obj1.arrayGetLength() / 2; + if (m > 4) { + error(-1, "Functions with more than 1 input are unsupported"); + goto err2; + } + for (i = 0; i < m; ++i) { + obj1.arrayGet(2*i, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function domain array"); + goto err1; + } + domain[i][0] = obj2.getNum(); + obj2.free(); + obj1.arrayGet(2*i+1, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function domain array"); + goto err1; + } + domain[i][1] = obj2.getNum(); + obj2.free(); + } + obj1.free(); + + //----- Range + if (!dict->lookup("Range", &obj1)->isArray()) { + error(-1, "Function is missing range"); + goto err2; + } + n = obj1.arrayGetLength() / 2; + if (n > 4) { + error(-1, "Functions with more than 4 outputs are unsupported"); + goto err2; + } + for (i = 0; i < n; ++i) { + obj1.arrayGet(2*i, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function range array"); + goto err1; + } + range[i][0] = obj2.getNum(); + obj2.free(); + obj1.arrayGet(2*i+1, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function range array"); + goto err1; + } + range[i][1] = obj2.getNum(); + obj2.free(); + } + obj1.free(); + + //----- Size + if (!dict->lookup("Size", &obj1)->isArray() || + obj1.arrayGetLength() != m) { + error(-1, "Function has missing or invalid size array"); + goto err2; + } + for (i = 0; i < m; ++i) { + obj1.arrayGet(i, &obj2); + if (!obj2.isInt()) { + error(-1, "Illegal value in function size array"); + goto err1; + } + sampleSize[i] = obj2.getInt(); + obj2.free(); + } + obj1.free(); + + //----- BitsPerSample + if (!dict->lookup("BitsPerSample", &obj1)->isInt()) { + error(-1, "Function has missing or invalid BitsPerSample"); + goto err2; + } + sampleBits = obj1.getInt(); + sampleMul = 1.0 / (double)((1 << sampleBits) - 1); + obj1.free(); + + //----- Encode + if (dict->lookup("Encode", &obj1)->isArray() && + obj1.arrayGetLength() == 2*m) { + for (i = 0; i < m; ++i) { + obj1.arrayGet(2*i, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function encode array"); + goto err1; + } + encode[i][0] = obj2.getNum(); + obj2.free(); + obj1.arrayGet(2*i+1, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function encode array"); + goto err1; + } + encode[i][1] = obj2.getNum(); + obj2.free(); + } + } else { + for (i = 0; i < m; ++i) { + encode[i][0] = 0; + encode[i][1] = sampleSize[i] - 1; + } + } + obj1.free(); + + //----- Decode + if (dict->lookup("Decode", &obj1)->isArray() && + obj1.arrayGetLength() == 2*n) { + for (i = 0; i < n; ++i) { + obj1.arrayGet(2*i, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function decode array"); + goto err1; + } + decode[i][0] = obj2.getNum(); + obj2.free(); + obj1.arrayGet(2*i+1, &obj2); + if (!obj2.isNum()) { + error(-1, "Illegal value in function decode array"); + goto err1; + } + decode[i][1] = obj2.getNum(); + obj2.free(); + } + } else { + for (i = 0; i < n; ++i) { + decode[i][0] = range[i][0]; + decode[i][1] = range[i][1]; + } + } + obj1.free(); + + //----- samples + nSamples = n; + for (i = 0; i < m; ++i) + nSamples *= sampleSize[i]; + samples = (double *)gmalloc(nSamples * sizeof(double)); + buf = 0; + bits = 0; + bitMask = (1 << sampleBits) - 1; + str->reset(); + for (i = 0; i < nSamples; ++i) { + if (sampleBits == 8) { + s = str->getChar(); + } else if (sampleBits == 16) { + s = str->getChar(); + s = (s << 8) + str->getChar(); + } else if (sampleBits == 32) { + s = str->getChar(); + s = (s << 8) + str->getChar(); + s = (s << 8) + str->getChar(); + s = (s << 8) + str->getChar(); + } else { + while (bits < sampleBits) { + buf = (buf << 8) | (str->getChar() & 0xff); + bits += 8; + } + s = (buf >> (bits - sampleBits)) & bitMask; + bits -= sampleBits; + } + samples[i] = (double)s * sampleMul; + } + + ok = gTrue; + return; + + err1: + obj2.free(); + err2: + obj1.free(); + err3: + return; +} + +Function::Function(Function *func) { + int nSamples, i; + + m = func->m; + n = func->n; + memcpy(domain, func->domain, sizeof(domain)); + memcpy(range, func->range, sizeof(range)); + memcpy(sampleSize, func->sampleSize, sizeof(sampleSize)); + memcpy(encode, func->encode, sizeof(encode)); + memcpy(decode, func->decode, sizeof(decode)); + + nSamples = n; + for (i = 0; i < m; ++i) + nSamples *= sampleSize[i]; + samples = (double *)gmalloc(nSamples * sizeof(double)); + memcpy(samples, func->samples, nSamples * sizeof(double)); + + ok = gTrue; +} + +Function::~Function() { + if (samples) + gfree(samples); +} + +void Function::transform(double *in, double *out) { + double e[4]; + double s; + double x0, x1; + int e0, e1; + double efrac; + int i; + + // map input values into sample array + for (i = 0; i < m; ++i) { + e[i] = ((in[i] - domain[i][0]) / (domain[i][1] - domain[i][0])) * + (encode[i][1] - encode[i][0]) + encode[i][0]; + if (e[i] < 0) + e[i] = 0; + else if (e[i] > sampleSize[i] - 1) + e[i] = sampleSize[i] - 1; + } + + for (i = 0; i < n; ++i) { + + // m-linear interpolation + // (only m=1 is currently supported) + e0 = (int)floor(e[0]); + e1 = (int)ceil(e[0]); + efrac = e[0] - e0; + x0 = samples[e0 * n + i]; + x1 = samples[e1 * n + i]; + s = (1 - efrac) * x0 + efrac * x1; + + // map output values to range + out[i] = s * (decode[i][1] - decode[i][0]) + decode[i][0]; + if (out[i] < range[i][0]) + out[i] = range[i][0]; + else if (out[i] > range[i][1]) + out[i] = range[i][1]; + } +} + +//------------------------------------------------------------------------ +// GfxImageColorMap +//------------------------------------------------------------------------ + +GfxImageColorMap::GfxImageColorMap(int bits1, Object *decode, + GfxColorSpace *colorSpace1) { + GfxColor color; + double x[4]; + int maxPixel; + Object obj; + int i, j; + + ok = gTrue; + + // bits per component and colorspace + bits = bits1; + maxPixel = (1 << bits) - 1; + colorSpace = colorSpace1; + mode = colorSpace->getMode(); + + // get decode map + if (decode->isNull()) { + if (colorSpace->isIndexed()) { + indexed = gTrue; + numComps = 1; + decodeLow[0] = 0; + decodeRange[0] = maxPixel; + } else { + indexed = gFalse; + numComps = colorSpace->getNumPixelComps(); + for (i = 0; i < numComps; ++i) { + decodeLow[i] = 0; + decodeRange[i] = 1; + } + } + } else if (decode->isArray()) { + numComps = decode->arrayGetLength() / 2; + if (numComps != colorSpace->getNumPixelComps()) + goto err1; + indexed = colorSpace->isIndexed(); + for (i = 0; i < numComps; ++i) { + decode->arrayGet(2*i, &obj); + if (!obj.isNum()) + goto err2; + decodeLow[i] = obj.getNum(); + obj.free(); + decode->arrayGet(2*i+1, &obj); + if (!obj.isNum()) + goto err2; + decodeRange[i] = obj.getNum() - decodeLow[i]; + obj.free(); + } + } else { + goto err1; + } + + // construct lookup table + lookup = (double (*)[4])gmalloc((maxPixel + 1) * 4 * sizeof(double)); + if (indexed) { + for (i = 0; i <= maxPixel; ++i) { + x[0] = (double)i; + colorSpace->getColor(x, &color); + lookup[i][0] = color.getR(); + lookup[i][1] = color.getG(); + lookup[i][2] = color.getB(); + } + } else { + for (i = 0; i <= maxPixel; ++i) + for (j = 0; j < numComps; ++j) + lookup[i][j] = decodeLow[j] + (i * decodeRange[j]) / maxPixel; + } + + return; + + err2: + obj.free(); + err1: + ok = gFalse; +} + +GfxImageColorMap::~GfxImageColorMap() { + delete colorSpace; + gfree(lookup); +} + +void GfxImageColorMap::getColor(Guchar x[4], GfxColor *color) { + double *p; + + if (indexed) { + p = lookup[x[0]]; + color->setRGB(p[0], p[1], p[2]); + } else { + switch (mode) { + case colorGray: + color->setGray(lookup[x[0]][0]); + break; + case colorCMYK: + color->setCMYK(lookup[x[0]][0], lookup[x[1]][1], + lookup[x[2]][2], lookup[x[3]][3]); + break; + case colorRGB: + color->setRGB(lookup[x[0]][0], lookup[x[1]][1], lookup[x[2]][2]); + break; + } + } +} + +//------------------------------------------------------------------------ +// GfxSubpath and GfxPath +//------------------------------------------------------------------------ + +GfxSubpath::GfxSubpath(double x1, double y1) { + size = 16; + x = (double *)gmalloc(size * sizeof(double)); + y = (double *)gmalloc(size * sizeof(double)); + curve = (GBool *)gmalloc(size * sizeof(GBool)); + n = 1; + x[0] = x1; + y[0] = y1; + curve[0] = gFalse; +} + +GfxSubpath::~GfxSubpath() { + gfree(x); + gfree(y); + gfree(curve); +} + +// Used for copy(). +GfxSubpath::GfxSubpath(GfxSubpath *subpath) { + size = subpath->size; + n = subpath->n; + x = (double *)gmalloc(size * sizeof(double)); + y = (double *)gmalloc(size * sizeof(double)); + curve = (GBool *)gmalloc(size * sizeof(GBool)); + memcpy(x, subpath->x, n * sizeof(double)); + memcpy(y, subpath->y, n * sizeof(double)); + memcpy(curve, subpath->curve, n * sizeof(GBool)); +} + +void GfxSubpath::lineTo(double x1, double y1) { + if (n >= size) { + size += 16; + x = (double *)grealloc(x, size * sizeof(double)); + y = (double *)grealloc(y, size * sizeof(double)); + curve = (GBool *)grealloc(curve, size * sizeof(GBool)); + } + x[n] = x1; + y[n] = y1; + curve[n] = gFalse; + ++n; +} + +void GfxSubpath::curveTo(double x1, double y1, double x2, double y2, + double x3, double y3) { + if (n+3 > size) { + size += 16; + x = (double *)grealloc(x, size * sizeof(double)); + y = (double *)grealloc(y, size * sizeof(double)); + curve = (GBool *)grealloc(curve, size * sizeof(GBool)); + } + x[n] = x1; + y[n] = y1; + x[n+1] = x2; + y[n+1] = y2; + x[n+2] = x3; + y[n+2] = y3; + curve[n] = curve[n+1] = gTrue; + curve[n+2] = gFalse; + n += 3; +} + +GfxPath::GfxPath() { + justMoved = gFalse; + size = 16; + n = 0; + subpaths = (GfxSubpath **)gmalloc(size * sizeof(GfxSubpath *)); +} + +GfxPath::~GfxPath() { + int i; + + for (i = 0; i < n; ++i) + delete subpaths[i]; + gfree(subpaths); +} + +// Used for copy(). +GfxPath::GfxPath(GBool justMoved1, double firstX1, double firstY1, + GfxSubpath **subpaths1, int n1, int size1) { + int i; + + justMoved = justMoved1; + firstX = firstX1; + firstY = firstY1; + size = size1; + n = n1; + subpaths = (GfxSubpath **)gmalloc(size * sizeof(GfxSubpath *)); + for (i = 0; i < n; ++i) + subpaths[i] = subpaths1[i]->copy(); +} + +void GfxPath::moveTo(double x, double y) { + justMoved = gTrue; + firstX = x; + firstY = y; +} + +void GfxPath::lineTo(double x, double y) { + if (justMoved) { + if (n >= size) { + size += 16; + subpaths = (GfxSubpath **) + grealloc(subpaths, size * sizeof(GfxSubpath *)); + } + subpaths[n] = new GfxSubpath(firstX, firstY); + ++n; + justMoved = gFalse; + } + subpaths[n-1]->lineTo(x, y); +} + +void GfxPath::curveTo(double x1, double y1, double x2, double y2, + double x3, double y3) { + if (justMoved) { + if (n >= size) { + size += 16; + subpaths = (GfxSubpath **) + grealloc(subpaths, size * sizeof(GfxSubpath *)); + } + subpaths[n] = new GfxSubpath(firstX, firstY); + ++n; + justMoved = gFalse; + } + subpaths[n-1]->curveTo(x1, y1, x2, y2, x3, y3); +} + + +//------------------------------------------------------------------------ +// GfxState +//------------------------------------------------------------------------ + +GfxState::GfxState(int dpi, double px1a, double py1a, double px2a, double py2a, + int rotate, GBool upsideDown) { + double k; + + px1 = px1a; + py1 = py1a; + px2 = px2a; + py2 = py2a; + k = (double)dpi / 72.0; + if (rotate == 90) { + ctm[0] = 0; + ctm[1] = upsideDown ? k : -k; + ctm[2] = k; + ctm[3] = 0; + ctm[4] = -k * py1; + ctm[5] = k * (upsideDown ? -px1 : px2); + pageWidth = (int)(k * (py2 - py1)); + pageHeight = (int)(k * (px2 - px1)); + } else if (rotate == 180) { + ctm[0] = -k; + ctm[1] = 0; + ctm[2] = 0; + ctm[3] = upsideDown ? k : -k; + ctm[4] = k * px2; + ctm[5] = k * (upsideDown ? -py1 : py2); + pageWidth = (int)(k * (px2 - px1)); + pageHeight = (int)(k * (py2 - py1)); + } else if (rotate == 270) { + ctm[0] = 0; + ctm[1] = upsideDown ? -k : k; + ctm[2] = -k; + ctm[3] = 0; + ctm[4] = k * py2; + ctm[5] = k * (upsideDown ? px2 : -px1); + pageWidth = (int)(k * (py2 - py1)); + pageHeight = (int)(k * (px2 - px1)); + } else { + ctm[0] = k; + ctm[1] = 0; + ctm[2] = 0; + ctm[3] = upsideDown ? -k : k; + ctm[4] = -k * px1; + ctm[5] = k * (upsideDown ? py2 : -py1); + pageWidth = (int)(k * (px2 - px1)); + pageHeight = (int)(k * (py2 - py1)); + } + + fillColorSpace = new GfxColorSpace(colorGray); + strokeColorSpace = new GfxColorSpace(colorGray); + fillColor.setGray(0); + strokeColor.setGray(0); + + lineWidth = 1; + lineDash = NULL; + lineDashLength = 0; + lineDashStart = 0; + flatness = 0; + lineJoin = 0; + lineCap = 0; + miterLimit = 10; + + font = NULL; + fontSize = 0; + textMat[0] = 1; textMat[1] = 0; + textMat[2] = 0; textMat[3] = 1; + textMat[4] = 0; textMat[5] = 0; + charSpace = 0; + wordSpace = 0; + horizScaling = 1; + leading = 0; + rise = 0; + render = 0; + + path = new GfxPath(); + curX = curY = 0; + lineX = lineY = 0; + + saved = NULL; +} + +GfxState::~GfxState() { + if (fillColorSpace) + delete fillColorSpace; + if (strokeColorSpace) + delete strokeColorSpace; + gfree(lineDash); + delete path; + if (saved) + delete saved; +} + +// Used for copy(); +GfxState::GfxState(GfxState *state) { + memcpy(this, state, sizeof(GfxState)); + if (fillColorSpace) + fillColorSpace = state->fillColorSpace->copy(); + if (strokeColorSpace) + strokeColorSpace = state->strokeColorSpace->copy(); + if (lineDashLength > 0) { + lineDash = (double *)gmalloc(lineDashLength * sizeof(double)); + memcpy(lineDash, state->lineDash, lineDashLength * sizeof(double)); + } + path = state->path->copy(); + saved = NULL; +} + +double GfxState::transformWidth(double w) { + double x, y; + + x = ctm[0] + ctm[2]; + y = ctm[1] + ctm[3]; + return w * sqrt(0.5 * (x * x + y * y)); +} + +double GfxState::getTransformedFontSize() { + double x1, y1, x2, y2; + + x1 = textMat[2] * fontSize; + y1 = textMat[3] * fontSize; + x2 = ctm[0] * x1 + ctm[2] * y1; + y2 = ctm[1] * x1 + ctm[3] * y1; + return sqrt(x2 * x2 + y2 * y2); +} + +void GfxState::getFontTransMat(double *m11, double *m12, + double *m21, double *m22) { + *m11 = (textMat[0] * ctm[0] + textMat[1] * ctm[2]) * fontSize; + *m12 = (textMat[0] * ctm[1] + textMat[1] * ctm[3]) * fontSize; + *m21 = (textMat[2] * ctm[0] + textMat[3] * ctm[2]) * fontSize; + *m22 = (textMat[2] * ctm[1] + textMat[3] * ctm[3]) * fontSize; +} + +void GfxState::concatCTM(double a, double b, double c, + double d, double e, double f) { + double a1 = ctm[0]; + double b1 = ctm[1]; + double c1 = ctm[2]; + double d1 = ctm[3]; + + ctm[0] = a * a1 + b * c1; + ctm[1] = a * b1 + b * d1; + ctm[2] = c * a1 + d * c1; + ctm[3] = c * b1 + d * d1; + ctm[4] = e * a1 + f * c1 + ctm[4]; + ctm[5] = e * b1 + f * d1 + ctm[5]; +} + +void GfxState::setFillColorSpace(GfxColorSpace *colorSpace) { + if (fillColorSpace) + delete fillColorSpace; + fillColorSpace = colorSpace; +} + +void GfxState::setStrokeColorSpace(GfxColorSpace *colorSpace) { + if (strokeColorSpace) + delete strokeColorSpace; + strokeColorSpace = colorSpace; +} + +void GfxState::setLineDash(double *dash, int length, double start) { + if (lineDash) + gfree(lineDash); + lineDash = dash; + lineDashLength = length; + lineDashStart = start; +} + +void GfxState::clearPath() { + delete path; + path = new GfxPath(); +} + +void GfxState::textShift(double tx) { + double dx, dy; + + textTransformDelta(tx, 0, &dx, &dy); + curX += dx; + curY += dy; +} + +GfxState *GfxState::save() { + GfxState *newState; + + newState = copy(); + newState->saved = this; + return newState; +} + +GfxState *GfxState::restore() { + GfxState *oldState; + + if (saved) { + oldState = saved; + saved = NULL; + delete this; + } else { + oldState = this; + } + return oldState; +} diff --git a/pdf/xpdf/GfxState.h b/pdf/xpdf/GfxState.h new file mode 100644 index 00000000..21bbec84 --- /dev/null +++ b/pdf/xpdf/GfxState.h @@ -0,0 +1,472 @@ +//======================================================================== +// +// GfxState.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef GFXSTATE_H +#define GFXSTATE_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "gtypes.h" + +class Object; +class Function; +class GfxFont; + +//------------------------------------------------------------------------ +// GfxColor +//------------------------------------------------------------------------ + +class GfxColor { +public: + + GfxColor(): r(0), g(0), b(0) {} + + // Set color. + void setGray(double gray) + { r = g = b = gray; } + void setCMYK(double c, double m, double y, double k); + void setRGB(double r1, double g1, double b1) + { r = r1; g = g1; b = b1; } + + // Accessors. + double getR() { return r; } + double getG() { return g; } + double getB() { return b; } + double getGray() { return 0.299 * r + 0.587 * g + 0.114 * b; } + +private: + + double r, g, b; +}; + +//------------------------------------------------------------------------ +// GfxColorSpace +//------------------------------------------------------------------------ + +enum GfxColorMode { + colorGray, colorCMYK, colorRGB +}; + +class GfxColorSpace { +public: + + // Construct a colorspace. + GfxColorSpace(Object *colorSpace); + + // Construct a simple colorspace: DeviceGray, DeviceCMYK, or + // DeviceRGB. + GfxColorSpace(GfxColorMode mode1); + + // Destructor. + ~GfxColorSpace(); + + // Copy. + GfxColorSpace *copy() { return new GfxColorSpace(this); } + + // Is color space valid? + GBool isOk() { return ok; } + + // Get the color mode. + GfxColorMode getMode() { return mode; } + + // Get number of components in pixels of this colorspace. + int getNumPixelComps() { return indexed ? 1 : numComps; } + + // Get number of components in colors of this colorspace. + int getNumColorComps() { return numComps; } + + // Return true if colorspace is indexed. + GBool isIndexed() { return indexed; } + + // Get lookup table (only for indexed colorspaces). + int getIndexHigh() { return indexHigh; } + Guchar *getLookupVal(int i) { return lookup[i]; } + + // Convert a pixel to a color. + void getColor(double x[4], GfxColor *color); + +private: + + Function *sepFunc; // separation tint transform function + GfxColorMode mode; // color mode + GBool indexed; // set for indexed colorspaces + int numComps; // number of components in colors + int indexHigh; // max pixel for indexed colorspace + Guchar (*lookup)[4]; // lookup table (only for indexed + // colorspaces) + GBool ok; // is color space valid? + + GfxColorSpace(GfxColorSpace *colorSpace); + void setMode(Object *colorSpace); +}; + +//------------------------------------------------------------------------ +// Function +//------------------------------------------------------------------------ + +class Function { +public: + + // Create a PDF function object. + Function(Object *funcObj); + + ~Function(); + + Function *copy() { return new Function(this); } + + GBool isOk() { return ok; } + + // Return size of input and output tuples. + int getInputSize() { return m; } + int getOutputSize() { return n; } + + // Transform an input tuple into an output tuple. + void transform(double *in, double *out); + +private: + + Function(Function *func); + + int m, n; + double domain[1][2]; + double range[4][2]; + int sampleSize[1]; + double encode[1][2]; + double decode[4][2]; + double *samples; + GBool ok; +}; + +//------------------------------------------------------------------------ +// GfxImageColorMap +//------------------------------------------------------------------------ + +class GfxImageColorMap { +public: + + // Constructor. + GfxImageColorMap(int bits1, Object *decode, GfxColorSpace *colorSpace1); + + // Destructor. + ~GfxImageColorMap(); + + // Is color map valid? + GBool isOk() { return ok; } + + // Get the color space. + GfxColorSpace *getColorSpace() { return colorSpace; } + + // Get stream decoding info. + int getNumPixelComps() { return numComps; } + int getBits() { return bits; } + + // Get decode table. + double getDecodeLow(int i) { return decodeLow[i]; } + double getDecodeHigh(int i) { return decodeLow[i] + decodeRange[i]; } + + // Convert a pixel to a color. + void getColor(Guchar x[4], GfxColor *color); + +private: + + GfxColorSpace *colorSpace; // the image colorspace + int bits; // bits per component + int numComps; // number of components in a pixel + GBool indexed; // set for indexed color space + GfxColorMode mode; // color mode + double (*lookup)[4]; // lookup table + double decodeLow[4]; // minimum values for each component + double decodeRange[4]; // max - min value for each component + GBool ok; +}; + +//------------------------------------------------------------------------ +// GfxSubpath and GfxPath +//------------------------------------------------------------------------ + +class GfxSubpath { +public: + + // Constructor. + GfxSubpath(double x1, double y1); + + // Destructor. + ~GfxSubpath(); + + // Copy. + GfxSubpath *copy() { return new GfxSubpath(this); } + + // Get points. + int getNumPoints() { return n; } + double getX(int i) { return x[i]; } + double getY(int i) { return y[i]; } + GBool getCurve(int i) { return curve[i]; } + + // Get last point. + double getLastX() { return x[n-1]; } + double getLastY() { return y[n-1]; } + + // Add a line segment. + void lineTo(double x1, double y1); + + // Add a Bezier curve. + void curveTo(double x1, double y1, double x2, double y2, + double x3, double y3); + + // Close the subpath. + void close() + { if (x[n-1] != x[0] || y[n-1] != y[0]) lineTo(x[0], y[0]); } + +private: + + double *x, *y; // points + GBool *curve; // curve[i] => point i is a control point + // for a Bezier curve + int n; // number of points + int size; // size of x/y arrays + + GfxSubpath(GfxSubpath *subpath); +}; + +class GfxPath { +public: + + // Constructor. + GfxPath(); + + // Destructor. + ~GfxPath(); + + // Copy. + GfxPath *copy() + { return new GfxPath(justMoved, firstX, firstY, subpaths, n, size); } + + // Is there a current point? + GBool isCurPt() { return n > 0 || justMoved; } + + // Is the path non-empty, i.e., is there at least one segment? + GBool isPath() { return n > 0; } + + // Get subpaths. + int getNumSubpaths() { return n; } + GfxSubpath *getSubpath(int i) { return subpaths[i]; } + + // Get last point on last subpath. + double getLastX() { return subpaths[n-1]->getLastX(); } + double getLastY() { return subpaths[n-1]->getLastY(); } + + // Move the current point. + void moveTo(double x, double y); + + // Add a segment to the last subpath. + void lineTo(double x, double y); + + // Add a Bezier curve to the last subpath + void curveTo(double x1, double y1, double x2, double y2, + double x3, double y3); + + // Close the last subpath. + void close() { subpaths[n-1]->close(); } + +private: + + GBool justMoved; // set if a new subpath was just started + double firstX, firstY; // first point in new subpath + GfxSubpath **subpaths; // subpaths + int n; // number of subpaths + int size; // size of subpaths array + + GfxPath(GBool justMoved1, double firstX1, double firstY1, + GfxSubpath **subpaths1, int n1, int size1); +}; + +//------------------------------------------------------------------------ +// GfxState +//------------------------------------------------------------------------ + +class GfxState { +public: + + // Construct a default GfxState, for a device with resolution , + // page box (,)-(,), page rotation , and + // coordinate system specified by . + GfxState(int dpi, double px1a, double py1a, double px2a, double py2a, + int rotate, GBool upsideDown); + + // Destructor. + ~GfxState(); + + // Copy. + GfxState *copy() { return new GfxState(this); } + + // Accessors. + double *getCTM() { return ctm; } + double getX1() { return px1; } + double getY1() { return py1; } + double getX2() { return px2; } + double getY2() { return py2; } + double getPageWidth() { return pageWidth; } + double getPageHeight() { return pageHeight; } + GfxColor *getFillColor() { return &fillColor; } + GfxColor *getStrokeColor() { return &strokeColor; } + double getLineWidth() { return lineWidth; } + void getLineDash(double **dash, int *length, double *start) + { *dash = lineDash; *length = lineDashLength; *start = lineDashStart; } + int getFlatness() { return flatness; } + int getLineJoin() { return lineJoin; } + int getLineCap() { return lineCap; } + double getMiterLimit() { return miterLimit; } + GfxFont *getFont() { return font; } + double getFontSize() { return fontSize; } + double *getTextMat() { return textMat; } + double getCharSpace() { return charSpace; } + double getWordSpace() { return wordSpace; } + double getHorizScaling() { return horizScaling; } + double getLeading() { return leading; } + double getRise() { return rise; } + int getRender() { return render; } + GfxPath *getPath() { return path; } + double getCurX() { return curX; } + double getCurY() { return curY; } + double getLineX() { return lineX; } + double getLineY() { return lineY; } + + // Is there a current point/path? + GBool isCurPt() { return path->isCurPt(); } + GBool isPath() { return path->isPath(); } + + // Transforms. + void transform(double x1, double y1, double *x2, double *y2) + { *x2 = ctm[0] * x1 + ctm[2] * y1 + ctm[4]; + *y2 = ctm[1] * x1 + ctm[3] * y1 + ctm[5]; } + void transformDelta(double x1, double y1, double *x2, double *y2) + { *x2 = ctm[0] * x1 + ctm[2] * y1; + *y2 = ctm[1] * x1 + ctm[3] * y1; } + void textTransform(double x1, double y1, double *x2, double *y2) + { *x2 = textMat[0] * x1 + textMat[2] * y1 + textMat[4]; + *y2 = textMat[1] * x1 + textMat[3] * y1 + textMat[5]; } + void textTransformDelta(double x1, double y1, double *x2, double *y2) + { *x2 = textMat[0] * x1 + textMat[2] * y1; + *y2 = textMat[1] * x1 + textMat[3] * y1; } + double transformWidth(double w); + double getTransformedLineWidth() + { return transformWidth(lineWidth); } + double getTransformedFontSize(); + void getFontTransMat(double *m11, double *m12, double *m21, double *m22); + + // Change state parameters. + void concatCTM(double a, double b, double c, + double d, double e, double f); + void setFillGray(double gray) + { fillColor.setGray(gray); } + void setFillCMYK(double c, double m, double y, double k) + { fillColor.setCMYK(c, m, y, k); } + void setFillRGB(double r, double g, double b) + { fillColor.setRGB(r, g, b); } + void setStrokeGray(double gray) + { strokeColor.setGray(gray); } + void setStrokeCMYK(double c, double m, double y, double k) + { strokeColor.setCMYK(c, m, y, k); } + void setStrokeRGB(double r, double g, double b) + { strokeColor.setRGB(r, g, b); } + void setFillColorSpace(GfxColorSpace *colorSpace); + void setStrokeColorSpace(GfxColorSpace *colorSpace); + void setFillColor(double x[4]) + { fillColorSpace->getColor(x, &fillColor); } + void setStrokeColor(double x[4]) + { strokeColorSpace->getColor(x, &strokeColor); } + void setLineWidth(double width) + { lineWidth = width; } + void setLineDash(double *dash, int length, double start); + void setFlatness(int flatness1) { flatness = flatness1; } + void setLineJoin(int lineJoin1) { lineJoin = lineJoin1; } + void setLineCap(int lineCap1) { lineCap = lineCap1; } + void setMiterLimit(double miterLimit1) { miterLimit = miterLimit1; } + void setFont(GfxFont *font1, double fontSize1) + { font = font1; fontSize = fontSize1; } + void setTextMat(double a, double b, double c, + double d, double e, double f) + { textMat[0] = a; textMat[1] = b; textMat[2] = c; + textMat[3] = d; textMat[4] = e; textMat[5] = f; } + void setCharSpace(double space) + { charSpace = space; } + void setWordSpace(double space) + { wordSpace = space; } + void setHorizScaling(double scale) + { horizScaling = 0.01 * scale; } + void setLeading(double leading1) + { leading = leading1; } + void setRise(double rise1) + { rise = rise1; } + void setRender(int render1) + { render = render1; } + + // Add to path. + void moveTo(double x, double y) + { path->moveTo(curX = x, curY = y); } + void lineTo(double x, double y) + { path->lineTo(curX = x, curY = y); } + void curveTo(double x1, double y1, double x2, double y2, + double x3, double y3) + { path->curveTo(x1, y1, x2, y2, curX = x3, curY = y3); } + void closePath() + { path->close(); curX = path->getLastX(); curY = path->getLastY(); } + void clearPath(); + + // Text position. + void textMoveTo(double tx, double ty) + { lineX = tx; lineY = ty; textTransform(tx, ty, &curX, &curY); } + void textShift(double tx); + + // Push/pop GfxState on/off stack. + GfxState *save(); + GfxState *restore(); + GBool hasSaves() { return saved != NULL; } + +private: + + double ctm[6]; // coord transform matrix + double px1, py1, px2, py2; // page corners (user coords) + double pageWidth, pageHeight; // page size (pixels) + + GfxColorSpace *fillColorSpace; // fill color space + GfxColorSpace *strokeColorSpace; // stroke color space + GfxColor fillColor; // fill color + GfxColor strokeColor; // stroke color + + double lineWidth; // line width + double *lineDash; // line dash + int lineDashLength; + double lineDashStart; + int flatness; // curve flatness + int lineJoin; // line join style + int lineCap; // line cap style + double miterLimit; // line miter limit + + GfxFont *font; // font + double fontSize; // font size + double textMat[6]; // text matrix + double charSpace; // character spacing + double wordSpace; // word spacing + double horizScaling; // horizontal scaling + double leading; // text leading + double rise; // text rise + int render; // text rendering mode + + GfxPath *path; // array of path elements + double curX, curY; // current point (user coords) + double lineX, lineY; // start of current text line (text coords) + + GfxState *saved; // next GfxState on stack + + GfxState(GfxState *state); +}; + +#endif diff --git a/pdf/xpdf/ImageOutputDev.cc b/pdf/xpdf/ImageOutputDev.cc new file mode 100644 index 00000000..00782fb5 --- /dev/null +++ b/pdf/xpdf/ImageOutputDev.cc @@ -0,0 +1,151 @@ +//======================================================================== +// +// ImageOutputDev.cc +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "gmem.h" +#include "config.h" +#include "Error.h" +#include "GfxState.h" +#include "Object.h" +#include "Stream.h" +#include "ImageOutputDev.h" + +ImageOutputDev::ImageOutputDev(char *fileRoot1, GBool dumpJPEG1) { + fileRoot = copyString(fileRoot1); + fileName = (char *)gmalloc(strlen(fileRoot) + 20); + dumpJPEG = dumpJPEG1; + imgNum = 0; + ok = gTrue; +} + +ImageOutputDev::~ImageOutputDev() { + gfree(fileName); + gfree(fileRoot); +} + +void ImageOutputDev::drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg) { + FILE *f; + int c; + + // dump JPEG file + if (dumpJPEG && str->getKind() == strDCT) { + + // open the image file + sprintf(fileName, "%s-%03d.jpg", fileRoot, imgNum); + ++imgNum; + if (!(f = fopen(fileName, "wb"))) { + error(-1, "Couldn't open image file '%s'", fileName); + return; + } + + // initialize stream + str = ((DCTStream *)str)->getRawStream(); + str->reset(); + + // copy the stream + while ((c = str->getChar()) != EOF) + fputc(c, f); + + fclose(f); + + // dump PBM file + } else { + + // open the image file and write the PBM header + sprintf(fileName, "%s-%03d.pbm", fileRoot, imgNum); + ++imgNum; + if (!(f = fopen(fileName, "wb"))) { + error(-1, "Couldn't open image file '%s'", fileName); + return; + } + fprintf(f, "P4\n"); + fprintf(f, "%d %d\n", width, height); + + // initialize stream + str->reset(); + + // copy the stream + while ((c = str->getChar()) != EOF) + fputc(c, f); + + fclose(f); + } +} + +void ImageOutputDev::drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg) { + FILE *f; + Guchar pixBuf[4]; + GfxColor color; + int x, y; + int c; + + // dump JPEG file + if (dumpJPEG && str->getKind() == strDCT) { + + // open the image file + sprintf(fileName, "%s-%03d.jpg", fileRoot, imgNum); + ++imgNum; + if (!(f = fopen(fileName, "wb"))) { + error(-1, "Couldn't open image file '%s'", fileName); + return; + } + + // initialize stream + str = ((DCTStream *)str)->getRawStream(); + str->reset(); + + // copy the stream + while ((c = str->getChar()) != EOF) + fputc(c, f); + + fclose(f); + + // dump PPM file + } else { + + // open the image file and write the PPM header + sprintf(fileName, "%s-%03d.ppm", fileRoot, imgNum); + ++imgNum; + if (!(f = fopen(fileName, "wb"))) { + error(-1, "Couldn't open image file '%s'", fileName); + return; + } + fprintf(f, "P6\n"); + fprintf(f, "%d %d\n", width, height); + fprintf(f, "255\n"); + + // initialize stream + str->resetImage(width, colorMap->getNumPixelComps(), colorMap->getBits()); + + // for each line... + for (y = 0; y < height; ++y) { + + // write the line + for (x = 0; x < width; ++x) { + str->getImagePixel(pixBuf); + colorMap->getColor(pixBuf, &color); + fputc((int)(color.getR() * 255 + 0.5), f); + fputc((int)(color.getG() * 255 + 0.5), f); + fputc((int)(color.getB() * 255 + 0.5), f); + } + } + + fclose(f); + } +} diff --git a/pdf/xpdf/ImageOutputDev.h b/pdf/xpdf/ImageOutputDev.h new file mode 100644 index 00000000..84766dd1 --- /dev/null +++ b/pdf/xpdf/ImageOutputDev.h @@ -0,0 +1,67 @@ +//======================================================================== +// +// ImageOutputDev.h +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifndef IMAGEOUTPUTDEV_H +#define IMAGEOUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "gtypes.h" +#include "OutputDev.h" + +class GfxState; + +//------------------------------------------------------------------------ +// ImageOutputDev +//------------------------------------------------------------------------ + +class ImageOutputDev: public OutputDev { +public: + + // Create an OutputDev which will write images to files named + // -NNN.. Normally, all images are written as PBM + // (.pbm) or PPM (.ppm) files. If is set, JPEG images are + // written as JPEG (.jpg) files. + ImageOutputDev(char *fileRoot1, GBool dumpJPEG1); + + // Destructor. + virtual ~ImageOutputDev(); + + // Check if file was successfully created. + virtual GBool isOk() { return ok; } + + //---- get info about output device + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) + virtual GBool upsideDown() { return gTrue; } + + // Does this device use drawChar() or drawString()? + virtual GBool useDrawChar() { return gFalse; } + + //----- image drawing + virtual void drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg); + virtual void drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg); + +private: + + char *fileRoot; // root of output file names + char *fileName; // buffer for output file names + GBool dumpJPEG; // set to dump native JPEG files + int imgNum; // current image number + GBool ok; // set up ok? +}; + +#endif diff --git a/pdf/xpdf/LTKOutputDev.cc b/pdf/xpdf/LTKOutputDev.cc new file mode 100644 index 00000000..8b376e41 --- /dev/null +++ b/pdf/xpdf/LTKOutputDev.cc @@ -0,0 +1,57 @@ +//======================================================================== +// +// LTKOutputDev.cc +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "gmem.h" +#include "GString.h" +#include "LTKWindow.h" +#include "LTKScrollingCanvas.h" +#include "Object.h" +#include "Stream.h" +#include "GfxState.h" +#include "GfxFont.h" +#include "Error.h" +#include "Params.h" +#include "LTKOutputDev.h" + +//------------------------------------------------------------------------ + +LTKOutputDev::LTKOutputDev(LTKWindow *win1, unsigned long paperColor): + XOutputDev(win1->getDisplay(), + ((LTKScrollingCanvas *)win1->findWidget("canvas"))->getPixmap(), + 0, win1->getColormap(), paperColor) +{ + win = win1; + canvas = (LTKScrollingCanvas *)win->findWidget("canvas"); + setPixmap(canvas->getPixmap(), + canvas->getRealWidth(), canvas->getRealHeight()); +} + +LTKOutputDev::~LTKOutputDev() { +} + +void LTKOutputDev::startPage(int pageNum, GfxState *state) { + canvas->resize((int)(state->getPageWidth() + 0.5), + (int)(state->getPageHeight() + 0.5)); + setPixmap(canvas->getPixmap(), + canvas->getRealWidth(), canvas->getRealHeight()); + XOutputDev::startPage(pageNum, state); + canvas->redraw(); +} + +void LTKOutputDev::dump() { + canvas->redraw(); + XOutputDev::dump(); +} diff --git a/pdf/xpdf/LTKOutputDev.h b/pdf/xpdf/LTKOutputDev.h new file mode 100644 index 00000000..f8d7ddad --- /dev/null +++ b/pdf/xpdf/LTKOutputDev.h @@ -0,0 +1,46 @@ +//======================================================================== +// +// LTKOutputDev.h +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifndef LTKOUTPUTDEV_H +#define LTKOUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "config.h" +#include "XOutputDev.h" + +class LTKApp; +class LTKWindow; + +//------------------------------------------------------------------------ + +class LTKOutputDev: public XOutputDev { +public: + + LTKOutputDev(LTKWindow *win1, unsigned long paperColor); + + ~LTKOutputDev(); + + //----- initialization and control + + // Start a page. + virtual void startPage(int pageNum, GfxState *state); + + // Dump page contents to display. + virtual void dump(); + +private: + + LTKWindow *win; // window + LTKScrollingCanvas *canvas; // drawing canvas +}; + +#endif diff --git a/pdf/xpdf/Lexer.cc b/pdf/xpdf/Lexer.cc new file mode 100644 index 00000000..302a0248 --- /dev/null +++ b/pdf/xpdf/Lexer.cc @@ -0,0 +1,453 @@ +//======================================================================== +// +// Lexer.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "Lexer.h" +#include "Error.h" + +//------------------------------------------------------------------------ + +// A '1' in this array means the corresponding character ends a name +// or command. +static char endOfNameChars[128] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, // 0x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x + 1, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, // 2x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, // 3x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 4x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, // 5x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 6x + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0 // 7x +}; + +//------------------------------------------------------------------------ +// Lexer +//------------------------------------------------------------------------ + +Lexer::Lexer(Stream *str) { + Object obj; + + curStr.initStream(str); + streams = new Array(); + streams->add(curStr.copy(&obj)); + strPtr = 0; + freeArray = gTrue; + curStr.streamReset(); +} + +Lexer::Lexer(Object *obj) { + Object obj2; + + if (obj->isStream()) { + streams = new Array(); + freeArray = gTrue; + streams->add(obj->copy(&obj2)); + } else { + streams = obj->getArray(); + freeArray = gFalse; + } + strPtr = 0; + if (streams->getLength() > 0) { + streams->get(strPtr, &curStr); + curStr.streamReset(); + } +} + +Lexer::~Lexer() { + if (!curStr.isNone()) + curStr.free(); + if (freeArray) + delete streams; +} + +int Lexer::getChar() { + int c; + + c = EOF; + while (!curStr.isNone() && (c = curStr.streamGetChar()) == EOF) { + curStr.free(); + ++strPtr; + if (strPtr < streams->getLength()) { + streams->get(strPtr, &curStr); + curStr.streamReset(); + } + } + return c; +} + +int Lexer::lookChar() { + int c; + + c = EOF; + while (!curStr.isNone() && (c = curStr.streamLookChar()) == EOF) { + curStr.free(); + ++strPtr; + if (strPtr < streams->getLength()) { + streams->get(strPtr, &curStr); + curStr.streamReset(); + } + } + return c; +} + +Object *Lexer::getObj(Object *obj) { + char *p; + int c, c2; + GBool comment, neg, done; + int numParen; + int xi; + double xf, scale; + GString *s; + int n, m; + + // skip whitespace and comments + comment = gFalse; + while (1) { + if ((c = getChar()) == EOF) + return obj->initEOF(); + if (comment) { + if (c == '\r' || c == '\n') + comment = gFalse; + } else if (c == '%') { + comment = gTrue; + } else if (!isspace(c)) { + break; + } + } + + // start reading token + switch (c) { + + // number + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + case '-': case '.': + neg = gFalse; + xi = 0; + if (c == '-') { + neg = gTrue; + } else if (c == '.') { + goto doReal; + } else { + xi = c - '0'; + } + while (1) { + c = lookChar(); + if (isdigit(c)) { + getChar(); + xi = xi * 10 + (c - '0'); + } else if (c == '.') { + getChar(); + goto doReal; + } else { + break; + } + } + if (neg) + xi = -xi; + obj->initInt(xi); + break; + doReal: + xf = xi; + scale = 0.1; + while (1) { + c = lookChar(); + if (!isdigit(c)) + break; + getChar(); + xf = xf + scale * (c - '0'); + scale *= 0.1; + } + if (neg) + xf = -xf; + obj->initReal(xf); + break; + + // string + case '(': + p = tokBuf; + n = 0; + numParen = 1; + done = gFalse; + s = NULL; + do { + c2 = EOF; + switch (c = getChar()) { + + case EOF: + case '\r': + case '\n': + error(getPos(), "Unterminated string"); + done = gTrue; + break; + + case '(': + ++numParen; + break; + + case ')': + if (--numParen == 0) + done = gTrue; + break; + + case '\\': + switch (c = getChar()) { + case 'n': + c2 = '\n'; + break; + case 'r': + c2 = '\r'; + break; + case 't': + c2 = '\t'; + break; + case 'b': + c2 = '\b'; + break; + case 'f': + c2 = '\f'; + break; + case '\\': + case '(': + case ')': + c2 = c; + break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c2 = c - '0'; + c = lookChar(); + if (c >= '0' && c <= '7') { + getChar(); + c2 = (c2 << 3) + (c - '0'); + c = lookChar(); + if (c >= '0' && c <= '7') { + getChar(); + c2 = (c2 << 3) + (c - '0'); + } + } + break; + case '\r': + c = lookChar(); + if (c == '\n') + getChar(); + break; + case '\n': + break; + case EOF: + error(getPos(), "Unterminated string"); + done = gTrue; + break; + default: + c2 = c; + break; + } + break; + + default: + c2 = c; + break; + } + + if (c2 != EOF) { + if (n == tokBufSize) { + if (!s) + s = new GString(tokBuf, tokBufSize); + else + s->append(tokBuf, tokBufSize); + p = tokBuf; + n = 0; + } + *p++ = (char)c2; + ++n; + } + } while (!done); + if (!s) + s = new GString(tokBuf, n); + else + s->append(tokBuf, n); + obj->initString(s); + break; + + // name + case '/': + p = tokBuf; + n = 0; + while ((c = lookChar()) != EOF && !(c < 128 && endOfNameChars[c])) { + getChar(); + if (c == '#') { + c2 = lookChar(); + if (c2 >= '0' && c2 <= '9') + c = c2 - '0'; + else if (c2 >= 'A' && c2 <= 'F') + c = c2 - 'A' + 10; + else if (c2 >= 'a' && c2 <= 'f') + c = c2 - 'a' + 10; + else + goto notEscChar; + getChar(); + c <<= 4; + c2 = getChar(); + if (c2 >= '0' && c2 <= '9') + c += c2 - '0'; + else if (c2 >= 'A' && c2 <= 'F') + c += c2 - 'A' + 10; + else if (c2 >= 'a' && c2 <= 'f') + c += c2 - 'a' + 10; + else + error(getPos(), "Illegal digit in hex char in name"); + } + notEscChar: + if (++n == tokBufSize) { + error(getPos(), "Name token too long"); + break; + } + *p++ = c; + } + *p = '\0'; + obj->initName(tokBuf); + break; + + // array punctuation + case '[': + case ']': + tokBuf[0] = c; + tokBuf[1] = '\0'; + obj->initCmd(tokBuf); + break; + + // hex string or dict punctuation + case '<': + c = lookChar(); + + // dict punctuation + if (c == '<') { + getChar(); + tokBuf[0] = tokBuf[1] = '<'; + tokBuf[2] = '\0'; + obj->initCmd(tokBuf); + + // hex string + } else { + p = tokBuf; + m = n = 0; + c2 = 0; + s = NULL; + while (1) { + c = getChar(); + if (c == '>') { + break; + } else if (c == EOF) { + error(getPos(), "Unterminated hex string"); + break; + } else if (!isspace(c)) { + c2 = c2 << 4; + if (c >= '0' && c <= '9') + c2 += c - '0'; + else if (c >= 'A' && c <= 'F') + c2 += c - 'A' + 10; + else if (c >= 'a' && c <= 'f') + c2 += c - 'a' + 10; + else + error(getPos(), "Illegal character <%02x> in hex string", c); + if (++m == 2) { + if (n == tokBufSize) { + if (!s) + s = new GString(tokBuf, tokBufSize); + else + s->append(tokBuf, tokBufSize); + p = tokBuf; + n = 0; + } + *p++ = (char)c2; + ++n; + c2 = 0; + m = 0; + } + } + } + if (!s) + s = new GString(tokBuf, n); + else + s->append(tokBuf, n); + if (m == 1) + s->append((char)(c2 << 4)); + obj->initString(s); + } + break; + + // dict punctuation + case '>': + c = lookChar(); + if (c == '>') { + getChar(); + tokBuf[0] = tokBuf[1] = '>'; + tokBuf[2] = '\0'; + obj->initCmd(tokBuf); + } else { + error(getPos(), "Illegal character '>'"); + obj->initError(); + } + break; + + // error + case ')': + case '{': + case '}': + error(getPos(), "Illegal character '%c'", c); + obj->initError(); + break; + + // command + default: + p = tokBuf; + *p++ = c; + n = 1; + while ((c = lookChar()) != EOF && !(c < 128 && endOfNameChars[c])) { + getChar(); + if (++n == tokBufSize) { + error(getPos(), "Command token too long"); + break; + } + *p++ = c; + } + *p = '\0'; + if (tokBuf[0] == 't' && !strcmp(tokBuf, "true")) + obj->initBool(gTrue); + else if (tokBuf[0] == 'f' && !strcmp(tokBuf, "false")) + obj->initBool(gFalse); + else if (tokBuf[0] == 'n' && !strcmp(tokBuf, "null")) + obj->initNull(); + else + obj->initCmd(tokBuf); + break; + } + + return obj; +} + +void Lexer::skipToNextLine() { + int c; + + while (1) { + c = getChar(); + if (c == EOF || c == '\n') + return; + if (c == '\r') { + if ((c = lookChar()) == '\n') + getChar(); + return; + } + } +} diff --git a/pdf/xpdf/Lexer.h b/pdf/xpdf/Lexer.h new file mode 100644 index 00000000..70144b86 --- /dev/null +++ b/pdf/xpdf/Lexer.h @@ -0,0 +1,72 @@ +//======================================================================== +// +// Lexer.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef LEXER_H +#define LEXER_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "Object.h" +#include "Stream.h" + +#define tokBufSize 128 // size of token buffer + +//------------------------------------------------------------------------ +// Lexer +//------------------------------------------------------------------------ + +class Lexer { +public: + + // Construct a lexer for a single stream. Deletes the stream when + // lexer is deleted. + Lexer(Stream *str); + + // Construct a lexer for a stream or array of streams (assumes obj + // is either a stream or array of streams). + Lexer(Object *obj); + + // Destructor. + ~Lexer(); + + // Get the next object from the input stream. + Object *getObj(Object *obj); + + // Skip to the beginning of the next line in the input stream. + void skipToNextLine(); + + // Skip over one character. + void skipChar() { getChar(); } + + // Get stream. + Stream *getStream() + { return curStr.isNone() ? (Stream *)NULL : curStr.getStream(); } + + // Get current position in file. + int getPos() + { return curStr.isNone() ? -1 : curStr.streamGetPos(); } + + // Set position in file. + void setPos(int pos) + { if (!curStr.isNone()) curStr.streamSetPos(pos); } + +private: + + int getChar(); + int lookChar(); + + Array *streams; // array of input streams + int strPtr; // index of current stream + Object curStr; // current stream + GBool freeArray; // should lexer free the streams array? + char tokBuf[tokBufSize]; // temporary token buffer +}; + +#endif diff --git a/pdf/xpdf/Link.cc b/pdf/xpdf/Link.cc new file mode 100644 index 00000000..02b355c1 --- /dev/null +++ b/pdf/xpdf/Link.cc @@ -0,0 +1,581 @@ +//======================================================================== +// +// Link.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include "gmem.h" +#include "GString.h" +#include "Error.h" +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "Link.h" + +//------------------------------------------------------------------------ + +static GString *getFileSpecName(Object *fileSpecObj); + +//------------------------------------------------------------------------ +// LinkDest +//------------------------------------------------------------------------ + +LinkDest::LinkDest(Array *a, GBool pageIsRef1) { + Object obj1, obj2; + + // initialize fields + pageIsRef = pageIsRef1; + left = bottom = right = top = zoom = 0; + ok = gFalse; + + // get page + if (pageIsRef) { + if (!a->getNF(0, &obj1)->isRef()) { + error(-1, "Bad annotation destination"); + goto err2; + } + pageRef.num = obj1.getRefNum(); + pageRef.gen = obj1.getRefGen(); + obj1.free(); + } else { + if (!a->get(0, &obj1)->isInt()) { + error(-1, "Bad annotation destination"); + goto err2; + } + pageNum = obj1.getInt() + 1; + obj1.free(); + } + + // get destination type + a->get(1, &obj1); + + // XYZ link + if (obj1.isName("XYZ")) { + kind = destXYZ; + a->get(2, &obj2); + if (obj2.isNull()) { + changeLeft = gFalse; + } else if (obj2.isNum()) { + changeLeft = gTrue; + left = obj2.getNum(); + } else { + error(-1, "Bad annotation destination position"); + goto err1; + } + obj2.free(); + a->get(3, &obj2); + if (obj2.isNull()) { + changeTop = gFalse; + } else if (obj2.isNum()) { + changeTop = gTrue; + top = obj2.getNum(); + } else { + error(-1, "Bad annotation destination position"); + goto err1; + } + obj2.free(); + a->get(4, &obj2); + if (obj2.isNull()) { + changeZoom = gFalse; + } else if (obj2.isNum()) { + changeZoom = gTrue; + zoom = obj2.getNum(); + } else { + error(-1, "Bad annotation destination position"); + goto err1; + } + obj2.free(); + + // Fit link + } else if (obj1.isName("Fit")) { + kind = destFit; + + // FitH link + } else if (obj1.isName("FitH")) { + kind = destFitH; + if (!a->get(2, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + top = obj2.getNum(); + obj2.free(); + + // FitV link + } else if (obj1.isName("FitV")) { + kind = destFitV; + if (!a->get(2, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + left = obj2.getNum(); + obj2.free(); + + // FitR link + } else if (obj1.isName("FitR")) { + kind = destFitR; + if (!a->get(2, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + left = obj2.getNum(); + obj2.free(); + if (!a->get(3, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + bottom = obj2.getNum(); + obj2.free(); + if (!a->get(4, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + right = obj2.getNum(); + obj2.free(); + if (!a->get(5, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + top = obj2.getNum(); + obj2.free(); + + // FitB link + } else if (obj1.isName("FitB")) { + kind = destFitB; + + // FitBH link + } else if (obj1.isName("FitBH")) { + kind = destFitBH; + if (!a->get(2, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + top = obj2.getNum(); + obj2.free(); + + // FitBV link + } else if (obj1.isName("FitBV")) { + kind = destFitBV; + if (!a->get(2, &obj2)->isNum()) { + error(-1, "Bad annotation destination position"); + goto err1; + } + left = obj2.getNum(); + obj2.free(); + + // unknown link kind + } else { + error(-1, "Unknown annotation destination type"); + goto err2; + } + + obj1.free(); + ok = gTrue; + return; + + err1: + obj2.free(); + err2: + obj1.free(); +} + +LinkDest::LinkDest(LinkDest *dest) { + kind = dest->kind; + pageIsRef = dest->pageIsRef; + if (pageIsRef) + pageRef = dest->pageRef; + else + pageNum = dest->pageNum; + left = dest->left; + bottom = dest->bottom; + right = dest->right; + top = dest->top; + zoom = dest->zoom; + changeLeft = dest->changeLeft; + changeTop = dest->changeTop; + changeZoom = dest->changeZoom; + ok = gTrue; +} + +//------------------------------------------------------------------------ +// LinkGoTo +//------------------------------------------------------------------------ + +LinkGoTo::LinkGoTo(Object *destObj) { + dest = NULL; + namedDest = NULL; + + // named destination + if (destObj->isName()) { + namedDest = new GString(destObj->getName()); + } else if (destObj->isString()) { + namedDest = destObj->getString()->copy(); + + // destination dictionary + } else if (destObj->isArray()) { + dest = new LinkDest(destObj->getArray(), gTrue); + if (!dest->isOk()) { + delete dest; + dest = NULL; + } + + // error + } else { + error(-1, "Illegal annotation destination"); + } +} + +LinkGoTo::~LinkGoTo() { + if (dest) + delete dest; + if (namedDest) + delete namedDest; +} + +//------------------------------------------------------------------------ +// LinkGoToR +//------------------------------------------------------------------------ + +LinkGoToR::LinkGoToR(Object *fileSpecObj, Object *destObj) { + dest = NULL; + namedDest = NULL; + + // get file name + fileName = getFileSpecName(fileSpecObj); + + // named destination + if (destObj->isName()) { + namedDest = new GString(destObj->getName()); + } else if (destObj->isString()) { + namedDest = destObj->getString()->copy(); + + // destination dictionary + } else if (destObj->isArray()) { + dest = new LinkDest(destObj->getArray(), gFalse); + if (!dest->isOk()) { + delete dest; + dest = NULL; + } + + // error + } else { + error(-1, "Illegal annotation destination"); + } +} + +LinkGoToR::~LinkGoToR() { + if (fileName) + delete fileName; + if (dest) + delete dest; + if (namedDest) + delete namedDest; +} + + +//------------------------------------------------------------------------ +// LinkLaunch +//------------------------------------------------------------------------ + +LinkLaunch::LinkLaunch(Object *actionObj) { + Object obj1, obj2; + + fileName = NULL; + params = NULL; + + if (actionObj->isDict()) { + if (!actionObj->dictLookup("F", &obj1)->isNull()) { + fileName = getFileSpecName(&obj1); + } else { + obj1.free(); + //~ This hasn't been defined by Adobe yet, so assume it looks + //~ just like the Win dictionary until they say otherwise. + if (actionObj->dictLookup("Unix", &obj1)->isDict()) { + obj1.dictLookup("F", &obj2); + fileName = getFileSpecName(&obj2); + obj2.free(); + if (obj1.dictLookup("P", &obj2)->isString()) + params = obj2.getString()->copy(); + obj2.free(); + } else { + error(-1, "Bad launch-type link action"); + } + } + obj1.free(); + } +} + +LinkLaunch::~LinkLaunch() { + if (fileName) + delete fileName; + if (params) + delete params; +} + +//------------------------------------------------------------------------ +// LinkURI +//------------------------------------------------------------------------ + +LinkURI::LinkURI(Object *uriObj) { + uri = NULL; + if (uriObj->isString()) + uri = uriObj->getString()->copy(); + else + error(-1, "Illegal URI-type link"); +} + +LinkURI::~LinkURI() { + if (uri) + delete uri; +} + +//------------------------------------------------------------------------ +// LinkUnknown +//------------------------------------------------------------------------ + +LinkUnknown::LinkUnknown(char *action1) { + action = new GString(action1); +} + +LinkUnknown::~LinkUnknown() { + delete action; +} + +//------------------------------------------------------------------------ +// Link +//------------------------------------------------------------------------ + +Link::Link(Dict *dict) { + Object obj1, obj2, obj3, obj4; + double t; + + action = NULL; + ok = gFalse; + + // get rectangle + if (!dict->lookup("Rect", &obj1)->isArray()) { + error(-1, "Annotation rectangle is wrong type"); + goto err2; + } + if (!obj1.arrayGet(0, &obj2)->isNum()) { + error(-1, "Bad annotation rectangle"); + goto err1; + } + x1 = obj2.getNum(); + obj2.free(); + if (!obj1.arrayGet(1, &obj2)->isNum()) { + error(-1, "Bad annotation rectangle"); + goto err1; + } + y1 = obj2.getNum(); + obj2.free(); + if (!obj1.arrayGet(2, &obj2)->isNum()) { + error(-1, "Bad annotation rectangle"); + goto err1; + } + x2 = obj2.getNum(); + obj2.free(); + if (!obj1.arrayGet(3, &obj2)->isNum()) { + error(-1, "Bad annotation rectangle"); + goto err1; + } + y2 = obj2.getNum(); + obj2.free(); + obj1.free(); + if (x1 > x2) { + t = x1; + x1 = x2; + x2 = t; + } + if (y1 > y2) { + t = y1; + y1 = y2; + y2 = t; + } + + // get border + borderW = 0; + if (!dict->lookup("Border", &obj1)->isNull()) { + if (obj1.isArray() && obj1.arrayGet(2, &obj2)->isNum()) + borderW = obj2.getNum(); + else + error(-1, "Bad annotation border"); + obj2.free(); + } + obj1.free(); + + // look for destination + if (!dict->lookup("Dest", &obj1)->isNull()) { + action = new LinkGoTo(&obj1); + + // look for action + } else { + obj1.free(); + if (dict->lookup("A", &obj1)->isDict()) { + obj1.dictLookup("S", &obj2); + + // GoTo action + if (obj2.isName("GoTo")) { + obj1.dictLookup("D", &obj3); + action = new LinkGoTo(&obj3); + obj3.free(); + + // GoToR action + } else if (obj2.isName("GoToR")) { + obj1.dictLookup("F", &obj3); + obj1.dictLookup("D", &obj4); + action = new LinkGoToR(&obj3, &obj4); + obj3.free(); + obj4.free(); + + // Launch action + } else if (obj2.isName("Launch")) { + action = new LinkLaunch(&obj1); + + // URI action + } else if (obj2.isName("URI")) { + obj1.dictLookup("URI", &obj3); + action = new LinkURI(&obj3); + obj3.free(); + + // unknown action + } else if (obj2.isName()) { + action = new LinkUnknown(obj2.getName()); + + // action is missing or wrong type + } else { + error(-1, "Bad annotation action"); + action = NULL; + } + + obj2.free(); + + } else { + error(-1, "Missing annotation destination/action"); + action = NULL; + } + } + obj1.free(); + + // check for bad action + if (action && action->isOk()) + ok = gTrue; + + return; + + err1: + obj2.free(); + err2: + obj1.free(); +} + +Link::~Link() { + if (action) + delete action; +} + +//------------------------------------------------------------------------ +// Links +//------------------------------------------------------------------------ + +Links::Links(Object *annots) { + Link *link; + Object obj1, obj2; + int size; + int i; + + links = NULL; + size = 0; + numLinks = 0; + + if (annots->isArray()) { + for (i = 0; i < annots->arrayGetLength(); ++i) { + if (annots->arrayGet(i, &obj1)->isDict()) { + if (obj1.dictLookup("Subtype", &obj2)->isName("Link")) { + link = new Link(obj1.getDict()); + if (link->isOk()) { + if (numLinks >= size) { + size += 16; + links = (Link **)grealloc(links, size * sizeof(Link *)); + } + links[numLinks++] = link; + } else { + delete link; + } + } + obj2.free(); + } + obj1.free(); + } + } +} + +Links::~Links() { + int i; + + for (i = 0; i < numLinks; ++i) + delete links[i]; + gfree(links); +} + +LinkAction *Links::find(double x, double y) { + int i; + + for (i = 0; i < numLinks; ++i) { + if (links[i]->inRect(x, y)) { + if (links[i]->getAction()) + return links[i]->getAction(); + return NULL; + } + } + return NULL; +} + +GBool Links::onLink(double x, double y) { + int i; + + for (i = 0; i < numLinks; ++i) { + if (links[i]->inRect(x, y)) + return gTrue; + } + return gFalse; +} + +//------------------------------------------------------------------------ + +// Extract a file name from a file specification (string or dictionary). +static GString *getFileSpecName(Object *fileSpecObj) { + GString *name; + Object obj1; + + name = NULL; + + // string + if (fileSpecObj->isString()) { + name = fileSpecObj->getString()->copy(); + + // dictionary + } else if (fileSpecObj->isDict()) { + if (!fileSpecObj->dictLookup("Unix", &obj1)->isString()) { + obj1.free(); + fileSpecObj->dictLookup("F", &obj1); + } + if (obj1.isString()) + name = obj1.getString()->copy(); + else + error(-1, "Illegal file spec in link"); + + // error + } else { + error(-1, "Illegal file spec in link"); + } + + return name; +} diff --git a/pdf/xpdf/Link.h b/pdf/xpdf/Link.h new file mode 100644 index 00000000..62a4c85e --- /dev/null +++ b/pdf/xpdf/Link.h @@ -0,0 +1,313 @@ +//======================================================================== +// +// Link.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef LINK_H +#define LINK_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "Object.h" + +class GString; +class Array; +class Dict; + +//------------------------------------------------------------------------ +// LinkAction +//------------------------------------------------------------------------ + +enum LinkActionKind { + actionGoTo, // go to destination + actionGoToR, // go to destination in new file + actionLaunch, // launch app (or open document) + actionURI, // URI + actionUnknown // anything else +}; + +class LinkAction { +public: + + // Destructor. + virtual ~LinkAction() {} + + // Was the LinkAction created successfully? + virtual GBool isOk() = 0; + + // Check link action type. + virtual LinkActionKind getKind() = 0; +}; + +//------------------------------------------------------------------------ +// LinkDest +//------------------------------------------------------------------------ + +enum LinkDestKind { + destXYZ, + destFit, + destFitH, + destFitV, + destFitR, + destFitB, + destFitBH, + destFitBV +}; + +class LinkDest { +public: + + // Build a LinkDest from the array. If is true, the + // page is specified by an object reference; otherwise the page is + // specified by a (zero-relative) page number. + LinkDest(Array *a, GBool pageIsRef1); + + // Copy a LinkDest. + LinkDest *copy() { return new LinkDest(this); } + + // Was the LinkDest created successfully? + GBool isOk() { return ok; } + + // Accessors. + LinkDestKind getKind() { return kind; } + GBool isPageRef() { return pageIsRef; } + int getPageNum() { return pageNum; } + Ref getPageRef() { return pageRef; } + double getLeft() { return left; } + double getBottom() { return bottom; } + double getRight() { return right; } + double getTop() { return top; } + double getZoom() { return zoom; } + GBool getChangeLeft() { return changeLeft; } + GBool getChangeTop() { return changeTop; } + GBool getChangeZoom() { return changeZoom; } + +private: + + LinkDestKind kind; // destination type + GBool pageIsRef; // is the page a reference or number? + union { + Ref pageRef; // reference to page + int pageNum; // one-relative page number + }; + double left, bottom; // position + double right, top; + double zoom; // zoom factor + GBool changeLeft, changeTop; // for destXYZ links, which position + GBool changeZoom; // components to change + GBool ok; // set if created successfully + + LinkDest(LinkDest *dest); +}; + +//------------------------------------------------------------------------ +// LinkGoTo +//------------------------------------------------------------------------ + +class LinkGoTo: public LinkAction { +public: + + // Build a LinkGoTo from a destination (dictionary, name, or string). + LinkGoTo(Object *destObj); + + // Destructor. + virtual ~LinkGoTo(); + + // Was the LinkGoTo created successfully? + virtual GBool isOk() { return dest || namedDest; } + + // Accessors. + virtual LinkActionKind getKind() { return actionGoTo; } + LinkDest *getDest() { return dest; } + GString *getNamedDest() { return namedDest; } + +private: + + LinkDest *dest; // regular destination (NULL for remote + // link with bad destination) + GString *namedDest; // named destination (only one of dest and + // and namedDest may be non-NULL) +}; + +//------------------------------------------------------------------------ +// LinkGoToR +//------------------------------------------------------------------------ + +class LinkGoToR: public LinkAction { +public: + + // Build a LinkGoToR from a file spec (dictionary) and destination + // (dictionary, name, or string). + LinkGoToR(Object *fileSpecObj, Object *destObj); + + // Destructor. + virtual ~LinkGoToR(); + + // Was the LinkGoToR created successfully? + virtual GBool isOk() { return fileName && (dest || namedDest); } + + // Accessors. + virtual LinkActionKind getKind() { return actionGoToR; } + GString *getFileName() { return fileName; } + LinkDest *getDest() { return dest; } + GString *getNamedDest() { return namedDest; } + +private: + + GString *fileName; // file name + LinkDest *dest; // regular destination (NULL for remote + // link with bad destination) + GString *namedDest; // named destination (only one of dest and + // and namedDest may be non-NULL) +}; + +//------------------------------------------------------------------------ +// LinkLaunch +//------------------------------------------------------------------------ + +class LinkLaunch: public LinkAction { +public: + + // Build a LinkLaunch from an action dictionary. + LinkLaunch(Object *actionObj); + + // Destructor. + virtual ~LinkLaunch(); + + // Was the LinkLaunch created successfully? + virtual GBool isOk() { return fileName != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionLaunch; } + GString *getFileName() { return fileName; } + GString *getParams() { return params; } + +private: + + GString *fileName; // file name + GString *params; // parameters +}; + +//------------------------------------------------------------------------ +// LinkURI +//------------------------------------------------------------------------ + +class LinkURI: public LinkAction { +public: + + // Build a LinkURI given the URI (string). + LinkURI(Object *uriObj); + + // Destructor. + virtual ~LinkURI(); + + // Was the LinkURI created successfully? + virtual GBool isOk() { return uri != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionURI; } + GString *getURI() { return uri; } + +private: + + GString *uri; // the URI +}; + +//------------------------------------------------------------------------ +// LinkUnknown +//------------------------------------------------------------------------ + +class LinkUnknown: public LinkAction { +public: + + // Build a LinkUnknown with the specified action type. + LinkUnknown(char *action1); + + // Destructor. + virtual ~LinkUnknown(); + + // Was the LinkUnknown create successfully? + virtual GBool isOk() { return action != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionUnknown; } + GString *getAction() { return action; } + +private: + + GString *action; // action subtype +}; + +//------------------------------------------------------------------------ +// Link +//------------------------------------------------------------------------ + +class Link { +public: + + // Construct a link, given its dictionary. + Link(Dict *dict); + + // Destructor. + ~Link(); + + // Was the link created successfully? + GBool isOk() { return ok; } + + // Check if point is inside the link rectangle. + GBool inRect(double x, double y) + { return x1 <= x && x <= x2 && y1 <= y && y <= y2; } + + // Get action. + LinkAction *getAction() { return action; } + + // Get border corners and width. + void getBorder(double *xa1, double *ya1, double *xa2, double *ya2, + double *wa) + { *xa1 = x1; *ya1 = y1; *xa2 = x2; *ya2 = y2; *wa = borderW; } + +private: + + double x1, y1; // lower left corner + double x2, y2; // upper right corner + double borderW; // border width + LinkAction *action; // action + GBool ok; // is link valid? +}; + +//------------------------------------------------------------------------ +// Links +//------------------------------------------------------------------------ + +class Links { +public: + + // Extract links from array of annotations. + Links(Object *annots); + + // Destructor. + ~Links(); + + // Iterate through list of links. + int getNumLinks() { return numLinks; } + Link *getLink(int i) { return links[i]; } + + // If point , is in a link, return the associated action; + // else return NULL. + LinkAction *find(double x, double y); + + // Return true if , is in a link. + GBool onLink(double x, double y); + +private: + + Link **links; + int numLinks; +}; + +#endif diff --git a/pdf/xpdf/Makefile.in b/pdf/xpdf/Makefile.in new file mode 100644 index 00000000..73934ed3 --- /dev/null +++ b/pdf/xpdf/Makefile.in @@ -0,0 +1,261 @@ +#======================================================================== +# +# Xpdf Makefile +# +# Copyright 1996 Derek B. Noonburg +# +#======================================================================== + +srcdir = @srcdir@ +VPATH = @srcdir@ + +GOOSRCDIR = $(srcdir)/../goo +GOOLIBDIR = ../goo +LTKSRCDIR = $(srcdir)/../ltk +LTKLIBDIR = ../ltk + +CXXFLAGS = @CXXFLAGS@ @DEFS@ @OPTIONS@ -I$(GOOSRCDIR) -I$(LTKSRCDIR) -I$(srcdir) @X_CFLAGS@ @Xpm_CFLAGS@ + +XLIBS = @Xpm_LIBS@ @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ + +OTHERLIBS = @LIBS@ + +CXX = @CXX@ +STRIP = @STRIP@ + +LIBPREFIX = @LIBPREFIX@ +EXE = @EXE@ + +#------------------------------------------------------------------------ + +.SUFFIXES: .cc + +.cc.o: + $(CXX) $(CXXFLAGS) -c $< + +#------------------------------------------------------------------------ + +CXX_SRC = \ + $(srcdir)/Array.cc \ + $(srcdir)/Catalog.cc \ + $(srcdir)/Dict.cc \ + $(srcdir)/Error.cc \ + $(srcdir)/Gfx.cc \ + $(srcdir)/GfxFont.cc \ + $(srcdir)/GfxState.cc \ + $(srcdir)/ImageOutputDev.cc \ + $(srcdir)/Lexer.cc \ + $(srcdir)/Link.cc \ + $(srcdir)/LTKOutputDev.cc \ + $(srcdir)/Object.cc \ + $(srcdir)/OutputDev.cc \ + $(srcdir)/Page.cc \ + $(srcdir)/Params.cc \ + $(srcdir)/Parser.cc \ + $(srcdir)/PBMOutputDev.cc \ + $(srcdir)/PDFDoc.cc \ + $(srcdir)/PSOutputDev.cc \ + $(srcdir)/Stream.cc \ + $(srcdir)/TextOutputDev.cc \ + $(srcdir)/XOutputDev.cc \ + $(srcdir)/XRef.cc \ + $(srcdir)/xpdf.cc \ + $(srcdir)/pdftops.cc \ + $(srcdir)/pdftotext.cc \ + $(srcdir)/pdfinfo.cc \ + $(srcdir)/pdftopbm.cc \ + $(srcdir)/pdfimages.cc + +#------------------------------------------------------------------------ + +all: xpdf$(EXE) pdftops$(EXE) pdftotext$(EXE) pdfinfo$(EXE) \ + pdftopbm$(EXE) pdfimages$(EXE) + +#------------------------------------------------------------------------ + +XPDF_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o LTKOutputDev.o Object.o OutputDev.o \ + Page.o Params.o Parser.o PDFDoc.o PSOutputDev.o Stream.o \ + TextOutputDev.o XOutputDev.o XRef.o xpdf.o +XPDF_LIBS = -L$(LTKLIBDIR) -lLTK -L$(GOOLIBDIR) -lGoo $(XLIBS) $(OTHERLIBS) -lm + +xpdf$(EXE): $(XPDF_OBJS) + $(CXX) $(CXXFLAGS) -o xpdf$(EXE) $(XPDF_OBJS) $(XPDF_LIBS) + $(STRIP) xpdf$(EXE) + +xpdf-ltk.h: xpdf.ltk + rm -f $@ + $(LTKLIBDIR)/ltkbuild $@.new + mv $@.new $@ + +#------------------------------------------------------------------------ + +PDFTOPS_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o Params.o \ + Parser.o PDFDoc.o PSOutputDev.o Stream.o XRef.o pdftops.o +PDFTOPS_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm + +pdftops$(EXE): $(PDFTOPS_OBJS) + $(CXX) $(CXXFLAGS) -o pdftops$(EXE) $(PDFTOPS_OBJS) $(PDFTOPS_LIBS) + $(STRIP) pdftops$(EXE) + +#------------------------------------------------------------------------ + +PDFTOTEXT_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o Params.o \ + Parser.o PDFDoc.o TextOutputDev.o Stream.o XRef.o pdftotext.o +PDFTOTEXT_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm + +pdftotext$(EXE): $(PDFTOTEXT_OBJS) + $(CXX) $(CXXFLAGS) -o pdftotext$(EXE) $(PDFTOTEXT_OBJS) \ + $(PDFTOTEXT_LIBS) + $(STRIP) pdftotext$(EXE) + +#------------------------------------------------------------------------ + +PDFINFO_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o \ + Params.o Parser.o PDFDoc.o Stream.o XRef.o pdfinfo.o +PDFINFO_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm + +pdfinfo$(EXE): $(PDFINFO_OBJS) + $(CXX) $(CXXFLAGS) -o pdfinfo$(EXE) $(PDFINFO_OBJS) $(PDFINFO_LIBS) + $(STRIP) pdfinfo$(EXE) + +#------------------------------------------------------------------------ + +PDFTOPBM_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o PBMOutputDev.o \ + Page.o Params.o Parser.o PDFDoc.o Stream.o TextOutputDev.o \ + XOutputDev.o XRef.o pdftopbm.o +PDFTOPBM_LIBS = -L$(GOOLIBDIR) -lGoo $(XLIBS) $(OTHERLIBS) -lm + +pdftopbm$(EXE): $(PDFTOPBM_OBJS) + $(CXX) $(CXXFLAGS) -o pdftopbm$(EXE) $(PDFTOPBM_OBJS) $(PDFTOPBM_LIBS) + $(STRIP) pdftopbm$(EXE) + +#------------------------------------------------------------------------ + +PDFIMAGES_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o ImageOutputDev.o Lexer.o Link.o Object.o OutputDev.o \ + Page.o Params.o Parser.o PDFDoc.o Stream.o XRef.o pdfimages.o +PDFIMAGES_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm + +pdfimages$(EXE): $(PDFIMAGES_OBJS) + $(CXX) $(CXXFLAGS) -o pdfimages$(EXE) $(PDFIMAGES_OBJS) \ + $(PDFIMAGES_LIBS) + $(STRIP) pdfimages$(EXE) + +#------------------------------------------------------------------------ + +clean: + rm -f $(XPDF_OBJS) xpdf-ltk.h.new xpdf$(EXE) + rm -f $(PDFTOPS_OBJS) pdftops$(EXE) + rm -f $(PDFTOTEXT_OBJS) pdftotext$(EXE) + rm -f $(PDFINFO_OBJS) pdfinfo$(EXE) + rm -f $(PDFTOPBM_OBJS) pdftopbm$(EXE) + rm -f $(PDFIMAGES_OBJS) pdfimages$(EXE) + +#------------------------------------------------------------------------ + +distdepend: + cp Makefile.in Makefile.in.bak + sed '/^#----- dependences -----/q' Makefile.in.bak >Makefile.in + $(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >>Makefile.in + +#----- dependences ----- +Array.o: ./Array.cc ../goo/gmem.h Object.h ../goo/gtypes.h \ + ../goo/GString.h Array.h Dict.h Stream.h +Catalog.o: ./Catalog.cc ../goo/gmem.h Object.h ../goo/gtypes.h \ + ../goo/GString.h Array.h Dict.h Stream.h Page.h Error.h config.h \ + Link.h Catalog.h +Dict.o: ./Dict.cc ../goo/gmem.h Object.h ../goo/gtypes.h \ + ../goo/GString.h Array.h Dict.h Stream.h XRef.h +Error.o: ./Error.cc ../goo/gtypes.h Params.h Error.h config.h +Gfx.o: ./Gfx.cc ../goo/gmem.h Object.h ../goo/gtypes.h \ + ../goo/GString.h Array.h Dict.h Stream.h Lexer.h Parser.h GfxFont.h \ + GfxState.h OutputDev.h Params.h Error.h config.h Gfx.h +GfxFont.o: ./GfxFont.cc ../goo/GString.h ../goo/gmem.h ../goo/gfile.h \ + ../goo/gtypes.h config.h Object.h Array.h Dict.h Stream.h Error.h \ + Params.h GfxFont.h FontInfo.h +GfxState.o: ./GfxState.cc ../goo/gmem.h Error.h config.h Object.h \ + ../goo/gtypes.h ../goo/GString.h Array.h Dict.h Stream.h GfxState.h +ImageOutputDev.o: ./ImageOutputDev.cc ../goo/gmem.h config.h Error.h \ + GfxState.h ../goo/gtypes.h Object.h ../goo/GString.h Array.h Dict.h \ + Stream.h ImageOutputDev.h OutputDev.h +Lexer.o: ./Lexer.cc Lexer.h Object.h ../goo/gtypes.h ../goo/gmem.h \ + ../goo/GString.h Array.h Dict.h Stream.h Error.h config.h +Link.o: ./Link.cc ../goo/gmem.h ../goo/GString.h Error.h config.h \ + Object.h ../goo/gtypes.h Array.h Dict.h Stream.h Link.h +LTKOutputDev.o: ./LTKOutputDev.cc ../goo/gmem.h ../goo/GString.h \ + ../ltk/LTKWindow.h ../goo/gtypes.h ../ltk/LTKScrollingCanvas.h \ + ../ltk/LTKWidget.h Object.h Array.h Dict.h Stream.h GfxState.h \ + GfxFont.h Error.h config.h Params.h LTKOutputDev.h XOutputDev.h \ + OutputDev.h +Object.o: ./Object.cc Object.h ../goo/gtypes.h ../goo/gmem.h \ + ../goo/GString.h Array.h Dict.h Stream.h Error.h config.h XRef.h +OutputDev.o: ./OutputDev.cc Object.h ../goo/gtypes.h ../goo/gmem.h \ + ../goo/GString.h Array.h Dict.h Stream.h GfxState.h OutputDev.h +Page.o: ./Page.cc Object.h ../goo/gtypes.h ../goo/gmem.h \ + ../goo/GString.h Array.h Dict.h Stream.h XRef.h OutputDev.h Gfx.h \ + Error.h config.h Params.h Page.h +Params.o: ./Params.cc ../goo/gtypes.h ../goo/gmem.h ../goo/GString.h \ + ../goo/gfile.h Params.h +Parser.o: ./Parser.cc Object.h ../goo/gtypes.h ../goo/gmem.h \ + ../goo/GString.h Array.h Dict.h Stream.h Parser.h Lexer.h Error.h \ + config.h +PBMOutputDev.o: ./PBMOutputDev.cc ../goo/gmem.h ../goo/GString.h \ + Object.h ../goo/gtypes.h Array.h Dict.h Stream.h GfxState.h GfxFont.h \ + Error.h config.h Params.h PBMOutputDev.h XOutputDev.h OutputDev.h +PDFDoc.o: ./PDFDoc.cc ../goo/GString.h config.h Page.h Object.h \ + ../goo/gtypes.h ../goo/gmem.h Array.h Dict.h Stream.h Catalog.h \ + XRef.h Link.h OutputDev.h Params.h Error.h PDFDoc.h +PSOutputDev.o: ./PSOutputDev.cc ../goo/GString.h config.h Object.h \ + ../goo/gtypes.h ../goo/gmem.h Array.h Dict.h Stream.h Error.h \ + GfxState.h GfxFont.h Catalog.h Page.h PSOutputDev.h OutputDev.h +Stream.o: ./Stream.cc ../goo/gmem.h config.h Error.h Object.h \ + ../goo/gtypes.h ../goo/GString.h Array.h Dict.h Stream.h \ + Stream-CCITT.h +TextOutputDev.o: ./TextOutputDev.cc ../goo/GString.h ../goo/gmem.h \ + config.h Error.h GfxState.h ../goo/gtypes.h GfxFont.h Object.h \ + Array.h Dict.h Stream.h TextOutputDev.h OutputDev.h \ + TextOutputFontInfo.h +XOutputDev.o: ./XOutputDev.cc ../goo/gmem.h ../goo/GString.h Object.h \ + ../goo/gtypes.h Array.h Dict.h Stream.h GfxState.h GfxFont.h Error.h \ + config.h Params.h TextOutputDev.h OutputDev.h XOutputDev.h \ + XOutputFontInfo.h +XRef.o: ./XRef.cc ../goo/gmem.h Object.h ../goo/gtypes.h \ + ../goo/GString.h Array.h Dict.h Stream.h Lexer.h Parser.h Error.h \ + config.h XRef.h +xpdf.o: ./xpdf.cc ../goo/gtypes.h ../goo/GString.h ../goo/parseargs.h \ + ../goo/gfile.h ../goo/gmem.h ../ltk/LTKAll.h ../ltk/LTKApp.h \ + ../ltk/LTKWindow.h ../ltk/LTKMenu.h ../ltk/LTKWidget.h \ + ../ltk/LTKCompoundWidget.h ../ltk/LTKBox.h ../ltk/LTKBorder.h \ + ../ltk/LTKButtonDialog.h ../ltk/LTKButton.h ../ltk/LTKCanvas.h \ + ../ltk/LTKDblBufCanvas.h ../ltk/LTKEmpty.h ../ltk/LTKFileReq.h \ + ../ltk/LTKLabel.h ../ltk/LTKList.h ../ltk/LTKScrollbar.h \ + ../ltk/LTKScrollingCanvas.h ../ltk/LTKTextIn.h ../ltk/LTKResources.h \ + Object.h Array.h Dict.h Stream.h XRef.h Catalog.h Page.h Link.h \ + PDFDoc.h XOutputDev.h config.h OutputDev.h LTKOutputDev.h \ + PSOutputDev.h TextOutputDev.h Params.h Error.h xpdfIcon.xpm \ + leftArrow.xbm dblLeftArrow.xbm rightArrow.xbm dblRightArrow.xbm \ + zoomIn.xbm zoomOut.xbm find.xbm postscript.xbm about.xbm xpdf-ltk.h +pdftops.o: ./pdftops.cc ../goo/parseargs.h ../goo/gtypes.h \ + ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \ + XRef.h Catalog.h Page.h PDFDoc.h Link.h PSOutputDev.h config.h \ + OutputDev.h Params.h Error.h +pdftotext.o: ./pdftotext.cc ../goo/parseargs.h ../goo/gtypes.h \ + ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \ + XRef.h Catalog.h Page.h PDFDoc.h Link.h TextOutputDev.h OutputDev.h \ + Params.h Error.h config.h +pdfinfo.o: ./pdfinfo.cc ../goo/parseargs.h ../goo/gtypes.h \ + ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \ + XRef.h Catalog.h Page.h PDFDoc.h Link.h Params.h Error.h config.h +pdftopbm.o: ./pdftopbm.cc ../goo/parseargs.h ../goo/gtypes.h \ + ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \ + XRef.h Catalog.h Page.h PDFDoc.h Link.h PBMOutputDev.h config.h \ + XOutputDev.h OutputDev.h Params.h Error.h +pdfimages.o: ./pdfimages.cc ../goo/parseargs.h ../goo/gtypes.h \ + ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \ + XRef.h Catalog.h Page.h PDFDoc.h Link.h ImageOutputDev.h OutputDev.h \ + Params.h Error.h config.h diff --git a/pdf/xpdf/Object.cc b/pdf/xpdf/Object.cc new file mode 100644 index 00000000..777f5262 --- /dev/null +++ b/pdf/xpdf/Object.cc @@ -0,0 +1,217 @@ +//======================================================================== +// +// Object.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "Error.h" +#include "Stream.h" +#include "XRef.h" + +//------------------------------------------------------------------------ +// Object +//------------------------------------------------------------------------ + +char *objTypeNames[numObjTypes] = { + "boolean", + "integer", + "real", + "string", + "name", + "null", + "array", + "dictionary", + "stream", + "ref", + "cmd", + "error", + "eof", + "none" +}; + +#ifdef DEBUG_MEM +int Object::numAlloc[numObjTypes] = + {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +#endif + +Object *Object::initArray() { + initObj(objArray); + array = new Array(); + return this; +} + +Object *Object::initDict() { + initObj(objDict); + dict = new Dict(); + return this; +} + +Object *Object::initStream(Stream *stream1) { + initObj(objStream); + stream = stream1; + return this; +} + +Object *Object::copy(Object *obj) { + *obj = *this; + switch (type) { + case objString: + obj->string = string->copy(); + break; + case objName: + obj->name = copyString(name); + break; + case objArray: + array->incRef(); + break; + case objDict: + dict->incRef(); + break; + case objStream: + stream->incRef(); + break; + case objCmd: + obj->cmd = copyString(cmd); + break; + default: + break; + } +#ifdef DEBUG_MEM + ++numAlloc[type]; +#endif + return obj; +} + +Object *Object::fetch(Object *obj) { + return (type == objRef && xref) ? + xref->fetch(ref.num, ref.gen, obj) : copy(obj); +} + +void Object::free() { + switch (type) { + case objString: + delete string; + break; + case objName: + gfree(name); + break; + case objArray: + if (!array->decRef()) + delete array; + break; + case objDict: + if (!dict->decRef()) + delete dict; + break; + case objStream: + if (!stream->decRef()) + delete stream; + break; + case objCmd: + gfree(cmd); + break; + default: + break; + } +#ifdef DEBUG_MEM + --numAlloc[type]; +#endif + type = objNone; +} + +char *Object::getTypeName() { + return objTypeNames[type]; +} + +void Object::print(FILE *f) { + Object obj; + int i; + + switch (type) { + case objBool: + fprintf(f, "%s", booln ? "true" : "false"); + break; + case objInt: + fprintf(f, "%d", intg); + break; + case objReal: + fprintf(f, "%g", real); + break; + case objString: + fprintf(f, "(%s)", string->getCString()); + break; + case objName: + fprintf(f, "/%s", name); + break; + case objNull: + fprintf(f, "null"); + break; + case objArray: + fprintf(f, "["); + for (i = 0; i < arrayGetLength(); ++i) { + if (i > 0) + fprintf(f, " "); + arrayGetNF(i, &obj); + obj.print(f); + obj.free(); + } + fprintf(f, "]"); + break; + case objDict: + fprintf(f, "<<"); + for (i = 0; i < dictGetLength(); ++i) { + fprintf(f, " /%s ", dictGetKey(i)); + dictGetValNF(i, &obj); + obj.print(f); + obj.free(); + } + fprintf(f, " >>"); + break; + case objStream: + fprintf(f, ""); + break; + case objRef: + fprintf(f, "%d %d R", ref.num, ref.gen); + break; + case objCmd: + fprintf(f, "%s", cmd); + break; + case objError: + fprintf(f, ""); + break; + case objEOF: + fprintf(f, ""); + break; + case objNone: + fprintf(f, ""); + break; + } +} + +void Object::memCheck(FILE *f) { +#ifdef DEBUG_MEM + int i; + int t; + + t = 0; + for (i = 0; i < numObjTypes; ++i) + t += numAlloc[i]; + if (t > 0) { + fprintf(f, "Allocated objects:\n"); + for (i = 0; i < numObjTypes; ++i) { + if (numAlloc[i] > 0) + fprintf(f, " %-20s: %6d\n", objTypeNames[i], numAlloc[i]); + } + } +#endif +} diff --git a/pdf/xpdf/Object.h b/pdf/xpdf/Object.h new file mode 100644 index 00000000..395096fb --- /dev/null +++ b/pdf/xpdf/Object.h @@ -0,0 +1,299 @@ +//======================================================================== +// +// Object.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef OBJECT_H +#define OBJECT_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include +#include "gtypes.h" +#include "gmem.h" +#include "GString.h" + +class Array; +class Dict; +class Stream; + +//------------------------------------------------------------------------ +// Ref +//------------------------------------------------------------------------ + +struct Ref { + int num; // object number + int gen; // generation number +}; + +//------------------------------------------------------------------------ +// object types +//------------------------------------------------------------------------ + +enum ObjType { + // simple objects + objBool, // boolean + objInt, // integer + objReal, // real + objString, // string + objName, // name + objNull, // null + + // complex objects + objArray, // array + objDict, // dictionary + objStream, // stream + objRef, // indirect reference + + // special objects + objCmd, // command name + objError, // error return from Lexer + objEOF, // end of file return from Lexer + objNone // uninitialized object +}; + +#define numObjTypes 14 // total number of object types + +//------------------------------------------------------------------------ +// Object +//------------------------------------------------------------------------ + +#ifdef DEBUG_MEM +#define initObj(t) ++numAlloc[type = t] +#else +#define initObj(t) type = t +#endif + +class Object { +public: + + // Default constructor. + Object(): + type(objNone) {} + + // Initialize an object. + Object *initBool(GBool booln1) + { initObj(objBool); booln = booln1; return this; } + Object *initInt(int intg1) + { initObj(objInt); intg = intg1; return this; } + Object *initReal(double real1) + { initObj(objReal); real = real1; return this; } + Object *initString(GString *string1) + { initObj(objString); string = string1; return this; } + Object *initName(char *name1) + { initObj(objName); name = copyString(name1); return this; } + Object *initNull() + { initObj(objNull); return this; } + Object *initArray(); + Object *initDict(); + Object *initDict(Dict *dict1) + { initObj(objDict); dict = dict1; return this; } + Object *initStream(Stream *stream1); + Object *initRef(int num1, int gen1) + { initObj(objRef); ref.num = num1; ref.gen = gen1; return this; } + Object *initCmd(char *cmd1) + { initObj(objCmd); cmd = copyString(cmd1); return this; } + Object *initError() + { initObj(objError); return this; } + Object *initEOF() + { initObj(objEOF); return this; } + + // Copy an object. + Object *copy(Object *obj); + + // If object is a Ref, fetch and return the referenced object. + // Otherwise, return a copy of the object. + Object *fetch(Object *obj); + + // Free object contents. + void free(); + + // Type checking. + GBool isBool() { return type == objBool; } + GBool isInt() { return type == objInt; } + GBool isReal() { return type == objReal; } + GBool isNum() { return type == objInt || type == objReal; } + GBool isString() { return type == objString; } + GBool isName() { return type == objName; } + GBool isNull() { return type == objNull; } + GBool isArray() { return type == objArray; } + GBool isDict() { return type == objDict; } + GBool isStream() { return type == objStream; } + GBool isRef() { return type == objRef; } + GBool isCmd() { return type == objCmd; } + GBool isError() { return type == objError; } + GBool isEOF() { return type == objEOF; } + GBool isNone() { return type == objNone; } + + // Special type checking. + GBool isName(char *name1) + { return type == objName && !strcmp(name, name1); } + GBool isDict(char *dictType); + GBool isStream(char *dictType); + GBool isCmd(char *cmd1) + { return type == objCmd && !strcmp(cmd, cmd1); } + + // Accessors. NB: these assume object is of correct type. + GBool getBool() { return booln; } + int getInt() { return intg; } + double getReal() { return real; } + double getNum() { return type == objInt ? (double)intg : real; } + GString *getString() { return string; } + char *getName() { return name; } + Array *getArray() { return array; } + Dict *getDict() { return dict; } + Stream *getStream() { return stream; } + Ref getRef() { return ref; } + int getRefNum() { return ref.num; } + int getRefGen() { return ref.gen; } + + // Array accessors. + int arrayGetLength(); + void arrayAdd(Object *elem); + Object *arrayGet(int i, Object *obj); + Object *arrayGetNF(int i, Object *obj); + + // Dict accessors. + int dictGetLength(); + void dictAdd(char *key, Object *val); + GBool dictIs(char *dictType); + Object *dictLookup(char *key, Object *obj); + Object *dictLookupNF(char *key, Object *obj); + char *dictGetKey(int i); + Object *dictGetVal(int i, Object *obj); + Object *dictGetValNF(int i, Object *obj); + + // Stream accessors. + GBool streamIs(char *dictType); + void streamReset(); + int streamGetChar(); + int streamLookChar(); + char *streamGetLine(char *buf, int size); + int streamGetPos(); + void streamSetPos(int pos); + FILE *streamGetFile(); + Dict *streamGetDict(); + + // Output. + char *getTypeName(); + void print(FILE *f = stdout); + + // Memory testing. + static void memCheck(FILE *f); + +private: + + ObjType type; // object type + union { // value for each type: + GBool booln; // boolean + int intg; // integer + double real; // real + GString *string; // string + char *name; // name + Array *array; // array + Dict *dict; // dictionary + Stream *stream; // stream + Ref ref; // indirect reference + char *cmd; // command + }; + +#ifdef DEBUG_MEM + static int // number of each type of object + numAlloc[numObjTypes]; // currently allocated +#endif +}; + +//------------------------------------------------------------------------ +// Array accessors. +//------------------------------------------------------------------------ + +#include "Array.h" + +inline int Object::arrayGetLength() + { return array->getLength(); } + +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::arrayGetNF(int i, Object *obj) + { return array->getNF(i, obj); } + +//------------------------------------------------------------------------ +// Dict accessors. +//------------------------------------------------------------------------ + +#include "Dict.h" + +inline int Object::dictGetLength() + { return dict->getLength(); } + +inline void Object::dictAdd(char *key, Object *val) + { dict->add(key, val); } + +inline GBool Object::dictIs(char *dictType) + { return dict->is(dictType); } + +inline GBool Object::isDict(char *dictType) + { return type == objDict && dictIs(dictType); } + +inline Object *Object::dictLookup(char *key, Object *obj) + { return dict->lookup(key, obj); } + +inline Object *Object::dictLookupNF(char *key, Object *obj) + { return dict->lookupNF(key, obj); } + +inline char *Object::dictGetKey(int i) + { return dict->getKey(i); } + +inline Object *Object::dictGetVal(int i, Object *obj) + { return dict->getVal(i, obj); } + +inline Object *Object::dictGetValNF(int i, Object *obj) + { return dict->getValNF(i, obj); } + +//------------------------------------------------------------------------ +// Stream accessors. +//------------------------------------------------------------------------ + +#include "Stream.h" + +inline GBool Object::streamIs(char *dictType) + { return stream->getDict()->is(dictType); } + +inline GBool Object::isStream(char *dictType) + { return type == objStream && streamIs(dictType); } + +inline void Object::streamReset() + { stream->reset(); } + +inline int Object::streamGetChar() + { return stream->getChar(); } + +inline int Object::streamLookChar() + { return stream->lookChar(); } + +inline char *Object::streamGetLine(char *buf, int size) + { return stream->getLine(buf, size); } + +inline int Object::streamGetPos() + { return stream->getPos(); } + +inline void Object::streamSetPos(int pos) + { stream->setPos(pos); } + +inline FILE *Object::streamGetFile() + { return stream->getFile(); } + +inline Dict *Object::streamGetDict() + { return stream->getDict(); } + +#endif diff --git a/pdf/xpdf/OutputDev.cc b/pdf/xpdf/OutputDev.cc new file mode 100644 index 00000000..95c5628e --- /dev/null +++ b/pdf/xpdf/OutputDev.cc @@ -0,0 +1,85 @@ +//======================================================================== +// +// OutputDev.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include "Object.h" +#include "Stream.h" +#include "GfxState.h" +#include "OutputDev.h" + +//------------------------------------------------------------------------ +// OutputDev +//------------------------------------------------------------------------ + +void OutputDev::setDefaultCTM(double *ctm1) { + int i; + double det; + + for (i = 0; i < 6; ++i) + ctm[i] = ctm1[i]; + det = 1 / (ctm[0] * ctm[3] - ctm[1] * ctm[2]); + ictm[0] = ctm[3] * det; + ictm[1] = -ctm[1] * det; + ictm[2] = -ctm[2] * det; + ictm[3] = ctm[0] * det; + ictm[4] = (ctm[2] * ctm[5] - ctm[3] * ctm[4]) * det; + ictm[5] = (ctm[1] * ctm[4] - ctm[0] * ctm[5]) * det; +} + +void OutputDev::cvtDevToUser(int dx, int dy, double *ux, double *uy) { + *ux = ictm[0] * dx + ictm[2] * dy + ictm[4]; + *uy = ictm[1] * dx + ictm[3] * dy + ictm[5]; +} + +void OutputDev::cvtUserToDev(double ux, double uy, int *dx, int *dy) { + *dx = (int)(ctm[0] * ux + ctm[2] * uy + ctm[4] + 0.5); + *dy = (int)(ctm[1] * ux + ctm[3] * uy + ctm[5] + 0.5); +} + +void OutputDev::updateAll(GfxState *state) { + updateLineDash(state); + updateFlatness(state); + updateLineJoin(state); + updateLineCap(state); + updateMiterLimit(state); + updateLineWidth(state); + updateFillColor(state); + updateStrokeColor(state); + updateFont(state); +} + +void OutputDev::drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg) { + int i, j; + + if (inlineImg) { + str->reset(); + j = height * ((width + 7) / 8); + for (i = 0; i < j; ++i) + str->getChar(); + } +} + +void OutputDev::drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg) { + int i, j; + + if (inlineImg) { + str->reset(); + j = height * ((width * colorMap->getNumPixelComps() * + colorMap->getBits() + 7) / 8); + for (i = 0; i < j; ++i) + str->getChar(); + } +} diff --git a/pdf/xpdf/OutputDev.h b/pdf/xpdf/OutputDev.h new file mode 100644 index 00000000..98afaff6 --- /dev/null +++ b/pdf/xpdf/OutputDev.h @@ -0,0 +1,131 @@ +//======================================================================== +// +// OutputDev.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef OUTPUTDEV_H +#define OUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "gtypes.h" + +class GString; +class GfxState; +class GfxColorSpace; +class GfxImageColorMap; +class Stream; + +//------------------------------------------------------------------------ +// OutputDev +//------------------------------------------------------------------------ + +class OutputDev { +public: + + // Constructor. + OutputDev() {} + + // Destructor. + virtual ~OutputDev() {} + + //----- get info about output device + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) + virtual GBool upsideDown() = 0; + + // Does this device use drawChar() or drawString()? + virtual GBool useDrawChar() = 0; + + //----- initialization and control + + // Set default transform matrix. + virtual void setDefaultCTM(double *ctm1); + + // Start a page. + virtual void startPage(int pageNum, GfxState *state) {} + + // End a page. + virtual void endPage() {} + + // Dump page contents to display. + virtual void dump() {} + + //----- coordinate conversion + + // Convert between device and user coordinates. + virtual void cvtDevToUser(int dx, int dy, double *ux, double *uy); + virtual void cvtUserToDev(double ux, double uy, int *dx, int *dy); + + //----- link borders + virtual void drawLinkBorder(double x1, double y1, double x2, double y2, + double w) {} + + //----- save/restore graphics state + virtual void saveState(GfxState *state) {} + virtual void restoreState(GfxState *state) {} + + //----- update graphics state + virtual void updateAll(GfxState *state); + virtual void updateCTM(GfxState *state, double m11, double m12, + double m21, double m22, double m31, double m32) {} + virtual void updateLineDash(GfxState *state) {} + virtual void updateFlatness(GfxState *state) {} + virtual void updateLineJoin(GfxState *state) {} + virtual void updateLineCap(GfxState *state) {} + virtual void updateMiterLimit(GfxState *state) {} + virtual void updateLineWidth(GfxState *state) {} + virtual void updateFillColor(GfxState *state) {} + virtual void updateStrokeColor(GfxState *state) {} + + //----- update text state + virtual void updateFont(GfxState *state) {} + virtual void updateTextMat(GfxState *state) {} + virtual void updateCharSpace(GfxState *state) {} + virtual void updateRender(GfxState *state) {} + virtual void updateRise(GfxState *state) {} + virtual void updateWordSpace(GfxState *state) {} + virtual void updateHorizScaling(GfxState *state) {} + virtual void updateTextPos(GfxState *state) {} + virtual void updateTextShift(GfxState *state, double shift) {} + + //----- path painting + virtual void stroke(GfxState *state) {} + virtual void fill(GfxState *state) {} + virtual void eoFill(GfxState *state) {} + + //----- path clipping + virtual void clip(GfxState *state) {} + virtual void eoClip(GfxState *state) {} + + //----- text drawing + virtual void beginString(GfxState *state, GString *s) {} + virtual void endString(GfxState *state) {} + virtual void drawChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c) {} + virtual void drawChar16(GfxState *state, double x, double y, + double dx, double dy, int c) {} + virtual void drawString(GfxState *state, GString *s) {} + virtual void drawString16(GfxState *state, GString *s) {} + + //----- image drawing + virtual void drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg); + virtual void drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg); + +private: + + double ctm[6]; // coordinate transform matrix + double ictm[6]; // inverse CTM +}; + +#endif diff --git a/pdf/xpdf/PBMOutputDev.cc b/pdf/xpdf/PBMOutputDev.cc new file mode 100644 index 00000000..e21c0efe --- /dev/null +++ b/pdf/xpdf/PBMOutputDev.cc @@ -0,0 +1,141 @@ +//======================================================================== +// +// PBMOutputDev.cc +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "gmem.h" +#include "GString.h" +#include "Object.h" +#include "Stream.h" +#include "GfxState.h" +#include "GfxFont.h" +#include "Error.h" +#include "Params.h" +#include "PBMOutputDev.h" + +//------------------------------------------------------------------------ + +PBMOutputDev *PBMOutputDev::makePBMOutputDev(char *displayName, + char *fileRoot1) { + Display *display; + Pixmap pixmap; + Window dummyWin; + int screen; + int invert; + unsigned long black, white; + + if (!(display = XOpenDisplay(displayName))) { + fprintf(stderr, "Couldn't open display '%s'\n", displayName); + exit(1); + } + screen = DefaultScreen(display); + + black = BlackPixel(display, screen); + white = WhitePixel(display, screen); + if ((black & 1) == (white & 1)) { + fprintf(stderr, "Weird black/white pixel colors\n"); + XCloseDisplay(display); + return NULL; + } + invert = (white & 1) == 1 ? 0xff : 0x00; + + dummyWin = XCreateSimpleWindow(display, RootWindow(display, screen), + 0, 0, 1, 1, 0, + black, white); + pixmap = XCreatePixmap(display, dummyWin, 1, 1, 1); + return new PBMOutputDev(display, screen, pixmap, dummyWin, + invert, fileRoot1); +} + +PBMOutputDev::PBMOutputDev(Display *display1, int screen1, + Pixmap pixmap1, Window dummyWin1, + int invert1, char *fileRoot1): + XOutputDev(display1, pixmap1, 1, + DefaultColormap(display1, screen1), + WhitePixel(display1, DefaultScreen(display1))) +{ + display = display1; + screen = screen1; + pixmap = pixmap1; + dummyWin = dummyWin1; + invert = invert1; + fileRoot = fileRoot1; + fileName = (char *)gmalloc(strlen(fileRoot) + 20); +} + +PBMOutputDev::~PBMOutputDev() { + XFreePixmap(display, pixmap); + XDestroyWindow(display, dummyWin); + XCloseDisplay(display); + gfree(fileName); +} + +void PBMOutputDev::startPage(int pageNum, GfxState *state) { + + curPage = pageNum; + width = (int)(state->getPageWidth() + 0.5); + height = (int)(state->getPageHeight() + 0.5); + XFreePixmap(display, pixmap); + pixmap = XCreatePixmap(display, dummyWin, width, height, 1); + setPixmap(pixmap, width, height); + XOutputDev::startPage(pageNum, state); +} + +void PBMOutputDev::endPage() { + XImage *image; + FILE *f; + int p; + int x, y, i; + + image = XCreateImage(display, DefaultVisual(display, screen), + 1, ZPixmap, 0, NULL, width, height, 8, 0); + image->data = (char *)gmalloc(height * image->bytes_per_line); + XGetSubImage(display, pixmap, 0, 0, width, height, 1, ZPixmap, + image, 0, 0); + + sprintf(fileName, "%s-%06d.pbm", fileRoot, curPage); + if (!(f = fopen(fileName, "wb"))) { + fprintf(stderr, "Couldn't open output file '%s'\n", fileName); + goto err; + } + fprintf(f, "P4\n"); + fprintf(f, "%d %d\n", width, height); + + for (y = 0; y < height; ++y) { + for (x = 0; x+8 <= width; x += 8) { + p = 0; + for (i = 0; i < 8; ++i) + p = (p << 1) + (XGetPixel(image, x+i, y) & 1); + p ^= invert; + fputc((char)p, f); + } + if (width & 7) { + p = 0; + for (i = 0; i < (width & 7); ++i) + p = (p << 1) + (XGetPixel(image, x+i, y) & 1); + p <<= 8 - (width & 7); + p ^= invert; + fputc((char)p, f); + } + } + + fclose(f); + + err: + gfree(image->data); + image->data = NULL; + XDestroyImage(image); + + XOutputDev::endPage(); +} diff --git a/pdf/xpdf/PBMOutputDev.h b/pdf/xpdf/PBMOutputDev.h new file mode 100644 index 00000000..3d235b30 --- /dev/null +++ b/pdf/xpdf/PBMOutputDev.h @@ -0,0 +1,56 @@ +//======================================================================== +// +// PBMOutputDev.h +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#ifndef PBMOUTPUTDEV_H +#define PBMOUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "config.h" +#include "XOutputDev.h" + +//------------------------------------------------------------------------ + +class PBMOutputDev: public XOutputDev { +public: + + static PBMOutputDev *makePBMOutputDev(char *displayName, + char *fileRoot1); + + ~PBMOutputDev(); + + //----- initialization and control + + // Start a page. + virtual void startPage(int pageNum, GfxState *state); + + // End a page. + virtual void endPage(); + +private: + + PBMOutputDev(Display *display1, int screen1, + Pixmap pixmap1, Window dummyWin1, + int invert1, char *fileRoot1); + + char *fileRoot; + char *fileName; + int curPage; + + Display *display; + int screen; + Pixmap pixmap; + Window dummyWin; + int width, height; + int invert; +}; + +#endif diff --git a/pdf/xpdf/PDFDoc.cc b/pdf/xpdf/PDFDoc.cc new file mode 100644 index 00000000..886b6a0b --- /dev/null +++ b/pdf/xpdf/PDFDoc.cc @@ -0,0 +1,168 @@ +//======================================================================== +// +// PDFDoc.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "GString.h" +#include "config.h" +#include "Page.h" +#include "Catalog.h" +#include "XRef.h" +#include "Link.h" +#include "OutputDev.h" +#include "Params.h" +#include "Error.h" +#include "PDFDoc.h" + +//------------------------------------------------------------------------ +// PDFDoc +//------------------------------------------------------------------------ + +PDFDoc::PDFDoc(GString *fileName1) { + FileStream *str; + Object catObj; + Object obj; + GString *fileName2; + + // setup + ok = gFalse; + catalog = NULL; + xref = NULL; + file = NULL; + links = NULL; + + // try to open file + fileName = fileName1; + fileName2 = NULL; +#ifdef VMS + if (!(file = fopen(fileName->getCString(), "rb", "ctx=stm"))) { + error(-1, "Couldn't open file '%s'", fileName->getCString()); + return; + } +#else + if (!(file = fopen(fileName->getCString(), "rb"))) { + fileName2 = fileName->copy(); + fileName2->lowerCase(); + if (!(file = fopen(fileName2->getCString(), "rb"))) { + fileName2->upperCase(); + if (!(file = fopen(fileName2->getCString(), "rb"))) { + error(-1, "Couldn't open file '%s'", fileName->getCString()); + delete fileName2; + return; + } + } + delete fileName2; + } +#endif + + // create stream + obj.initNull(); + str = new FileStream(file, 0, -1, &obj); + + // check header + str->checkHeader(); + + // read xref table + xref = new XRef(str); + delete str; + if (!xref->isOk()) { + error(-1, "Couldn't read xref table"); + return; + } + + // read catalog + catalog = new Catalog(xref->getCatalog(&catObj)); + catObj.free(); + if (!catalog->isOk()) { + error(-1, "Couldn't read page catalog"); + return; + } + + // done + ok = gTrue; + return; +} + +PDFDoc::~PDFDoc() { + if (catalog) + delete catalog; + if (xref) + delete xref; + if (file) + fclose(file); + if (fileName) + delete fileName; + if (links) + delete links; +} + +void PDFDoc::displayPage(OutputDev *out, int page, int zoom, int rotate, + GBool doLinks) { + Link *link; + double x1, y1, x2, y2; + double w; + int i; + + if (printCommands) + printf("***** page %d *****\n", page); + catalog->getPage(page)->display(out, zoom, rotate); + if (doLinks) { + if (links) + delete links; + getLinks(page); + for (i = 0; i < links->getNumLinks(); ++i) { + link = links->getLink(i); + link->getBorder(&x1, &y1, &x2, &y2, &w); + if (w > 0) + out->drawLinkBorder(x1, y1, x2, y2, w); + } + out->dump(); + } +} + +void PDFDoc::displayPages(OutputDev *out, int firstPage, int lastPage, + int zoom, int rotate) { + Page *p; + int page; + + for (page = firstPage; page <= lastPage; ++page) { + if (printCommands) + printf("***** page %d *****\n", page); + p = catalog->getPage(page); + p->display(out, zoom, rotate); + } +} + +GBool PDFDoc::saveAs(GString *name) { + FILE *f; + char buf[4096]; + int n; + + if (!(f = fopen(name->getCString(), "wb"))) { + error(-1, "Couldn't open file '%s'", name->getCString()); + return gFalse; + } + rewind(file); + while ((n = fread(buf, 1, sizeof(buf), file)) > 0) + fwrite(buf, 1, n, f); + fclose(f); + return gTrue; +} + +void PDFDoc::getLinks(int page) { + Object obj; + + links = new Links(catalog->getPage(page)->getAnnots(&obj)); + obj.free(); +} diff --git a/pdf/xpdf/PDFDoc.h b/pdf/xpdf/PDFDoc.h new file mode 100644 index 00000000..5e28962e --- /dev/null +++ b/pdf/xpdf/PDFDoc.h @@ -0,0 +1,107 @@ +//======================================================================== +// +// PDFDoc.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef PDFDOC_H +#define PDFDOC_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "Link.h" + +class GString; +class XRef; +class Catalog; +class OutputDev; +class Links; +class LinkAction; +class LinkDest; + +//------------------------------------------------------------------------ +// PDFDoc +//------------------------------------------------------------------------ + +class PDFDoc { +public: + + PDFDoc(GString *fileName1); + ~PDFDoc(); + + // Was PDF document successfully opened? + GBool isOk() { return ok; } + + // Get file name. + GString *getFileName() { return fileName; } + + // Get catalog. + Catalog *getCatalog() { return catalog; } + + // Get page parameters. + double getPageWidth(int page) + { return catalog->getPage(page)->getWidth(); } + double getPageHeight(int page) + { return catalog->getPage(page)->getHeight(); } + int getPageRotate(int page) + { return catalog->getPage(page)->getRotate(); } + + // Get number of pages. + int getNumPages() { return catalog->getNumPages(); } + + // Display a page. + void displayPage(OutputDev *out, int page, int zoom, int rotate, + GBool doLinks); + + // Display a range of pages. + void displayPages(OutputDev *out, int firstPage, int lastPage, + int zoom, int rotate); + + // Find a page, given its object ID. Returns page number, or 0 if + // not found. + int findPage(int num, int gen) { return catalog->findPage(num, gen); } + + // If point , is in a link, return the associated action; + // else return NULL. + LinkAction *findLink(double x, double y) { return links->find(x, y); } + + // Return true if , is in a link. + GBool onLink(double x, double y) { return links->onLink(x, y); } + + // Find a named destination. Returns the link destination, or + // NULL if is not a destination. + LinkDest *findDest(GString *name) + { return catalog->findDest(name); } + + // Is the file encrypted? + GBool isEncrypted() { return xref->isEncrypted(); } + + // Are printing and copying allowed? If not, print an error message. + GBool okToPrint() { return xref->okToPrint(); } + GBool okToCopy() { return xref->okToCopy(); } + + // Return the document's Info dictionary (if any). + Object *getDocInfo(Object *obj) { return xref->getDocInfo(obj); } + + // Save this file with another name. + GBool saveAs(GString *name); + +private: + + void getLinks(int page); + + GString *fileName; + FILE *file; + XRef *xref; + Catalog *catalog; + Links *links; + + GBool ok; +}; + +#endif diff --git a/pdf/xpdf/PSOutputDev.cc b/pdf/xpdf/PSOutputDev.cc new file mode 100644 index 00000000..bc7fb3c7 --- /dev/null +++ b/pdf/xpdf/PSOutputDev.cc @@ -0,0 +1,1132 @@ +//======================================================================== +// +// PSOutputDev.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include +#include "GString.h" +#include "config.h" +#include "Object.h" +#include "Error.h" +#include "GfxState.h" +#include "GfxFont.h" +#include "Catalog.h" +#include "Page.h" +#include "Stream.h" +#include "PSOutputDev.h" + +//------------------------------------------------------------------------ +// Parameters +//------------------------------------------------------------------------ + +// Generate Level 1 PostScript? +GBool psOutLevel1 = gFalse; + +int paperWidth = defPaperWidth; +int paperHeight = defPaperHeight; + +//------------------------------------------------------------------------ +// PostScript prolog and setup +//------------------------------------------------------------------------ + +static char *prolog[] = { + "/xpdf 75 dict def xpdf begin", + "% PDF special state", + "/pdfDictSize 14 def", + "/pdfSetup {", + " pdfDictSize dict begin", + " /pdfFill [0] def", + " /pdfStroke [0] def", + " /pdfLastFill false def", + " /pdfLastStroke false def", + " /pdfTextMat [1 0 0 1 0 0] def", + " /pdfFontSize 0 def", + " /pdfCharSpacing 0 def", + " /pdfTextRender 0 def", + " /pdfTextRise 0 def", + " /pdfWordSpacing 0 def", + " /pdfHorizScaling 1 def", + "} def", + "/pdfStartPage {", + " 2 array astore", + " pdfSetup", + " /setpagedevice where {", + " pop 2 dict dup begin", + " exch /PageSize exch def", + " /ImagingBBox null def", + " end setpagedevice", + " } {", + " pop", + " } ifelse", + "} def", + "/pdfEndPage { end } def", + "/sCol { pdfLastStroke not {", + " pdfStroke aload length", + " 1 eq { setgray } { setrgbcolor} ifelse", + " /pdfLastStroke true def /pdfLastFill false def", + " } if } def", + "/fCol { pdfLastFill not {", + " pdfFill aload length", + " 1 eq { setgray } { setrgbcolor } ifelse", + " /pdfLastFill true def /pdfLastStroke false def", + " } if } def", + "% build a font", + "/pdfMakeFont {", + " 3 2 roll findfont", + " 3 2 roll 1 matrix scale makefont", + " dup length dict begin", + " { 1 index /FID ne { def } { pop pop } ifelse } forall", + " /Encoding exch def", + " currentdict", + " end", + " definefont pop", + "} def", + "% graphics state operators", + "/q { gsave pdfDictSize dict begin } def", + "/Q { end grestore } def", + "/cm { concat } def", + "/d { setdash } def", + "/i { setflat } def", + "/j { setlinejoin } def", + "/J { setlinecap } def", + "/M { setmiterlimit } def", + "/w { setlinewidth } def", + "% color operators", + "/g { dup 1 array astore /pdfFill exch def setgray", + " /pdfLastFill true def /pdfLastStroke false def } def", + "/G { dup 1 array astore /pdfStroke exch def setgray", + " /pdfLastStroke true def /pdfLastFill false def } def", + "/rg { 3 copy 3 array astore /pdfFill exch def setrgbcolor", + " /pdfLastFill true def /pdfLastStroke false def } def", + "/RG { 3 copy 3 array astore /pdfStroke exch def setrgbcolor", + " /pdfLastStroke true def /pdfLastFill false def } def", + "% path segment operators", + "/m { moveto } def", + "/l { lineto } def", + "/c { curveto } def", + "/re { 4 2 roll moveto 1 index 0 rlineto 0 exch rlineto", + " neg 0 rlineto closepath } def" + "% path painting operators", + "/S { sCol stroke } def", + "/f { fCol fill } def", + "/f* { fCol eofill } def", + "% clipping operators", + "/W { clip newpath } def", + "/W* { eoclip newpath } def", + "% text state operators", + "/Tc { /pdfCharSpacing exch def } def", + "/Tf { dup /pdfFontSize exch def", + " dup pdfHorizScaling mul exch matrix scale", + " pdfTextMat matrix concatmatrix dup 4 0 put dup 5 0 put", + " exch findfont exch makefont setfont } def", + "/Tr { /pdfTextRender exch def } def", + "/Ts { /pdfTextRise exch def } def", + "/Tw { /pdfWordSpacing exch def } def", + "/Tz { /pdfHorizScaling exch def } def", + "% text positioning operators", + "/Td { pdfTextMat transform moveto } def", + "/Tm { /pdfTextMat exch def } def", + "% text string operators", + "/Tj { pdfTextRender 1 and 0 eq { fCol } { sCol } ifelse", + " 0 pdfTextRise pdfTextMat dtransform rmoveto", + " pdfFontSize mul pdfHorizScaling mul", + " 1 index stringwidth pdfTextMat idtransform pop", + " sub 1 index length dup 0 ne { div } { pop pop 0 } ifelse", + " pdfWordSpacing 0 pdfTextMat dtransform 32", + " 4 3 roll pdfCharSpacing add 0 pdfTextMat dtransform", + " 6 5 roll awidthshow", + " 0 pdfTextRise neg pdfTextMat dtransform rmoveto } def", + "/TJm { pdfFontSize 0.001 mul mul neg 0", + " pdfTextMat dtransform rmoveto } def", + "% Level 1 image operators", + "/pdfIm1 {", + " /pdfImBuf1 4 index string def", + " { currentfile pdfImBuf1 readhexstring pop } image", + "} def", + "/pdfImM1 {", + " /pdfImBuf1 4 index 7 add 8 idiv string def", + " { currentfile pdfImBuf1 readhexstring pop } imagemask", + "} def", + "% Level 2 image operators", + "/pdfImBuf 100 string def", + "/pdfIm {", + " image", + " { currentfile pdfImBuf readline", + " not { pop exit } if", + " (%-EOD-) eq { exit } if } loop", + "} def", + "/pdfImM {", + " fCol imagemask", + " { currentfile pdfImBuf readline", + " not { pop exit } if", + " (%-EOD-) eq { exit } if } loop", + "} def", + "end", + NULL +}; + +//------------------------------------------------------------------------ +// Fonts +//------------------------------------------------------------------------ + +struct PSFont { + char *name; // PDF name + char *psName; // PostScript name +}; + +struct PSSubstFont { + char *psName; // PostScript name + double mWidth; // width of 'm' character +}; + +static PSFont psFonts[] = { + {"Courier", "Courier"}, + {"Courier-Bold", "Courier-Bold"}, + {"Courier-Oblique", "Courier-Bold"}, + {"Courier-BoldOblique", "Courier-BoldOblique"}, + {"Helvetica", "Helvetica"}, + {"Helvetica-Bold", "Helvetica-Bold"}, + {"Helvetica-Oblique", "Helvetica-Oblique"}, + {"Helvetica-BoldOblique", "Helvetica-BoldOblique"}, + {"Symbol", "Symbol"}, + {"Times-Roman", "Times-Roman"}, + {"Times-Bold", "Times-Bold"}, + {"Times-Italic", "Times-Italic"}, + {"Times-BoldItalic", "Times-BoldItalic"}, + {"ZapfDingbats", "ZapfDingbats"}, + {NULL} +}; + +static PSSubstFont psSubstFonts[] = { + {"Helvetica", 0.833}, + {"Helvetica-Oblique", 0.833}, + {"Helvetica-Bold", 0.889}, + {"Helvetica-BoldOblique", 0.889}, + {"Times-Roman", 0.788}, + {"Times-Italic", 0.722}, + {"Times-Bold", 0.833}, + {"Times-BoldItalic", 0.778}, + {"Courier", 0.600}, + {"Courier-Oblique", 0.600}, + {"Courier-Bold", 0.600}, + {"Courier-BoldOblique", 0.600} +}; + +//------------------------------------------------------------------------ +// PSOutputDev +//------------------------------------------------------------------------ + +PSOutputDev::PSOutputDev(char *fileName, Catalog *catalog, + int firstPage, int lastPage, + GBool embedType11, GBool doForm1) { + Page *page; + Dict *resDict; + char **p; + int pg; + + // initialize + embedType1 = embedType11; + doForm = doForm1; + fontIDs = NULL; + fontFileIDs = NULL; + fontFileNames = NULL; + f = NULL; + if (doForm) + lastPage = firstPage; + + // open file or pipe + ok = gTrue; + if (!strcmp(fileName, "-")) { + fileType = psStdout; + f = stdout; + } else if (fileName[0] == '|') { + fileType = psPipe; +#ifdef HAVE_POPEN +#ifndef WIN32 + signal(SIGPIPE, (void (*)(int))SIG_IGN); +#endif + if (!(f = popen(fileName + 1, "w"))) { + error(-1, "Couldn't run print command '%s'", fileName); + ok = gFalse; + return; + } +#else + error(-1, "Print commands are not supported ('%s')", fileName); + ok = gFalse; + return; +#endif + } else { + fileType = psFile; + if (!(f = fopen(fileName, "w"))) { + error(-1, "Couldn't open PostScript file '%s'", fileName); + ok = gFalse; + return; + } + } + + // initialize fontIDs, fontFileIDs, and fontFileNames lists + fontIDSize = 64; + fontIDLen = 0; + fontIDs = (Ref *)gmalloc(fontIDSize * sizeof(Ref)); + fontFileIDSize = 64; + fontFileIDLen = 0; + fontFileIDs = (Ref *)gmalloc(fontFileIDSize * sizeof(Ref)); + fontFileNameSize = 64; + fontFileNameLen = 0; + fontFileNames = (char **)gmalloc(fontFileNameSize * sizeof(char *)); + + // write header + if (doForm) { + writePS("%%!PS-Adobe-3.0 Resource-Form\n"); + writePS("%%%%Creator: xpdf/pdftops %s\n", xpdfVersion); + writePS("%%%%EndComments\n"); + } else { + writePS("%%!PS-Adobe-3.0\n"); + writePS("%%%%Creator: xpdf/pdftops %s\n", xpdfVersion); + writePS("%%%%Pages: %d\n", lastPage - firstPage + 1); + writePS("%%%%EndComments\n"); + } + + // write prolog + if (!doForm) + writePS("%%%%BeginProlog\n"); + writePS("%%%%BeginResource: xpdf %s\n", xpdfVersion); + for (p = prolog; *p; ++p) + writePS("%s\n", *p); + writePS("%%%%EndResource\n"); + if (!doForm) + writePS("%%%%EndProlog\n"); + + // set up fonts + if (!doForm) + writePS("%%%%BeginSetup\n"); + writePS("xpdf begin\n"); + for (pg = firstPage; pg <= lastPage; ++pg) { + if ((resDict = catalog->getPage(pg)->getResourceDict())) + setupFonts(resDict); + } + if (doForm) + writePS("end\n"); + else + writePS("%%%%EndSetup\n"); + + // write form header + if (doForm) { + page = catalog->getPage(firstPage); + writePS("4 dict dup begin\n"); + writePS("/BBox [%d %d %d %d] def\n", + (int)page->getX1(), (int)page->getY1(), + (int)page->getX2(), (int)page->getY2()); + writePS("/FormType 1 def\n"); + writePS("/Matrix [1 0 0 1 0 0] def\n"); + } + + // initialize sequential page number + seqPage = 1; +} + +PSOutputDev::~PSOutputDev() { + if (f) { + if (doForm) { + writePS("end\n"); + writePS("/Foo exch /Form defineresource pop\n"); + } else { + writePS("%%%%Trailer\n"); + writePS("end\n"); + writePS("%%%%EOF\n"); + } + if (fileType == psFile) { + fclose(f); + } +#ifdef HAVE_POPEN + else if (fileType == psPipe) { + pclose(f); +#ifndef WIN32 + signal(SIGPIPE, (void (*)(int))SIG_DFL); +#endif + } +#endif + } + if (fontIDs) + gfree(fontIDs); + if (fontFileIDs) + gfree(fontFileIDs); + if (fontFileNames) + gfree(fontFileNames); +} + +void PSOutputDev::setupFonts(Dict *resDict) { + Object fontDict, xObjDict, xObj, resObj; + GfxFontDict *gfxFontDict; + GfxFont *font; + int i; + + resDict->lookup("Font", &fontDict); + if (fontDict.isDict()) { + gfxFontDict = new GfxFontDict(fontDict.getDict()); + for (i = 0; i < gfxFontDict->getNumFonts(); ++i) { + font = gfxFontDict->getFont(i); + setupFont(font); + } + delete gfxFontDict; + } + fontDict.free(); + + resDict->lookup("XObject", &xObjDict); + if (xObjDict.isDict()) { + for (i = 0; i < xObjDict.dictGetLength(); ++i) { + xObjDict.dictGetVal(i, &xObj); + if (xObj.isStream()) { + xObj.streamGetDict()->lookup("Resources", &resObj); + if (resObj.isDict()) + setupFonts(resObj.getDict()); + resObj.free(); + } + xObj.free(); + } + } + xObjDict.free(); +} + +void PSOutputDev::setupFont(GfxFont *font) { + Ref fontFileID; + GString *name; + char *psName; + char *charName; + double scale; + int i, j; + + // check if font is already set up + for (i = 0; i < fontIDLen; ++i) { + if (fontIDs[i].num == font->getID().num && + fontIDs[i].gen == font->getID().gen) + return; + } + + // add entry to fontIDs list + if (fontIDLen >= fontIDSize) { + fontIDSize += 64; + fontIDs = (Ref *)grealloc(fontIDs, fontIDSize * sizeof(Ref)); + } + fontIDs[fontIDLen++] = font->getID(); + + // check for embedded font + if (embedType1 && font->getType() == fontType1 && + font->getEmbeddedFontID(&fontFileID)) { + setupEmbeddedFont(&fontFileID); + psName = font->getEmbeddedFontName(); + scale = 1; + + // check for external font file + } else if (embedType1 && font->getType() == fontType1 && + font->getExtFontFile()) { + setupEmbeddedFont(font->getExtFontFile()); + // this assumes that the PS font name matches the PDF font name + psName = font->getName()->getCString(); + scale = 1; + + // do font substitution + } else { + name = font->getName(); + psName = NULL; + scale = 1.0; + if (name) { + for (i = 0; psFonts[i].name; ++i) { + if (name->cmp(psFonts[i].name) == 0) { + psName = psFonts[i].psName; + break; + } + } + } + if (!psName) { + if (font->isFixedWidth()) + i = 8; + else if (font->isSerif()) + i = 4; + else + i = 0; + if (font->isBold()) + i += 2; + if (font->isItalic()) + i += 1; + psName = psSubstFonts[i].psName; + scale = font->getWidth('m') / psSubstFonts[i].mWidth; + if (scale < 0.1) + scale = 1; + } + } + + // generate PostScript code to set up the font + writePS("/F%d_%d /%s %g\n", + font->getID().num, font->getID().gen, psName, scale); + for (i = 0; i < 256; i += 8) { + writePS((i == 0) ? "[ " : " "); + for (j = 0; j < 8; ++j) { + charName = font->getCharName(i+j); + writePS("/%s", charName ? charName : ".notdef"); + } + writePS((i == 256-8) ? "]\n" : "\n"); + } + writePS("pdfMakeFont\n"); +} + +void PSOutputDev::setupEmbeddedFont(Ref *id) { + static char hexChar[17] = "0123456789abcdef"; + Object refObj, strObj, obj1, obj2; + Dict *dict; + int length1, length2; + int c; + int start[4]; + GBool binMode; + int i; + + // check if font is already embedded + for (i = 0; i < fontFileIDLen; ++i) { + if (fontFileIDs[i].num == id->num && + fontFileIDs[i].gen == id->gen) + return; + } + + // add entry to fontFileIDs list + if (fontFileIDLen >= fontFileIDSize) { + fontFileIDSize += 64; + fontFileIDs = (Ref *)grealloc(fontFileIDs, fontFileIDSize * sizeof(Ref)); + } + fontFileIDs[fontFileIDLen++] = *id; + + // get the font stream and info + refObj.initRef(id->num, id->gen); + refObj.fetch(&strObj); + refObj.free(); + if (!strObj.isStream()) { + error(-1, "Embedded font file object is not a stream"); + goto err1; + } + if (!(dict = strObj.streamGetDict())) { + error(-1, "Embedded font stream is missing its dictionary"); + goto err1; + } + dict->lookup("Length1", &obj1); + dict->lookup("Length2", &obj2); + if (!obj1.isInt() || !obj2.isInt()) { + error(-1, "Missing length fields in embedded font stream dictionary"); + obj1.free(); + obj2.free(); + goto err1; + } + length1 = obj1.getInt(); + length2 = obj2.getInt(); + obj1.free(); + obj2.free(); + + // copy ASCII portion of font + strObj.streamReset(); + for (i = 0; i < length1 && (c = strObj.streamGetChar()) != EOF; ++i) + fputc(c, f); + + // figure out if encrypted portion is binary or ASCII + binMode = gFalse; + for (i = 0; i < 4; ++i) { + start[i] = strObj.streamGetChar(); + if (start[i] == EOF) { + error(-1, "Unexpected end of file in embedded font stream"); + goto err1; + } + if (!((start[i] >= '0' && start[i] <= '9') || + (start[i] >= 'A' && start[i] <= 'F') || + (start[i] >= 'a' && start[i] <= 'f'))) + binMode = gTrue; + } + + // convert binary data to ASCII + if (binMode) { + for (i = 0; i < 4; ++i) { + fputc(hexChar[(start[i] >> 4) & 0x0f], f); + fputc(hexChar[start[i] & 0x0f], f); + } + while (i < length2) { + if ((c = strObj.streamGetChar()) == EOF) + break; + fputc(hexChar[(c >> 4) & 0x0f], f); + fputc(hexChar[c & 0x0f], f); + if (++i % 32 == 0) + fputc('\n', f); + } + if (i % 32 > 0) + fputc('\n', f); + + // already in ASCII format -- just copy it + } else { + for (i = 0; i < 4; ++i) + fputc(start[i], f); + for (i = 4; i < length2; ++i) { + if ((c = strObj.streamGetChar()) == EOF) + break; + fputc(c, f); + } + } + + // write padding and "cleartomark" + for (i = 0; i < 8; ++i) + writePS("00000000000000000000000000000000" + "00000000000000000000000000000000\n"); + writePS("cleartomark\n"); + + err1: + strObj.free(); +} + +//~ This doesn't handle .pfb files or binary eexec data (which only +//~ happens in pfb files?). +void PSOutputDev::setupEmbeddedFont(char *fileName) { + FILE *fontFile; + int c; + int i; + + // check if font is already embedded + for (i = 0; i < fontFileNameLen; ++i) { + if (!strcmp(fontFileNames[i], fileName)) + return; + } + + // add entry to fontFileNames list + if (fontFileNameLen >= fontFileNameSize) { + fontFileNameSize += 64; + fontFileNames = (char **)grealloc(fontFileNames, + fontFileNameSize * sizeof(char *)); + } + fontFileNames[fontFileNameLen++] = fileName; + + // copy the font file + if (!(fontFile = fopen(fileName, "rb"))) { + error(-1, "Couldn't open external font file"); + return; + } + while ((c = fgetc(fontFile)) != EOF) + fputc(c, f); + fclose(fontFile); +} + +void PSOutputDev::startPage(int pageNum, GfxState *state) { + int x1, y1, x2, y2, width, height, t; + double xScale, yScale; + + if (doForm) { + + writePS("/PaintProc {\n"); + writePS("begin xpdf begin\n"); + writePS("pdfSetup\n"); + + } else { + + writePS("%%%%Page: %d %d\n", pageNum, seqPage); + writePS("%%%%BeginPageSetup\n"); + + // rotate, translate, and scale page + x1 = (int)(state->getX1() + 0.5); + y1 = (int)(state->getY1() + 0.5); + x2 = (int)(state->getX2() + 0.5); + y2 = (int)(state->getY2() + 0.5); + width = x2 - x1; + height = y2 - y1; + if (width > height) { + writePS("%%%%PageOrientation: Landscape\n"); + writePS("%d %d pdfStartPage\n", paperWidth, paperHeight); + writePS("90 rotate\n"); + writePS("%d %d translate\n", -x1, -(y1 + paperWidth)); + t = width; + width = height; + height = t; + } else { + writePS("%%%%PageOrientation: Portrait\n"); + writePS("%d %d pdfStartPage\n", paperWidth, paperHeight); + if (x1 != 0 || y1 != 0) + writePS("%d %d translate\n", -x1, -y1); + } + if (width > paperWidth || height > paperHeight) { + xScale = (double)paperWidth / (double)width; + yScale = (double)paperHeight / (double)height; + if (yScale < xScale) + xScale = yScale; + writePS("%0.4f %0.4f scale\n", xScale, xScale); + } + + writePS("%%%%EndPageSetup\n"); + ++seqPage; + } +} + +void PSOutputDev::endPage() { + if (doForm) { + writePS("pdfEndPage\n"); + writePS("end end\n"); + writePS("} def\n"); + } else { + writePS("showpage\n"); + writePS("%%%%PageTrailer\n"); + writePS("pdfEndPage\n"); + } +} + +void PSOutputDev::saveState(GfxState *state) { + writePS("q\n"); +} + +void PSOutputDev::restoreState(GfxState *state) { + writePS("Q\n"); +} + +void PSOutputDev::updateCTM(GfxState *state, double m11, double m12, + double m21, double m22, double m31, double m32) { + writePS("[%g %g %g %g %g %g] cm\n", m11, m12, m21, m22, m31, m32); +} + +void PSOutputDev::updateLineDash(GfxState *state) { + double *dash; + double start; + int length, i; + + state->getLineDash(&dash, &length, &start); + writePS("["); + for (i = 0; i < length; ++i) + writePS("%g%s", dash[i], (i == length-1) ? "" : " "); + writePS("] %g d\n", start); +} + +void PSOutputDev::updateFlatness(GfxState *state) { + writePS("%d i\n", state->getFlatness()); +} + +void PSOutputDev::updateLineJoin(GfxState *state) { + writePS("%d j\n", state->getLineJoin()); +} + +void PSOutputDev::updateLineCap(GfxState *state) { + writePS("%d J\n", state->getLineCap()); +} + +void PSOutputDev::updateMiterLimit(GfxState *state) { + writePS("%g M\n", state->getMiterLimit()); +} + +void PSOutputDev::updateLineWidth(GfxState *state) { + writePS("%g w\n", state->getLineWidth()); +} + +void PSOutputDev::updateFillColor(GfxState *state) { + GfxColor *color; + double r, g, b; + + color = state->getFillColor(); + r = color->getR(); + g = color->getG(); + b = color->getB(); + if (r == g && g == b) + writePS("%g g\n", r); + else + writePS("%g %g %g rg\n", r, g, b); +} + +void PSOutputDev::updateStrokeColor(GfxState *state) { + GfxColor *color; + double r, g, b; + + color = state->getStrokeColor(); + r = color->getR(); + g = color->getG(); + b = color->getB(); + if (r == g && g == b) + writePS("%g G\n", r); + else + writePS("%g %g %g RG\n", r, g, b); +} + +void PSOutputDev::updateFont(GfxState *state) { + if (state->getFont()) { + writePS("/F%d_%d %g Tf\n", + state->getFont()->getID().num, state->getFont()->getID().gen, + state->getFontSize()); + } +} + +void PSOutputDev::updateTextMat(GfxState *state) { + double *mat; + + mat = state->getTextMat(); + writePS("[%g %g %g %g %g %g] Tm\n", + mat[0], mat[1], mat[2], mat[3], mat[4], mat[5]); +} + +void PSOutputDev::updateCharSpace(GfxState *state) { + writePS("%g Tc\n", state->getCharSpace()); +} + +void PSOutputDev::updateRender(GfxState *state) { + writePS("%d Tr\n", state->getRender()); +} + +void PSOutputDev::updateRise(GfxState *state) { + writePS("%g Ts\n", state->getRise()); +} + +void PSOutputDev::updateWordSpace(GfxState *state) { + writePS("%g Tw\n", state->getWordSpace()); +} + +void PSOutputDev::updateHorizScaling(GfxState *state) { + writePS("%g Tz\n", state->getHorizScaling()); +} + +void PSOutputDev::updateTextPos(GfxState *state) { + writePS("%g %g Td\n", state->getLineX(), state->getLineY()); +} + +void PSOutputDev::updateTextShift(GfxState *state, double shift) { + writePS("%g TJm\n", shift); +} + +void PSOutputDev::stroke(GfxState *state) { + doPath(state->getPath()); + writePS("S\n"); +} + +void PSOutputDev::fill(GfxState *state) { + doPath(state->getPath()); + writePS("f\n"); +} + +void PSOutputDev::eoFill(GfxState *state) { + doPath(state->getPath()); + writePS("f*\n"); +} + +void PSOutputDev::clip(GfxState *state) { + doPath(state->getPath()); + writePS("W\n"); +} + +void PSOutputDev::eoClip(GfxState *state) { + doPath(state->getPath()); + writePS("W*\n"); +} + +void PSOutputDev::doPath(GfxPath *path) { + GfxSubpath *subpath; + double x0, y0, x1, y1, x2, y2, x3, y3, x4, y4; + int n, m, i, j; + + n = path->getNumSubpaths(); + + if (n == 1 && path->getSubpath(0)->getNumPoints() == 5) { + subpath = path->getSubpath(0); + x0 = subpath->getX(0); + y0 = subpath->getY(0); + x4 = subpath->getX(4); + y4 = subpath->getY(4); + if (x4 == x0 && y4 == y0) { + x1 = subpath->getX(1); + y1 = subpath->getY(1); + x2 = subpath->getX(2); + y2 = subpath->getY(2); + x3 = subpath->getX(3); + y3 = subpath->getY(3); + if (x0 == x1 && x2 == x3 && y0 == y3 && y1 == y2) { + writePS("%g %g %g %g re\n", + x0 < x2 ? x0 : x2, y0 < y1 ? y0 : y1, + fabs(x2 - x0), fabs(y1 - y0)); + return; + } else if (x0 == x3 && x1 == x2 && y0 == y1 && y2 == y3) { + writePS("%g %g %g %g re\n", + x0 < x1 ? x0 : x1, y0 < y2 ? y0 : y2, + fabs(x1 - x0), fabs(y2 - y0)); + return; + } + } + } + + for (i = 0; i < n; ++i) { + subpath = path->getSubpath(i); + m = subpath->getNumPoints(); + writePS("%g %g m\n", subpath->getX(0), subpath->getY(0)); + j = 1; + while (j < m) { + if (subpath->getCurve(j)) { + writePS("%g %g %g %g %g %g c\n", subpath->getX(j), subpath->getY(j), + subpath->getX(j+1), subpath->getY(j+1), + subpath->getX(j+2), subpath->getY(j+2)); + j += 3; + } else { + writePS("%g %g l\n", subpath->getX(j), subpath->getY(j)); + ++j; + } + } + } +} + +void PSOutputDev::drawString(GfxState *state, GString *s) { + // check for invisible text -- this is used by Acrobat Capture + if ((state->getRender() & 3) == 3) + return; + + writePSString(s); + writePS(" %g Tj\n", state->getFont()->getWidth(s)); +} + +void PSOutputDev::drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg) { + int len; + + len = height * ((width + 7) / 8); + if (psOutLevel1) + doImageL1(NULL, invert, inlineImg, str, width, height, len); + else + doImage(NULL, invert, inlineImg, str, width, height, len); +} + +void PSOutputDev::drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg) { + int len; + + len = height * ((width * colorMap->getNumPixelComps() * + colorMap->getBits() + 7) / 8); + if (psOutLevel1) + doImageL1(colorMap, gFalse, inlineImg, str, width, height, len); + else + doImage(colorMap, gFalse, inlineImg, str, width, height, len); +} + +void PSOutputDev::doImageL1(GfxImageColorMap *colorMap, + GBool invert, GBool inlineImg, + Stream *str, int width, int height, int len) { + Guchar pixBuf[4]; + GfxColor color; + int x, y, i; + + // width, height, matrix, bits per component + if (colorMap) { + writePS("%d %d 8 [%d 0 0 %d 0 %d] pdfIm1\n", + width, height, + width, -height, height); + } else { + writePS("%d %d %s [%d 0 0 %d 0 %d] pdfImM1\n", + width, height, invert ? "true" : "false", + width, -height, height); + } + + // image + if (colorMap) { + + // set up to process the data stream + str->resetImage(width, colorMap->getNumPixelComps(), colorMap->getBits()); + + // process the data stream + i = 0; + for (y = 0; y < height; ++y) { + + // write the line + for (x = 0; x < width; ++x) { + str->getImagePixel(pixBuf); + colorMap->getColor(pixBuf, &color); + fprintf(f, "%02x", (int)(color.getGray() * 255 + 0.5)); + if (++i == 32) { + fputc('\n', f); + i = 0; + } + } + } + if (i != 0) + fputc('\n', f); + + // imagemask + } else { + str->reset(); + i = 0; + for (y = 0; y < height; ++y) { + for (x = 0; x < width; x += 8) { + fprintf(f, "%02x", str->getChar() & 0xff); + if (++i == 32) { + fputc('\n', f); + i = 0; + } + } + } + if (i != 0) + fputc('\n', f); + } +} + +void PSOutputDev::doImage(GfxImageColorMap *colorMap, + GBool invert, GBool inlineImg, + Stream *str, int width, int height, int len) { + GfxColorSpace *colorSpace; + GString *s; + int n, numComps; + Guchar *color; + GBool useRLE, useA85; + int c; + int i, j, k; + + // color space + if (colorMap) { + colorSpace = colorMap->getColorSpace(); + if (colorSpace->isIndexed()) + writePS("[/Indexed "); + switch (colorSpace->getMode()) { + case colorGray: + writePS("/DeviceGray "); + break; + case colorCMYK: + writePS("/DeviceCMYK "); + break; + case colorRGB: + writePS("/DeviceRGB "); + break; + } + if (colorSpace->isIndexed()) { + n = colorSpace->getIndexHigh(); + numComps = colorSpace->getNumColorComps(); + writePS("%d <\n", n); + for (i = 0; i <= n; i += 8) { + writePS(" "); + for (j = i; j < i+8 && j <= n; ++j) { + color = colorSpace->getLookupVal(j); + for (k = 0; k < numComps; ++k) + writePS("%02x", color[k]); + } + writePS("\n"); + } + writePS("> ] setcolorspace\n"); + } else { + writePS("setcolorspace\n"); + } + } + + // image dictionary + writePS("<<\n /ImageType 1\n"); + + // width, height, matrix, bits per component + writePS(" /Width %d\n", width); + writePS(" /Height %d\n", height); + writePS(" /ImageMatrix [%d 0 0 %d 0 %d]\n", width, -height, height); + writePS(" /BitsPerComponent %d\n", + colorMap ? colorMap->getBits() : 1); + + // decode + if (colorMap) { + writePS(" /Decode ["); + numComps = colorMap->getNumPixelComps(); + for (i = 0; i < numComps; ++i) { + if (i > 0) + writePS(" "); + writePS("%g %g", colorMap->getDecodeLow(i), colorMap->getDecodeHigh(i)); + } + writePS("]\n"); + } else { + writePS(" /Decode [%d %d]\n", invert ? 1 : 0, invert ? 0 : 1); + } + + if (doForm) { + + // data source + writePS(" /DataSource <~\n"); + + // write image data stream, using ASCII85 encode filter + str = new ASCII85Encoder(str); + str->reset(); + while ((c = str->getChar()) != EOF) + fputc(c, f); + fputc('\n', f); + delete str; + + // end of image dictionary + writePS(">>\n%s\n", colorMap ? "image" : "imagemask"); + + } else { + + // data source + writePS(" /DataSource currentfile\n"); + s = str->getPSFilter(" "); + if (inlineImg || !s) { + useRLE = gTrue; + useA85 = gTrue; + } else { + useRLE = gFalse; + useA85 = str->isBinary(); + } + if (useA85) + writePS(" /ASCII85Decode filter\n"); + if (useRLE) + writePS(" /RunLengthDecode filter\n"); + else + writePS("%s", s->getCString()); + if (s) + delete s; + + // end of image dictionary + writePS(">>\n%s\n", colorMap ? "pdfIm" : "pdfImM"); + + // write image data stream + + // cut off inline image streams at appropriate length + if (inlineImg) + str = new FixedLengthEncoder(str, len); + else if (!useRLE) + str = str->getBaseStream(); + + // add RunLengthEncode and ASCII85 encode filters + if (useRLE) + str = new RunLengthEncoder(str); + if (useA85) + str = new ASCII85Encoder(str); + + // copy the stream data + str->reset(); + while ((c = str->getChar()) != EOF) + fputc(c, f); + + // add newline and trailer to the end + fputc('\n', f); + fputs("%-EOD-\n", f); + + // delete encoders + if (useRLE || useA85) + delete str; + } +} + +void PSOutputDev::writePS(char *fmt, ...) { + va_list args; + + va_start(args, fmt); + vfprintf(f, fmt, args); + va_end(args); +} + +void PSOutputDev::writePSString(GString *s) { + Guchar *p; + int n; + + fputc('(', f); + for (p = (Guchar *)s->getCString(), n = s->getLength(); n; ++p, --n) { + if (*p == '(' || *p == ')' || *p == '\\') + fprintf(f, "\\%c", *p); + else if (*p < 0x20 || *p >= 0x80) + fprintf(f, "\\%03o", *p); + else + fputc(*p, f); + } + fputc(')', f); +} diff --git a/pdf/xpdf/PSOutputDev.h b/pdf/xpdf/PSOutputDev.h new file mode 100644 index 00000000..aa991fa6 --- /dev/null +++ b/pdf/xpdf/PSOutputDev.h @@ -0,0 +1,159 @@ +//======================================================================== +// +// PSOutputDev.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef PSOUTPUTDEV_H +#define PSOUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "config.h" +#include "Object.h" +#include "OutputDev.h" + +class GfxPath; +class GfxFont; + +//------------------------------------------------------------------------ +// Parameters +//------------------------------------------------------------------------ + +// Generate Level 1 PostScript? +extern GBool psOutLevel1; + +// Paper size. +extern int paperWidth; +extern int paperHeight; + +//------------------------------------------------------------------------ +// PSOutputDev +//------------------------------------------------------------------------ + +enum PSFileType { + psFile, // write to file + psPipe, // write to pipe + psStdout // write to stdout +}; + +class PSOutputDev: public OutputDev { +public: + + // Open a PostScript output file, and write the prolog. + PSOutputDev(char *fileName, Catalog *catalog, + int firstPage, int lastPage, + GBool embedType11, GBool doForm1); + + // Destructor -- writes the trailer and closes the file. + virtual ~PSOutputDev(); + + // Check if file was successfully created. + virtual GBool isOk() { return ok; } + + //---- get info about output device + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) + virtual GBool upsideDown() { return gFalse; } + + // Does this device use drawChar() or drawString()? + virtual GBool useDrawChar() { return gFalse; } + + //----- initialization and control + + // Start a page. + virtual void startPage(int pageNum, GfxState *state); + + // End a page. + virtual void endPage(); + + //----- save/restore graphics state + virtual void saveState(GfxState *state); + virtual void restoreState(GfxState *state); + + //----- update graphics state + virtual void updateCTM(GfxState *state, double m11, double m12, + double m21, double m22, double m31, double m32); + virtual void updateLineDash(GfxState *state); + virtual void updateFlatness(GfxState *state); + virtual void updateLineJoin(GfxState *state); + virtual void updateLineCap(GfxState *state); + virtual void updateMiterLimit(GfxState *state); + virtual void updateLineWidth(GfxState *state); + virtual void updateFillColor(GfxState *state); + virtual void updateStrokeColor(GfxState *state); + + //----- update text state + virtual void updateFont(GfxState *state); + virtual void updateTextMat(GfxState *state); + virtual void updateCharSpace(GfxState *state); + virtual void updateRender(GfxState *state); + virtual void updateRise(GfxState *state); + virtual void updateWordSpace(GfxState *state); + virtual void updateHorizScaling(GfxState *state); + virtual void updateTextPos(GfxState *state); + virtual void updateTextShift(GfxState *state, double shift); + + //----- path painting + virtual void stroke(GfxState *state); + virtual void fill(GfxState *state); + virtual void eoFill(GfxState *state); + + //----- path clipping + virtual void clip(GfxState *state); + virtual void eoClip(GfxState *state); + + //----- text drawing + virtual void drawString(GfxState *state, GString *s); + + //----- image drawing + virtual void drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg); + virtual void drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg); + +private: + + void setupFonts(Dict *resDict); + void setupFont(GfxFont *font); + void setupEmbeddedFont(Ref *id); + void setupEmbeddedFont(char *fileName); + void doPath(GfxPath *path); + void doImageL1(GfxImageColorMap *colorMap, + GBool invert, GBool inlineImg, + Stream *str, int width, int height, int len); + void doImage(GfxImageColorMap *colorMap, + GBool invert, GBool inlineImg, + Stream *str, int width, int height, int len); + void writePS(char *fmt, ...); + void writePSString(GString *s); + + GBool embedType1; // embed Type 1 fonts? + GBool doForm; // generate a form? + + FILE *f; // PostScript file + PSFileType fileType; // file / pipe / stdout + int seqPage; // current sequential page number + + Ref *fontIDs; // list of object IDs of all used fonts + int fontIDLen; // number of entries in fontIDs array + int fontIDSize; // size of fontIDs array + Ref *fontFileIDs; // list of object IDs of all embedded fonts + int fontFileIDLen; // number of entries in fontFileIDs array + int fontFileIDSize; // size of fontFileIDs array + char **fontFileNames; // list of names of all embedded external fonts + int fontFileNameLen; // number of entries in fontFileNames array + int fontFileNameSize; // size of fontFileNames array + + GBool ok; // set up ok? +}; + +#endif diff --git a/pdf/xpdf/Page.cc b/pdf/xpdf/Page.cc new file mode 100644 index 00000000..d09170a8 --- /dev/null +++ b/pdf/xpdf/Page.cc @@ -0,0 +1,214 @@ +//======================================================================== +// +// Page.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "OutputDev.h" +#ifndef PDF_PARSER_ONLY +#include "Gfx.h" +#endif +#include "Error.h" + +#include "Params.h" +#include "Page.h" + +//------------------------------------------------------------------------ +// PageAttrs +//------------------------------------------------------------------------ + +PageAttrs::PageAttrs(PageAttrs *attrs, Dict *dict) { + Object obj1, obj2; + double w, h; + + // get old/default values + if (attrs) { + x1 = attrs->x1; + y1 = attrs->y1; + x2 = attrs->x2; + y2 = attrs->y2; + cropX1 = attrs->cropX1; + cropY1 = attrs->cropY1; + cropX2 = attrs->cropX2; + cropY2 = attrs->cropY2; + rotate = attrs->rotate; + attrs->resources.copy(&resources); + } else { + // set default MediaBox to 8.5" x 11" -- this shouldn't be necessary + // but some (non-compliant) PDF files don't specify a MediaBox + x1 = 0; + y1 = 0; + x2 = 612; + y2 = 792; + cropX1 = cropY1 = cropX2 = cropY2 = 0; + rotate = 0; + resources.initNull(); + } + + // media box + dict->lookup("MediaBox", &obj1); + if (obj1.isArray() && obj1.arrayGetLength() == 4) { + obj1.arrayGet(0, &obj2); + if (obj2.isNum()) + x1 = obj2.getNum(); + obj2.free(); + obj1.arrayGet(1, &obj2); + if (obj2.isNum()) + y1 = obj2.getNum(); + obj2.free(); + obj1.arrayGet(2, &obj2); + if (obj2.isNum()) + x2 = obj2.getNum(); + obj2.free(); + obj1.arrayGet(3, &obj2); + if (obj2.isNum()) + y2 = obj2.getNum(); + obj2.free(); + } + obj1.free(); + + // crop box + dict->lookup("CropBox", &obj1); + if (obj1.isArray() && obj1.arrayGetLength() == 4) { + obj1.arrayGet(0, &obj2); + if (obj2.isNum()) + cropX1 = obj2.getNum(); + obj2.free(); + obj1.arrayGet(1, &obj2); + if (obj2.isNum()) + cropY1 = obj2.getNum(); + obj2.free(); + obj1.arrayGet(2, &obj2); + if (obj2.isNum()) + cropX2 = obj2.getNum(); + obj2.free(); + obj1.arrayGet(3, &obj2); + if (obj2.isNum()) + cropY2 = obj2.getNum(); + obj2.free(); + + // if the MediaBox is excessively larger than the CropBox, + // just use the CropBox + w = 0.25 * (cropX2 - cropX1); + h = 0.25 * (cropY2 - cropY1); + if (cropX1 - x1 > w || x2 - cropX2 > w || + cropY1 - y1 > h || y2 - cropY2 > h) { + x1 = cropX1; + x2 = cropX2; + y1 = cropY1; + y2 = cropY2; + } + } else { + cropX1 = cropX2 = cropY1 = cropY2 = 0; + } + obj1.free(); + + // rotate + dict->lookup("Rotate", &obj1); + if (obj1.isInt()) + rotate = obj1.getInt(); + obj1.free(); + while (rotate < 0) + rotate += 360; + while (rotate >= 360) + rotate -= 360; + + // resource dictionary + dict->lookup("Resources", &obj1); + if (obj1.isDict()) { + resources.free(); + obj1.copy(&resources); + } + obj1.free(); +} + +PageAttrs::~PageAttrs() { + resources.free(); +} + +//------------------------------------------------------------------------ +// Page +//------------------------------------------------------------------------ + +Page::Page(int num1, Dict *pageDict, PageAttrs *attrs1) { + + ok = gTrue; + num = num1; + + // get attributes + attrs = attrs1; + + // annotations + pageDict->lookupNF("Annots", &annots); + if (!(annots.isRef() || annots.isArray() || annots.isNull())) { + error(-1, "Page annotations object (page %d) is wrong type (%s)", + num, annots.getTypeName()); + annots.free(); + goto err2; + } + + // contents + pageDict->lookupNF("Contents", &contents); + if (!(contents.isRef() || contents.isArray() || + contents.isNull())) { + error(-1, "Page contents object (page %d) is wrong type (%s)", + num, contents.getTypeName()); + contents.free(); + goto err1; + } + + return; + + err2: + annots.initNull(); + err1: + contents.initNull(); + ok = gFalse; +} + +Page::~Page() { + delete attrs; + annots.free(); + contents.free(); +} + +void Page::display(OutputDev *out, int dpi, int rotate) { +#ifndef PDF_PARSER_ONLY + Gfx *gfx; + Object obj; + + if (printCommands) { + printf("***** MediaBox = ll:%g,%g ur:%g,%g\n", + getX1(), getY1(), getX2(), getY2()); + if (isCropped()) { + printf("***** CropBox = ll:%g,%g ur:%g,%g\n", + getCropX1(), getCropY1(), getCropX2(), getCropY2()); + } + printf("***** Rotate = %d\n", attrs->getRotate()); + } + rotate += getRotate(); + if (rotate >= 360) + rotate -= 360; + else if (rotate < 0) + rotate += 360; + gfx = new Gfx(out, num, attrs->getResourceDict(), + dpi, getX1(), getY1(), getX2(), getY2(), isCropped(), + getCropX1(), getCropY1(), getCropX2(), getCropY2(), rotate); + contents.fetch(&obj); + if (!obj.isNull()) + gfx->display(&obj); + obj.free(); + delete gfx; +#endif +} diff --git a/pdf/xpdf/Page.h b/pdf/xpdf/Page.h new file mode 100644 index 00000000..c74f0b5b --- /dev/null +++ b/pdf/xpdf/Page.h @@ -0,0 +1,110 @@ +//======================================================================== +// +// Page.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef PAGE_H +#define PAGE_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "Object.h" + +class Dict; +class XRef; +class OutputDev; + +//------------------------------------------------------------------------ +// PageAttrs +//------------------------------------------------------------------------ + +class PageAttrs { +public: + + // Construct a new PageAttrs object by merging a dictionary + // (of type Pages or Page) into another PageAttrs object. If + // is NULL, uses defaults. + PageAttrs(PageAttrs *attrs, Dict *dict); + + // Destructor. + ~PageAttrs(); + + // Accessors. + double getX1() { return x1; } + double getY1() { return y1; } + double getX2() { return x2; } + double getY2() { return y2; } + GBool isCropped() { return cropX2 > cropX1; } + double getCropX1() { return cropX1; } + double getCropY1() { return cropY1; } + double getCropX2() { return cropX2; } + double getCropY2() { return cropY2; } + int getRotate() { return rotate; } + Dict *getResourceDict() + { return resources.isDict() ? resources.getDict() : (Dict *)NULL; } + +private: + + double x1, y1, x2, y2; + double cropX1, cropY1, cropX2, cropY2; + int rotate; + Object resources; +}; + +//------------------------------------------------------------------------ +// Page +//------------------------------------------------------------------------ + +class Page { +public: + + // Constructor. + Page(int num1, Dict *pageDict, PageAttrs *attrs1); + + // Destructor. + ~Page(); + + // Is page valid? + GBool isOk() { return ok; } + + // Get page parameters. + double getX1() { return attrs->getX1(); } + double getY1() { return attrs->getY1(); } + double getX2() { return attrs->getX2(); } + double getY2() { return attrs->getY2(); } + GBool isCropped() { return attrs->isCropped(); } + double getCropX1() { return attrs->getCropX1(); } + double getCropY1() { return attrs->getCropY1(); } + double getCropX2() { return attrs->getCropX2(); } + double getCropY2() { return attrs->getCropY2(); } + double getWidth() { return attrs->getX2() - attrs->getX1(); } + double getHeight() { return attrs->getY2() - attrs->getY1(); } + int getRotate() { return attrs->getRotate(); } + + // Get resource + Dict *getResourceDict() { return attrs->getResourceDict(); } + + // Get annotations array. + Object *getAnnots(Object *obj) { return annots.fetch(obj); } + + // Get contents. + Object *getContents(Object *obj) { return contents.fetch(obj); } + + // Display a page. + void display(OutputDev *out, int dpi, int rotate); + +private: + + int num; // page number + PageAttrs *attrs; // page attributes + Object annots; // annotations array + Object contents; // page contents + GBool ok; // true if page is valid +}; + +#endif diff --git a/pdf/xpdf/Params.cc b/pdf/xpdf/Params.cc new file mode 100644 index 00000000..35adfdfe --- /dev/null +++ b/pdf/xpdf/Params.cc @@ -0,0 +1,87 @@ +//======================================================================== +// +// Params.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include "gtypes.h" +#include "gmem.h" +#include "GString.h" +#include "gfile.h" +#include "Params.h" + +char **fontPath = NULL; +static int fontPathLen, fontPathSize; + +DevFontMapEntry *devFontMap = NULL; +static int devFontMapLen, devFontMapSize; + +void initParams(char *configFile) { + GString *fileName; + FILE *f; + char buf[256]; + char *p, *q; + + // initialize font path and font map + fontPath = (char **)gmalloc((fontPathSize = 8) * sizeof(char *)); + fontPath[fontPathLen = 0] = NULL; + devFontMap = (DevFontMapEntry *)gmalloc((devFontMapSize = 8) * + sizeof(DevFontMapEntry)); + devFontMap[devFontMapLen = 0].pdfFont = NULL; + + // read config file + fileName = appendToPath(getHomeDir(), configFile); + if ((f = fopen(fileName->getCString(), "r"))) { + while (fgets(buf, sizeof(buf)-1, f)) { + buf[sizeof(buf)-1] = '\0'; + p = strtok(buf, " \t\n\r"); + if (p && !strcmp(p, "fontpath")) { + if (fontPathLen+1 >= fontPathSize) + fontPath = (char **) + grealloc(fontPath, (fontPathSize += 8) * sizeof(char *)); + p = strtok(NULL, " \t\n\r"); + fontPath[fontPathLen++] = copyString(p); + } else if (p && !strcmp(p, "fontmap")) { + if (devFontMapLen+1 >= devFontMapSize) + devFontMap = (DevFontMapEntry *) + grealloc(devFontMap, + (devFontMapSize += 8) * sizeof(DevFontMapEntry)); + p = strtok(NULL, " \t\n\r"); + devFontMap[devFontMapLen].pdfFont = copyString(p); + p = strtok(NULL, "\t\n\r"); + while (*p == ' ') + ++p; + for (q = p + strlen(p) - 1; q >= p && *q == ' '; --q) ; + q[1] = '\0'; + devFontMap[devFontMapLen++].devFont = copyString(p); + } + } + fclose(f); + fontPath[fontPathLen] = NULL; + devFontMap[devFontMapLen].pdfFont = NULL; + } + delete fileName; +} + +void freeParams() { + int i; + + if (fontPath) { + for (i = 0; i < fontPathLen; ++i) + gfree(fontPath[i]); + gfree(fontPath); + } + if (devFontMap) { + for (i = 0; i < devFontMapLen; ++i) { + gfree(devFontMap[i].pdfFont); + gfree(devFontMap[i].devFont); + } + gfree(devFontMap); + } +} diff --git a/pdf/xpdf/Params.h b/pdf/xpdf/Params.h new file mode 100644 index 00000000..debe1a09 --- /dev/null +++ b/pdf/xpdf/Params.h @@ -0,0 +1,37 @@ +//======================================================================== +// +// Params.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef PARAMS_H +#define PARAMS_H + +// Print commands as they're executed. +extern GBool printCommands; + +// Send error messages to /dev/tty instead of stderr. +extern GBool errorsToTTY; + +// Font search path. +extern char **fontPath; + +// Mapping from PDF font name to device font name. +struct DevFontMapEntry { + char *pdfFont; + char *devFont; +}; +extern DevFontMapEntry *devFontMap; + +//------------------------------------------------------------------------ + +// Initialize font path and font map, and read configuration file, +// if present. +extern void initParams(char *configFile); + +// Free memory used for font path and font map. +extern void freeParams(); + +#endif diff --git a/pdf/xpdf/Parser.cc b/pdf/xpdf/Parser.cc new file mode 100644 index 00000000..49968f32 --- /dev/null +++ b/pdf/xpdf/Parser.cc @@ -0,0 +1,161 @@ +//======================================================================== +// +// Parser.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include "Object.h" +#include "Array.h" +#include "Dict.h" +#include "Parser.h" +#include "Error.h" + +Parser::Parser(Lexer *lexer1) { + lexer = lexer1; + inlineImg = 0; + lexer->getObj(&buf1); + lexer->getObj(&buf2); +} + +Parser::~Parser() { + buf1.free(); + buf2.free(); + delete lexer; +} + +Object *Parser::getObj(Object *obj) { + char *key; + Stream *str; + Object obj2; + int num; + + // refill buffer after inline image data + if (inlineImg == 2) { + buf1.free(); + buf2.free(); + lexer->getObj(&buf1); + lexer->getObj(&buf2); + inlineImg = 0; + } + + // array + if (buf1.isCmd("[")) { + shift(); + obj->initArray(); + while (!buf1.isCmd("]") && !buf1.isEOF()) + obj->arrayAdd(getObj(&obj2)); + if (buf1.isEOF()) + error(getPos(), "End of file inside array"); + shift(); + + // dictionary or stream + } else if (buf1.isCmd("<<")) { + shift(); + obj->initDict(); + while (!buf1.isCmd(">>") && !buf1.isEOF()) { + if (!buf1.isName()) { + error(getPos(), "Dictionary key must be a name object"); + shift(); + } else { + key = copyString(buf1.getName()); + shift(); + if (buf1.isEOF() || buf1.isError()) + break; + obj->dictAdd(key, getObj(&obj2)); + } + } + if (buf1.isEOF()) + error(getPos(), "End of file inside dictionary"); + if (buf2.isCmd("stream")) { + if ((str = makeStream(obj))) { + obj->initStream(str); + } else { + obj->free(); + obj->initError(); + } + } else { + shift(); + } + + // indirect reference or integer + } else if (buf1.isInt()) { + num = buf1.getInt(); + shift(); + if (buf1.isInt() && buf2.isCmd("R")) { + obj->initRef(num, buf1.getInt()); + shift(); + shift(); + } else { + obj->initInt(num); + } + + // simple object + } else { + buf1.copy(obj); + shift(); + } + + return obj; +} + +Stream *Parser::makeStream(Object *dict) { + Object obj; + Stream *str; + int pos, length; + + // get stream start position + lexer->skipToNextLine(); + pos = lexer->getPos(); + + // get length + dict->dictLookup("Length", &obj); + if (obj.isInt()) { + length = obj.getInt(); + obj.free(); + } else { + error(getPos(), "Bad 'Length' attribute in stream"); + obj.free(); + return NULL; + } + + // make base stream + str = new FileStream(lexer->getStream()->getFile(), pos, length, dict); + + // get filters + str = str->addFilters(dict); + + // skip over stream data + lexer->setPos(pos + length); + + // refill token buffers and check for 'endstream' + shift(); // kill '>>' + shift(); // kill 'stream' + if (buf1.isCmd("endstream")) + shift(); + else + error(getPos(), "Missing 'endstream'"); + + return str; +} + +void Parser::shift() { + if (inlineImg > 0) { + ++inlineImg; + } else if (buf2.isCmd("ID")) { + lexer->skipChar(); // skip char after 'ID' command + inlineImg = 1; + } + buf1.free(); + buf1 = buf2; + if (inlineImg > 0) // don't buffer inline image data + buf2.initNull(); + else + lexer->getObj(&buf2); +} diff --git a/pdf/xpdf/Parser.h b/pdf/xpdf/Parser.h new file mode 100644 index 00000000..1e2c1177 --- /dev/null +++ b/pdf/xpdf/Parser.h @@ -0,0 +1,51 @@ +//======================================================================== +// +// Parser.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef PARSER_H +#define PARSER_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include "Lexer.h" + +//------------------------------------------------------------------------ +// Parser +//------------------------------------------------------------------------ + +class Parser { +public: + + // Constructor. + Parser(Lexer *lexer1); + + // Destructor. + ~Parser(); + + // Get the next object from the input stream. + Object *getObj(Object *obj); + + // Get stream. + Stream *getStream() { return lexer->getStream(); } + + // Get current position in file. + int getPos() { return lexer->getPos(); } + +private: + + Lexer *lexer; // input stream + Object buf1, buf2; // next two tokens + int inlineImg; // set when inline image data is encountered + + Stream *makeStream(Object *dict); + void shift(); +}; + +#endif + diff --git a/pdf/xpdf/Stream-CCITT.h b/pdf/xpdf/Stream-CCITT.h new file mode 100644 index 00000000..fe337408 --- /dev/null +++ b/pdf/xpdf/Stream-CCITT.h @@ -0,0 +1,403 @@ +//======================================================================== +// +// Stream-CCITT.h +// +// Tables for CCITT Fax decoding. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +struct CCITTCode { + short bits; + short n; +}; + +#define ccittEOL -2 + +//------------------------------------------------------------------------ +// 2D codes +//------------------------------------------------------------------------ + +#define twoDimPass 0 +#define twoDimHoriz 1 +#define twoDimVert0 2 +#define twoDimVertR1 3 +#define twoDimVertL1 4 +#define twoDimVertR2 5 +#define twoDimVertL2 6 +#define twoDimVertR3 7 +#define twoDimVertL3 8 + +// 1-4 bit codes +static CCITTCode twoDimTab1[16] = { + {-1, -1}, // 0000 + {4, twoDimPass}, // 0001 + {3, twoDimHoriz}, {3, twoDimHoriz}, // 001x + {3, twoDimVertL1}, {3, twoDimVertL1}, // 010x + {3, twoDimVertR1}, {3, twoDimVertR1}, // 011x + {1, twoDimVert0}, {1, twoDimVert0}, // 1xxx + {1, twoDimVert0}, {1, twoDimVert0}, + {1, twoDimVert0}, {1, twoDimVert0}, + {1, twoDimVert0}, {1, twoDimVert0} +}; + +//------------------------------------------------------------------------ +// white run lengths +//------------------------------------------------------------------------ + +// 11-12 bit codes (upper 7 bits are 0) +static CCITTCode whiteTab1[32] = { + {-1, -1}, // 00000 + {12, ccittEOL}, // 00001 + {-1, -1}, {-1, -1}, // 0001x + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 001xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 010xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 011xx + {11, 1792}, {11, 1792}, // 1000x + {12, 1984}, // 10010 + {12, 2048}, // 10011 + {12, 2112}, // 10100 + {12, 2176}, // 10101 + {12, 2240}, // 10110 + {12, 2304}, // 10111 + {11, 1856}, {11, 1856}, // 1100x + {11, 1920}, {11, 1920}, // 1101x + {12, 2368}, // 11100 + {12, 2432}, // 11101 + {12, 2496}, // 11110 + {12, 2560} // 11111 +}; + +// 1-9 bit codes +static CCITTCode whiteTab2[512] = { + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 0000000xx + {8, 29}, {8, 29}, // 00000010x + {8, 30}, {8, 30}, // 00000011x + {8, 45}, {8, 45}, // 00000100x + {8, 46}, {8, 46}, // 00000101x + {7, 22}, {7, 22}, {7, 22}, {7, 22}, // 0000011xx + {7, 23}, {7, 23}, {7, 23}, {7, 23}, // 0000100xx + {8, 47}, {8, 47}, // 00001010x + {8, 48}, {8, 48}, // 00001011x + {6, 13}, {6, 13}, {6, 13}, {6, 13}, // 000011xxx + {6, 13}, {6, 13}, {6, 13}, {6, 13}, + {7, 20}, {7, 20}, {7, 20}, {7, 20}, // 0001000xx + {8, 33}, {8, 33}, // 00010010x + {8, 34}, {8, 34}, // 00010011x + {8, 35}, {8, 35}, // 00010100x + {8, 36}, {8, 36}, // 00010101x + {8, 37}, {8, 37}, // 00010110x + {8, 38}, {8, 38}, // 00010111x + {7, 19}, {7, 19}, {7, 19}, {7, 19}, // 0001100xx + {8, 31}, {8, 31}, // 00011010x + {8, 32}, {8, 32}, // 00011011x + {6, 1}, {6, 1}, {6, 1}, {6, 1}, // 000111xxx + {6, 1}, {6, 1}, {6, 1}, {6, 1}, + {6, 12}, {6, 12}, {6, 12}, {6, 12}, // 001000xxx + {6, 12}, {6, 12}, {6, 12}, {6, 12}, + {8, 53}, {8, 53}, // 00100100x + {8, 54}, {8, 54}, // 00100101x + {7, 26}, {7, 26}, {7, 26}, {7, 26}, // 0010011xx + {8, 39}, {8, 39}, // 00101000x + {8, 40}, {8, 40}, // 00101001x + {8, 41}, {8, 41}, // 00101010x + {8, 42}, {8, 42}, // 00101011x + {8, 43}, {8, 43}, // 00101100x + {8, 44}, {8, 44}, // 00101101x + {7, 21}, {7, 21}, {7, 21}, {7, 21}, // 0010111xx + {7, 28}, {7, 28}, {7, 28}, {7, 28}, // 0011000xx + {8, 61}, {8, 61}, // 00110010x + {8, 62}, {8, 62}, // 00110011x + {8, 63}, {8, 63}, // 00110100x + {8, 0}, {8, 0}, // 00110101x + {8, 320}, {8, 320}, // 00110110x + {8, 384}, {8, 384}, // 00110111x + {5, 10}, {5, 10}, {5, 10}, {5, 10}, // 00111xxxx + {5, 10}, {5, 10}, {5, 10}, {5, 10}, + {5, 10}, {5, 10}, {5, 10}, {5, 10}, + {5, 10}, {5, 10}, {5, 10}, {5, 10}, + {5, 11}, {5, 11}, {5, 11}, {5, 11}, // 01000xxxx + {5, 11}, {5, 11}, {5, 11}, {5, 11}, + {5, 11}, {5, 11}, {5, 11}, {5, 11}, + {5, 11}, {5, 11}, {5, 11}, {5, 11}, + {7, 27}, {7, 27}, {7, 27}, {7, 27}, // 0100100xx + {8, 59}, {8, 59}, // 01001010x + {8, 60}, {8, 60}, // 01001011x + {9, 1472}, // 010011000 + {9, 1536}, // 010011001 + {9, 1600}, // 010011010 + {9, 1728}, // 010011011 + {7, 18}, {7, 18}, {7, 18}, {7, 18}, // 0100111xx + {7, 24}, {7, 24}, {7, 24}, {7, 24}, // 0101000xx + {8, 49}, {8, 49}, // 01010010x + {8, 50}, {8, 50}, // 01010011x + {8, 51}, {8, 51}, // 01010100x + {8, 52}, {8, 52}, // 01010101x + {7, 25}, {7, 25}, {7, 25}, {7, 25}, // 0101011xx + {8, 55}, {8, 55}, // 01011000x + {8, 56}, {8, 56}, // 01011001x + {8, 57}, {8, 57}, // 01011010x + {8, 58}, {8, 58}, // 01011011x + {6, 192}, {6, 192}, {6, 192}, {6, 192}, // 010111xxx + {6, 192}, {6, 192}, {6, 192}, {6, 192}, + {6, 1664}, {6, 1664}, {6, 1664}, {6, 1664}, // 011000xxx + {6, 1664}, {6, 1664}, {6, 1664}, {6, 1664}, + {8, 448}, {8, 448}, // 01100100x + {8, 512}, {8, 512}, // 01100101x + {9, 704}, // 011001100 + {9, 768}, // 011001101 + {8, 640}, {8, 640}, // 01100111x + {8, 576}, {8, 576}, // 01101000x + {9, 832}, // 011010010 + {9, 896}, // 011010011 + {9, 960}, // 011010100 + {9, 1024}, // 011010101 + {9, 1088}, // 011010110 + {9, 1152}, // 011010111 + {9, 1216}, // 011011000 + {9, 1280}, // 011011001 + {9, 1344}, // 011011010 + {9, 1408}, // 011011011 + {7, 256}, {7, 256}, {7, 256}, {7, 256}, // 0110111xx + {4, 2}, {4, 2}, {4, 2}, {4, 2}, // 0111xxxxx + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 2}, {4, 2}, {4, 2}, {4, 2}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, // 1000xxxxx + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {4, 3}, {4, 3}, {4, 3}, {4, 3}, + {5, 128}, {5, 128}, {5, 128}, {5, 128}, // 10010xxxx + {5, 128}, {5, 128}, {5, 128}, {5, 128}, + {5, 128}, {5, 128}, {5, 128}, {5, 128}, + {5, 128}, {5, 128}, {5, 128}, {5, 128}, + {5, 8}, {5, 8}, {5, 8}, {5, 8}, // 10011xxxx + {5, 8}, {5, 8}, {5, 8}, {5, 8}, + {5, 8}, {5, 8}, {5, 8}, {5, 8}, + {5, 8}, {5, 8}, {5, 8}, {5, 8}, + {5, 9}, {5, 9}, {5, 9}, {5, 9}, // 10100xxxx + {5, 9}, {5, 9}, {5, 9}, {5, 9}, + {5, 9}, {5, 9}, {5, 9}, {5, 9}, + {5, 9}, {5, 9}, {5, 9}, {5, 9}, + {6, 16}, {6, 16}, {6, 16}, {6, 16}, // 101010xxx + {6, 16}, {6, 16}, {6, 16}, {6, 16}, + {6, 17}, {6, 17}, {6, 17}, {6, 17}, // 101011xxx + {6, 17}, {6, 17}, {6, 17}, {6, 17}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, // 1011xxxxx + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 4}, {4, 4}, {4, 4}, {4, 4}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, // 1100xxxxx + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {4, 5}, {4, 5}, {4, 5}, {4, 5}, + {6, 14}, {6, 14}, {6, 14}, {6, 14}, // 110100xxx + {6, 14}, {6, 14}, {6, 14}, {6, 14}, + {6, 15}, {6, 15}, {6, 15}, {6, 15}, // 110101xxx + {6, 15}, {6, 15}, {6, 15}, {6, 15}, + {5, 64}, {5, 64}, {5, 64}, {5, 64}, // 11011xxxx + {5, 64}, {5, 64}, {5, 64}, {5, 64}, + {5, 64}, {5, 64}, {5, 64}, {5, 64}, + {5, 64}, {5, 64}, {5, 64}, {5, 64}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, // 1110xxxxx + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 6}, {4, 6}, {4, 6}, {4, 6}, + {4, 7}, {4, 7}, {4, 7}, {4, 7}, // 1111xxxxx + {4, 7}, {4, 7}, {4, 7}, {4, 7}, + {4, 7}, {4, 7}, {4, 7}, {4, 7}, + {4, 7}, {4, 7}, {4, 7}, {4, 7}, + {4, 7}, {4, 7}, {4, 7}, {4, 7}, + {4, 7}, {4, 7}, {4, 7}, {4, 7}, + {4, 7}, {4, 7}, {4, 7}, {4, 7}, + {4, 7}, {4, 7}, {4, 7}, {4, 7} +}; + +//------------------------------------------------------------------------ +// black run lengths +//------------------------------------------------------------------------ + +// 10-13 bit codes (upper 6 bits are 0) +static CCITTCode blackTab1[128] = { + {-1, -1}, {-1, -1}, // 000000000000x + {12, ccittEOL}, {12, ccittEOL}, // 000000000001x + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000001xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000010xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000011xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000100xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000101xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000110xx + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 00000000111xx + {11, 1792}, {11, 1792}, {11, 1792}, {11, 1792}, // 00000001000xx + {12, 1984}, {12, 1984}, // 000000010010x + {12, 2048}, {12, 2048}, // 000000010011x + {12, 2112}, {12, 2112}, // 000000010100x + {12, 2176}, {12, 2176}, // 000000010101x + {12, 2240}, {12, 2240}, // 000000010110x + {12, 2304}, {12, 2304}, // 000000010111x + {11, 1856}, {11, 1856}, {11, 1856}, {11, 1856}, // 00000001100xx + {11, 1920}, {11, 1920}, {11, 1920}, {11, 1920}, // 00000001101xx + {12, 2368}, {12, 2368}, // 000000011100x + {12, 2432}, {12, 2432}, // 000000011101x + {12, 2496}, {12, 2496}, // 000000011110x + {12, 2560}, {12, 2560}, // 000000011111x + {10, 18}, {10, 18}, {10, 18}, {10, 18}, // 0000001000xxx + {10, 18}, {10, 18}, {10, 18}, {10, 18}, + {12, 52}, {12, 52}, // 000000100100x + {13, 640}, // 0000001001010 + {13, 704}, // 0000001001011 + {13, 768}, // 0000001001100 + {13, 832}, // 0000001001101 + {12, 55}, {12, 55}, // 000000100111x + {12, 56}, {12, 56}, // 000000101000x + {13, 1280}, // 0000001010010 + {13, 1344}, // 0000001010011 + {13, 1408}, // 0000001010100 + {13, 1472}, // 0000001010101 + {12, 59}, {12, 59}, // 000000101011x + {12, 60}, {12, 60}, // 000000101100x + {13, 1536}, // 0000001011010 + {13, 1600}, // 0000001011011 + {11, 24}, {11, 24}, {11, 24}, {11, 24}, // 00000010111xx + {11, 25}, {11, 25}, {11, 25}, {11, 25}, // 00000011000xx + {13, 1664}, // 0000001100100 + {13, 1728}, // 0000001100101 + {12, 320}, {12, 320}, // 000000110011x + {12, 384}, {12, 384}, // 000000110100x + {12, 448}, {12, 448}, // 000000110101x + {13, 512}, // 0000001101100 + {13, 576}, // 0000001101101 + {12, 53}, {12, 53}, // 000000110111x + {12, 54}, {12, 54}, // 000000111000x + {13, 896}, // 0000001110010 + {13, 960}, // 0000001110011 + {13, 1024}, // 0000001110100 + {13, 1088}, // 0000001110101 + {13, 1152}, // 0000001110110 + {13, 1216}, // 0000001110111 + {10, 64}, {10, 64}, {10, 64}, {10, 64}, // 0000001111xxx + {10, 64}, {10, 64}, {10, 64}, {10, 64} +}; + +// 7-12 bit codes (upper 4 bits are 0) +static CCITTCode blackTab2[192] = { + {8, 13}, {8, 13}, {8, 13}, {8, 13}, // 00000100xxxx + {8, 13}, {8, 13}, {8, 13}, {8, 13}, + {8, 13}, {8, 13}, {8, 13}, {8, 13}, + {8, 13}, {8, 13}, {8, 13}, {8, 13}, + {11, 23}, {11, 23}, // 00000101000x + {12, 50}, // 000001010010 + {12, 51}, // 000001010011 + {12, 44}, // 000001010100 + {12, 45}, // 000001010101 + {12, 46}, // 000001010110 + {12, 47}, // 000001010111 + {12, 57}, // 000001011000 + {12, 58}, // 000001011001 + {12, 61}, // 000001011010 + {12, 256}, // 000001011011 + {10, 16}, {10, 16}, {10, 16}, {10, 16}, // 0000010111xx + {10, 17}, {10, 17}, {10, 17}, {10, 17}, // 0000011000xx + {12, 48}, // 000001100100 + {12, 49}, // 000001100101 + {12, 62}, // 000001100110 + {12, 63}, // 000001100111 + {12, 30}, // 000001101000 + {12, 31}, // 000001101001 + {12, 32}, // 000001101010 + {12, 33}, // 000001101011 + {12, 40}, // 000001101100 + {12, 41}, // 000001101101 + {11, 22}, {11, 22}, // 00000110111x + {8, 14}, {8, 14}, {8, 14}, {8, 14}, // 00000111xxxx + {8, 14}, {8, 14}, {8, 14}, {8, 14}, + {8, 14}, {8, 14}, {8, 14}, {8, 14}, + {8, 14}, {8, 14}, {8, 14}, {8, 14}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, // 0000100xxxxx + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 10}, {7, 10}, {7, 10}, {7, 10}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, // 0000101xxxxx + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {7, 11}, {7, 11}, {7, 11}, {7, 11}, + {9, 15}, {9, 15}, {9, 15}, {9, 15}, // 000011000xxx + {9, 15}, {9, 15}, {9, 15}, {9, 15}, + {12, 128}, // 000011001000 + {12, 192}, // 000011001001 + {12, 26}, // 000011001010 + {12, 27}, // 000011001011 + {12, 28}, // 000011001100 + {12, 29}, // 000011001101 + {11, 19}, {11, 19}, // 00001100111x + {11, 20}, {11, 20}, // 00001101000x + {12, 34}, // 000011010010 + {12, 35}, // 000011010011 + {12, 36}, // 000011010100 + {12, 37}, // 000011010101 + {12, 38}, // 000011010110 + {12, 39}, // 000011010111 + {11, 21}, {11, 21}, // 00001101100x + {12, 42}, // 000011011010 + {12, 43}, // 000011011011 + {10, 0}, {10, 0}, {10, 0}, {10, 0}, // 0000110111xx + {7, 12}, {7, 12}, {7, 12}, {7, 12}, // 0000111xxxxx + {7, 12}, {7, 12}, {7, 12}, {7, 12}, + {7, 12}, {7, 12}, {7, 12}, {7, 12}, + {7, 12}, {7, 12}, {7, 12}, {7, 12}, + {7, 12}, {7, 12}, {7, 12}, {7, 12}, + {7, 12}, {7, 12}, {7, 12}, {7, 12}, + {7, 12}, {7, 12}, {7, 12}, {7, 12}, + {7, 12}, {7, 12}, {7, 12}, {7, 12} +}; + +// 2-6 bit codes +static CCITTCode blackTab3[64] = { + {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, // 0000xx + {6, 9}, // 000100 + {6, 8}, // 000101 + {5, 7}, {5, 7}, // 00011x + {4, 6}, {4, 6}, {4, 6}, {4, 6}, // 0010xx + {4, 5}, {4, 5}, {4, 5}, {4, 5}, // 0011xx + {3, 1}, {3, 1}, {3, 1}, {3, 1}, // 010xxx + {3, 1}, {3, 1}, {3, 1}, {3, 1}, + {3, 4}, {3, 4}, {3, 4}, {3, 4}, // 011xxx + {3, 4}, {3, 4}, {3, 4}, {3, 4}, + {2, 3}, {2, 3}, {2, 3}, {2, 3}, // 10xxxx + {2, 3}, {2, 3}, {2, 3}, {2, 3}, + {2, 3}, {2, 3}, {2, 3}, {2, 3}, + {2, 3}, {2, 3}, {2, 3}, {2, 3}, + {2, 2}, {2, 2}, {2, 2}, {2, 2}, // 11xxxx + {2, 2}, {2, 2}, {2, 2}, {2, 2}, + {2, 2}, {2, 2}, {2, 2}, {2, 2}, + {2, 2}, {2, 2}, {2, 2}, {2, 2} +}; diff --git a/pdf/xpdf/Stream.cc b/pdf/xpdf/Stream.cc new file mode 100644 index 00000000..d7040cee --- /dev/null +++ b/pdf/xpdf/Stream.cc @@ -0,0 +1,2987 @@ +//======================================================================== +// +// Stream.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#ifndef WIN32 +#include +#endif +#include +#include +#include "gmem.h" +#include "config.h" +#include "Error.h" +#include "Object.h" +#include "Stream.h" +#include "Stream-CCITT.h" + +#ifdef VMS +#if (__VMS_VER < 70000000) +extern "C" int unlink(char *filename); +#endif +#ifdef __GNUC__ +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#endif +#endif + +//------------------------------------------------------------------------ + +#define headerSearchSize 1024 // read this many bytes at beginning of + // file to look for '%PDF' + +//------------------------------------------------------------------------ +// Stream (base class) +//------------------------------------------------------------------------ + +Stream::Stream() { + ref = 1; + predictor = 1; + rawLine = NULL; + pixLine = NULL; +} + +Stream::~Stream() { + gfree(rawLine); + gfree(pixLine); +} + +void Stream::resetImage(int width1, int nComps1, int nBits1) { + reset(); + if (predictor > 1 && + (width1 != width || nComps != nComps || nBits1 != nBits)) + error(-1, "Mismatched image parameters in predictor"); + width = width1; + nComps = nComps1; + nBits = nBits1; + nVals = width * nComps; + pixBytes = (nComps * nBits + 7) >> 3; + rowBytes = (nVals * nBits + 7) >> 3; + rawLine = (Guchar *)grealloc(rawLine, rowBytes + pixBytes); + memset(rawLine, 0, rowBytes); + pixLine = (Guchar *)grealloc(pixLine, ((nVals + 7) & ~7) * sizeof(Guchar)); + pixIdx = nVals; +} + +char *Stream::getLine(char *buf, int size) { + int i; + int c; + + if (lookChar() == EOF) + return NULL; + for (i = 0; i < size - 1; ++i) { + c = getChar(); + if (c == EOF || c == '\n') + break; + if (c == '\r') { + if ((c = lookChar()) == '\n') + getChar(); + break; + } + buf[i] = c; + } + buf[i] = '\0'; + return buf; +} + +GBool Stream::getImagePixel(Guchar *pix) { + int curPred; + int left, up, upLeft, p, pa, pb, pc; + Guchar upLeftBuf[4]; + Gulong buf, bitMask; + int c; + int bits; + int i, j; + + // read an image line + if (pixIdx >= nVals) { + + // get PNG optimum predictor number + if (predictor == 15) { + if ((curPred = getChar()) == EOF) + return EOF; + curPred += 10; + } else { + curPred = predictor; + } + + // read the raw line, apply byte predictor + upLeftBuf[0] = upLeftBuf[1] = upLeftBuf[2] = upLeftBuf[3] = 0; + for (i = 0; i < rowBytes; ++i) { + upLeftBuf[3] = upLeftBuf[2]; + upLeftBuf[2] = upLeftBuf[1]; + upLeftBuf[1] = upLeftBuf[0]; + upLeftBuf[0] = rawLine[pixBytes+i]; + if ((c = getChar()) == EOF) + return EOF; + switch (curPred) { + case 11: // PNG sub + rawLine[pixBytes+i] = rawLine[i] + (Guchar)c; + break; + case 12: // PNG up + rawLine[pixBytes+i] = rawLine[pixBytes+i] + (Guchar)c; + break; + case 13: // PNG average + rawLine[pixBytes+i] = ((rawLine[i] + rawLine[pixBytes+i]) >> 1) + + (Guchar)c; + break; + case 14: // PNG Paeth + left = rawLine[i]; + up = rawLine[pixBytes+i]; + upLeft = upLeftBuf[pixBytes]; + p = left + up - upLeft; + if ((pa = p - left) < 0) + pa = -pa; + if ((pb = p - up) < 0) + pb = -pb; + if ((pc = p - upLeft) < 0) + pc = -pc; + if (pa <= pb && pa <= pc) + rawLine[pixBytes+i] = pa + (Guchar)c; + else if (pb <= pc) + rawLine[pixBytes+i] = pb + (Guchar)c; + else + rawLine[pixBytes+i] = pc + (Guchar)c; + break; + case 10: // PNG none + default: // no predictor or TIFF predictor + rawLine[pixBytes+i] = (Guchar)c; + break; + } + } + + // convert into pixels, apply component predictor + if (predictor == 2) { + if (nBits == 1) { + for (i = 0, j = pixBytes; i < nVals; i += 8, ++j) { + c = rawLine[j]; + pixLine[i+0] = (Guchar)((pixLine[i+0] + (c >> 7)) & 1); + pixLine[i+1] = (Guchar)((pixLine[i+1] + (c >> 6)) & 1); + pixLine[i+2] = (Guchar)((pixLine[i+2] + (c >> 5)) & 1); + pixLine[i+3] = (Guchar)((pixLine[i+3] + (c >> 4)) & 1); + pixLine[i+4] = (Guchar)((pixLine[i+4] + (c >> 3)) & 1); + pixLine[i+5] = (Guchar)((pixLine[i+5] + (c >> 2)) & 1); + pixLine[i+6] = (Guchar)((pixLine[i+6] + (c >> 1)) & 1); + pixLine[i+7] = (Guchar)((pixLine[i+7] + c) & 1); + } + } else if (nBits == 8) { + for (i = 0, j = pixBytes; i < nVals; ++i, ++j) + pixLine[i] = pixLine[i] + rawLine[j]; + } else { + bitMask = (1 << nBits) - 1; + buf = 0; + bits = 0; + j = pixBytes; + for (i = 0; i < nVals; ++i) { + if (bits < nBits) { + buf = (buf << 8) | (rawLine[j++] & 0xff); + bits += 8; + } + pixLine[i] = (Guchar)((pixLine[i] + + (buf >> (bits - nBits))) & bitMask); + bits -= nBits; + } + } + } else { + if (nBits == 1) { + for (i = 0, j = pixBytes; i < nVals; i += 8, ++j) { + c = rawLine[j]; + pixLine[i+0] = (Guchar)((c >> 7) & 1); + pixLine[i+1] = (Guchar)((c >> 6) & 1); + pixLine[i+2] = (Guchar)((c >> 5) & 1); + pixLine[i+3] = (Guchar)((c >> 4) & 1); + pixLine[i+4] = (Guchar)((c >> 3) & 1); + pixLine[i+5] = (Guchar)((c >> 2) & 1); + pixLine[i+6] = (Guchar)((c >> 1) & 1); + pixLine[i+7] = (Guchar)(c & 1); + } + } else if (nBits == 8) { + for (i = 0, j = pixBytes; i < nVals; ++i, ++j) + pixLine[i] = rawLine[j]; + } else { + bitMask = (1 << nBits) - 1; + buf = 0; + bits = 0; + j = pixBytes; + for (i = 0; i < nVals; ++i) { + if (bits < nBits) { + buf = (buf << 8) | (rawLine[j++] & 0xff); + bits += 8; + } + pixLine[i] = (Guchar)((buf >> (bits - nBits)) & bitMask); + bits -= nBits; + } + } + } + + // read from start of line + pixIdx = 0; + } + + for (i = 0; i < nComps; ++i) + pix[i] = pixLine[pixIdx++]; + return gTrue; +} + +void Stream::skipImageLine() { + int n, i; + + n = (nVals * nBits + 7) / 8; + for (i = 0; i < n; ++i) + getChar(); + pixIdx = nVals; +} + +void Stream::setPos(int pos) { + error(-1, "Internal: called setPos() on non-FileStream"); +} + +GString *Stream::getPSFilter(char *indent) { + return new GString(); +} + +Stream *Stream::addFilters(Object *dict) { + Object obj, obj2; + Object params, params2; + Stream *str; + int i; + + str = this; + dict->dictLookup("Filter", &obj); + if (obj.isNull()) { + obj.free(); + dict->dictLookup("F", &obj); + } + dict->dictLookup("DecodeParms", ¶ms); + if (params.isNull()) { + params.free(); + dict->dictLookup("DP", ¶ms); + } + if (obj.isName()) { + str = makeFilter(obj.getName(), str, ¶ms); + } else if (obj.isArray()) { + for (i = 0; i < obj.arrayGetLength(); ++i) { + obj.arrayGet(i, &obj2); + if (params.isArray()) + params.arrayGet(i, ¶ms2); + else + params2.initNull(); + if (obj2.isName()) { + str = makeFilter(obj2.getName(), str, ¶ms2); + } else { + error(getPos(), "Bad filter name"); + str = new EOFStream(str); + } + obj2.free(); + params2.free(); + } + } else if (!obj.isNull()) { + error(getPos(), "Bad 'Filter' attribute in stream"); + } + obj.free(); + params.free(); + + return str; +} + +Stream *Stream::makeFilter(char *name, Stream *str, Object *params) { + int pred; // parameters + int colors; + int bits; + int early; + int encoding; + GBool byteAlign; + GBool black; + int columns, rows; + Object obj; + + if (!strcmp(name, "ASCIIHexDecode") || !strcmp(name, "AHx")) { + str = new ASCIIHexStream(str); + } else if (!strcmp(name, "ASCII85Decode") || !strcmp(name, "A85")) { + str = new ASCII85Stream(str); + } else if (!strcmp(name, "LZWDecode") || !strcmp(name, "LZW")) { + pred = 1; + columns = 1; + colors = 1; + bits = 8; + early = 1; + if (params->isDict()) { + params->dictLookup("Predictor", &obj); + if (obj.isInt()) + pred = obj.getInt(); + obj.free(); + params->dictLookup("Columns", &obj); + if (obj.isInt()) + columns = obj.getInt(); + obj.free(); + params->dictLookup("Colors", &obj); + if (obj.isInt()) + colors = obj.getInt(); + obj.free(); + params->dictLookup("BitsPerComponent", &obj); + if (obj.isInt()) + bits = obj.getInt(); + obj.free(); + params->dictLookup("EarlyChange", &obj); + if (obj.isInt()) + early = obj.getInt(); + obj.free(); + } + str = new LZWStream(str, pred, columns, colors, bits, early); + } else if (!strcmp(name, "RunLengthDecode") || !strcmp(name, "RL")) { + str = new RunLengthStream(str); + } else if (!strcmp(name, "CCITTFaxDecode") || !strcmp(name, "CCF")) { + encoding = 0; + byteAlign = gFalse; + columns = 1728; + rows = 0; + black = gFalse; + if (params->isDict()) { + params->dictLookup("K", &obj); + if (obj.isInt()) + encoding = obj.getInt(); + obj.free(); + params->dictLookup("EncodedByteAlign", &obj); + if (obj.isBool()) + byteAlign = obj.getBool(); + obj.free(); + params->dictLookup("Columns", &obj); + if (obj.isInt()) + columns = obj.getInt(); + obj.free(); + params->dictLookup("Rows", &obj); + if (obj.isInt()) + rows = obj.getInt(); + obj.free(); + params->dictLookup("BlackIs1", &obj); + if (obj.isBool()) + black = obj.getBool(); + obj.free(); + } + str = new CCITTFaxStream(str, encoding, byteAlign, columns, rows, black); + } else if (!strcmp(name, "DCTDecode") || !strcmp(name, "DCT")) { + str = new DCTStream(str); + } else if (!strcmp(name, "FlateDecode") || !strcmp(name, "Fl")) { + pred = 1; + columns = 1; + colors = 1; + bits = 8; + if (params->isDict()) { + params->dictLookup("Predictor", &obj); + if (obj.isInt()) + pred = obj.getInt(); + obj.free(); + params->dictLookup("Columns", &obj); + if (obj.isInt()) + columns = obj.getInt(); + obj.free(); + params->dictLookup("Colors", &obj); + if (obj.isInt()) + colors = obj.getInt(); + obj.free(); + params->dictLookup("BitsPerComponent", &obj); + if (obj.isInt()) + bits = obj.getInt(); + obj.free(); + } + str = new FlateStream(str, pred, columns, colors, bits); + } else { + error(getPos(), "Unknown filter '%s'", name); + str = new EOFStream(str); + } + return str; +} + +//------------------------------------------------------------------------ +// FileStream +//------------------------------------------------------------------------ + +FileStream::FileStream(FILE *f1, int start1, int length1, Object *dict1) { + f = f1; + start = start1; + length = length1; + bufPtr = bufEnd = buf; + bufPos = start; + savePos = -1; + dict = *dict1; +} + +FileStream::~FileStream() { + if (savePos >= 0) + fseek(f, savePos, SEEK_SET); + dict.free(); +} + +void FileStream::reset() { + savePos = (int)ftell(f); + fseek(f, start, SEEK_SET); + bufPtr = bufEnd = buf; + bufPos = start; +} + +GBool FileStream::fillBuf() { + int n; + + bufPos += bufEnd - buf; + bufPtr = bufEnd = buf; + if (length >= 0 && bufPos >= start + length) + return gFalse; + if (length >= 0 && bufPos + 256 > start + length) + n = start + length - bufPos; + else + n = 256; + n = fread(buf, 1, n, f); + bufEnd = buf + n; + if (bufPtr >= bufEnd) + return gFalse; + return gTrue; +} + +void FileStream::setPos(int pos1) { + long size; + + if (pos1 >= 0) { + fseek(f, pos1, SEEK_SET); + bufPos = pos1; + } else { + fseek(f, 0, SEEK_END); + size = ftell(f); + if (pos1 < -size) + pos1 = (int)(-size); + fseek(f, pos1, SEEK_END); + bufPos = (int)ftell(f); + } + bufPtr = bufEnd = buf; +} + +GBool FileStream::checkHeader() { + char hdrBuf[headerSearchSize+1]; + char *p; + double version; + int i; + + for (i = 0; i < headerSearchSize; ++i) + hdrBuf[i] = getChar(); + hdrBuf[headerSearchSize] = '\0'; + for (i = 0; i < headerSearchSize - 5; ++i) { + if (!strncmp(&hdrBuf[i], "%PDF-", 5)) + break; + } + if (i >= headerSearchSize - 5) { + error(-1, "May not be a PDF file (continuing anyway)"); + return gFalse; + } + start += i; + p = strtok(&hdrBuf[i+5], " \t\n\r"); + version = atof(p); + if (!(hdrBuf[i+5] >= '0' && hdrBuf[i+5] <= '9') || version > pdfVersionNum) { + error(getPos(), "PDF version %s -- xpdf supports version %s" + " (continuing anyway)", p, pdfVersion); + return gFalse; + } + return gTrue; +} + +//------------------------------------------------------------------------ +// SubStream +//------------------------------------------------------------------------ + +SubStream::SubStream(Stream *str1, Object *dict1) { + str = str1; + dict = *dict1; +} + +SubStream::~SubStream() { + dict.free(); +} + +//------------------------------------------------------------------------ +// ASCIIHexStream +//------------------------------------------------------------------------ + +ASCIIHexStream::ASCIIHexStream(Stream *str1) { + str = str1; + buf = EOF; + eof = gFalse; +} + +ASCIIHexStream::~ASCIIHexStream() { + delete str; +} + +void ASCIIHexStream::reset() { + str->reset(); + buf = EOF; + eof = gFalse; +} + +int ASCIIHexStream::lookChar() { + int c1, c2, x; + + if (buf != EOF) + return buf; + if (eof) { + buf = EOF; + return EOF; + } + do { + c1 = str->getChar(); + } while (isspace(c1)); + if (c1 == '>') { + eof = gTrue; + buf = EOF; + return buf; + } + do { + c2 = str->getChar(); + } while (isspace(c2)); + if (c2 == '>') { + eof = gTrue; + c2 = '0'; + } + if (c1 >= '0' && c1 <= '9') { + x = (c1 - '0') << 4; + } else if (c1 >= 'A' && c1 <= 'F') { + x = (c1 - 'A' + 10) << 4; + } else if (c1 >= 'a' && c1 <= 'f') { + x = (c1 - 'a' + 10) << 4; + } else if (c1 == EOF) { + eof = gTrue; + x = 0; + } else { + error(getPos(), "Illegal character <%02x> in ASCIIHex stream", c1); + x = 0; + } + if (c2 >= '0' && c2 <= '9') { + x += c2 - '0'; + } else if (c2 >= 'A' && c2 <= 'F') { + x += c2 - 'A' + 10; + } else if (c2 >= 'a' && c2 <= 'f') { + x += c2 - 'a' + 10; + } else if (c2 == EOF) { + eof = gTrue; + x = 0; + } else { + error(getPos(), "Illegal character <%02x> in ASCIIHex stream", c2); + } + buf = x & 0xff; + return buf; +} + +GString *ASCIIHexStream::getPSFilter(char *indent) { + GString *s; + + s = str->getPSFilter(indent); + s->append(indent)->append("/ASCIIHexDecode filter\n"); + return s; +} + +GBool ASCIIHexStream::isBinary(GBool last) { + return str->isBinary(gFalse); +} + +//------------------------------------------------------------------------ +// ASCII85Stream +//------------------------------------------------------------------------ + +ASCII85Stream::ASCII85Stream(Stream *str1) { + str = str1; + index = n = 0; + eof = gFalse; +} + +ASCII85Stream::~ASCII85Stream() { + delete str; +} + +void ASCII85Stream::reset() { + str->reset(); + index = n = 0; + eof = gFalse; +} + +int ASCII85Stream::lookChar() { + int k; + Gulong t; + + if (index >= n) { + if (eof) + return EOF; + index = 0; + do { + c[0] = str->getChar(); + } while (c[0] == '\n' || c[0] == '\r'); + if (c[0] == '~' || c[0] == EOF) { + eof = gTrue; + n = 0; + return EOF; + } else if (c[0] == 'z') { + b[0] = b[1] = b[2] = b[3] = 0; + n = 4; + } else { + for (k = 1; k < 5; ++k) { + do { + c[k] = str->getChar(); + } while (c[k] == '\n' || c[k] == '\r'); + if (c[k] == '~' || c[k] == EOF) + break; + } + n = k - 1; + if (k < 5 && (c[k] == '~' || c[k] == EOF)) { + for (++k; k < 5; ++k) + c[k] = 0x21 + 84; + eof = gTrue; + } + t = 0; + for (k = 0; k < 5; ++k) + t = t * 85 + (c[k] - 0x21); + for (k = 3; k >= 0; --k) { + b[k] = (int)(t & 0xff); + t >>= 8; + } + } + } + return b[index]; +} + +GString *ASCII85Stream::getPSFilter(char *indent) { + GString *s; + + s = str->getPSFilter(indent); + s->append(indent)->append("/ASCII85Decode filter\n"); + return s; +} + +GBool ASCII85Stream::isBinary(GBool last) { + return str->isBinary(gFalse); +} + +//------------------------------------------------------------------------ +// LZWStream +//------------------------------------------------------------------------ + +LZWStream::LZWStream(Stream *str1, int predictor1, int columns1, int colors1, + int bits1, int early1) { + str = str1; + predictor = predictor1; + if (predictor1 > 1) { + width = columns1; + nComps = colors1; + nBits = bits1; + } + early = early1; + zPipe = NULL; + bufPtr = bufEnd = buf; +} + +LZWStream::~LZWStream() { + if (zPipe) { +#ifdef HAVE_POPEN + pclose(zPipe); +#else + fclose(zPipe); +#endif + zPipe = NULL; + unlink(zName); + } + delete str; +} + +int LZWStream::getChar() { + return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); +} + +int LZWStream::lookChar() { + return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); +} + +void LZWStream::reset() { + FILE *f; + + str->reset(); + bufPtr = bufEnd = buf; + if (zPipe) { +#ifdef HAVE_POPEN + pclose(zPipe); +#else + fclose(zPipe); +#endif + zPipe = NULL; + unlink(zName); + } + strcpy(zCmd, uncompressCmd); + strcat(zCmd, " "); + zName = zCmd + strlen(zCmd); + tmpnam(zName); + strcat(zName, ".Z"); + if (!(f = fopen(zName, "wb"))) { + error(getPos(), "Couldn't open temporary file '%s'", zName); + return; + } + dumpFile(f); + fclose(f); +#ifdef HAVE_POPEN + if (!(zPipe = popen(zCmd, "r"))) { + error(getPos(), "Couldn't popen '%s'", zCmd); + unlink(zName); + return; + } +#else +#ifdef VMS + if (!system(zCmd)) { +#else + if (system(zCmd)) { +#endif + error(getPos(), "Couldn't execute '%s'", zCmd); + unlink(zName); + return; + } + zName[strlen(zName) - 2] = '\0'; + if (!(zPipe = fopen(zName, "rb"))) { + error(getPos(), "Couldn't open uncompress file '%s'", zName); + unlink(zName); + return; + } +#endif +} + +void LZWStream::dumpFile(FILE *f) { + int outCodeBits; // size of output code + int outBits; // max output code + int outBuf[8]; // output buffer + int outData; // temporary output buffer + int inCode, outCode; // input and output codes + int nextCode; // next code index + GBool eof; // set when EOF is reached + GBool clear; // set if table needs to be cleared + GBool first; // indicates first code word after clear + int i, j; + + // magic number + fputc(0x1f, f); + fputc(0x9d, f); + + // max code length, block mode flag + fputc(0x8c, f); + + // init input side + inCodeBits = 9; + inputBuf = 0; + inputBits = 0; + eof = gFalse; + + // init output side + outCodeBits = 9; + + // clear table + first = gTrue; + nextCode = 258; + + clear = gFalse; + do { + for (i = 0; i < 8; ++i) { + // check for table overflow + if (nextCode + early > 0x1001) { + inCode = 256; + + // read input code + } else { + do { + inCode = getCode(); + if (inCode == EOF) { + eof = gTrue; + inCode = 0; + } + } while (first && inCode == 256); + } + + // compute output code + if (inCode < 256) { + outCode = inCode; + } else if (inCode == 256) { + outCode = 256; + clear = gTrue; + } else if (inCode == 257) { + outCode = 0; + eof = gTrue; + } else { + outCode = inCode - 1; + } + outBuf[i] = outCode; + + // next code index + if (first) + first = gFalse; + else + ++nextCode; + + // check input code size + if (nextCode + early == 0x200) + inCodeBits = 10; + else if (nextCode + early == 0x400) { + inCodeBits = 11; + } else if (nextCode + early == 0x800) { + inCodeBits = 12; + } + + // check for eof/clear + if (eof) + break; + if (clear) { + i = 8; + break; + } + } + + // write output block + outData = 0; + outBits = 0; + j = 0; + while (j < i || outBits > 0) { + if (outBits < 8 && j < i) { + outData = outData | (outBuf[j++] << outBits); + outBits += outCodeBits; + } + fputc(outData & 0xff, f); + outData >>= 8; + outBits -= 8; + } + + // check output code size + if (nextCode - 1 == 512 || + nextCode - 1 == 1024 || + nextCode - 1 == 2048 || + nextCode - 1 == 4096) { + outCodeBits = inCodeBits; + } + + // clear table if necessary + if (clear) { + inCodeBits = 9; + outCodeBits = 9; + first = gTrue; + nextCode = 258; + clear = gFalse; + } + } while (!eof); +} + +int LZWStream::getCode() { + int c; + int code; + + while (inputBits < inCodeBits) { + if ((c = str->getChar()) == EOF) + return EOF; + inputBuf = (inputBuf << 8) | (c & 0xff); + inputBits += 8; + } + code = (inputBuf >> (inputBits - inCodeBits)) & ((1 << inCodeBits) - 1); + inputBits -= inCodeBits; + return code; +} + +GBool LZWStream::fillBuf() { + int n; + + if (!zPipe) + return gFalse; + if ((n = fread(buf, 1, 256, zPipe)) < 256) { +#ifdef HAVE_POPEN + pclose(zPipe); +#else + fclose(zPipe); +#endif + zPipe = NULL; + unlink(zName); + } + bufPtr = buf; + bufEnd = buf + n; + return n > 0; +} + +GString *LZWStream::getPSFilter(char *indent) { + GString *s; + + s = str->getPSFilter(indent); + s->append(indent)->append("/LZWDecode filter\n"); + return s; +} + +GBool LZWStream::isBinary(GBool last) { + return str->isBinary(gTrue); +} + +//------------------------------------------------------------------------ +// RunLengthStream +//------------------------------------------------------------------------ + +RunLengthStream::RunLengthStream(Stream *str1) { + str = str1; + bufPtr = bufEnd = buf; + eof = gFalse; +} + +RunLengthStream::~RunLengthStream() { + delete str; +} + +void RunLengthStream::reset() { + str->reset(); + bufPtr = bufEnd = buf; + eof = gFalse; +} + +GString *RunLengthStream::getPSFilter(char *indent) { + GString *s; + + s = str->getPSFilter(indent); + s->append(indent)->append("/RunLengthDecode filter\n"); + return s; +} + +GBool RunLengthStream::isBinary(GBool last) { + return str->isBinary(gTrue); +} + +GBool RunLengthStream::fillBuf() { + int c; + int n, i; + + if (eof) + return gFalse; + c = str->getChar(); + if (c == 0x80 || c == EOF) { + eof = gTrue; + return gFalse; + } + if (c < 0x80) { + n = c + 1; + for (i = 0; i < n; ++i) + buf[i] = (char)str->getChar(); + } else { + n = 0x101 - c; + c = str->getChar(); + for (i = 0; i < n; ++i) + buf[i] = (char)c; + } + bufPtr = buf; + bufEnd = buf + n; + return gTrue; +} + +//------------------------------------------------------------------------ +// CCITTFaxStream +//------------------------------------------------------------------------ + +CCITTFaxStream::CCITTFaxStream(Stream *str1, int encoding1, GBool byteAlign1, + int columns1, int rows1, GBool black1) { + str = str1; + encoding = encoding1; + byteAlign = byteAlign1; + columns = columns1; + rows = rows1; + black = black1; + refLine = (short *)gmalloc((columns + 2) * sizeof(short)); + codingLine = (short *)gmalloc((columns + 2) * sizeof(short)); + + eof = gFalse; + nextLine2D = encoding < 0; + inputBits = 0; + codingLine[0] = 0; + codingLine[1] = refLine[2] = columns; + a0 = 1; + + buf = EOF; +} + +CCITTFaxStream::~CCITTFaxStream() { + delete str; + gfree(refLine); + gfree(codingLine); +} + +void CCITTFaxStream::reset() { + str->reset(); + eof = gFalse; + nextLine2D = encoding < 0; + inputBits = 0; + if ((look13Bits() >> 1) == 0x001) + eatBits(12); + codingLine[0] = 0; + codingLine[1] = refLine[2] = columns; + a0 = 1; + buf = EOF; +} + +int CCITTFaxStream::lookChar() { + short code1, code2, code3; + int a0New; + int ret; + int bits, i; + + // if at eof just return EOF + if (eof && codingLine[a0] >= columns) + return EOF; + + // read the next row + if (codingLine[a0] >= columns) { + + // check for end of file + i = look13Bits(); + if (i == EOF || (i >> 1) == 0x001) { + eof = gTrue; + codingLine[a0 = 0] = columns; + return EOF; + } + + // 2-D encoding + if (nextLine2D) { + for (i = 0; codingLine[i] < columns; ++i) + refLine[i] = codingLine[i]; + refLine[i] = refLine[i + 1] = columns; + b1 = 1; + a0New = codingLine[a0 = 0] = 0; + do { + code1 = getTwoDimCode(); + switch (code1) { + case twoDimPass: + if (refLine[b1] < columns) { + a0New = refLine[b1 + 1]; + b1 += 2; + } + break; + case twoDimHoriz: + if ((a0 & 1) == 0) { + code1 = code2 = 0; + do { + code1 += code3 = getWhiteCode(); + } while (code3 >= 64); + do { + code2 += code3 = getBlackCode(); + } while (code3 >= 64); + } else { + code1 = code2 = 0; + do { + code1 += code3 = getBlackCode(); + } while (code3 >= 64); + do { + code2 += code3 = getWhiteCode(); + } while (code3 >= 64); + } + codingLine[a0 + 1] = a0New + code1; + ++a0; + a0New = codingLine[a0 + 1] = codingLine[a0] + code2; + ++a0; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + break; + case twoDimVert0: + a0New = codingLine[++a0] = refLine[b1]; + if (refLine[b1] < columns) { + ++b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + } + break; + case twoDimVertR1: + a0New = codingLine[++a0] = refLine[b1] + 1; + if (refLine[b1] < columns) { + ++b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + } + break; + case twoDimVertL1: + a0New = codingLine[++a0] = refLine[b1] - 1; + --b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + break; + case twoDimVertR2: + a0New = codingLine[++a0] = refLine[b1] + 2; + if (refLine[b1] < columns) { + ++b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + } + break; + case twoDimVertL2: + a0New = codingLine[++a0] = refLine[b1] - 2; + --b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + break; + case twoDimVertR3: + a0New = codingLine[++a0] = refLine[b1] + 3; + if (refLine[b1] < columns) { + ++b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + } + break; + case twoDimVertL3: + a0New = codingLine[++a0] = refLine[b1] - 3; + --b1; + while (refLine[b1] <= codingLine[a0] && refLine[b1] < columns) + b1 += 2; + break; + case EOF: + eof = gTrue; + codingLine[a0 = 0] = columns; + return EOF; + default: + error(getPos(), "Bad 2D code %04x in CCITTFax stream", code1); + return EOF; + } + } while (codingLine[a0] < columns); + + // 1-D encoding + } else { + codingLine[a0 = 0] = 0; + while (1) { + code1 = 0; + do { + code1 += code3 = getWhiteCode(); + } while (code3 >= 64); + codingLine[a0+1] = codingLine[a0] + code1; + ++a0; + if (codingLine[a0] >= columns) + break; + code2 = 0; + do { + code2 += code3 = getBlackCode(); + } while (code3 >= 64); + codingLine[a0+1] = codingLine[a0] + code2; + ++a0; + if (codingLine[a0] >= columns) + break; + } + } + + if (codingLine[a0] != columns) + error(getPos(), "CCITTFax row is wrong length (%d)", codingLine[a0]); + + // check for end-of-line marker + code1 = look13Bits(); + if ((code1 >> 1) == 0x001) { + eatBits(12); + if (encoding > 0) { + eatBits(1); + nextLine2D = !(code1 & 1); + } + } + + a0 = 0; + outputBits = codingLine[1] - codingLine[0]; + } + + // get a byte + if (outputBits >= 8) { + ret = ((a0 & 1) == 0) ? 0xff : 0x00; + if ((outputBits -= 8) == 0) { + ++a0; + if (codingLine[a0] < columns) + outputBits = codingLine[a0 + 1] - codingLine[a0]; + } + } else { + bits = 8; + ret = 0; + do { + if (outputBits > bits) { + i = bits; + bits = 0; + if ((a0 & 1) == 0) + ret |= 0xff >> (8 - i); + outputBits -= i; + } else { + i = outputBits; + bits -= outputBits; + if ((a0 & 1) == 0) + ret |= (0xff >> (8 - i)) << bits; + outputBits = 0; + ++a0; + if (codingLine[a0] < columns) + outputBits = codingLine[a0 + 1] - codingLine[a0]; + } + } while (bits > 0 && codingLine[a0] < columns); + } + buf = black ? (ret ^ 0xff) : ret; + return buf; +} + +short CCITTFaxStream::getTwoDimCode() { + short code, code0; + CCITTCode *p; + + code0 = look13Bits(); + code = code0 >> 6; + if (code == 0x0002) { + eatBits(7); + return twoDimVertL3; + } + if (code == 0x0003) { + eatBits(7); + return twoDimVertR3; + } + code >>= 1; + if (code == 0x0002) { + eatBits(6); + return twoDimVertL2; + } + if (code == 0x0003) { + eatBits(6); + return twoDimVertR2; + } + code >>= 2; + p = &twoDimTab1[code]; + if (p->bits > 0) { + eatBits(p->bits); + return p->n; + } + error(getPos(), "Bad two dim code (%04x) in CCITTFax stream", code0); + return EOF; +} + +short CCITTFaxStream::getWhiteCode() { + short code; + CCITTCode *p; + + code = look13Bits(); + if ((code >> 6) == 0) + p = &whiteTab1[code >> 1]; + else + p = &whiteTab2[code >> 4]; + if (p->bits > 0) { + eatBits(p->bits); + return p->n; + } + error(getPos(), "Bad white code (%04x) in CCITTFax stream", code); + return EOF; +} + +short CCITTFaxStream::getBlackCode() { + short code; + CCITTCode *p; + + code = look13Bits(); + if ((code >> 7) == 0) + p = &blackTab1[code]; + else if ((code >> 9) == 0) + p = &blackTab2[(code >> 1) - 64]; + else + p = &blackTab3[code >> 7]; + if (p->bits > 0) { + eatBits(p->bits); + return p->n; + } + error(getPos(), "Bad black code (%04x) in CCITTFax stream", code); + return EOF; +} + +short CCITTFaxStream::look13Bits() { + int c; + + while (inputBits < 13) { + if ((c = str->getChar()) == EOF) { + if (inputBits == 0) + return EOF; + c = 0; + } + inputBuf = (inputBuf << 8) + c; + inputBits += 8; + } + return (inputBuf >> (inputBits - 13)) & 0x1fff; +} + +GString *CCITTFaxStream::getPSFilter(char *indent) { + GString *s; + char s1[50]; + + s = str->getPSFilter(indent); + s->append(indent)->append("<< "); + if (encoding != 0) { + sprintf(s1, "/K %d ", encoding); + s->append(s1); + } + if (byteAlign) + s->append("/EncodedByteAlign true "); + sprintf(s1, "/Columns %d ", columns); + s->append(s1); + if (rows != 0) { + sprintf(s1, "/Rows %d ", rows); + s->append(s1); + } + if (black) + s->append("/BlackIs1 true "); + s->append(">> /CCITTFaxDecode filter\n"); + return s; +} + +GBool CCITTFaxStream::isBinary(GBool last) { + return str->isBinary(gTrue); +} + +//------------------------------------------------------------------------ +// DCTStream +//------------------------------------------------------------------------ + +// IDCT constants (20.12 fixed point format) +#ifndef FP_IDCT +#define dctCos1 4017 // cos(pi/16) +#define dctSin1 799 // sin(pi/16) +#define dctCos3 3406 // cos(3*pi/16) +#define dctSin3 2276 // sin(3*pi/16) +#define dctCos6 1567 // cos(6*pi/16) +#define dctSin6 3784 // sin(6*pi/16) +#define dctSqrt2 5793 // sqrt(2) +#define dctSqrt1d2 2896 // sqrt(2) / 2 +#endif + +// IDCT constants +#ifdef FP_IDCT +#define dctCos1 0.98078528 // cos(pi/16) +#define dctSin1 0.19509032 // sin(pi/16) +#define dctCos3 0.83146961 // cos(3*pi/16) +#define dctSin3 0.55557023 // sin(3*pi/16) +#define dctCos6 0.38268343 // cos(6*pi/16) +#define dctSin6 0.92387953 // sin(6*pi/16) +#define dctSqrt2 1.41421356 // sqrt(2) +#define dctSqrt1d2 0.70710678 // sqrt(2) / 2 +#endif + +// color conversion parameters (16.16 fixed point format) +#define dctCrToR 91881 // 1.4020 +#define dctCbToG -22553 // -0.3441363 +#define dctCrToG -46802 // -0.71413636 +#define dctCbToB 116130 // 1.772 + +// clip [-256,511] --> [0,255] +#define dctClipOffset 256 +static Guchar dctClip[768]; +static int dctClipInit = 0; + +// zig zag decode map +static int dctZigZag[64] = { + 0, + 1, 8, + 16, 9, 2, + 3, 10, 17, 24, + 32, 25, 18, 11, 4, + 5, 12, 19, 26, 33, 40, + 48, 41, 34, 27, 20, 13, 6, + 7, 14, 21, 28, 35, 42, 49, 56, + 57, 50, 43, 36, 29, 22, 15, + 23, 30, 37, 44, 51, 58, + 59, 52, 45, 38, 31, + 39, 46, 53, 60, + 61, 54, 47, + 55, 62, + 63 +}; + +DCTStream::DCTStream(Stream *str1) { + int i, j; + + str = str1; + width = height = 0; + mcuWidth = mcuHeight = 0; + numComps = 0; + comp = 0; + x = y = dy = 0; + for (i = 0; i < 4; ++i) + for (j = 0; j < 32; ++j) + rowBuf[i][j] = NULL; + + if (!dctClipInit) { + for (i = -256; i < 0; ++i) + dctClip[dctClipOffset + i] = 0; + for (i = 0; i < 256; ++i) + dctClip[dctClipOffset + i] = i; + for (i = 256; i < 512; ++i) + dctClip[dctClipOffset + i] = 255; + dctClipInit = 1; + } +} + +DCTStream::~DCTStream() { + int i, j; + + delete str; + for (i = 0; i < numComps; ++i) + for (j = 0; j < mcuHeight; ++j) + gfree(rowBuf[i][j]); +} + +void DCTStream::reset() { + str->reset(); + if (!readHeader()) { + y = height; + return; + } + restartMarker = 0xd0; + restart(); +} + +int DCTStream::getChar() { + int c; + + c = lookChar(); + if (c == EOF) + return EOF; + if (++comp == numComps) { + comp = 0; + if (++x == width) { + x = 0; + ++y; + ++dy; + } + } + if (y == height) + readTrailer(); + return c; +} + +int DCTStream::lookChar() { + if (y >= height) + return EOF; + if (dy >= mcuHeight) { + if (!readMCURow()) { + y = height; + return EOF; + } + comp = 0; + x = 0; + dy = 0; + } + return rowBuf[comp][dy][x]; +} + +void DCTStream::restart() { + int i; + + inputBits = 0; + restartCtr = restartInterval; + for (i = 0; i < numComps; ++i) + compInfo[i].prevDC = 0; +} + +GBool DCTStream::readMCURow() { + Guchar data[64]; + Guchar *p1, *p2; + int pY, pCb, pCr, pR, pG, pB; + int h, v, horiz, vert, hSub, vSub; + int x1, x2, y2, x3, y3, x4, y4, x5, y5, cc, i; + int c; + + for (x1 = 0; x1 < width; x1 += mcuWidth) { + + // deal with restart marker + if (restartInterval > 0 && restartCtr == 0) { + c = readMarker(); + if (c != restartMarker) { + error(getPos(), "Bad DCT data: incorrect restart marker"); + return gFalse; + } + if (++restartMarker == 0xd8) + restartMarker = 0xd0; + restart(); + } + + // read one MCU + for (cc = 0; cc < numComps; ++cc) { + h = compInfo[cc].hSample; + v = compInfo[cc].vSample; + horiz = mcuWidth / h; + vert = mcuHeight / v; + hSub = horiz / 8; + vSub = vert / 8; + for (y2 = 0; y2 < mcuHeight; y2 += vert) { + for (x2 = 0; x2 < mcuWidth; x2 += horiz) { + if (!readDataUnit(&dcHuffTables[compInfo[cc].dcHuffTable], + &acHuffTables[compInfo[cc].acHuffTable], + quantTables[compInfo[cc].quantTable], + &compInfo[cc].prevDC, + data)) + return gFalse; + if (hSub == 1 && vSub == 1) { + for (y3 = 0, i = 0; y3 < 8; ++y3, i += 8) { + p1 = &rowBuf[cc][y2+y3][x1+x2]; + p1[0] = data[i]; + p1[1] = data[i+1]; + p1[2] = data[i+2]; + p1[3] = data[i+3]; + p1[4] = data[i+4]; + p1[5] = data[i+5]; + p1[6] = data[i+6]; + p1[7] = data[i+7]; + } + } else if (hSub == 2 && vSub == 2) { + for (y3 = 0, i = 0; y3 < 16; y3 += 2, i += 8) { + p1 = &rowBuf[cc][y2+y3][x1+x2]; + p2 = &rowBuf[cc][y2+y3+1][x1+x2]; + p1[0] = p1[1] = p2[0] = p2[1] = data[i]; + p1[2] = p1[3] = p2[2] = p2[3] = data[i+1]; + p1[4] = p1[5] = p2[4] = p2[5] = data[i+2]; + p1[6] = p1[7] = p2[6] = p2[7] = data[i+3]; + p1[8] = p1[9] = p2[8] = p2[9] = data[i+4]; + p1[10] = p1[11] = p2[10] = p2[11] = data[i+5]; + p1[12] = p1[13] = p2[12] = p2[13] = data[i+6]; + p1[14] = p1[15] = p2[14] = p2[15] = data[i+7]; + } + } else { + i = 0; + for (y3 = 0, y4 = 0; y3 < 8; ++y3, y4 += vSub) { + for (x3 = 0, x4 = 0; x3 < 8; ++x3, x4 += hSub) { + for (y5 = 0; y5 < vSub; ++y5) + for (x5 = 0; x5 < hSub; ++x5) + rowBuf[cc][y2+y4+y5][x1+x2+x4+x5] = data[i]; + ++i; + } + } + } + } + } + } + --restartCtr; + + // color space conversion + if (colorXform) { + // convert YCbCr to RGB + if (numComps == 3) { + for (y2 = 0; y2 < mcuHeight; ++y2) { + for (x2 = 0; x2 < mcuWidth; ++x2) { + pY = rowBuf[0][y2][x1+x2]; + pCb = rowBuf[1][y2][x1+x2] - 128; + pCr = rowBuf[2][y2][x1+x2] - 128; + pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16; + rowBuf[0][y2][x1+x2] = dctClip[dctClipOffset + pR]; + pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32678) >> 16; + rowBuf[1][y2][x1+x2] = dctClip[dctClipOffset + pG]; + pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16; + rowBuf[2][y2][x1+x2] = dctClip[dctClipOffset + pB]; + } + } + // convert YCbCrK to CMYK (K is passed through unchanged) + } else if (numComps == 4) { + for (y2 = 0; y2 < mcuHeight; ++y2) { + for (x2 = 0; x2 < mcuWidth; ++x2) { + pY = rowBuf[0][y2][x1+x2]; + pCb = rowBuf[1][y2][x1+x2] - 128; + pCr = rowBuf[2][y2][x1+x2] - 128; + pR = ((pY << 16) + dctCrToR * pCr + 32768) >> 16; + rowBuf[0][y2][x1+x2] = 255 - dctClip[dctClipOffset + pR]; + pG = ((pY << 16) + dctCbToG * pCb + dctCrToG * pCr + 32678) >> 16; + rowBuf[1][y2][x1+x2] = 255 - dctClip[dctClipOffset + pG]; + pB = ((pY << 16) + dctCbToB * pCb + 32768) >> 16; + rowBuf[2][y2][x1+x2] = 255 - dctClip[dctClipOffset + pB]; + } + } + } + } + } + return gTrue; +} + +// This IDCT algorithm is taken from: +// Christoph Loeffler, Adriaan Ligtenberg, George S. Moschytz, +// "Practical Fast 1-D DCT Algorithms with 11 Multiplications", +// IEEE Intl. Conf. on Acoustics, Speech & Signal Processing, 1989, +// 988-991. +// The stage numbers mentioned in the comments refer to Figure 1 in this +// paper. +#ifndef FP_IDCT +GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, + DCTHuffTable *acHuffTable, + Guchar quantTable[64], int *prevDC, + Guchar data[64]) { + int tmp1[64]; + int v0, v1, v2, v3, v4, v5, v6, v7, t; + int run, size, amp; + int c; + int i, j; + + // Huffman decode and dequantize + size = readHuffSym(dcHuffTable); + if (size == 9999) + return gFalse; + if (size > 0) { + amp = readAmp(size); + if (amp == 9999) + return gFalse; + } else { + amp = 0; + } + tmp1[0] = (*prevDC += amp) * quantTable[0]; + for (i = 1; i < 64; ++i) + tmp1[i] = 0; + i = 1; + while (i < 64) { + run = 0; + while ((c = readHuffSym(acHuffTable)) == 0xf0 && run < 0x30) + run += 0x10; + if (c == 9999) + return gFalse; + if (c == 0x00) { + break; + } else { + run += (c >> 4) & 0x0f; + size = c & 0x0f; + amp = readAmp(size); + if (amp == 9999) + return gFalse; + i += run; + j = dctZigZag[i++]; + tmp1[j] = amp * quantTable[j]; + } + } + + // inverse DCT on rows + for (i = 0; i < 64; i += 8) { + + // stage 4 + v0 = (dctSqrt2 * tmp1[i+0] + 128) >> 8; + v1 = (dctSqrt2 * tmp1[i+4] + 128) >> 8; + v2 = tmp1[i+2]; + v3 = tmp1[i+6]; + v4 = (dctSqrt1d2 * (tmp1[i+1] - tmp1[i+7]) + 128) >> 8; + v7 = (dctSqrt1d2 * (tmp1[i+1] + tmp1[i+7]) + 128) >> 8; + v5 = tmp1[i+3] << 4; + v6 = tmp1[i+5] << 4; + + // stage 3 + t = (v0 - v1+ 1) >> 1; + v0 = (v0 + v1 + 1) >> 1; + v1 = t; + t = (v2 * dctSin6 + v3 * dctCos6 + 128) >> 8; + v2 = (v2 * dctCos6 - v3 * dctSin6 + 128) >> 8; + v3 = t; + t = (v4 - v6 + 1) >> 1; + v4 = (v4 + v6 + 1) >> 1; + v6 = t; + t = (v7 + v5 + 1) >> 1; + v5 = (v7 - v5 + 1) >> 1; + v7 = t; + + // stage 2 + t = (v0 - v3 + 1) >> 1; + v0 = (v0 + v3 + 1) >> 1; + v3 = t; + t = (v1 - v2 + 1) >> 1; + v1 = (v1 + v2 + 1) >> 1; + v2 = t; + t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; + v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; + v7 = t; + t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; + v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; + v6 = t; + + // stage 1 + tmp1[i+0] = v0 + v7; + tmp1[i+7] = v0 - v7; + tmp1[i+1] = v1 + v6; + tmp1[i+6] = v1 - v6; + tmp1[i+2] = v2 + v5; + tmp1[i+5] = v2 - v5; + tmp1[i+3] = v3 + v4; + tmp1[i+4] = v3 - v4; + } + + // inverse DCT on columns + for (i = 0; i < 8; ++i) { + + // stage 4 + v0 = (dctSqrt2 * tmp1[0*8+i] + 2048) >> 12; + v1 = (dctSqrt2 * tmp1[4*8+i] + 2048) >> 12; + v2 = tmp1[2*8+i]; + v3 = tmp1[6*8+i]; + v4 = (dctSqrt1d2 * (tmp1[1*8+i] - tmp1[7*8+i]) + 2048) >> 12; + v7 = (dctSqrt1d2 * (tmp1[1*8+i] + tmp1[7*8+i]) + 2048) >> 12; + v5 = tmp1[3*8+i]; + v6 = tmp1[5*8+i]; + + // stage 3 + t = (v0 - v1 + 1) >> 1; + v0 = (v0 + v1 + 1) >> 1; + v1 = t; + t = (v2 * dctSin6 + v3 * dctCos6 + 2048) >> 12; + v2 = (v2 * dctCos6 - v3 * dctSin6 + 2048) >> 12; + v3 = t; + t = (v4 - v6 + 1) >> 1; + v4 = (v4 + v6 + 1) >> 1; + v6 = t; + t = (v7 + v5 + 1) >> 1; + v5 = (v7 - v5 + 1) >> 1; + v7 = t; + + // stage 2 + t = (v0 - v3 + 1) >> 1; + v0 = (v0 + v3 + 1) >> 1; + v3 = t; + t = (v1 - v2 + 1) >> 1; + v1 = (v1 + v2 + 1) >> 1; + v2 = t; + t = (v4 * dctSin3 + v7 * dctCos3 + 2048) >> 12; + v4 = (v4 * dctCos3 - v7 * dctSin3 + 2048) >> 12; + v7 = t; + t = (v5 * dctSin1 + v6 * dctCos1 + 2048) >> 12; + v5 = (v5 * dctCos1 - v6 * dctSin1 + 2048) >> 12; + v6 = t; + + // stage 1 + tmp1[0*8+i] = v0 + v7; + tmp1[7*8+i] = v0 - v7; + tmp1[1*8+i] = v1 + v6; + tmp1[6*8+i] = v1 - v6; + tmp1[2*8+i] = v2 + v5; + tmp1[5*8+i] = v2 - v5; + tmp1[3*8+i] = v3 + v4; + tmp1[4*8+i] = v3 - v4; + } + + // convert to 8-bit integers + for (i = 0; i < 64; ++i) + data[i] = dctClip[dctClipOffset + 128 + ((tmp1[i] + 8) >> 4)]; + + return gTrue; +} +#endif + +#ifdef FP_IDCT +GBool DCTStream::readDataUnit(DCTHuffTable *dcHuffTable, + DCTHuffTable *acHuffTable, + Guchar quantTable[64], int *prevDC, + Guchar data[64]) { + double tmp1[64]; + double v0, v1, v2, v3, v4, v5, v6, v7, t; + int run, size, amp; + int c; + int i, j; + + // Huffman decode and dequantize + size = readHuffSym(dcHuffTable); + if (size == 9999) + return gFalse; + if (size > 0) { + amp = readAmp(size); + if (amp == 9999) + return gFalse; + } else { + amp = 0; + } + tmp1[0] = (*prevDC += amp) * quantTable[0]; + for (i = 1; i < 64; ++i) + tmp1[i] = 0; + i = 1; + while (i < 64) { + run = 0; + while ((c = readHuffSym(acHuffTable)) == 0xf0 && run < 0x30) + run += 0x10; + if (c == 9999) + return gFalse; + if (c == 0x00) { + break; + } else { + run += (c >> 4) & 0x0f; + size = c & 0x0f; + amp = readAmp(size); + if (amp == 9999) + return gFalse; + i += run; + j = dctZigZag[i++]; + tmp1[j] = amp * quantTable[j]; + } + } + + // inverse DCT on rows + for (i = 0; i < 64; i += 8) { + + // stage 4 + v0 = dctSqrt2 * tmp1[i+0]; + v1 = dctSqrt2 * tmp1[i+4]; + v2 = tmp1[i+2]; + v3 = tmp1[i+6]; + v4 = dctSqrt1d2 * (tmp1[i+1] - tmp1[i+7]); + v7 = dctSqrt1d2 * (tmp1[i+1] + tmp1[i+7]); + v5 = tmp1[i+3]; + v6 = tmp1[i+5]; + + // stage 3 + t = 0.5 * (v0 - v1); + v0 = 0.5 * (v0 + v1); + v1 = t; + t = v2 * dctSin6 + v3 * dctCos6; + v2 = v2 * dctCos6 - v3 * dctSin6; + v3 = t; + t = 0.5 * (v4 - v6); + v4 = 0.5 * (v4 + v6); + v6 = t; + t = 0.5 * (v7 + v5); + v5 = 0.5 * (v7 - v5); + v7 = t; + + // stage 2 + t = 0.5 * (v0 - v3); + v0 = 0.5 * (v0 + v3); + v3 = t; + t = 0.5 * (v1 - v2); + v1 = 0.5 * (v1 + v2); + v2 = t; + t = v4 * dctSin3 + v7 * dctCos3; + v4 = v4 * dctCos3 - v7 * dctSin3; + v7 = t; + t = v5 * dctSin1 + v6 * dctCos1; + v5 = v5 * dctCos1 - v6 * dctSin1; + v6 = t; + + // stage 1 + tmp1[i+0] = v0 + v7; + tmp1[i+7] = v0 - v7; + tmp1[i+1] = v1 + v6; + tmp1[i+6] = v1 - v6; + tmp1[i+2] = v2 + v5; + tmp1[i+5] = v2 - v5; + tmp1[i+3] = v3 + v4; + tmp1[i+4] = v3 - v4; + } + + // inverse DCT on columns + for (i = 0; i < 8; ++i) { + + // stage 4 + v0 = dctSqrt2 * tmp1[0*8+i]; + v1 = dctSqrt2 * tmp1[4*8+i]; + v2 = tmp1[2*8+i]; + v3 = tmp1[6*8+i]; + v4 = dctSqrt1d2 * (tmp1[1*8+i] - tmp1[7*8+i]); + v7 = dctSqrt1d2 * (tmp1[1*8+i] + tmp1[7*8+i]); + v5 = tmp1[3*8+i]; + v6 = tmp1[5*8+i]; + + // stage 3 + t = 0.5 * (v0 - v1); + v0 = 0.5 * (v0 + v1); + v1 = t; + t = v2 * dctSin6 + v3 * dctCos6; + v2 = v2 * dctCos6 - v3 * dctSin6; + v3 = t; + t = 0.5 * (v4 - v6); + v4 = 0.5 * (v4 + v6); + v6 = t; + t = 0.5 * (v7 + v5); + v5 = 0.5 * (v7 - v5); + v7 = t; + + // stage 2 + t = 0.5 * (v0 - v3); + v0 = 0.5 * (v0 + v3); + v3 = t; + t = 0.5 * (v1 - v2); + v1 = 0.5 * (v1 + v2); + v2 = t; + t = v4 * dctSin3 + v7 * dctCos3; + v4 = v4 * dctCos3 - v7 * dctSin3; + v7 = t; + t = v5 * dctSin1 + v6 * dctCos1; + v5 = v5 * dctCos1 - v6 * dctSin1; + v6 = t; + + // stage 1 + tmp1[0*8+i] = v0 + v7; + tmp1[7*8+i] = v0 - v7; + tmp1[1*8+i] = v1 + v6; + tmp1[6*8+i] = v1 - v6; + tmp1[2*8+i] = v2 + v5; + tmp1[5*8+i] = v2 - v5; + tmp1[3*8+i] = v3 + v4; + tmp1[4*8+i] = v3 - v4; + } + + // convert to 8-bit integers + for (i = 0; i < 64; ++i) + data[i] = dctClip[dctClipOffset + (int)(tmp1[i] + 128.5)]; + + return gTrue; +} +#endif + +int DCTStream::readHuffSym(DCTHuffTable *table) { + Gushort code; + int bit; + int codeBits; + + code = 0; + codeBits = 0; + do { + // add a bit to the code + if ((bit = readBit()) == EOF) + return 9999; + code = (code << 1) + bit; + ++codeBits; + + // look up code + if (code - table->firstCode[codeBits] < table->numCodes[codeBits]) { + code -= table->firstCode[codeBits]; + return table->sym[table->firstSym[codeBits] + code]; + } + } while (codeBits < 16); + + error(getPos(), "Bad Huffman code in DCT stream"); + return 9999; +} + +int DCTStream::readAmp(int size) { + int amp, bit; + int bits; + + amp = 0; + for (bits = 0; bits < size; ++bits) { + if ((bit = readBit()) == EOF) + return 9999; + amp = (amp << 1) + bit; + } + if (amp < (1 << (size - 1))) + amp -= (1 << size) - 1; + return amp; +} + +int DCTStream::readBit() { + int bit; + int c, c2; + + if (inputBits == 0) { + if ((c = str->getChar()) == EOF) + return EOF; + if (c == 0xff) { + do { + c2 = str->getChar(); + } while (c2 == 0xff); + if (c2 != 0x00) { + error(getPos(), "Bad DCT data: missing 00 after ff"); + return EOF; + } + } + inputBuf = c; + inputBits = 8; + } + bit = (inputBuf >> (inputBits - 1)) & 1; + --inputBits; + return bit; +} + +GBool DCTStream::readHeader() { + GBool doScan; + int minHSample, minVSample; + int bufWidth; + int n; + int c = 0; + int i, j; + + width = height = 0; + numComps = 0; + numQuantTables = 0; + numDCHuffTables = 0; + numACHuffTables = 0; + colorXform = 0; + restartInterval = 0; + + // read headers + doScan = gFalse; + while (!doScan) { + c = readMarker(); + switch (c) { + case 0xc0: // SOF0 + if (!readFrameInfo()) + return gFalse; + break; + case 0xc4: // DHT + if (!readHuffmanTables()) + return gFalse; + break; + case 0xd8: // SOI + break; + case 0xda: // SOS + if (!readScanInfo()) + return gFalse; + doScan = gTrue; + break; + case 0xdb: // DQT + if (!readQuantTables()) + return gFalse; + break; + case 0xdd: // DRI + if (!readRestartInterval()) + return gFalse; + break; + case 0xee: // APP14 + if (!readAdobeMarker()) + return gFalse; + break; + case EOF: + error(getPos(), "Bad DCT header"); + return gFalse; + default: + // skip APPn / COM / etc. + if (c >= 0xe0) { + n = read16() - 2; + for (i = 0; i < n; ++i) + str->getChar(); + } else { + error(getPos(), "Unknown DCT marker <%02x>", c); + return gFalse; + } + break; + } + } + + // compute MCU size + mcuWidth = minHSample = compInfo[0].hSample; + mcuHeight = minVSample = compInfo[0].vSample; + for (i = 1; i < numComps; ++i) { + if (compInfo[i].hSample < minHSample) + minHSample = compInfo[i].hSample; + if (compInfo[i].vSample < minVSample) + minVSample = compInfo[i].vSample; + if (compInfo[i].hSample > mcuWidth) + mcuWidth = compInfo[i].hSample; + if (compInfo[i].vSample > mcuHeight) + mcuHeight = compInfo[i].vSample; + } + for (i = 0; i < numComps; ++i) { + compInfo[i].hSample /= minHSample; + compInfo[i].vSample /= minVSample; + } + mcuWidth = (mcuWidth / minHSample) * 8; + mcuHeight = (mcuHeight / minVSample) * 8; + + // allocate buffers + bufWidth = ((width + mcuWidth - 1) / mcuWidth) * mcuWidth; + for (i = 0; i < numComps; ++i) + for (j = 0; j < mcuHeight; ++j) + rowBuf[i][j] = (Guchar *)gmalloc(bufWidth * sizeof(Guchar)); + + // initialize counters + comp = 0; + x = 0; + y = 0; + dy = mcuHeight; + + return gTrue; +} + +GBool DCTStream::readFrameInfo() { + int length; + int prec; + int i; + int c; + + length = read16() - 2; + prec = str->getChar(); + height = read16(); + width = read16(); + numComps = str->getChar(); + length -= 6; + if (prec != 8) { + error(getPos(), "Bad DCT precision %d", prec); + return gFalse; + } + for (i = 0; i < numComps; ++i) { + compInfo[i].id = str->getChar(); + compInfo[i].inScan = gFalse; + c = str->getChar(); + compInfo[i].hSample = (c >> 4) & 0x0f; + compInfo[i].vSample = c & 0x0f; + compInfo[i].quantTable = str->getChar(); + compInfo[i].dcHuffTable = 0; + compInfo[i].acHuffTable = 0; + } + return gTrue; +} + +GBool DCTStream::readScanInfo() { + int length; + int scanComps, id, c; + int i, j; + + length = read16() - 2; + scanComps = str->getChar(); + --length; + if (length != 2 * scanComps + 3) { + error(getPos(), "Bad DCT scan info block"); + return gFalse; + } + for (i = 0; i < scanComps; ++i) { + id = str->getChar(); + for (j = 0; j < numComps; ++j) { + if (id == compInfo[j].id) + break; + } + if (j == numComps) { + error(getPos(), "Bad DCT component ID in scan info block"); + return gFalse; + } + compInfo[j].inScan = gTrue; + c = str->getChar(); + compInfo[j].dcHuffTable = (c >> 4) & 0x0f; + compInfo[j].acHuffTable = c & 0x0f; + } + str->getChar(); + str->getChar(); + str->getChar(); + return gTrue; +} + +GBool DCTStream::readQuantTables() { + int length; + int i; + int index; + + length = read16() - 2; + while (length > 0) { + index = str->getChar(); + if ((index & 0xf0) || index >= 4) { + error(getPos(), "Bad DCT quantization table"); + return gFalse; + } + if (index == numQuantTables) + numQuantTables = index + 1; + for (i = 0; i < 64; ++i) + quantTables[index][dctZigZag[i]] = str->getChar(); + length -= 65; + } + return gTrue; +} + +GBool DCTStream::readHuffmanTables() { + DCTHuffTable *tbl; + int length; + int index; + Gushort code; + Guchar sym; + int i; + int c; + + length = read16() - 2; + while (length > 0) { + index = str->getChar(); + --length; + if ((index & 0x0f) >= 4) { + error(getPos(), "Bad DCT Huffman table"); + return gFalse; + } + if (index & 0x10) { + index &= 0x0f; + if (index >= numACHuffTables) + numACHuffTables = index+1; + tbl = &acHuffTables[index]; + } else { + if (index >= numDCHuffTables) + numDCHuffTables = index+1; + tbl = &dcHuffTables[index]; + } + sym = 0; + code = 0; + for (i = 1; i <= 16; ++i) { + c = str->getChar(); + tbl->firstSym[i] = sym; + tbl->firstCode[i] = code; + tbl->numCodes[i] = c; + sym += c; + code = (code + c) << 1; + } + length -= 16; + for (i = 0; i < sym; ++i) + tbl->sym[i] = str->getChar(); + length -= sym; + } + return gTrue; +} + +GBool DCTStream::readRestartInterval() { + int length; + + length = read16(); + if (length != 4) { + error(getPos(), "Bad DCT restart interval"); + return gFalse; + } + restartInterval = read16(); + return gTrue; +} + +GBool DCTStream::readAdobeMarker() { + int length, i; + char buf[12]; + int c; + + length = read16(); + if (length != 14) + goto err; + for (i = 0; i < 12; ++i) { + if ((c = str->getChar()) == EOF) + goto err; + buf[i] = c; + } + if (strncmp(buf, "Adobe", 5)) + goto err; + colorXform = buf[11]; + return gTrue; + + err: + error(getPos(), "Bad DCT Adobe APP14 marker"); + return gFalse; +} + +GBool DCTStream::readTrailer() { + int c; + + c = readMarker(); + if (c != 0xd9) { // EOI + error(getPos(), "Bad DCT trailer"); + return gFalse; + } + return gTrue; +} + +int DCTStream::readMarker() { + int c; + + do { + do { + c = str->getChar(); + } while (c != 0xff); + do { + c = str->getChar(); + } while (c == 0xff); + } while (c == 0x00); + return c; +} + +int DCTStream::read16() { + int c1, c2; + + if ((c1 = str->getChar()) == EOF) + return EOF; + if ((c2 = str->getChar()) == EOF) + return EOF; + return (c1 << 8) + c2; +} + +GString *DCTStream::getPSFilter(char *indent) { + GString *s; + + s = str->getPSFilter(indent); + s->append(indent)->append("<< >> /DCTDecode filter\n"); + return s; +} + +GBool DCTStream::isBinary(GBool last) { + return str->isBinary(gTrue); +} + +//------------------------------------------------------------------------ +// FlateStream +//------------------------------------------------------------------------ + +int FlateStream::codeLenCodeMap[flateMaxCodeLenCodes] = { + 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15 +}; + +FlateDecode FlateStream::lengthDecode[flateMaxLitCodes-257] = { + {0, 3}, + {0, 4}, + {0, 5}, + {0, 6}, + {0, 7}, + {0, 8}, + {0, 9}, + {0, 10}, + {1, 11}, + {1, 13}, + {1, 15}, + {1, 17}, + {2, 19}, + {2, 23}, + {2, 27}, + {2, 31}, + {3, 35}, + {3, 43}, + {3, 51}, + {3, 59}, + {4, 67}, + {4, 83}, + {4, 99}, + {4, 115}, + {5, 131}, + {5, 163}, + {5, 195}, + {5, 227}, + {0, 258} +}; + +FlateDecode FlateStream::distDecode[flateMaxDistCodes] = { + { 0, 1}, + { 0, 2}, + { 0, 3}, + { 0, 4}, + { 1, 5}, + { 1, 7}, + { 2, 9}, + { 2, 13}, + { 3, 17}, + { 3, 25}, + { 4, 33}, + { 4, 49}, + { 5, 65}, + { 5, 97}, + { 6, 129}, + { 6, 193}, + { 7, 257}, + { 7, 385}, + { 8, 513}, + { 8, 769}, + { 9, 1025}, + { 9, 1537}, + {10, 2049}, + {10, 3073}, + {11, 4097}, + {11, 6145}, + {12, 8193}, + {12, 12289}, + {13, 16385}, + {13, 24577} +}; + +FlateStream::FlateStream(Stream *str1, int predictor1, int columns1, + int colors1, int bits1) { + str = str1; + predictor = predictor1; + if (predictor1 > 1) { + width = columns1; + nComps = colors1; + nBits = bits1; + } +} + +FlateStream::~FlateStream() { + delete str; +} + +void FlateStream::reset() { + int cmf, flg; + + str->reset(); + + // read header + //~ need to look at window size? + endOfBlock = eof = gTrue; + cmf = str->getChar(); + flg = str->getChar(); + if (cmf == EOF || flg == EOF) + return; + if ((cmf & 0x0f) != 0x08) { + error(getPos(), "Unknown compression method in flate stream"); + return; + } + if ((((cmf << 8) + flg) % 31) != 0) { + error(getPos(), "Bad FCHECK in flate stream"); + return; + } + if (flg & 0x20) { + error(getPos(), "FDICT bit set in flate stream"); + return; + } + + // initialize + index = 0; + remain = 0; + codeBuf = 0; + codeSize = 0; + compressedBlock = gFalse; + endOfBlock = gTrue; + eof = gFalse; +} + +int FlateStream::getChar() { + int c; + + while (remain == 0) { + if (endOfBlock && eof) + return EOF; + readSome(); + } + c = buf[index]; + index = (index + 1) & flateMask; + --remain; + return c; +} + +int FlateStream::lookChar() { + int c; + + while (remain == 0) { + if (endOfBlock && eof) + return EOF; + readSome(); + } + c = buf[index]; + return c; +} + +GString *FlateStream::getPSFilter(char *indent) { + return NULL; +} + +GBool FlateStream::isBinary(GBool last) { + return str->isBinary(gTrue); +} + +void FlateStream::readSome() { + int code1, code2; + int len, dist; + int i, j, k; + int c; + + if (endOfBlock) { + if (!startBlock()) + return; + } + + if (compressedBlock) { + if ((code1 = getHuffmanCodeWord(&litCodeTab)) == EOF) + goto err; + if (code1 < 256) { + buf[index] = code1; + remain = 1; + } else if (code1 == 256) { + endOfBlock = gTrue; + remain = 0; + } else { + code1 -= 257; + code2 = lengthDecode[code1].bits; + if (code2 > 0 && (code2 = getCodeWord(code2)) == EOF) + goto err; + len = lengthDecode[code1].first + code2; + if ((code1 = getHuffmanCodeWord(&distCodeTab)) == EOF) + goto err; + code2 = distDecode[code1].bits; + if (code2 > 0 && (code2 = getCodeWord(code2)) == EOF) + goto err; + dist = distDecode[code1].first + code2; + i = index; + j = (index - dist) & flateMask; + for (k = 0; k < len; ++k) { + buf[i] = buf[j]; + i = (i + 1) & flateMask; + j = (j + 1) & flateMask; + } + remain = len; + } + + } else { + len = (blockLen < flateWindow) ? blockLen : flateWindow; + for (i = 0, j = index; i < len; ++i, j = (j + 1) & flateMask) { + if ((c = str->getChar()) == EOF) { + endOfBlock = eof = gTrue; + break; + } + buf[j] = c & 0xff; + } + remain = i; + blockLen -= len; + if (blockLen == 0) + endOfBlock = gTrue; + } + + return; + +err: + error(getPos(), "Unexpected end of file in flate stream"); + endOfBlock = eof = gTrue; + remain = 0; +} + +GBool FlateStream::startBlock() { + int blockHdr; + int c; + int check; + + // read block header + blockHdr = getCodeWord(3); + if (blockHdr & 1) + eof = gTrue; + blockHdr >>= 1; + + // uncompressed block + if (blockHdr == 0) { + compressedBlock = gFalse; + if ((c = str->getChar()) == EOF) + goto err; + blockLen = c & 0xff; + if ((c = str->getChar()) == EOF) + goto err; + blockLen |= (c & 0xff) << 8; + if ((c = str->getChar()) == EOF) + goto err; + check = c & 0xff; + if ((c = str->getChar()) == EOF) + goto err; + check |= (c & 0xff) << 8; + if (check != (~blockLen & 0xffff)) + error(getPos(), "Bad uncompressed block length in flate stream"); + codeBuf = 0; + codeSize = 0; + + // compressed block with fixed codes + } else if (blockHdr == 1) { + compressedBlock = gTrue; + loadFixedCodes(); + + // compressed block with dynamic codes + } else if (blockHdr == 2) { + compressedBlock = gTrue; + if (!readDynamicCodes()) + goto err; + + // unknown block type + } else { + goto err; + } + + endOfBlock = gFalse; + return gTrue; + +err: + error(getPos(), "Bad block header in flate stream"); + endOfBlock = eof = gTrue; + return gFalse; +} + +void FlateStream::loadFixedCodes() { + int i; + + // set up code arrays + litCodeTab.codes = allCodes; + distCodeTab.codes = allCodes + flateMaxLitCodes; + + // initialize literal code table + for (i = 0; i <= 143; ++i) + litCodeTab.codes[i].len = 8; + for (i = 144; i <= 255; ++i) + litCodeTab.codes[i].len = 9; + for (i = 256; i <= 279; ++i) + litCodeTab.codes[i].len = 7; + for (i = 280; i <= 287; ++i) + litCodeTab.codes[i].len = 8; + compHuffmanCodes(&litCodeTab, flateMaxLitCodes); + + // initialize distance code table + for (i = 0; i < 5; ++i) + distCodeTab.start[i] = 0; + distCodeTab.start[5] = 0; + for (i = 6; i <= flateMaxHuffman+1; ++i) + distCodeTab.start[6] = flateMaxDistCodes; + for (i = 0; i < flateMaxDistCodes; ++i) { + distCodeTab.codes[i].len = 5; + distCodeTab.codes[i].code = i; + distCodeTab.codes[i].val = i; + } +} + +GBool FlateStream::readDynamicCodes() { + int numCodeLenCodes; + int numLitCodes; + int numDistCodes; + FlateCode codeLenCodes[flateMaxCodeLenCodes]; + FlateHuffmanTab codeLenCodeTab; + int len, repeat, code; + int i; + + // read lengths + if ((numLitCodes = getCodeWord(5)) == EOF) + goto err; + numLitCodes += 257; + if ((numDistCodes = getCodeWord(5)) == EOF) + goto err; + numDistCodes += 1; + if ((numCodeLenCodes = getCodeWord(4)) == EOF) + goto err; + numCodeLenCodes += 4; + if (numLitCodes > flateMaxLitCodes || + numDistCodes > flateMaxDistCodes || + numCodeLenCodes > flateMaxCodeLenCodes) + goto err; + + // read code length code table + codeLenCodeTab.codes = codeLenCodes; + for (i = 0; i < flateMaxCodeLenCodes; ++i) + codeLenCodes[i].len = 0; + for (i = 0; i < numCodeLenCodes; ++i) { + if ((codeLenCodes[codeLenCodeMap[i]].len = getCodeWord(3)) == -1) + goto err; + } + compHuffmanCodes(&codeLenCodeTab, flateMaxCodeLenCodes); + + // set up code arrays + litCodeTab.codes = allCodes; + distCodeTab.codes = allCodes + numLitCodes; + + // read literal and distance code tables + len = 0; + repeat = 0; + i = 0; + while (i < numLitCodes + numDistCodes) { + if ((code = getHuffmanCodeWord(&codeLenCodeTab)) == EOF) + goto err; + if (code == 16) { + if ((repeat = getCodeWord(2)) == EOF) + goto err; + for (repeat += 3; repeat > 0; --repeat) + allCodes[i++].len = len; + } else if (code == 17) { + if ((repeat = getCodeWord(3)) == EOF) + goto err; + len = 0; + for (repeat += 3; repeat > 0; --repeat) + allCodes[i++].len = 0; + } else if (code == 18) { + if ((repeat = getCodeWord(7)) == EOF) + goto err; + len = 0; + for (repeat += 11; repeat > 0; --repeat) + allCodes[i++].len = 0; + } else { + allCodes[i++].len = len = code; + } + } + compHuffmanCodes(&litCodeTab, numLitCodes); + compHuffmanCodes(&distCodeTab, numDistCodes); + + return gTrue; + +err: + error(getPos(), "Bad dynamic code table in flate stream"); + return gFalse; +} + +// On entry, the codes> array contains the lengths of each code, +// stored in code value order. This function computes the code words. +// The result is sorted in order of (1) code length and (2) code word. +// The length values are no longer valid. The start> array is +// filled with the indexes of the first code of each length. +void FlateStream::compHuffmanCodes(FlateHuffmanTab *tab, int n) { + int numLengths[flateMaxHuffman+1]; + int nextCode[flateMaxHuffman+1]; + int nextIndex[flateMaxHuffman+2]; + int code; + int i, j; + + // count number of codes for each code length + for (i = 0; i <= flateMaxHuffman; ++i) + numLengths[i] = 0; + for (i = 0; i < n; ++i) + ++numLengths[tab->codes[i].len]; + + // compute first index for each length + tab->start[0] = nextIndex[0] = 0; + for (i = 1; i <= flateMaxHuffman + 1; ++i) + tab->start[i] = nextIndex[i] = tab->start[i-1] + numLengths[i-1]; + + // compute first code for each length + code = 0; + numLengths[0] = 0; + for (i = 1; i <= flateMaxHuffman; ++i) { + code = (code + numLengths[i-1]) << 1; + nextCode[i] = code; + } + + // compute the codes -- this permutes the codes array from value + // order to length/code order + for (i = 0; i < n; ++i) { + j = nextIndex[tab->codes[i].len]++; + if (tab->codes[i].len == 0) + tab->codes[j].code = 0; + else + tab->codes[j].code = nextCode[tab->codes[i].len]++; + tab->codes[j].val = i; + } +} + +int FlateStream::getHuffmanCodeWord(FlateHuffmanTab *tab) { + int len; + int code; + int c; + int i, j; + + code = 0; + for (len = 1; len <= flateMaxHuffman; ++len) { + + // add a bit to the code + if (codeSize == 0) { + if ((c = str->getChar()) == EOF) + return EOF; + codeBuf = c & 0xff; + codeSize = 8; + } + code = (code << 1) | (codeBuf & 1); + codeBuf >>= 1; + --codeSize; + + // look for code + i = tab->start[len]; + j = tab->start[len + 1]; + if (i < j && code >= tab->codes[i].code && code <= tab->codes[j-1].code) { + i += code - tab->codes[i].code; + return tab->codes[i].val; + } + } + + // not found + error(getPos(), "Bad code (%04x) in flate stream", code); + return EOF; +} + +int FlateStream::getCodeWord(int bits) { + int c; + + while (codeSize < bits) { + if ((c = str->getChar()) == EOF) + return EOF; + codeBuf |= (c & 0xff) << codeSize; + codeSize += 8; + } + c = codeBuf & ((1 << bits) - 1); + codeBuf >>= bits; + codeSize -= bits; + return c; +} + +//------------------------------------------------------------------------ +// EOFStream +//------------------------------------------------------------------------ + +EOFStream::EOFStream(Stream *str1) { + str = str1; +} + +EOFStream::~EOFStream() { + delete str; +} + +//------------------------------------------------------------------------ +// FixedLengthEncoder +//------------------------------------------------------------------------ + +FixedLengthEncoder::FixedLengthEncoder(Stream *str1, int length1) { + str = str1; + length = length1; + count = 0; +} + +FixedLengthEncoder::~FixedLengthEncoder() { + if (str->isEncoder()) + delete str; +} + +void FixedLengthEncoder::reset() { + str->reset(); + count = 0; +} + +int FixedLengthEncoder::getChar() { + if (length >= 0 && count >= length) + return EOF; + ++count; + return str->getChar(); +} + +int FixedLengthEncoder::lookChar() { + if (length >= 0 && count >= length) + return EOF; + return str->getChar(); +} + +//------------------------------------------------------------------------ +// ASCII85Encoder +//------------------------------------------------------------------------ + +ASCII85Encoder::ASCII85Encoder(Stream *str1) { + str = str1; + bufPtr = bufEnd = buf; + lineLen = 0; + eof = gFalse; +} + +ASCII85Encoder::~ASCII85Encoder() { + if (str->isEncoder()) + delete str; +} + +void ASCII85Encoder::reset() { + str->reset(); + bufPtr = bufEnd = buf; + lineLen = 0; + eof = gFalse; +} + +GBool ASCII85Encoder::fillBuf() { + Gulong t; + char buf1[5]; + int c; + int n, i; + + if (eof) + return gFalse; + t = 0; + for (n = 0; n < 4; ++n) { + if ((c = str->getChar()) == EOF) + break; + t = (t << 8) + c; + } + bufPtr = bufEnd = buf; + if (n > 0) { + if (n == 4 && t == 0) { + *bufEnd++ = 'z'; + if (++lineLen == 65) { + *bufEnd++ = '\n'; + lineLen = 0; + } + } else { + if (n < 4) + t <<= 8 * (4 - n); + for (i = 4; i >= 0; --i) { + buf1[i] = (char)(t % 85 + 0x21); + t /= 85; + } + for (i = 0; i <= n; ++i) { + *bufEnd++ = buf1[i]; + if (++lineLen == 65) { + *bufEnd++ = '\n'; + lineLen = 0; + } + } + } + } + if (n < 4) { + *bufEnd++ = '~'; + *bufEnd++ = '>'; + eof = gTrue; + } + return bufPtr < bufEnd; +} + +//------------------------------------------------------------------------ +// RunLengthEncoder +//------------------------------------------------------------------------ + +RunLengthEncoder::RunLengthEncoder(Stream *str1) { + str = str1; + bufPtr = bufEnd = nextEnd = buf; + eof = gFalse; +} + +RunLengthEncoder::~RunLengthEncoder() { + if (str->isEncoder()) + delete str; +} + +void RunLengthEncoder::reset() { + str->reset(); + bufPtr = bufEnd = nextEnd = buf; + eof = gFalse; +} + +// +// When fillBuf finishes, buf[] looks like this: +// +-----+--------------+-----------------+-- +// + tag | ... data ... | next 0, 1, or 2 | +// +-----+--------------+-----------------+-- +// ^ ^ ^ +// bufPtr bufEnd nextEnd +// +GBool RunLengthEncoder::fillBuf() { + int c, c1, c2; + int n; + + // already hit EOF? + if (eof) + return gFalse; + + // grab two bytes + if (nextEnd < bufEnd + 1) { + if ((c1 = str->getChar()) == EOF) { + eof = gTrue; + return gFalse; + } + } else { + c1 = bufEnd[0] & 0xff; + } + if (nextEnd < bufEnd + 2) { + if ((c2 = str->getChar()) == EOF) { + eof = gTrue; + buf[0] = 0; + buf[1] = c1; + bufPtr = buf; + bufEnd = &buf[2]; + return gTrue; + } + } else { + c2 = bufEnd[1] & 0xff; + } + + // check for repeat + if (c1 == c2) { + n = 2; + while (n < 128 && (c = str->getChar()) == c1) + ++n; + buf[0] = (char)(257 - n); + buf[1] = c1; + bufEnd = &buf[2]; + if (c == EOF) { + eof = gTrue; + } else if (n < 128) { + buf[2] = c; + nextEnd = &buf[3]; + } else { + nextEnd = bufEnd; + } + + // get up to 128 chars + } else { + buf[1] = c1; + buf[2] = c2; + n = 2; + while (n < 128) { + if ((c = str->getChar()) == EOF) { + eof = gTrue; + break; + } + ++n; + buf[n] = c; + if (buf[n] == buf[n-1]) + break; + } + if (buf[n] == buf[n-1]) { + buf[0] = (char)(n-2-1); + bufEnd = &buf[n-1]; + nextEnd = &buf[n+1]; + } else { + buf[0] = (char)(n-1); + bufEnd = nextEnd = &buf[n+1]; + } + } + bufPtr = buf; + return gTrue; +} diff --git a/pdf/xpdf/Stream.h b/pdf/xpdf/Stream.h new file mode 100644 index 00000000..409d2ae4 --- /dev/null +++ b/pdf/xpdf/Stream.h @@ -0,0 +1,661 @@ +//======================================================================== +// +// Stream.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef STREAM_H +#define STREAM_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "gtypes.h" +#include "Object.h" + +//------------------------------------------------------------------------ + +enum StreamKind { + strFile, + strASCIIHex, + strASCII85, + strLZW, + strRunLength, + strCCITTFax, + strDCT, + strFlate, + strWeird // internal-use stream types +}; + +//------------------------------------------------------------------------ +// Stream (base class) +//------------------------------------------------------------------------ + +class Stream { +public: + + // Constructor. + Stream(); + + // Destructor. + virtual ~Stream(); + + // Reference counting. + int incRef() { return ++ref; } + int decRef() { return --ref; } + + // Get kind of stream. + virtual StreamKind getKind() = 0; + + // Reset stream to beginning. + virtual void reset() = 0; + + // Reset stream and allocate buffers for use by getPixel(). + // The image has pixels per line, components per + // pixel, and bits per component. + virtual void resetImage(int width1, int nComps1, int nBits1); + + // Get next char from stream. + virtual int getChar() = 0; + + // Peek at next char in stream. + virtual int lookChar() = 0; + + // Get next line from stream. + virtual char *getLine(char *buf, int size); + + // Gets the next pixel from the stream. (resetImage() must be called + // first.) should be able to hold at least nComps elements. + // Returns false at end of file. + virtual GBool getImagePixel(Guchar *pix); + + // Skip an entire line from the image. + virtual void skipImageLine(); + + // Get current position in file. + virtual int getPos() = 0; + + // Go to a position in the stream. + virtual void setPos(int pos1); + + // Get PostScript command for the filter(s). + virtual GString *getPSFilter(char *indent); + + // Does this stream type potentially contain non-printable chars? + virtual GBool isBinary(GBool last = gTrue) = 0; + + // Get the base FileStream or SubStream of this stream. + virtual Stream *getBaseStream() = 0; + + // Get the base file of this stream. + virtual FILE *getFile() = 0; + + // Get the dictionary associated with this stream. + virtual Dict *getDict() = 0; + + // Is this an encoding filter? + virtual GBool isEncoder() { return gFalse; } + + // Add filters to this stream according to the parameters in . + // Returns the new stream. + Stream *addFilters(Object *dict); + +private: + + Stream *makeFilter(char *name, Stream *str, Object *params); + + int ref; // reference count + +protected: + + //----- image stuff + int predictor; // predictor + int width; // pixels per line + int nComps; // components per pixel + int nBits; // bits per component + int nVals; // components per line + int pixBytes; // bytes per pixel + int rowBytes; // bytes per line + Guchar *rawLine; // raw line buffer + Guchar *pixLine; // pixel line buffer + int pixIdx; // current index in line buffer +}; + +//------------------------------------------------------------------------ +// FileStream +//------------------------------------------------------------------------ + +class FileStream: public Stream { +public: + + FileStream(FILE *f1, int start1, int length1, Object *dict1); + virtual ~FileStream(); + virtual StreamKind getKind() { return strFile; } + virtual void reset(); + virtual int getChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } + virtual int lookChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } + virtual int getPos() { return bufPos + (bufPtr - buf); } + virtual void setPos(int pos1); + virtual GBool isBinary(GBool last = gTrue) { return last; } + virtual Stream *getBaseStream() { return this; } + virtual FILE *getFile() { return f; } + virtual Dict *getDict() { return dict.getDict(); } + + // Check for a PDF header on this stream. Skip past some garbage + // if necessary. + GBool checkHeader(); + + // Get position of first byte of stream within the file. + int getStart() { return start; } + +private: + + GBool fillBuf(); + + FILE *f; + int start; + int length; + char buf[256]; + char *bufPtr; + char *bufEnd; + int bufPos; + int savePos; + Object dict; +}; + +//------------------------------------------------------------------------ +// SubStream +//------------------------------------------------------------------------ + +class SubStream: public Stream { +public: + + SubStream(Stream *str1, Object *dict1); + virtual ~SubStream(); + virtual StreamKind getKind() { return str->getKind(); } + virtual void reset() {} + virtual int getChar() { return str->getChar(); } + virtual int lookChar() { return str->lookChar(); } + virtual int getPos() { return str->getPos(); } + virtual GBool isBinary(GBool last = gTrue) { return last; } + virtual Stream *getBaseStream() { return this; } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return dict.getDict(); } + +private: + + Stream *str; + Object dict; +}; + +//------------------------------------------------------------------------ +// ASCIIHexStream +//------------------------------------------------------------------------ + +class ASCIIHexStream: public Stream { +public: + + ASCIIHexStream(Stream *str1); + virtual ~ASCIIHexStream(); + virtual StreamKind getKind() { return strASCIIHex; } + virtual void reset(); + virtual int getChar() + { int c = lookChar(); buf = EOF; return c; } + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; + int buf; + GBool eof; +}; + +//------------------------------------------------------------------------ +// ASCII85Stream +//------------------------------------------------------------------------ + +class ASCII85Stream: public Stream { +public: + + ASCII85Stream(Stream *str1); + virtual ~ASCII85Stream(); + virtual StreamKind getKind() { return strASCII85; } + virtual void reset(); + virtual int getChar() + { int ch = lookChar(); ++index; return ch; } + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; + int c[5]; + int b[4]; + int index, n; + GBool eof; +}; + +//------------------------------------------------------------------------ +// LZWStream +//------------------------------------------------------------------------ + +class LZWStream: public Stream { +public: + + LZWStream(Stream *str1, int predictor1, int columns1, int colors1, + int bits1, int early1); + virtual ~LZWStream(); + virtual StreamKind getKind() { return strLZW; } + virtual void reset(); + virtual int getChar(); + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; // stream + int early; // early parameter + char zCmd[256]; // uncompress command + FILE *zPipe; // uncompress pipe + char *zName; // .Z file name (in zCmd) + int inputBuf; // input buffer + int inputBits; // number of bits in input buffer + int inCodeBits; // size of input code + char buf[256]; // buffer + char *bufPtr; // next char to read + char *bufEnd; // end of buffer + + void dumpFile(FILE *f); + int getCode(); + GBool fillBuf(); +}; + +//------------------------------------------------------------------------ +// RunLengthStream +//------------------------------------------------------------------------ + +class RunLengthStream: public Stream { +public: + + RunLengthStream(Stream *str1); + virtual ~RunLengthStream(); + virtual StreamKind getKind() { return strRunLength; } + virtual void reset(); + virtual int getChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } + virtual int lookChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; + char buf[128]; // buffer + char *bufPtr; // next char to read + char *bufEnd; // end of buffer + GBool eof; + + GBool fillBuf(); +}; + +//------------------------------------------------------------------------ +// CCITTFaxStream +//------------------------------------------------------------------------ + +struct CCITTCodeTable; + +class CCITTFaxStream: public Stream { +public: + + CCITTFaxStream(Stream *str1, int encoding1, GBool byteAlign1, + int columns1, int rows1, GBool black1); + virtual ~CCITTFaxStream(); + virtual StreamKind getKind() { return strCCITTFax; } + virtual void reset(); + virtual int getChar() + { int c = lookChar(); buf = EOF; return c; } + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; // stream + int encoding; // 'K' parameter + GBool byteAlign; // 'EncodedByteAlign' parameter + int columns; // 'Columns' parameter + int rows; // 'Rows' parameter + GBool black; // 'BlackIs1' parameter + GBool eof; // true if at eof + GBool nextLine2D; // true if next line uses 2D encoding + int inputBuf; // input buffer + int inputBits; // number of bits in input buffer + short *refLine; // reference line changing elements + int b1; // index into refLine + short *codingLine; // coding line changing elements + int a0; // index into codingLine + int outputBits; // remaining ouput bits + int buf; // character buffer + + short getTwoDimCode(); + short getWhiteCode(); + short getBlackCode(); + short look13Bits(); + void eatBits(int bits) { inputBits -= bits; } +}; + +//------------------------------------------------------------------------ +// DCTStream +//------------------------------------------------------------------------ + +// DCT component info +struct DCTCompInfo { + int id; // component ID + GBool inScan; // is this component in the current scan? + int hSample, vSample; // horiz/vert sampling resolutions + int quantTable; // quantization table number + int dcHuffTable, acHuffTable; // Huffman table numbers + int prevDC; // DC coefficient accumulator +}; + +// DCT Huffman decoding table +struct DCTHuffTable { + Guchar firstSym[17]; // first symbol for this bit length + Gushort firstCode[17]; // first code for this bit length + Gushort numCodes[17]; // number of codes of this bit length + Guchar sym[256]; // symbols +}; + +class DCTStream: public Stream { +public: + + DCTStream(Stream *str1); + virtual ~DCTStream(); + virtual StreamKind getKind() { return strDCT; } + virtual void reset(); + virtual int getChar(); + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + Stream *getRawStream() { return str; } + +private: + + Stream *str; // stream + int width, height; // image size + int mcuWidth, mcuHeight; // size of min coding unit, in data units + DCTCompInfo compInfo[4]; // info for each component + int numComps; // number of components in image + int colorXform; // need YCbCr-to-RGB transform? + int restartInterval; // restart interval, in MCUs + Guchar quantTables[4][64]; // quantization tables + int numQuantTables; // number of quantization tables + DCTHuffTable dcHuffTables[4]; // DC Huffman tables + DCTHuffTable acHuffTables[4]; // AC Huffman tables + int numDCHuffTables; // number of DC Huffman tables + int numACHuffTables; // number of AC Huffman tables + Guchar *rowBuf[4][32]; // buffer for one MCU + int comp, x, y, dy; // current position within image/MCU + int restartCtr; // MCUs left until restart + int restartMarker; // next restart marker + int inputBuf; // input buffer for variable length codes + int inputBits; // number of valid bits in input buffer + + void restart(); + GBool readMCURow(); + GBool readDataUnit(DCTHuffTable *dcHuffTable, DCTHuffTable *acHuffTable, + Guchar quantTable[64], int *prevDC, Guchar data[64]); + int readHuffSym(DCTHuffTable *table); + int readAmp(int size); + int readBit(); + GBool readHeader(); + GBool readFrameInfo(); + GBool readScanInfo(); + GBool readQuantTables(); + GBool readHuffmanTables(); + GBool readRestartInterval(); + GBool readAdobeMarker(); + GBool readTrailer(); + int readMarker(); + int read16(); +}; + +//------------------------------------------------------------------------ +// FlateStream +//------------------------------------------------------------------------ + +#define flateWindow 32768 // buffer size +#define flateMask (flateWindow-1) +#define flateMaxHuffman 15 // max Huffman code length +#define flateMaxCodeLenCodes 19 // max # code length codes +#define flateMaxLitCodes 288 // max # literal codes +#define flateMaxDistCodes 30 // max # distance codes + +// Huffman code table entry +struct FlateCode { + int len; // code length in bits + int code; // code word + int val; // value represented by this code +}; + +// Huffman code table +struct FlateHuffmanTab { + int start[flateMaxHuffman+2]; // indexes of first code of each length + FlateCode *codes; // codes, sorted by length and code word +}; + +// Decoding info for length and distance code words +struct FlateDecode { + int bits; // # extra bits + int first; // first length/distance +}; + +class FlateStream: public Stream { +public: + + FlateStream(Stream *str1, int predictor1, int columns1, + int colors1, int bits1); + virtual ~FlateStream(); + virtual StreamKind getKind() { return strFlate; } + virtual void reset(); + virtual int getChar(); + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent); + virtual GBool isBinary(GBool last = gTrue); + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; // stream + Guchar buf[flateWindow]; // output data buffer + int index; // current index into output buffer + int remain; // number valid bytes in output buffer + int codeBuf; // input buffer + int codeSize; // number of bits in input buffer + FlateCode // literal and distance codes + allCodes[flateMaxLitCodes + flateMaxDistCodes]; + FlateHuffmanTab litCodeTab; // literal code table + FlateHuffmanTab distCodeTab; // distance code table + GBool compressedBlock; // set if reading a compressed block + int blockLen; // remaining length of uncompressed block + GBool endOfBlock; // set when end of block is reached + GBool eof; // set when end of stream is reached + + static int // code length code reordering + codeLenCodeMap[flateMaxCodeLenCodes]; + static FlateDecode // length decoding info + lengthDecode[flateMaxLitCodes-257]; + static FlateDecode // distance decoding info + distDecode[flateMaxDistCodes]; + + void readSome(); + GBool startBlock(); + void loadFixedCodes(); + GBool readDynamicCodes(); + void compHuffmanCodes(FlateHuffmanTab *tab, int n); + int getHuffmanCodeWord(FlateHuffmanTab *tab); + int getCodeWord(int bits); +}; + +//------------------------------------------------------------------------ +// EOFStream +//------------------------------------------------------------------------ + +class EOFStream: public Stream { +public: + + EOFStream(Stream *str1); + virtual ~EOFStream(); + virtual StreamKind getKind() { return strWeird; } + virtual void reset() {} + virtual int getChar() { return EOF; } + virtual int lookChar() { return EOF; } + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent) { return NULL; } + virtual GBool isBinary(GBool last = gTrue) { return gFalse; } + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + +private: + + Stream *str; +}; + +//------------------------------------------------------------------------ +// FixedLengthEncoder +//------------------------------------------------------------------------ + +class FixedLengthEncoder: public Stream { +public: + + FixedLengthEncoder(Stream *str1, int length1); + ~FixedLengthEncoder(); + virtual StreamKind getKind() { return strWeird; } + virtual void reset(); + virtual int getChar(); + virtual int lookChar(); + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent) { return NULL; } + virtual GBool isBinary(GBool last = gTrue) { return gFalse; } + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + virtual GBool isEncoder() { return gTrue; } + +private: + + Stream *str; + int length; + int count; +}; + +//------------------------------------------------------------------------ +// ASCII85Encoder +//------------------------------------------------------------------------ + +class ASCII85Encoder: public Stream { +public: + + ASCII85Encoder(Stream *str1); + virtual ~ASCII85Encoder(); + virtual StreamKind getKind() { return strWeird; } + virtual void reset(); + virtual int getChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } + virtual int lookChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent) { return NULL; } + virtual GBool isBinary(GBool last = gTrue) { return gFalse; } + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + virtual GBool isEncoder() { return gTrue; } + +private: + + Stream *str; + char buf[8]; + char *bufPtr; + char *bufEnd; + int lineLen; + GBool eof; + + GBool fillBuf(); +}; + +//------------------------------------------------------------------------ +// RunLengthEncoder +//------------------------------------------------------------------------ + +class RunLengthEncoder: public Stream { +public: + + RunLengthEncoder(Stream *str1); + virtual ~RunLengthEncoder(); + virtual StreamKind getKind() { return strWeird; } + virtual void reset(); + virtual int getChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } + virtual int lookChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } + virtual int getPos() { return str->getPos(); } + virtual GString *getPSFilter(char *indent) { return NULL; } + virtual GBool isBinary(GBool last = gTrue) { return gFalse; } + virtual Stream *getBaseStream() { return str->getBaseStream(); } + virtual FILE *getFile() { return str->getFile(); } + virtual Dict *getDict() { return str->getDict(); } + virtual GBool isEncoder() { return gTrue; } + +private: + + Stream *str; + char buf[131]; + char *bufPtr; + char *bufEnd; + char *nextEnd; + GBool eof; + + GBool fillBuf(); +}; + +#endif diff --git a/pdf/xpdf/TextOutputDev.cc b/pdf/xpdf/TextOutputDev.cc new file mode 100644 index 00000000..2d9ddde1 --- /dev/null +++ b/pdf/xpdf/TextOutputDev.cc @@ -0,0 +1,628 @@ +//======================================================================== +// +// TextOutputDev.cc +// +// Copyright 1997 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "GString.h" +#include "gmem.h" +#include "config.h" +#include "Error.h" +#include "GfxState.h" +#include "GfxFont.h" +#include "TextOutputDev.h" + +#include "TextOutputFontInfo.h" + +//------------------------------------------------------------------------ +// Character substitutions +//------------------------------------------------------------------------ + +static char *isoLatin1Subst[] = { + "L", // Lslash + "OE", // OE + "S", // Scaron + "Y", // Ydieresis + "Z", // Zcaron + "fi", // fi + "fl", // fl + "i", // dotlessi + "l", // lslash + "oe", // oe + "s", // scaron + "z", // zcaron + "*", // bullet + "...", // ellipsis + "-", "-", // emdash, hyphen + "\"", "\"", // quotedblleft, quotedblright + "'", // quotesingle + "TM" // trademark +}; + +static char *ascii7Subst[] = { + "A", "A", "A", "A", // A{acute,circumflex,dieresis,grave} + "A", "A", // A{ring,tilde} + "AE", // AE + "C", // Ccedilla + "E", "E", "E", "E", // E{acute,circumflex,dieresis,grave} + "I", "I", "I", "I", // I{acute,circumflex,dieresis,grave} + "L", // Lslash + "N", // Ntilde + "O", "O", "O", "O", // O{acute,circumflex,dieresis,grave} + "O", "O", // O{slash,tilde} + "OE", // OE + "S", // Scaron + "U", "U", "U", "U", // U{acute,circumflex,dieresis,grave} + "Y", "Y", // T{acute,dieresis} + "Z", // Zcaron + "a", "a", "a", "a", // a{acute,circumflex,dieresis,grave} + "a", "a", // a{ring,tilde} + "ae", // ae + "c", // ccedilla + "e", "e", "e", "e", // e{acute,circumflex,dieresis,grave} + "fi", // fi + "fl", // fl + "i", // dotlessi + "i", "i", "i", "i", // i{acute,circumflex,dieresis,grave} + "l", // lslash + "n", // ntilde + "o", "o", "o", "o", // o{acute,circumflex,dieresis,grave} + "o", "o", // o{slash,tilde} + "oe", // oe + "s", // scaron + "u", "u", "u", "u", // u{acute,circumflex,dieresis,grave} + "y", "y", // t{acute,dieresis} + "z", // zcaron + "|", // brokenbar + "*", // bullet + "...", // ellipsis + "-", "-", "-", // emdash, endash, hyphen + "\"", "\"", // quotedblleft, quotedblright + "'", // quotesingle + "(R)", // registered + "TM" // trademark +}; + +//------------------------------------------------------------------------ +// TextString +//------------------------------------------------------------------------ + +TextString::TextString(GfxState *state, GBool hexCodes1) { + double x, y, h; + + state->transform(state->getCurX(), state->getCurY(), &x, &y); + h = state->getTransformedFontSize(); + //~ yMin/yMax computation should use font ascent/descent values + yMin = y - 0.95 * h; + yMax = yMin + 1.3 * h; + col = 0; + text = new GString(); + xRight = NULL; + yxNext = NULL; + xyNext = NULL; + hexCodes = hexCodes1; +} + +TextString::~TextString() { + delete text; + gfree(xRight); +} + +void TextString::addChar(GfxState *state, double x, double y, + double dx, double dy, + Guchar c, GBool useASCII7) { + char *charName, *sub; + int c1; + int i, j, n, m; + + // get current index + i = text->getLength(); + + // append translated character(s) to string + sub = NULL; + n = 1; + if ((charName = state->getFont()->getCharName(c))) { + if (useASCII7) + c1 = ascii7Encoding.getCharCode(charName); + else + c1 = isoLatin1Encoding.getCharCode(charName); + if (c1 < 0) { + m = strlen(charName); + if (hexCodes && m == 3 && + (charName[0] == 'B' || charName[0] == 'C' || + charName[0] == 'G') && + isxdigit(charName[1]) && isxdigit(charName[2])) { + sscanf(charName+1, "%x", &c1); + } else if (!hexCodes && m >= 2 && m <= 3 && + isdigit(charName[0]) && isdigit(charName[1])) { + c1 = atoi(charName); + if (c1 >= 256) + c1 = -1; + } else if (!hexCodes && m >= 3 && m <= 5 && isdigit(charName[1])) { + c1 = atoi(charName+1); + if (c1 >= 256) + c1 = -1; + } + //~ this is a kludge -- is there a standard internal encoding + //~ used by all/most Type 1 fonts? + if (c1 == 262) // hyphen + c1 = 45; + else if (c1 == 266) // emdash + c1 = 208; + if (useASCII7) + c1 = ascii7Encoding.getCharCode(isoLatin1Encoding.getCharName(c1)); + } + if (useASCII7) { + if (c1 >= 128) { + sub = ascii7Subst[c1 - 128]; + n = strlen(sub); + } + } else { + if (c1 >= 256) { + sub = isoLatin1Subst[c1 - 256]; + n = strlen(sub); + } + } + } else { + c1 = -1; + } + if (sub) + text->append(sub); + else if (c1 >= 0) + text->append((char)c1); + else + text->append(' '); + + // update position information + if (i+n > ((i+15) & ~15)) + xRight = (double *)grealloc(xRight, ((i+n+15) & ~15) * sizeof(double)); + if (i == 0) + xMin = x; + for (j = 0; j < n; ++j) + xRight[i+j] = x + ((j+1) * dx) / n; + xMax = x + dx; +} + +//------------------------------------------------------------------------ +// TextPage +//------------------------------------------------------------------------ + +TextPage::TextPage(GBool useASCII71) { + useASCII7 = useASCII71; + curStr = NULL; + yxStrings = NULL; + xyStrings = NULL; +} + +TextPage::~TextPage() { + clear(); +} + +void TextPage::beginString(GfxState *state, GString *s, GBool hexCodes) { + curStr = new TextString(state, hexCodes); +} + +void TextPage::addChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c) { + double x1, y1, w1, h1; + + state->transform(x, y, &x1, &y1); + state->transformDelta(dx, dy, &w1, &h1); + curStr->addChar(state, x1, y1, w1, h1, c, useASCII7); +} + +void TextPage::endString() { + TextString *p1, *p2; + double h, y1, y2; + + // throw away zero-length strings -- they don't have valid xMin/xMax + // values, and they're useless anyway + if (curStr->text->getLength() == 0) { + delete curStr; + curStr = NULL; + return; + } + +#if 0 //~tmp + if (curStr->yMax - curStr->yMin > 20) { + delete curStr; + curStr = NULL; + return; + } +#endif + + // insert string in y-major list + h = curStr->yMax - curStr->yMin; + y1 = curStr->yMin + 0.5 * h; + y2 = curStr->yMin + 0.8 * h; + for (p1 = NULL, p2 = yxStrings; p2; p1 = p2, p2 = p2->yxNext) { + if (y1 < p2->yMin || (y2 < p2->yMax && curStr->xMax < p2->xMin)) + break; + } + if (p1) + p1->yxNext = curStr; + else + yxStrings = curStr; + curStr->yxNext = p2; + curStr = NULL; +} + +void TextPage::coalesce() { + TextString *str1, *str2; + double space, d; + int n, i; + +#if 0 //~ for debugging + for (str1 = yxStrings; str1; str1 = str1->yxNext) { + printf("x=%3d..%3d y=%3d..%3d size=%2d '%s'\n", + (int)str1->xMin, (int)str1->xMax, (int)str1->yMin, (int)str1->yMax, + (int)(str1->yMax - str1->yMin), str1->text->getCString()); + } + printf("\n------------------------------------------------------------\n\n"); +#endif + str1 = yxStrings; + while (str1 && (str2 = str1->yxNext)) { + space = str1->yMax - str1->yMin; + d = str2->xMin - str1->xMax; +#if 0 //~tmp + if (str2->yMin < str1->yMax && d > -0.1 * space && d < 0.2 * space) { +#else + if (str2->yMin < str1->yMax && d > -0.5 * space && d < space) { +#endif + n = str1->text->getLength(); + if (d > 0.1 * space) + str1->text->append(' '); + str1->text->append(str2->text); + str1->xRight = (double *) + grealloc(str1->xRight, str1->text->getLength() * sizeof(double)); + if (d > 0.1 * space) + str1->xRight[n++] = str2->xMin; + for (i = 0; i < str2->text->getLength(); ++i) + str1->xRight[n++] = str2->xRight[i]; + if (str2->xMax > str1->xMax) + str1->xMax = str2->xMax; + if (str2->yMax > str1->yMax) + str1->yMax = str2->yMax; + str1->yxNext = str2->yxNext; + delete str2; + } else { + str1 = str2; + } + } +} + +GBool TextPage::findText(char *s, GBool top, GBool bottom, + double *xMin, double *yMin, + double *xMax, double *yMax) { + TextString *str; + char *p, *p1, *q; + int n, m, i; + double x; + + // scan all strings on page + n = strlen(s); + for (str = yxStrings; str; str = str->yxNext) { + + // check: above top limit? + if (!top && (str->yMax < *yMin || + (str->yMin < *yMin && str->xMax <= *xMin))) + continue; + + // check: below bottom limit? + if (!bottom && (str->yMin > *yMax || + (str->yMax > *yMax && str->xMin >= *xMax))) + return gFalse; + + // search each position in this string + m = str->text->getLength(); + for (i = 0, p = str->text->getCString(); i <= m - n; ++i, ++p) { + + // check: above top limit? + if (!top && str->yMin < *yMin) { + x = (((i == 0) ? str->xMin : str->xRight[i-1]) + str->xRight[i]) / 2; + if (x < *xMin) + continue; + } + + // check: below bottom limit? + if (!bottom && str->yMax > *yMax) { + x = (((i == 0) ? str->xMin : str->xRight[i-1]) + str->xRight[i]) / 2; + if (x > *xMax) + return gFalse; + } + + // compare the strings + for (p1 = p, q = s; *q; ++p1, ++q) { + if (tolower(*p1) != tolower(*q)) + break; + } + + // found it + if (!*q) { + *xMin = (i == 0) ? str->xMin : str->xRight[i-1]; + *xMax = str->xRight[i+n-1]; + *yMin = str->yMin; + *yMax = str->yMax; + return gTrue; + } + } + } + return gFalse; +} + +GString *TextPage::getText(double xMin, double yMin, + double xMax, double yMax) { + GString *s; + TextString *str1; + double x0, x1, x2, y; + double xPrev, yPrev; + int i1, i2; + GBool multiLine; + + s = new GString(); + xPrev = yPrev = 0; + multiLine = gFalse; + for (str1 = yxStrings; str1; str1 = str1->yxNext) { + y = 0.5 * (str1->yMin + str1->yMax); + if (y > yMax) + break; + if (y > yMin && str1->xMin < xMax && str1->xMax > xMin) { + x0 = x1 = x2 = str1->xMin; + for (i1 = 0; i1 < str1->text->getLength(); ++i1) { + x0 = (i1==0) ? str1->xMin : str1->xRight[i1-1]; + x1 = str1->xRight[i1]; + if (0.5 * (x0 + x1) >= xMin) + break; + } + for (i2 = str1->text->getLength() - 1; i2 > i1; --i2) { + x1 = (i2==0) ? str1->xMin : str1->xRight[i2-1]; + x2 = str1->xRight[i2]; + if (0.5 * (x1 + x2) <= xMax) + break; + } + if (s->getLength() > 0) { + if (x0 < xPrev || str1->yMin > yPrev) { + s->append('\n'); + multiLine = gTrue; + } else { + s->append(" "); + } + } + s->append(str1->text->getCString() + i1, i2 - i1 + 1); + xPrev = x2; + yPrev = str1->yMax; + } + } + if (multiLine) + s->append('\n'); + return s; +} + +void TextPage::dump(FILE *f) { + TextString *str1, *str2, *str3; + double yMin, yMax; + int col1, col2; + double d; + + // build x-major list + xyStrings = NULL; + for (str1 = yxStrings; str1; str1 = str1->yxNext) { + for (str2 = NULL, str3 = xyStrings; + str3; + str2 = str3, str3 = str3->xyNext) { + if (str1->xMin < str3->xMin || + (str1->xMin == str3->xMin && str1->yMin < str3->yMin)) + break; + } + if (str2) + str2->xyNext = str1; + else + xyStrings = str1; + str1->xyNext = str3; + } + + // do column assignment + for (str1 = xyStrings; str1; str1 = str1->xyNext) { + col1 = 0; + for (str2 = xyStrings; str2 != str1; str2 = str2->xyNext) { + if (str1->xMin >= str2->xMax) { + col2 = str2->col + str2->text->getLength() + 4; + if (col2 > col1) + col1 = col2; + } else if (str1->xMin > str2->xMin) { + col2 = str2->col + + (int)(((str1->xMin - str2->xMin) / (str2->xMax - str2->xMin)) * + str2->text->getLength()); + if (col2 > col1) { + col1 = col2; + } + } + } + str1->col = col1; + } + +#if 0 //~ for debugging + fprintf(f, "~~~~~~~~~~\n"); + for (str1 = yxStrings; str1; str1 = str1->yxNext) { + fprintf(f, "(%4d,%4d) - (%4d,%4d) [%3d] %s\n", + (int)str1->xMin, (int)str1->yMin, (int)str1->xMax, (int)str1->yMax, + str1->col, str1->text->getCString()); + } + fprintf(f, "~~~~~~~~~~\n"); +#endif + + // output + col1 = 0; + yMax = yxStrings ? yxStrings->yMax : 0; + for (str1 = yxStrings; str1; str1 = str1->yxNext) { + + // line this string up with the correct column + for (; col1 < str1->col; ++col1) + fputc(' ', f); + + // print the string + fputs(str1->text->getCString(), f); + + // increment column + col1 += str1->text->getLength(); + + // update yMax for this line + if (str1->yMax > yMax) + yMax = str1->yMax; + + // if we've hit the end of the line... +#if 0 //~ + if (!(str1->yxNext && str1->yxNext->yMin < str1->yMax && + str1->yxNext->xMin >= str1->xMax)) { +#else + if (!(str1->yxNext && + str1->yxNext->yMin < 0.2*str1->yMin + 0.8*str1->yMax && + str1->yxNext->xMin >= str1->xMax)) { +#endif + + // print a return + fputc('\n', f); + + // print extra vertical space if necessary + if (str1->yxNext) { + + // find yMin for next line + yMin = str1->yxNext->yMin; + for (str2 = str1->yxNext; str2; str2 = str2->yxNext) { + if (str2->yMin < yMin) + yMin = str2->yMin; + if (!(str2->yxNext && str2->yxNext->yMin < str2->yMax && + str2->yxNext->xMin >= str2->xMax)) + break; + } + + // print the space + d = (int)((yMin - yMax) / (str1->yMax - str1->yMin) + 0.5); + for (; d > 0; --d) + fputc('\n', f); + } + + // set up for next line + col1 = 0; + yMax = str1->yxNext ? str1->yxNext->yMax : 0; + } + } +} + +void TextPage::clear() { + TextString *p1, *p2; + + if (curStr) { + delete curStr; + curStr = NULL; + } + for (p1 = yxStrings; p1; p1 = p2) { + p2 = p1->yxNext; + delete p1; + } + yxStrings = NULL; + xyStrings = NULL; +} + +//------------------------------------------------------------------------ +// TextOutputDev +//------------------------------------------------------------------------ + +TextOutputDev::TextOutputDev(char *fileName, GBool useASCII7) { + text = NULL; + ok = gTrue; + + // open file + needClose = gFalse; + if (fileName) { + if (!strcmp(fileName, "-")) { + f = stdout; + } else if ((f = fopen(fileName, "w"))) { + needClose = gTrue; + } else { + error(-1, "Couldn't open text file '%s'", fileName); + ok = gFalse; + return; + } + } else { + f = NULL; + } + + // set up text object + text = new TextPage(useASCII7); +} + +TextOutputDev::~TextOutputDev() { + if (needClose) + fclose(f); + if (text) + delete text; +} + +void TextOutputDev::startPage(int pageNum, GfxState *state) { + text->clear(); +} + +void TextOutputDev::endPage() { + text->coalesce(); + if (f) { + text->dump(f); + fputc('\n', f); + fputs("\f\n", f); + fputc('\n', f); + } +} + +void TextOutputDev::updateFont(GfxState *state) { + GfxFont *font; + char *charName; + int c; + + // look for hex char codes in subsetted font + hexCodes = gFalse; + if ((font = state->getFont())) { + for (c = 0; c < 256; ++c) { + if ((charName = font->getCharName(c))) { + if ((charName[0] == 'B' || charName[0] == 'C' || + charName[0] == 'G') && + strlen(charName) == 3 && + ((charName[1] >= 'a' && charName[1] <= 'f') || + (charName[1] >= 'A' && charName[1] <= 'F') || + (charName[2] >= 'a' && charName[2] <= 'f') || + (charName[2] >= 'A' && charName[2] <= 'F'))) { + hexCodes = gTrue; + break; + } + } + } + } +} + +void TextOutputDev::beginString(GfxState *state, GString *s) { + text->beginString(state, s, hexCodes); +} + +void TextOutputDev::endString(GfxState *state) { + text->endString(); +} + +void TextOutputDev::drawChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c) { + text->addChar(state, x, y, dx, dy, c); +} + +GBool TextOutputDev::findText(char *s, GBool top, GBool bottom, + double *xMin, double *yMin, + double *xMax, double *yMax) { + return text->findText(s, top, bottom, xMin, yMin, xMax, yMax); +} diff --git a/pdf/xpdf/TextOutputDev.h b/pdf/xpdf/TextOutputDev.h new file mode 100644 index 00000000..8c1cc778 --- /dev/null +++ b/pdf/xpdf/TextOutputDev.h @@ -0,0 +1,176 @@ +//======================================================================== +// +// TextOutputDev.h +// +// Copyright 1997 Derek B. Noonburg +// +//======================================================================== + +#ifndef TEXTOUTPUTDEV_H +#define TEXTOUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "gtypes.h" +#include "OutputDev.h" + +class GfxState; +class GfxFont; +class GString; + +//------------------------------------------------------------------------ +// TextString +//------------------------------------------------------------------------ + +class TextString { +public: + + // Constructor. + TextString(GfxState *state, GBool hexCodes1); + + // Destructor. + ~TextString(); + + // Add a character to the string. + void addChar(GfxState *state, double x, double y, + double dx, double dy, + Guchar c, GBool useASCII7); + +private: + + double xMin, xMax; // bounding box x coordinates + double yMin, yMax; // bounding box y coordinates + int col; // starting column + GString *text; // the text + double *xRight; // right-hand x coord of each char + TextString *yxNext; // next string in y-major order + TextString *xyNext; // next string in x-major order + GBool hexCodes; // subsetted font with hex char codes + + friend class TextPage; +}; + +//------------------------------------------------------------------------ +// TextPage +//------------------------------------------------------------------------ + +class TextPage { +public: + + // Constructor. + TextPage(GBool useASCII71); + + // Destructor. + ~TextPage(); + + // Begin a new string. + void beginString(GfxState *state, GString *s, GBool hex1); + + // Add a character to the current string. + void addChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c); + + // End the current string, sorting it into the list of strings. + void endString(); + + // Coalesce strings that look like parts of the same line. + void coalesce(); + + // Find a string. If is true, starts looking at top of page; + // otherwise starts looking at ,. If is true, + // stops looking at bottom of page; otherwise stops looking at + // ,. If found, sets the text bounding rectange and + // returns true; otherwise returns false. + GBool findText(char *s, GBool top, GBool bottom, + double *xMin, double *yMin, + double *xMax, double *yMax); + + // Get the text which is inside the specified rectangle. + GString *getText(double xMin, double yMin, + double xMax, double yMax); + + // Dump contents of page to a file. + void dump(FILE *f); + + // Clear the page. + void clear(); + +private: + + GBool useASCII7; // use 7-bit ASCII? + + TextString *curStr; // currently active string + + TextString *yxStrings; // strings in y-major order + TextString *xyStrings; // strings in x-major order +}; + +//------------------------------------------------------------------------ +// TextOutputDev +//------------------------------------------------------------------------ + +class TextOutputDev: public OutputDev { +public: + + // Open a text output file. If is NULL, no file is written + // (this is useful, e.g., for searching text). If is true, + // text is converted to 7-bit ASCII; otherwise, text is converted to + // 8-bit ISO Latin-1. + TextOutputDev(char *fileName, GBool useASCII7); + + // Destructor. + virtual ~TextOutputDev(); + + // Check if file was successfully created. + virtual GBool isOk() { return ok; } + + //---- get info about output device + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) + virtual GBool upsideDown() { return gTrue; } + + // Does this device use drawChar() or drawString()? + virtual GBool useDrawChar() { return gTrue; } + + //----- initialization and control + + // Start a page. + virtual void startPage(int pageNum, GfxState *state); + + // End a page. + virtual void endPage(); + + //----- update text state + virtual void updateFont(GfxState *state); + + //----- text drawing + virtual void beginString(GfxState *state, GString *s); + virtual void endString(GfxState *state); + virtual void drawChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c); + + //----- special access + + // Find a string. If is true, starts looking at top of page; + // otherwise starts looking at ,. If is true, + // stops looking at bottom of page; otherwise stops looking at + // ,. If found, sets the text bounding rectange and + // returns true; otherwise returns false. + GBool findText(char *s, GBool top, GBool bottom, + double *xMin, double *yMin, + double *xMax, double *yMax); + +private: + + FILE *f; // text file + GBool needClose; // need to close the file? + TextPage *text; // text for the current page + GBool hexCodes; // subsetted font with hex char codes + GBool ok; // set up ok? +}; + +#endif diff --git a/pdf/xpdf/TextOutputFontInfo.h b/pdf/xpdf/TextOutputFontInfo.h new file mode 100644 index 00000000..0f385cbb --- /dev/null +++ b/pdf/xpdf/TextOutputFontInfo.h @@ -0,0 +1,514 @@ +//======================================================================== +// +// TextOutputFontInfo.h +// +// This file was automatically generated by makeTextFontInfo. +// +// Copyright 1997 Derek B. Noonburg +// +//======================================================================== + +#ifndef TEXTFONTINFO_H +#define TEXTFONTINFO_H + +//------------------------------------------------------------------------ +// Character encodings. +//------------------------------------------------------------------------ + +#define ascii7EncodingSize 208 +static char *ascii7EncodingNames[ascii7EncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "minus", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + NULL, + "Aacute", + "Acircumflex", + "Adieresis", + "Agrave", + "Aring", + "Atilde", + "AE", + "Ccedilla", + "Eacute", + "Ecircumflex", + "Edieresis", + "Egrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Igrave", + "Lslash", + "Ntilde", + "Oacute", + "Ocircumflex", + "Odieresis", + "Ograve", + "Oslash", + "Otilde", + "OE", + "Scaron", + "Uacute", + "Ucircumflex", + "Udieresis", + "Ugrave", + "Yacute", + "Ydieresis", + "Zcaron", + "aacute", + "acircumflex", + "adieresis", + "agrave", + "aring", + "atilde", + "ae", + "ccedilla", + "eacute", + "ecircumflex", + "edieresis", + "egrave", + "fi", + "fl", + "dotlessi", + "iacute", + "icircumflex", + "idieresis", + "igrave", + "lslash", + "ntilde", + "oacute", + "ocircumflex", + "odieresis", + "ograve", + "oslash", + "otilde", + "oe", + "scaron", + "uacute", + "ucircumflex", + "udieresis", + "ugrave", + "yacute", + "ydieresis", + "zcaron", + "brokenbar", + "bullet", + "ellipsis", + "emdash", + "endash", + "hyphen", + "quotedblleft", + "quotedblright", + "quotesingle", + "registered", + "trademark" +}; +static GfxFontEncoding ascii7Encoding(ascii7EncodingNames, + ascii7EncodingSize); + +#define isoLatin1EncodingSize 276 +static char *isoLatin1EncodingNames[isoLatin1EncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "minus", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "exclamdown", + "cent", + "sterling", + "currency", + "yen", + "brokenbar", + "section", + "dieresis", + "copyright", + "ordfeminine", + "guillemotleft", + "logicalnot", + "endash", + "registered", + "macron", + "degree", + "plusminus", + "twosuperior", + "threesuperior", + "acute", + "mu", + "paragraph", + "periodcentered", + "cedilla", + "onesuperior", + "ordmasculine", + "guillemotright", + "onequarter", + "onehalf", + "threequarters", + "questiondown", + "Agrave", + "Aacute", + "Acircumflex", + "Atilde", + "Adieresis", + "Aring", + "AE", + "Ccedilla", + "Egrave", + "Eacute", + "Ecircumflex", + "Edieresis", + "Igrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Eth", + "Ntilde", + "Ograve", + "Oacute", + "Ocircumflex", + "Otilde", + "Odieresis", + "multiply", + "Oslash", + "Ugrave", + "Uacute", + "Ucircumflex", + "Udieresis", + "Yacute", + "Thorn", + "germandbls", + "agrave", + "aacute", + "acircumflex", + "atilde", + "adieresis", + "aring", + "ae", + "ccedilla", + "egrave", + "eacute", + "ecircumflex", + "edieresis", + "igrave", + "iacute", + "icircumflex", + "idieresis", + "eth", + "ntilde", + "ograve", + "oacute", + "ocircumflex", + "otilde", + "odieresis", + "divide", + "oslash", + "ugrave", + "uacute", + "ucircumflex", + "udieresis", + "yacute", + "thorn", + "ydieresis", + "Lslash", + "OE", + "Scaron", + "Ydieresis", + "Zcaron", + "fi", + "fl", + "dotlessi", + "lslash", + "oe", + "scaron", + "zcaron", + "bullet", + "ellipsis", + "emdash", + "hyphen", + "quotedblleft", + "quotedblright", + "quotesingle", + "trademark" +}; +static GfxFontEncoding isoLatin1Encoding(isoLatin1EncodingNames, + isoLatin1EncodingSize); + +#endif diff --git a/pdf/xpdf/XOutputDev.cc b/pdf/xpdf/XOutputDev.cc new file mode 100644 index 00000000..3e762f62 --- /dev/null +++ b/pdf/xpdf/XOutputDev.cc @@ -0,0 +1,2183 @@ +//======================================================================== +// +// XOutputDev.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include +#include +#include "gmem.h" +#include "GString.h" +#include "Object.h" +#include "Stream.h" +#include "GfxState.h" +#include "GfxFont.h" +#include "Error.h" +#include "Params.h" +#include "TextOutputDev.h" +#include "XOutputDev.h" + +#include "XOutputFontInfo.h" + +#ifdef XlibSpecificationRelease +#if XlibSpecificationRelease < 5 +typedef char *XPointer; +#endif +#else +typedef char *XPointer; +#endif + +//------------------------------------------------------------------------ +// Constants and macros +//------------------------------------------------------------------------ + +#define xoutRound(x) ((int)(x + 0.5)) + +#define maxCurveSplits 6 // max number of splits when recursively + // drawing Bezier curves + +//------------------------------------------------------------------------ +// Parameters +//------------------------------------------------------------------------ + +GBool installCmap; + +int rgbCubeSize; + +//------------------------------------------------------------------------ +// Font map +//------------------------------------------------------------------------ + +struct FontMapEntry { + char *pdfFont; + char *xFont; + GfxFontEncoding *encoding; +}; + +static FontMapEntry fontMap[] = { + {"Courier", + "-*-courier-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Courier-Bold", + "-*-courier-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Courier-BoldOblique", + "-*-courier-bold-o-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Courier-Oblique", + "-*-courier-medium-o-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Helvetica", + "-*-helvetica-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Helvetica-Bold", + "-*-helvetica-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Helvetica-BoldOblique", + "-*-helvetica-bold-o-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Helvetica-Oblique", + "-*-helvetica-medium-o-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Symbol", + "-*-symbol-medium-r-normal-*-%s-*-*-*-*-*-adobe-fontspecific", + &symbolEncoding}, + {"Times-Bold", + "-*-times-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Times-BoldItalic", + "-*-times-bold-i-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Times-Italic", + "-*-times-medium-i-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"Times-Roman", + "-*-times-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", + &isoLatin1Encoding}, + {"ZapfDingbats", + "-*-zapfdingbats-medium-r-normal-*-%s-*-*-*-*-*-*-*", + &zapfDingbatsEncoding}, + {NULL} +}; + +static FontMapEntry *userFontMap; + +//------------------------------------------------------------------------ +// Font substitutions +//------------------------------------------------------------------------ + +struct FontSubst { + char *xFont; + double mWidth; +}; + +// index: {symbolic:12, fixed:8, serif:4, sans-serif:0} + bold*2 + italic +static FontSubst fontSubst[16] = { + {"-*-helvetica-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", 0.833}, + {"-*-helvetica-medium-o-normal-*-%s-*-*-*-*-*-iso8859-1", 0.833}, + {"-*-helvetica-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", 0.889}, + {"-*-helvetica-bold-o-normal-*-%s-*-*-*-*-*-iso8859-1", 0.889}, + {"-*-times-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", 0.788}, + {"-*-times-medium-i-normal-*-%s-*-*-*-*-*-iso8859-1", 0.722}, + {"-*-times-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", 0.833}, + {"-*-times-bold-i-normal-*-%s-*-*-*-*-*-iso8859-1", 0.778}, + {"-*-courier-medium-r-normal-*-%s-*-*-*-*-*-iso8859-1", 0.600}, + {"-*-courier-medium-o-normal-*-%s-*-*-*-*-*-iso8859-1", 0.600}, + {"-*-courier-bold-r-normal-*-%s-*-*-*-*-*-iso8859-1", 0.600}, + {"-*-courier-bold-o-normal-*-%s-*-*-*-*-*-iso8859-1", 0.600}, + {"-*-symbol-medium-r-normal-*-%s-*-*-*-*-*-adobe-fontspecific", 0.576}, + {"-*-symbol-medium-r-normal-*-%s-*-*-*-*-*-adobe-fontspecific", 0.576}, + {"-*-symbol-medium-r-normal-*-%s-*-*-*-*-*-adobe-fontspecific", 0.576}, + {"-*-symbol-medium-r-normal-*-%s-*-*-*-*-*-adobe-fontspecific", 0.576} +}; + +//------------------------------------------------------------------------ +// 16-bit fonts +//------------------------------------------------------------------------ + +#if JAPANESE_SUPPORT + +static char *japan12Font = "-*-fixed-medium-r-normal-*-%s-*-*-*-*-*-jisx0208.1983-0"; + +// CID 0 .. 96 +static Gushort japan12Map[96] = { + 0x2120, 0x2120, 0x212a, 0x2149, 0x2174, 0x2170, 0x2173, 0x2175, // 00 .. 07 + 0x2147, 0x214a, 0x214b, 0x2176, 0x215c, 0x2124, 0x213e, 0x2123, // 08 .. 0f + 0x213f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, // 10 .. 17 + 0x2337, 0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, // 18 .. 1f + 0x2129, 0x2177, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, // 20 .. 27 + 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, // 28 .. 2f + 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, // 30 .. 37 + 0x2357, 0x2358, 0x2359, 0x235a, 0x214e, 0x216f, 0x214f, 0x2130, // 38 .. 3f + 0x2132, 0x2146, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, // 40 .. 47 + 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, // 48 .. 4f + 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, // 50 .. 57 + 0x2377, 0x2378, 0x2379, 0x237a, 0x2150, 0x2143, 0x2151, 0x2141 // 58 .. 5f +}; + +// CID 325 .. 421 +static Gushort japan12KanaMap1[97] = { + 0x2131, 0x2121, 0x2123, 0x2156, 0x2157, 0x2122, 0x2126, 0x2572, + 0x2521, 0x2523, 0x2525, 0x2527, 0x2529, 0x2563, 0x2565, 0x2567, + 0x2543, 0x213c, 0x2522, 0x2524, 0x2526, 0x2528, 0x252a, 0x252b, + 0x252d, 0x252f, 0x2531, 0x2533, 0x2535, 0x2537, 0x2539, 0x253b, + 0x253d, 0x253f, 0x2541, 0x2544, 0x2546, 0x2548, 0x254a, 0x254b, + 0x254c, 0x254d, 0x254e, 0x254f, 0x2552, 0x2555, 0x2558, 0x255b, + 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2564, 0x2566, 0x2568, + 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256f, 0x2573, 0x212b, + 0x212c, 0x212e, 0x2570, 0x2571, 0x256e, 0x2575, 0x2576, 0x2574, + 0x252c, 0x252e, 0x2530, 0x2532, 0x2534, 0x2536, 0x2538, 0x253a, + 0x253c, 0x253e, 0x2540, 0x2542, 0x2545, 0x2547, 0x2549, 0x2550, + 0x2551, 0x2553, 0x2554, 0x2556, 0x2557, 0x2559, 0x255a, 0x255c, + 0x255d +}; + +// CID 501 .. 598 +static Gushort japan12KanaMap2[98] = { + 0x212d, 0x212f, 0x216d, 0x214c, 0x214d, 0x2152, 0x2153, 0x2154, + 0x2155, 0x2158, 0x2159, 0x215a, 0x215b, 0x213d, 0x2121, 0x2472, + 0x2421, 0x2423, 0x2425, 0x2427, 0x2429, 0x2463, 0x2465, 0x2467, + 0x2443, 0x2422, 0x2424, 0x2426, 0x2428, 0x242a, 0x242b, 0x242d, + 0x242f, 0x2431, 0x2433, 0x2435, 0x2437, 0x2439, 0x243b, 0x243d, + 0x243f, 0x2441, 0x2444, 0x2446, 0x2448, 0x244a, 0x244b, 0x244c, + 0x244d, 0x244e, 0x244f, 0x2452, 0x2455, 0x2458, 0x245b, 0x245e, + 0x245f, 0x2460, 0x2461, 0x2462, 0x2464, 0x2466, 0x2468, 0x2469, + 0x246a, 0x246b, 0x246c, 0x246d, 0x246f, 0x2473, 0x2470, 0x2471, + 0x246e, 0x242c, 0x242e, 0x2430, 0x2432, 0x2434, 0x2436, 0x2438, + 0x243a, 0x243c, 0x243e, 0x2440, 0x2442, 0x2445, 0x2447, 0x2449, + 0x2450, 0x2451, 0x2453, 0x2454, 0x2456, 0x2457, 0x2459, 0x245a, + 0x245c, 0x245d +}; + +static char *japan12Roman[10] = { + "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X" +}; + +static char *japan12Abbrev1[6] = { + "mm", "cm", "km", "mg", "kg", "cc" +}; + +#endif + +//------------------------------------------------------------------------ +// Constructed characters +//------------------------------------------------------------------------ + +#define lastRegularChar 0x0ff +#define firstSubstChar 0x100 +#define lastSubstChar 0x104 +#define firstConstrChar 0x105 +#define lastConstrChar 0x106 +#define firstMultiChar 0x107 +#define lastMultiChar 0x10d + +// substituted chars +static Guchar substChars[] = { + 0x27, // 100: quotesingle --> quoteright + 0x2d, // 101: emdash --> hyphen + 0xad, // 102: hyphen --> endash + 0x2f, // 103: fraction --> slash + 0xb0, // 104: ring --> degree +}; + +// constructed chars +// 105: bullet +// 106: trademark + +// built-up chars +static char *multiChars[] = { + "fi", // 107: fi + "fl", // 108: fl + "OE", // 109: OE + "oe", // 10a: oe + "...", // 10b: ellipsis + "``", // 10c: quotedblleft + "''" // 10d: quotedblright +}; + +// ignored chars +// 10c: Lslash +// 10d: Scaron +// 10e: Zcaron +// 10f: Ydieresis +// 110: breve +// 111: caron +// 112: circumflex +// 113: dagger +// 114: daggerdbl +// 115: dotaccent +// 116: dotlessi +// 117: florin +// 118: grave +// 119: guilsinglleft +// 11a: guilsinglright +// 11b: hungarumlaut +// 11c: lslash +// 11d: ogonek +// 11e: perthousand +// 11f: quotedblbase +// 120: quotesinglbase +// 121: scaron +// 122: tilde +// 123: zcaron + +//------------------------------------------------------------------------ +// XOutputFont +//------------------------------------------------------------------------ + +// Note: if real font is substantially narrower than substituted +// font, the size is reduced accordingly. +XOutputFont::XOutputFont(GfxFont *gfxFont, double m11, double m12, + double m21, double m22, Display *display1) { + GString *pdfFont; + FontMapEntry *p; + GfxFontEncoding *encoding; + char *fontNameFmt; + char fontName[200], fontSize[100]; + GBool rotated; + double size; + int startSize, sz; + int index; + int code, code2; + double w1, w2, v; + double *fm; + char *charName; + int n; + + // init + id = gfxFont->getID(); + mat11 = m11; + mat12 = m12; + mat21 = m21; + mat22 = m22; + display = display1; + xFont = NULL; + hex = gFalse; + + // construct X font name + if (gfxFont->is16Bit()) { + fontNameFmt = fontSubst[0].xFont; + switch (gfxFont->getCharSet16()) { + case font16AdobeJapan12: +#if JAPANESE_SUPPORT + fontNameFmt = japan12Font; +#endif + break; + } + } else { + pdfFont = gfxFont->getName(); + if (pdfFont) { + for (p = userFontMap; p->pdfFont; ++p) { + if (!pdfFont->cmp(p->pdfFont)) + break; + } + if (!p->pdfFont) { + for (p = fontMap; p->pdfFont; ++p) { + if (!pdfFont->cmp(p->pdfFont)) + break; + } + } + } else { + p = NULL; + } + if (p && p->pdfFont) { + fontNameFmt = p->xFont; + encoding = p->encoding; + } else { + encoding = &isoLatin1Encoding; +//~ Some non-symbolic fonts are tagged as symbolic. +// if (gfxFont->isSymbolic()) { +// index = 12; +// encoding = symbolEncoding; +// } else + if (gfxFont->isFixedWidth()) { + index = 8; + } else if (gfxFont->isSerif()) { + index = 4; + } else { + index = 0; + } + if (gfxFont->isBold()) + index += 2; + if (gfxFont->isItalic()) + index += 1; + if ((code = gfxFont->getCharCode("m")) >= 0) + w1 = gfxFont->getWidth(code); + else + w1 = 0; + w2 = fontSubst[index].mWidth; + if (gfxFont->getType() == fontType3) { + // This is a hack which makes it possible to substitute for some + // Type 3 fonts. The problem is that it's impossible to know what + // the base coordinate system used in the font is without actually + // rendering the font. This code tries to guess by looking at the + // width of the character 'm' (which breaks if the font is a + // subset that doesn't contain 'm'). + if (w1 > 0 && (w1 > 1.1 * w2 || w1 < 0.9 * w2)) { + w1 /= w2; + mat11 *= w1; + mat12 *= w1; + mat21 *= w1; + mat22 *= w1; + } + fm = gfxFont->getFontMatrix(); + v = (fm[0] == 0) ? 1 : (fm[3] / fm[0]); + mat12 *= v; + mat22 *= v; + } else if (!gfxFont->isSymbolic()) { + if (w1 > 0.01 && w1 < 0.9 * w2) { + w1 /= w2; + if (w1 < 0.8) + w1 = 0.8; + mat11 *= w1; + mat12 *= w1; + mat21 *= w1; + mat22 *= w1; + } + } + fontNameFmt = fontSubst[index].xFont; + } + + // Construct forward and reverse map. + // This tries to deal with font subset character names of the + // form 'Bxx', 'Cxx', 'Gxx', with decimal or hex numbering. + for (code = 0; code < 256; ++code) + revMap[code] = 0; + if (encoding) { + for (code = 0; code < 256; ++code) { + if ((charName = gfxFont->getCharName(code))) { + if ((charName[0] == 'B' || charName[0] == 'C' || + charName[0] == 'G') && + strlen(charName) == 3 && + ((charName[1] >= 'a' && charName[1] <= 'f') || + (charName[1] >= 'A' && charName[1] <= 'F') || + (charName[2] >= 'a' && charName[2] <= 'f') || + (charName[2] >= 'A' && charName[2] <= 'F'))) { + hex = gTrue; + break; + } + } + } + for (code = 0; code < 256; ++code) { + if ((charName = gfxFont->getCharName(code))) { + if ((code2 = encoding->getCharCode(charName)) < 0) { + n = strlen(charName); + if (hex && n == 3 && + (charName[0] == 'B' || charName[0] == 'C' || + charName[0] == 'G') && + isxdigit(charName[1]) && isxdigit(charName[2])) { + sscanf(charName+1, "%x", &code2); + } else if (!hex && n >= 2 && n <= 3 && + isdigit(charName[0]) && isdigit(charName[1])) { + code2 = atoi(charName); + if (code2 >= 256) + code2 = -1; + } else if (!hex && n >= 3 && n <= 5 && isdigit(charName[1])) { + code2 = atoi(charName+1); + if (code2 >= 256) + code2 = -1; + } + //~ this is a kludge -- is there a standard internal encoding + //~ used by all/most Type 1 fonts? + if (code2 == 262) // hyphen + code2 = 45; + else if (code2 == 266) // emdash + code2 = 208; + } + if (code2 >= 0) { + map[code] = (Gushort)code2; + if (code2 < 256) + revMap[code2] = (Guchar)code; + } else { + map[code] = 0; + } + } else { + map[code] = 0; + } + } + } else { + code2 = 0; // to make gcc happy + //~ this is a hack to get around the fact that X won't draw + //~ chars 0..31; this works when the fonts have duplicate encodings + //~ for those chars + for (code = 0; code < 32; ++code) { + if ((charName = gfxFont->getCharName(code)) && + (code2 = gfxFont->getCharCode(charName)) >= 0) { + map[code] = (Gushort)code2; + if (code2 < 256) + revMap[code2] = (Guchar)code; + } + } + for (code = 32; code < 256; ++code) { + map[code] = (Gushort)code; + revMap[code] = (Guchar)code; + } + } + } + + // compute size, normalize matrix + size = sqrt(mat21*mat21 + mat22*mat22); + mat11 = mat11 / size; + mat12 = -mat12 / size; + mat21 = mat21 / size; + mat22 = -mat22 / size; + startSize = (int)size; + + // try to get a rotated font? + rotated = !(mat11 > 0 && mat22 > 0 && fabs(mat11/mat22 - 1) < 0.2 && + fabs(mat12) < 0.01 && fabs(mat21) < 0.01); + + // open X font -- if font is not found (which means the server can't + // scale fonts), try progressively smaller and then larger sizes + //~ This does a linear search -- it should get a list of fonts from + //~ the server and pick the closest. + if (rotated) + sprintf(fontSize, "[%s%0.2f %s%0.2f %s%0.2f %s%0.2f]", + mat11<0 ? "~" : "", fabs(mat11 * startSize), + mat12<0 ? "~" : "", fabs(mat12 * startSize), + mat21<0 ? "~" : "", fabs(mat21 * startSize), + mat22<0 ? "~" : "", fabs(mat22 * startSize)); + else + sprintf(fontSize, "%d", startSize); + sprintf(fontName, fontNameFmt, fontSize); + xFont = XLoadQueryFont(display, fontName); + if (!xFont) { + for (sz = startSize; sz >= startSize/2 && sz >= 1; --sz) { + sprintf(fontSize, "%d", sz); + sprintf(fontName, fontNameFmt, fontSize); + if ((xFont = XLoadQueryFont(display, fontName))) + break; + } + if (!xFont) { + for (sz = startSize + 1; sz < startSize + 10; ++sz) { + sprintf(fontSize, "%d", sz); + sprintf(fontName, fontNameFmt, fontSize); + if ((xFont = XLoadQueryFont(display, fontName))) + break; + } + if (!xFont) { + sprintf(fontSize, "%d", startSize); + sprintf(fontName, fontNameFmt, fontSize); + error(-1, "Failed to open font: '%s'", fontName); + return; + } + } + } +} + +XOutputFont::~XOutputFont() { + if (xFont) + XFreeFont(display, xFont); +} + +//------------------------------------------------------------------------ +// XOutputFontCache +//------------------------------------------------------------------------ + +XOutputFontCache::XOutputFontCache(Display *display1) { + int i; + + display = display1; + for (i = 0; i < fontCacheSize; ++i) + fonts[i] = NULL; + numFonts = 0; +} + +XOutputFontCache::~XOutputFontCache() { + int i; + + for (i = 0; i < numFonts; ++i) + delete fonts[i]; +} + +XOutputFont *XOutputFontCache::getFont(GfxFont *gfxFont, + double m11, double m12, + double m21, double m22) { + XOutputFont *font; + int i, j; + + // is it the most recently used font? + if (numFonts > 0 && fonts[0]->matches(gfxFont->getID(), + m11, m12, m21, m22)) + return fonts[0]; + + // is it in the cache? + for (i = 1; i < numFonts; ++i) { + if (fonts[i]->matches(gfxFont->getID(), m11, m12, m21, m22)) { + font = fonts[i]; + for (j = i; j > 0; --j) + fonts[j] = fonts[j-1]; + fonts[0] = font; + return font; + } + } + + // make a new font + font = new XOutputFont(gfxFont, m11, m12, m21, m22, display); + if (!font->getXFont()) { + delete font; + return NULL; + } + + // insert font in cache + if (numFonts == fontCacheSize) { + --numFonts; + delete fonts[numFonts]; + } + for (j = numFonts; j > 0; --j) + fonts[j] = fonts[j-1]; + fonts[0] = font; + ++numFonts; + + // return it + return font; +} + +//------------------------------------------------------------------------ +// XOutputDev +//------------------------------------------------------------------------ + +XOutputDev::XOutputDev(Display *display1, Pixmap pixmap1, Guint depth1, + Colormap colormap, unsigned long paperColor) { + XVisualInfo visualTempl; + XVisualInfo *visualList; + int nVisuals; + Gulong mask; + XGCValues gcValues; + XColor xcolor; + XColor *xcolors; + int r, g, b, n, m, i; + GBool ok; + + // get display/pixmap info + display = display1; + screenNum = DefaultScreen(display); + pixmap = pixmap1; + depth = depth1; + + // check for TrueColor visual + trueColor = gFalse; + if (depth == 0) { + depth = DefaultDepth(display, screenNum); + visualList = XGetVisualInfo(display, 0, &visualTempl, &nVisuals); + for (i = 0; i < nVisuals; ++i) { + if (visualList[i].visual == DefaultVisual(display, screenNum)) { + if (visualList[i].c_class == TrueColor) { + trueColor = gTrue; + mask = visualList[i].red_mask; + rShift = 0; + while (mask && !(mask & 1)) { + ++rShift; + mask >>= 1; + } + rMul = (int)mask; + mask = visualList[i].green_mask; + gShift = 0; + while (mask && !(mask & 1)) { + ++gShift; + mask >>= 1; + } + gMul = (int)mask; + mask = visualList[i].blue_mask; + bShift = 0; + while (mask && !(mask & 1)) { + ++bShift; + mask >>= 1; + } + bMul = (int)mask; + } + break; + } + } + XFree((XPointer)visualList); + } + + // allocate a color cube + if (!trueColor) { + + // set colors in private colormap + if (installCmap) { + for (numColors = 6; numColors >= 2; --numColors) { + m = numColors * numColors * numColors; + if (XAllocColorCells(display, colormap, False, NULL, 0, colors, m)) + break; + } + if (numColors >= 2) { + m = numColors * numColors * numColors; + xcolors = (XColor *)gmalloc(m * sizeof(XColor)); + n = 0; + for (r = 0; r < numColors; ++r) { + for (g = 0; g < numColors; ++g) { + for (b = 0; b < numColors; ++b) { + xcolors[n].pixel = colors[n]; + xcolors[n].red = (r * 65535) / (numColors - 1); + xcolors[n].green = (g * 65535) / (numColors - 1); + xcolors[n].blue = (b * 65535) / (numColors - 1); + xcolors[n].flags = DoRed | DoGreen | DoBlue; + ++n; + } + } + } + XStoreColors(display, colormap, xcolors, m); + gfree(xcolors); + } else { + numColors = 1; + colors[0] = BlackPixel(display, screenNum); + colors[1] = WhitePixel(display, screenNum); + } + + // allocate colors in shared colormap + } else { + if (rgbCubeSize > maxRGBCube) + rgbCubeSize = maxRGBCube; + ok = gFalse; + for (numColors = rgbCubeSize; numColors >= 2; --numColors) { + ok = gTrue; + n = 0; + for (r = 0; r < numColors && ok; ++r) { + for (g = 0; g < numColors && ok; ++g) { + for (b = 0; b < numColors && ok; ++b) { + if (n == 0) { + colors[n++] = BlackPixel(display, screenNum); + } else { + xcolor.red = (r * 65535) / (numColors - 1); + xcolor.green = (g * 65535) / (numColors - 1); + xcolor.blue = (b * 65535) / (numColors - 1); + if (XAllocColor(display, colormap, &xcolor)) + colors[n++] = xcolor.pixel; + else + ok = gFalse; + } + } + } + } + if (ok) + break; + XFreeColors(display, colormap, &colors[1], n-1, 0); + } + if (!ok) { + numColors = 1; + colors[0] = BlackPixel(display, screenNum); + colors[1] = WhitePixel(display, screenNum); + } + } + } + + // allocate GCs + gcValues.foreground = BlackPixel(display, screenNum); + gcValues.background = WhitePixel(display, screenNum); + gcValues.line_width = 0; + gcValues.line_style = LineSolid; + strokeGC = XCreateGC(display, pixmap, + GCForeground | GCBackground | GCLineWidth | GCLineStyle, + &gcValues); + fillGC = XCreateGC(display, pixmap, + GCForeground | GCBackground | GCLineWidth | GCLineStyle, + &gcValues); + gcValues.foreground = paperColor; + paperGC = XCreateGC(display, pixmap, + GCForeground | GCBackground | GCLineWidth | GCLineStyle, + &gcValues); + + // no clip region yet + clipRegion = NULL; + + // get user font map + for (n = 0; devFontMap[n].pdfFont; ++n) ; + userFontMap = (FontMapEntry *)gmalloc((n+1) * sizeof(FontMapEntry)); + for (i = 0; i < n; ++i) { + userFontMap[i].pdfFont = devFontMap[i].pdfFont; + userFontMap[i].xFont = devFontMap[i].devFont; + m = strlen(userFontMap[i].xFont); + if (m >= 10 && !strcmp(userFontMap[i].xFont + m - 10, "-iso8859-2")) + userFontMap[i].encoding = &isoLatin2Encoding; + else if (m >= 13 && !strcmp(userFontMap[i].xFont + m - 13, + "-fontspecific")) + userFontMap[i].encoding = NULL; + else + userFontMap[i].encoding = &isoLatin1Encoding; + } + userFontMap[n].pdfFont = NULL; + + // set up the font cache and fonts + gfxFont = NULL; + font = NULL; + fontCache = new XOutputFontCache(display); + + // empty state stack + save = NULL; + + // create text object + text = new TextPage(gFalse); +} + +XOutputDev::~XOutputDev() { + gfree(userFontMap); + delete fontCache; + XFreeGC(display, strokeGC); + XFreeGC(display, fillGC); + XFreeGC(display, paperGC); + if (clipRegion) + XDestroyRegion(clipRegion); + delete text; +} + +void XOutputDev::startPage(int pageNum, GfxState *state) { + XOutputState *s; + XGCValues gcValues; + XRectangle rect; + + // clear state stack + while (save) { + s = save; + save = save->next; + XFreeGC(display, s->strokeGC); + XFreeGC(display, s->fillGC); + XDestroyRegion(s->clipRegion); + delete s; + } + save = NULL; + + // default line flatness + flatness = 0; + + // reset GCs + gcValues.foreground = BlackPixel(display, screenNum); + gcValues.background = WhitePixel(display, screenNum); + gcValues.line_width = 0; + gcValues.line_style = LineSolid; + XChangeGC(display, strokeGC, + GCForeground | GCBackground | GCLineWidth | GCLineStyle, + &gcValues); + XChangeGC(display, fillGC, + GCForeground | GCBackground | GCLineWidth | GCLineStyle, + &gcValues); + + // clear clipping region + if (clipRegion) + XDestroyRegion(clipRegion); + clipRegion = XCreateRegion(); + rect.x = rect.y = 0; + rect.width = pixmapW; + rect.height = pixmapH; + XUnionRectWithRegion(&rect, clipRegion, clipRegion); + XSetRegion(display, strokeGC, clipRegion); + XSetRegion(display, fillGC, clipRegion); + + // clear font + gfxFont = NULL; + font = NULL; + + // clear window + XFillRectangle(display, pixmap, paperGC, 0, 0, pixmapW, pixmapH); + + // clear text object + text->clear(); +} + +void XOutputDev::endPage() { + text->coalesce(); +} + +void XOutputDev::drawLinkBorder(double x1, double y1, double x2, double y2, + double w) { + GfxColor color; + XPoint points[5]; + int x, y; + + color.setRGB(0, 0, 1); + XSetForeground(display, strokeGC, findColor(&color)); + XSetLineAttributes(display, strokeGC, xoutRound(w), + LineSolid, CapRound, JoinRound); + cvtUserToDev(x1, y1, &x, &y); + points[0].x = points[4].x = x; + points[0].y = points[4].y = y; + cvtUserToDev(x2, y1, &x, &y); + points[1].x = x; + points[1].y = y; + cvtUserToDev(x2, y2, &x, &y); + points[2].x = x; + points[2].y = y; + cvtUserToDev(x1, y2, &x, &y); + points[3].x = x; + points[3].y = y; + XDrawLines(display, pixmap, strokeGC, points, 5, CoordModeOrigin); +} + +void XOutputDev::saveState(GfxState *state) { + XOutputState *s; + XGCValues values; + + // save current state + s = new XOutputState; + s->strokeGC = strokeGC; + s->fillGC = fillGC; + s->clipRegion = clipRegion; + + // push onto state stack + s->next = save; + save = s; + + // create a new current state by copying + strokeGC = XCreateGC(display, pixmap, 0, &values); + XCopyGC(display, s->strokeGC, 0xffffffff, strokeGC); + fillGC = XCreateGC(display, pixmap, 0, &values); + XCopyGC(display, s->fillGC, 0xffffffff, fillGC); + clipRegion = XCreateRegion(); + XUnionRegion(s->clipRegion, clipRegion, clipRegion); + XSetRegion(display, strokeGC, clipRegion); + XSetRegion(display, fillGC, clipRegion); +} + +void XOutputDev::restoreState(GfxState *state) { + XOutputState *s; + + if (save) { + // kill current state + XFreeGC(display, strokeGC); + XFreeGC(display, fillGC); + XDestroyRegion(clipRegion); + + // restore state + flatness = state->getFlatness(); + strokeGC = save->strokeGC; + fillGC = save->fillGC; + clipRegion = save->clipRegion; + XSetRegion(display, strokeGC, clipRegion); + XSetRegion(display, fillGC, clipRegion); + + // pop state stack + s = save; + save = save->next; + delete s; + } +} + +void XOutputDev::updateAll(GfxState *state) { + updateLineAttrs(state, gTrue); + updateFlatness(state); + updateMiterLimit(state); + updateFillColor(state); + updateStrokeColor(state); + updateFont(state); +} + +void XOutputDev::updateCTM(GfxState *state, double m11, double m12, + double m21, double m22, double m31, double m32) { + updateLineAttrs(state, gTrue); +} + +void XOutputDev::updateLineDash(GfxState *state) { + updateLineAttrs(state, gTrue); +} + +void XOutputDev::updateFlatness(GfxState *state) { + flatness = state->getFlatness(); +} + +void XOutputDev::updateLineJoin(GfxState *state) { + updateLineAttrs(state, gFalse); +} + +void XOutputDev::updateLineCap(GfxState *state) { + updateLineAttrs(state, gFalse); +} + +// unimplemented +void XOutputDev::updateMiterLimit(GfxState *state) { +} + +void XOutputDev::updateLineWidth(GfxState *state) { + updateLineAttrs(state, gFalse); +} + +void XOutputDev::updateLineAttrs(GfxState *state, GBool updateDash) { + double width; + int cap, join; + double *dashPattern; + int dashLength; + double dashStart; + char dashList[20]; + int i; + + width = state->getTransformedLineWidth(); + switch (state->getLineCap()) { + case 0: cap = CapButt; break; + case 1: cap = CapRound; break; + case 2: cap = CapProjecting; break; + default: + error(-1, "Bad line cap style (%d)", state->getLineCap()); + cap = CapButt; + break; + } + switch (state->getLineJoin()) { + case 0: join = JoinMiter; break; + case 1: join = JoinRound; break; + case 2: join = JoinBevel; break; + default: + error(-1, "Bad line join style (%d)", state->getLineJoin()); + join = JoinMiter; + break; + } + state->getLineDash(&dashPattern, &dashLength, &dashStart); + XSetLineAttributes(display, strokeGC, xoutRound(width), + dashLength > 0 ? LineOnOffDash : LineSolid, + cap, join); + if (updateDash && dashLength > 0) { + if (dashLength > 20) + dashLength = 20; + for (i = 0; i < dashLength; ++i) { + dashList[i] = xoutRound(state->transformWidth(dashPattern[i])); + if (dashList[i] == 0) + dashList[i] = 1; + } + XSetDashes(display, strokeGC, xoutRound(dashStart), dashList, dashLength); + } +} + +void XOutputDev::updateFillColor(GfxState *state) { + XSetForeground(display, fillGC, findColor(state->getFillColor())); +} + +void XOutputDev::updateStrokeColor(GfxState *state) { + XSetForeground(display, strokeGC, findColor(state->getStrokeColor())); +} + +void XOutputDev::updateFont(GfxState *state) { + double m11, m12, m21, m22; + + if (!(gfxFont = state->getFont())) { + font = NULL; + return; + } + state->getFontTransMat(&m11, &m12, &m21, &m22); + m11 *= state->getHorizScaling(); + m21 *= state->getHorizScaling(); + font = fontCache->getFont(gfxFont, m11, m12, m21, m22); + if (font) { + XSetFont(display, fillGC, font->getXFont()->fid); + XSetFont(display, strokeGC, font->getXFont()->fid); + } +} + +void XOutputDev::stroke(GfxState *state) { + XPoint *points; + int *lengths; + int n, size, numPoints, i, j; + + // transform points + n = convertPath(state, &points, &size, &numPoints, &lengths, gFalse); + + // draw each subpath + j = 0; + for (i = 0; i < n; ++i) { + XDrawLines(display, pixmap, strokeGC, points + j, lengths[i], + CoordModeOrigin); + j += lengths[i]; + } + + // free points and lengths arrays + if (points != tmpPoints) + gfree(points); + if (lengths != tmpLengths) + gfree(lengths); +} + +void XOutputDev::fill(GfxState *state) { + doFill(state, WindingRule); +} + +void XOutputDev::eoFill(GfxState *state) { + doFill(state, EvenOddRule); +} + +// +// X doesn't color the pixels on the right-most and bottom-most +// borders of a polygon. This means that one-pixel-thick polygons +// are not colored at all. I think this is supposed to be a +// feature, but I can't figure out why. So after it fills a +// polygon, it also draws lines around the border. This is done +// only for single-component polygons, since it's not very +// compatible with the compound polygon kludge (see convertPath()). +// +void XOutputDev::doFill(GfxState *state, int rule) { + XPoint *points; + int *lengths; + int n, size, numPoints, i, j; + + // set fill rule + XSetFillRule(display, fillGC, rule); + + // transform points, build separate polygons + n = convertPath(state, &points, &size, &numPoints, &lengths, gTrue); + + // fill them + j = 0; + for (i = 0; i < n; ++i) { + XFillPolygon(display, pixmap, fillGC, points + j, lengths[i], + Complex, CoordModeOrigin); + if (state->getPath()->getNumSubpaths() == 1) { + XDrawLines(display, pixmap, fillGC, points + j, lengths[i], + CoordModeOrigin); + } + j += lengths[i] + 1; + } + + // free points and lengths arrays + if (points != tmpPoints) + gfree(points); + if (lengths != tmpLengths) + gfree(lengths); +} + +void XOutputDev::clip(GfxState *state) { + doClip(state, WindingRule); +} + +void XOutputDev::eoClip(GfxState *state) { + doClip(state, EvenOddRule); +} + +void XOutputDev::doClip(GfxState *state, int rule) { + Region region, region2; + XPoint *points; + int *lengths; + int n, size, numPoints, i, j; + + // transform points, build separate polygons + n = convertPath(state, &points, &size, &numPoints, &lengths, gTrue); + + // construct union of subpath regions + region = XPolygonRegion(points, lengths[0], rule); + j = lengths[0] + 1; + for (i = 1; i < n; ++i) { + region2 = XPolygonRegion(points + j, lengths[i], rule); + XUnionRegion(region2, region, region); + XDestroyRegion(region2); + j += lengths[i] + 1; + } + + // intersect region with clipping region + XIntersectRegion(region, clipRegion, clipRegion); + XDestroyRegion(region); + XSetRegion(display, strokeGC, clipRegion); + XSetRegion(display, fillGC, clipRegion); + + // free points and lengths arrays + if (points != tmpPoints) + gfree(points); + if (lengths != tmpLengths) + gfree(lengths); +} + +// +// Transform points in the path and convert curves to line segments. +// Builds a set of subpaths and returns the number of subpaths. +// If is set, close any unclosed subpaths and activate a +// kludge for polygon fills: First, it divides up the subpaths into +// non-overlapping polygons by simply comparing bounding rectangles. +// Then it connects subaths within a single compound polygon to a single +// point so that X can fill the polygon (sort of). +// +int XOutputDev::convertPath(GfxState *state, XPoint **points, int *size, + int *numPoints, int **lengths, GBool fillHack) { + GfxPath *path; + BoundingRect *rects; + BoundingRect rect; + int n, i, ii, j, k, k0; + + // get path and number of subpaths + path = state->getPath(); + n = path->getNumSubpaths(); + + // allocate lengths array + if (n < numTmpSubpaths) + *lengths = tmpLengths; + else + *lengths = (int *)gmalloc(n * sizeof(int)); + + // allocate bounding rectangles array + if (fillHack) { + if (n < numTmpSubpaths) + rects = tmpRects; + else + rects = (BoundingRect *)gmalloc(n * sizeof(BoundingRect)); + } else { + rects = NULL; + } + + // do each subpath + *points = tmpPoints; + *size = numTmpPoints; + *numPoints = 0; + for (i = 0; i < n; ++i) { + + // transform the points + j = *numPoints; + convertSubpath(state, path->getSubpath(i), points, size, numPoints); + + // construct bounding rectangle + if (fillHack) { + rects[i].xMin = rects[i].xMax = (*points)[j].x; + rects[i].yMin = rects[i].yMax = (*points)[j].y; + for (k = j + 1; k < *numPoints; ++k) { + if ((*points)[k].x < rects[i].xMin) + rects[i].xMin = (*points)[k].x; + else if ((*points)[k].x > rects[i].xMax) + rects[i].xMax = (*points)[k].x; + if ((*points)[k].y < rects[i].yMin) + rects[i].yMin = (*points)[k].y; + else if ((*points)[k].y > rects[i].yMax) + rects[i].yMax = (*points)[k].y; + } + } + + // close subpath if necessary + if (fillHack && ((*points)[*numPoints-1].x != (*points)[j].x || + (*points)[*numPoints-1].y != (*points)[j].y)) { + addPoint(points, size, numPoints, (*points)[j].x, (*points)[j].y); + } + + // length of this subpath + (*lengths)[i] = *numPoints - j; + + // leave an extra point for compound fill hack + if (fillHack) + addPoint(points, size, numPoints, 0, 0); + } + + // combine compound polygons + if (fillHack) { + i = j = k = 0; + while (i < n) { + + // start with subpath i + rect = rects[i]; + (*lengths)[j] = (*lengths)[i]; + k0 = k; + (*points)[k + (*lengths)[i]] = (*points)[k0]; + k += (*lengths)[i] + 1; + ++i; + + // combine overlapping polygons + do { + + // look for the first subsequent subpath, if any, which overlaps + for (ii = i; ii < n; ++ii) { + if (((rects[ii].xMin > rect.xMin && rects[ii].xMin < rect.xMax) || + (rects[ii].xMax > rect.xMin && rects[ii].xMax < rect.xMax) || + (rects[ii].xMin < rect.xMin && rects[ii].xMax > rect.xMax)) && + ((rects[ii].yMin > rect.yMin && rects[ii].yMin < rect.yMax) || + (rects[ii].yMax > rect.yMin && rects[ii].yMax < rect.yMax) || + (rects[ii].yMin < rect.yMin && rects[ii].yMax > rect.yMax))) + break; + } + + // if there is an overlap, combine the polygons + if (ii < n) { + for (; i <= ii; ++i) { + if (rects[i].xMin < rect.xMin) + rect.xMin = rects[j].xMin; + if (rects[i].xMax > rect.xMax) + rect.xMax = rects[j].xMax; + if (rects[i].yMin < rect.yMin) + rect.yMin = rects[j].yMin; + if (rects[i].yMax > rect.yMax) + rect.yMax = rects[j].yMax; + (*lengths)[j] += (*lengths)[i] + 1; + (*points)[k + (*lengths)[i]] = (*points)[k0]; + k += (*lengths)[i] + 1; + } + } + } while (ii < n && i < n); + + ++j; + } + + // free bounding rectangles + if (rects != tmpRects) + gfree(rects); + + n = j; + } + + return n; +} + +// +// Transform points in a single subpath and convert curves to line +// segments. +// +void XOutputDev::convertSubpath(GfxState *state, GfxSubpath *subpath, + XPoint **points, int *size, int *n) { + double x0, y0, x1, y1, x2, y2, x3, y3; + int m, i; + + m = subpath->getNumPoints(); + i = 0; + while (i < m) { + if (i >= 1 && subpath->getCurve(i)) { + state->transform(subpath->getX(i-1), subpath->getY(i-1), &x0, &y0); + state->transform(subpath->getX(i), subpath->getY(i), &x1, &y1); + state->transform(subpath->getX(i+1), subpath->getY(i+1), &x2, &y2); + state->transform(subpath->getX(i+2), subpath->getY(i+2), &x3, &y3); + doCurve(points, size, n, x0, y0, x1, y1, x2, y2, x3, y3); + i += 3; + } else { + state->transform(subpath->getX(i), subpath->getY(i), &x1, &y1); + addPoint(points, size, n, xoutRound(x1), xoutRound(y1)); + ++i; + } + } +} + +// +// Subdivide a Bezier curve. This uses floating point to avoid +// propagating rounding errors. (The curves look noticeably more +// jagged with integer arithmetic.) +// +void XOutputDev::doCurve(XPoint **points, int *size, int *n, + double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3) { + double x[(1<= *size) { + *size += 32; + if (*points == tmpPoints) { + *points = (XPoint *)gmalloc(*size * sizeof(XPoint)); + memcpy(*points, tmpPoints, *k * sizeof(XPoint)); + } else { + *points = (XPoint *)grealloc(*points, *size * sizeof(XPoint)); + } + } + (*points)[*k].x = x; + (*points)[*k].y = y; + ++(*k); +} + +void XOutputDev::beginString(GfxState *state, GString *s) { + text->beginString(state, s, font ? font->isHex() : gFalse); +} + +void XOutputDev::endString(GfxState *state) { + text->endString(); +} + +void XOutputDev::drawChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c) { + Gushort c1; + char buf; + char *p; + int n, i; + double x1, y1; + double tx; + + text->addChar(state, x, y, dx, dy, c); + + if (!font) + return; + + // check for invisible text -- this is used by Acrobat Capture + if ((state->getRender() & 3) == 3) + return; + + state->transform(x, y, &x1, &y1); + c1 = font->mapChar(c); + if (c1 <= lastRegularChar) { + buf = (char)c1; + XDrawString(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), &buf, 1); + } else if (c1 <= lastSubstChar) { + buf = (char)substChars[c1 - firstSubstChar]; + XDrawString(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), &buf, 1); + } else if (c1 <= lastConstrChar) { + //~ need to deal with rotated text here + switch (c1 - firstConstrChar) { + case 0: // bullet + tx = 0.25 * state->getTransformedFontSize() * + gfxFont->getWidth(c); + XFillRectangle(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1 + tx), + xoutRound(y1 - 0.4 * font->getXFont()->ascent - tx), + xoutRound(2 * tx), xoutRound(2 * tx)); + break; + case 1: // trademark +//~ this should use a smaller font +// tx = state->getTransformedFontSize() * +// (gfxFont->getWidth(c) - +// gfxFont->getWidth(font->revCharMap('M'))); + tx = 0.9 * state->getTransformedFontSize() * + gfxFont->getWidth(font->revMapChar('T')); + y1 -= 0.33 * (double)font->getXFont()->ascent; + buf = 'T'; + XDrawString(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), &buf, 1); + x1 += tx; + buf = 'M'; + XDrawString(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), &buf, 1); + break; + } + } else if (c1 <= lastMultiChar) { + p = multiChars[c1 - firstMultiChar]; + n = strlen(p); + tx = gfxFont->getWidth(c); + tx -= gfxFont->getWidth(font->revMapChar(p[n-1])); + tx = tx * state->getTransformedFontSize() / (double)(n - 1); + for (i = 0; i < n; ++i) { + XDrawString(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), p + i, 1); + x1 += tx; + } + } +} + +void XOutputDev::drawChar16(GfxState *state, double x, double y, + double dx, double dy, int c) { + int c1; + XChar2b c2[4]; + double x1, y1; +#if JAPANESE_SUPPORT + int t1, t2; + double x2; + char *p; + int n, i; +#endif + + if (!font) + return; + + // check for invisible text -- this is used by Acrobat Capture + if ((state->getRender() & 3) == 3) + return; + + state->transform(x, y, &x1, &y1); + + c1 = 0; + switch (gfxFont->getCharSet16()) { + + // convert Adobe-Japan1-2 to JIS X 0208-1983 + case font16AdobeJapan12: +#if JAPANESE_SUPPORT + if (c <= 96) { + c1 = japan12Map[c]; + } else if (c <= 632) { + if (c <= 230) + c1 = 0; + else if (c <= 324) + c1 = japan12Map[c - 230]; + else if (c <= 421) + c1 = japan12KanaMap1[c - 325]; + else if (c <= 500) + c1 = 0; + else if (c <= 598) + c1 = japan12KanaMap2[c - 501]; + else + c1 = 0; + } else if (c <= 1124) { + if (c <= 779) { + if (c <= 726) + c1 = 0x2121 + (c - 633); + else if (c <= 740) + c1 = 0x2221 + (c - 727); + else if (c <= 748) + c1 = 0x223a + (c - 741); + else if (c <= 755) + c1 = 0x224a + (c - 749); + else if (c <= 770) + c1 = 0x225c + (c - 756); + else if (c <= 778) + c1 = 0x2272 + (c - 771); + else + c1 = 0x227e; + } else if (c <= 841) { + if (c <= 789) + c1 = 0x2330 + (c - 780); + else if (c <= 815) + c1 = 0x2341 + (c - 790); + else + c1 = 0x2361 + (c - 816); + } else if (c <= 1010) { + if (c <= 924) + c1 = 0x2421 + (c - 842); + else + c1 = 0x2521 + (c - 925); + } else { + if (c <= 1034) + c1 = 0x2621 + (c - 1011); + else if (c <= 1058) + c1 = 0x2641 + (c - 1035); + else if (c <= 1091) + c1 = 0x2721 + (c - 1059); + else + c1 = 0x2751 + (c - 1092); + } + } else if (c <= 4089) { + t1 = (c - 1125) / 94; + t2 = (c - 1125) % 94; + c1 = 0x3021 + (t1 << 8) + t2; + } else if (c <= 7477) { + t1 = (c - 4090) / 94; + t2 = (c - 4090) % 94; + c1 = 0x5021 + (t1 << 8) + t2; + } else if (c <= 7554) { + c1 = 0; + } else if (c <= 7563) { // circled Arabic numbers 1..9 + c1 = 0x2331 + (c - 7555); + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), c2, 1); + c1 = 0x227e; + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), c2, 1); + c1 = -1; + } else if (c <= 7574) { // circled Arabic numbers 10..20 + n = c - 7564 + 10; + x2 = x1; + for (i = 0; i < 2; ++i) { + c1 = 0x2330 + (i == 0 ? (n / 10) : (n % 10)); + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x2), xoutRound(y1), c2, 1); + x2 += 0.5 * state->getTransformedFontSize(); + } + c1 = 0x227e; + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), c2, 1); + c1 = -1; + } else if (c <= 7584) { // Roman numbers I..X + p = japan12Roman[c - 7575]; + n = strlen(p); + for (; *p; ++p) { + if (*p == 'I') + c1 = 0x2349; + else if (*p == 'V') + c1 = 0x2356; + else // 'X' + c1 = 0x2358; + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), c2, 1); + if (*p == 'I') + x1 += 0.2 * state->getTransformedFontSize(); + else + x1 += 0.5 * state->getTransformedFontSize(); + } + c1 = -1; + } else if (c <= 7632) { + if (c <= 7600) { + c1 = 0; + } else if (c <= 7606) { + p = japan12Abbrev1[c - 7601]; + n = strlen(p); + for (; *p; ++p) { + c1 = 0x2300 + *p; + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), c2, 1); + x1 += 0.5 * state->getTransformedFontSize(); + } + c1 = -1; + } else { + c1 = 0; + } + } else { + c1 = 0; + } +#if 0 //~ + if (c1 == 0) + error(-1, "Unsupported Adobe-Japan1-2 character: %d", c); +#endif +#endif // JAPANESE_SUPPORT + break; + } + + if (c1 > 0) { + c2[0].byte1 = c1 >> 8; + c2[0].byte2 = c1 & 0xff; + XDrawString16(display, pixmap, + (state->getRender() & 1) ? strokeGC : fillGC, + xoutRound(x1), xoutRound(y1), c2, 1); + } +} + +void XOutputDev::drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg) { + XImage *image; + int x0, y0; // top left corner of image + int w0, h0, w1, h1; // size of image + int x2, y2; + int w2, h2; + double xt, yt, wt, ht; + GBool rotate, xFlip, yFlip; + int x, y; + int ix, iy; + int px1, px2, qx, dx; + int py1, py2, qy, dy; + Guchar pixBuf; + Gulong color; + int i, j; + + // get image position and size + state->transform(0, 0, &xt, &yt); + state->transformDelta(1, 1, &wt, &ht); + if (wt > 0) { + x0 = xoutRound(xt); + w0 = xoutRound(wt); + } else { + x0 = xoutRound(xt + wt); + w0 = xoutRound(-wt); + } + if (ht > 0) { + y0 = xoutRound(yt); + h0 = xoutRound(ht); + } else { + y0 = xoutRound(yt + ht); + h0 = xoutRound(-ht); + } + state->transformDelta(1, 0, &xt, &yt); + rotate = fabs(xt) < fabs(yt); + if (rotate) { + w1 = h0; + h1 = w0; + xFlip = ht < 0; + yFlip = wt > 0; + } else { + w1 = w0; + h1 = h0; + xFlip = wt < 0; + yFlip = ht > 0; + } + + // set up + color = findColor(state->getFillColor()); + + // check for tiny (zero width or height) images + if (w0 == 0 || h0 == 0) { + j = height * ((width + 7) / 8); + str->reset(); + for (i = 0; i < j; ++i) + str->getChar(); + return; + } + + // Bresenham parameters + px1 = w1 / width; + px2 = w1 - px1 * width; + py1 = h1 / height; + py2 = h1 - py1 * height; + + // allocate XImage + image = XCreateImage(display, DefaultVisual(display, screenNum), + depth, ZPixmap, 0, NULL, w0, h0, 8, 0); + image->data = (char *)gmalloc(h0 * image->bytes_per_line); + if (x0 + w0 > pixmapW) + w2 = pixmapW - x0; + else + w2 = w0; + if (x0 < 0) { + x2 = -x0; + w2 += x0; + x0 = 0; + } else { + x2 = 0; + } + if (y0 + h0 > pixmapH) + h2 = pixmapH - y0; + else + h2 = h0; + if (y0 < 0) { + y2 = -y0; + h2 += y0; + y0 = 0; + } else { + y2 = 0; + } + XGetSubImage(display, pixmap, x0, y0, w2, h2, (1 << depth) - 1, ZPixmap, + image, x2, y2); + + // initialize the image stream + str->resetImage(width, 1, 1); + + // first line (column) + y = yFlip ? h1 - 1 : 0; + qy = 0; + + // read image + for (i = 0; i < height; ++i) { + + // vertical (horizontal) Bresenham + dy = py1; + if ((qy += py2) >= height) { + ++dy; + qy -= height; + } + + // drop a line (column) + if (dy == 0) { + str->skipImageLine(); + + } else { + + // first column (line) + x = xFlip ? w1 - 1 : 0; + qx = 0; + + // for each column (line)... + for (j = 0; j < width; ++j) { + + // horizontal (vertical) Bresenham + dx = px1; + if ((qx += px2) >= width) { + ++dx; + qx -= width; + } + + // get image pixel + str->getImagePixel(&pixBuf); + if (invert) + pixBuf ^= 1; + + // draw image pixel + if (dx > 0 && pixBuf == 0) { + if (dx == 1 && dy == 1) { + if (rotate) + XPutPixel(image, y, x, color); + else + XPutPixel(image, x, y, color); + } else { + for (ix = 0; ix < dx; ++ix) { + for (iy = 0; iy < dy; ++iy) { + if (rotate) + XPutPixel(image, yFlip ? y - iy : y + iy, + xFlip ? x - ix : x + ix, color); + else + XPutPixel(image, xFlip ? x - ix : x + ix, + yFlip ? y - iy : y + iy, color); + } + } + } + } + + // next column (line) + if (xFlip) + x -= dx; + else + x += dx; + } + } + + // next line (column) + if (yFlip) + y -= dy; + else + y += dy; + } + + // blit the image into the pixmap + XPutImage(display, pixmap, fillGC, image, x2, y2, x0, y0, w2, h2); + + // free memory + gfree(image->data); + image->data = NULL; + XDestroyImage(image); +} + +inline Gulong XOutputDev::findColor(RGBColor *x, RGBColor *err) { + double gray; + int r, g, b; + Gulong pixel; + + if (trueColor) { + r = xoutRound(x->r * rMul); + g = xoutRound(x->g * gMul); + b = xoutRound(x->b * bMul); + pixel = ((Gulong)r << rShift) + + ((Gulong)g << gShift) + + ((Gulong)b << bShift); + err->r = x->r - (double)r / rMul; + err->g = x->g - (double)g / gMul; + err->b = x->b - (double)b / bMul; + } else if (numColors == 1) { + gray = 0.299 * x->r + 0.587 * x->g + 0.114 * x->b; + if (gray < 0.5) { + pixel = colors[0]; + err->r = x->r; + err->g = x->g; + err->b = x->b; + } else { + pixel = colors[1]; + err->r = x->r - 1; + err->g = x->g - 1; + err->b = x->b - 1; + } + } else { + r = xoutRound(x->r * (numColors - 1)); + g = xoutRound(x->g * (numColors - 1)); + b = xoutRound(x->b * (numColors - 1)); + pixel = colors[(r * numColors + g) * numColors + b]; + err->r = x->r - (double)r / (numColors - 1); + err->g = x->g - (double)g / (numColors - 1); + err->b = x->b - (double)b / (numColors - 1); + } + return pixel; +} + +void XOutputDev::drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg) { + XImage *image; + int x0, y0; // top left corner of image + int w0, h0, w1, h1; // size of image + double xt, yt, wt, ht; + GBool rotate, xFlip, yFlip; + GBool dither; + int x, y; + int ix, iy; + int px1, px2, qx, dx; + int py1, py2, qy, dy; + Guchar pixBuf[4]; + Gulong pixel; + int nComps, nVals, nBits; + double r1, g1, b1; + GfxColor color; + RGBColor color2, err; + RGBColor *errRight, *errDown; + int i, j; + + // get image position and size + state->transform(0, 0, &xt, &yt); + state->transformDelta(1, 1, &wt, &ht); + if (wt > 0) { + x0 = xoutRound(xt); + w0 = xoutRound(wt); + } else { + x0 = xoutRound(xt + wt); + w0 = xoutRound(-wt); + } + if (ht > 0) { + y0 = xoutRound(yt); + h0 = xoutRound(ht); + } else { + y0 = xoutRound(yt + ht); + h0 = xoutRound(-ht); + } + state->transformDelta(1, 0, &xt, &yt); + rotate = fabs(xt) < fabs(yt); + if (rotate) { + w1 = h0; + h1 = w0; + xFlip = ht < 0; + yFlip = wt > 0; + } else { + w1 = w0; + h1 = h0; + xFlip = wt < 0; + yFlip = ht > 0; + } + + // set up + nComps = colorMap->getNumPixelComps(); + nVals = width * nComps; + nBits = colorMap->getBits(); + dither = nComps > 1 || nBits > 1; + + // check for tiny (zero width or height) images + if (w0 == 0 || h0 == 0) { + j = height * ((nVals * nBits + 7) / 8); + str->reset(); + for (i = 0; i < j; ++i) + str->getChar(); + return; + } + + // Bresenham parameters + px1 = w1 / width; + px2 = w1 - px1 * width; + py1 = h1 / height; + py2 = h1 - py1 * height; + + // allocate XImage + image = XCreateImage(display, DefaultVisual(display, screenNum), + depth, ZPixmap, 0, NULL, w0, h0, 8, 0); + image->data = (char *)gmalloc(h0 * image->bytes_per_line); + + // allocate error diffusion accumulators + if (dither) { + errDown = (RGBColor *)gmalloc(w1 * sizeof(RGBColor)); + errRight = (RGBColor *)gmalloc((py1 + 1) * sizeof(RGBColor)); + for (j = 0; j < w1; ++j) + errDown[j].r = errDown[j].g = errDown[j].b = 0; + } else { + errDown = NULL; + errRight = NULL; + } + + // initialize the image stream + str->resetImage(width, nComps, nBits); + + // first line (column) + y = yFlip ? h1 - 1 : 0; + qy = 0; + + // read image + for (i = 0; i < height; ++i) { + + // vertical (horizontal) Bresenham + dy = py1; + if ((qy += py2) >= height) { + ++dy; + qy -= height; + } + + // drop a line (column) + if (dy == 0) { + str->skipImageLine(); + + } else { + + // first column (line) + x = xFlip ? w1 - 1 : 0; + qx = 0; + + // clear error accumulator + if (dither) { + for (j = 0; j <= py1; ++j) + errRight[j].r = errRight[j].g = errRight[j].b = 0; + } + + // for each column (line)... + for (j = 0; j < width; ++j) { + + // horizontal (vertical) Bresenham + dx = px1; + if ((qx += px2) >= width) { + ++dx; + qx -= width; + } + + // get image pixel + str->getImagePixel(pixBuf); + + // draw image pixel + if (dx > 0) { + colorMap->getColor(pixBuf, &color); + r1 = color.getR(); + g1 = color.getG(); + b1 = color.getB(); + if (dither) { + pixel = 0; + } else { + color2.r = r1; + color2.g = g1; + color2.b = b1; + pixel = findColor(&color2, &err); + } + if (dx == 1 && dy == 1) { + if (dither) { + color2.r = r1 + errRight[0].r + errDown[x].r; + if (color2.r > 1) + color2.r = 1; + else if (color2.r < 0) + color2.r = 0; + color2.g = g1 + errRight[0].g + errDown[x].g; + if (color2.g > 1) + color2.g = 1; + else if (color2.g < 0) + color2.g = 0; + color2.b = b1 + errRight[0].b + errDown[x].b; + if (color2.b > 1) + color2.b = 1; + else if (color2.b < 0) + color2.b = 0; + pixel = findColor(&color2, &err); + errRight[0].r = errDown[x].r = err.r / 2; + errRight[0].g = errDown[x].g = err.g / 2; + errRight[0].b = errDown[x].b = err.b / 2; + } + if (rotate) + XPutPixel(image, y, x, pixel); + else + XPutPixel(image, x, y, pixel); + } else { + for (iy = 0; iy < dy; ++iy) { + for (ix = 0; ix < dx; ++ix) { + if (dither) { + color2.r = r1 + errRight[iy].r + + errDown[xFlip ? x - ix : x + ix].r; + if (color2.r > 1) + color2.r = 1; + else if (color2.r < 0) + color2.r = 0; + color2.g = g1 + errRight[iy].g + + errDown[xFlip ? x - ix : x + ix].g; + if (color2.g > 1) + color2.g = 1; + else if (color2.g < 0) + color2.g = 0; + color2.b = b1 + errRight[iy].b + + errDown[xFlip ? x - ix : x + ix].b; + if (color2.b > 1) + color2.b = 1; + else if (color2.b < 0) + color2.b = 0; + pixel = findColor(&color2, &err); + errRight[iy].r = errDown[xFlip ? x - ix : x + ix].r = + err.r / 2; + errRight[iy].g = errDown[xFlip ? x - ix : x + ix].g = + err.g / 2; + errRight[iy].b = errDown[xFlip ? x - ix : x + ix].b = + err.b / 2; + } + if (rotate) + XPutPixel(image, yFlip ? y - iy : y + iy, + xFlip ? x - ix : x + ix, pixel); + else + XPutPixel(image, xFlip ? x - ix : x + ix, + yFlip ? y - iy : y + iy, pixel); + } + } + } + } + + // next column (line) + if (xFlip) + x -= dx; + else + x += dx; + } + } + + // next line (column) + if (yFlip) + y -= dy; + else + y += dy; + } + + // blit the image into the pixmap + XPutImage(display, pixmap, fillGC, image, 0, 0, x0, y0, w0, h0); + + // free memory + gfree(image->data); + image->data = NULL; + XDestroyImage(image); + gfree(errRight); + gfree(errDown); +} + +Gulong XOutputDev::findColor(GfxColor *color) { + int r, g, b; + double gray; + Gulong pixel; + + if (trueColor) { + r = xoutRound(color->getR() * rMul); + g = xoutRound(color->getG() * gMul); + b = xoutRound(color->getB() * bMul); + pixel = ((Gulong)r << rShift) + + ((Gulong)g << gShift) + + ((Gulong)b << bShift); + } else if (numColors == 1) { + gray = color->getGray(); + if (gray < 0.5) + pixel = colors[0]; + else + pixel = colors[1]; + } else { + r = xoutRound(color->getR() * (numColors - 1)); + g = xoutRound(color->getG() * (numColors - 1)); + b = xoutRound(color->getB() * (numColors - 1)); +#if 0 //~ this makes things worse as often as better + // even a very light color shouldn't map to white + if (r == numColors - 1 && g == numColors - 1 && b == numColors - 1) { + if (color->getR() < 0.95) + --r; + if (color->getG() < 0.95) + --g; + if (color->getB() < 0.95) + --b; + } +#endif + pixel = colors[(r * numColors + g) * numColors + b]; + } + return pixel; +} + +GBool XOutputDev::findText(char *s, GBool top, GBool bottom, + int *xMin, int *yMin, int *xMax, int *yMax) { + double xMin1, yMin1, xMax1, yMax1; + + xMin1 = (double)*xMin; + yMin1 = (double)*yMin; + xMax1 = (double)*xMax; + yMax1 = (double)*yMax; + if (text->findText(s, top, bottom, &xMin1, &yMin1, &xMax1, &yMax1)) { + *xMin = xoutRound(xMin1); + *xMax = xoutRound(xMax1); + *yMin = xoutRound(yMin1); + *yMax = xoutRound(yMax1); + return gTrue; + } + return gFalse; +} + +GString *XOutputDev::getText(int xMin, int yMin, int xMax, int yMax) { + return text->getText((double)xMin, (double)yMin, + (double)xMax, (double)yMax); +} diff --git a/pdf/xpdf/XOutputDev.h b/pdf/xpdf/XOutputDev.h new file mode 100644 index 00000000..48454212 --- /dev/null +++ b/pdf/xpdf/XOutputDev.h @@ -0,0 +1,284 @@ +//======================================================================== +// +// XOutputDev.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef XOUTPUTDEV_H +#define XOUTPUTDEV_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include +#include +#include "config.h" +#include "OutputDev.h" + +class GString; +class GfxColor; +class GfxFont; +class GfxSubpath; +class TextPage; +struct RGBColor; + +//------------------------------------------------------------------------ +// Constants +//------------------------------------------------------------------------ + +#define maxRGBCube 8 // max size of RGB color cube + +#define numTmpPoints 256 // number of XPoints in temporary array +#define numTmpSubpaths 16 // number of elements in temporary arrays + // for fill/clip + +//------------------------------------------------------------------------ +// Misc types +//------------------------------------------------------------------------ + +struct BoundingRect { + short xMin, xMax; // min/max x values + short yMin, yMax; // min/max y values +}; + +struct RGBColor { + double r, g, b; +}; + +//------------------------------------------------------------------------ +// Parameters +//------------------------------------------------------------------------ + +// Install a private colormap. +extern GBool installCmap; + +// Size of RGB color cube. +extern int rgbCubeSize; + +//------------------------------------------------------------------------ +// XOutputFont +//------------------------------------------------------------------------ + +class XOutputFont { +public: + + // Constructor. + XOutputFont(GfxFont *gfxFont, double m11, double m12, + double m21, double m22, Display *display1); + + // Destructor. + ~XOutputFont(); + + // Does this font match the ID, size, and angle? + GBool matches(Ref id1, double m11, double m12, double m21, double m22) + { return id.num == id1.num && id.gen == id1.gen && + mat11 == m11 && mat12 == m12 && mat21 == m21 && mat22 == m22; } + + // Get X font. + XFontStruct *getXFont() { return xFont; } + + // Get character mapping. + Gushort mapChar(Guchar c) { return map[c]; } + + // Reverse map a character. + Guchar revMapChar(Gushort c) { return revMap[c]; } + + // Does this font use hex char codes? + GBool isHex() { return hex; } + +private: + + Ref id; + double mat11, mat12, mat21, mat22; + Display *display; + XFontStruct *xFont; + GBool hex; // subsetted font with hex char codes + Gushort map[256]; + Guchar revMap[256]; +}; + +//------------------------------------------------------------------------ +// XOutputFontCache +//------------------------------------------------------------------------ + +class XOutputFontCache { +public: + + // Constructor. + XOutputFontCache(Display *display1); + + // Destructor. + ~XOutputFontCache(); + + // Get a font. This creates a new font if necessary. + XOutputFont *getFont(GfxFont *gfxFont, double m11, double m12, + double m21, double m22); + +private: + + Display *display; // X display pointer + XOutputFont * // fonts in reverse-LRU order + fonts[fontCacheSize]; + int numFonts; // number of valid entries +}; + +//------------------------------------------------------------------------ +// XOutputState +//------------------------------------------------------------------------ + +struct XOutputState { + GC strokeGC; + GC fillGC; + Region clipRegion; + XOutputState *next; +}; + +//------------------------------------------------------------------------ +// XOutputDev +//------------------------------------------------------------------------ + +class XOutputDev: public OutputDev { +public: + + // Constructor. + XOutputDev(Display *display1, Pixmap pixmap1, Guint depth1, + Colormap colormap, unsigned long paperColor); + + // Destructor. + virtual ~XOutputDev(); + + //---- get info about output device + + // Does this device use upside-down coordinates? + // (Upside-down means (0,0) is the top left corner of the page.) + virtual GBool upsideDown() { return gTrue; } + + // Does this device use drawChar() or drawString()? + virtual GBool useDrawChar() { return gTrue; } + + //----- initialization and control + + // Start a page. + virtual void startPage(int pageNum, GfxState *state); + + // End a page. + virtual void endPage(); + + //----- link borders + virtual void drawLinkBorder(double x1, double y1, double x2, double y2, + double w); + + //----- save/restore graphics state + virtual void saveState(GfxState *state); + virtual void restoreState(GfxState *state); + + //----- update graphics state + virtual void updateAll(GfxState *state); + virtual void updateCTM(GfxState *state, double m11, double m12, + double m21, double m22, double m31, double m32); + virtual void updateLineDash(GfxState *state); + virtual void updateFlatness(GfxState *state); + virtual void updateLineJoin(GfxState *state); + virtual void updateLineCap(GfxState *state); + virtual void updateMiterLimit(GfxState *state); + virtual void updateLineWidth(GfxState *state); + virtual void updateFillColor(GfxState *state); + virtual void updateStrokeColor(GfxState *state); + + //----- update text state + virtual void updateFont(GfxState *state); + + //----- path painting + virtual void stroke(GfxState *state); + virtual void fill(GfxState *state); + virtual void eoFill(GfxState *state); + + //----- path clipping + virtual void clip(GfxState *state); + virtual void eoClip(GfxState *state); + + //----- text drawing + virtual void beginString(GfxState *state, GString *s); + virtual void endString(GfxState *state); + virtual void drawChar(GfxState *state, double x, double y, + double dx, double dy, Guchar c); + virtual void drawChar16(GfxState *state, double x, double y, + double dx, double dy, int c); + + //----- image drawing + virtual void drawImageMask(GfxState *state, Stream *str, + int width, int height, GBool invert, + GBool inlineImg); + virtual void drawImage(GfxState *state, Stream *str, int width, + int height, GfxImageColorMap *colorMap, + GBool inlineImg); + + //----- special access + + // Find a string. If is true, starts looking at ,; + // otherwise starts looking at top of page. If is true, + // stops looking at ,; otherwise stops looking at bottom + // of page. If found, sets the text bounding rectange and returns + // true; otherwise returns false. + GBool findText(char *s, GBool top, GBool bottom, + int *xMin, int *yMin, int *xMax, int *yMax); + + // Get the text which is inside the specified rectangle. + GString *getText(int xMin, int yMin, int xMax, int yMax); + +protected: + + // Update pixmap ID after a page change. + void setPixmap(Pixmap pixmap1, int pixmapW1, int pixmapH1) + { pixmap = pixmap1; pixmapW = pixmapW1; pixmapH = pixmapH1; } + +private: + + Display *display; // X display pointer + int screenNum; // X screen number + Pixmap pixmap; // pixmap to draw into + int pixmapW, pixmapH; // size of pixmap + Guint depth; // pixmap depth + int flatness; // line flatness + GC paperGC; // GC for background + GC strokeGC; // GC with stroke color + GC fillGC; // GC with fill color + Region clipRegion; // clipping region + GBool trueColor; // set if using a TrueColor visual + int rMul, gMul, bMul; // RGB multipliers (for TrueColor) + int rShift, gShift, bShift; // RGB shifts (for TrueColor) + Gulong // color cube + colors[maxRGBCube * maxRGBCube * maxRGBCube]; + int numColors; // size of color cube + XPoint // temporary points array + tmpPoints[numTmpPoints]; + int // temporary arrays for fill/clip + tmpLengths[numTmpSubpaths]; + BoundingRect + tmpRects[numTmpSubpaths]; + GfxFont *gfxFont; // current PDF font + XOutputFont *font; // current font + XOutputFontCache *fontCache; // font cache + XOutputState *save; // stack of saved states + TextPage *text; // text from the current page + + void updateLineAttrs(GfxState *state, GBool updateDash); + void doFill(GfxState *state, int rule); + void doClip(GfxState *state, int rule); + int convertPath(GfxState *state, XPoint **points, int *size, + int *numPoints, int **lengths, GBool fillHack); + void convertSubpath(GfxState *state, GfxSubpath *subpath, + XPoint **points, int *size, int *n); + void doCurve(XPoint **points, int *size, int *k, + double x0, double y0, double x1, double y1, + double x2, double y2, double x3, double y3); + void addPoint(XPoint **points, int *size, int *k, int x, int y); + Gulong findColor(GfxColor *color); + Gulong findColor(RGBColor *x, RGBColor *err); +}; + +#endif diff --git a/pdf/xpdf/XOutputFontInfo.h b/pdf/xpdf/XOutputFontInfo.h new file mode 100644 index 00000000..0c54be3b --- /dev/null +++ b/pdf/xpdf/XOutputFontInfo.h @@ -0,0 +1,1142 @@ +//======================================================================== +// +// XOutputFontInfo.h +// +// This file was automatically generated by makeXFontInfo. +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef XFONTINFO_H +#define XFONTINFO_H + +//------------------------------------------------------------------------ +// Character encodings. +//------------------------------------------------------------------------ + +#define isoLatin1EncodingSize 294 +static char *isoLatin1EncodingNames[isoLatin1EncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "minus", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "exclamdown", + "cent", + "sterling", + "currency", + "yen", + "brokenbar", + "section", + "dieresis", + "copyright", + "ordfeminine", + "guillemotleft", + "logicalnot", + "endash", + "registered", + "macron", + "degree", + "plusminus", + "twosuperior", + "threesuperior", + "acute", + "mu", + "paragraph", + "periodcentered", + "cedilla", + "onesuperior", + "ordmasculine", + "guillemotright", + "onequarter", + "onehalf", + "threequarters", + "questiondown", + "Agrave", + "Aacute", + "Acircumflex", + "Atilde", + "Adieresis", + "Aring", + "AE", + "Ccedilla", + "Egrave", + "Eacute", + "Ecircumflex", + "Edieresis", + "Igrave", + "Iacute", + "Icircumflex", + "Idieresis", + "Eth", + "Ntilde", + "Ograve", + "Oacute", + "Ocircumflex", + "Otilde", + "Odieresis", + "multiply", + "Oslash", + "Ugrave", + "Uacute", + "Ucircumflex", + "Udieresis", + "Yacute", + "Thorn", + "germandbls", + "agrave", + "aacute", + "acircumflex", + "atilde", + "adieresis", + "aring", + "ae", + "ccedilla", + "egrave", + "eacute", + "ecircumflex", + "edieresis", + "igrave", + "iacute", + "icircumflex", + "idieresis", + "eth", + "ntilde", + "ograve", + "oacute", + "ocircumflex", + "otilde", + "odieresis", + "divide", + "oslash", + "ugrave", + "uacute", + "ucircumflex", + "udieresis", + "yacute", + "thorn", + "ydieresis", + "quotesingle", + "emdash", + "hyphen", + "fraction", + "ring", + "bullet", + "trademark", + "fi", + "fl", + "OE", + "oe", + "ellipsis", + "quotedblleft", + "quotedblright", + "Lslash", + "Scaron", + "Zcaron", + "Ydieresis", + "breve", + "caron", + "circumflex", + "dagger", + "daggerdbl", + "dotaccent", + "dotlessi", + "florin", + "grave", + "guilsinglleft", + "guilsinglright", + "hungarumlaut", + "lslash", + "ogonek", + "perthousand", + "quotedblbase", + "quotesinglbase", + "scaron", + "tilde", + "zcaron" +}; +static GfxFontEncoding isoLatin1Encoding(isoLatin1EncodingNames, + isoLatin1EncodingSize); + +#define isoLatin2EncodingSize 294 +static char *isoLatin2EncodingNames[isoLatin2EncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "quotedbl", + "numbersign", + "dollar", + "percent", + "ampersand", + "quoteright", + "parenleft", + "parenright", + "asterisk", + "plus", + "comma", + "minus", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "at", + "A", + "B", + "C", + "D", + "E", + "F", + "G", + "H", + "I", + "J", + "K", + "L", + "M", + "N", + "O", + "P", + "Q", + "R", + "S", + "T", + "U", + "V", + "W", + "X", + "Y", + "Z", + "bracketleft", + "backslash", + "bracketright", + "asciicircum", + "underscore", + "quoteleft", + "a", + "b", + "c", + "d", + "e", + "f", + "g", + "h", + "i", + "j", + "k", + "l", + "m", + "n", + "o", + "p", + "q", + "r", + "s", + "t", + "u", + "v", + "w", + "x", + "y", + "z", + "braceleft", + "bar", + "braceright", + "asciitilde", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Aogonek", + "breve", + "Lslash", + "currency", + "Lcaron", + "Sacute", + "section", + "dieresis", + "Scaron", + "Scommaaccent", + "Tcaron", + "Zacute", + "endash", + "Zcaron", + "Zdotaccent", + "degree", + "aogonek", + "ogonek", + "lslash", + "acute", + "lcaron", + "sacute", + "caron", + "cedilla", + "scaron", + "scommaaccent", + "tcaron", + "zacute", + "hungarumlaut", + "zcaron", + "zdotaccent", + "Racute", + "Aacute", + "Acircumflex", + "Abreve", + "Adieresis", + "Lacute", + "Cacute", + "Ccedilla", + "Ccaron", + "Eacute", + "Eogonek", + "Edieresis", + "Ecaron", + "Iacute", + "Icircumflex", + "Dcaron", + "Dcroat", + "Nacute", + "Ncaron", + "Oacute", + "Ocircumflex", + "Ohungarumlaut", + "Odieresis", + "multiply", + "Rcaron", + "Uring", + "Uacute", + "Uhungarumlaut", + "Udieresis", + "Yacute", + "Tcommaaccent", + "germandbls", + "racute", + "aacute", + "acircumflex", + "abreve", + "adieresis", + "lacute", + "cacute", + "ccedilla", + "ccaron", + "eacute", + "eogonek", + "edieresis", + "ecaron", + "iacute", + "icircumflex", + "dcaron", + "dcroat", + "nacute", + "ncaron", + "oacute", + "ocircumflex", + "ohungarumlaut", + "odieresis", + "divide", + "rcaron", + "uring", + "uacute", + "uhungarumlaut", + "udieresis", + "yacute", + "tcommaaccent", + "dotaccent", + "quotesingle", + "emdash", + "hyphen", + "fraction", + "ring", + "bullet", + "trademark", + "fi", + "fl", + "OE", + "oe", + "ellipsis", + "quotedblleft", + "quotedblright", + NULL, + NULL, + NULL, + "Ydieresis", + NULL, + NULL, + "circumflex", + "dagger", + "daggerdbl", + NULL, + "dotlessi", + "florin", + "grave", + "guilsinglleft", + "guilsinglright", + NULL, + NULL, + NULL, + "perthousand", + "quotedblbase", + "quotesinglbase", + NULL, + "tilde", + NULL +}; +static GfxFontEncoding isoLatin2Encoding(isoLatin2EncodingNames, + isoLatin2EncodingSize); + +#define symbolEncodingSize 256 +static char *symbolEncodingNames[symbolEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "exclam", + "universal", + "numbersign", + "existential", + "percent", + "ampersand", + "suchthat", + "parenleft", + "parenright", + "asteriskmath", + "plus", + "comma", + "minus", + "period", + "slash", + "zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "colon", + "semicolon", + "less", + "equal", + "greater", + "question", + "congruent", + "Alpha", + "Beta", + "Chi", + "Delta", + "Epsilon", + "Phi", + "Gamma", + "Eta", + "Iota", + "theta1", + "Kappa", + "Lambda", + "Mu", + "Nu", + "Omicron", + "Pi", + "Theta", + "Rho", + "Sigma", + "Tau", + "Upsilon", + "sigma1", + "Omega", + "Xi", + "Psi", + "Zeta", + "bracketleft", + "therefore", + "bracketright", + "perpendicular", + "underscore", + "radicalex", + "alpha", + "beta", + "chi", + "delta", + "epsilon", + "phi", + "gamma", + "eta", + "iota", + "phi1", + "kappa", + "lambda", + "mu", + "nu", + "omicron", + "pi", + "theta", + "rho", + "sigma", + "tau", + "upsilon", + "omega1", + "omega", + "xi", + "psi", + "zeta", + "braceleft", + "bar", + "braceright", + "similar", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "Upsilon1", + "minute", + "lessequal", + "fraction", + "infinity", + "florin", + "club", + "diamond", + "heart", + "spade", + "arrowboth", + "arrowleft", + "arrowup", + "arrowright", + "arrowdown", + "degree", + "plusminus", + "second", + "greaterequal", + "multiply", + "proportional", + "partialdiff", + "bullet", + "divide", + "notequal", + "equivalence", + "approxequal", + "ellipsis", + "arrowvertex", + "arrowhorizex", + "carriagereturn", + "aleph", + "Ifraktur", + "Rfraktur", + "weierstrass", + "circlemultiply", + "circleplus", + "emptyset", + "intersection", + "union", + "propersuperset", + "reflexsuperset", + "notsubset", + "propersubset", + "reflexsubset", + "element", + "notelement", + "angle", + "gradient", + "registerserif", + "copyrightserif", + "trademarkserif", + "product", + "radical", + "dotmath", + "logicalnot", + "logicaland", + "logicalor", + "arrowdblboth", + "arrowdblleft", + "arrowdblup", + "arrowdblright", + "arrowdbldown", + "lozenge", + "angleleft", + "registersans", + "copyrightsans", + "trademarksans", + "summation", + "parenlefttp", + "parenleftex", + "parenleftbt", + "bracketlefttp", + "bracketleftex", + "bracketleftbt", + "bracelefttp", + "braceleftmid", + "braceleftbt", + "braceex", + NULL, + "angleright", + "integral", + "integraltp", + "integralex", + "integralbt", + "parenrighttp", + "parenrightex", + "parenrightbt", + "bracketrighttp", + "bracketrightex", + "bracketrightbt", + "bracerighttp", + "bracerightmid", + "bracerightbt", + NULL +}; +static GfxFontEncoding symbolEncoding(symbolEncodingNames, + symbolEncodingSize); + +#define zapfDingbatsEncodingSize 256 +static char *zapfDingbatsEncodingNames[zapfDingbatsEncodingSize] = { + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "space", + "a1", + "a2", + "a202", + "a3", + "a4", + "a5", + "a119", + "a118", + "a117", + "a11", + "a12", + "a13", + "a14", + "a15", + "a16", + "a105", + "a17", + "a18", + "a19", + "a20", + "a21", + "a22", + "a23", + "a24", + "a25", + "a26", + "a27", + "a28", + "a6", + "a7", + "a8", + "a9", + "a10", + "a29", + "a30", + "a31", + "a32", + "a33", + "a34", + "a35", + "a36", + "a37", + "a38", + "a39", + "a40", + "a41", + "a42", + "a43", + "a44", + "a45", + "a46", + "a47", + "a48", + "a49", + "a50", + "a51", + "a52", + "a53", + "a54", + "a55", + "a56", + "a57", + "a58", + "a59", + "a60", + "a61", + "a62", + "a63", + "a64", + "a65", + "a66", + "a67", + "a68", + "a69", + "a70", + "a71", + "a72", + "a73", + "a74", + "a203", + "a75", + "a204", + "a76", + "a77", + "a78", + "a79", + "a81", + "a82", + "a83", + "a84", + "a97", + "a98", + "a99", + "a100", + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + "a101", + "a102", + "a103", + "a104", + "a106", + "a107", + "a108", + "a112", + "a111", + "a110", + "a109", + "a120", + "a121", + "a122", + "a123", + "a124", + "a125", + "a126", + "a127", + "a128", + "a129", + "a130", + "a131", + "a132", + "a133", + "a134", + "a135", + "a136", + "a137", + "a138", + "a139", + "a140", + "a141", + "a142", + "a143", + "a144", + "a145", + "a146", + "a147", + "a148", + "a149", + "a150", + "a151", + "a152", + "a153", + "a154", + "a155", + "a156", + "a157", + "a158", + "a159", + "a160", + "a161", + "a163", + "a164", + "a196", + "a165", + "a192", + "a166", + "a167", + "a168", + "a169", + "a170", + "a171", + "a172", + "a173", + "a162", + "a174", + "a175", + "a176", + "a177", + "a178", + "a179", + "a193", + "a180", + "a199", + "a181", + "a200", + "a182", + NULL, + "a201", + "a183", + "a184", + "a197", + "a185", + "a194", + "a198", + "a186", + "a195", + "a187", + "a188", + "a189", + "a190", + "a191", + NULL +}; +static GfxFontEncoding zapfDingbatsEncoding(zapfDingbatsEncodingNames, + zapfDingbatsEncodingSize); + +#endif diff --git a/pdf/xpdf/XRef.cc b/pdf/xpdf/XRef.cc new file mode 100644 index 00000000..cc9bee80 --- /dev/null +++ b/pdf/xpdf/XRef.cc @@ -0,0 +1,443 @@ +//======================================================================== +// +// XRef.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifdef __GNUC__ +#pragma implementation +#endif + +#include +#include +#include +#include +#include "gmem.h" +#include "Object.h" +#include "Stream.h" +#include "Lexer.h" +#include "Parser.h" +#include "Dict.h" +#include "Error.h" +#include "XRef.h" + +//------------------------------------------------------------------------ + +#define xrefSearchSize 1024 // read this many bytes at end of file + // to look for 'startxref' + +//------------------------------------------------------------------------ +// The global xref table +//------------------------------------------------------------------------ + +XRef *xref = NULL; + +//------------------------------------------------------------------------ +// XRef +//------------------------------------------------------------------------ + +XRef::XRef(FileStream *str) { + XRef *oldXref; + int pos; + int i; + + ok = gTrue; + size = 0; + entries = NULL; + + // get rid of old xref (otherwise it will try to fetch the Root object + // in the new document, using the old xref) + oldXref = xref; + xref = NULL; + + // read the trailer + file = str->getFile(); + start = str->getStart(); + pos = readTrailer(str); + + // if there was a problem with the trailer, + // try to reconstruct the xref table + if (pos == 0) { + if (!(ok = constructXRef(str))) { + xref = oldXref; + return; + } + + // trailer is ok - read the xref table + } else { + entries = (XRefEntry *)gmalloc(size * sizeof(XRefEntry)); + for (i = 0; i < size; ++i) { + entries[i].offset = -1; + entries[i].used = gFalse; + } + while (readXRef(str, &pos)) ; + + // if there was a problem with the xref table, + // try to reconstruct it + if (!ok) { + gfree(entries); + size = 0; + entries = NULL; + if (!(ok = constructXRef(str))) { + xref = oldXref; + return; + } + } + } + + // set up new xref table + xref = this; + + // check for encryption + if (checkEncrypted()) { + ok = gFalse; + xref = oldXref; + return; + } +} + +XRef::~XRef() { + gfree(entries); + trailerDict.free(); +} + +// Read startxref position, xref table size, and root. Returns +// first xref position. +int XRef::readTrailer(FileStream *str) { + Parser *parser; + Object obj; + char buf[xrefSearchSize+1]; + int n, pos, pos1; + char *p; + int c; + int i; + + // read last xrefSearchSize bytes + str->setPos(-xrefSearchSize); + for (n = 0; n < xrefSearchSize; ++n) { + if ((c = str->getChar()) == EOF) + break; + buf[n] = c; + } + buf[n] = '\0'; + + // find startxref + for (i = n - 9; i >= 0; --i) { + if (!strncmp(&buf[i], "startxref", 9)) + break; + } + if (i < 0) + return 0; + for (p = &buf[i+9]; isspace(*p); ++p) ; + pos = atoi(p); + + // find trailer dict by looking after first xref table + // (NB: we can't just use the trailer dict at the end of the file -- + // this won't work for linearized files.) + str->setPos(start + pos); + for (i = 0; i < 4; ++i) + buf[i] = str->getChar(); + if (strncmp(buf, "xref", 4)) + return 0; + pos1 = pos + 4; + while (1) { + str->setPos(start + pos1); + for (i = 0; i < 35; ++i) { + if ((c = str->getChar()) == EOF) + return 0; + buf[i] = c; + } + if (!strncmp(buf, "trailer", 7)) + break; + p = buf; + while (isspace(*p)) ++p; + while ('0' <= *p && *p <= '9') ++p; + while (isspace(*p)) ++p; + n = atoi(p); + while ('0' <= *p && *p <= '9') ++p; + while (isspace(*p)) ++p; + if (p == buf) + return 0; + pos1 += (p - buf) + n * 20; + } + pos1 += 7; + + // read trailer dict + obj.initNull(); + parser = new Parser(new Lexer(new FileStream(file, start + pos1, -1, &obj))); + parser->getObj(&trailerDict); + if (trailerDict.isDict()) { + trailerDict.dictLookupNF("Size", &obj); + if (obj.isInt()) + size = obj.getInt(); + else + pos = 0; + obj.free(); + trailerDict.dictLookupNF("Root", &obj); + if (obj.isRef()) { + rootNum = obj.getRefNum(); + rootGen = obj.getRefGen(); + } else { + pos = 0; + } + obj.free(); + } else { + pos = 0; + } + delete parser; + + // return first xref position + return pos; +} + +// Read an xref table and the prev pointer from the trailer. +GBool XRef::readXRef(FileStream *str, int *pos) { + Parser *parser; + Object obj, obj2; + char s[20]; + GBool more; + int first, n, i, j; + int c; + + // seek to xref in stream + str->setPos(start + *pos); + + // make sure it's an xref table + while ((c = str->getChar()) != EOF && isspace(c)) ; + s[0] = (char)c; + s[1] = (char)str->getChar(); + s[2] = (char)str->getChar(); + s[3] = (char)str->getChar(); + if (!(s[0] == 'x' && s[1] == 'r' && s[2] == 'e' && s[3] == 'f')) + goto err2; + + // read xref + while (1) { + while ((c = str->lookChar()) != EOF && isspace(c)) + str->getChar(); + if (c == 't') + break; + for (i = 0; (c = str->getChar()) != EOF && isdigit(c) && i < 20; ++i) + s[i] = (char)c; + if (i == 0) + goto err2; + s[i] = '\0'; + first = atoi(s); + while ((c = str->lookChar()) != EOF && isspace(c)) + str->getChar(); + for (i = 0; (c = str->getChar()) != EOF && isdigit(c) && i < 20; ++i) + s[i] = (char)c; + if (i == 0) + goto err2; + s[i] = '\0'; + n = atoi(s); + while ((c = str->lookChar()) != EOF && isspace(c)) + str->getChar(); + for (i = first; i < first + n; ++i) { + for (j = 0; j < 20; ++j) { + if ((c = str->getChar()) == EOF) + goto err2; + s[j] = (char)c; + } + if (entries[i].offset < 0) { + s[10] = '\0'; + entries[i].offset = atoi(s); + s[16] = '\0'; + entries[i].gen = atoi(&s[11]); + if (s[17] == 'n') + entries[i].used = gTrue; + else if (s[17] == 'f') + entries[i].used = gFalse; + else + goto err2; + } + } + } + + // read prev pointer from trailer dictionary + obj.initNull(); + parser = new Parser(new Lexer( + new FileStream(file, str->getPos(), -1, &obj))); + parser->getObj(&obj); + if (!obj.isCmd("trailer")) + goto err1; + obj.free(); + parser->getObj(&obj); + if (!obj.isDict()) + goto err1; + obj.getDict()->lookupNF("Prev", &obj2); + if (obj2.isInt()) { + *pos = obj2.getInt(); + more = gTrue; + } else { + more = gFalse; + } + obj.free(); + obj2.free(); + + delete parser; + return more; + + err1: + obj.free(); + err2: + ok = gFalse; + return gFalse; +} + +// Attempt to construct an xref table for a damaged file. +GBool XRef::constructXRef(FileStream *str) { + Parser *parser; + Object obj; + char buf[256]; + int pos; + int num, gen; + int newSize; + char *p; + int i; + GBool gotRoot; + + error(0, "PDF file is damaged - attempting to reconstruct xref table..."); + gotRoot = gFalse; + + str->reset(); + while (1) { + pos = str->getPos(); + if (!str->getLine(buf, 256)) + break; + p = buf; + + // got trailer dictionary + if (!strncmp(p, "trailer", 7)) { + obj.initNull(); + parser = new Parser(new Lexer( + new FileStream(file, start + pos + 8, -1, &obj))); + if (!trailerDict.isNone()) + trailerDict.free(); + parser->getObj(&trailerDict); + if (trailerDict.isDict()) { + trailerDict.dictLookupNF("Root", &obj); + if (obj.isRef()) { + rootNum = obj.getRefNum(); + rootGen = obj.getRefGen(); + gotRoot = gTrue; + } + obj.free(); + } else { + pos = 0; + } + delete parser; + + // look for object + } else if (isdigit(*p)) { + num = atoi(p); + do { + ++p; + } while (*p && isdigit(*p)); + if (isspace(*p)) { + do { + ++p; + } while (*p && isspace(*p)); + if (isdigit(*p)) { + gen = atoi(p); + do { + ++p; + } while (*p && isdigit(*p)); + if (isspace(*p)) { + do { + ++p; + } while (*p && isspace(*p)); + if (!strncmp(p, "obj", 3)) { + if (num >= size) { + newSize = (num + 1 + 255) & ~255; + entries = (XRefEntry *) + grealloc(entries, newSize * sizeof(XRefEntry)); + for (i = size; i < newSize; ++i) { + entries[i].offset = -1; + entries[i].used = gFalse; + } + size = newSize; + } + if (!entries[num].used || gen >= entries[num].gen) { + entries[num].offset = pos - start; + entries[num].gen = gen; + entries[num].used = gTrue; + } + } + } + } + } + } + } + + if (gotRoot) + return gTrue; + + error(-1, "Couldn't find trailer dictionary"); + return gFalse; +} + +GBool XRef::checkEncrypted() { + Object obj; + GBool encrypted; + + trailerDict.dictLookup("Encrypt", &obj); + if ((encrypted = !obj.isNull())) { + error(-1, "PDF file is encrypted and cannot be displayed"); + error(-1, "* Decryption support is currently not included in xpdf"); + error(-1, "* due to legal restrictions: the U.S.A. still has bogus"); + error(-1, "* export controls on cryptography software."); + } + obj.free(); + return encrypted; +} + +GBool XRef::okToPrint() { + return gTrue; +} + +GBool XRef::okToCopy() { + return gTrue; +} + +Object *XRef::fetch(int num, int gen, Object *obj) { + XRefEntry *e; + Parser *parser; + Object obj1, obj2, obj3; + + // check for bogus ref - this can happen in corrupted PDF files + if (num < 0 || num >= size) { + obj->initNull(); + return obj; + } + + e = &entries[num]; + if (e->gen == gen && e->offset >= 0) { + obj1.initNull(); + parser = new Parser(new Lexer( + new FileStream(file, start + e->offset, -1, &obj1))); + parser->getObj(&obj1); + parser->getObj(&obj2); + parser->getObj(&obj3); + if (obj1.isInt() && obj1.getInt() == num && + obj2.isInt() && obj2.getInt() == gen && + obj3.isCmd("obj")) { + parser->getObj(obj); + } else { + obj->initNull(); + } + obj1.free(); + obj2.free(); + obj3.free(); + delete parser; + } else { + obj->initNull(); + } + return obj; +} + +Object *XRef::getDocInfo(Object *obj) { + return trailerDict.dictLookup("Info", obj); +} diff --git a/pdf/xpdf/XRef.h b/pdf/xpdf/XRef.h new file mode 100644 index 00000000..b843ea28 --- /dev/null +++ b/pdf/xpdf/XRef.h @@ -0,0 +1,84 @@ +//======================================================================== +// +// XRef.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef XREF_H +#define XREF_H + +#ifdef __GNUC__ +#pragma interface +#endif + +#include +#include "gtypes.h" +#include "Object.h" + +class Dict; +class FileStream; + +//------------------------------------------------------------------------ +// XRef +//------------------------------------------------------------------------ + +struct XRefEntry { + int offset; + int gen; + GBool used; +}; + +class XRef { +public: + + // Constructor. Read xref table from stream. + XRef(FileStream *str); + + // Destructor. + ~XRef(); + + // Is xref table valid? + GBool isOk() { return ok; } + + // Is the file encrypted? + GBool isEncrypted() { return gFalse; } + + // Are printing and copying allowed? If not, print an error message. + GBool okToPrint(); + GBool okToCopy(); + + // Get catalog object. + Object *getCatalog(Object *obj) { return fetch(rootNum, rootGen, obj); } + + // Fetch an indirect reference. + Object *fetch(int num, int gen, Object *obj); + + // Return the document's Info dictionary (if any). + Object *getDocInfo(Object *obj); + +private: + + FILE *file; // input file + int start; // offset in file (to allow for garbage + // at beginning of file) + XRefEntry *entries; // xref entries + int size; // size of array + int rootNum, rootGen; // catalog dict + GBool ok; // true if xref table is valid + Object trailerDict; // trailer dictionary + + int readTrailer(FileStream *str); + GBool readXRef(FileStream *str, int *pos); + GBool constructXRef(FileStream *str); + GBool checkEncrypted(); +}; + +//------------------------------------------------------------------------ +// The global xref table +//------------------------------------------------------------------------ + +extern XRef *xref; + +#endif diff --git a/pdf/xpdf/about.xbm b/pdf/xpdf/about.xbm new file mode 100644 index 00000000..86f84720 --- /dev/null +++ b/pdf/xpdf/about.xbm @@ -0,0 +1,6 @@ +#define about_width 10 +#define about_height 15 +static unsigned char about_bits[] = { + 0x78, 0x00, 0xfc, 0x00, 0xce, 0x01, 0x86, 0x01, 0x80, 0x01, 0x80, 0x01, + 0xc0, 0x01, 0xe0, 0x00, 0x70, 0x00, 0x30, 0x00, 0x30, 0x00, 0x30, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x30, 0x00}; diff --git a/pdf/xpdf/dblLeftArrow.xbm b/pdf/xpdf/dblLeftArrow.xbm new file mode 100644 index 00000000..616d2bd3 --- /dev/null +++ b/pdf/xpdf/dblLeftArrow.xbm @@ -0,0 +1,6 @@ +#define dblLeftArrow_width 16 +#define dblLeftArrow_height 15 +static unsigned char dblLeftArrow_bits[] = { + 0x80, 0x80, 0xc0, 0xc0, 0xe0, 0xe0, 0xf0, 0xf0, 0xf8, 0xf8, 0xfc, 0xfc, + 0xfe, 0xfe, 0xff, 0xff, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf8, 0xf0, 0xf0, + 0xe0, 0xe0, 0xc0, 0xc0, 0x80, 0x80}; diff --git a/pdf/xpdf/dblRightArrow.xbm b/pdf/xpdf/dblRightArrow.xbm new file mode 100644 index 00000000..0072810e --- /dev/null +++ b/pdf/xpdf/dblRightArrow.xbm @@ -0,0 +1,6 @@ +#define dblRightArrow_width 16 +#define dblRightArrow_height 15 +static unsigned char dblRightArrow_bits[] = { + 0x01, 0x01, 0x03, 0x03, 0x07, 0x07, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x3f, + 0x7f, 0x7f, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, + 0x07, 0x07, 0x03, 0x03, 0x01, 0x01}; diff --git a/pdf/xpdf/find.xbm b/pdf/xpdf/find.xbm new file mode 100644 index 00000000..206da875 --- /dev/null +++ b/pdf/xpdf/find.xbm @@ -0,0 +1,6 @@ +#define find_width 15 +#define find_height 15 +static unsigned char find_bits[] = { + 0x38, 0x0e, 0x28, 0x0a, 0x2e, 0x3a, 0xfe, 0x3f, 0x7f, 0x7f, 0x61, 0x43, + 0x61, 0x43, 0x61, 0x43, 0x61, 0x43, 0xe1, 0x43, 0x21, 0x42, 0x21, 0x42, + 0x21, 0x42, 0x21, 0x42, 0x3f, 0x7e}; diff --git a/pdf/xpdf/leftArrow.xbm b/pdf/xpdf/leftArrow.xbm new file mode 100644 index 00000000..367e4e60 --- /dev/null +++ b/pdf/xpdf/leftArrow.xbm @@ -0,0 +1,5 @@ +#define leftArrow_width 8 +#define leftArrow_height 15 +static unsigned char leftArrow_bits[] = { + 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff, 0xfe, 0xfc, 0xf8, 0xf0, + 0xe0, 0xc0, 0x80}; diff --git a/pdf/xpdf/makefile.w32 b/pdf/xpdf/makefile.w32 new file mode 100644 index 00000000..24a4672d --- /dev/null +++ b/pdf/xpdf/makefile.w32 @@ -0,0 +1,171 @@ +# Generated automatically from Makefile.in by configure. +#======================================================================== +# +# Xpdf Makefile +# +# Copyright 1996 Derek B. Noonburg +# +#======================================================================== + +srcdir = . + +GOOSRCDIR = $(srcdir)/../goo +GOOLIBDIR = ../goo +LTKSRCDIR = $(srcdir)/../ltk +LTKLIBDIR = ../ltk + +CXXFLAGS = -O2 -DHAVE_DIRENT_H=1 -DNO_POPEN -DUSE_GZIP=1 -I$(GOOSRCDIR) -I$(srcdir) + + +XLIBS = -lXpm -lSM -lICE -L/usr/X11R6/lib -lX11 + +CXX = gcc +STRIP = strip + +LIBPREFIX = lib +EXE = + +#------------------------------------------------------------------------ + +.SUFFIXES: .cc + +.cc.o: + $(CXX) $(CXXFLAGS) -c $< + +#------------------------------------------------------------------------ + +CXX_SRC = \ + $(srcdir)/Array.cc \ + $(srcdir)/Catalog.cc \ + $(srcdir)/Dict.cc \ + $(srcdir)/Error.cc \ + $(srcdir)/Gfx.cc \ + $(srcdir)/GfxFont.cc \ + $(srcdir)/GfxState.cc \ + $(srcdir)/ImageOutputDev.cc \ + $(srcdir)/Lexer.cc \ + $(srcdir)/Link.cc \ + $(srcdir)/LTKOutputDev.cc \ + $(srcdir)/Object.cc \ + $(srcdir)/OutputDev.cc \ + $(srcdir)/Page.cc \ + $(srcdir)/Params.cc \ + $(srcdir)/Parser.cc \ + $(srcdir)/PBMOutputDev.cc \ + $(srcdir)/PDFDoc.cc \ + $(srcdir)/PSOutputDev.cc \ + $(srcdir)/Stream.cc \ + $(srcdir)/TextOutputDev.cc \ + $(srcdir)/XOutputDev.cc \ + $(srcdir)/XRef.cc \ + $(srcdir)/xpdf.cc \ + $(srcdir)/pdftops.cc \ + $(srcdir)/pdftotext.cc \ + $(srcdir)/pdfinfo.cc \ + $(srcdir)/pdftopbm.cc \ + $(srcdir)/pdfimages.cc + +#------------------------------------------------------------------------ + +all: xpdf$(EXE) pdftops$(EXE) pdftotext$(EXE) pdfinfo$(EXE) \ + pdftopbm$(EXE) pdfimages$(EXE) + +#------------------------------------------------------------------------ + +XPDF_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o LTKOutputDev.o Object.o OutputDev.o \ + Page.o Params.o Parser.o PDFDoc.o PSOutputDev.o Stream.o \ + TextOutputDev.o XOutputDev.o XRef.o xpdf.o +XPDF_LIBS = -L$(LTKLIBDIR) -lLTK -L$(GOOLIBDIR) -lGoo $(XLIBS) -lm + +xpdf$(EXE): $(XPDF_OBJS) + $(CXX) $(CXXFLAGS) -o xpdf$(EXE) $(XPDF_OBJS) $(XPDF_LIBS) + $(STRIP) xpdf$(EXE).exe + +xpdf-ltk.h: xpdf.ltk + del $@ + $(LTKLIBDIR)/ltkbuild $@.new + mv $@.new $@ + +#------------------------------------------------------------------------ + +PDFTOPS_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o Params.o \ + Parser.o PDFDoc.o PSOutputDev.o Stream.o XRef.o pdftops.o +PDFTOPS_LIBS = -L$(GOOLIBDIR) -lGoo -lm + +pdftops$(EXE): $(PDFTOPS_OBJS) + $(CXX) $(CXXFLAGS) -o pdftops$(EXE) $(PDFTOPS_OBJS) $(PDFTOPS_LIBS) + $(STRIP) pdftops$(EXE).exe + +#------------------------------------------------------------------------ + +PDFTOTEXT_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o Params.o \ + Parser.o PDFDoc.o TextOutputDev.o Stream.o XRef.o pdftotext.o +PDFTOTEXT_LIBS = -L$(GOOLIBDIR) -lGoo -lm + +pdftotext$(EXE): $(PDFTOTEXT_OBJS) + $(CXX) $(CXXFLAGS) -o pdftotext$(EXE) $(PDFTOTEXT_OBJS) \ + $(PDFTOTEXT_LIBS) + $(STRIP) pdftotext$(EXE).exe + +#------------------------------------------------------------------------ + +PDFINFO_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o Page.o Params.o \ + Parser.o PDFDoc.o Stream.o XRef.o pdfinfo.o +PDFINFO_LIBS = -L$(GOOLIBDIR) -lGoo -lm + +pdfinfo$(EXE): $(PDFINFO_OBJS) + $(CXX) $(CXXFLAGS) -o pdfinfo$(EXE) $(PDFINFO_OBJS) $(PDFINFO_LIBS) + $(STRIP) pdfinfo$(EXE).exe + +#------------------------------------------------------------------------ + +PDFTOPBM_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o Lexer.o Link.o Object.o OutputDev.o PBMOutputDev.o \ + Page.o Params.o Parser.o PDFDoc.o Stream.o TextOutputDev.o \ + XOutputDev.o XRef.o pdftopbm.o +PDFTOPBM_LIBS = -L$(GOOLIBDIR) -lGoo $(XLIBS) -lm + +pdftopbm$(EXE): $(PDFTOPBM_OBJS) + $(CXX) $(CXXFLAGS) -o pdftopbm$(EXE) $(PDFTOPBM_OBJS) $(PDFTOPBM_LIBS) + $(STRIP) pdftopbm$(EXE).exe + +#------------------------------------------------------------------------ + +PDFIMAGES_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \ + GfxState.o ImageOutputDev.o Lexer.o Link.o Object.o OutputDev.o \ + Page.o Params.o Parser.o PDFDoc.o Stream.o XRef.o pdfimages.o +PDFIMAGES_LIBS = -L$(GOOLIBDIR) -lGoo -lm + +pdfimages$(EXE): $(PDFIMAGES_OBJS) + $(CXX) $(CXXFLAGS) -o pdfimages$(EXE) $(PDFIMAGES_OBJS) \ + $(PDFIMAGES_LIBS) + $(STRIP) pdfimages$(EXE).exe + +#------------------------------------------------------------------------ + +clean: + del *.o + del xpdf$(EXE) + del xpdf$(EXE).exe + del pdftops$(EXE) + del pdftops$(EXE).exe + del pdftotext$(EXE) + del pdftotext$(EXE).exe + del pdfinfo$(EXE) + del pdfinfo$(EXE).exe + del pdftopbm$(EXE) + del pdftopbm$(EXE).exe + del pdfimages$(EXE) + del pdfimages$(EXE).exe +# rm -f Makefile.bak + +#------------------------------------------------------------------------ + +depend: + $(CXX) $(CXXFLAGS) -M $(CXX_SRC) >Makefile.dep + +#include Makefile.dep diff --git a/pdf/xpdf/pdfimages.cc b/pdf/xpdf/pdfimages.cc new file mode 100644 index 00000000..1825a26a --- /dev/null +++ b/pdf/xpdf/pdfimages.cc @@ -0,0 +1,100 @@ +//======================================================================== +// +// pdfimages.cc +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include "parseargs.h" +#include "GString.h" +#include "gmem.h" +#include "Object.h" +#include "Stream.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "Catalog.h" +#include "Page.h" +#include "PDFDoc.h" +#include "ImageOutputDev.h" +#include "Params.h" +#include "Error.h" +#include "config.h" + +static int firstPage = 1; +static int lastPage = 0; +static GBool dumpJPEG = gFalse; +GBool printCommands = gFalse; +static GBool printHelp = gFalse; + +static ArgDesc argDesc[] = { + {"-f", argInt, &firstPage, 0, + "first page to convert"}, + {"-l", argInt, &lastPage, 0, + "last page to convert"}, + {"-j", argFlag, &dumpJPEG, 0, + "write JPEG images as JPEG files"}, + {"-h", argFlag, &printHelp, 0, + "print usage information"}, + {"-help", argFlag, &printHelp, 0, + "print usage information"}, + {NULL} +}; + +int main(int argc, char *argv[]) { + PDFDoc *doc; + GString *fileName; + char *imgRoot; + ImageOutputDev *imgOut; + GBool ok; + + // parse args + ok = parseArgs(argDesc, &argc, argv); + if (!ok || argc != 3 || printHelp) { + fprintf(stderr, "pdfimages version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + printUsage("pdfimages", " ", argDesc); + exit(1); + } + fileName = new GString(argv[1]); + imgRoot = argv[2]; + + // init error file + errorInit(); + + // read config file + initParams(xpdfConfigFile); + + // open PDF file + xref = NULL; + doc = new PDFDoc(fileName); + if (!doc->isOk()) + exit(1); + + // get page range + if (firstPage < 1) + firstPage = 1; + if (lastPage < 1 || lastPage > doc->getNumPages()) + lastPage = doc->getNumPages(); + + // write image files + imgOut = new ImageOutputDev(imgRoot, dumpJPEG); + if (imgOut->isOk()) + doc->displayPages(imgOut, firstPage, lastPage, 72, 0); + delete imgOut; + + // clean up + delete doc; + freeParams(); + + // check for memory leaks + Object::memCheck(errFile); + gMemReport(errFile); + + return 0; +} diff --git a/pdf/xpdf/pdfinfo.cc b/pdf/xpdf/pdfinfo.cc new file mode 100644 index 00000000..fae8a182 --- /dev/null +++ b/pdf/xpdf/pdfinfo.cc @@ -0,0 +1,121 @@ +//======================================================================== +// +// pdfinfo.cc +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include "parseargs.h" +#include "GString.h" +#include "gmem.h" +#include "Object.h" +#include "Stream.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "Catalog.h" +#include "Page.h" +#include "PDFDoc.h" +#include "Params.h" +#include "Error.h" +#include "config.h" + +GBool printCommands = gFalse; +static GBool printHelp = gFalse; + +static ArgDesc argDesc[] = { + {"-h", argFlag, &printHelp, 0, + "print usage information"}, + {"-help", argFlag, &printHelp, 0, + "print usage information"}, + {NULL} +}; + +int main(int argc, char *argv[]) { + PDFDoc *doc; + GString *fileName; + Object info, obj; + char *s; + GBool ok; + + // parse args + ok = parseArgs(argDesc, &argc, argv); + if (!ok || argc != 2 || printHelp) { + fprintf(stderr, "pdfinfo version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + printUsage("pdfinfo", "", argDesc); + exit(1); + } + fileName = new GString(argv[1]); + + // init error file + errorInit(); + + // read config file + initParams(xpdfConfigFile); + + // open PDF file + xref = NULL; + doc = new PDFDoc(fileName); + if (!doc->isOk()) + exit(1); + + // print doc info + doc->getDocInfo(&info); + if (info.isDict()) { + if (info.dictLookup("Title", &obj)->isString()) + printf("Title: %s\n", obj.getString()->getCString()); + obj.free(); + if (info.dictLookup("Subject", &obj)->isString()) + printf("Subject: %s\n", obj.getString()->getCString()); + obj.free(); + if (info.dictLookup("Keywords", &obj)->isString()) + printf("Keywords: %s\n", obj.getString()->getCString()); + obj.free(); + if (info.dictLookup("Author", &obj)->isString()) + printf("Author: %s\n", obj.getString()->getCString()); + obj.free(); + if (info.dictLookup("Creator", &obj)->isString()) + printf("Creator: %s\n", obj.getString()->getCString()); + obj.free(); + if (info.dictLookup("Producer", &obj)->isString()) + printf("Producer: %s\n", obj.getString()->getCString()); + obj.free(); + if (info.dictLookup("CreationDate", &obj)->isString()) { + s = obj.getString()->getCString(); + if (s[0] == 'D' && s[1] == ':') + s += 2; + printf("CreationDate: %s\n", s); + } + obj.free(); + if (info.dictLookup("ModDate", &obj)->isString()) { + s = obj.getString()->getCString(); + if (s[0] == 'D' && s[1] == ':') + s += 2; + printf("ModDate: %s\n", s); + } + obj.free(); + } + info.free(); + + // print page count + printf("Pages: %d\n", doc->getNumPages()); + + // print encrypted flag + printf("Encrypted: %s\n", doc->isEncrypted() ? "yes" : "no"); + + // clean up + delete doc; + freeParams(); + + // check for memory leaks + Object::memCheck(errFile); + gMemReport(errFile); + + return 0; +} diff --git a/pdf/xpdf/pdftopbm.cc b/pdf/xpdf/pdftopbm.cc new file mode 100644 index 00000000..42fa3cd8 --- /dev/null +++ b/pdf/xpdf/pdftopbm.cc @@ -0,0 +1,100 @@ +//======================================================================== +// +// pdftopbm.cc +// +// Copyright 1998 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include "parseargs.h" +#include "GString.h" +#include "gmem.h" +#include "Object.h" +#include "Stream.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "Catalog.h" +#include "Page.h" +#include "PDFDoc.h" +#include "PBMOutputDev.h" +#include "Params.h" +#include "Error.h" +#include "config.h" + +static int firstPage = 1; +static int lastPage = 0; +static int resolution = 150; +GBool printCommands = gFalse; +static GBool printHelp = gFalse; + +static ArgDesc argDesc[] = { + {"-f", argInt, &firstPage, 0, + "first page to print"}, + {"-l", argInt, &lastPage, 0, + "last page to print"}, + {"-r", argInt, &resolution, 0, + "resolution, in DPI (default is 150)"}, + {"-h", argFlag, &printHelp, 0, + "print usage information"}, + {"-help", argFlag, &printHelp, 0, + "print usage information"}, + {NULL} +}; + +int main(int argc, char *argv[]) { + PDFDoc *doc; + GString *fileName; + char *pbmRoot; + PBMOutputDev *pbmOut; + GBool ok; + + // parse args + ok = parseArgs(argDesc, &argc, argv); + if (!ok || argc != 3 || printHelp) { + fprintf(stderr, "pdftopbm version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + printUsage("pdftopbm", " ", argDesc); + exit(1); + } + fileName = new GString(argv[1]); + pbmRoot = argv[2]; + + // init error file + errorInit(); + + // read config file + initParams(xpdfConfigFile); + + // open PDF file + xref = NULL; + doc = new PDFDoc(fileName); + if (!doc->isOk()) + exit(1); + + // get page range + if (firstPage < 1) + firstPage = 1; + if (lastPage < 1 || lastPage > doc->getNumPages()) + lastPage = doc->getNumPages(); + + // write PBM files + rgbCubeSize = 1; + pbmOut = PBMOutputDev::makePBMOutputDev(NULL, pbmRoot); + doc->displayPages(pbmOut, firstPage, lastPage, resolution, 0); + delete pbmOut; + + // clean up + delete doc; + freeParams(); + + // check for memory leaks + Object::memCheck(errFile); + gMemReport(errFile); + + return 0; +} diff --git a/pdf/xpdf/pdftops.cc b/pdf/xpdf/pdftops.cc new file mode 100644 index 00000000..08b369fa --- /dev/null +++ b/pdf/xpdf/pdftops.cc @@ -0,0 +1,132 @@ +//======================================================================== +// +// pdftops.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include "parseargs.h" +#include "GString.h" +#include "gmem.h" +#include "Object.h" +#include "Stream.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "Catalog.h" +#include "Page.h" +#include "PDFDoc.h" +#include "PSOutputDev.h" +#include "Params.h" +#include "Error.h" +#include "config.h" + +static int firstPage = 1; +static int lastPage = 0; +static GBool noEmbedFonts = gFalse; +static GBool doForm = gFalse; +GBool printCommands = gFalse; +static GBool printHelp = gFalse; + +static ArgDesc argDesc[] = { + {"-f", argInt, &firstPage, 0, + "first page to print"}, + {"-l", argInt, &lastPage, 0, + "last page to print"}, + {"-paperw", argInt, &paperWidth, 0, + "paper width, in points"}, + {"-paperh", argInt, &paperHeight, 0, + "paper height, in points"}, + {"-level1", argFlag, &psOutLevel1, 0, + "generate Level 1 PostScript"}, + {"-noemb", argFlag, &noEmbedFonts, 0, + "don't embed Type 1 fonts"}, + {"-form", argFlag, &doForm, 0, + "generate a PostScript form"}, + {"-h", argFlag, &printHelp, 0, + "print usage information"}, + {"-help", argFlag, &printHelp, 0, + "print usage information"}, + {NULL} +}; + +int main(int argc, char *argv[]) { + PDFDoc *doc; + GString *fileName; + GString *psFileName; + PSOutputDev *psOut; + GBool ok; + char *p; + + // parse args + ok = parseArgs(argDesc, &argc, argv); + if (!ok || argc < 2 || argc > 3 || printHelp) { + fprintf(stderr, "pdftops version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + printUsage("pdftops", " []", argDesc); + exit(1); + } + if (doForm && psOutLevel1) { + fprintf(stderr, "Error: forms are only available with Level 2 output.\n"); + exit(1); + } + fileName = new GString(argv[1]); + + // init error file + errorInit(); + + // read config file + initParams(xpdfConfigFile); + + // open PDF file + xref = NULL; + doc = new PDFDoc(fileName); + if (!doc->isOk()) + exit(1); + + // construct PostScript file name + 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); + else + psFileName = fileName->copy(); + psFileName->append(".ps"); + } + + // get page range + if (firstPage < 1) + firstPage = 1; + if (lastPage < 1 || lastPage > doc->getNumPages()) + lastPage = doc->getNumPages(); + if (doForm) + lastPage = firstPage; + + // write PostScript file + if (doc->okToPrint()) { + psOut = new PSOutputDev(psFileName->getCString(), doc->getCatalog(), + firstPage, lastPage, !noEmbedFonts, doForm); + if (psOut->isOk()) + doc->displayPages(psOut, firstPage, lastPage, 72, 0); + delete psOut; + } + + // clean up + delete psFileName; + delete doc; + freeParams(); + + // check for memory leaks + Object::memCheck(errFile); + gMemReport(errFile); + + return 0; +} diff --git a/pdf/xpdf/pdftotext.cc b/pdf/xpdf/pdftotext.cc new file mode 100644 index 00000000..aa38a8be --- /dev/null +++ b/pdf/xpdf/pdftotext.cc @@ -0,0 +1,114 @@ +//======================================================================== +// +// pdftotext.cc +// +// Copyright 1997 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include "parseargs.h" +#include "GString.h" +#include "gmem.h" +#include "Object.h" +#include "Stream.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "Catalog.h" +#include "Page.h" +#include "PDFDoc.h" +#include "TextOutputDev.h" +#include "Params.h" +#include "Error.h" +#include "config.h" + +static int firstPage = 1; +static int lastPage = 0; +static GBool useASCII7 = gFalse; +GBool printCommands = gFalse; +static GBool printHelp = gFalse; + +static ArgDesc argDesc[] = { + {"-f", argInt, &firstPage, 0, + "first page to convert"}, + {"-l", argInt, &lastPage, 0, + "last page to convert"}, + {"-ascii7", argFlag, &useASCII7, 0, + "convert to 7-bit ASCII (default is 8-bit ISO Latin-1)"}, + {"-h", argFlag, &printHelp, 0, + "print usage information"}, + {"-help", argFlag, &printHelp, 0, + "print usage information"}, + {NULL} +}; + +int main(int argc, char *argv[]) { + PDFDoc *doc; + GString *fileName; + GString *textFileName; + TextOutputDev *textOut; + GBool ok; + char *p; + + // parse args + ok = parseArgs(argDesc, &argc, argv); + if (!ok || argc < 2 || argc > 3 || printHelp) { + fprintf(stderr, "pdftotext version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + printUsage("pdftotext", " []", argDesc); + exit(1); + } + fileName = new GString(argv[1]); + + // init error file + errorInit(); + + // read config file + initParams(xpdfConfigFile); + + // open PDF file + xref = NULL; + doc = new PDFDoc(fileName); + if (!doc->isOk()) + exit(1); + + // construct text file name + 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); + else + textFileName = fileName->copy(); + textFileName->append(".txt"); + } + + // get page range + if (firstPage < 1) + firstPage = 1; + if (lastPage < 1 || lastPage > doc->getNumPages()) + lastPage = doc->getNumPages(); + + // write text file + textOut = new TextOutputDev(textFileName->getCString(), useASCII7); + if (textOut->isOk()) + doc->displayPages(textOut, firstPage, lastPage, 72, 0); + delete textOut; + + // clean up + delete textFileName; + delete doc; + freeParams(); + + // check for memory leaks + Object::memCheck(errFile); + gMemReport(errFile); + + return 0; +} diff --git a/pdf/xpdf/postscript.xbm b/pdf/xpdf/postscript.xbm new file mode 100644 index 00000000..016e1263 --- /dev/null +++ b/pdf/xpdf/postscript.xbm @@ -0,0 +1,6 @@ +#define postscript_width 15 +#define postscript_height 15 +static unsigned char postscript_bits[] = { + 0xf0, 0x7f, 0x10, 0x40, 0x10, 0x40, 0xc8, 0x23, 0x08, 0x20, 0x68, 0x23, + 0x04, 0x10, 0x34, 0x10, 0x04, 0x10, 0xff, 0x7f, 0x55, 0x55, 0xab, 0x6a, + 0x55, 0x55, 0xab, 0x6a, 0xfe, 0x3f}; diff --git a/pdf/xpdf/rightArrow.xbm b/pdf/xpdf/rightArrow.xbm new file mode 100644 index 00000000..4ccb16b1 --- /dev/null +++ b/pdf/xpdf/rightArrow.xbm @@ -0,0 +1,5 @@ +#define rightArrow_width 8 +#define rightArrow_height 15 +static unsigned char rightArrow_bits[] = { + 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff, 0x7f, 0x3f, 0x1f, 0x0f, + 0x07, 0x03, 0x01}; diff --git a/pdf/xpdf/vms_make.com b/pdf/xpdf/vms_make.com new file mode 100644 index 00000000..18429fae --- /dev/null +++ b/pdf/xpdf/vms_make.com @@ -0,0 +1,88 @@ +$!======================================================================== +$! +$! Xpdf compile script for VMS. +$! +$! Copyright 1996 Derek B. Noonburg +$! +$!======================================================================== +$! +$ XPDF_OBJS = "Array.obj,Catalog.obj,Dict.obj,Error.obj,Gfx.obj," + - + "GfxFont.obj,GfxState.obj,Lexer.obj,Link.obj," + - + "LTKOutputDev.obj,Object.obj,OutputDev.obj,Page.obj," + - + "Params.obj,Parser.obj,PDFDoc.obj,PSOutputDev.obj," + - + "Stream.obj,TextOutputDev.obj,XOutputDev.obj,XRef.obj" +$ XPDF_LIBS = "[-.goo]libgoo.olb/lib,[-.ltk]libltk.olb/lib" +$! +$ PDFTOPS_OBJS = "Array.obj,Catalog.obj,Dict.obj,Error.obj,Gfx.obj," + - + "GfxFont.obj,GfxState.obj,Lexer.obj,Link.obj," + - + "Object.obj,OutputDev.obj,Page.obj,Params.obj," + - + "Parser.obj,PDFdoc.obj,PSOutputDev.obj,Stream.obj," + - + "XRef.obj" +$ PDFTOPS_LIBS = "[-.goo]libgoo.olb/lib" +$! +$ PDFTOTEXT_OBJS = "Array.obj,Catalog.obj,Dict.obj,Error.obj,Gfx.obj," + - + "GfxFont.obj,GfxState.obj,Lexer.obj,Link.obj," + - + "Object.obj,OutputDev.obj,Page.obj,Params.obj," + - + "Parser.obj,PDFdoc.obj,TextOutputDev.obj,Stream.obj," + - + "XRef.obj" +$ PDFTOTEXT_LIBS = "[-.goo]libgoo.olb/lib" +$! +$ PDFINFO_OBJS = "Array.obj,Catalog.obj,Dict.obj,Error.obj,Gfx.obj," + - + "GfxFont.obj,GfxState.obj,Lexer.obj,Link.obj," + - + "Object.obj,OutputDev.obj,Page.obj,Params.obj," + - + "Parser.obj,PDFdoc.obj,Stream.obj,XRef.obj" +$ PDFINFO_LIBS = "[-.goo]libgoo.olb/lib" +$! +$ PDFTOPBM_OBJS = "Array.obj,Catalog.obj,Dict.obj,Error.obj,Gfx.obj," + - + "GfxFont.obj,GfxState.obj,Lexer.obj,Link.obj," + - + "Object.obj,OutputDev.obj,PBMOutputDev.obj,Page.obj," + - + "Params.obj,Parser.obj,PDFdoc.obj,Stream.obj," + - + "TextOutputDev.obj,XOutputDev.obj,XRef.obj" +$ PDFTOPBM_LIBS = "[-.goo]libgoo.olb/lib" +$! +$ PDFIMAGES_OBJS = "Array.obj,Catalog.obj,Dict.obj,Error.obj,Gfx.obj," + - + "GfxFont.obj,GfxState.obj,ImageOutputDev.obj," + - + "Lexer.obj,Link.obj,Object.obj,OutputDev.obj,Page.obj," + - + "Params.obj,Parser.obj,PDFdoc.obj,Stream.obj,XRef.obj" +$ PDFIMAGES_LIBS = "[-.goo]libgoo.olb/lib" +$! Build xpdf-ltk.h +$ def/user sys$input xpdf.ltk +$ def/user sys$output xpdf-ltk.h +$ run [-.ltk]ltkbuild +$! +$ CXXCOMP Array.cc +$ CXXCOMP Catalog.cc +$ CXXCOMP Dict.cc +$ CXXCOMP Error.cc +$ CXXCOMP Gfx.cc +$ CXXCOMP GfxFont.cc +$ CXXCOMP GfxState.cc +$ CXXCOMP ImageOutputDev.cc +$ CXXCOMP Lexer.cc +$ CXXCOMP Link.cc +$ CXXCOMP LTKOutputDev.cc +$ CXXCOMP Object.cc +$ CXXCOMP OutputDev.cc +$ CXXCOMP Page.cc +$ CXXCOMP Params.cc +$ CXXCOMP Parser.cc +$ CXXCOMP PBMOutputDev.cc +$ CXXCOMP PDFDoc.cc +$ CXXCOMP PSOutputDev.cc +$ CXXCOMP Stream.cc +$ CXXCOMP TextOutputDev.cc +$ CXXCOMP XOutputDev.cc +$ CXXCOMP XRef.cc +$ CXXCOMP xpdf.cc +$ CXXCOMP pdftops.cc +$ CXXCOMP pdftotext.cc +$ CXXCOMP pdfinfo.cc +$ CXXCOMP pdftopbm.cc +$ CXXCOMP pdfimages.cc +$! +$ link xpdf,'XPDF_OBJS,'XPDF_LIBS,[-]xpdf.opt/opt +$ link pdftops,'PDFTOPS_OBJS,'PDFTOPS_LIBS,[-]xpdf.opt/opt +$ link pdftotext,'PDFTOTEXT_OBJS,'PDFTOTEXT_LIBS,[-]xpdf.opt/opt +$ link pdfinfo,'PDFINFO_OBJS,'PDFINFO_LIBS,[-]xpdf.opt/opt +$ link pdftopbm,'PDFTOPBM_OBJS,'PDFTOPBM_LIBS,[-]xpdf.opt/opt +$ link pdfimages,'PDFIMAGES_OBJS,'PDFIMAGES_LIBS,[-]xpdf.opt/opt diff --git a/pdf/xpdf/xpdf-flip.ltk b/pdf/xpdf/xpdf-flip.ltk new file mode 100644 index 00000000..97c7cc6d --- /dev/null +++ b/pdf/xpdf/xpdf-flip.ltk @@ -0,0 +1,253 @@ +#======================================================================== +# +# xpdf-flip.ltk +# +# Copyright 1997 Derek B. Noonburg +# +#======================================================================== + +#------------------------------------------------------------------------ +# main window +#------------------------------------------------------------------------ + +Window(func:makeWindow title:"xpdf" icon:xpdfIcon) { + Box(x:2 y:1 xfill:1 yfill:1) { + + # canvas, scrollbars, page number + Box(x:2 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1 sunken) { + ScrollingCanvas(name:"canvas" w:100 h:100) + } + Box1(yfill:1) { + Scrollbar(name:"vScrollbar" vert min:0 max:100 move:&scrollVertCbk) + } + Box(x:4 y:1) { + Box1() { + Label(text:"Page" + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + Box1(sunken left:4 right:4) { + TextIn(name:"pageNum" mw:6 done:&pageNumCbk + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + Box1() { + Label(name:"numPages" length:9 + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + Box(x:1 y:2 xfill:1) { + Box1(xfill:1) { + Scrollbar(name:"hScrollbar" horiz min:0 max:100 + move:&scrollHorizCbk) + } + Box1(xfill:1 yfill:1) { Empty() } + } + } + Box1() { Empty() } + } + + # buttons + Box(x:1 y:12 yfill:1) { + Box1() { + IconButton(bitmap:leftArrow_bits w:leftArrow_width + h:leftArrow_height press:&prevPageCbk) + } + Box1() { + IconButton(bitmap:rightArrow_bits w:rightArrow_width + h:rightArrow_height press:&nextPageCbk) + } + Box1() { + IconButton(bitmap:dblLeftArrow_bits w:dblLeftArrow_width + h:dblLeftArrow_height press:&prevTenPageCbk) + } + Box1() { + IconButton(bitmap:dblRightArrow_bits w:dblRightArrow_width + h:dblRightArrow_height press:&nextTenPageCbk) + } + Box1(yfill:1) { Empty() } + Box1() { + IconButton(bitmap:zoomIn_bits w:zoomIn_width + h:zoomIn_height press:&zoomInCbk) + } + Box1() { + IconButton(bitmap:zoomOut_bits w:zoomOut_width + h:zoomOut_height press:&zoomOutCbk) + } + Box1(yfill:1) { Empty() } + Box1() { + IconButton(bitmap:postscript_bits w:postscript_width + h:postscript_height press:&postScriptCbk) + } + Box1() { + IconButton(bitmap:about_bits w:about_width h:about_height + press:&aboutCbk) + } + Box1(yfill:1) { Empty() } + Box1() { Button(label:"Quit" press:&quitCbk) } + } + } +} + +#------------------------------------------------------------------------ +# menu for main window +#------------------------------------------------------------------------ + +Menu(func:makeMenu title:"xpdf" n:9) { + MenuItem(text:"Open..." shortcut:"O" num:menuOpen + select:&menuCbk) + MenuItem(text:"Save PDF..." num:menuSavePDF + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Find" shortcut:"F" num:menuFind + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Rotate left" num:menuRotateLeft + select:&menuCbk) + MenuItem(text:"Rotate right" num:menuRotateRight + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Quit" shortcut:"Q" num:menuQuit + select:&menuCbk) +} + +#------------------------------------------------------------------------ +# "PostScript output" dialog +#------------------------------------------------------------------------ + +Window(func:makePostScriptDialog dialog:gTrue defWidget:"ok" + title:"xpdf: PostScript output") { + Box(x:1 y:3) { + Box(x:4 y:1) { + Box1() { Label(text:"Pages:") } + Box1(sunken) { + TextIn(name:"firstPage" mw:6 tab:"lastPage" + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + Box1() { Label(text:"to") } + Box1(sunken) { + TextIn(name:"lastPage" mw:6 tab:"fileName" + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + } + Box(x:2 y:1) { + Box1() { Label(text:"File:") } + Box1(sunken xfill:1) { + TextIn(name:"fileName" mw:32 + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + } + Box(x:3 y:1 top:8) { + Box1(left:8) { Button(name:"ok" label:"Ok" press:&psButtonCbk num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&psButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "open" dialog +#------------------------------------------------------------------------ + +Window(func:makeOpenDialog dialog:gTrue defWidget:"open" + title:"xpdf: Open...") { + Box(x:1 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1) { + FileReq(name:"fileReq" select:openSelectCbk + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"open" label:"Open" press:&openButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&openButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "save" dialog +#------------------------------------------------------------------------ + +Window(func:makeSaveDialog dialog:gTrue defWidget:"save" + title:"xpdf: Save as...") { + Box(x:1 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1) { + FileReq(name:"fileReq" select:saveSelectCbk + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"save" label:"Save" press:&saveButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&saveButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "find" window +#------------------------------------------------------------------------ + +Window(func:makeFindWindow defWidget:"find" title:"xpdf: Find") { + Box(x:1 y:3 xfill:1 yfill:1) { + Box(x:2 y:1 xfill:1) { + Box1() { Label(text:"Text:") } + Box1(xfill:1 sunken) { + TextIn(name:"text" mw:32 + font:"-*-courier-medium-r-*-*-14-*-*-*-*-*-*-*") + } + } + Box1(xfill:1 yfill:1) { Empty() } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"find" label:"Find" press:&findButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Close" press:&findButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "about" window +#------------------------------------------------------------------------ + +Window(func:makeAboutWindow defWidget:"close" title:"About xpdf") { + Box(x:1 y:2) { + Box(x:1 y:10 left:2 right:2 top:2 bottom:2 sunken) { + Box1(bottom:0) { + Label(text:"xpdf" + font:"-*-times-bold-i-*-*-24-*-*-*-*-*-*-*") + } + Box1(bottom:12) { + Label(text:["Version " xpdfVersion]) + } + Box1(bottom:0) { + Label(text:xpdfCopyright) + } + Box1(bottom:12) { + Label(text:"derekn@foolabs.com") + } + Box1(bottom:0) { + Label(text:["Supports PDF version " pdfVersion "."]) + } + Box1(bottom:0) { + Label(text:"The PDF data structures, operators, and specification") + } + Box1(bottom:12) { + Label(text:"are copyright 1995 Adobe Systems Inc.") + } + Box1(bottom:0) { + Label(text:"Mouse button 1: select text / follow link") + } + Box1(bottom:12) { + Label(text:"Mouse button 3: menu") + } + Box1(bottom:12) { + Label(text:"http://www.foolabs.com/xpdf/") + } + } + Box(x:2 y:1) { + Box1(xfill:1) { Empty() } + Box1() { Button(name:"close" label:"Close" press:&closeAboutCbk) } + } + } +} diff --git a/pdf/xpdf/xpdf-ltk.h b/pdf/xpdf/xpdf-ltk.h new file mode 100644 index 00000000..2c18d32e --- /dev/null +++ b/pdf/xpdf/xpdf-ltk.h @@ -0,0 +1,241 @@ +// This file was generated by ltkbuild 0.80 + +LTKWindow *makeWindow(LTKApp *app) { + return new LTKWindow(app, gFalse, "xpdf", xpdfIcon, NULL, + new LTKBox(NULL, 1, 2, 0, 0, 0, 0, ltkBorderNone, 1, 1, + new LTKBox(NULL, 2, 2, 0, 0, 0, 0, ltkBorderNone, 1, 1, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderSunken, 1, 1, + new LTKScrollingCanvas("canvas", 0, 100, 100, 32, 32) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 1, + new LTKScrollbar("vScrollbar", 0, gTrue, 0, 100, &scrollVertCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKScrollbar("hScrollbar", 0, gFalse, 0, 100, &scrollHorizCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKEmpty() + ) + ), + new LTKBox(NULL, 14, 1, 0, 0, 0, 0, ltkBorderNone, 1, 0, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, dblLeftArrow_bits, dblLeftArrow_width, dblLeftArrow_height, ltkButtonClick, &prevTenPageCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, leftArrow_bits, leftArrow_width, leftArrow_height, ltkButtonClick, &prevPageCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, rightArrow_bits, rightArrow_width, rightArrow_height, ltkButtonClick, &nextPageCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, dblRightArrow_bits, dblRightArrow_width, dblRightArrow_height, ltkButtonClick, &nextTenPageCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", "Page") + ), + new LTKBox(NULL, 1, 1, 4, 4, 2, 2, ltkBorderSunken, 0, 0, + new LTKTextIn("pageNum", 0, 6, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", &pageNumCbk, NULL) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel("numPages", 0, ltkLabelMaxLength, 9, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", NULL) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, zoomIn_bits, zoomIn_width, zoomIn_height, ltkButtonClick, &zoomInCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, zoomOut_bits, zoomOut_width, zoomOut_height, ltkButtonClick, &zoomOutCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, find_bits, find_width, find_height, ltkButtonClick, &findCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, postscript_bits, postscript_width, postscript_height, ltkButtonClick, &postScriptCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, about_bits, about_width, about_height, ltkButtonClick, &aboutCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKLabel("link", 0, ltkLabelFixedWidth, 8, "-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*", NULL) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, "Quit", ltkButtonClick, &quitCbk) + ) + ) + ) + ); +} + +LTKMenu *makeMenu() { + return new LTKMenu("xpdf", 7, + new LTKMenuItem("Open...", "O", menuOpen, &menuCbk, NULL), + new LTKMenuItem("Save as...", NULL, menuSavePDF, &menuCbk, NULL), + new LTKMenuItem(NULL, NULL, 0, NULL, NULL), + new LTKMenuItem("Rotate left", NULL, menuRotateLeft, &menuCbk, NULL), + new LTKMenuItem("Rotate right", NULL, menuRotateRight, &menuCbk, NULL), + new LTKMenuItem(NULL, NULL, 0, NULL, NULL), + new LTKMenuItem("Quit", "Q", menuQuit, &menuCbk, NULL) + + ); +} + +LTKWindow *makePostScriptDialog(LTKApp *app) { + return new LTKWindow(app, gTrue, "xpdf: PostScript output", NULL, "ok", + new LTKBox(NULL, 1, 3, 0, 0, 0, 0, ltkBorderNone, 0, 0, + new LTKBox(NULL, 4, 1, 0, 0, 0, 0, ltkBorderNone, 0, 0, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Pages:") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderSunken, 0, 0, + new LTKTextIn("firstPage", 0, 6, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", NULL, "lastPage") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "to") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderSunken, 0, 0, + new LTKTextIn("lastPage", 0, 6, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", NULL, "fileName") + ) + ), + new LTKBox(NULL, 2, 1, 0, 0, 0, 0, ltkBorderNone, 0, 0, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "File:") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderSunken, 1, 0, + new LTKTextIn("fileName", 0, 32, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", NULL, NULL) + ) + ), + new LTKBox(NULL, 3, 1, 0, 0, 8, 0, ltkBorderNone, 0, 0, + new LTKBox(NULL, 1, 1, 8, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton("ok", 1, "Ok", ltkButtonClick, &psButtonCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKEmpty() + ), + new LTKBox(NULL, 1, 1, 2, 8, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, "Cancel", ltkButtonClick, &psButtonCbk) + ) + ) + ) + ); +} + +LTKWindow *makeOpenDialog(LTKApp *app) { + return new LTKWindow(app, gTrue, "xpdf: Open...", NULL, "open", + new LTKBox(NULL, 1, 2, 0, 0, 0, 0, ltkBorderNone, 1, 1, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 1, + new LTKFileReq("fileReq", 0, openSelectCbk, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + ), + new LTKBox(NULL, 3, 1, 0, 0, 8, 0, ltkBorderNone, 1, 0, + new LTKBox(NULL, 1, 1, 8, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton("open", 1, "Open", ltkButtonClick, &openButtonCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKEmpty() + ), + new LTKBox(NULL, 1, 1, 2, 8, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, "Cancel", ltkButtonClick, &openButtonCbk) + ) + ) + ) + ); +} + +LTKWindow *makeSaveDialog(LTKApp *app) { + return new LTKWindow(app, gTrue, "xpdf: Save as...", NULL, "save", + new LTKBox(NULL, 1, 2, 0, 0, 0, 0, ltkBorderNone, 1, 1, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 1, + new LTKFileReq("fileReq", 0, saveSelectCbk, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + ), + new LTKBox(NULL, 3, 1, 0, 0, 8, 0, ltkBorderNone, 1, 0, + new LTKBox(NULL, 1, 1, 8, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton("save", 1, "Save", ltkButtonClick, &saveButtonCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKEmpty() + ), + new LTKBox(NULL, 1, 1, 2, 8, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, "Cancel", ltkButtonClick, &saveButtonCbk) + ) + ) + ) + ); +} + +LTKWindow *makeFindWindow(LTKApp *app) { + return new LTKWindow(app, gFalse, "xpdf: Find", NULL, "find", + new LTKBox(NULL, 1, 3, 0, 0, 0, 0, ltkBorderNone, 1, 1, + new LTKBox(NULL, 2, 1, 0, 0, 0, 0, ltkBorderNone, 1, 0, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Text:") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderSunken, 1, 0, + new LTKTextIn("text", 0, 32, "-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*", NULL, NULL) + ) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 1, + new LTKEmpty() + ), + new LTKBox(NULL, 3, 1, 0, 0, 8, 0, ltkBorderNone, 1, 0, + new LTKBox(NULL, 1, 1, 8, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton("find", 1, "Find", ltkButtonClick, &findButtonCbk) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKEmpty() + ), + new LTKBox(NULL, 1, 1, 2, 8, 2, 2, ltkBorderNone, 0, 0, + new LTKButton(NULL, 0, "Close", ltkButtonClick, &findButtonCbk) + ) + ) + ) + ); +} + +LTKWindow *makeAboutWindow(LTKApp *app) { + return new LTKWindow(app, gFalse, "About xpdf", NULL, "close", + new LTKBox(NULL, 1, 2, 0, 0, 0, 0, ltkBorderNone, 0, 0, + new LTKBox(NULL, 1, 11, 2, 2, 2, 2, ltkBorderSunken, 0, 0, + new LTKBox(NULL, 1, 1, 2, 2, 2, 0, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, "-*-times-bold-i-normal-*-24-*-*-*-*-*-*-*", "xpdf") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 12, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Version " xpdfVersion) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 0, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, xpdfCopyright) + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 12, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "derekn@foolabs.com") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Supports PDF version " pdfVersion ".") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 0, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "The PDF data structures, operators, and specification") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 12, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "are copyright 1995 Adobe Systems Inc.") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 0, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Mouse button 1: select text / follow link") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 0, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Mouse button 2: pan window") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 12, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "Mouse button 3: menu") + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 12, ltkBorderNone, 0, 0, + new LTKLabel(NULL, 0, ltkLabelStatic, 8, NULL, "http://www.foolabs.com/xpdf/") + ) + ), + new LTKBox(NULL, 2, 1, 0, 0, 0, 0, ltkBorderNone, 0, 0, + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 1, 0, + new LTKEmpty() + ), + new LTKBox(NULL, 1, 1, 2, 2, 2, 2, ltkBorderNone, 0, 0, + new LTKButton("close", 0, "Close", ltkButtonClick, &closeAboutCbk) + ) + ) + ) + ); +} + diff --git a/pdf/xpdf/xpdf-top.ltk b/pdf/xpdf/xpdf-top.ltk new file mode 100644 index 00000000..4d789f2a --- /dev/null +++ b/pdf/xpdf/xpdf-top.ltk @@ -0,0 +1,252 @@ +#======================================================================== +# +# xpdf.ltk +# +# Copyright 1996 Derek B. Noonburg +# +#======================================================================== + +#------------------------------------------------------------------------ +# main window +#------------------------------------------------------------------------ + +Window(func:makeWindow title:"xpdf" icon:xpdfIcon) { + Box(x:1 y:2 xfill:1 yfill:1) { + + # buttons, page number, etc. + Box(x:14 y:1 xfill:1 top:2) { + Box1() { + IconButton(bitmap:dblLeftArrow_bits w:dblLeftArrow_width + h:dblLeftArrow_height press:&prevTenPageCbk) + } + Box1() { + IconButton(bitmap:leftArrow_bits w:leftArrow_width + h:leftArrow_height press:&prevPageCbk) + } + Box1() { + IconButton(bitmap:rightArrow_bits w:rightArrow_width + h:rightArrow_height press:&nextPageCbk) + } + Box1() { + IconButton(bitmap:dblRightArrow_bits w:dblRightArrow_width + h:dblRightArrow_height press:&nextTenPageCbk) + } + Box1() { + Label(text:"Page" + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1(sunken left:4 right:4) { + TextIn(name:"pageNum" mw:6 done:&pageNumCbk + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1() { + Label(name:"numPages" maxLength length:9 + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1() { + IconButton(bitmap:zoomIn_bits w:zoomIn_width + h:zoomIn_height press:&zoomInCbk) + } + Box1() { + IconButton(bitmap:zoomOut_bits w:zoomOut_width + h:zoomOut_height press:&zoomOutCbk) + } + Box1() { + IconButton(bitmap:find_bits w:find_width + h:find_height press:&findCbk) + } + Box1() { + IconButton(bitmap:postscript_bits w:postscript_width + h:postscript_height press:&postScriptCbk) + } + Box1() { + IconButton(bitmap:about_bits w:about_width h:about_height + press:&aboutCbk) + } + Box1(xfill:1) { + Label(name:"link" fixedWidth + font:"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") + } + Box1() { Button(label:"Quit" press:&quitCbk) } + } + + # canvas and scrollbars + Box(x:2 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1 sunken) { + ScrollingCanvas(name:"canvas" w:100 h:100) + } + Box1(yfill:1) { + Scrollbar(name:"vScrollbar" vert min:0 max:100 move:&scrollVertCbk) + } + Box1(xfill:1) { + Scrollbar(name:"hScrollbar" horiz min:0 max:100 move:&scrollHorizCbk) + } + Box1() { Empty() } + } + } +} + +#------------------------------------------------------------------------ +# menu for main window +#------------------------------------------------------------------------ + +Menu(func:makeMenu title:"xpdf" n:7) { + MenuItem(text:"Open..." shortcut:"O" num:menuOpen + select:&menuCbk) + MenuItem(text:"Save as..." num:menuSavePDF + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Rotate left" num:menuRotateLeft + select:&menuCbk) + MenuItem(text:"Rotate right" num:menuRotateRight + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Quit" shortcut:"Q" num:menuQuit + select:&menuCbk) +} + +#------------------------------------------------------------------------ +# "PostScript output" dialog +#------------------------------------------------------------------------ + +Window(func:makePostScriptDialog dialog:gTrue defWidget:"ok" + title:"xpdf: PostScript output") { + Box(x:1 y:3) { + Box(x:4 y:1) { + Box1() { Label(text:"Pages:") } + Box1(sunken) { + TextIn(name:"firstPage" mw:6 tab:"lastPage" + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1() { Label(text:"to") } + Box1(sunken) { + TextIn(name:"lastPage" mw:6 tab:"fileName" + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + } + Box(x:2 y:1) { + Box1() { Label(text:"File:") } + Box1(sunken xfill:1) { + TextIn(name:"fileName" mw:32 + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + } + Box(x:3 y:1 top:8) { + Box1(left:8) { Button(name:"ok" label:"Ok" press:&psButtonCbk num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&psButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "open" dialog +#------------------------------------------------------------------------ + +Window(func:makeOpenDialog dialog:gTrue defWidget:"open" + title:"xpdf: Open...") { + Box(x:1 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1) { + FileReq(name:"fileReq" select:openSelectCbk + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"open" label:"Open" press:&openButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&openButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "save" dialog +#------------------------------------------------------------------------ + +Window(func:makeSaveDialog dialog:gTrue defWidget:"save" + title:"xpdf: Save as...") { + Box(x:1 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1) { + FileReq(name:"fileReq" select:saveSelectCbk + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"save" label:"Save" press:&saveButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&saveButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "find" window +#------------------------------------------------------------------------ + +Window(func:makeFindWindow defWidget:"find" title:"xpdf: Find") { + Box(x:1 y:3 xfill:1 yfill:1) { + Box(x:2 y:1 xfill:1) { + Box1() { Label(text:"Text:") } + Box1(xfill:1 sunken) { + TextIn(name:"text" mw:32 + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + } + Box1(xfill:1 yfill:1) { Empty() } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"find" label:"Find" press:&findButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Close" press:&findButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "about" window +#------------------------------------------------------------------------ + +Window(func:makeAboutWindow defWidget:"close" title:"About xpdf") { + Box(x:1 y:2) { + Box(x:1 y:11 left:2 right:2 top:2 bottom:2 sunken) { + Box1(bottom:0) { + Label(text:"xpdf" + font:"-*-times-bold-i-normal-*-24-*-*-*-*-*-*-*") + } + Box1(bottom:12) { + Label(text:["Version " xpdfVersion]) + } + Box1(bottom:0) { + Label(text:xpdfCopyright) + } + Box1(bottom:12) { + Label(text:"derekn@foolabs.com") + } + Box1(bottom:2) { + Label(text:["Supports PDF version " pdfVersion "."]) + } + Box1(bottom:0) { + Label(text:"The PDF data structures, operators, and specification") + } + Box1(bottom:12) { + Label(text:"are copyright 1995 Adobe Systems Inc.") + } + Box1(bottom:0) { + Label(text:"Mouse button 1: select text / follow link") + } + Box1(bottom:0) { + Label(text:"Mouse button 2: pan window") + } + Box1(bottom:12) { + Label(text:"Mouse button 3: menu") + } + Box1(bottom:12) { + Label(text:"http://www.foolabs.com/xpdf/") + } + } + Box(x:2 y:1) { + Box1(xfill:1) { Empty() } + Box1() { Button(name:"close" label:"Close" press:&closeAboutCbk) } + } + } +} diff --git a/pdf/xpdf/xpdf.cc b/pdf/xpdf/xpdf.cc new file mode 100644 index 00000000..edd1c758 --- /dev/null +++ b/pdf/xpdf/xpdf.cc @@ -0,0 +1,1736 @@ +//======================================================================== +// +// xpdf.cc +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#include +#include +#include +#include +#include +#include +#include +#include "gtypes.h" +#include "GString.h" +#include "parseargs.h" +#include "gfile.h" +#include "gmem.h" +#include "LTKAll.h" +#include "Object.h" +#include "Stream.h" +#include "Array.h" +#include "Dict.h" +#include "XRef.h" +#include "Catalog.h" +#include "Page.h" +#include "Link.h" +#include "PDFDoc.h" +#include "XOutputDev.h" +#include "LTKOutputDev.h" +#include "PSOutputDev.h" +#include "TextOutputDev.h" +#include "Params.h" +#include "Error.h" +#include "config.h" + +#ifdef XlibSpecificationRelease +#if XlibSpecificationRelease < 5 +typedef char *XPointer; +#endif +#else +typedef char *XPointer; +#endif + +// hack around old X includes which are missing these symbols +#ifndef XK_Page_Up +#define XK_Page_Up 0xFF55 +#endif +#ifndef XK_Page_Down +#define XK_Page_Down 0xFF56 +#endif + +//------------------------------------------------------------------------ +// misc constants / enums +//------------------------------------------------------------------------ + +#define remoteCmdLength 256 + +enum XpdfMenuItem { + menuOpen, + menuSavePDF, + menuRotateLeft, + menuRotateRight, + menuQuit +}; + +//------------------------------------------------------------------------ +// prototypes +//------------------------------------------------------------------------ + +// loadFile / displayPage +static GBool loadFile(GString *fileName); +static void displayPage(int page1, int zoom1, int rotate1); + +// key press and menu callbacks +static void keyPressCbk(LTKWindow *win1, KeySym key, Guint modifiers, + char *s, int n); +static void menuCbk(LTKMenuItem *item); + +// mouse callbacks +static void buttonPressCbk(LTKWidget *canvas1, int n, + int mx, int my, int button, GBool dblClick); +static void buttonReleaseCbk(LTKWidget *canvas1, int n, + int mx, int my, int button, GBool click); +static void doLink(int mx, int my); +static void mouseMoveCbk(LTKWidget *widget, int widgetNum, int mx, int my); +static void mouseDragCbk(LTKWidget *widget, int widgetNum, + int mx, int my, int button); + +// button callbacks +static void nextPageCbk(LTKWidget *button, int n, GBool on); +static void nextTenPageCbk(LTKWidget *button, int n, GBool on); +static void prevPageCbk(LTKWidget *button, int n, GBool on); +static void prevTenPageCbk(LTKWidget *button, int n, GBool on); +static void pageNumCbk(LTKWidget *textIn, int n, GString *text); +static void zoomInCbk(LTKWidget *button, int n, GBool on); +static void zoomOutCbk(LTKWidget *button, int n, GBool on); +static void postScriptCbk(LTKWidget *button, int n, GBool on); +static void aboutCbk(LTKWidget *button, int n, GBool on); +static void quitCbk(LTKWidget *button, int n, GBool on); + +// scrollbar callbacks +static void scrollVertCbk(LTKWidget *scrollbar, int n, int val); +static void scrollHorizCbk(LTKWidget *scrollbar, int n, int val); + +// misc callbacks +static void layoutCbk(LTKWindow *win1); +static void propChangeCbk(LTKWindow *win1, Atom atom); + +// selection +static void setSelection(int newXMin, int newYMin, int newXMax, int newYMax); + +// "Open" dialog +static void mapOpenDialog(); +static void openButtonCbk(LTKWidget *button, int n, GBool on); +static void openSelectCbk(LTKWidget *widget, int n, GString *name); + +// "Save PDF" dialog +static void mapSaveDialog(); +static void saveButtonCbk(LTKWidget *button, int n, GBool on); +static void saveSelectCbk(LTKWidget *widget, int n, GString *name); + +// "PostScript" dialog +static void mapPSDialog(); +static void psButtonCbk(LTKWidget *button, int n, GBool on); + +// "About" window +static void mapAboutWin(); +static void closeAboutCbk(LTKWidget *button, int n, GBool on); + +// "Find" window +static void findCbk(LTKWidget *button, int n, GBool on); +static void mapFindWin(); +static void findButtonCbk(LTKWidget *button, int n, GBool on); +static void doFind(char *s); + +// app kill callback +static void killCbk(LTKWindow *win1); + +//------------------------------------------------------------------------ +// GUI includes +//------------------------------------------------------------------------ + +#include "xpdfIcon.xpm" +#include "leftArrow.xbm" +#include "dblLeftArrow.xbm" +#include "rightArrow.xbm" +#include "dblRightArrow.xbm" +#include "zoomIn.xbm" +#include "zoomOut.xbm" +#include "find.xbm" +#include "postscript.xbm" +#include "about.xbm" +#include "xpdf-ltk.h" + +//------------------------------------------------------------------------ +// command line options +//------------------------------------------------------------------------ + +static XrmOptionDescRec opts[] = { + {"-display", ".display", XrmoptionSepArg, NULL}, + {"-foreground", ".foreground", XrmoptionSepArg, NULL}, + {"-fg", ".foreground", XrmoptionSepArg, NULL}, + {"-background", ".background", XrmoptionSepArg, NULL}, + {"-bg", ".background", XrmoptionSepArg, NULL}, + {"-geometry", ".geometry", XrmoptionSepArg, NULL}, + {"-g", ".geometry", XrmoptionSepArg, NULL}, + {"-font", ".font", XrmoptionSepArg, NULL}, + {"-fn", ".font", XrmoptionSepArg, NULL}, + {"-cmap", ".installCmap", XrmoptionNoArg, (XPointer)"on"}, + {"-rgb", ".rgbCubeSize", XrmoptionSepArg, NULL}, + {"-papercolor", ".paperColor", XrmoptionSepArg, NULL}, + {"-z", ".initialZoom", XrmoptionSepArg, NULL}, + {"-ps", ".psFile", XrmoptionSepArg, NULL}, + {"-paperw", ".psPaperWidth", XrmoptionSepArg, NULL}, + {"-paperh", ".psPaperHeight", XrmoptionSepArg, NULL}, + {"-level1", ".psLevel1", XrmoptionNoArg, (XPointer)"false"}, + {NULL} +}; + +GBool printCommands = gFalse; +static GBool printHelp = gFalse; +static char remoteName[100] = "xpdf_"; +static GBool doRemoteRaise = gFalse; +static GBool doRemoteQuit = gFalse; + +static ArgDesc argDesc[] = { + {"-err", argFlag, &errorsToTTY, 0, + "send error messages to /dev/tty instead of stderr"}, + {"-z", argIntDummy, NULL, 0, + "initial zoom level (-5..5)"}, + {"-g", argStringDummy, NULL, 0, + "initial window geometry"}, + {"-geometry", argStringDummy, NULL, 0, + "initial window geometry"}, + {"-remote", argString, remoteName + 5, sizeof(remoteName) - 5, + "start/contact xpdf remote server with specified name"}, + {"-raise", argFlag, &doRemoteRaise, 0, + "raise xpdf remote server window (with -remote only)"}, + {"-quit", argFlag, &doRemoteQuit, 0, + "kill xpdf remote server (with -remote only)"}, + {"-cmap", argFlagDummy, NULL, 0, + "install a private colormap"}, + {"-rgb", argIntDummy, NULL, 0, + "biggest RGB cube to allocate (default is 5)"}, + {"-papercolor", argStringDummy, NULL, 0, + "color of paper background"}, + {"-ps", argStringDummy, NULL, 0, + "default PostScript file/command name"}, + {"-paperw", argIntDummy, NULL, 0, + "paper width, in points"}, + {"-paperh", argIntDummy, NULL, 0, + "paper height, in points"}, + {"-level1", argFlagDummy, NULL, 0, + "generate Level 1 PostScript"}, + {"-cmd", argFlag, &printCommands, 0, + "print commands as they're executed"}, + {"-h", argFlag, &printHelp, 0, + "print usage information"}, + {"-help", argFlag, &printHelp, 0, + "print usage information"}, + {NULL} +}; + +//------------------------------------------------------------------------ +// global variables +//------------------------------------------------------------------------ + +// zoom factor is 1.2 (similar to DVI magsteps) +#define minZoom -5 +#define maxZoom 5 +static int zoomDPI[maxZoom - minZoom + 1] = { + 29, 35, 42, 50, 60, + 72, + 86, 104, 124, 149, 179 +}; +#define defZoom 1 + +static PDFDoc *doc; + +static LTKOutputDev *out; + +static int page; +static int zoom; +static int rotate; +static GBool quit; + +static LinkAction *linkAction; // mouse pointer is over this link +static int // coordinates of current selection: + selectXMin, selectYMin, // (xMin==xMax || yMin==yMax) means there + selectXMax, selectYMax; // is no selection +static GBool lastDragLeft; // last dragged selection edge was left/right +static GBool lastDragTop; // last dragged selection edge was top/bottom +static int panMX, panMY; // last mouse position for pan + +static GString *defPSFileName; +static GString *psFileName; +static int psFirstPage, psLastPage; + +static GString *fileReqDir; // current directory for file requesters + +static GString *urlCommand; // command to execute for URI links + +static LTKApp *app; +static Display *display; +static LTKWindow *win; +static LTKScrollingCanvas *canvas; +static LTKScrollbar *hScrollbar, *vScrollbar; +static LTKTextIn *pageNumText; +static LTKLabel *numPagesLabel; +static LTKLabel *linkLabel; +static LTKWindow *aboutWin; +static LTKWindow *psDialog; +static LTKWindow *openDialog; +static LTKWindow *saveDialog; +static LTKWindow *findWin; +static Atom remoteAtom; +static GC selectGC; + +//------------------------------------------------------------------------ +// main program +//------------------------------------------------------------------------ + +int main(int argc, char *argv[]) { + Window xwin; + XGCValues gcValues; + char cmd[remoteCmdLength]; + LTKMenu *menu; + GString *name; + GString *title; + unsigned long paperColor; + int pg; + int x, y; + Guint width, height; + GBool ok; + char s[20]; + int ret; + + // initialize + app = NULL; + win = NULL; + out = NULL; + remoteAtom = None; + doc = NULL; + xref = NULL; + psFileName = NULL; + fileReqDir = getCurrentDir(); + ret = 0; + + // parse args + paperWidth = paperHeight = -1; + ok = parseArgs(argDesc, &argc, argv); + + // init error file + errorInit(); + + // read config file + initParams(xpdfConfigFile); + + // create LTKApp (and parse X-related args) + app = new LTKApp("xpdf", opts, &argc, argv); + app->setKillCbk(&killCbk); + display = app->getDisplay(); + + // check command line + if (doRemoteRaise) + ok = ok && remoteName[5] && !doRemoteQuit && argc >= 1 && argc <= 3; + else if (doRemoteQuit) + ok = ok && remoteName[5] && argc == 1; + else + ok = ok && argc >= 1 && argc <= 3; + if (!ok || printHelp) { + fprintf(stderr, "xpdf version %s\n", xpdfVersion); + fprintf(stderr, "%s\n", xpdfCopyright); + printUsage("xpdf", "[ []]", argDesc); + ret = 1; + goto done2; + } + if (argc >= 2) + name = new GString(argv[1]); + else + name = NULL; + if (argc == 3) + pg = atoi(argv[2]); + else + pg = 1; + + // look for already-running remote server + if (remoteName[5]) { + remoteAtom = XInternAtom(display, remoteName, False); + xwin = XGetSelectionOwner(display, remoteAtom); + if (xwin != None) { + if (name) { + sprintf(cmd, "%c %d %.200s", doRemoteRaise ? 'D' : 'd', + pg, name->getCString()); + XChangeProperty(display, xwin, remoteAtom, remoteAtom, 8, + PropModeReplace, (Guchar *)cmd, strlen(cmd) + 1); + delete name; + } else if (doRemoteRaise) { + XChangeProperty(display, xwin, remoteAtom, remoteAtom, 8, + PropModeReplace, (Guchar *)"r", 2); + } else if (doRemoteQuit) { + XChangeProperty(display, xwin, remoteAtom, remoteAtom, 8, + PropModeReplace, (Guchar *)"q", 2); + } + goto done2; + } + if (doRemoteQuit) + goto done2; + } + + // print banner + fprintf(errFile, "xpdf version %s\n", xpdfVersion); + fprintf(errFile, "%s\n", xpdfCopyright); + + // open PDF file + defPSFileName = app->getStringResource("psFile", NULL); + if (name) { + if (!loadFile(name)) { + ret = 1; + goto done1; + } + delete fileReqDir; + fileReqDir = makePathAbsolute(grabPath(name->getCString())); + } + + // check for legal page number + if (doc && (pg < 1 || pg > doc->getNumPages())) + pg = 1; + + // create window + win = makeWindow(app); + menu = makeMenu(); + win->setMenu(menu); + canvas = (LTKScrollingCanvas *)win->findWidget("canvas"); + hScrollbar = (LTKScrollbar *)win->findWidget("hScrollbar"); + vScrollbar = (LTKScrollbar *)win->findWidget("vScrollbar"); + pageNumText = (LTKTextIn *)win->findWidget("pageNum"); + numPagesLabel = (LTKLabel *)win->findWidget("numPages"); + linkLabel = (LTKLabel *)win->findWidget("link"); + win->setKeyCbk(&keyPressCbk); + win->setLayoutCbk(&layoutCbk); + canvas->setButtonPressCbk(&buttonPressCbk); + canvas->setButtonReleaseCbk(&buttonReleaseCbk); + canvas->setMouseMoveCbk(&mouseMoveCbk); + canvas->setMouseDragCbk(&mouseDragCbk); + hScrollbar->setRepeatPeriod(0); + vScrollbar->setRepeatPeriod(0); + + // get X resources + paperWidth = app->getIntResource("psPaperWidth", defPaperWidth); + paperHeight = app->getIntResource("psPaperHeight", defPaperHeight); + psOutLevel1 = app->getBoolResource("psLevel1", gFalse); + urlCommand = app->getStringResource("urlCommand", NULL); + installCmap = app->getBoolResource("installCmap", gFalse); + if (installCmap) + win->setInstallCmap(gTrue); + rgbCubeSize = app->getIntResource("rgbCubeSize", defaultRGBCube); + paperColor = app->getColorResource("paperColor", "white", + WhitePixel(display, app->getScreenNum()), + NULL); + zoom = app->getIntResource("initialZoom", defZoom); + if (zoom < minZoom) + zoom = minZoom; + else if (zoom > maxZoom) + zoom = maxZoom; + + // get geometry + x = -1; + y = -1; + if (!doc) { + width = 612; + height = 792; + } else if (doc->getPageRotate(pg) == 90 || doc->getPageRotate(pg) == 270) { + width = (int)(doc->getPageHeight(pg) + 0.5); + height = (int)(doc->getPageWidth(pg) + 0.5); + } else { + width = (int)(doc->getPageWidth(pg) + 0.5); + height = (int)(doc->getPageHeight(pg) + 0.5); + } + width = (width * zoomDPI[zoom - minZoom]) / 72 + 28; + if (width > (Guint)app->getDisplayWidth() - 100) + width = app->getDisplayWidth() - 100; + height = (height * zoomDPI[zoom - minZoom]) / 72 + 56; + if (height > (Guint)app->getDisplayHeight() - 100) + height = app->getDisplayHeight() - 100; + app->getGeometryResource("geometry", &x, &y, &width, &height); + + // finish setting up window + sprintf(s, "of %d", doc ? doc->getNumPages() : 0); + numPagesLabel->setText(s); + if (name) { + title = new GString("xpdf: "); + title->append(name); + } else { + title = new GString("xpdf"); + } + win->setTitle(title); + win->layout(x, y, width, height); + win->map(); + aboutWin = NULL; + psDialog = NULL; + openDialog = NULL; + saveDialog = NULL; + findWin = NULL; + gcValues.foreground = BlackPixel(display, win->getScreenNum()) ^ + WhitePixel(display, win->getScreenNum()); + gcValues.function = GXxor; + selectGC = XCreateGC(display, win->getXWindow(), + GCForeground | GCFunction, &gcValues); + + // set up remote server + if (remoteAtom != None) { + win->setPropChangeCbk(&propChangeCbk); + xwin = win->getXWindow(); + XSetSelectionOwner(display, remoteAtom, xwin, CurrentTime); + } + + // create output device + out = new LTKOutputDev(win, paperColor); + + // display first page + displayPage(pg, zoom, 0); + + // event loop + quit = gFalse; + do { + app->doEvent(gTrue); + } while (!quit); + + done1: + // release remote control atom + if (remoteAtom != None) + XSetSelectionOwner(display, remoteAtom, None, CurrentTime); + + done2: + // free stuff + if (out) + delete out; + if (win) + delete win; + if (aboutWin) + delete aboutWin; + if (findWin) + delete findWin; + if (app) + delete app; + if (doc) + delete doc; + if (psFileName) + delete psFileName; + if (defPSFileName) + delete defPSFileName; + if (fileReqDir) + delete fileReqDir; + if (urlCommand) + delete urlCommand; + freeParams(); + + // check for memory leaks + Object::memCheck(errFile); + gMemReport(errFile); + + return ret; +} + +//------------------------------------------------------------------------ +// loadFile / displayPage +//------------------------------------------------------------------------ + +static GBool loadFile(GString *fileName) { + GString *title; + PDFDoc *newDoc; + char s[20]; + char *p; + + // busy cursor + if (win) + win->setBusyCursor(gTrue); + + // open PDF file + newDoc = new PDFDoc(fileName); + if (!newDoc->isOk()) { + delete newDoc; + if (win) + win->setBusyCursor(gFalse); + return gFalse; + } + + // replace old document + if (doc) + delete doc; + doc = newDoc; + + // nothing displayed yet + page = -99; + + // init PostScript output params + if (psFileName) + delete psFileName; + if (defPSFileName) { + psFileName = defPSFileName->copy(); + } else { + p = fileName->getCString() + fileName->getLength() - 4; + if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) + psFileName = new GString(fileName->getCString(), + fileName->getLength() - 4); + else + psFileName = fileName->copy(); + psFileName->append(".ps"); + } + psFirstPage = 1; + psLastPage = doc->getNumPages(); + + // set up title, number-of-pages display; back to normal cursor + if (win) { + title = new GString("xpdf: "); + title->append(fileName); + win->setTitle(title); + sprintf(s, "of %d", doc->getNumPages()); + numPagesLabel->setText(s); + win->setBusyCursor(gFalse); + } + + // done + return gTrue; +} + +static void displayPage(int page1, int zoom1, int rotate1) { + char s[20]; + + // check for document + if (!doc) + return; + + // busy cursor + if (win) + win->setBusyCursor(gTrue); + + // new page/zoom/rotate values + page = page1; + zoom = zoom1; + rotate = rotate1; + + // initialize mouse-related stuff + linkAction = NULL; + win->setDefaultCursor(); + linkLabel->setText(NULL); + selectXMin = selectXMax = 0; + selectYMin = selectYMax = 0; + lastDragLeft = lastDragTop = gTrue; + + // draw the page + doc->displayPage(out, page, zoomDPI[zoom - minZoom], rotate, gTrue); + layoutCbk(win); + + // update page number display + sprintf(s, "%d", page); + pageNumText->setText(s); + + // back to regular cursor + win->setBusyCursor(gFalse); +} + +//------------------------------------------------------------------------ +// key press and menu callbacks +//------------------------------------------------------------------------ + +static void keyPressCbk(LTKWindow *win1, KeySym key, Guint modifiers, + char *s, int n) { + if (n > 0) { + switch (s[0]) { + case 'O': + case 'o': + mapOpenDialog(); + break; + case 'F': + case 'f': + mapFindWin(); + break; + case 'N': + case 'n': + nextPageCbk(NULL, 0, gTrue); + break; + case 'P': + case 'p': + prevPageCbk(NULL, 0, gTrue); + break; + case ' ': + if (vScrollbar->getPos() >= + canvas->getRealHeight() - canvas->getHeight()) { + nextPageCbk(NULL, 0, gTrue); + } else { + vScrollbar->setPos(vScrollbar->getPos() + canvas->getHeight(), + canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + } + break; + case '\b': // bs + case '\177': // del + if (vScrollbar->getPos() == 0) { + prevPageCbk(NULL, 0, gTrue); + } else { + vScrollbar->setPos(vScrollbar->getPos() - canvas->getHeight(), + canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + } + break; + case '\014': // ^L + win->redraw(); + displayPage(page, zoom, rotate); + break; + case 'Q': + case 'q': + quitCbk(NULL, 0, gTrue); + break; + } + } else { + switch (key) { + case XK_Home: + hScrollbar->setPos(0, canvas->getWidth()); + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case XK_End: + hScrollbar->setPos(canvas->getRealWidth() - canvas->getWidth(), + canvas->getWidth()); + vScrollbar->setPos(canvas->getRealHeight() - canvas->getHeight(), + canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case XK_Page_Up: + if (vScrollbar->getPos() == 0) { + prevPageCbk(NULL, 0, gTrue); + } else { + vScrollbar->setPos(vScrollbar->getPos() - canvas->getHeight(), + canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + } + break; + case XK_Page_Down: + if (vScrollbar->getPos() >= + canvas->getRealHeight() - canvas->getHeight()) { + nextPageCbk(NULL, 0, gTrue); + } else { + vScrollbar->setPos(vScrollbar->getPos() + canvas->getHeight(), + canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + } + break; + case XK_Left: + hScrollbar->setPos(hScrollbar->getPos() - 16, canvas->getWidth()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case XK_Right: + hScrollbar->setPos(hScrollbar->getPos() + 16, canvas->getWidth()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case XK_Up: + vScrollbar->setPos(vScrollbar->getPos() - 16, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case XK_Down: + vScrollbar->setPos(vScrollbar->getPos() + 16, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + } + } +} + +static void menuCbk(LTKMenuItem *item) { + int r; + + switch (item->getItemNum()) { + case menuOpen: + mapOpenDialog(); + break; + case menuSavePDF: + if (doc) + mapSaveDialog(); + break; + case menuRotateLeft: + if (doc) { + r = (rotate == 0) ? 270 : rotate - 90; + displayPage(page, zoom, r); + } + break; + case menuRotateRight: + if (doc) { + r = (rotate == 270) ? 0 : rotate + 90; + displayPage(page, zoom, r); + } + break; + case menuQuit: + quit = gTrue; + break; + } +} + +//------------------------------------------------------------------------ +// mouse callbacks +//------------------------------------------------------------------------ + +static void buttonPressCbk(LTKWidget *canvas1, int n, + int mx, int my, int button, GBool dblClick) { + if (!doc) + return; + if (button == 1) { + setSelection(mx, my, mx, my); + } else if (button == 2) { + panMX = mx - hScrollbar->getPos(); + panMY = my - vScrollbar->getPos(); + } +} + +static void buttonReleaseCbk(LTKWidget *canvas1, int n, + int mx, int my, int button, GBool click) { + GString *s; + + if (!doc) + return; + + if (button == 1) { + // selection + if (selectXMin < selectXMax && selectYMin < selectYMax) { +#ifndef NO_TEXT_SELECT + if (doc->okToCopy()) { + s = out->getText(selectXMin, selectYMin, selectXMax, selectYMax); + win->setSelection(NULL, s); + } +#endif + + // link + } else { + setSelection(mx, my, mx, my); + doLink(mx, my); + } + } +} + +static void doLink(int mx, int my) { + LinkActionKind kind; + LinkAction *action = NULL; + LinkDest *dest; + GString *namedDest; + char *s; + GString *fileName; + Ref pageRef; + int pg; + double x, y; + int dx, dy; + LTKButtonDialog *dialog; + + // look for a link + out->cvtDevToUser(mx, my, &x, &y); + if ((action = doc->findLink(x, y))) { + switch (kind = action->getKind()) { + + // GoTo / GoToR action + case actionGoTo: + case actionGoToR: + if (kind == actionGoTo) { + dest = NULL; + namedDest = NULL; + if ((dest = ((LinkGoTo *)action)->getDest())) + dest = dest->copy(); + else if ((namedDest = ((LinkGoTo *)action)->getNamedDest())) + namedDest = namedDest->copy(); + } else { + dest = NULL; + namedDest = NULL; + if ((dest = ((LinkGoToR *)action)->getDest())) + dest = dest->copy(); + else if ((namedDest = ((LinkGoToR *)action)->getNamedDest())) + namedDest = namedDest->copy(); + s = ((LinkGoToR *)action)->getFileName()->getCString(); + //~ translate path name for VMS (deal with '/') + if (isAbsolutePath(s)) + fileName = new GString(s); + else + fileName = appendToPath( + grabPath(doc->getFileName()->getCString()), s); + if (!loadFile(fileName)) { + if (dest) + delete dest; + if (namedDest) + delete namedDest; + return; + } + } + if (namedDest) { + dest = doc->findDest(namedDest); + delete namedDest; + } + if (!dest) { + if (kind == actionGoToR) + displayPage(1, zoom, 0); + } else { + if (dest->isPageRef()) { + pageRef = dest->getPageRef(); + pg = doc->findPage(pageRef.num, pageRef.gen); + } else { + pg = dest->getPageNum(); + } + if (pg > 0 && pg != page) + displayPage(pg, zoom, rotate); + else if (pg <= 0) + displayPage(1, zoom, rotate); + switch (dest->getKind()) { + case destXYZ: + out->cvtUserToDev(dest->getLeft(), dest->getTop(), &dx, &dy); + if (dest->getChangeLeft() || dest->getChangeTop()) { + if (dest->getChangeLeft()) + hScrollbar->setPos(dx, canvas->getWidth()); + if (dest->getChangeTop()) + vScrollbar->setPos(dy, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + } + //~ what is the zoom parameter? + break; + case destFit: + case destFitB: + //~ do fit + hScrollbar->setPos(0, canvas->getWidth()); + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case destFitH: + case destFitBH: + //~ do fit + out->cvtUserToDev(0, dest->getTop(), &dx, &dy); + hScrollbar->setPos(0, canvas->getWidth()); + vScrollbar->setPos(dy, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case destFitV: + case destFitBV: + //~ do fit + out->cvtUserToDev(dest->getLeft(), 0, &dx, &dy); + hScrollbar->setPos(dx, canvas->getWidth()); + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + case destFitR: + //~ do fit + out->cvtUserToDev(dest->getLeft(), dest->getTop(), &dx, &dy); + hScrollbar->setPos(dx, canvas->getWidth()); + vScrollbar->setPos(dy, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + break; + } + delete dest; + } + break; + + // Launch action + case actionLaunch: + fileName = ((LinkLaunch *)action)->getFileName(); + s = fileName->getCString(); + if (!strcmp(s + fileName->getLength() - 4, ".pdf") || + !strcmp(s + fileName->getLength() - 4, ".PDF")) { + //~ translate path name for VMS (deal with '/') + if (isAbsolutePath(s)) + fileName = fileName->copy(); + else + fileName = appendToPath( + grabPath(doc->getFileName()->getCString()), s); + if (!loadFile(fileName)) + return; + displayPage(1, zoom, rotate); + } else { + fileName = fileName->copy(); + if (((LinkLaunch *)action)->getParams()) { + fileName->append(' '); + fileName->append(((LinkLaunch *)action)->getParams()); + } +#ifdef VMS + fileName->insert(0, "spawn/nowait "); +#elif defined(__EMX__) + fileName->insert(0, "start /min /n "); +#else + fileName->append(" &"); +#endif + dialog = new LTKButtonDialog(win, "xpdf: Launch", + "Execute the command:", + fileName->getCString(), + NULL, "Ok", "Cancel"); + if (dialog->go()) + system(fileName->getCString()); + delete dialog; + delete fileName; + } + break; + + // URI action + case actionURI: + if (urlCommand) { + for (s = urlCommand->getCString(); *s; ++s) { + if (s[0] == '%' && s[1] == 's') + break; + } + if (s) { + fileName = new GString(urlCommand->getCString(), + s - urlCommand->getCString()); + fileName->append(((LinkURI *)action)->getURI()); + fileName->append(s+2); + } else { + fileName = urlCommand->copy(); + } +#ifdef VMS + fileName->insert(0, "spawn/nowait "); +#elif defined(__EMX__) + fileName->insert(0, "start /min /n "); +#else + fileName->append(" &"); +#endif + system(fileName->getCString()); + delete fileName; + } else { + fprintf(errFile, "URI: %s\n", + ((LinkURI *)action)->getURI()->getCString()); + } + break; + + // unknown action type + case actionUnknown: + error(-1, "Unknown link action type: '%s'", + ((LinkUnknown *)action)->getAction()->getCString()); + break; + } + } +} + +static void mouseMoveCbk(LTKWidget *widget, int widgetNum, int mx, int my) { + double x, y; + LinkAction *action; + char *s; + + if (!doc) + return; + out->cvtDevToUser(mx, my, &x, &y); + if ((action = doc->findLink(x, y))) { + if (action != linkAction) { + if (!linkAction) + win->setCursor(XC_hand2); + linkAction = action; + s = NULL; + switch (linkAction->getKind()) { + case actionGoTo: + s = "[internal link]"; + break; + case actionGoToR: + s = ((LinkGoToR *)linkAction)->getFileName()->getCString(); + break; + case actionLaunch: + s = ((LinkLaunch *)linkAction)->getFileName()->getCString(); + break; + case actionURI: + s = ((LinkURI *)action)->getURI()->getCString(); + break; + case actionUnknown: + s = "[unknown link]"; + break; + } + linkLabel->setText(s); + } + } else { + if (linkAction) { + linkAction = NULL; + win->setDefaultCursor(); + linkLabel->setText(NULL); + } + } +} + +static void mouseDragCbk(LTKWidget *widget, int widgetNum, + int mx, int my, int button) { + int x, y; + int xMin, yMin, xMax, yMax; + + // button 1: select + if (button == 1) { + + // clip mouse coords + x = mx; + if (x < 0) + x = 0; + else if (x >= canvas->getRealWidth()) + x = canvas->getRealWidth() - 1; + y = my; + if (y < 0) + y = 0; + else if (y >= canvas->getRealHeight()) + y = canvas->getRealHeight() - 1; + + // move appropriate edges of selection + if (lastDragLeft) { + if (x < selectXMax) { + xMin = x; + xMax = selectXMax; + } else { + xMin = selectXMax; + xMax = x; + lastDragLeft = gFalse; + } + } else { + if (x > selectXMin) { + xMin = selectXMin; + xMax = x; + } else { + xMin = x; + xMax = selectXMin; + lastDragLeft = gTrue; + } + } + if (lastDragTop) { + if (y < selectYMax) { + yMin = y; + yMax = selectYMax; + } else { + yMin = selectYMax; + yMax = y; + lastDragTop = gFalse; + } + } else { + if (y > selectYMin) { + yMin = selectYMin; + yMax = y; + } else { + yMin = y; + yMax = selectYMin; + lastDragTop = gTrue; + } + } + + // redraw the selection + setSelection(xMin, yMin, xMax, yMax); + + // button 2: pan + } else if (button == 2) { + mx -= hScrollbar->getPos(); + my -= vScrollbar->getPos(); + hScrollbar->setPos(hScrollbar->getPos() - (mx - panMX), + canvas->getWidth()); + vScrollbar->setPos(vScrollbar->getPos() - (my - panMY), + canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + panMX = mx; + panMY = my; + } +} + +//------------------------------------------------------------------------ +// button callbacks +//------------------------------------------------------------------------ + +static void nextPageCbk(LTKWidget *button, int n, GBool on) { + if (!doc) + return; + if (page < doc->getNumPages()) { + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + displayPage(page + 1, zoom, rotate); + } else { + XBell(display, 0); + } +} + +static void nextTenPageCbk(LTKWidget *button, int n, GBool on) { + int pg; + + if (!doc) + return; + if (page < doc->getNumPages()) { + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + if ((pg = page + 10) > doc->getNumPages()) + pg = doc->getNumPages(); + displayPage(pg, zoom, rotate); + } else { + XBell(display, 0); + } +} + +static void prevPageCbk(LTKWidget *button, int n, GBool on) { + if (!doc) + return; + if (page > 1) { + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + displayPage(page - 1, zoom, rotate); + } else { + XBell(display, 0); + } +} + +static void prevTenPageCbk(LTKWidget *button, int n, GBool on) { + int pg; + + if (!doc) + return; + if (page > 1) { + vScrollbar->setPos(0, canvas->getHeight()); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); + if ((pg = page - 10) < 1) + pg = 1; + displayPage(pg, zoom, rotate); + } else { + XBell(display, 0); + } +} + +static void pageNumCbk(LTKWidget *textIn, int n, GString *text) { + int page1; + char s[20]; + + if (!doc) + return; + page1 = atoi(text->getCString()); + if (page1 >= 1 && page1 <= doc->getNumPages()) { + if (page1 != page) + displayPage(page1, zoom, rotate); + } else { + XBell(display, 0); + sprintf(s, "%d", page); + pageNumText->setText(s); + } +} + +static void zoomInCbk(LTKWidget *button, int n, GBool on) { + if (!doc) + return; + if (zoom < maxZoom) + displayPage(page, zoom + 1, rotate); + else + XBell(display, 0); +} + +static void zoomOutCbk(LTKWidget *button, int n, GBool on) { + if (!doc) + return; + if (zoom > minZoom) + displayPage(page, zoom - 1, rotate); + else + XBell(display, 0); +} + +static void postScriptCbk(LTKWidget *button, int n, GBool on) { + if (!doc) + return; + mapPSDialog(); +} + +static void aboutCbk(LTKWidget *button, int n, GBool on) { + mapAboutWin(); +} + +static void quitCbk(LTKWidget *button, int n, GBool on) { + quit = gTrue; +} + +//------------------------------------------------------------------------ +// scrollbar callbacks +//------------------------------------------------------------------------ + +static void scrollVertCbk(LTKWidget *scrollbar, int n, int val) { + canvas->scroll(hScrollbar->getPos(), val); + XSync(display, False); +} + +static void scrollHorizCbk(LTKWidget *scrollbar, int n, int val) { + canvas->scroll(val, vScrollbar->getPos()); + XSync(display, False); +} + +//------------------------------------------------------------------------ +// misc callbacks +//------------------------------------------------------------------------ + +static void layoutCbk(LTKWindow *win1) { + hScrollbar->setLimits(0, canvas->getRealWidth() - 1); + hScrollbar->setPos(hScrollbar->getPos(), canvas->getWidth()); + hScrollbar->setScrollDelta(16); + vScrollbar->setLimits(0, canvas->getRealHeight() - 1); + vScrollbar->setPos(vScrollbar->getPos(), canvas->getHeight()); + vScrollbar->setScrollDelta(16); + canvas->scroll(hScrollbar->getPos(), vScrollbar->getPos()); +} + +static void propChangeCbk(LTKWindow *win1, Atom atom) { + Window xwin; + char *cmd; + Atom type; + int format; + Gulong size, remain; + char *p; + GString *newFileName; + int newPage; + + // get command + xwin = win1->getXWindow(); + if (XGetWindowProperty(display, xwin, remoteAtom, + 0, remoteCmdLength/4, True, remoteAtom, + &type, &format, &size, &remain, + (Guchar **)&cmd) != Success) + return; + if (size == 0) + return; + + // raise window + if (cmd[0] == 'D' || cmd[0] == 'r'){ + win->raise(); + XFlush(display); + } + + // display file / page + if (cmd[0] == 'd' || cmd[0] == 'D') { + p = cmd + 2; + newPage = atoi(p); + if (!(p = strchr(p, ' '))) + return; + newFileName = new GString(p + 1); + XFree((XPointer)cmd); + if (!doc || newFileName->cmp(doc->getFileName())) { + if (!loadFile(newFileName)) + return; + } else { + delete newFileName; + } + if (newPage != page && newPage >= 1 && newPage <= doc->getNumPages()) + displayPage(newPage, zoom, rotate); + + // quit + } else if (cmd[0] == 'q') { + quit = gTrue; + } +} + +//------------------------------------------------------------------------ +// selection +//------------------------------------------------------------------------ + +static void setSelection(int newXMin, int newYMin, int newXMax, int newYMax) { + int x, y, w, h; + GBool needRedraw, needScroll; + GBool moveLeft, moveRight, moveTop, moveBottom; + + // erase old selection on canvas pixmap + needRedraw = gFalse; + if (selectXMin < selectXMax && selectYMin < selectYMax) { + XFillRectangle(canvas->getDisplay(), canvas->getPixmap(), + selectGC, selectXMin, selectYMin, + selectXMax - selectXMin, selectYMax - selectYMin); + needRedraw = gTrue; + } + + // draw new selection on canvas pixmap + if (newXMin < newXMax && newYMin < newYMax) { + XFillRectangle(canvas->getDisplay(), canvas->getPixmap(), + selectGC, newXMin, newYMin, + newXMax - newXMin, newYMax - newYMin); + needRedraw = gTrue; + } + + // check which edges moved + moveLeft = newXMin != selectXMin; + moveTop = newYMin != selectYMin; + moveRight = newXMax != selectXMax; + moveBottom = newYMax != selectYMax; + + // redraw currently visible part of canvas + if (needRedraw) { + if (moveLeft) { + canvas->redrawRect((newXMin < selectXMin) ? newXMin : selectXMin, + (newYMin < selectYMin) ? newYMin : selectYMin, + (newXMin > selectXMin) ? newXMin : selectXMin, + (newYMax > selectYMax) ? newYMax : selectYMax); + } + if (moveRight) { + canvas->redrawRect((newXMax < selectXMax) ? newXMax : selectXMax, + (newYMin < selectYMin) ? newYMin : selectYMin, + (newXMax > selectXMax) ? newXMax : selectXMax, + (newYMax > selectYMax) ? newYMax : selectYMax); + } + if (moveTop) { + canvas->redrawRect((newXMin < selectXMin) ? newXMin : selectXMin, + (newYMin < selectYMin) ? newYMin : selectYMin, + (newXMax > selectXMax) ? newXMax : selectXMax, + (newYMin > selectYMin) ? newYMin : selectYMin); + } + if (moveBottom) { + canvas->redrawRect((newXMin < selectXMin) ? newXMin : selectXMin, + (newYMax < selectYMax) ? newYMax : selectYMax, + (newXMax > selectXMax) ? newXMax : selectXMax, + (newYMax > selectYMax) ? newYMax : selectYMax); + } + } + + // switch to new selection coords + selectXMin = newXMin; + selectXMax = newXMax; + selectYMin = newYMin; + selectYMax = newYMax; + + // scroll canvas if necessary + needScroll = gFalse; + w = canvas->getWidth(); + h = canvas->getHeight(); + x = hScrollbar->getPos(); + y = vScrollbar->getPos(); + if (moveLeft && selectXMin < x) { + x = selectXMin; + needScroll = gTrue; + } else if (moveRight && selectXMax >= x + w) { + x = selectXMax - w; + needScroll = gTrue; + } else if (moveLeft && selectXMin >= x + w) { + x = selectXMin - w; + needScroll = gTrue; + } else if (moveRight && selectXMax < x) { + x = selectXMax; + needScroll = gTrue; + } + if (moveTop && selectYMin < y) { + y = selectYMin; + needScroll = gTrue; + } else if (moveBottom && selectYMax >= y + h) { + y = selectYMax - h; + needScroll = gTrue; + } else if (moveTop && selectYMin >= y + h) { + y = selectYMin - h; + needScroll = gTrue; + } else if (moveBottom && selectYMax < y) { + y = selectYMax; + needScroll = gTrue; + } + if (needScroll) { + hScrollbar->setPos(x, w); + vScrollbar->setPos(y, h); + canvas->scroll(x, y); + } +} + +//------------------------------------------------------------------------ +// "Open" dialog +//------------------------------------------------------------------------ + +static void mapOpenDialog() { + openDialog = makeOpenDialog(app); + ((LTKFileReq *)openDialog->findWidget("fileReq"))->setDir(fileReqDir); + openDialog->layoutDialog(win, -1, -1); + openDialog->map(); +} + +static void openButtonCbk(LTKWidget *button, int n, GBool on) { + LTKFileReq *fileReq; + GString *sel; + + sel = NULL; + if (n == 1) { + fileReq = (LTKFileReq *)openDialog->findWidget("fileReq"); + if ((sel = fileReq->getSelection())) + openSelectCbk(fileReq, 0, sel); + else + XBell(display, 0); + } + if (openDialog) { + if (sel) { + delete fileReqDir; + fileReqDir = ((LTKFileReq *)openDialog->findWidget("fileReq"))->getDir(); + } + delete openDialog; + openDialog = NULL; + } +} + +static void openSelectCbk(LTKWidget *widget, int n, GString *name) { + GString *name1; + + name1 = name->copy(); + if (openDialog) { + delete fileReqDir; + fileReqDir = ((LTKFileReq *)openDialog->findWidget("fileReq"))->getDir(); + delete openDialog; + openDialog = NULL; + } + if (loadFile(name1)) + displayPage(1, zoom, rotate); +} + +//------------------------------------------------------------------------ +// "Save PDF" dialog +//------------------------------------------------------------------------ + +static void mapSaveDialog() { + saveDialog = makeSaveDialog(app); + ((LTKFileReq *)saveDialog->findWidget("fileReq"))->setDir(fileReqDir); + saveDialog->layoutDialog(win, -1, -1); + saveDialog->map(); +} + +static void saveButtonCbk(LTKWidget *button, int n, GBool on) { + LTKFileReq *fileReq; + GString *sel; + + if (!doc) + return; + sel = NULL; + if (n == 1) { + fileReq = (LTKFileReq *)saveDialog->findWidget("fileReq"); + if ((sel = fileReq->getSelection())) + saveSelectCbk(fileReq, 0, sel); + else + XBell(display, 0); + } + if (saveDialog) { + if (sel) { + delete fileReqDir; + fileReqDir = ((LTKFileReq *)saveDialog->findWidget("fileReq"))->getDir(); + } + delete saveDialog; + saveDialog = NULL; + } +} + +static void saveSelectCbk(LTKWidget *widget, int n, GString *name) { + GString *name1; + + name1 = name->copy(); + if (saveDialog) { + delete fileReqDir; + fileReqDir = ((LTKFileReq *)saveDialog->findWidget("fileReq"))->getDir(); + delete saveDialog; + saveDialog = NULL; + } + win->setBusyCursor(gTrue); + doc->saveAs(name1); + delete name1; + win->setBusyCursor(gFalse); +} + +//------------------------------------------------------------------------ +// "PostScript" dialog +//------------------------------------------------------------------------ + +static void mapPSDialog() { + LTKTextIn *widget; + char s[20]; + + psDialog = makePostScriptDialog(app); + sprintf(s, "%d", psFirstPage); + widget = (LTKTextIn *)psDialog->findWidget("firstPage"); + widget->setText(s); + sprintf(s, "%d", psLastPage); + widget = (LTKTextIn *)psDialog->findWidget("lastPage"); + widget->setText(s); + widget = (LTKTextIn *)psDialog->findWidget("fileName"); + widget->setText(psFileName->getCString()); + psDialog->layoutDialog(win, -1, -1); + psDialog->map(); +} + +static void psButtonCbk(LTKWidget *button, int n, GBool on) { + PSOutputDev *psOut; + LTKTextIn *widget; + + if (!doc) + return; + + // "Ok" button + if (n == 1) { + // extract params and close the dialog + widget = (LTKTextIn *)psDialog->findWidget("firstPage"); + psFirstPage = atoi(widget->getText()->getCString()); + if (psFirstPage < 1) + psFirstPage = 1; + widget = (LTKTextIn *)psDialog->findWidget("lastPage"); + psLastPage = atoi(widget->getText()->getCString()); + if (psLastPage < psFirstPage) + psLastPage = psFirstPage; + else if (psLastPage > doc->getNumPages()) + psLastPage = doc->getNumPages(); + widget = (LTKTextIn *)psDialog->findWidget("fileName"); + if (psFileName) + delete psFileName; + psFileName = widget->getText()->copy(); + if (!(psFileName->getChar(0) == '|' || + psFileName->cmp("-") == 0)) + makePathAbsolute(psFileName); + + // do the PostScript output + psDialog->setBusyCursor(gTrue); + win->setBusyCursor(gTrue); + if (doc->okToPrint()) { + psOut = new PSOutputDev(psFileName->getCString(), doc->getCatalog(), + psFirstPage, psLastPage, gTrue, gFalse); + if (psOut->isOk()) { + doc->displayPages(psOut, psFirstPage, psLastPage, + zoomDPI[zoom - minZoom], rotate); + } + delete psOut; + } + + delete psDialog; + win->setBusyCursor(gFalse); + + // "Cancel" button + } else { + delete psDialog; + } +} + +//------------------------------------------------------------------------ +// "About" window +//------------------------------------------------------------------------ + +static void mapAboutWin() { + if (aboutWin) { + aboutWin->raise(); + } else { + aboutWin = makeAboutWindow(app); + aboutWin->layout(-1, -1, -1, -1); + aboutWin->map(); + } +} + +static void closeAboutCbk(LTKWidget *button, int n, GBool on) { + delete aboutWin; + aboutWin = NULL; +} + +//------------------------------------------------------------------------ +// "Find" window +//------------------------------------------------------------------------ + +static void findCbk(LTKWidget *button, int n, GBool on) { + if (!doc) + return; + mapFindWin(); +} + +static void mapFindWin() { + if (findWin) { + findWin->raise(); + } else { + findWin = makeFindWindow(app); + findWin->layout(-1, -1, -1, -1); + findWin->map(); + } +} + +static void findButtonCbk(LTKWidget *button, int n, GBool on) { + LTKTextIn *textIn; + + if (!doc) + return; + if (n == 1) { + textIn = (LTKTextIn *)findWin->findWidget("text"); + doFind(textIn->getText()->getCString()); + } else { + delete findWin; + findWin = NULL; + } +} + +static void doFind(char *s) { + TextOutputDev *textOut; + int xMin, yMin, xMax, yMax; + double xMin1, yMin1, xMax1, yMax1; + int pg; + GBool top; + GString *s1; + + // check for zero-length string + if (!s[0]) { + XBell(display, 0); + return; + } + + // set cursors to watch + win->setBusyCursor(gTrue); + findWin->setBusyCursor(gTrue); + + // search current page starting at current selection or top of page + xMin = yMin = xMax = yMax = 0; + if (selectXMin < selectXMax && selectYMin < selectYMax) { + xMin = selectXMax; + yMin = (selectYMin + selectYMax) / 2; + top = gFalse; + } else { + top = gTrue; + } + if (out->findText(s, top, gTrue, &xMin, &yMin, &xMax, &yMax)) + goto found; + + // search following pages + textOut = new TextOutputDev(NULL, gFalse); + if (!textOut->isOk()) { + delete textOut; + goto done; + } + for (pg = page+1; pg <= doc->getNumPages(); ++pg) { + doc->displayPage(textOut, pg, 72, 0, gFalse); + if (textOut->findText(s, gTrue, gTrue, &xMin1, &yMin1, &xMax1, &yMax1)) + goto foundPage; + } + + // search previous pages + for (pg = 1; pg < page; ++pg) { + doc->displayPage(textOut, pg, 72, 0, gFalse); + if (textOut->findText(s, gTrue, gTrue, &xMin1, &yMin1, &xMax1, &yMax1)) + goto foundPage; + } + delete textOut; + + // search current page ending at current selection + if (selectXMin < selectXMax && selectYMin < selectYMax) { + xMax = selectXMin; + yMax = (selectYMin + selectYMax) / 2; + if (out->findText(s, gTrue, gFalse, &xMin, &yMin, &xMax, &yMax)) + goto found; + } + + // not found + XBell(display, 0); + goto done; + + // found on a different page + foundPage: + delete textOut; + displayPage(pg, zoom, rotate); + if (!out->findText(s, gTrue, gTrue, &xMin, &yMin, &xMax, &yMax)) + goto done; // this can happen if coalescing is bad + + // found: change the selection + found: + setSelection(xMin, yMin, xMax, yMax); +#ifndef NO_TEXT_SELECT + if (doc->okToCopy()) { + s1 = out->getText(selectXMin, selectYMin, selectXMax, selectYMax); + win->setSelection(NULL, s1); + } +#endif + + done: + // reset cursors to normal + win->setBusyCursor(gFalse); + findWin->setBusyCursor(gFalse); +} + +//------------------------------------------------------------------------ +// app kill callback +//------------------------------------------------------------------------ + +static void killCbk(LTKWindow *win1) { + if (win1 == win) { + quit = gTrue; + } else if (win1 == aboutWin) { + delete aboutWin; + aboutWin = NULL; + } else if (win1 == psDialog) { + delete psDialog; + psDialog = NULL; + } else if (win1 == openDialog) { + delete openDialog; + openDialog = NULL; + } else if (win1 == saveDialog) { + delete saveDialog; + saveDialog = NULL; + } else if (win1 == findWin) { + delete findWin; + findWin = NULL; + } +} diff --git a/pdf/xpdf/xpdf.ltk b/pdf/xpdf/xpdf.ltk new file mode 100644 index 00000000..55afc906 --- /dev/null +++ b/pdf/xpdf/xpdf.ltk @@ -0,0 +1,252 @@ +#======================================================================== +# +# xpdf.ltk +# +# Copyright 1996 Derek B. Noonburg +# +#======================================================================== + +#------------------------------------------------------------------------ +# main window +#------------------------------------------------------------------------ + +Window(func:makeWindow title:"xpdf" icon:xpdfIcon) { + Box(x:1 y:2 xfill:1 yfill:1) { + + # canvas and scrollbars + Box(x:2 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1 sunken) { + ScrollingCanvas(name:"canvas" w:100 h:100) + } + Box1(yfill:1) { + Scrollbar(name:"vScrollbar" vert min:0 max:100 move:&scrollVertCbk) + } + Box1(xfill:1) { + Scrollbar(name:"hScrollbar" horiz min:0 max:100 move:&scrollHorizCbk) + } + Box1() { Empty() } + } + + # buttons, page number, etc. + Box(x:14 y:1 xfill:1) { + Box1() { + IconButton(bitmap:dblLeftArrow_bits w:dblLeftArrow_width + h:dblLeftArrow_height press:&prevTenPageCbk) + } + Box1() { + IconButton(bitmap:leftArrow_bits w:leftArrow_width + h:leftArrow_height press:&prevPageCbk) + } + Box1() { + IconButton(bitmap:rightArrow_bits w:rightArrow_width + h:rightArrow_height press:&nextPageCbk) + } + Box1() { + IconButton(bitmap:dblRightArrow_bits w:dblRightArrow_width + h:dblRightArrow_height press:&nextTenPageCbk) + } + Box1() { + Label(text:"Page" + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1(sunken left:4 right:4) { + TextIn(name:"pageNum" mw:6 done:&pageNumCbk + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1() { + Label(name:"numPages" maxLength length:9 + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1() { + IconButton(bitmap:zoomIn_bits w:zoomIn_width + h:zoomIn_height press:&zoomInCbk) + } + Box1() { + IconButton(bitmap:zoomOut_bits w:zoomOut_width + h:zoomOut_height press:&zoomOutCbk) + } + Box1() { + IconButton(bitmap:find_bits w:find_width + h:find_height press:&findCbk) + } + Box1() { + IconButton(bitmap:postscript_bits w:postscript_width + h:postscript_height press:&postScriptCbk) + } + Box1() { + IconButton(bitmap:about_bits w:about_width h:about_height + press:&aboutCbk) + } + Box1(xfill:1) { + Label(name:"link" fixedWidth + font:"-*-helvetica-medium-r-normal-*-12-*-*-*-*-*-*-*") + } + Box1() { Button(label:"Quit" press:&quitCbk) } + } + } +} + +#------------------------------------------------------------------------ +# menu for main window +#------------------------------------------------------------------------ + +Menu(func:makeMenu title:"xpdf" n:7) { + MenuItem(text:"Open..." shortcut:"O" num:menuOpen + select:&menuCbk) + MenuItem(text:"Save as..." num:menuSavePDF + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Rotate left" num:menuRotateLeft + select:&menuCbk) + MenuItem(text:"Rotate right" num:menuRotateRight + select:&menuCbk) + MenuItem(text:NULL) + MenuItem(text:"Quit" shortcut:"Q" num:menuQuit + select:&menuCbk) +} + +#------------------------------------------------------------------------ +# "PostScript output" dialog +#------------------------------------------------------------------------ + +Window(func:makePostScriptDialog dialog:gTrue defWidget:"ok" + title:"xpdf: PostScript output") { + Box(x:1 y:3) { + Box(x:4 y:1) { + Box1() { Label(text:"Pages:") } + Box1(sunken) { + TextIn(name:"firstPage" mw:6 tab:"lastPage" + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box1() { Label(text:"to") } + Box1(sunken) { + TextIn(name:"lastPage" mw:6 tab:"fileName" + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + } + Box(x:2 y:1) { + Box1() { Label(text:"File:") } + Box1(sunken xfill:1) { + TextIn(name:"fileName" mw:32 + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + } + Box(x:3 y:1 top:8) { + Box1(left:8) { Button(name:"ok" label:"Ok" press:&psButtonCbk num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&psButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "open" dialog +#------------------------------------------------------------------------ + +Window(func:makeOpenDialog dialog:gTrue defWidget:"open" + title:"xpdf: Open...") { + Box(x:1 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1) { + FileReq(name:"fileReq" select:openSelectCbk + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"open" label:"Open" press:&openButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&openButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "save" dialog +#------------------------------------------------------------------------ + +Window(func:makeSaveDialog dialog:gTrue defWidget:"save" + title:"xpdf: Save as...") { + Box(x:1 y:2 xfill:1 yfill:1) { + Box1(xfill:1 yfill:1) { + FileReq(name:"fileReq" select:saveSelectCbk + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"save" label:"Save" press:&saveButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Cancel" press:&saveButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "find" window +#------------------------------------------------------------------------ + +Window(func:makeFindWindow defWidget:"find" title:"xpdf: Find") { + Box(x:1 y:3 xfill:1 yfill:1) { + Box(x:2 y:1 xfill:1) { + Box1() { Label(text:"Text:") } + Box1(xfill:1 sunken) { + TextIn(name:"text" mw:32 + font:"-*-courier-medium-r-normal-*-14-*-*-*-*-*-*-*") + } + } + Box1(xfill:1 yfill:1) { Empty() } + Box(x:3 y:1 top:8 xfill:1) { + Box1(left:8) { Button(name:"find" label:"Find" press:&findButtonCbk + num:1) } + Box1(xfill:1) { Empty() } + Box1(right:8) { Button(label:"Close" press:&findButtonCbk num:0) } + } + } +} + +#------------------------------------------------------------------------ +# "about" window +#------------------------------------------------------------------------ + +Window(func:makeAboutWindow defWidget:"close" title:"About xpdf") { + Box(x:1 y:2) { + Box(x:1 y:11 left:2 right:2 top:2 bottom:2 sunken) { + Box1(bottom:0) { + Label(text:"xpdf" + font:"-*-times-bold-i-normal-*-24-*-*-*-*-*-*-*") + } + Box1(bottom:12) { + Label(text:["Version " xpdfVersion]) + } + Box1(bottom:0) { + Label(text:xpdfCopyright) + } + Box1(bottom:12) { + Label(text:"derekn@foolabs.com") + } + Box1(bottom:2) { + Label(text:["Supports PDF version " pdfVersion "."]) + } + Box1(bottom:0) { + Label(text:"The PDF data structures, operators, and specification") + } + Box1(bottom:12) { + Label(text:"are copyright 1995 Adobe Systems Inc.") + } + Box1(bottom:0) { + Label(text:"Mouse button 1: select text / follow link") + } + Box1(bottom:0) { + Label(text:"Mouse button 2: pan window") + } + Box1(bottom:12) { + Label(text:"Mouse button 3: menu") + } + Box1(bottom:12) { + Label(text:"http://www.foolabs.com/xpdf/") + } + } + Box(x:2 y:1) { + Box1(xfill:1) { Empty() } + Box1() { Button(name:"close" label:"Close" press:&closeAboutCbk) } + } + } +} diff --git a/pdf/xpdf/xpdfIcon.xpm b/pdf/xpdf/xpdfIcon.xpm new file mode 100644 index 00000000..6f29c6d8 --- /dev/null +++ b/pdf/xpdf/xpdfIcon.xpm @@ -0,0 +1,58 @@ +/* XPM */ +static char *xpdfIcon[] = { +/* width height num_colors chars_per_pixel */ +" 48 48 3 1", +/* colors */ +". c #000000", +"# c #ffffff", +"o c #e00000", +/* pixels */ +"................................................", +"................................................", +"................................................", +"................................................", +".ooooooo..................................ooo...", +"..ooooooo................................ooo....", +"...ooooooo..............................ooo.....", +"....ooooooo............................ooo......", +".....ooooooo..........................ooo.......", +"......ooooooo...............###......####.......", +".......ooooooo...............##.....##o.##......", +"........ooooooo..............##....##o..##......", +".........ooooooo.............##...o##...........", +"..........ooooooo............##..o.##...........", +"...........ooooooo...........##.ooo##...........", +"............ooooooo..........##ooo.##...........", +".............ooooooo........##ooo.##............", +"..............ooooooo.......##oo..##............", +"..........#....ooooooo......##o...##............", +".........##.####ooooooo####o##...######.........", +"........####...##ooooo##..o###....##............", +".........##.....##ooo##ooooo##....##............", +".........##.....##.oo##ooo..##....##............", +".........##.....##..##ooooo##....##.............", +".........##.....##..##ooooo##....##.............", +".........##.....##..##ooooo##....##.............", +"........##.....##...##ooooo##o...##.............", +"........##.....##..o##..ooo##oo..##.............", +"........###...##..ooo##..o###ooo.##.............", +"........##.####..ooo..####o###oo####............", +"........##......ooo........ooooooo..............", +"........##.....ooo..........ooooooo.............", +"........##....ooo............ooooooo............", +".......##....ooo..............ooooooo...........", +".......##...ooo................ooooooo..........", +".......##..ooo..................ooooooo.........", +".......##.ooo....................ooooooo........", +".......##ooo......................ooooooo.......", +".......##oo........................ooooooo......", +"......####..........................ooooooo.....", +"......ooo............................ooooooo....", +".....ooo..............................ooooooo...", +"....ooo................................ooooooo..", +"...ooo..................................ooooooo.", +"................................................", +"................................................", +"................................................", +"................................................" +}; diff --git a/pdf/xpdf/xpdfconfig.h b/pdf/xpdf/xpdfconfig.h new file mode 100644 index 00000000..5353d03e --- /dev/null +++ b/pdf/xpdf/xpdfconfig.h @@ -0,0 +1,93 @@ +//======================================================================== +// +// config.h +// +// Copyright 1996 Derek B. Noonburg +// +//======================================================================== + +#ifndef CONFIG_H +#define CONFIG_H + +//------------------------------------------------------------------------ +// general constants +//------------------------------------------------------------------------ + +// xpdf version +#define xpdfVersion "0.80" + +// supported PDF version +#define pdfVersion "1.2" +#define pdfVersionNum 1.2 + +// copyright notice +#define xpdfCopyright "Copyright \251 1996-1998 Derek B. Noonburg" + +// default paper size (in points) for PostScript output +#ifdef A4_PAPER +#define defPaperWidth 595 // ISO A4 (210x297 mm) +#define defPaperHeight 842 +#else +#define defPaperWidth 612 // American letter (8.5x11") +#define defPaperHeight 792 +#endif + +// config file name +#if defined(VMS) || defined(__EMX__) +#define xpdfConfigFile "xpdfrc" +#else +#define xpdfConfigFile ".xpdfrc" +#endif + +//------------------------------------------------------------------------ +// X-related constants +//------------------------------------------------------------------------ + +// default maximum size of color cube to allocate +#define defaultRGBCube 5 + +// number of fonts to cache +#define fontCacheSize 16 + +//------------------------------------------------------------------------ +// uncompress program +//------------------------------------------------------------------------ + +#ifdef HAVE_POPEN + +// command to uncompress to stdout +# ifdef USE_GZIP +# define uncompressCmd "gzip -d -c -q" +# else +# ifdef __EMX__ +# define uncompressCmd "compress -d -c" +# else +# define uncompressCmd "uncompress -c" +# endif // __EMX__ +# endif // USE_GZIP + +#else // HAVE_POPEN + +// command to uncompress a file +# ifdef USE_GZIP +# define uncompressCmd "gzip -d -q" +# else +# define uncompressCmd "uncompress" +# endif // USE_GZIP + +#endif // HAVE_POPEN + +//------------------------------------------------------------------------ +// Win32 stuff +//------------------------------------------------------------------------ + +#ifdef WIN32 +#ifdef CDECL +#undef CDECL +#endif +#define CDECL __cdecl +#else +#define CDECL +#endif + +#endif diff --git a/pdf/xpdf/zoomIn.xbm b/pdf/xpdf/zoomIn.xbm new file mode 100644 index 00000000..ef7f3d1a --- /dev/null +++ b/pdf/xpdf/zoomIn.xbm @@ -0,0 +1,6 @@ +#define zoomIn_width 15 +#define zoomIn_height 15 +static unsigned char zoomIn_bits[] = { + 0x80, 0x07, 0x60, 0x18, 0x10, 0x20, 0x10, 0x23, 0x08, 0x43, 0xc8, 0x4f, + 0xc8, 0x4f, 0x08, 0x43, 0x10, 0x23, 0x10, 0x20, 0x78, 0x18, 0x9c, 0x07, + 0x0e, 0x00, 0x07, 0x00, 0x03, 0x00}; diff --git a/pdf/xpdf/zoomOut.xbm b/pdf/xpdf/zoomOut.xbm new file mode 100644 index 00000000..71040f3c --- /dev/null +++ b/pdf/xpdf/zoomOut.xbm @@ -0,0 +1,6 @@ +#define zoomOut_width 15 +#define zoomOut_height 15 +static unsigned char zoomOut_bits[] = { + 0x80, 0x07, 0x60, 0x18, 0x10, 0x20, 0x10, 0x20, 0x08, 0x40, 0xc8, 0x4f, + 0xc8, 0x4f, 0x08, 0x40, 0x10, 0x20, 0x10, 0x20, 0x78, 0x18, 0x9c, 0x07, + 0x0e, 0x00, 0x07, 0x00, 0x03, 0x00}; -- 2.43.5