From 5a6113df5f1807a483e524a031bc665158bf2993 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Thu, 1 Dec 2022 14:16:40 -0600 Subject: [PATCH] feat: add support for the docker image --- Makefile | 9 +++++++++ README.md | 3 ++- bin/patch-monolisa-docker | 27 +++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100755 bin/patch-monolisa-docker diff --git a/Makefile b/Makefile index 46bb771..56c5a20 100644 --- a/Makefile +++ b/Makefile @@ -14,13 +14,22 @@ $(if $(UNKNOWN),$(error unknown font type in ./MonoLisa: $(UNKNOWN))) msg = $(call tprint,{a.bold}==>{a.end} {a.b_magenta}$(1){a.end} {a.bold}<=={a.end}) ## patch | add nerd fonts to MonoLisa +ifdef DOCKER +.PHONY: patch +patch: $(foreach ml-type,$(ML_TYPES),patch-$(ml-type)-docker) +else .PHONY: patch patch: $(addprefix patch-,$(ML_TYPES)) +endif patch-%: ./bin/font-patcher $(call msg, Patching MonoLisa $* Files) @./bin/patch-monolisa $* $(ARGS) +patch-%-docker: ./bin/font-patcher + $(call msg, Patching Monolisa $* Files w/Docker) + @./bin/patch-monolisa-docker $* $(ARGS) + ## update-fonts | move fonts and update fc-cache .PHONY: update-fonts update-fonts: diff --git a/README.md b/README.md index fb4b1cf..4edfc42 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,8 @@ sudo pacman -S fontforge You can also download the version for your system from the releases in the fontforge [repo](https://github.com/fontforge/fontforge). +If you prefer to use `docker` rather than install `fontforge` you can just add `DOCKER=1` to calls to `make patch`. + ## Downloading MonoLisa Once you have acquired MonoLisa, follow the link in your email to download it. @@ -45,7 +47,6 @@ you can easily apply the nerd font patches with `make`. To patch all font types use the default `patch` rule. - ```bash make ``` diff --git a/bin/patch-monolisa-docker b/bin/patch-monolisa-docker new file mode 100755 index 0000000..77898f0 --- /dev/null +++ b/bin/patch-monolisa-docker @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +# set -e +# docker exits with code 1? + +exts=(otf ttf woff woff2) +ext=$1 +shift +fp_args=$@ + +if [[ -z $ext ]]; then + echo "please provide an extension" + exit 1 +fi + +if [[ ! " ${exts[@]} " =~ " ${ext} " ]]; then + echo "$ext is not a valid extension" + echo "Please choose one of the below:" + printf '%s\n' "${exts[@]}" + exit 1 +fi + +echo "Patching all fonts with ext -> $ext" +echo "Using the following arguments for font-patcher $fp_args" + +docker run --rm -v "$(pwd)/MonoLisa/$ext:/in" -v "$(pwd)/patched/$ext:/out" nerdfonts/patcher $fp_args + +exit 0