Contextual Substitutions in arabic font

hi all,
how can i replace this theh-ar.medi.alt2
to another theh when followed by lam-ar.medi?54%20PM

sub theh-ar.medi.alt2' lam-ar.medi by theh-ar.medi.xxx;

This should go into calt. I gave the alternate the .xxx suffix in this sample. You need to change that to the actual glyph name of course.

thank you mekkablue, but this code didn’t work, my code here
sub theh-ar.medi.alt2’ lam-ar.medi by theh-ar.medi;
43%20PM 01%20PM 19%20PM

You like to replace theh-ar.medi with an theh-ar.medi.alt2?
Then the code is backwards.

sub theh-ar.medi’ lam-ar.medi by theh-ar.medi.alt2;

From the question you asked , it is unclear which glyph you want to replace with which other glyph. Generally, you need this structure:

sub glyphname1' glyphname2 by glyphname3;

glyphname1: name of the glyph that you want to replace
glyphname2: name of the glyph that follows (the context)
glyphname3: name of the new glyph that should replace glyphname1

Read more about contextual substitutions here:
https://glyphsapp.com/tutorials/features-part-2-contextual-substitutions

hi george, no i want to replace theh-ar.medi.alt2 to theh-ar.medi when it followed by lam-ar.medi

Then this is the code that does exactly what you describe:

sub theh-ar.medi.alt2' lam-ar.medi by theh-ar.medi;

It expects theh-ar.medi.alt2 and lam-ar.medi to be available, i.e., it must come after the medi feature and the feature that inserted theh-ar.medi.alt2. IOW if the glyphs are not there yet, they cannot be replaced.

i know, but why this is not work till now, i have in my font theh-ar.medi.alt2, theh-ar.medi, lam-ar.medi :slight_smile: what i do now hahaha
and this is my all cast and it work prefect :slight_smile:45%20AM 06%20AM 24%20AM 59%20AM

It needs to be in a feature that comes after the feature shown in the screenshot.

wooooooow this is working now mekkablue :slight_smile: thannnnnnnnk you very much

2 Likes