72e3f2453a52ac2f5bfe1fe429e69badf8d0d04e
[platform/upstream/groff.git] / contrib / hdtbl / examples / fonts_x.in
1 .\"     -*-     mode: nroff     -*-
2 .ig
3
4 font_x.roff
5
6 This file is part of groff, the GNU roff type-setting system.
7
8 Copyright (C) 2005-2014 Free Software Foundation, Inc.
9 written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
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
17 ANY 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 .
26 .
27 .\"     ******************************************************************
28 .\"     **              groff glyphs vs. character codes:               **
29 .\"     **      .fontdump [font1 font2 ...]                             **
30 .\"     **              Print glyphs of font1, font2, ..., versus       **
31 .\"     **              character code.                                 **
32 .\"     **              `all' as fontname prints all fonts in the       **
33 .\"     **              specified string `fontpath'.                    **
34 .\"     **              without arg: glyphs and codes of active font.   **
35 .\"     ******************************************************************
36 .
37 .if !d sopath \
38 .  ds sopath
39 .
40 .so \*[sopath]examples/common.roff
41 .
42 .time start
43 .
44 .if !d fontpath \
45 .  ds fontpath @fontdir@
46 .
47 .de fontdump
48 .  ie \\n[.$] \
49 .    ds *args \\$*
50 .  el \
51 .    ds *args \\n[.fn]
52 .
53 .  pso sh -c \
54        "echo -n .ds *f\ ; \
55         ls \\*[fontpath]/dev\*[.T] \
56         | tr '[:cntrl:]' ' '"
57 .  \"   This dummy line is necessary; the preceding line eats it.
58 .
59 .  while !"\\*[*args]"" \{\
60 .    pops *$1 *args
61 .
62 .    if "\\*[*$1]"all" \{\
63 .      ds *args \\*[*f] \\*[*args]
64 .      pops *$1 *args
65 .      nr *all 1
66 .    \}
67 .
68 .    if \\n[*all] \{\
69 .      if "\\*[*$1]"." \
70 .        nr *all 0
71 .      if !F \\*[*$1] \
72 .        continue
73 .    \}
74 .
75 .    t*index "\\*[*f]" \\*[*$1]
76 .
77 .    ie (\\n[.y] > 18) \
78 .      if !F \\*[*$1] \{\
79 .        tm \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
80 .        continue
81 .      \}
82 .    el \{\
83 .      if !\\n[t*index] \{\
84 .        tm \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
85 .        continue
86 .      \}
87 .
88 .      nr * \\n[.f]
89 .      ft \\*[*$1]
90 .      nr ** \\n[.f]
91 .      ft
92 .
93 .      if (\\n[**] == \\n[*]) \
94 .        continue
95 .    \}
96 .
97 .    if \\n[t*cptn] \
98 .      bp
99 .
100 .    tm listing font `\\*[*$1]'...
101 .
102 .    TBL border=.1n bc=red cpd=0 csp=.1n bgc=
103 .      CPTN groff font \\*[*$1] \
104             .br \
105             val=b ".pso grep -e internalname \\*[fontpath]/dev\*[.T]/\\*[*$1]"
106 .      TR
107 .        TD
108 .          TBL cols=18 border=.1n bc=red csp=.1n cpd=.2n fgc=red4 bgc=beige \
109                hal=c fsz='1.2 1.7' fst=\\*[*$1]
110 .            nr c# 0-1 1
111 .            nr y# 0 1
112 .            TR fst=HB fgc=blue
113 .              TD
114 .              nr x# 0-1 1
115 .              while (\\n+[x#] < 16) \{\
116 .                d2x \\n[x#]
117 .                  TD
118 .                    nop \&.\\*[hex#]
119 .              \}
120 .              TD
121 .
122 .            nr y# -1
123 .            while (\\n+[y#] < 17) \{\
124 .              TR
125 .                TD fgc=blue fst=HB
126 .                d2x \\n[y#]
127 .                  nop \\*[hex#].
128 .                nr x# 0-1 1
129 .                while (\\n+[x#] < 16) \{\
130 .                  TD
131 .                    if c \N'\\n+[c#]' \
132 .                      nop \N'\\n[c#]'
133 .                \}
134 .                TD fgc=blue fst=HB
135 .                d2x \\n[y#]
136 .                  nop \\*[hex#].
137 .            \}
138 .
139 .            TR fst=HB fgc=blue
140 .              TD
141 .              nr x# 0-1 1
142 .              while (\\n+[x#] < 16) \{\
143 .                d2x \\n[x#]
144 .                TD
145 .                  nop \&..\\*[hex#]
146 .              \}
147 .              TD
148 .          ETB
149 .    ETB
150 .  \}
151 ..
152 .
153 .fontdump all
154 .
155 .time
156 .date
157 .
158 .\"     466MHz Celeron CPU, 384MB RAM
159 .\"     WindowsXP/cygwin groff18.1:     107s
160 .\"     WindowsXP/cygwin groff19.2:     390s
161 .\"     Suse Linux 9.3 groff19.2:        66s