Change anchor based on following/preceding character

I have an anchor position for this diacritic (pashta) named “post”.

In the event that the pashta is in the middle of a word, I want to anchor it to the anchor “mid top”.

I wondered what the best methodology for doing this.

I managed to get it to work based on the preceding letter, but can I do it for characters following? ie does this work @letters *

Also, are there some examples of UseMarkFilteringSet so that I can understand how this feature works?

Do you understand how UseMarkFilteringSet works in general?

I have tried to understand, but failed :frowning:

currently the pashta should sit where you see it in the cloud unless it is preceeded by any of the glyphs in @AllLetters in which case it should move…

It doesn’t move when I define it like this. What am I doing wrong?

I have managed to get this to work partially. I created a class called “glyphs” to include letters and vowels (that are marks)

@glyphs *

if I delete the hiriq then it works, but I do need it to work when there are other marks on the base glyph.

I don’t see any documentation on how to use the & which is what I think is needed nor much info on UseMarkFilteringSet which might also be needed for this to work here.

for anybody following, I thought I would share my solution.

After spending considerable hours along with a colleague, we came to the conclusion that the best approach was not contextual alternatives since frankly we couldn’t work out how to use it! We suspected that we had to use the & in some way, but we couldn’t work out how! We suspect that this feature works better for Arabic…

Instead, I duplicated the pashta and created pashta.001 with a different anchor and then created a calt feature and added the simple code:

sub pashta-hb' @letters by pashta-hb.001;

I hope this helps anybody else trying to achieve the same thing with Bible typesetting.

The conceptual anchos do not prefer a script over the other. So it is perfectly possible for Hebrew.
What anchor do you have in the “pashta”? Be default, it should have a “_topleft”. That is OK. Then you need to rename your context anchor to “*topleft.post” (the part after the period is up to you, can contain ascii letters and no spaces).
then the * @AllLetters should work.

1 Like

well it’s not working so clearly I have done something wrong.

in the pashta, I have an anchor called _post

in the base glyph, I have an anchor called post.

I have no added an anchor in the base glyph called *post.alt

And the anchor context is * @glyphs.

It only works if I remove any other marks that will be on the base glyph.

here it doesn’t work because of the dot under the base mark:

but if I remove the dot (hiriq-hb) then it works:

That is what the “UseMarkFilteringSet” is meant for. It would be good if you make yourself with the Fea spec.

Because other marks can get into the way of the context, you can tell a lookup to ignore marks. But that would also ignore the pashta. So we need to “filter” the marks that we what to ignore. In this case the pashta. So the context needs to be like this:

lookupflag UseMarkFilteringSet [pashta-hb]; * @AllLetters
1 Like

Firstly thank you very much for the answer! This is of course worked.

If I understand correctly, the moment we use “UseMarkFilteringSet” it automatically ignores ALL glyphs that are defined in the font as “marks” and then only consider what is in the square brackets?

So it’s saying in effect: Ignore all marks that might be attached to the base glyph or any other glyph, but please take into account any marks that are specified? Have I understood that correctly?

Now in order to do it this way, I would have to add an alternative anchor to all my base glyphs. Why is this more efficient in the code than creating a second pashta-hb with an anchor that already uses an anchor on the glyphs and using a calt? I ask because my plan is to create a font with all the Hebrew diacritics along with avoiding collisions and I know that memory will be a huge issue so I want to make sure my code is as efficient as possible.

You also wrote, “It would be good if you make yourself with the Fea spec.” Not sure what this sentence means. Could you elaborate?

Pretty sure he meant to say, “Make yourself familiar with…”

One thing slightly off topic: you do not need to set your marks to zero width yourself, Glyphs does this automatically at export for all glyphs that have category Mark, subcategory Nonspacing.

Keeping the sidebearings positive in the Glyphs file makes for easier editing.

2 Likes

okay, so I should be familiar with the Features set? Fortunately I am to a good extent :slight_smile:

1 Like

I am continuing with my project and I think I fully understand the lookupflags now, well at least my font is working so I guess I do.

Your code above has been extremely useful and I have added it and it works great.

However, I have one mark that behaves in the opposite way: At the beginning of a word it’s supposed to hang off the right edge (this is a ltr font) but just like in the example above, in the middle of a word, it’s supposed to be centered.

I thought I could simply write:

lookupflag UseMarkFilteringSet [telishagedola-hb]; @letters *

ie, if there is a letter before, then use the anchor *pre.middle which I have positions in the middle. Can this trick not be used here?

You can shift your marks with a contextual pos rule. This is how you would express it in feature code.

You can also add a duplicate of an anchor with a prefixed asterisk and type the context in the field that appears when the anchor is selected. I believe this only works with static fonts though.

Should work for Variable fonts.

1 Like