opentypejs / opentype.js

Read and write OpenType fonts using JavaScript.
https://opentype.js.org/
MIT License
4.38k stars 468 forks source link

Reading liga gsub table #514

Closed matezpaterson closed 2 years ago

matezpaterson commented 2 years ago

(Sorry for this silly question) I am very very beginner at javascript and i'm trying to read "liga" gsub table and display something like this:

sub f f by f_f; sub f i by f_i; sub f f i by f_f_i; sub o f f i by o_f_f_i; etc.

I know opentype.js can easily make the job and I know that it has been done in the past (based on this comment https://github.com/opentypejs/opentype.js/issues/194#issuecomment-240011128)

However I have tried to display "ligLookup" but got an error Uncaught ReferenceError: font is not defined I know i'm doing it wrong and i'm sure there is a easier way to do it. I hope someone can guide me.

matezpaterson commented 2 years ago

Ok i had to call it on OnFontLoad