summaryrefslogtreecommitdiff
path: root/dot/local/bin/lptext
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2016-09-12 19:38:59 -0400
committerAndrew Cady <d@jerkface.net>2016-09-12 19:38:59 -0400
commit85c07de1e294a18b7cdd40c4cf8f15636bf9a8fc (patch)
treef405634ed2992e10d33a1cad385c52bee798fe8a /dot/local/bin/lptext
parentfa7a42874f277551bf0ca096ee77c71ca41e6121 (diff)
new command: lptext
Diffstat (limited to 'dot/local/bin/lptext')
-rw-r--r--dot/local/bin/lptext13
1 files changed, 13 insertions, 0 deletions
diff --git a/dot/local/bin/lptext b/dot/local/bin/lptext
new file mode 100644
index 0000000..61fa331
--- /dev/null
+++ b/dot/local/bin/lptext
@@ -0,0 +1,13 @@
1#!/bin/sh
2font=${LP_FONT:-Courier}
3
4# Densities over 400 cause ImageMagick to cut off the top of the first line.
5density=400
6
7# Leading whitespace causes ImageMagick to duplicate the first non-empty line.
8skip_leading_empty_lines()
9{
10 perl -pe 'if (/./) {$seen++} elsif (!$seen) {undef $_}'
11}
12
13skip_leading_empty_lines | gm convert -font $font -density $density text:- -trim png:- | lp "$@"