9 cachedir
="${XDG_CACHE_HOME:-$HOME/.cache}/llpp"
10 test -d "$cachedir" || die
"cache directory '$cachedir' does not exist"
15 executable_p
() { command -v "$1" >/dev
/null
2>&1; }
19 eval "$1() { die \"$2 is needed for \$type conversion\"; }"
24 <pre style="font-size: ${1}pt;">
27 test -n "$2" && cat $2 ||
cat <<EOF
32 abcdefghijklmnopqrstwxyz
33 ABCDEFGHIJKLMNOPQRSTWXYZ
34 абвгдеёжзийклмнопрстуфхцчшщэюя
35 АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЭЮЯ
36 инпипнишпнипшнипнпншпнпинпипнпипщнпипипин
43 S in S9 59 S9 is like 5
45 3ЗЭэзээз3ЗqgO0o ijklI1| bgqpykvwlliliiijil1 lLLl
51 curly vs plain braces {} () {} →
57 Commutative [Co mm utative]
59 Before [Bef ore, Be for e]
60 higher [gh, h i gher, hi gher]
69 mkfifo [mk f i fo, mk f i fo]
76 Compiling [Co mp iling]
82 buildglyphs.js [buil dg lyphs]
92 Apostolic [A postolic]
97 automatically effective
98 Ilium is the Latin for Ilion.
101 Box drawing alignment tests: █
103 ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
104 ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
105 ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
106 ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
107 ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
108 ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
109 ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
112 https://mirrors.zju.edu.cn/CTAN/fonts/gofonts/doc/gofonts.pdf (page 2)
114 DIN Legibility Standard
116 The recent German DIN 1450 legibility standard
117 recommends several features for font legibility, including
118 differentiation of letter shapes to reduce confusion. The Go fonts
119 conform to the 1450 standard by carefully differentiating zero from
120 capital O; numeral 1 from capital I (eye) and lowercase l (ell);
121 numeral 5 from capital S; and numeral 8 from capital B. The shapes of
122 bowls of b d p q follow the natural asymmetries of legible Renaissance
123 handwriting, aiding differentiation to reduce confusion. [5]
126 Mistaking S for a 5 (at certain sizes) is more of a problem... but... Ze Germans
128 (https://en.wikipedia.org/wiki/Jabberwocky
129 Idea from the aforementioned gofonts paper)
131 Бе сгладне и честлинните комбурси Það leið að stekju, og slýgir greðlar
132 търляха се и сврецваха във плите; sig snældu og böluðu um slöffruna,
133 съвсем окласни бяха тук щурпите og angurvært sungu sópfiðrungar
134 и отма равапсатваха прасурси. við sífgelt týðmana svíræna.
136 (https://en.wikipedia.org/wiki/Typeface)
138 For the rational mind, type design can be a maddening game
139 of drawing things differently in order to make them appear the
146 # https://github.com/react-boilerplate/react-boilerplate/issues/1340
147 test -d "$cachedir/fonts" || mkdir
"$cachedir/fonts"
148 filename
="$(basename "$1")"
150 cat >"$cachedir/fonts/text.html" <<EOF
151 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
152 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
155 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
156 <title>$filename</title>
157 <style type="text/css">
158 @font-face { font-family: moo; src: url('$1'); }
159 pre { font-family: moo; }
165 for size
in 6 8 10 12 4 2; do
166 text
$size $textfilename >>"$cachedir/fonts/text.html"
168 cat >>"$cachedir/fonts/text.html" <<EOF
170 $(fc-scan -f '%{fullname} %{style} %{slant} %{file} %{fontversion} %{capability} %{lang}' "$1" || file "$1")
176 trap 'test -n "$casp" && rm -f "$casp"' 0
178 while getopts s
:c
:m
:t
:fu opt
; do
183 c
) css
="-s $OPTARG";;
184 s
) textfilename
="$OPTARG";;
185 ?
) die
"usage: $0 [-c css] [-m mime/type] [-t filter] [-f] [-s textfile] [path|url]";;
188 shift $
(($OPTIND - 1))
189 test -z "$1" && die
"usage $0: path"
192 if ${force-test ! -e "$1"} && expr >/dev
/null
"$1" : "\(ftp\|https\?\)://"; then
193 if executable_p wget
; then
194 dl
() { wget
-q $1 -O $2; }
195 elif executable_p curl
; then
196 dl
() { curl
-L $1 -o $2; }
198 die
"no program to fetch remote urls found"
201 hashof
="$cachedir/$(basename "$1")"
202 dl
"$1" "$hashof" ||
test -e "$md5of"
204 set -- "$hashof" "$@"
209 test -z "$type" && { ft
=$
(file -L --mime-type -b "$1") || die
"$ft"; }
212 application
/x-gzip | application
/x-compress
) dc=zcat
;;
213 application
/x-xz
) dc=xzcat
;;
214 application
/x-bzip2
) dc=bzcat
;;
215 *) unset dc || true
;;
218 filt
='"${dc-cat}" "$1" |'
222 application
/postscript
) type=ps
;;
223 application
/pdf
) type=pdf
;;
224 image
/vnd.djvu
) type=djvu
;;
225 text
/html
) type=html
;;
226 text
/plain
) type=text
;;
227 application
/msword
) type=word
;;
228 application
/vnd.openxmlformats-officedocument.
* \
229 | application
/vnd.ms-powerpoint \
230 | application
/vnd.ms-excel \
231 | application
/vnd.oasis.opendocument.
*) type=uno
;;
232 image
/svg
+xml
) type=svg
;;
233 image
/png | image
/jpeg
) test -n "$dc" && type="image" ||
type="image2";;
234 image
/*) type=image
;;
235 application
/x-dvi
) type=dvi
;;
236 application
/x-font-ttf \
237 | application
/vnd.ms-opentype \
238 | application
/font-sfnt
) type=font
;;
244 if test -z "$type"; then
246 mime
=$
(file -L --mime-type -b "$1" || die
"$mime") || \
247 $
(file -L --mime-type -bz "$1" || die
"$mime")
248 typeofmime
"$mime" || die
"unhandled file type: '$mime'"
253 ps
) conv
='ps2pdf - "$casp"';;
254 image2|pdf
) test -z "$dc" && exec llpp
"$@" || conv
='cat >"$casp"';;
256 missing texi2html
"texi2html(http://www.nongnu.org/texi2html/)"
257 missing prince
"PrinceXML(http://www.princexml.com/)"
258 conv
='texi2html - -o - | prince $css - -o "$casp"'
261 missing ddjvu
"ddjvu(http://djvu.sourceforge.net/doc/man/ddjvu.html)"
262 conv
='ddjvu -format=pdf - "$casp"'
265 missing prince
"Prince(http://www.princexml.com/)"
266 conv
='prince $css - -o "$casp"'
269 missing pandoc
"pandoc(http://pandoc.org)"
271 conv
='pandoc -r html - -w epub2 -o "$casp"'
274 if executable_p unoconv
&& test -z "$dc"; then
276 conv
='unoconv -o "$casp" "$1"'
278 missing antiword
"antiword or unoconv"
279 conv
='antiword -m 8859-1.txt -a a4 - >"$casp"'
283 test -n "$dc" && die
"cannot convert compressed '$mime'"
285 missing unoconv
"unoconv(http://dag.wiee.rs/home-made/unoconv/)"
286 conv
='unoconv -o "$casp" "$1"'
289 if executable_p inkscape
&& test -z "$dc"; then
291 conv
='inkscape -z -A "$casp" "$1"'
293 missing rsvg-convert
"rsvg-convert"
294 conv
='rsvg-convert -f pdf -o "$casp"'
298 maketext
"$1" "$textfilename"
299 exec llpp
-origin $1 -layout-height 0 "$cachedir/fonts/text.html"
302 missing convert
"convert(http://www.imagemagick.org/script/convert.php)"
303 conv
='convert - pdf:"$casp"'
306 test -n "$dc" && die
"cannot convert compressed '$mime'"
308 missing dvipdf
"dvipdf(http://ghostscript.com/)"
309 conv
='dvipdf "$1" "$casp"'
312 missing pandoc
"pandoc(http://pandoc.org/)"
313 conv
='pandoc -t epub2 - -o "$casp"'
316 *) die
"unhandled filter type: '$type'";;
319 hash=$
(cksum "$hashof") || die
"$hash"
320 casp
=$cachedir/${hash%% *}$caspsuf
322 { test -n "$force" ||
test ! -e "$casp"; } && eval "$filt" "$conv"
325 exec llpp
-origin $origin "$@" "$casp"