larsenwork / monoid

Customisable coding font with alternates, ligatures and contextual positioning. Crazy crisp at 12px/9pt. http://larsenwork.com/monoid/
7.86k stars 170 forks source link

Build.py: Call opentype feature instead of manually typing glyphs #36

Closed larsenwork closed 9 years ago

larsenwork commented 9 years ago

I'm currently adding versions optimised for high-res of some the letters letters (may end up being 50-100 letters) and to add those in build.py can be a bit repetitive so it would ultimately be great to be able to type e.g.

option('retina', 'Optimised for high-res displays', ss14)

instead of

option('retina', ''Optimised for high-res displays', Swap("one", "one.retina"), Swap("two", "two.retina").................Swap("hundred", "hundred.retina"))

https://github.com/khaledhosny/deotfy

chase commented 9 years ago

Should be easy enough.

larsenwork commented 9 years ago

:smiley:

chase commented 9 years ago

Just to clarify, the build option for this will only be for multiple replacements. Single swaps are still more efficient if you give the glyph name.

In order to swap glyphs based on a lookup table, you have to iterate over every single glyph to check if it matches against a sublookup. Fontforge as library is already very slow, so this would be awfully inefficient and cause builds to take 6x longer.

Only use this where absolutely necessary :smiley:

larsenwork commented 9 years ago

ok, maybe it's better to make it a separate font instead: e.g. "Monoid-Retina" or something like it.

chase commented 9 years ago

For things like Retina where it is more than 5 glyphs swapped at a time but far less than the entire set of glyphs, this approach is fine.

I'm just saying: don't use SwapLookup to swap a single glyph. Just use Swap like you've been using.

larsenwork commented 9 years ago

Yeah...knowing me retina will be >half of the glyphs at some point so might as well separate it now :)

chase commented 9 years ago

Haha, alright. Well, I implemented SwapLookup for future use.