Checking for changes to Font.kerning

I want to check for any update to the kerning dictionary of a font and do stuff accordingly.
I’m currently using the UPDATEINTERFACE callback, and it works as it should, but because I only need to check for kerning changes and I don’t want my callback function triggered all the time, I’m guessing there’s a better way to do it.

I’ve seen the addObserver_ , addObserver_forKeyPath_options_context_ and addObserver_forObservableKeyPath_ methods , but not quite sure of how to use these, what arguments they take and how to define the callback for them.

Any help on how to get started?

Where from do you need to access this info.
You can subscribe to changes of most properties of any object with the addObserver_forKeyPath_options_context_ method.
This might help to understand what is going on:


Thanks for the link Georg. Got it working from a general plugin.

Been trying to understand the same thing for some time (subscribing to changes in kerning) but still feel pretty confused. Could you please explain it a bit for dummies who don’t speak C?

I found this example which more or less makes sense, but can’t figure out how exactly to implement it. I suppose GSFont should be object and kerning — path?

Yes. The font is object and 'kerning’ is the path.