Microsoft Uniscribe renderer behaviour for kerning and Arabic marks

Hey all,

a question about the MS renderer.

I’m debugging an Arabic font, and in the sequence رّكك the Shadda on the final Reh “moves” with the kerning between final Reh and initial Kaf. By "moving" I mean as I type Reh + Shadda the mark is placed correctly, but as I continue to type Kaf the kerning between Reh and Kaf is applied, but the Shadda gets "pushed to the right" by as much as Reh and Kaf are (negatively) kerned.


Here a couple of fonts in Microsoft Word for Mac 16.16.5; the bottom one being the font I'm debugging.


I tested further, and to my astonishment it seems that any mark “moves” like this, affected by kerning when its base glyph is kerned against something to follow. In the font I am testing, final Reh and initial Kaf have their overlap kerned, so the Kaf arm slides nicely over the Reh. When I looked how some other fonts avoid the marks moving with kerning I found that e.g. in this example initial Kaf simply had a negative right sidebearing; makes sense to do it like this in the first place.

What does not make sense to me is why the renderer would behave like this. Applying kerning, but pushing the marks above kerned pairs to the side from their original place above the base glyph. Is my font buggy, or is this really the renderer “working as intended”?

Anybody have insights to this or encountered a similar issue with Word or other Microsoft programs?

Comments

  • I'm not sure how your OpenType features are formed but is it possible that the lookup flag in your kerning features is not set to ignoreMarks?
  • Johannes Neumeier
    Johannes Neumeier Posts: 377
    edited October 2020
    I'll definitely double check that, but this happens only in Microsoft programs. Mac, Adobe, Fontgoggles, they all render the kerning and marks without any weird issues. If it were the lookup flag it should happen throughout all programs, I reckon.

    Edit: IgnoreMarks is there, so it's not that.
  • How about changing the order of mark and kern features? Sometimes the order of features can make them work differently across different engines.
  • John Hudson
    John Hudson Posts: 3,186
    Yes, my first thought is lookup ordering. The recommendation I always had from Microsoft is that GPOS should be ordered curs -> kern -> mark -> mkmk.
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Thanks All for discussing this issue.
    Hope this post will shed light on the fallacy of auto-controlling of the three variables of dynamic Arabic typefaces, namely kerning, dot-positioning and mark-positioning that go on changing with different letters, ligatures and sizes. That's right: The problems of Arabic Typefaces are solved nowhere save by our unique tool, namely QalamBartar elaborated by the files attached at my Telegram Channel: https://Telegram.org/ > https://T.me/FonJawi/5 .
    Happy exploring with Flowers https://T.me/FlowerCrosswords
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Sorry! Doubled post.
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Sorry! Doubled post.
  • Huge thanks @Bahman Eslami and @John Hudson - spot on. It didn't even occur to me that their order might matter for the renderer, but I can follow the implicit logic here :|
    I'm using fontmake in this production and it semi-automates the generation of those features. I'll have to do some more debugging to establish if it is something we are additionally doing to the features or if it is an issue with fontmake itself.
  • Either way, order of application of lookups should not differ between shaping engines. Something else is wrong.
  • John Hudson
    John Hudson Posts: 3,186
    Either way, order of application of lookups should not differ between shaping engines. Something else is wrong.

    Yes, it isn't that the different engines are applying the lookups in different order, but that they have different interpretation of the lookups, producing different results depending on the ordering.

  • Simon Cozens
    Simon Cozens Posts: 740
    edited October 2020
    If you can subset the font to a minimal set of glyphs to show the problem (ideally with pyftsubset) and attach it to a Harfbuzz issue I can take a look at it.
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Samples speak louder than words?!
    With the said couple of fonts, I would like to see how kerning and mark-positioning go if the letter R (ر) in the above sample is replaced with the letter Z (dotted R =ز).

  • @AzizMostafa AzizAli That rather speaks to the quality of the design, but does not help debug the issue I was facing and have since resolved. The mark attachment and kerning for ر and ز are not technically different.
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    @AzizMostafa AzizAli That rather speaks to the quality of the design, but does not help debug the issue I was facing and have since resolved. The mark attachment and kerning for ر and ز are not technically different.
    Resolved even in case the letter Z (dotted R) comes with Shadda (ـّ) plus additional mark as usually encountered so, as shown in the attached sample in which I have to shift Z down for the top font and apply different kernings for the bottom one, too?

  • Small tashkil can cover a multitude of problems. ;-)
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Small tashkil can cover a multitude of problems. ;-)
    Wherever tashkil problem is encountered, I recommend making use of the wide Kaf (ك) shown in this image to one of QalamBartar fonts ( https://Maryamsoft.com/QalamBartar/ ).

  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Sorry! Doubled post.
  • Johannes, if you want to know whether this display is the result of a problem specific to MS Word, simply paste the same text into TextEdit—macOS has decent OT processing.

    If I were to guess what is happening based on the display, as well as your explanation, I would say that the Shadda is first positioned on the Reh, then kerning is applied to Reh-Kaf, causing the Reh to shift leftward and leave the Shadda behind. 

    To verify what is really happening, test your text & font in the Crowbar application. It will show you which lookups (under which features) have been activated in which order during the substitution and positioning stages. 
  • In my post, the last line should have read:

    ...activated in which order during the substitution and positioning stages.
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Kindly, have a look at the next post.

  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020

    Hi Dear Friends,
    Hope the coming Arabic typefaces will not only go with AppleMac and Microsoft tools like Word, Adobe Indesign, Photoshop, Illustrator, and CorelDraw, but they will also support more Arabic-based scripts like Persian, Pegon http://Nonosoft.jifisa.net/contoh-huruf-jawi-pegon/, Malay Jawi http://www.Jawiware.org/, Gundul, , Urdu, Pashto, Sindhi, Saraiki, Kazakh, Uyghur, Punjabi, Khowar (Chitrali), Balochi, Brahui, Kurdish, Kashmiri (Koshur), Kirghiz, Ozbek, Turkmen, and Gawri (Kalami) as well.

    Needless to say, most of the above-mentioned right-to-left scripts are not supported; neither by AppleMac nor by Microsoft, and to handle all of them with ease, there is no tool like QalamBartar with its increasing number of unique and dynamic typefaces that can be explored here https://Maryamsoft.com/QalamBartar/ > https://maryamsoft.com/fontshop/

    All the Best for All with Flowers https://Typedrawers.com/discussion/3631/Flying-High-Quranic-Arabic-Jawi-Pegon-Gundul-Fonts

  • @AzizMostafa AzizAli Not sure if something is lost in translation here, but while it is good of you to post illustrative examples of these mark designs and how they are placed in these examples it mostly feels like you are intentionally spamming this topic with self promotion. Maybe you focus more on how you approach the technical or design aspects of these in a way that will benefit readers of this topic.
  • @AzizMostafa AzizAli Not sure if something is lost in translation here, but while it is good of you to post illustrative examples of these mark designs and how they are placed in these examples it mostly feels like you are intentionally spamming this topic with self promotion. Maybe you focus more on how you approach the technical or design aspects of these in a way that will benefit readers of this topic.
    Self promotion is extremely important in fontdevelopment, as it can be used to directly focus the attention to the official website.
  • Self promotion is extremely important in fontdevelopment, as it can be used to directly focus the attention to the official website.
    Nothing wrong with that. Self promotion as answer to someone asking for advice is what rubs me wrong.

    It's probably in the spirit of 2020 that I cannot tell if you are being sarcastic about the "official website" or not. Aziz posted links to a commercial product.

  • According to the rules, self-promotion is not a problem, as long as it's not off-topic. I understand the solutions Aziz has shown are interesting but they're not addressing the issue of the topic. Aziz, please stop doing this, as it's not the first time and it's spamming the type drawers threads!
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Aziz, please stop doing this, as it's not the first time and it's spamming the type drawers threads!
    Should I stop illuminating TypeDrawers not to waste their time going on digging holes and filling them?! Or should I stop short-circuiting the system with the Ten commencements of Arabic fonts?! https://typedrawers.com/discussion/comment/38001#Comment_38001

    All the Best for All with Flowers
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited October 2020
    Aziz, please stop doing this, as it's not the first time and it's spamming the type drawers threads!
    Should I stop illuminating TypeDrawers not to waste their time going on digging and filling holes?! Or should I stop short-circuiting the system with the Ten commandments of Arabic fonts?! https://typedrawers.com/discussion/comment/38001#Comment_38001

    All the Best for All with Flowers
  • John Hudson
    John Hudson Posts: 3,186
    While I am sympathetic to pointing out the limitations of particular technologies such as OpenType Layout and inconsistencies in the implementation of those technologies, if this just take the form of repetition of ‘My software does it right’, I don’t think that helps move discussion forward. This is a thread specifically about OpenType fonts and rendering, and how to get the desired result in that technology.
  • AzizMostafa AzizAli
    AzizMostafa AzizAli Posts: 103
    edited November 2020
    While I am sympathetic to pointing out the limitations of particular technologies such as OpenType Layout and inconsistencies in the implementation of those technologies, if this just take the form of repetition of ‘My software does it right’, I don’t think that helps move discussion forward. This is a thread specifically about OpenType fonts and rendering, and how to get the desired result in that technology.
    Even if the Arabic OpenType fonts technology needs fixing by a complementary tool that does not sacrifice the exchangeability of files across the various apps by AppleMac, Microsoft and Winsoft like Word, Adobe Indesign, Photoshop, Illustrator, and CorelDraw?!
    So, when it comes to the Arabic OpenType fonts technology, which tool counts?
    Best compliments to All with Flowers
  • So, when it comes to the Arabic OpenType fonts technology, which tool counts?
    Best compliments to All with Flowers
    You can make Arabic OpenType fonts with almost any font tool. I make mine with a text editor.

    You are still spamming. Stop it.