Scaling a diacritic when under specific letters

I have a hebrew font with diacritics. I would like to scale some of the diacritics (make them a bit narrower) when located under certain letters.

Any suggestions on how to do it? I assume I could make a stylistic set, but is there a better way?

Thanks

You need to add narrower mark glyphs and then substitute them contextually. e.g. like this:

sub yodhiriq-hb atnahhafukh-hb' by atnahhafukh-hb.narrow;

Thanks. In Contextual Alternates OK?

You should use a feature that is on by default and that the user can’t disable. So “calt” is not ideal. You can try “ccmp”.

Thank you very much. Works perfectly