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 .
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 $(ls fonts/Operator\ Mono); 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/$x \ # mounted path to the original font file
--outputDir=/home/fonts/patched # directory to save the new font file
done