Skip to content

Update generate-all-fonts.sh #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 65 additions & 62 deletions generate-all-fonts.sh
Original file line number Diff line number Diff line change
@@ -1,64 +1,67 @@
#!/bin/bash

# Arguments are:
# * FreeType font file to load (eg: Vera.ttf)
# * FreeType font size to use (eg: 23)
# * Python filename to create (eg: heyd_23.py)
# * Name of the object inside the created python filename (eg: Heydings_23)

FULL_CHARSET=#32-#125,#160-#255
MINIMAL_CHARSET=#32-#125,#160-#163,#166-#169,#171,#173,#175,#176-#177,#180,#187,#224,#231-#234

python3 ft-generate.py ttf-fonts/heydings_icons.ttf 23 upy-fonts/heyd_23.py Heydings_23 --descender= --special-align= --chars=#33,#42-#43,#45,#49-#54,#56,#64-#90,#97-#105,#107-#119,#121
python3 ft-generate.py ttf-fonts/Entypo.otf 23 upy-fonts/etypo_13.py Entypo_13 --descenders= --special-align= --chars=#33-#126,#174,#196-#197,#199,#201,#209,#214,#220,#224-#229,#231-#239,#241-#244,#246
python3 ft-generate.py ttf-fonts/Entypo.otf 42 upy-fonts/etypo_23.py Entypo_23 --descenders= --special-align= --chars=#33-#126,#174,#196-#197,#199,#201,#209,#214,#220,#224-#229,#231-#239,#241-#244,#246

python3 ft-generate.py ttf-fonts/Arrows.ttf 24 upy-fonts/arrows_15.py Arrows_15 --descenders= --special-align=#65:M,#66:M,#73:M,#74:M,#81:M,#82:M,#83:M,#84:M,#85:M,#86:M,#87:M,#88:M,#97:M,#98:M --chars=#65-#90,#97-#122
python3 ft-generate.py ttf-fonts/Arrows.ttf 36 upy-fonts/arrows_23.py Arrows_23 --descenders= --special-align=#65:M,#66:M,#73:M,#74:M,#81:M,#82:M,#83:M,#84:M,#85:M,#86:M,#87:M,#88:M,#97:M,#98:M --chars=#65-#90,#97-#122

python3 ft-generate.py ttf-fonts/Vera.ttf 8 upy-fonts/vera_8.py Vera_8 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 9 upy-fonts/vera_9.py Vera_9 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 10 upy-fonts/vera_10.py Vera_10 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 14 upy-fonts/vera_15.py Vera_15 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 23 upy-fonts/vera_23.py Vera_23 --chars=$FULL_CHARSET

python3 ft-generate.py ttf-fonts/Vera.ttf 8 upy-fonts/vera_m8.py Vera_m8 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 9 upy-fonts/vera_m9.py Vera_m9 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 10 upy-fonts/vera_m10.py Vera_m10 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 14 upy-fonts/vera_m15.py Vera_m15 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Vera.ttf 23 upy-fonts/vera_m23.py Vera_m23 --chars=$MINIMAL_CHARSET

python3 ft-generate.py ttf-fonts/VeraMono.ttf 9 upy-fonts/veram_9.py VeraMono_9 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/VeraMono.ttf 10 upy-fonts/veram_10.py VeraMono_10 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/VeraMono.ttf 15 upy-fonts/veram_15.py VeraMono_15 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/VeraMono.ttf 23 upy-fonts/veram_23.py VeraMono_23 --chars=$FULL_CHARSET

python3 ft-generate.py ttf-fonts/VeraMono.ttf 9 upy-fonts/veram_m9.py VeraMono_m9 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/VeraMono.ttf 10 upy-fonts/veram_m10.py VeraMono_m10 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/VeraMono.ttf 15 upy-fonts/veram_m15.py VeraMono_m15 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/VeraMono.ttf 23 upy-fonts/veram_m23.py VeraMono_m23 --chars=$MINIMAL_CHARSET

