Skip to content

Glyphs FEA predicate tokens: glyph-metadata attributes and nested boolean expressions #2052

Description

@anthrotype

Follow-up to #92. Phase 1 there scopes 1.0 to name-only predicates which need nothing beyond the GlyphMap fea-rs already has. This issue is the deferred remainder: predicates that query glyph metadata, and nested boolean expressions.

As far as I can tell, only two crater sources need this:

ZalandoSans (zalando/sans): category/subCategory:

$[category like 'Number']
$[subCategory like 'Space']

Borel (RosaWagner/Borel): the full NSPredicate subset plus nested/parenthesised boolean, e.g. one @short class meaning "every exporting glyph that is an uppercase Letter with a Unicode value whose name starts with AE/C/E/T/X":

@short = [$[category like "Letter" && case==upper && unicode != nil && (name beginswith "AE" OR name beginswith "C" OR name beginswith "E" OR name beginswith "T" OR name beginswith "X")]];

What this needs on top of phase 1:

  • Threading glyph metadata (category, subCategory, case, unicode) through to wherever predicates are expanded. fea-rs currently only receives glyph names. case in particular isn't retained by glyphs-reader today (it's dropped in glyphdata.rs), so that needs adding to the reader first.
  • The like operator (fnmatch-style) and the nil literal (for unicode != nil).
  • A real boolean parser: mixing &&/OR, parenthesised grouping, and NOT with proper precedence (phase 1 only needs a flat single-operator chain).

These are two fairly independent chunks: ZalandoSans needs only the metadata threading + like; Borel additionally needs case (including the glyphs-reader change), unicode/nil, and the nested-boolean parser.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions