Testing, Spacing, Kerning and Hinting Arabic Fonts

Vladimir Tamari's picture

There is a wealth of experience and documentation about testing, adjusting the spacing, kerning and hinting of Latin type. Arabic has a radically different sript structure - many letters are connected, dots and marks are significant design elements, and there is a lot more variation in the shapes of glyphs within one font. Software like FontLab are geared to Latin fonts for example there is no way to test Arabic using such rules of thumb as the XOX or HOH strategies. You are invited here to share your experience in dealing with these particular aspects of Arabic fonts, with thanks.

AzizMostafa's picture

Behnam, I guess you are of Iranian origin.
If so, I have to say Beh Beh Nam Shoma BehNam
If not, Your thought is a THOUGHT INDEED?!

Vladimir Tamari's picture

That sounds interesting behnam, thanks
ددواورارداداالماا
Can you provide a graphic or screen shot with large-size glyphs and bearings to illustrate your ideas?
Would these rules of thumb depend on the vertical stem thickness of the letters?
In other words would you expand the spaces as the font gets bolder?

behnam's picture

I'm in the middle of moving now. I'll expand this idea when I have time. But until then, suppose this:
FontLab adds an Arabic spacing tool which produce a preview of that string (it has to be expanded and include initial jeem for example).
All characters are initially set at zero side bearing on both sides (where applicable). Then you have a 'master' side bearing glider that you can manually adjust the value of "s" as the value of side bearing. As you increase this value from initial zero, it is applied to all characters of that string with a coefficient number.
That coefficient number would be 1 for right side of all characters (except jeem for which it should be 1/2). And coefficient number for the left side should be zero for all, except reh and waw for which it should be -1 and for alef for which it should be +1/2.
Now as you slide the 'master' spacing line, you stop where that string looks good! That's your spacing!
Aziz you are right. I'm Persian that's why I usually use jeh in my string too, to make sure dots are not messed up!
This is my idea of spacing setting. I usually apply it to all characters, even assorted alefs. But we have not yet discussed in this topic about the 'kerning' part, which I usually use to undue the damage after the spacing is being set.
So this scheme can be applied to any font, regardless of the thickness of the characters. Actually in my experience, bold fonts tend to need less spacing.

behnam's picture


I don't know if this picture can illustrate it or not. It's setting the spacing based on above mentioned scheme, and then do the corrections by kerning. BTW I don't know how to edit previously posted text and this 'undue' in my previous post is getting on my nerves!.. Miss Tiffany, would you please undo the undue for me?!

You may notice that in picture sample, the right side bearing of alef is not following that 1/2 value of "s". It is more. In some other faces, it should be less. The point is that you only have one single variant for spacing which is "s". Then if you had 'side bearing classes' for each, depending the font face, you'd assign certain coefficient for the characters, the spacing adjustment can be controlled by variant "s" on one hand, and occasionally fine tuning the coefficient for side bearing class. I do this by creating normal classes, selecting and increasing and decreasing the side bearing. But it's hard to keep-up with every little changes you do in the value of "s". I often ignore them and later regret!
A tool with those side bearing classes in which you can set the coefficient for the class is, for Arabic spacing, a tool made in heaven! also notice initial Khah (same thing as initial jeem etc.) has reduced spacing on its right. This is because the 'weight' of the character which is toward the left, remain balanced despite the extended line to the right.
The picture is for a sample with and without kerning.
As you see, I use the same spacing for alef with madda above. And madda, particularly in Persian use, can be really substantial! but I ignore it in spacing. Same thing with what in Persian is called 'sarkash' of kaf and gaf. I ignore them in setting spacing and I apply the side bearing based on its base body. Then I do the correction in kerning.
Lately I changed this method in my fonts because most browsers don't support kerning and as you see in the picture, the text without kerning correction can't survive. So now I do apply side bearing with considering 'sarkash' and then in kerning, I apply negative value when applicable. But the first method is better (in a perfect world).
Hope it interest you,
Behnam

AzizMostafa's picture

@ Why not naming your next font after your little daughter, this way you can instill your love of Arabic type in her instead of dividing it :-)