python3 ft-generate.py ttf-fonts/Roboto-Light.ttf 8 upy-fonts/robotl_m8.py RobotoLight_m8 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Roboto-Light.ttf 10 upy-fonts/robotl_m10.py RobotoLight_m10 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Roboto-Light.ttf 12 upy-fonts/robotl_m12.py RobotoLight_m12 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Roboto-Light.ttf 15 upy-fonts/robotl_m15.py RobotoLight_m15 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/Roboto-Light.ttf 20 upy-fonts/robotl_m20.py RobotoLight_m20 --chars=$MINIMAL_CHARSET
# FontDrawer not stable for height 23
# python3 ft-generate.py ttf-fonts/Roboto-Light.ttf 23 upy-fonts/robotl_23.py RobotoLight_23 --chars=$MINIMAL_CHARSET

python3 ft-generate.py ttf-fonts/DejaVuSansMono.ttf 8 upy-fonts/dejav_m8.py dejav_m8 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/DejaVuSansMono.ttf 10 upy-fonts/dejav_m10.py dejav_m10 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/DejaVuSansMono.ttf 12 upy-fonts/dejav_m12.py dejav_m12 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/DejaVuSansMono.ttf 15 upy-fonts/dejav_m15.py dejav_m15 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/DejaVuSansMono.ttf 20 upy-fonts/dejav_m20.py dejav_m20 --chars=$MINIMAL_CHARSET

python3 ft-generate.py ttf-fonts/FreeSerif-4aeK.ttf 10 upy-fonts/fserif_m10.py fserif_m10 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/FreeSerif-4aeK.ttf 12 upy-fonts/fserif_m12.py fserif_m12 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/FreeSerif-4aeK.ttf 15 upy-fonts/fserif_m15.py fserif_m15 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/FreeSerif-4aeK.ttf 20 upy-fonts/fserif_m20.py fserif_m20 --chars=$MINIMAL_CHARSET

python3 ft-generate.py ttf-fonts/PitchDisplayRegularDemo.ttf 14 upy-fonts/pitch_15.py Pitch_15 --chars=$FULL_CHARSET
python3 ft-generate.py ttf-fonts/PitchDisplayRegularDemo.ttf 22 upy-fonts/pitch_23.py Pitch_23 --chars=$FULL_CHARSET

python3 ft-generate.py ttf-fonts/PitchDisplayRegularDemo.ttf 14 upy-fonts/pitch_15.py Pitch_m15 --chars=$MINIMAL_CHARSET
python3 ft-generate.py ttf-fonts/PitchDisplayRegularDemo.ttf 22 upy-fonts/pitch_23.py Pitch_m23 --chars=$MINIMAL_CHARSET
# Script for generating MicroPython font files from TrueType fonts using ft-generate.py

# Define the full and minimal character sets
FULL_CHARSET="#32-#125,#160-#255"
MINIMAL_CHARSET="#32-#125,#160-#163,#166-#169,#171,#173,#175,#176-#177,#180,#187,#224,#231-#234"

# Function to generate MicroPython font files
generate_font() {
python3 ft-generate.py "$1" "$2" "$3" "$4" --descender="$5" --special-align="$6" --chars="$7"
}

# Generate MicroPython font files for Heydings Icons font
generate_font "ttf-fonts/heydings_icons.ttf" 23 "upy-fonts/heyd_23.py" "Heydings_23" "" "" "#33,#42-#43,#45,#49-#54,#56,#64-#90,#97-#105,#107-#119,#121"

# Generate MicroPython font files for Entypo font
generate_font "ttf-fonts/Entypo.otf" 23 "upy-fonts/etypo_13.py" "Entypo_13" "" "" "#33-#126,#174,#196-#197,#199,#201,#209,#214,#220,#224-#229,#231-#239,#241-#244,#246"
generate_font "ttf-fonts/Entypo.otf" 42 "upy-fonts/etypo_23.py" "Entypo_23" "" "" "#33-#126,#174,#196-#197,#199,#201,#209,#214,#220,#224-#229,#231-#239,#241-#244,#246"

