googlefonts / roboto-classic

Development of a Roboto Variable font
SIL Open Font License 1.1
151 stars 15 forks source link

Clean up build-min.sh #58

Closed m4rc1e closed 4 years ago

m4rc1e commented 4 years ago

@sannorozco please can you submit your commits as pull requests going forward. This gives me a better way to review what we're doing.

I've just taken a quick look at the build-min. The fonts build which is great but we should make it neater.

Here are some quick changes I'd make:

Current:

fontmake -o ttf-interpolatable -m Roboto-min.designspace --no-production-names
fonttools varLib Roboto-min.designspace
mv Roboto-min-VF.ttf fonts/Roboto-unhinted.ttf

New:

fontmake -m Roboto-min.designspace --output-path fonts/Roboto[ital,wdth,wght].ttf

Current:

# Remove MVAR
ttx -x MVAR fonts/Roboto-unhinted.ttf
rm fonts/Roboto-unhinted.ttf
ttx fonts/Roboto-unhinted.ttx
rm fonts/Roboto-unhinted.ttx

New:

We have a gftools script for this.

gftools fix-unwanted-tables -t "MVAR" fonts/Roboto-unhinted.ttf

Current:

# Merge Hints from VTT source
python -m vttLib dumpfile HintingSource/VTTSourceRoboto-min-VF.ttf

mv HintingSource/VTTSourceRoboto-min-VF_VTT_Hinting.ttx fonts/VTTSourceRoboto-min-VF_VTT_Hinting.ttx

python -m vttLib mergefile fonts/VTTSourceRoboto-min-VF_VTT_Hinting.ttx fonts/Roboto-unhinted.ttf

rm fonts/VTTSourceRoboto-min-VF_VTT_Hinting.ttx

python -m vttLib compile fonts/Roboto-unhinted.ttf

rm fonts/Roboto-unhinted.ttf

New:

Mike's hinting work should be kept in the sources dir and stored as xml. This way we can see his changes instead of a binary blob

# Merge Hints from VTT source
python -m vttLib mergefile sources/vtt-hinting.ttx fonts/Roboto[ital,wdth,wght].ttf
python -m vttLib compile fonts/Roboto[ital,wdth,wght].ttf

Current:

#fix maxp
ttx -m fonts/Roboto[ital,wdth,wght].ttf fonts/fixes/maxp-fix.ttx
mv fonts/fixes/maxp-fix.ttf fonts/maxp-fix.ttf
ttx fonts/maxp-fix.ttf
rm fonts/maxp-fix.ttf
rm fonts/Roboto[ital,wdth,wght].ttf
ttx fonts/maxp-fix.ttx
rm fonts/maxp-fix.ttx
mv fonts/maxp-fix.ttf fonts/Roboto[ital,wdth,wght].ttf

New:

Are we sure this is going to work? Idk but maybe this table is always recalculated by fonttools each time we make a modification? I also dislike that the values are hardcoded which means we'll constantly need to update it each time we modify the fonts. If this table isn't regenerated by fonttools, perhaps we should write our own maxp table generator?

Current:

#remove TSI tables from VF
ttx -x TSI0 -x TSI1 -x TSI2 -x TSI3 -x TSI5 fonts/Roboto[ital,wdth,wght].ttf
rm fonts/Roboto[ital,wdth,wght].ttf
ttx fonts/Roboto[ital,wdth,wght].ttx
rm fonts/Roboto[ital,wdth,wght].ttx

New:

When you compile the hints, use the --ship flag. This will remove these tables automatically.

python -m vttLib compile fonts/Roboto[ital,wdth,wght].ttf --ship

cc @davelab6

m4rc1e commented 4 years ago

It may also make things cleaner to make fonts/Roboto[ital,wdth,wght].ttf a variable e.g VF_OUT=fonts/Roboto[ital,wdth,wght].ttf.

We can then use this for each tool e.g fontmake -m Roboto-min.designspace --output-path $VF_OUT

m4rc1e commented 4 years ago

Roboto classic uses a makefile which allows users to build different font sets. We should have similar functionality with an identical interface if we want to make this project a true replacement.