summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/xetexdir/hz.cpp
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
committerKarl Berry <karl@freefriends.org>2021-02-25 19:22:25 +0000
commitad547a6b5986815fda458221149728d9d9ab1d87 (patch)
tree16296910eb3eca724371474ea9aea3994dc69614 /Build/source/texk/web2c/xetexdir/hz.cpp
parent947b43de3dd21d58ccc2ffadefc4441ea1c2a813 (diff)
restore Build,TODO from r57911
git-svn-id: svn://tug.org/texlive/trunk@57915 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/hz.cpp')
-rw-r--r--Build/source/texk/web2c/xetexdir/hz.cpp77
1 files changed, 77 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..113a03f7a28
--- /dev/null
+++ b/Build/source/texk/web2c/xetexdir/hz.cpp
@@ -0,0 +1,77 @@
+/****************************************************************************\
+ Part of the XeTeX typesetting system
+ Copyright (c) 2010-2014 by Han The Thanh
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE
+FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
+CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the copyright holders
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Software without prior written
+authorization from the copyright holders.
+\****************************************************************************/
+
+#include <w2c/config.h>
+
+#include "XeTeX_web.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;
+
+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;
+}
+