diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml new file mode 100644 index 0000000..df0ee7b --- /dev/null +++ b/.github/workflows/sync.yml @@ -0,0 +1,17 @@ +name: Auto PR + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' + +jobs: + sync: + runs-on: ubuntu-latest + steps: + - uses: zk-phi/auto-pr@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + base: 'master' + head: 'zachleat:master' + diff --git a/.gitignore b/.gitignore index 38e62aa..0942b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules -test/fonts/ignored \ No newline at end of file +test/fonts/ignored +package-lock.json \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c984685 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ +v4.0.0 + +* Requires Node 10+ (Node 8 is EOL) +* A bunch of major release bumps of dependencies +* Fixes the `(node:1077) Warning` console output documented at the end of https://www.sarasoueidan.com/blog/glyphhanger/ \ No newline at end of file diff --git a/README.md b/README.md index 6d58718..882610b 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,12 @@ git submodule update --init --recursive python setup.py install ``` +If you want to read an in-depth tutorial on the installation steps above, please read [How I set up Glyphhanger on macOS for optimizing and converting font files for the Web](https://www.sarasoueidan.com/blog/glyphhanger/) by Sara Soueidan. + ## Usage +_Related: operate on existing `unicode-range` values with [Unicode Range Interchange](https://www.zachleat.com/unicode-range-interchange/) ([read the blog post](https://www.zachleat.com/web/unicode-range-interchange/))._ + ### Find the glyphs in a local file or url ```sh @@ -47,7 +51,7 @@ glyphhanger ./test.html --string glyphhanger http://example.com # multiple URLs, optionally using HTTPS -glyphhanger https://google.com https://www.filamentgroup.com +glyphhanger https://google.com https://www.zachleat.com # show results for each font-family on the page glyphhanger ./test.html --json @@ -233,15 +237,14 @@ echo "this is a test" | glyphhanger --jsdom ## Testing -* Build Status: [![Build Status](https://travis-ci.org/filamentgroup/glyphhanger.svg?branch=master)](https://travis-ci.org/filamentgroup/glyphhanger) - `npm test` will run the tests. Or, alternatively `npx mocha`. ## Enhancement Queue -* [Top Voted Issues 👍](https://github.com/filamentgroup/glyphhanger/issues?q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc) +* [Top Voted Issues 👍](https://github.com/zachleat/glyphhanger/issues?q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc) +* Archived: [Voted Issues from `filamentgroup/glyphhanger`](https://github.com/filamentgroup/glyphhanger/issues?q=label%3Aneeds-votes+sort%3Areactions-%2B1-desc) ## Alternatives to GlyphHanger diff --git a/cmd.js b/cmd.js index ec2ab86..307d302 100755 --- a/cmd.js +++ b/cmd.js @@ -30,6 +30,7 @@ if( argv.jsdom ) { var subset = new GlyphHangerSubset(); subset.setOutputDirectory(argv.output); +subset.setOutputSuffix(argv.suffix); if( argv.formats ) { subset.setFormats( argv.formats ); diff --git a/package.json b/package.json index b9f610f..ca83f69 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "glyphhanger", - "version": "3.2.0", + "version": "4.0.1", "description": "A tool to ease webfont subsetting.", "main": "src/GlyphHanger.js", "scripts": { @@ -8,39 +8,38 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/filamentgroup/glyphhanger.git" + "url": "git+https://github.com/zachleat/glyphhanger.git" }, "author": { "name": "Zach Leatherman", - "email": "zach@filamentgroup.com", - "url": "https://filamentgroup.com" + "email": "zachleatherman@gmail.com", + "url": "https://zachleat.com/" }, "license": "MIT", "bugs": { - "url": "https://github.com/filamentgroup/glyphhanger/issues" + "url": "https://github.com/zachleat/glyphhanger/issues" }, - "homepage": "https://github.com/filamentgroup/glyphhanger#readme", + "homepage": "https://github.com/zachleat/glyphhanger#readme", "bin": { "glyphhanger": "./cmd.js" }, "dependencies": { - "@zachleat/spider-pig": "^1.0.3", - "chalk": "^2.3.0", + "@zachleat/spider-pig": "zk-phi/spider-pig", + "chalk": "^4.1.0", "characterset": "^1.3.0", - "connect": "^3.6.6", - "debug": "^3.1.0", - "filesize": "^3.5.11", - "fs-extra": "^5.0.0", - "get-stdin": "^6.0.0", - "glob": "^7.1.2", - "jsdom": "^13.0.0", - "minimist": "^1.2.0", + "connect": "^3.7.0", + "debug": "^4.3.1", + "filesize": "^6.1.0", + "fs-extra": "^9.1.0", + "get-stdin": "^8.0.0", + "glob": "^7.1.6", + "jsdom": "^15.2.1", + "minimist": "^1.2.5", "parse-filepath": "^1.0.2", - "rsvp": "^4.7.0", - "serve-static": "^1.13.2", - "shelljs": "^0.7.8" + "serve-static": "^1.14.1", + "shelljs": "^0.8.4" }, "devDependencies": { - "mocha": "^4.0.1" + "mocha": "^8.3.1" } } diff --git a/src/GlyphHangerSubset.js b/src/GlyphHangerSubset.js index ea9c3fa..7621500 100644 --- a/src/GlyphHangerSubset.js +++ b/src/GlyphHangerSubset.js @@ -23,6 +23,16 @@ class GlyphHangerSubset { return this.outputDirectory; } + setOutputSuffix( suffix ) { + if( suffix != null ) { + this.outputSuffix = suffix; + } + } + + getOutputSuffix() { + return this.outputSuffix; + } + setFontFilesGlob( ttfFilesGlob ) { this.fontPaths = glob.sync( ttfFilesGlob ); } @@ -84,7 +94,8 @@ class GlyphHangerSubset { getFilenameFromTTFPath( ttfPath, format, useZopfli ) { var fontPath = parsePath( ttfPath ); - var outputFilename = fontPath.name + "-subset" + ( useZopfli ? ".zopfli" : "" ) + ( format ? "." + format : fontPath.ext ); + var suffix = this.getOutputSuffix();; + var outputFilename = fontPath.name + (suffix == null ? "-subset" : suffix) + ( useZopfli ? ".zopfli" : "" ) + ( format ? "." + format : fontPath.ext ); return outputFilename; } diff --git a/src/GlyphHangerWhitelist.js b/src/GlyphHangerWhitelist.js index fbaede0..80c5143 100644 --- a/src/GlyphHangerWhitelist.js +++ b/src/GlyphHangerWhitelist.js @@ -12,7 +12,7 @@ class GlyphHangerWhitelist { } if( presets.LATIN ) { - cs = cs.union( CharacterSet.parseUnicodeRange("U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD" )); + cs = cs.union( CharacterSet.parseUnicodeRange("U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD" )); } if( typeof chars === "string" ) {