@ As I understand it, Aziz has made an incredible labor of love to create a unique font family (Wurud??)TTF (or OT?) with artistry and precision.
Let us call it a full-course naskh meal by a master chef.
We look forward to the feast.
______________________________________________________________________

Thanks Vladimir Tamari + Saad Abulhab with Flowers

1. My daughter already carries the name of one of the fascinating Styles of Arabic Calligraphy:
http://www.persiaart.net/rayhan/index.asp
http://www.splart.net/forum/index.php?showtopic=9608

2. My discovering of Rayhan.OTF by MaryamSot.com, and their discovering of my uncompromising Arabic Naskh font, we have joined forces — after 5 long meetings — to redo both fonts (Rayhan+Zaynab) and add them afterward to their fantastic MirEmad.

So virtually MaryamSoft will carry the names of my Goldfish+2Flowers: Rayhan+Zaynab.

Vladimir Tamari's picture

Good luck Aziz - I am sure all of us here will be happy to see your fonts succeed in the market and make you and the the fonts' namesakes proud.

Thanks behnam I have been rather busy and only saw your message today - I will study your illustrated explanation carefully.

Vladimir Tamari's picture

behnam, I printed the image and text of your message and will take a little time studying them.
As to deleting the insignificant mistake in your message I would not be unduly worried. Remember the words of your fellow Persian the great Omar Khayyam:

The Moving Finger writes; and, having writ,
Moves on: nor all your* Piety nor Wit
Shall lure it back to cancel half a Line,
Nor all your Tears wash out a Word of it
____________________________
*or Miss Tiffany's?

behnam's picture

That was lovely Vladimir. I only wish I could picture its original wording but I couldn't. But I'll keep looking!
Oh yes, maybe my mistyped issue was a little overstated. It was intended jokingly! Not a big deal at all.

Glad you spend time to study it. It shouldn't be a complicated issue for a coder to figure out how to implement it as a tool. I'm just hopeless in technical matters (among other things!)

Cheers,
Behnam

Vladimir Tamari's picture

I only wish I could picture its original wording but I couldn’t. But I’ll keep looking!

Exactly- one wants to see the verses written in Farsi. There is the famous manuscript at Oxford with the Rubaiyat. Are there any known examples of Omar Khayyam's own handwriting? Also the English I quoted is known to be too freely translated often changing the meaning.

Thanks behnam! Your 'dream software' for spacing Arabic sounds very interesting hope Fontlab is listening. In the sense that it lets you choose the spacing in a proportional way for all glyphs simultaneously, it sounds a lot like one function of DecoType's Tasmeem on InDesign ME. Too bad many programs do not apply kerning, so the only practical way remains to do manual spacing as you showed.

AzizMostafa's picture

> Too bad many programs do not apply kerning, so the only practical way remains to do manual spacing as you showed.

Kerning is a font built-in feature.
It is automatic in Adobe Arabic OTF.
http://typophile.com/node/19609
http://typophile.com/node/20638
http://typophile.com/node/36706
As for the Programs and Programming, say with me:
Happy Kerning with Flowers

behnam's picture

Well, this is my contribution, for however wants to implement it in a tool!

I've been away from Iran too far and for too long to have any relevant information. But my instinct says that if the original manuscript of Khayyam existed, every single Iranian would have known it! In a region with a long history of far too many wars and far too many burnt cities and libraries, it is highly unlikely that we ever see the original manuscript of any great writer. But the manuscript of Oxford library seems to be one of credible references.
http://www.bestirantravel.com/culture/poetry/khayam_old.html
Edward Fitzgerald, as you mentioned, was a poet who made poetry based on his inspiration of Khayyam. I guess this is the best way to put it, and perhaps the only way to translate Persian poetry. Khayyam could not be known in English literary if it was otherwise. So I personally don't see this free style of translation as a fallback.
Even in Persian, it was not uncommon for someone to reproduce the book of a great poet with adding one or two verses of his own, inspired by his greatness! This makes the task of authentication very difficult for researchers. But 'culturally' speaking, this is not considered a forgery. It is considered a tribute to a great poet. If a verse is good enough to be Khayyam, it is Khayyam as far as I'm concerned!

