Imported Upstream version 1.23.0
[platform/upstream/groff.git] / font / devps / generate / make-zapfdr
1 #! /bin/sh
2 #
3 # make-zapfdr -- script for creating the file zapfdr.ps
4 #
5 # Copyright (C) 2006-2020 Free Software Foundation, Inc.
6 #      Written by Werner Lemberg <wl@gnu.org>
7 #
8 # This file is part of groff.
9 #
10 # groff is free software; you can redistribute it and/or modify it under
11 # the terms of the GNU General Public License as published by the Free
12 # Software Foundation, either version 3 of the License, or
13 # (at your option) any later version.
14 #
15 # groff is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 # FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
18 # for more details.
19 #
20 # You should have received a copy of the GNU General Public License
21 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
23 #
24 # usage:
25 #
26 #   make-zapfdr < ZapfDingbats.afm > zapfdr.ps
27 #
28
29
30 # Write preamble.
31 cat <<END
32 %!PS-Adobe-3.0 Resource-Font
33 %%DocumentNeededResources: font ZapfDingbats
34 %%EndComments
35 %%IncludeResource: font ZapfDingbats
36
37 /ZapfDingbats findfont [-1 0 0 1 0 0] makefont
38
39 dup length 1 add dict begin
40 {
41         exch dup dup /FID ne exch /UniqueID ne and {
42                 exch def
43         } {
44                 pop pop
45         } ifelse
46 } forall
47
48 /FontName /ZapfDingbats-Reverse def
49 END
50
51
52 # Emit reverse metrics.
53 sed '
54   /^StartCharMetrics/ {
55     s|StartCharMetrics \([0-9]*\)|/Metrics \1 dict dup begin|
56     H
57     d
58   }
59
60   /^C / {
61     s|^.*$|&@|
62     s|^.* N \([^ ]*\) ;.*$|&/\1 [|
63     s|^.* B [0-9-]* [0-9-]* \([0-9]*\) [0-9-]* ;.*$|&-\1 |
64     s|^.* B [0-9-]* [0-9-]* -\([0-9]*\) [0-9-]* ;.*$|&\1 |
65     s|^.* WX \([0-9]*\) ;.*$|&-\1] def|
66     s|^.* WX -\([0-9]*\) ;.*$|&\1] def|
67     s|^.*@|     |
68     H
69     d
70   }
71
72   $ {
73     g
74     p
75   }
76
77   d
78 '
79
80
81 # Write postamble.
82 cat <<END
83
84 end def
85
86 /ZapfDingbats-Reverse currentdict end definefont pop
87 END
88
89 # EOF