From 37aaa559afdbc1a199e929de1aa84754dcd44641 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Sat, 11 Jul 2020 08:33:55 +0200 Subject: [PATCH] Fix Cascadia Code 2007.01 problem with font-patcher [why] With the Cascadia Code 2007.01 release the font-patcher process ends with a segfault. The reason is unknown. Probably some internal structure of the ttf file and the patching process leads to triggering a bug in fontforge. [how] Nicola (xbb@github) found out, that rewriting the font file with fontforge is possible. The rewriting process skips some of the font internal properties - one of them is the reason for the crash. So we open and save the Cascadia Code font without doing anything to it, and work with that 'cleaned' font file onwards. Thanks to Nicola for the hint with rewriting. Fixes: #39 Signed-off-by: Fini Jastrow --- .github/workflows/generate-fonts.yml | 3 ++- prepare-font | 14 ++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 prepare-font diff --git a/.github/workflows/generate-fonts.yml b/.github/workflows/generate-fonts.yml index 0974674..5278ba3 100644 --- a/.github/workflows/generate-fonts.yml +++ b/.github/workflows/generate-fonts.yml @@ -15,7 +15,6 @@ jobs: echo Downloading ${CASCADIAVERS} curl -L https://github.com/microsoft/cascadia-code/releases/download/${CASCADIAVERS} -O unzip CascadiaCode*.zip - mv **/CascadiaCodePL.ttf . - name: Install FontForge run: | sudo add-apt-repository ppa:fontforge/fontforge -y -u; @@ -32,6 +31,8 @@ jobs: run: pip install configparser - name: Extract additional powerline glyphs run: fontforge -lang=ff -script extract-extra-glyphs + - name: Prepare Caskadia Code font file + run: fontforge prepare-font --input **/CascadiaCodePL.ttf --output CascadiaCodePL.ttf - name: Build Powerline run: | fontforge -script font-patcher --careful --powerline --custom SomeExtraSymbols.otf \ diff --git a/prepare-font b/prepare-font new file mode 100644 index 0000000..2c8a669 --- /dev/null +++ b/prepare-font @@ -0,0 +1,14 @@ +#!/usr/bin/env python +# coding=utf8 + +import fontforge +from argparse import ArgumentParser + +# Setup and parse the comand-line arguments +parser = ArgumentParser() +parser.add_argument("--input", help="input file name") +parser.add_argument("--output", help="output file name") +args = parser.parse_args() + +# Just open and save the font, to fix some internal structure +fontforge.open(args.input).generate(args.output)