monoid icon indicating copy to clipboard operation
monoid copied to clipboard

Look into using opentype.js to make font download

Open chase opened this issue 10 years ago • 8 comments

Opentype: https://github.com/nodebox/opentype.js

  • Doesn't support CALT or LIGA
  • ~~Doesn't support kerning~~ Now it does!

Zips: https://gildas-lormeau.github.io/zip.js/core-api.html#zip-writing https://stuk.github.io/jszip/documentation/examples.html

chase avatar Jul 13 '15 19:07 chase

Unsure exactly what it is you want to do? :smile:

Opentype.js is for font manipulation as far as I can see and since we're already zip'ing when building what would we need on-the-fly zipping for?

larsenwork avatar Jul 15 '15 11:07 larsenwork

I was thinking: What if rather than building all the options before hand, we only host the original TTF files (Normal, Bold, Oblique, Retina) and then do the small option modifications in the browser? Think fontbuilder.py in your browser for exactly what you picked (ex. it changes each style of the family) then zips them up.

chase avatar Jul 15 '15 12:07 chase

Ah - that would be cool - would allow for an infinite amount of alternates. But that would require the website being hosted on a proper web server with python capabilities, right?

larsenwork avatar Jul 15 '15 13:07 larsenwork

Nope! That's the beauty of this solution, everything is still static (we still build the base fonts using CircleCI) but all (or most) of the customization options would be implemented on the client-side browser. Opentype.js allows manipulation and writing of TTF blobs in the browser, no server needed. It lacks some capabilities, but I'll have to check if it discards things like CALT/LIGA tables entirely on loading. If it doesn't, we could build the nocalt option in CircleCI and just switch to those base fonts for Contextual Alternates / No Contextual Alternates option. If it does, I can probably work out a hack.

What Opentype.js definitely can do:

  • Line height changes (We could totally make a slider for this!)
  • Glyph changes (resizing, etc, for things like Powerline symbols)
  • Glyphn swaps

chase avatar Jul 15 '15 14:07 chase

Wow - that sounds powerful and definitely cool to have. I'm afraid my schedule is quite packed for the next month or so I won't have time to really look into until then but if it's something you'd want to look into then by all means 🚀😎

larsenwork avatar Jul 15 '15 15:07 larsenwork

I assigned myself to it, no need to do anything on your end. I'm pretty busy so this project is probably for post v1.0. This is more a reminder to check out this approach later on.

chase avatar Jul 15 '15 15:07 chase

So this may be a better alternative to opentype.js: https://github.com/kekee000/fonteditor-core

I'll have to investigate some more, but it seems like it may support everything we'd need.

chase avatar Jul 27 '15 00:07 chase

Looking forward to this.

tomByrer avatar Nov 17 '15 00:11 tomByrer