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