AzizMostafa's picture

> In a region with a long history of far too many wars and far too many burnt cities and libraries, it is highly unlikely that we ever see the original manuscript of any great writer.

Sorry for Behnam! Name any great Iranian writer,
and I will send you the link you miss. Worth Reading:
http://taghrib.ir/english/?pgid=43&scid=39&dcid=42015
Flowers for Peace-loving Nations.

Vladimir Tamari's picture

Of course behnam, Fitzgerald's translation is invaluable because it made the Rubaiyyat famous and it has added its own enjoyable quaint Victorian style. But surely Khayyam's poems deserve a more modern translation, particularly as Fitzgerald has been accused of transforming spiritual ideas into praise for a hedonistic lifestyle.

Aziz I enjoyed your صخرة kerning example. Google is almighty, but can it recreate lost manuscripts?

behnam's picture

This is increasingly getting off topic Vladimir. But in two lines, I'd say both Khayyam and Fitzgerald were praising hedonistic lifestyle, not as a goal, but as a vehicle to express some ideas about freedom of mind. Victorian era might be a good reason for Fitzgerald to be attracted to those ideas. When Khayyam talks about wine, he means that well known alcoholic beverage and not some symbolic medium to some spiritual pleasure that some people claim! These people can not face the fact that this great person was completely ignoring Islamic rules and was following his own mind. But Khayyam meant what he meant. A modern translation can only emphasis this. The spirituality is right there.

AzizMostafa's picture

> ... people can not face the fact that this great person was completely ignoring Islamic rules and was following his own mind. But Khayyam meant what he meant.

Though I am too far from being great but I hope people wont accuse me — after my death — of completely ignoring Islamic rules and following my own mind when they read The Tighter, The Nicer.

Flowers for All

AzizMostafa's picture

>... Google is almighty, but can it recreate lost manuscripts?

Of course No! But can it recreate yet-to-be-documented nicely-handwritten manuscripts that need years of hard work just to be data-based. Know that Google is a new-born and the Iranian nation has just got its independence.

Again Flowers to All.

Vladimir Tamari's picture

This is increasingly getting off topic
..yes of course behnam.I once wondered whether this was OK in Typophile threads and was reassured that it is quite normal to go on all sorts of tangents in discussions. I now realize that part of the value of Typophile is to provide a place to relax from the rigors of font-making. You may well be right about the earthiness of Khayyam's verse - but wine is spirit-ual however one reads it! Still, one likes to see a translation free from Victorian sentimentality and the need to rhyme etc.

Going back to your idea for a spacing scheme I wonder if this is the sort of thing that can be implemented with Python scripts? My hope is that you and others will start new threads here, perhaps 'Arabic Features I'd like to See in Fontlab'. I would start it but do not want to appear to monopolize this space, so please feel free.
I hope people wont accuse me — after my death — of completely ignoring Islamic rules and following my own mind...
Aziz لك طول العمر Long Life to you. I think that each of the thousands of glyphs you designed will be a credited to your account to answer anybody's accusations in this life or the next!

AzizMostafa's picture

And long life with Flowers to VladimirTamari+his household.
May God bless your clicking Finger

Saad Abulhab's picture

Bahnam wrote:

>>If the left side bearing of all glyphs are set to zero, the right side bearing of alef would define the right side bearing of dal, reh waw and all no right joiner glyphs.

I too believe this is the best course in handling spacing. I used this principle in my fonts by divining letters/glyphs (from connectivity aspect) to restricted (no right joiner included) and non-restricted. Restricted get built-in spaces to avoid kerning. Non restricted are set to zero (or more if one design isolated glyph fonts) side bearing.

Bahnam suggestion to build the principle as tool in Fontlab is great one. It would save designers a good time.

-Saad

behnam's picture

