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]
74 mkfifo [mk f i fo, mk f i fo]
85 automatically effective
88 Box drawing alignment tests: █
90 ╔══╦══╗ ┌──┬──┐ ╭──┬──╮ ╭──┬──╮ ┏━━┳━━┓ ┎┒┏┑ ╷ ╻ ┏┯┓ ┌┰┐ ▊ ╱╲╱╲╳╳╳
91 ║┌─╨─┐║ │╔═╧═╗│ │╒═╪═╕│ │╓─╁─╖│ ┃┌─╂─┐┃ ┗╃╄┙ ╶┼╴╺╋╸┠┼┨ ┝╋┥ ▋ ╲╱╲╱╳╳╳
92 ║│╲ ╱│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╿ │┃ ┍╅╆┓ ╵ ╹ ┗┷┛ └┸┘ ▌ ╱╲╱╲╳╳╳
93 ╠╡ ╳ ╞╣ ├╢ ╟┤ ├┼─┼─┼┤ ├╫─╂─╫┤ ┣┿╾┼╼┿┫ ┕┛┖┚ ┌┄┄┐ ╎ ┏┅┅┓ ┋ ▍ ╲╱╲╱╳╳╳
94 ║│╱ ╲│║ │║ ║│ ││ │ ││ │║ ┃ ║│ ┃│ ╽ │┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▎
95 ║└─╥─┘║ │╚═╤═╝│ │╘═╪═╛│ │╙─╀─╜│ ┃└─╂─┘┃ ░░▒▒▓▓██ ┊ ┆ ╎ ╏ ┇ ┋ ▏
96 ╚══╩══╝ └──┴──┘ ╰──┴──╯ ╰──┴──╯ ┗━━┻━━┛ ▗▄▖▛▀▜ └╌╌┘ ╎ ┗╍╍┛ ┋ ▁▂▃▄▅▆▇█
103 # https://github.com/react-boilerplate/react-boilerplate/issues/1340
104 test -d "$cachedir/fonts" || mkdir
"$cachedir/fonts"
105 cat >"$cachedir/fonts/text.html" <<EOF
106 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
107 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
110 <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
112 <style type="text/css">
126 for size
in 6 8 10 12 4 2; do
127 text
$size >>"$cachedir/fonts/text.html"
129 cat >>"$cachedir/fonts/text.html" <<EOF
131 $(fc-scan -f '%{fullname} %{style} %{slant} %{file} %{fontversion} %{capability} %{lang}' "$1" || file "$1")
137 trap 'test -n "$casp" && rm -f "$casp"' 0
139 while getopts c
:m
:t
:fu opt
; do
144 c
) css
="-s $OPTARG";;
146 ?
) die
"usage: $0 [-c css] [-m mime/type] [-t filter] [-f] [path|url]";;
149 shift $
(($OPTIND - 1))
150 test -z "$1" && die
"usage $0: path"
153 if ${force-test ! -e "$1"} && expr >/dev
/null
"$1" : "\(ftp\|https\?\)://"; then
154 if executable_p wget
; then
158 elif executable_p curl
; then
163 die
"no program to fetch remote urls found"
166 md5of
="$cachedir/$(basename "$1")"
167 dl
"$1" "$md5of" ||
test -e "$md5of"
175 ft
=$
(file -L --mime-type -b "$1") || die
"$ft"
179 application
/x-gzip | application
/x-compress
) dc=zcat
;;
180 application
/x-xz
) dc=xzcat
;;
181 application
/x-bzip2
) dc=bzcat
;;
182 *) unset dc || true
;;
185 filt
='"${dc-cat}" "$1" |'
187 if test -z "$type"; then
188 test -z "$mime" && mime
=$
(file -L --mime-type -bz "$1" || die
"$mime")
190 application
/postscript
) type=ps
;;
191 application
/pdf
) type=pdf
;;
192 image
/vnd.djvu
) type=djvu
;;
193 text
/html
) type=html
;;
194 text
/plain
) type=text
;;
195 application
/msword
) type=word
;;
196 application
/vnd.openxmlformats-officedocument.
* \
197 | application
/vnd.ms-powerpoint \
198 | application
/vnd.ms-excel \
199 | application
/vnd.oasis.opendocument.
*) type=uno
;;
200 image
/svg
+xml
) type=svg
;;
201 image
/png | image
/jpeg
) test -n "$dc" && type="image" ||
type="image2";;
202 image
/*) type=image
;;
203 application
/x-dvi
) type=dvi
;;
204 application
/x-font-ttf \
205 | application
/vnd.ms-opentype \
206 | application
/font-sfnt
) type=font
;;
207 *) die
"unhandled file type: '$mime'";;
213 ps
) conv
='ps2pdf - "$casp"';;
214 image2|pdf
) test -z "$dc" && exec llpp
"$@" || conv
='cat >"$casp"';;
216 missing texi2html
"texi2html(http://www.nongnu.org/texi2html/)"
217 missing prince
"PrinceXML(http://www.princexml.com/)"
218 conv
='texi2html - -o - | prince $css - -o "$casp"'
221 missing ddjvu
"ddjvu(http://djvu.sourceforge.net/doc/man/ddjvu.html)"
222 conv
='ddjvu -format=pdf - "$casp"'
225 missing prince
"PrinceXML(http://www.princexml.com/)"
226 conv
='prince $css - -o "$casp"'
229 missing pandoc
"pandoc(http://pandoc.org)"
231 conv
='pandoc -r html - -w epub -o "$casp"'
234 if executable_p unoconv
&& test -z "$dc"; then
236 conv
='unoconv -o "$casp" "$1"'
238 missing antiword
"antiword or unoconv"
239 conv
='antiword -m 8859-1.txt -a a4 - >"$casp"'
243 test -n "$dc" && die
"cannot convert compressed '$mime'"
245 missing unoconv
"unoconv(http://dag.wiee.rs/home-made/unoconv/)"
246 conv
='unoconv -o "$casp" "$1"'
249 if executable_p inkscape
&& test -z "$dc"; then
251 conv
='inkscape -z -A "$casp" "$1"'
253 missing rsvg-convert
"rsvg-convert"
254 conv
='rsvg-convert -f pdf -o "$casp"'
258 if test -z $usemupdf; then
261 mupdf
=$HOME/x
/rcs
/git
/mupdf
/build
/native
/mupdf-gl
262 executable_p
$mupdf || v
=mupdf-gl
&& v
=$mupdf
265 exec $v "$cachedir/fonts/text.html"
268 missing convert
"convert(http://www.imagemagick.org/script/convert.php)"
269 conv
='convert - pdf:"$casp"'
272 test -n "$dc" && die
"cannot convert compressed '$mime'"
274 missing dvipdf
"dvipdf(http://ghostscript.com/)"
275 conv
='dvipdf "$1" "$casp"'
278 missing pandoc
"pandoc(http://pandoc.org/)"
279 conv
='pandoc -t epub - -o "$casp"'
282 *) die
"unhandled filter type: '$type'";;
285 hash=$
(md5sum "$md5of") || die
"$hash"
286 casp
=$cachedir/${hash%% *}$caspsuf
288 { test -n "$force" ||
test ! -e "$casp"; } && eval "$filt" "$conv"
291 exec llpp
-origin $origin "$@" "$casp"