gftools icon indicating copy to clipboard operation
gftools copied to clipboard

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

Open RickyDaMa opened this issue 1 year ago • 0 comments

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:

  • Should the YAML inline syntax instead be comma separated, to match ufomerge's own CLI convention?
  • There's a bug in ufomerge that means excluding a glyph by name when using a named glyphset will remove its unicode: https://github.com/googlefonts/ufomerge/issues/28
  • Improving the documentation of the subset operation in the builder docs

Happy to hear thoughts, feedback, emotions

RickyDaMa avatar Aug 21 '24 16:08 RickyDaMa