File: build

package info (click to toggle)
fonts-firacode 5.2%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 5,240 kB
  • sloc: sh: 186; python: 111; makefile: 15
file content (90 lines) | stat: -rwxr-xr-x 2,624 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash -e

source venv/bin/activate

# ============================================================================
# VARIABLE FONT ==============================================================

# variable font
firaCodeVF=distr/variable_ttf/FiraCode-VF.ttf

rm -rf $firaCodeVF
fontmake -g FiraCode.glyphs -o variable --output-dir distr/variable_ttf

# fix variable font metadata – very important
gftools fix-vf-meta $firaCodeVF
mv $firaCodeVF.fix $firaCodeVF

# other fixes for metadata and hinting
gftools fix-nonhinting $firaCodeVF $firaCodeVF
gftools fix-gasp --autofix $firaCodeVF
mv $firaCodeVF.fix $firaCodeVF

debian/script/gftools-fix-dsig.py --autofix $firaCodeVF

# cleanup of temp files
rm -rf distr/variable_ttf/*-gasp*

# TODO (late 2019?): use TTFautohint-VF for variable font (current support is minimal)

# ============================================================================
# STATIC FONTS ===============================================================

rm -rf distr/ttf
fontmake -g FiraCode.glyphs -o ttf --output-dir distr/ttf -i

rm -rf distr/otf
fontmake -g FiraCode.glyphs -o otf --output-dir distr/otf -i

# -------------------------------------------------------------
# Autohinting -------------------------------------------------

statics=$(ls distr/ttf/*.ttf)
for file in $statics; do 
    echo "fix DSIG in " ${file}
    debian/script/gftools-fix-dsig.py --autofix ${file}

    echo "TTFautohint " ${file}
    # autohint with detailed info
    hintedFile=${file/".ttf"/"-hinted.ttf"}
    ttfautohint -I ${file} ${hintedFile} --stem-width-mode nnn --composites --windows-compatibility
    cp ${hintedFile} ${file}
    rm -rf ${hintedFile}
done


# ============================================================================
# Build woff2 fonts ==========================================================

# requires woff2_compress (get from https://github.com/bramstein/homebrew-webfonttools)

rm -rf distr/woff2

ttfs=$(ls distr/*/*.ttf)
for ttf in $ttfs; do
    woff2_compress $ttf
done

mkdir -p distr/woff2
woff2s=$(ls distr/*/*.woff2)
for woff2 in $woff2s; do
    mv $woff2 distr/woff2/$(basename $woff2)
done

# ============================================================================
# Build woff fonts ===========================================================

# requires sfnt2woff-zopfli (get from https://github.com/bramstein/homebrew-webfonttools)

rm -rf distr/woff

ttfs=$(ls distr/*/*.ttf)
for ttf in $ttfs; do
    sfnt2woff-zopfli $ttf
done

mkdir -p distr/woff
woffs=$(ls distr/*/*.woff)
for woff in $woffs; do
    mv $woff distr/woff/$(basename $woff)
done