From 4aee1f7fccab1d1ec7378d2e4acc830ef457bc74 Mon Sep 17 00:00:00 2001 From: Nikita Ivanov Date: Wed, 27 Jul 2022 18:00:16 +0500 Subject: [PATCH] Add fonts support --- README.md | 1 + doc/ctpv.1 | 3 +++ previews.h | 2 ++ sh/prev/font.sh | 8 ++++++++ 4 files changed, 14 insertions(+) create mode 100644 sh/prev/font.sh diff --git a/README.md b/README.md index 12b88dd..df2dc57 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ For example, you only need either `elinks`, `lynx` or | archive | `atool` | | diff | `colordiff` `delta` `diff-so-fancy` | | directory | `ls` | +| font | `fontimage` | | gpg-encrypted | `gpg` | | html | `elinks` `lynx` `w3m` | | image | `ueberzug` `chafa` | diff --git a/doc/ctpv.1 b/doc/ctpv.1 index 425340f..b078fa9 100644 --- a/doc/ctpv.1 +++ b/doc/ctpv.1 @@ -94,6 +94,9 @@ T} directory T{ ls T} +font T{ +fontimage +T} gpg-encrypted T{ gpg T} diff --git a/previews.h b/previews.h index 84c3811..a280f20 100644 --- a/previews.h +++ b/previews.h @@ -44,6 +44,8 @@ Preview b_previews[] = { PR(NULL, "text", "x-diff", colordiff, PREV_ATTR_NONE), PR(NULL, "text", "x-patch", colordiff, PREV_ATTR_NONE), + PR(NULL, "font", NULL, font, PREV_ATTR_NONE), + PR("tar.gz", NULL, NULL, atool, PREV_ATTR_NONE), PR("tgz", NULL, NULL, atool, PREV_ATTR_NONE), PR("tgz", NULL, NULL, atool, PREV_ATTR_NONE), diff --git a/sh/prev/font.sh b/sh/prev/font.sh new file mode 100644 index 0000000..c9eb6a0 --- /dev/null +++ b/sh/prev/font.sh @@ -0,0 +1,8 @@ +# font: fontimage + +font() { + fontimage -o "$cache_f.png" "$f" && + mv -- "$cache_f.png" "$cache_f" +} + +convert_and_show_image font