Sync-to-go: contrib/hdtbl..
[s-roff.git] / contrib / hdtbl / examples / fonts_x.in
blob34429853ad6dbf21f0f6221283651087d6064bcc
1 .ig
2 @ font_x.in
4 Copyright (c) 2014 - 2015 Steffen (Daode) Nurpmeso <sdaoden@users.sf.net>.
6 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
7 written by Joachim Walsdorff <Joachim.Walsdorff@urz.uni-heidelberg.de>.
9 This is free software; you can redistribute it and/or modify it under
10 the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2, or (at your option) any later
12 version.
14 This is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
17 for more details.
19 You should have received a copy of the GNU General Public License
20 along with groff; see the file COPYING.  If not, write to the Free
21 Software Foundation, 51 Franklin St - Fifth Floor, Boston, MA
22 02110-1301, USA.
26 .\"   **    roff glyphs vs. character codes:
27 .\"   ** .fontdump [font1 font2 ...]
28 .\"   **    Print glyphs of font1, font2, ..., versus
29 .\"   **    character code.
30 .\"   **    `all' as fontname prints all fonts in the
31 .\"   **    specified string `fontpath'.
32 .\"   **    without arg: glyphs and codes of active font.
34 .time start
36 .if !d fontpath \
37 .  ds fontpath @FONTDIR@
39 .de fontdump
40 .  ie \\n[.$] \
41 .    ds *args \\$*
42 .  el \
43 .    ds *args \\n[.fn]
45 .  pso sh -c \
46        "echo -n .ds *f\ ; \
47         ls \\*[fontpath]/dev\*[.T] \
48         | tr '[:cntrl:]' ' '"
49 .  \" This dummy line is necessary; the preceding line eats it.
51 .  while !"\\*[*args]"" \{\
52 .    pops *$1 *args
54 .    if "\\*[*$1]"all" \{\
55 .      ds *args \\*[*f] \\*[*args]
56 .      pops *$1 *args
57 .      nr *all 1
58 .    \}
60 .    if \\n[*all] \{\
61 .      if "\\*[*$1]"." \
62 .        nr *all 0
63 .      if !F \\*[*$1] \
64 .        continue
65 .    \}
67 .    t*index "\\*[*f]" \\*[*$1]
69 .    ie (\\n[.y] > 18) \
70 .      if !F \\*[*$1] \{\
71 .        tm \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
72 .        continue
73 .      \}
74 .    el \{\
75 .      if !\\n[t*index] \{\
76 .        tm \\n[.F]:\\n[.c]: Font \\*[*$1] not found.
77 .        continue
78 .      \}
80 .      nr * \\n[.f]
81 .      ft \\*[*$1]
82 .      nr ** \\n[.f]
83 .      ft
85 .      if (\\n[**] == \\n[*]) \
86 .        continue
87 .    \}
89 .    if \\n[t*cptn] \
90 .      bp
92 .    tm listing font `\\*[*$1]'...
94 .    TBL border=.1n bc=red cpd=0 csp=.1n bgc=
95 .      CPTN @L_ROFF@ font \\*[*$1] \
96             .br \
97             val=b ".pso grep internalname \\*[fontpath]/dev\*[.T]/\\*[*$1]"
98 .      TR
99 .        TD
100 .          TBL cols=18 border=.1n bc=red csp=.1n cpd=.2n fgc=red4 bgc=beige \
101                hal=c fsz='1.2 1.7' fst=\\*[*$1]
102 .            nr c# 0-1 1
103 .            nr y# 0 1
104 .            TR fst=HB fgc=blue
105 .              TD
106 .              nr x# 0-1 1
107 .              while (\\n+[x#] < 16) \{\
108 .                d2x \\n[x#]
109 .                  TD
110 .                    nop \&.\\*[hex#]
111 .              \}
112 .              TD
114 .            nr y# -1
115 .            while (\\n+[y#] < 17) \{\
116 .              TR
117 .                TD fgc=blue fst=HB
118 .                d2x \\n[y#]
119 .                  nop \\*[hex#].
120 .                nr x# 0-1 1
121 .                while (\\n+[x#] < 16) \{\
122 .                  TD
123 .                    if c \N'\\n+[c#]' \
124 .                      nop \N'\\n[c#]'
125 .                \}
126 .                TD fgc=blue fst=HB
127 .                d2x \\n[y#]
128 .                  nop \\*[hex#].
129 .            \}
131 .            TR fst=HB fgc=blue
132 .              TD
133 .              nr x# 0-1 1
134 .              while (\\n+[x#] < 16) \{\
135 .                d2x \\n[x#]
136 .                TD
137 .                  nop \&..\\*[hex#]
138 .              \}
139 .              TD
140 .          ETB
141 .    ETB
142 .  \}
145 .fontdump all
147 .time
148 .date
149 .\"   466MHz Celeron CPU, 384MB RAM
150 .\"   WindowsXP/cygwin groff18.1:   107s
151 .\"   WindowsXP/cygwin groff19.2:   390s
152 .\"   Suse Linux 9.3 groff19.2:   66s
153 .\" s-tr-mode