PageRenderTime 122ms CodeModel.GetById 113ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 1ms

/contrib/groff/font/devlj4/generate/special.awk

https://bitbucket.org/freebsd/freebsd-head/
AWK | 82 lines | 72 code | 5 blank | 5 comment | 0 complexity | 0d769c5141e47f64f52b4e32d7e5aa86 MD5 | raw file
 1#! /bin/awk -f
 2
 3# Correct Intellifont-based height metrics for several glyphs in
 4# special font for TrueType CG Times (LaserJet 4000 and later).
 5
 6function scale(num)
 7{
 8  return int(num * em + 0.5)
 9}
10
11BEGIN {
12  FS = "\t"
13  OFS = "\t"
14  em = 26346	# Intellifont (8782 DU/em) and hpftodit(1) multiplier of 3
15
16  ascent["integralcrvmid"] = scale(0.84358)
17  descent["integralcrvmid"] = scale(0.25006)
18  ascent["integralbt"] = scale(0.84358)
19  descent["integralbt"] = scale(0.15164)
20  ascent["lt"] = scale(0.84358)
21  descent["lt"] = scale(0.15164)
22  ascent["parenlefttp"] = scale(0.84358)
23  descent["parenlefttp"] = scale(0.15164)
24  ascent["bracelefttp"] = scale(0.84358)
25  descent["bracelefttp"] = scale(0.15164)
26  ascent["lk"] = scale(0.84358)
27  descent["lk"] = scale(0.15164)
28  ascent["braceleftmid"] = scale(0.84358)
29  descent["braceleftmid"] = scale(0.15164)
30  ascent["lb"] = scale(0.84358)
31  descent["lb"] = scale(0.15164)
32  ascent["parenleftbt"] = scale(0.84358)
33  descent["parenleftbt"] = scale(0.15164)
34  ascent["braceleftbt"] = scale(0.84358)
35  descent["braceleftbt"] = scale(0.15164)
36  ascent["rt"] = scale(0.84358)
37  descent["rt"] = scale(0.15164)
38  ascent["parenrighttp"] = scale(0.84358)
39  descent["parenrighttp"] = scale(0.15164)
40  ascent["bracerighttp"] = scale(0.84358)
41  descent["bracerighttp"] = scale(0.15164)
42  ascent["rk"] = scale(0.84358)
43  descent["rk"] = scale(0.15164)
44  ascent["bracerightmid"] = scale(0.84358)
45  descent["bracerightmid"] = scale(0.15164)
46  ascent["rb"] = scale(0.84358)
47  descent["rb"] = scale(0.15164)
48  ascent["parenrightbt"] = scale(0.84358)
49  descent["parenrightbt"] = scale(0.15164)
50  ascent["bracerightbt"] = scale(0.84358)
51  descent["bracerightbt"] = scale(0.15164)
52  ascent["parenrightex"] = scale(0.84358)
53  descent["parenrightex"] = scale(0.15164)
54  ascent["parenleftex"] = scale(0.84358)
55  descent["parenleftex"] = scale(0.15164)
56  ascent["bv"] = scale(0.84358)
57  descent["bv"] = scale(0.15164)
58  ascent["bracerightex"] = scale(0.84358)
59  descent["bracerightex"] = scale(0.15164)
60  ascent["braceleftex"] = scale(0.84358)
61  descent["braceleftex"] = scale(0.15164)
62  ascent["integralex"] = scale(0.84358)
63  descent["integralex"] = scale(0.15164)
64  ascent["bracketrightex"] = scale(0.84358)
65  descent["bracketrightex"] = scale(0.15164)
66  ascent["bracketleftex"] = scale(0.84358)
67  descent["bracketleftex"] = scale(0.15164)
68  ascent["barex"] = scale(0.84358)
69  descent["barex"] = scale(0.15164)
70}
71{
72  if ($2 != "\"" && ascent[$1]) {
73    n = split($2, temp, ",")
74    $2 = sprintf("%d,%d,%d", temp[1], ascent[$1], descent[$1])
75    # just in case there are additional metrics
76    for (i = 4; i <= n; i++)
77      $2 = $2 "," temp[i]
78  }
79  print $0
80}
81
82# EOF