File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Copyright 2018 Source Foundry Authors
4
+ # MIT License
5
+
6
+ # compare fonts with ttx
7
+ ttdiff () {
8
+ if [ " $# " -lt 2 ]
9
+ then
10
+ echo " Usage: ttdiff FONT1.ttf FONT2.ttf [tables ...]"
11
+ return 1
12
+ fi
13
+ first=" $1 "
14
+ if [ ! -f " $first " ]; then
15
+ echo " File $first not found"
16
+ return 1
17
+ fi
18
+ second=" $2 "
19
+ if [ ! -f " $second " ]; then
20
+ echo " File $second not found"
21
+ return 1
22
+ fi
23
+ tables=" "
24
+ for i in ${@: 3}
25
+ do
26
+ if [ ! -z " $i " ]
27
+ then
28
+ table=" -t "
29
+ if [ ${# i} -eq 3 ]; then
30
+ # add trailing space to pad tag to four chars
31
+ table+=" '" $i " '"
32
+ else
33
+ table+=$i
34
+ fi
35
+ tables+=" $table "
36
+ fi
37
+ done
38
+ cmd1=" ttx -q -o - $tables \" $first \" 2>/dev/null"
39
+ cmd2=" ttx -q -o - $tables \" $second \" 2>/dev/null"
40
+ echo $cmd1
41
+ echo $cmd2
42
+ # colorize output if colordiff is installed
43
+ if ` command -v colordiff > /dev/null 2>&1 ` ; then
44
+ diff -u <( eval $cmd1 ) <( eval $cmd2 ) | colordiff | less -R
45
+ else
46
+ diff -u <( eval $cmd1 ) <( eval $cmd2 ) | less -R
47
+ fi
48
+ }
49
+
50
+ ttdiff " $@ "
You can’t perform that action at this time.
0 commit comments