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