johanmattssonm / birdfont

A font editor for creating fonts in TTF, EOT, SVG and BIRDFONT format.
https://birdfont.org
449 stars 32 forks source link

Contextual substitution Beginning does not work like kerning classes #172

Open ciqven opened 3 months ago

ciqven commented 3 months ago

OS: Linux x86_64 Birdfont version: 6.7.1 (installed via the flatpak from the website)

tldr: Contextual substitution beginning field does not specify a character class, but an exact sequence needed. This is not intuitive (to me) and contrary to the manual. How can I specify a kerning-like class here?

Greetings, I am trying to make a font for an abugida with initial and isolated vowel forms. In other words, a vowel will have three forms. Initial: Ox, combining: xO, and isolated when not preceded by a valid consonant: xaO).

I am trying to use contextual substitution to handle these vowel forms. I want a rule that converts the initial form to a combining form when preceded by a consonant, so per the manual I tried to setup the following rule:

Ligature: o.combining Beginning: b c Middle: o End:

However, this does not work. In the spacing view, whenever I type bo or co, the o does not get substituted. Only when I type exactly bco does the o get substituted. This looks like the Beginning field does not specify a character class, but rather an exact character sequence. So I would need one rule per consonant-vowel combination.

johanmattssonm commented 3 months ago

Yes, the beginning is a character sequence not a class.

Could mark classes be a solution?

ciqven commented 3 months ago

Thank you for the quick reply.

I am new to Birdfont so I might be misunderstanding this, but from what I can see in the manual mark classes are used to position a glyph relative to another for diacritics, not for replacing one glyph with another based on surrounding characters.

For my (simplified) use-case I need each vowel to resolve to 3 different glyphs based on the preceding character. One of these 3 glyphs is a diacritic for some vowels and for that I plan to use mark classes, but before that I need to convert the vowel to the right glyph.

So I am looking for a way to type e.g [b c d k v] in the beginning field, or even better type e.g @classname and then add the right glyphs to the right class in the overview. I recall FontForge does something similar (https://fontforge.org/docs/tutorial/editexample6-5.html 2nd screenshot) allowing you to define classes, only in true FontForge fashion this is both complicated and crashed when attempting it :)

Edit I see that the birdfont save-file is XML, so in the worst case I could just all all rules programmatically myself. Still, GUI for this would be less clutter.

johanmattssonm commented 3 months ago

Thanks I will look into that later. It is not something I have added support for in Birdfont at this time.