Skip to content

Commit

Permalink
Fix Cascadia Code 2007.01 problem with font-patcher
Browse files Browse the repository at this point in the history
[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: adam7#39

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
  • Loading branch information
Finii committed Jul 11, 2020
1 parent 09f8793 commit 37aaa55
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/generate-fonts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 \
Expand Down
14 changes: 14 additions & 0 deletions prepare-font
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 37aaa55

Please sign in to comment.