Script to increase the line height of a font
This script shouldn't really exist, and patching fonts in this way isn't really such a good idea. However, Emacs currently doesn't have proper support for adjusting line height, as summarized in this stack overflow question. The only workaround that I have found to work reliably, is to patch the font itself to include the proper spacing. So, here is a script that at least makes the process easy.
The easiest way to run the script is to build a docker image via the
Dockerfile
provided.
# build the image (only required once)
docker build -t font-patcher .
If you are using the examples below as is, make sure to copy your original font into the fonts
directory of this project so the files will be mapped into the container.
docker run --rm -v $(pwd):/home font-patcher \
/usr/bin/python /home/src/main.py \
--factor=1.3 \ # increase the line height by 30%
--input=/home/fonts/Operator\ Mono.otf \ # mounted path to the original font file
--outputDir=/home/fonts/patched # directory to save the new font file
This is really just the repetition of patching a single font file, but since it's so common, here is an example:
for x in $(/bin/ls fonts/OperatorMono); do
docker run --rm -v $(pwd):/home font-patcher \
/usr/bin/python /home/src/main.py \
--factor=1.3 \ # increase the line height by 30%
--input=/home/fonts/OperatorMono/$x \ # mounted path to the original font file
--outputDir=/home/fonts/patched # directory to save the new font file
done
Once your fonts are patched, you can install them on your machine for future use.