summaryrefslogtreecommitdiff
path: root/dot/local/bin/lptext
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2017-03-09 15:54:13 -0500
committerAndrew Cady <d@jerkface.net>2017-03-09 15:54:13 -0500
commit84564e32311e47e5385bb2fc1b7146e68182cb73 (patch)
tree5fc417d09e4fd3d9f1add841c053348616569853 /dot/local/bin/lptext
parente147ab5b9d0b7df6a689057b9398b0f486cc43b1 (diff)
lptext: use text2png
Diffstat (limited to 'dot/local/bin/lptext')
-rwxr-xr-x[-rw-r--r--]dot/local/bin/lptext13
1 files changed, 1 insertions, 12 deletions
diff --git a/dot/local/bin/lptext b/dot/local/bin/lptext
index 61fa331..064e98e 100644..100755
--- a/dot/local/bin/lptext
+++ b/dot/local/bin/lptext
@@ -1,13 +1,2 @@
1#!/bin/sh 1#!/bin/sh
2font=${LP_FONT:-Courier} 2text2png | lp "$@"
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 "$@"