Here is a Kufi-like Arabic script font, and here are most of the main glyphs:
Notice how some of them are extremely similar, only differing by height. Also you'll note that some are similar but differ slightly because they appear at the beginning/middle/end. I am not concerned with the latter, but I am not sure what the former are used for (the ones differing only by height). See these for example:
Those two sets have glyphs differing only by height it seems. The second has 3 which slant upwards, and 3 which are flat. Are these different characters? I have asked some Arabic speakers and they said no, they are not different characters (I am somewhat familiar with the Arabic alphabet). Instead they say it is for "aesthetic purposes". But they didn't explain how the font chooses which one out of the 3? How does the font decide (roughly speaking) which one to choose, if it's purely aesthetic?
Then this next image has a vertical line, one which is straight, and one which is slightly curved. Is this the same situation here?
My goal is to take these SVGs and turn them into JavaScript, so I can stretch the horizontal aspects of some of the letters dynamically (by scaling the SVG path definition). So I am not sure how I should make use of the 3 glyphs in the set, for these examples. Do I just keep 1 and throw out the other 2, or somehow algorithmically decide (or aesthetically but programmatically decide) when to use which variant?
Any help would be appreciated in understanding what the purpose of these seemingly aesthetic variants are, and how to take advantage of them.
If it is purely an aesthetic thing, I don't understand how you would select between the aesthetic variants. How does that work in a font even?