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\"; }"
25 # ibm plex mono = ~ S9 З3 align
26 # droid sans mono = ~ S9 З3
27 # input mono = S9 З3 -Wvla didn't
30 # anonymous pro = life З3
33 # | anonymous pro = ЁЖЗ
34 # source code pro = S9
36 # ubuntu mono = ~ S9 З3
38 # everson mono = З3 life 0 ~
40 <pre style="font-size: ${1}pt;">
46 abcdefghizklmnopqrstwxyz
47 ABCDEFGHIZKLMNOPQRSTWXYZ
48 абвгдеёжзийклмнопрстуфхцчшщэюя
49 АБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЭЮЯ
54 S in S9 59 S9 is like 5
55 3ЗЭэзээз3ЗqgO0o ijklI1| bgqpykvwlliliiijil1
60 curly vs plain braces {} () {}
66 Before [Bef ore, Be for e]
67 higher [gh, h i gher, hi gher]
75 mkfifo [mk f i fo, mk f i fo]
86 automatically effective
89 Box drawing alignment tests: █
91 ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
92 ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
93 ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
94 ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
95 ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
96 ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
97 ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
104 # https://github.com/react-boilerplate/react-boilerplate/issues/1340
105 test -d "$cachedir/fonts" || mkdir
"$cachedir/fonts"
106 filename
="$(basename $1)"
107 cat >"$cachedir/fonts/text.html" <<EOF
108 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
109 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
112 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
113 <title>$filename</title>
114 <style type="text/css">
128 for size
in 6 8 10 12 4 2; do
129 text
$size >>"$cachedir/fonts/text.html"
131 cat >>"$cachedir/fonts/text.html" <<EOF
133 $(fc-scan -f '%{fullname} %{style} %{slant} %{file} %{fontversion} %{capability} %{lang}' "$1" || file "$1")
139 trap 'test -n "$casp" && rm -f "$casp"' 0
141 while getopts c
:m
:t
:fu opt
; do
146 c
) css
="-s $OPTARG";;
148 ?
) die
"usage: $0 [-c css] [-m mime/type] [-t filter] [-f] [path|url]";;
151 shift $
(($OPTIND - 1))
152 test -z "$1" && die
"usage $0: path"
155 if ${force-test ! -e "$1"} && expr >/dev
/null
"$1" : "\(ftp\|https\?\)://"; then
156 if executable_p wget
; then
160 elif executable_p curl
; then
165 die
"no program to fetch remote urls found"
168 md5of
="$cachedir/$(basename "$1")"
169 dl
"$1" "$md5of" ||
test -e "$md5of"
177 ft
=$
(file -L --mime-type -b "$1") || die
"$ft"
181 application
/x-gzip | application
/x-compress
) dc=zcat
;;
182 application
/x-xz
) dc=xzcat
;;
183 application
/x-bzip2
) dc=bzcat
;;
184 *) unset dc || true
;;
187 filt
='"${dc-cat}" "$1" |'
189 if test -z "$type"; then
190 test -z "$mime" && mime
=$
(file -L --mime-type -bz "$1" || die
"$mime")
192 application
/postscript
) type=ps
;;
193 application
/pdf
) type=pdf
;;
194 image
/vnd.djvu
) type=djvu
;;
195 text
/html
) type=html
;;
196 text
/plain
) type=text
;;
197 application
/msword
) type=word
;;
198 application
/vnd.openxmlformats-officedocument.
* \
199 | application
/vnd.ms-powerpoint \
200 | application
/vnd.ms-excel \
201 | application
/vnd.oasis.opendocument.
*) type=uno
;;
202 image
/svg
+xml
) type=svg
;;
203 image
/png | image
/jpeg
) test -n "$dc" && type="image" ||
type="image2";;
204 image
/*) type=image
;;
205 application
/x-dvi
) type=dvi
;;
206 application
/x-font-ttf \
207 | application
/vnd.ms-opentype \
208 | application
/font-sfnt
) type=font
;;
209 *) die
"unhandled file type: '$mime'";;
215 ps
) conv
='ps2pdf - "$casp"';;
216 image2|pdf
) test -z "$dc" && exec llpp
"$@" || conv
='cat >"$casp"';;
218 missing texi2html
"texi2html(http://www.nongnu.org/texi2html/)"
219 missing prince
"PrinceXML(http://www.princexml.com/)"
220 conv
='texi2html - -o - | prince $css - -o "$casp"'
223 missing ddjvu
"ddjvu(http://djvu.sourceforge.net/doc/man/ddjvu.html)"
224 conv
='ddjvu -format=pdf - "$casp"'
227 missing prince
"PrinceXML(http://www.princexml.com/)"
228 conv
='prince $css - -o "$casp"'
231 missing pandoc
"pandoc(http://pandoc.org)"
233 conv
='pandoc -r html - -w epub -o "$casp"'
236 if executable_p unoconv
&& test -z "$dc"; then
238 conv
='unoconv -o "$casp" "$1"'
240 missing antiword
"antiword or unoconv"
241 conv
='antiword -m 8859-1.txt -a a4 - >"$casp"'
245 test -n "$dc" && die
"cannot convert compressed '$mime'"
247 missing unoconv
"unoconv(http://dag.wiee.rs/home-made/unoconv/)"
248 conv
='unoconv -o "$casp" "$1"'
251 if executable_p inkscape
&& test -z "$dc"; then
253 conv
='inkscape -z -A "$casp" "$1"'
255 missing rsvg-convert
"rsvg-convert"
256 conv
='rsvg-convert -f pdf -o "$casp"'
260 if test -z $usemupdf; then
263 mupdf
=$HOME/x
/rcs
/git
/mupdf
/build
/native
/mupdf-gl
264 executable_p
$mupdf || v
=mupdf-gl
&& v
=$mupdf
267 exec $v "$cachedir/fonts/text.html"
270 missing convert
"convert(http://www.imagemagick.org/script/convert.php)"
271 conv
='convert - pdf:"$casp"'
274 test -n "$dc" && die
"cannot convert compressed '$mime'"
276 missing dvipdf
"dvipdf(http://ghostscript.com/)"
277 conv
='dvipdf "$1" "$casp"'
280 missing pandoc
"pandoc(http://pandoc.org/)"
281 conv
='pandoc -t epub - -o "$casp"'
284 *) die
"unhandled filter type: '$type'";;
287 hash=$
(md5sum "$md5of") || die
"$hash"
288 casp
=$cachedir/${hash%% *}$caspsuf
290 { test -n "$force" ||
test ! -e "$casp"; } && eval "$filt" "$conv"
293 exec llpp
-origin $origin "$@" "$casp"