Yes, the idea is to minimize kerning by implementing a proper spacing from the get go. My main concern was applications and mediums which don't have sophisticated text rendering. Think of text messaging for example. But also, it seems that kerning chews a lot of CPU activities and slows down the process. I don't have scientific knowledge about it but in my experience it certainly feels that way.
So if we are designing fonts for high end publishing environment, it really doesn't matter. But if the intention is a general purpose font, minimizing kerning to strict minimum is important.
As I said earlier, I'm not a coder and have no knowledge about programming whatsoever. So I can't initiate a topic revolving the design of an Arabic script font tool. This is a very good idea though but it should be initiated by someone who actually intends to make a tool. Then we can all contribute and give our inputs for such project.

Saad Abulhab's picture

Re-reading Bahnam's suggestion, I see that we are probably not talking about the same thing. In my approach, all restricted letters/glyphs get extra spaces: those that do not join on left - like Raa, Dal, waw... - get extra built-in space on the left; And those that do not join at all -like Hamzah - get space on both sides. This would apply to all shapes: initial, isolated and final.

Non restricted letters/glyphs are all the rest of the letters which can be either joined on both sides, one side, or be isolated, like Haa, baa, ayn, Faa, ..etc. These all get zero or one value side bearing. Again, this would apply to all shapes: initial, medial, isolated and final.

Kerning can then be applied to final shapes of restricted and some non-restricted letters like jeem ...etc, depending on style, but it would not be required.

-Saad

behnam's picture

Yes I suspected that we were not applying the spacing the same way. But the point is that if we had an "s" variant and designated coefficient for side bearing classes, we could apply it anyway we want.
Having an equal spacing on the right side of all glyphs (where applicable) would ensure a better spacing (basic) setting for a character like reh, that could use a -1 coefficient for its left side and this cut-off portion would be absorbed by "s" value of the right side of any glyph which might be at the left side of reh. A +1/2 coefficient for the left side of alef (again, as a start) also is an important part of balancing the whole thing.

Saad Abulhab's picture

>>But the point is that if we had an “s” variant and designated coefficient for side bearing classes, we could apply it anyway we want.

Bahnam, Yes, this is the beneficial central point. Both of our approaches recognize the importance of designating "side bearing classes" to simplify the kerning task.

-Saad

AzizMostafa's picture

Arabic is so fonty that if she encounters a sophisticated one such as Kaf, she narrows limbs to push it away but if she encounters a dwarf one such as meem, she lets it penetrate fully to relax. And it is not the (letter) length, not the (fontlab) strength but the resistance (to spacings) that counts!

k.l.'s picture

Behnam, I have a question about this earlier screenshot: Did you just forget to activate the "RTL" button before doing the screenshot, or do you kern Arabic without activating "RTL" mode?

Karsten

behnam's picture

Oh this was just for the pattern demonstration. Kerning if applied in ltr preview will be applied in opposite side of the glyph. I don't know if it functions properly in rtl setting though. Because I made all my sample patterns in ltr setting, I stayed with it. A friend of mine made me a little application that reverse the kerning after the font is made. I vaguely remember that the kerning didn't work properly in rtl setting of the preview either. But this was about the version 4. I don't know about now.

k.l.'s picture

It seems that with FLS5 it works like it should.
There is an 'RTL' button both in the Kerning Window and in the OpenType Feature section of the Preview panel. (Though not in the Preview section of this panel.) Since FLS5's internal logic for kerning and classes goes by "1st and 2nd glyph of a pair" (in RTL mode the 1st glyph of a pair is the right one), FLS5's kerning data can be transformed (almost) 1:1 into OT feature logic, e.g. with kern2volt. So it makes sense to use the Kerning Window's RTL mode when kerning Arabic.

But if you have a workflow with text patterns and tools already, then there's no need for change.

AzizMostafa's picture

"It is not necessary to spend much time on defining sidebearings,
just set them to zero."
You got it Karsten http://kltf.de/kltf_notes_ace1.htm
All the Best with Flowers

piccic's picture

I love this thread… :=)
I will read it in full. But… Flowers? :P

Vladimir Tamari's picture

But… Flowers? :P
There are two types of posts on Typophile, those that are flowerized by Aziz (or Azizified with flowers), and those that are not :) He is an expert font designer with many interesting ideas on Arabic fonts, sometimes expressed rather enigmatically!

piccic's picture

Caleidoscopic… :)

Syndicate content Syndicate content