Imported Upstream version 1.22.4
[platform/upstream/groff.git] / contrib / hdtbl / examples / fonts_n.in
1 .ig
2
3 font_n.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_n fonts_n.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_n]: 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_n]: \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
81 .        continue
82 .      \}
83 .    el \{\
84 .      if !\\n[t*index] \{\
85 .        tm \\*[fonts_n]: \\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_n]: 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=12 border=.1n bc=red csp=.1n cpd=.2n fgc=red4 bgc=beige \
110                hal=c fsz='1.2 1.2' fst=\\*[*$1]
111 .            nr c# 0-1 1
112 .            nr y# 0-1 1
113 .            TR fst=HB fgc=blue
114 .              TD
115 .                nr x# 0-1 1
116 .                \" following 4 'PN's instead of 4 while-loops as in
117 .                \" font_x.roff; short and easy to write, but a little
118 .                \" bit slower.
119 .              PN 10 .TD \
120                  \&..\\\\n+[x#]
121 .              TD
122 .
123 .            PN 27 .TR \
124                ".TD fgc=blue fst=HB" \
125                  \\\\n+[y#]. \
126                ".PN 10 .TD \
127                  "".if c \N'\En+[c#]' \
128                    \N'\En[c#]'""" \
129                ".TD fgc=blue fst=HB" \
130                  \\\\n[y#].
131 .
132 .            TR fst=HB fgc=blue 
133 .              TD 
134 .                nr x# 0-1 1
135 .              PN 10 .TD \
136                  \&..\\\\n+[x#]
137 .              TD 
138 .          ETB 
139 .    ETB 
140 .  \}
141 ..
142 .
143 .fontdump all
144 .
145 .\" ====================================================================
146 .\" Editor settings
147 .\" ====================================================================
148 .
149 .\" Local Variables:
150 .\" mode: nroff
151 .\" fill-column: 72
152 .\" End:
153 .\" vim: set filetype=groff textwidth=72: