Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/CharCodeToUnicode.h
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 22:20:42 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 22:20:42 (GMT)
commit2a393c134fe3fe8eb85bf818cb7ad6ae4396322a (patch)
treeeba8b0dcaba42d799ed8313faee15fb74a5a0cd2 /pdf/xpdf/CharCodeToUnicode.h
parent7aac8dc8533347e21311b15186e0af82f1b22fd6 (diff)
Synched with Xpdf 1.01
Diffstat (limited to 'pdf/xpdf/CharCodeToUnicode.h')
-rw-r--r--pdf/xpdf/CharCodeToUnicode.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/pdf/xpdf/CharCodeToUnicode.h b/pdf/xpdf/CharCodeToUnicode.h
new file mode 100644
index 0000000..06916c8
--- /dev/null
+++ b/pdf/xpdf/CharCodeToUnicode.h
@@ -0,0 +1,88 @@
+//========================================================================
+//
+// CharCodeToUnicode.h
+//
+// Mapping from character codes to Unicode.
+//
+// Copyright 2001-2002 Glyph & Cog, LLC
+//
+//========================================================================
+
+#ifndef CHARCODETOUNICODE_H
+#define CHARCODETOUNICODE_H
+
+#ifdef __GNUC__
+#pragma interface
+#endif
+
+#include "CharTypes.h"
+
+struct CharCodeToUnicodeString;
+
+//------------------------------------------------------------------------
+
+class CharCodeToUnicode {
+public:
+
+ // Create the CID-to-Unicode mapping specified by <collection>.
+ // This reads a .cidToUnicode file from disk. Sets the initial
+ // reference count to 1. Returns NULL on failure.
+ static CharCodeToUnicode *parseCIDToUnicode(GString *collectionA);
+
+ // Create the CharCode-to-Unicode mapping for an 8-bit font.
+ // <toUnicode> is an array of 256 Unicode indexes. Sets the initial
+ // reference count to 1.
+ static CharCodeToUnicode *make8BitToUnicode(Unicode *toUnicode);
+
+ // Parse a ToUnicode CMap for an 8- or 16-bit font.
+ static CharCodeToUnicode *parseCMap(GString *buf, int nBits);
+
+ ~CharCodeToUnicode();
+
+ void incRefCnt();
+ void decRefCnt();
+
+ // Return true if this mapping matches the specified <collectionA>.
+ GBool match(GString *collectionA);
+
+ // Map a CharCode to Unicode.
+ int mapToUnicode(CharCode c, Unicode *u, int size);
+
+private:
+
+ void parseCMap1(int (*getCharFunc)(void *), void *data, int nBits);
+ CharCodeToUnicode(GString *collectionA);
+ CharCodeToUnicode(GString *collectionA, Unicode *mapA,
+ CharCode mapLenA, GBool copyMap,
+ CharCodeToUnicodeString *sMapA, int sMapLenA);
+
+ GString *collection;
+ Unicode *map;
+ CharCode mapLen;
+ CharCodeToUnicodeString *sMap;
+ int sMapLen, sMapSize;
+ int refCnt;
+};
+
+//------------------------------------------------------------------------
+
+#define cidToUnicodeCacheSize 4
+
+class CIDToUnicodeCache {
+public:
+
+ CIDToUnicodeCache();
+ ~CIDToUnicodeCache();
+
+ // Get the CharCodeToUnicode object for <collection>. Increments
+ // its reference count; there will be one reference for the cache
+ // plus one for the caller of this function. Returns NULL on
+ // failure.
+ CharCodeToUnicode *getCIDToUnicode(GString *collection);
+
+private:
+
+ CharCodeToUnicode *cache[cidToUnicodeCacheSize];
+};
+
+#endif