Microsoft Typography | Developer information | Specifications | OpenType font development
Arabic OpenType Specification | Terms | Shaping | Features | Other | Appendix

How the Arabic shaping engine works

The Uniscribe Arabic shaping engine processes text in stages. The stages are:

  1. Analyzing the characters for contextual shape.
  2. Shaping (substituting) glyphs with OTLS (OpenType Library Services).
  3. Positioning glyphs with OTLS.

The descriptions which follow will help font developers understand the rationale for the Arabic feature encoding model, and help application developers better understand how layout clients can divide responsibilities with operating system functions.

Analyzing the characters

The unit that the shaping engine receives for the purpose of shaping is a string of Unicode characters, in a sequence. The contextual analysis engine determines the correct contextual form the character should take based on the character before and after it. The contextual shape maps to an OTL feature for that form (isol, init, medi, fina).

Additionally, during the analysis process, the engine also verifies valid diacritic combinations. For additional information see Other Encoding Issues; 'Handling invalid combining marks' in this document.

Shaping with OTLS

The first step Uniscribe takes in shaping the character string is to map all characters to their nominal form glyphs (e.g. the glyph for U+0627). Then, Uniscribe applies contextual shape features to the glyph string.

Next, Uniscribe calls OTLS to apply the features. All OTL processing is divided into a set of predefined features (described and illustrated in the Feature section of this document). Each feature is applied, one by one, to the appropriate glyphs in the syllable and OTLS processes them. Uniscribe makes as many calls to the OTL Services as there are features. This ensures that the features are executed in the desired order.

The steps of the shaping process are outlined below. Not all of the features listed apply to all Arabic script languages.

Shaping features:

  1. Language forms
    1. Apply feature 'ccmp' to preprocess any glyphs that require composition or decomposition. For example, 'alef' followed by 'hamza above' may be composed into 'alef with hamza above'.
    2. Apply feature 'isol' to get the isolated form of characters.
    3. Apply feature 'fina' to get final form glyphs.
    4. Apply feature 'medi' to get medial form glyphs.
    5. Apply feature 'init' to get initial form glyphs.
    6. Apply feature 'rlig' to compose any mandatory ligatures, like 'lam alef'.
    7. Apply feature 'calt' to apply any desired alternative forms of connections. This can provide type designers with the capability to contextually exchange a glyph to give a better calligraphic presentation.

  2. Typographical forms
    1. Apply feature 'liga' to compose any optional ligatures, like 'lam meem'.
    2. Apply feature 'dlig' to compose any discretionary ligatures.
    3. Apply feature 'cswh' to substitute any swash characters based on context. For example, a swash 'noon' might be used if followed by n glyphs that do not extend below the baseline.
    4. Apply feature 'mset' to apply mark positioning via substitution. This does not produce the best typographic possibilities as would the use of the positioning feature 'mark'.

Positioning glyphs with OTLS

Uniscribe next applies features concerned with positioning, calling functions of OTLS to position glyphs.

Positioning features:

  1. Cursive connection
    1. Apply feature 'curs' to connect cursive font glyphs as appropriate.

  2. Kerning
    1. Apply feature 'kern' to provide pair kerning between base glyphs requiring adjustment for better typographical quality.

  3. Mark to base
    1. Apply feature 'mark' to position diacritic glyphs to the base glyph.

  4. Mark to mark
    1. Apply feature 'mkmk' to position diacritic glyphs to other diacritic glyphs.

this page was last updated 25 February 2002
© 2001 Microsoft Corporation. All rights reserved. Terms of use.
comments to the MST group: how to contact us


Arabic OpenType Specification | Terms | Shaping | Features | Other | Appendix
Microsoft Typography | Developer information | Specifications | OpenType font development