Skip to content

Commit

Permalink
Update font-subset script for a clearer instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
renintw committed Nov 15, 2023
1 parent c2f5712 commit 0b0b7b0
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions bin/font-subset.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
/* eslint-disable no-console */
/**
* Prerequisite:
* 1. Install glyphhanger - https://github.com/zachleat/glyphhanger
* 1. Install/Update glyphhanger - https://github.com/zachleat/glyphhanger
* Usage:
* 1. Add {"type": "module"} to package.json.
* 2. mkdir output fonts.
* 2. Run 'mkdir output fonts'.
* 3. Put all font files into /fonts and change the file name if it's hard to read.
* 4. Change the fontFileName, fontWeight and fontFamily etc. accroding to the font you use in this script.
* 5. npm run font-subset.
* 6. Copy subsetting files and css styles to where they should be placed.
* 4. Change the fontFileName, fontWeight and fontFamily etc. below according to the font you use in this script.
* 5. Run 'npm run font-subset'.
* 6. Copy subsetting files and css styles to where they should be placed. (Usually mu-plugins/global-fonts)
* 7. remove output and fonts.
* 8. Remove {"type": "module"} from package.json or the linter would prompt an error.
*/
Expand Down Expand Up @@ -50,12 +50,13 @@ const alphabets = [
];

const __dirname = process.cwd();
const fontFileName = 'Inter';
// Update the values below if necessary.
const fontFileName = 'Newsreader-Italic';
const fontFileExt = 'ttf';
const fontFamily = 'Inter';
const fontFamily = 'Newsreader';
const fontWeight = '100 900';
const fontStyle = 'normal';
const fontFinalDir = 'Inter';
const fontStyle = 'italic';
const fontFinalDir = 'Newsreader';

for ( const alphabet of alphabets ) {
await new Promise( ( resolve ) => {
Expand Down

0 comments on commit 0b0b7b0

Please sign in to comment.