Contextual Kerning in Hebrew


In the above image which is Hebrew rtl, I want to add kerning between the slash and the letter yod-hb on the left due to the diacritic patah-hb underneath.

however, when I add this code to the kern feature,

# Automatic Code
lookupflag RightToLeft ;
pos slash' 200 yod @wide_vowels;

As you can see it has added space to the right of the slash…

Is there is a solution?

Try the extended notation <xPos yPos xAdv yAdv>: keep all y values at zero; pos means the positioning of the glyph, adv means the displacement of the following cursor position.

So your example would be:

pos slash' <0 0 -200 0> yod @wide_vowels;

The position of slash doesn’t change, but the following cursor position is moved 200 to the left.

Or:

pos slash yod' <-200 0 -200 0> @wide_vowels;

Moves the yod instead (and the following cursor position).

Edit: corrected number values. Thx Janus.

Question: why does the kern pair have to be contextual? You could just do:

pos slash yod -200;

Without the tick mark ('), that is.

The contextual version in your code (pos slash' 200 yod @wide_vowels;) literally means: “if slash appears before a yod, add 200 to its right”

Edit: wrong answer, see below. Thx Janus.

Wouldn’t your code alter the spacing between the slash and any yod? The existing spacing looks right for a yod with no wide vowel underneath it.

And why negative -200 if the purpose is to loosen the space?

Yes, you’re right! I overlooked the vowels class in the context. Okay, then a simple pair adjustment doesn’t make sense.

And you’re also right about my positive/negative confusion. I’ll edit the examples above.

okay, I played around and the answer was the following:
pos slash yod' <0 0 50 0> @widevowels;

200 was obviously a little too much :slight_smile:

Thank you!

I wonder why this kerning is only applied when the vowels are there? Wouldn’t it be needed without them?

The slash tucks nicely under the yod-hb character without the vowels, but honestly, I am trying to learn as much as possible because I eventually want to do a font with cantillation marks which is far more complex.

Currently I solve the problem of cantillation marks with a program that I had made that creates a massive search and replace which can take hours to run on a large text.

That should be build into the font. Your tool should has all the info it needs to generate the feature code. So you can set up the groups like you showed in the video. But instead of applying it to the text in Indesign, you generate the fea code, add it to the .glyphs file and export the font (Testing your fonts in Adobe apps | Glyphs).

That is definitely one plan.

However, its current 1,300 lines of code and it’s not organized efficiently which makes editing the code impossible.

I’m tempted to start again especially if I want to kern the font.

I have to give it a lot of thought.