mirror of
https://github.com/daylinmorgan/monolisa-nerdfont-patch.git
synced 2025-01-22 08:07:32 -06:00
simplify workflow using make
This commit is contained in:
parent
312b059e67
commit
870329f52a
6 changed files with 92 additions and 14 deletions
38
Makefile
Normal file
38
Makefile
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
ARGS ?= -c
|
||||||
|
OK_TYPES := otf ttf woff woff2
|
||||||
|
NF_SRC := $(shell find src -type f)
|
||||||
|
ML_TYPES := $(shell find MonoLisa -mindepth 1 -type d -printf "%f ")
|
||||||
|
|
||||||
|
UNKNOWN := $(filter-out $(OK_TYPES),$(ML_TYPES))
|
||||||
|
$(if $(UNKNOWN),$(error unknown font type in ./MonoLisa: $(UNKNOWN)))
|
||||||
|
|
||||||
|
.PHONY: patch
|
||||||
|
patch: $(addprefix patch-,$(ML_TYPES))
|
||||||
|
|
||||||
|
patch-%: ./bin/font-patcher
|
||||||
|
@echo "==> Patching MonoLisa $* Files <=="
|
||||||
|
@./bin/patch-monolisa $* $(ARGS)
|
||||||
|
|
||||||
|
.PHONY: update-fonts
|
||||||
|
update-fonts:
|
||||||
|
@echo "==> Adding Fonts To System <=="
|
||||||
|
@./bin/update-fonts
|
||||||
|
@fc-cache -f -v
|
||||||
|
|
||||||
|
.PHONY: check
|
||||||
|
check:
|
||||||
|
@echo "==> Checking System For Fonts <=="
|
||||||
|
@fc-list | grep "MonoLisa"
|
||||||
|
|
||||||
|
.PHONY: update-src
|
||||||
|
update-src:
|
||||||
|
@echo "==> Updating Source File <=="
|
||||||
|
@./bin/update-src
|
||||||
|
|
||||||
|
.PHONY: lint
|
||||||
|
lint:
|
||||||
|
@shfmt -w -s $(shell shfmt -f bin/)
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
@rm -r patched/*
|
52
README.md
52
README.md
|
@ -2,38 +2,72 @@
|
||||||
|
|
||||||
*Most* Batteries inlcuded repo to patch MonoLisa with Nerd Fonts glyphs
|
*Most* Batteries inlcuded repo to patch MonoLisa with Nerd Fonts glyphs
|
||||||
|
|
||||||
|
tested w/ MonoLisa v1.808
|
||||||
|
|
||||||
## Before You Begin
|
## Before You Begin
|
||||||
|
|
||||||
First you will need to install `fontforge`
|
First you will need to install `fontforge`
|
||||||
There are a number of caveats to invoking the `font-patcher` script.
|
There are a number of caveats to invoking the `font-patcher` script.
|
||||||
Some of which are explained by [nerd fonts](https://github.com/ryanoasis/nerd-fonts#font-patcher).
|
Some of which are explained by [nerd fonts](https://github.com/ryanoasis/nerd-fonts#font-patcher).
|
||||||
|
|
||||||
Using `patch-monolisa` assumes you have installed fontforge using your system dependency manager.
|
On Arch:
|
||||||
On ubuntu: `sudo apt-get install fontforge`.
|
|
||||||
|
```bash
|
||||||
|
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).
|
||||||
|
|
||||||
## 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.
|
||||||
Then extract the `.zip` into `MonoLisa/`.
|
Then extract the `.zip` file of the type you've downloaded into `MonoLisa/`.
|
||||||
|
|
||||||
|
The expected directory structure is below.
|
||||||
|
You only need to download the font types you plan to use.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
MonoLisa
|
||||||
|
├── otf
|
||||||
|
├── ttf
|
||||||
|
├── woff
|
||||||
|
└── woff2
|
||||||
|
```
|
||||||
|
|
||||||
## Patching your font
|
## Patching your font
|
||||||
|
|
||||||
Once you have downloaded MonoLisa and `fontforge`
|
Once you have downloaded MonoLisa and `fontforge`
|
||||||
you can easily apply the nerd font patches using the `patch-monolisa` script.
|
you can easily apply the nerd font patches with `make`.
|
||||||
The only required argument is the font file extension you want to patch.
|
|
||||||
All remaining supplied arguments are passed to the `font-patcher` script.
|
To patch all font types use the default `patch` rule.
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./patch-monolisa otf -c -w
|
make
|
||||||
|
```
|
||||||
|
|
||||||
|
By default the complete (`-c`) flag is passed to the font-patcher script to include all icons/symbols.
|
||||||
|
You can change this by specifying the `ARGS` at runtime.
|
||||||
|
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ARGS="-c -w" make patch
|
||||||
```
|
```
|
||||||
|
|
||||||
You can find your patched fonts in the `patched/` directory
|
You can find your patched fonts in the `patched/` directory
|
||||||
|
|
||||||
If like me you want to place your patched fonts in a standard location on your Unix system you can move them to `~/.local/share/fonts/MonoLisa` with the `update-fonts` script.
|
If like me you want to place your patched fonts in a standard location on your Unix system you can move them to `~/.local/share/fonts/MonoLisa` with the `bin/update-fonts` script.
|
||||||
|
|
||||||
|
Or for simplicity you can copy the fonts and update the cache with:
|
||||||
|
```bash
|
||||||
|
make update-fonts
|
||||||
|
```
|
||||||
|
|
||||||
|
You can verify the fonts have been added with `make check`.
|
||||||
|
|
||||||
## Changing the Batteries
|
## Changing the Batteries
|
||||||
|
|
||||||
If I haven't committed to this repo in a while it's likely a good idea to run `update-src` to update the fonts, icons and patcher script.
|
If I haven't committed to this repo in a while it's likely a good idea to run `make update-src` to update the fonts, icons and patcher script from nerd fonts.
|
||||||
|
|
||||||
## Special Thanks
|
## Special Thanks
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
exts=(otf ttf woff woff2)
|
exts=(otf ttf woff woff2)
|
||||||
ext=$1
|
ext=$1
|
||||||
|
@ -22,6 +23,6 @@ echo "Using the following arguments for font-patcher $fp_args"
|
||||||
|
|
||||||
for fontfile in MonoLisa/$ext/*.$ext; do
|
for fontfile in MonoLisa/$ext/*.$ext; do
|
||||||
|
|
||||||
fontforge -script font-patcher $fontfile -o patched/$ext $fp_args
|
fontforge -script ./bin/font-patcher $fontfile --glyphdir ./src/glyphs/ -o ./patched/$ext $fp_args
|
||||||
|
|
||||||
done
|
done
|
|
@ -1,18 +1,23 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
PATCHED_FONTS=./patched
|
PATCHED_FONTS=./patched
|
||||||
INSTALL_DIR=~/.local/share/fonts/MonoLisa
|
INSTALL_DIR=~/.local/share/fonts/MonoLisa
|
||||||
|
|
||||||
|
mkdir -p $INSTALL_DIR
|
||||||
|
|
||||||
for font_dir in $PATCHED_FONTS/*; do
|
for font_dir in $PATCHED_FONTS/*; do
|
||||||
patched_dir="${font_dir##*/}"
|
patched_dir="${font_dir##*/}"
|
||||||
echo ">>> $patched_dir"
|
echo ">>> $patched_dir"
|
||||||
|
|
||||||
if [[ -d "${INSTALL_DIR}/${patched_dir}" ]]; then
|
dest=$INSTALL_DIR/$patched_dir
|
||||||
|
|
||||||
|
if [[ -d ${dest} ]]; then
|
||||||
echo "deleting existing version"
|
echo "deleting existing version"
|
||||||
rm -rf $INSTALL_DIR/$patched_dir
|
rm -rf $dest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dest=$INSTALL_DIR/$patched_dir
|
|
||||||
mkdir $dest && cp -v $font_dir/* $dest
|
mkdir $dest && cp -v $font_dir/* $dest
|
||||||
done
|
done
|
||||||
|
|
|
@ -9,7 +9,7 @@ cd nerd-fonts
|
||||||
git sparse-checkout add src/glyphs
|
git sparse-checkout add src/glyphs
|
||||||
git checkout
|
git checkout
|
||||||
|
|
||||||
cp font-patcher ../font-patcher
|
cp font-patcher ../bin/font-patcher
|
||||||
cp src/glyphs/** ../src/glyphs -r
|
cp src/glyphs/** ../src/glyphs -r
|
||||||
|
|
||||||
echo "don't forget to commit your changes!"
|
echo "don't forget to commit your changes!"
|
Loading…
Reference in a new issue