feat: add support for the docker image

This commit is contained in:
Daylin Morgan 2022-12-01 14:16:40 -06:00
parent 36ad6b5009
commit 5a6113df5f
3 changed files with 38 additions and 1 deletions

View file

@ -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}) msg = $(call tprint,{a.bold}==>{a.end} {a.b_magenta}$(1){a.end} {a.bold}<=={a.end})
## patch | add nerd fonts to MonoLisa ## patch | add nerd fonts to MonoLisa
ifdef DOCKER
.PHONY: patch
patch: $(foreach ml-type,$(ML_TYPES),patch-$(ml-type)-docker)
else
.PHONY: patch .PHONY: patch
patch: $(addprefix patch-,$(ML_TYPES)) patch: $(addprefix patch-,$(ML_TYPES))
endif
patch-%: ./bin/font-patcher patch-%: ./bin/font-patcher
$(call msg, Patching MonoLisa $* Files) $(call msg, Patching MonoLisa $* Files)
@./bin/patch-monolisa $* $(ARGS) @./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 ## update-fonts | move fonts and update fc-cache
.PHONY: update-fonts .PHONY: update-fonts
update-fonts: update-fonts:

View file

@ -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). 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 ## Downloading MonoLisa
Once you have acquired MonoLisa, follow the link in your email to download it. 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. To patch all font types use the default `patch` rule.
```bash ```bash
make make
``` ```

27
bin/patch-monolisa-docker Executable file
View file

@ -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