diff options
author | Andrew Cady <d@jerkface.net> | 2016-09-12 19:38:59 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2016-09-12 19:38:59 -0400 |
commit | 85c07de1e294a18b7cdd40c4cf8f15636bf9a8fc (patch) | |
tree | f405634ed2992e10d33a1cad385c52bee798fe8a /dot/local/bin/lptext | |
parent | fa7a42874f277551bf0ca096ee77c71ca41e6121 (diff) |
new command: lptext
Diffstat (limited to 'dot/local/bin/lptext')
-rw-r--r-- | dot/local/bin/lptext | 13 |
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 | ||
2 | font=${LP_FONT:-Courier} | ||
3 | |||
4 | # Densities over 400 cause ImageMagick to cut off the top of the first line. | ||
5 | density=400 | ||
6 | |||
7 | # Leading whitespace causes ImageMagick to duplicate the first non-empty line. | ||
8 | skip_leading_empty_lines() | ||
9 | { | ||
10 | perl -pe 'if (/./) {$seen++} elsif (!$seen) {undef $_}' | ||
11 | } | ||
12 | |||
13 | skip_leading_empty_lines | gm convert -font $font -density $density text:- -trim png:- | lp "$@" | ||