summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/hz.cpp
diff options
context:
space:
mode:
authorHan The Thanh <hanthethanh@gmail.com>2010-06-05 07:28:22 +0000
committerHan The Thanh <hanthethanh@gmail.com>2010-06-05 07:28:22 +0000
commitfc6e759582a57b0d59398fb5e923157416fc0055 (patch)
tree4bab960903146ab1cc11d0666a9fa5d240f5d6d3 /Build/source/texk/web2c/xetexdir/hz.cpp
parent55524f8b6257bf114c5a49091a82b66225b4646e (diff)
added character protrusion for xetex; changed version string to 0.9997.1
git-svn-id: svn://tug.org/texlive/trunk@18754 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/hz.cpp')
-rw-r--r--Build/source/texk/web2c/xetexdir/hz.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/xetexdir/hz.cpp b/Build/source/texk/web2c/xetexdir/hz.cpp
new file mode 100644
index 00000000000..badbd5a6981
--- /dev/null
+++ b/Build/source/texk/web2c/xetexdir/hz.cpp
@@ -0,0 +1,51 @@
+#include "XeTeX_ext.h"
+
+#include <map>
+#include <iostream>
+#include <assert.h>
+using namespace std;
+
+typedef pair<int, unsigned int> GlyphId;
+typedef map<GlyphId, int> ProtrusionFactor;
+ProtrusionFactor leftProt, rightProt;
+
+extern "C" {
+
+void set_cp_code(int fontNum, unsigned int code, int side, int value)
+{
+ GlyphId id(fontNum, code);
+ switch (side) {
+ case LEFT_SIDE:
+ leftProt[id] = value;
+ break;
+ case RIGHT_SIDE:
+ rightProt[id] = value;
+ break;
+ default:
+ assert(0); // we should not reach here
+ }
+}
+
+int get_cp_code(int fontNum, unsigned int code, int side)
+{
+ GlyphId id(fontNum, code);
+ ProtrusionFactor* container;
+ switch (side) {
+ case LEFT_SIDE:
+ container = &leftProt;
+ break;
+ case RIGHT_SIDE:
+ container = &rightProt;
+ break;
+ default:
+ assert(0); // we should not reach here
+ }
+ ProtrusionFactor::iterator it = container->find(id);
+ if (it == container->end())
+ return 0;
+ return it->second;
+}
+
+}
+
+