# Generate MicroPython font files for Arrows font
generate_font "ttf-fonts/Arrows.ttf" 24 "upy-fonts/arrows_15.py" "Arrows_15" "" "#65:M,#66:M,#73:M,#74:M,#81:M,#82:M,#83:M,#84:M,#85:M,#86:M,#87:M,#88:M,#97:M,#98:M" "#65-#90,#97-#122"
generate_font "ttf-fonts/Arrows.ttf" 36 "upy-fonts/arrows_23.py" "Arrows_23" "" "#65:M,#66:M,#73:M,#74:M,#81:M,#82:M,#83:M,#84:M,#85:M,#86:M,#87:M,#88:M,#97:M,#98:M" "#65-#90,#97-#122"

# Generate MicroPython font files for Vera font
for size in 8 9 10 14 23; do
generate_font "ttf-fonts/Vera.ttf" "$size" "upy-fonts/vera_$size.py" "Vera_$size" "" "" "$FULL_CHARSET"
done

# Generate MicroPython font files for minimal Vera font
for size in 8 9 10 14 23; do
generate_font "ttf-fonts/Vera.ttf" "$size" "upy-fonts/vera_m$size.py" "Vera_m$size" "" "" "$MINIMAL_CHARSET"
done

# Generate MicroPython font files for VeraMono font
for size in 9 10 15 23; do
generate_font "ttf-fonts/VeraMono.ttf" "$size" "upy-fonts/veram_$size.py" "VeraMono_$size" "" "" "$FULL_CHARSET"
done

# Generate MicroPython font files for minimal VeraMono font
for size in 9 10 15 23; do
generate_font "ttf-fonts/VeraMono.ttf" "$size" "upy-fonts/veram_m$size.py" "VeraMono_m$size" "" "" "$MINIMAL_CHARSET"
done

# Generate MicroPython font files for Roboto-Light font
for size in 8 10 12 15 20; do
generate_font "ttf-fonts/Roboto-Light.ttf" "$size" "upy-fonts/robotl_m$size.py" "RobotoLight_m$size" "" "" "$MINIMAL_CHARSET"
done

# Generate MicroPython font files for DejaVuSansMono font
for size in 8 10 12 15 20; do
generate_font "ttf-fonts/DejaVuSansMono.ttf" "$size" "upy-fonts/dejav_m$size.py" "dejav_m$size" "" "" "$MINIMAL_CHARSET"
done

# Generate MicroPython font files for FreeSerif font
for size in 10 12 15 20; do
generate_font "ttf-fonts/FreeSerif-4aeK.ttf" "$size" "upy-fonts/fserif_m$size.py" "fserif_m$size" "" "" "$MINIMAL_CHARSET"
done

# Generate MicroPython font files for PitchDisplayRegularDemo font
generate_font "ttf-fonts/PitchDisplayRegularDemo.ttf" 14 "upy-fonts/pitch_15.py" "Pitch_15" "" "" "$FULL_CHARSET"
generate_font "ttf-fonts/PitchDisplayRegularDemo.ttf" 22 "upy-fonts/pitch_23.py" "Pitch_23" "" "" "$FULL_CHARSET"

# Generate MicroPython font files for minimal PitchDisplayRegularDemo font
generate_font "ttf-fonts/PitchDisplayRegularDemo.ttf" 14 "upy-fonts/pitch_m15.py" "Pitch_m15" "" "" "$MINIMAL_CHARSET"
generate_font "ttf-fonts/PitchDisplayRegularDemo.ttf" 22 "upy-fonts/pitch_m23.py" "Pitch_m23" "" "" "$MINIMAL_CHARSET"