verovio icon indicating copy to clipboard operation
verovio copied to clipboard

How to choose stylistic alternates in SMuFL

Open rettinghaus opened this issue 3 years ago • 3 comments

Some SMuFL fonts bring stylistic alternates for some glyphs like the recommended ones in Bravura: https://w3c.github.io/smufl/latest/tables/clefs.html The problem is, that they share a code point with another glyph and the current method for bounding box calculation and glyph extraction relies on code points alone. Also in SVG fonts they appear at code points outside the SMuFL range. Question is if there is any possibility to select these glyphs in Verovio with the glyph.num attribute.

rettinghaus avatar Mar 17 '21 13:03 rettinghaus

Could we use the alternates and codepoint informations from metadata.json file for font generation?

rettinghaus avatar Mar 17 '21 14:03 rettinghaus

Never mind, I found it https://w3c.github.io/smufl/latest/specification/glyphswithalternates.html

lpugin avatar Mar 17 '21 14:03 lpugin

  1. I think we would need something similar to https://github.com/rism-digital/verovio/blob/develop/fonts/supported.xsl to list the alternates we support. With this in hand, alternate codepoints glyphs will be extracted as well as their bounding box without major changes to the building scripts.
  2. We need use the metadata.json to do make the mapping available in Verovio in Resources::s_smuflNames - obviously we assume that all fonts use the same mapping, which seems to be the case from what I have seen in fonts but not from the specifications since alternates are recommended. It would add entries like { "gClefSmall", SMUFL_alt_F472_gClefSmall }
  3. The alternate could be selected with @glyph.name="gClefSmall" (which would be mapped to the alternate codepoint preserved in 2., which we already support)

lpugin avatar Mar 17 '21 15:03 lpugin