9 cachedir
="${XDG_CACHE_HOME:-$HOME/.cache}/llpp"
10 test -d "$cachedir" || die
"cache directory '$cachedir' does not exist"
16 command -v "$1" >/dev
/null
2>&1
21 eval "$1() { die \"$2 is needed for \$type conversion\"; }"
26 <pre style="font-size: ${1}pt;">
29 test -n "$2" && cat $2 ||
cat <<EOF
34 abcdefghijklmnopqrstwxyz
35 ABCDEFGHIJKLMNOPQRSTWXYZ
36 абвгдеёжзийклмнопрстуфхцчшщэюя
37 АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЭЮЯ
38 инпипнишпнипшнипнпншпнпинпипнпипщнпипипин
45 S in S9 59 S9 is like 5
47 3ЗЭэзээз3ЗqgO0o ijklI1| bgqpykvwlliliiijil1 lLLl
52 curly vs plain braces {} () {}
58 Before [Bef ore, Be for e]
59 higher [gh, h i gher, hi gher]
68 mkfifo [mk f i fo, mk f i fo]
75 Compiling [Co mp iling]
81 buildglyphs.js [buil dg lyphs]
91 automatically effective
92 Ilium is the Latin for Ilion.
95 Box drawing alignment tests: █
97 ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
98 ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
99 ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
100 ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
101 ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
102 ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
103 ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
106 https://mirrors.zju.edu.cn/CTAN/fonts/gofonts/doc/gofonts.pdf (page 2)
108 DIN Legibility Standard
110 The recent German DIN 1450 legibility standard
111 recommends several features for font legibility, including
112 differentiation of letter shapes to reduce confusion. The Go fonts
113 conform to the 1450 standard by carefully differentiating zero from
114 capital O; numeral 1 from capital I (eye) and lowercase l (ell);
115 numeral 5 from capital S; and numeral 8 from capital B. The shapes of
116 bowls of b d p q follow the natural asymmetries of legible Renaissance
117 handwriting, aiding differentiation to reduce confusion. [5]
120 Mistaking S for a 5 (at certain sizes) is more of a problem... but... Ze Germans
122 (https://en.wikipedia.org/wiki/Jabberwocky
123 Idea from the aforementioned gofonts paper)
125 Бе сгладне и честлинните комбурси Það leið að stekju, og slýgir greðlar
126 търляха се и сврецваха във плите; sig snældu og böluðu um slöffruna,
127 съвсем окласни бяха тук щурпите og angurvært sungu sópfiðrungar
128 и отма равапсатваха прасурси. við sífgelt týðmana svíræna.
131 (https://en.wikipedia.org/wiki/Typeface)
133 For the rational mind, type design can be a maddening game
134 of drawing things differently in order to make them appear the
141 # https://github.com/react-boilerplate/react-boilerplate/issues/1340
142 test -d "$cachedir/fonts" || mkdir
"$cachedir/fonts"
143 filename
="$(basename "$1")"
145 cat >"$cachedir/fonts/text.html" <<EOF
146 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
147 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
150 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
151 <title>$filename</title>
152 <style type="text/css">
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";;
185 s
) textfilename
="$OPTARG";;
186 ?
) die
"usage: $0 [-c css] [-m mime/type] [-t filter] [-f] [-s textfile] [path|url]";;
189 shift $
(($OPTIND - 1))
190 test -z "$1" && die
"usage $0: path"
193 if ${force-test ! -e "$1"} && expr >/dev
/null
"$1" : "\(ftp\|https\?\)://"; then
194 if executable_p wget
; then
198 elif executable_p curl
; then
203 die
"no program to fetch remote urls found"
206 md5of
="$cachedir/$(basename "$1")"
207 dl
"$1" "$md5of" ||
test -e "$md5of"
215 ft
=$
(file -L --mime-type -b "$1") || die
"$ft"
219 application
/x-gzip | application
/x-compress
) dc=zcat
;;
220 application
/x-xz
) dc=xzcat
;;
221 application
/x-bzip2
) dc=bzcat
;;
222 *) unset dc || true
;;
225 filt
='"${dc-cat}" "$1" |'
229 application
/postscript
) type=ps
;;
230 application
/pdf
) type=pdf
;;
231 image
/vnd.djvu
) type=djvu
;;
232 text
/html
) type=html
;;
233 text
/plain
) type=text
;;
234 application
/msword
) type=word
;;
235 application
/vnd.openxmlformats-officedocument.
* \
236 | application
/vnd.ms-powerpoint \
237 | application
/vnd.ms-excel \
238 | application
/vnd.oasis.opendocument.
*) type=uno
;;
239 image
/svg
+xml
) type=svg
;;
240 image
/png | image
/jpeg
) test -n "$dc" && type="image" ||
type="image2";;
241 image
/*) type=image
;;
242 application
/x-dvi
) type=dvi
;;
243 application
/x-font-ttf \
244 | application
/vnd.ms-opentype \
245 | application
/font-sfnt
) type=font
;;
251 if test -z "$type"; then
253 mime
=$
(file -L --mime-type -b "$1" || die
"$mime") || \
254 $
(file -L --mime-type -bz "$1" || die
"$mime")
255 typeofmime
"$mime" || die
"unhandled file type: '$mime'"
260 ps
) conv
='ps2pdf - "$casp"';;
261 image2|pdf
) test -z "$dc" && exec llpp
"$@" || conv
='cat >"$casp"';;
263 missing texi2html
"texi2html(http://www.nongnu.org/texi2html/)"
264 missing prince
"PrinceXML(http://www.princexml.com/)"
265 conv
='texi2html - -o - | prince $css - -o "$casp"'
268 missing ddjvu
"ddjvu(http://djvu.sourceforge.net/doc/man/ddjvu.html)"
269 conv
='ddjvu -format=pdf - "$casp"'
272 missing prince
"PrinceXML(http://www.princexml.com/)"
273 conv
='prince $css - -o "$casp"'
276 missing pandoc
"pandoc(http://pandoc.org)"
278 conv
='pandoc -r html - -w epub -o "$casp"'
281 if executable_p unoconv
&& test -z "$dc"; then
283 conv
='unoconv -o "$casp" "$1"'
285 missing antiword
"antiword or unoconv"
286 conv
='antiword -m 8859-1.txt -a a4 - >"$casp"'
290 test -n "$dc" && die
"cannot convert compressed '$mime'"
292 missing unoconv
"unoconv(http://dag.wiee.rs/home-made/unoconv/)"
293 conv
='unoconv -o "$casp" "$1"'
296 if executable_p inkscape
&& test -z "$dc"; then
298 conv
='inkscape -z -A "$casp" "$1"'
300 missing rsvg-convert
"rsvg-convert"
301 conv
='rsvg-convert -f pdf -o "$casp"'
305 if test -z $usemupdf; then
306 v
="llpp -origin $1 -layout-height 0"
308 mupdf
=$HOME/x
/rcs
/git
/mupdf
/build
/native
/mupdf-gl
309 executable_p
$mupdf || v
=mupdf-gl
&& v
=$mupdf
312 maketext
"$1" "$textfilename"
313 exec $v "$cachedir/fonts/text.html"
316 missing convert
"convert(http://www.imagemagick.org/script/convert.php)"
317 conv
='convert - pdf:"$casp"'
320 test -n "$dc" && die
"cannot convert compressed '$mime'"
322 missing dvipdf
"dvipdf(http://ghostscript.com/)"
323 conv
='dvipdf "$1" "$casp"'
326 missing pandoc
"pandoc(http://pandoc.org/)"
327 conv
='pandoc -t epub - -o "$casp"'
330 *) die
"unhandled filter type: '$type'";;
333 hash=$
(md5sum "$md5of") || die
"$hash"
334 casp
=$cachedir/${hash%% *}$caspsuf
336 { test -n "$force" ||
test ! -e "$casp"; } && eval "$filt" "$conv"
339 exec llpp
-origin $origin "$@" "$casp"