googlefonts / gftools

Misc tools for working with the Google Fonts library
Apache License 2.0
243 stars 70 forks source link

Builder subset operation: exclude glyphs by name/codepoint/file #1020

Closed RickyDaMa closed 1 month ago

RickyDaMa commented 2 months ago

Adds support both on commandline and through YAML for glyphs to be excluded by either their name or codepoint.

All of the following now work (and yes, they would work together if something possessed you to do so):

# -- snip --
subsets:
  - from:
      repo: myorg/myfont
      path: source/myfont.designspace
    force: true
    name: GF_Latin_Core
    # āœØ new āœØ šŸ‘‡
    exclude_codepoints: U+0032 U+0033  # space delimited
    exclude_codepoints_file: exclude_codepoints.txt
    exclude_glyphs: space a b c  # space delimited
    exclude_glyphs_file: exclude_glyph_names.txt

Usage docs for the CLI:

options:
  --exclude-codepoints EXCLUDE_CODEPOINTS
                        Space-delimited unicodes to exclude
  --exclude-codepoints-file EXCLUDE_CODEPOINTS_FILE
                        Newline delimited file with unicodes to exclude. Allows for comments with either #
                        or //
  --exclude-glyphs EXCLUDE_GLYPHS
                        Space-delimited glyph names to exclude
  --exclude-glyphs-file EXCLUDE_GLYPHS_FILE
                        Newline delimited file with glyph names to exclude. Allows for comments with
                        either # or //

The file format I've tried to be considerate/flexible: it's newline delimited, allowing either // or # style comments (both in-line and on thier own line)


Considerations:

Happy to hear thoughts, feedback, emotions

simoncozens commented 1 month ago

I've just fixed the ufomerge bug and am happy with this if you are - ready for review?

RickyDaMa commented 1 month ago

I don't think the failing test runs are on me, but let me know if I'm mistaken there

Pushed documentation on the subset operation (see it rendered here)

I wanted to pin ufomerge to >1.8.0* so we don't pull in the bugged version to gftools, but as far as I can see gftools doesn't even have an explicit dependency on ufomerge? If so, I think we should add it

(*note: the fix has not yet been released)

simoncozens commented 1 month ago

Yes, please add a dependency on ufomerge>=1.8.1

Hoolean commented 1 month ago

@simoncozens Thanks Simon, all pinned now: šŸ“Œ 1e0521a06ac8c7b9f653e353e6b914a19b4b842f šŸ“Œ

simoncozens commented 1 month ago

Nice, thank you!