How to Subset a Variable Font

How to Subset a Variable Font

clagnut.com clagnut.com3 months ago in #Typography Love25

Using variable fonts will also be a very good manner to cut back bandwidth and latency as they may be able to extremely successfully mix a couple of kinds into one font dossier. However, as with same old skilled fonts, they may be able to comprise a lot characters you’re going to by no means use (in my case this would come with Greek and Cyrillic – your mileage will range). These un-needed characters will also be got rid of from the font to cut back file-size, a procedure referred to as subsetting. This submit is essentially an aide-memoire explaining how to subset fonts from first ideas on a Mac (macOS Monterey 12.3.1 at time of writing). I’ll be the usage of fonttools, an open supply font manipulation library written in Python, to subset a font and create a WOFF2 font dossier to be used at the Web. macOS now not comes bundles with Python, so initially obtain and set up the most recent model of Python Three following the directions within the macOS installer. Once Python Three has put in effectively, open Terminal and set up fonttools the usage of pip (which is distributed with Python): python3 -m pip set up fonttools Next set up Brotli compression, which is needed to output a WOFF2. python3 -m pip set up brotli Now trade the Terminal listing to the folder the place font dossier is eg. cd /Users/wealthy/ Finally run the fonttools subsetting regimen the usage of the required choices. For instance: pyftsubset LiterataTT.ttf -unicodes=”U 0020-007F, U 00A0-00FF, U 0100-017F, U 2000-206F, U 2070-209F, U 20A0-20CF, U 2100-214F, U 2200-22FF, U FB00-FB4F” -layout-features=’*’ -flavor=”woff2″ -output-file=”LiterataTT.woff2″ In this situation I’m subsetting LiterataTT.ttf and outputting as LiterataTT.woff2 into the similar listing. The unicodes possibility specifies which characters to come with within the subset, by means of Unicode persona levels. It doesn’t topic if the font doesn’t have all of the Unicode levels to be had within the first, or all of the characters inside of a specified vary – those simply get unnoticed. In this situation I’m together with the next Unicode levels: The layout-features possibility specifies which OpenType format aspects to come with, reminiscent of kerning, ligatures, numerals and exchange characters. In this case I’m the usage of layout-features=’*’ to come with all of the aspects to be had. You too can upload decided on aspects to the default set. For instance layout-features =onum,pnum,ss01 will stay the default set of aspects and upload onum, pnum and ss01 (old-style and proportional numerals, and styleset 1). The default aspects come with calt, clig, kern and ligaamong others. See the fonttools Documentation for more information on layout-features. Applying that subsetting regimen to LiterataTT diminished the unique font dossier from 913Kb to 207Kb. The latter continues to be a somewhat massive dossier, however I used to be conservative in my subsetting (as in maintaining in quite a few European characters and OpenType aspects) and as a variable font will quilt all eventualities from Light to Black weight and occasional to prime distinction optical sizing. Love  » Read More

Like to keep reading?

This article first appeared on clagnut.com. If you'd like to keep reading, follow the white rabbit.

View Full Article

Leave a Reply