summaryrefslogtreecommitdiff
path: root/scripts/runcmapshare.sh
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2018-04-04 16:36:21 +0200
committerTor Andersson <tor.andersson@artifex.com>2018-04-25 12:26:32 +0200
commita6d083bb776ecd498e57450ef84c20e39ae604cf (patch)
treea1f4399f011eb2b59e21f0588d322690a6ab14f4 /scripts/runcmapshare.sh
parent84cf672da90dfdaa2dfd2742cc69fa0bad268081 (diff)
downloadmupdf-a6d083bb776ecd498e57450ef84c20e39ae604cf.tar.xz
Add CMap processing scripts, and turn cmapdump into mutool.
A dumping script written in python. A flattening script written in python (for easier editing). A subsetting script written in shell to minimize CMaps by reusing subsets. Use 'mutool cmapdump' to bootstrap or verify cmap dumps.
Diffstat (limited to 'scripts/runcmapshare.sh')
-rw-r--r--scripts/runcmapshare.sh48
1 files changed, 48 insertions, 0 deletions
diff --git a/scripts/runcmapshare.sh b/scripts/runcmapshare.sh
new file mode 100644
index 00000000..7a167c1e
--- /dev/null
+++ b/scripts/runcmapshare.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# This scripts expects a to find the original CMap resources in thirdparty/cmap-resources.
+#
+
+rm -f build/cmaps/*
+mkdir -p build/cmaps
+
+function flatten {
+ for DIR in $(echo thirdparty/cmap-resources/Adobe-*)
+ do
+ if [ -f $DIR/CMap/$1 ]
+ then
+ echo $DIR/CMap/$1
+ python scripts/cmapflatten.py $DIR/CMap/$1 > build/cmaps/$1
+ fi
+ done
+}
+
+flatten GBK-EUC-H
+flatten GBK2K-H
+flatten GBKp-EUC-H
+flatten UniCNS-UCS2-H
+flatten UniCNS-UTF16-H
+flatten UniGB-UCS2-H
+flatten UniGB-UTF16-H
+flatten UniJIS-UCS2-H
+flatten UniJIS-UTF16-H
+flatten UniKS-UCS2-H
+flatten UniKS-UTF16-H
+
+python scripts/cmapshare.py build/cmaps/GBK-X build/cmaps/GB*-H
+python scripts/cmapshare.py build/cmaps/UniCNS-X build/cmaps/UniCNS-*-H
+python scripts/cmapshare.py build/cmaps/UniGB-X build/cmaps/UniGB-*-H
+python scripts/cmapshare.py build/cmaps/UniJIS-X build/cmaps/UniJIS-*-H
+python scripts/cmapshare.py build/cmaps/UniKS-X build/cmaps/UniKS-*-H
+
+for F in build/cmaps/*-X
+do
+ B=$(basename $F)
+ python scripts/cmapclean.py $F > resources/cmaps/$B
+done
+
+for F in build/cmaps/*.shared
+do
+ B=$(basename $F .shared)
+ python scripts/cmapclean.py $F > resources/cmaps/$B
+done