Skip to content

Commit

Permalink
Merge pull request #1 from rsheeter/bug
Browse files Browse the repository at this point in the history
Add woff2 support
  • Loading branch information
rsheeter authored Sep 26, 2023
2 parents 25c9c28 + e27a4a8 commit 51de0d4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
setup_requires=["setuptools_scm"],
install_requires=[
"absl-py>=1.4.0",
"brotli>=1.1.0",
"fonttools>=4.42.1",
"uharfbuzz>=0.37.2",
],
Expand Down
4 changes: 0 additions & 4 deletions src/subset_gf_icons/_version.py

This file was deleted.

17 changes: 17 additions & 0 deletions src/subset_gf_icons/subset_gf_icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,24 @@
subset_gf_icons ~/Downloads/MaterialIcons-Regular.ttf menu alarm etc
"""
from absl import app
from absl import flags
from fontTools import ttLib, subset
from functools import reduce
import uharfbuzz as hb
from pathlib import Path


FLAGS = flags.FLAGS


flags.DEFINE_enum(
"flavor",
None,
['woff', 'woff2'],
"Specify flavor of output font file. May be 'woff' or 'woff2'. If unspecified output is uncompressed.",
)


ZERO_WIDTH_SPACE = chr(0x200B)


Expand Down Expand Up @@ -85,6 +97,11 @@ def _run(argv):
subsetter.subset(subset_font)

out_file = in_file.parent / (in_file.stem + "-subset" + in_file.suffix)

if FLAGS.flavor is not None:
out_file = out_file.with_suffix('.' + FLAGS.flavor)
subset_font.flavor = FLAGS.flavor

subset_font.save(out_file)

print("Wrote subset to", out_file)
Expand Down

0 comments on commit 51de0d4

Please sign in to comment.