summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2023-06-30 03:47:33 -0700
committerHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2023-06-30 03:47:33 -0700
commitfc62e87c7f3c7e14d2a0f22d16074ff2ff17de51 (patch)
tree1f6e3b05d1c356b62a1b0574c276b7eab39a4f02
parenta2e390f8e2348dded6650785c0bba60749903535 (diff)
Added smarter font directory handling
-rw-r--r--README2
-rwxr-xr-xfontd5
2 files changed, 6 insertions, 1 deletions
diff --git a/README b/README
index 3b6e755..d5332b4 100644
--- a/README
+++ b/README
@@ -30,12 +30,14 @@ begin:
examples are in INPUT and INPUT2
------------------------------------=[fontd]=-----------------------------------
+NOTE: When specifiying the font directory, do not leaving a trailing /
Font Display:
prints font in braille characters, useful for limited environments such
as the linux console(although you would need braille support first),
takes as first argument a decimal codepoint (bdf format) and the 2nd a
directory with bdf fonts from which to find the character
------------------------------------=[textd]=-----------------------------------
+NOTE: When specifiying the font directory, do not leaving a trailing /
Text Display:
Takes utf-8 input from stdin and displays it vertically with fonts
specified by the first argument
diff --git a/fontd b/fontd
index d6754d0..aecd636 100755
--- a/fontd
+++ b/fontd
@@ -4,9 +4,12 @@
# display CHAR if found in any bdf fonts in DIR/
# NOTE: CHAR must be in decimal encoding point format of bdf
+#expands ~ and *, it's a bit unsafe
+eval fonts="$2/*bdf"
+
#gets font size, it can take multiple fonts as input so only get the first one
#and assume they're all the same size
-size=$(cat $2/*bdf | grep -m 1 PIXEL_SIZE | awk '{print $2}')
+size=$(cat $fonts | grep -m 1 PIXEL_SIZE | awk '{print $2}')
#get bdf bitmap info from bdf
#fflag ensures only one result even with multiple bdfs, cflag finds the char,