3

When designing a font for another language in Unicode, how do you change the position of the characters to show up how they need to show up?

Edit: Since the characters don't seem to be showing up for some of you, I am including an image with the text and will reference which line in the image I am referring to when using the characters (Format: [character]/[line number in image])

Gurmukhi characters image

For example, in Gurmukhi, the ਿ/1 (vowel) character should show up before the (consonant) character that it is attached to. For example, when attached to ਸ/2, it shows up as ਸਿ/3. Though it shows up before, the ਿ/1 character is actually after the ਸ/2 character (in terms of how it's stored). You can see this by copying the characters together into another textbox and pressing backspace.

It is notable that it even shifts the character that it is attached to over to create space when needed. See this example: ਨਾਮ/4 and ਨਾਮਿ/5. You can here that it shifts the ਮ/6 character to the right in order to create room for the ਿ/1 character (again, you can see it better if you copy and press backspace).

I have seen other character positions handled with anchors, but those don't seem to apply here exactly. Even for other characters in Gurmukhi, anchors are used to change the character position. For example, the way that the ੁ/7 is supposed to be positioned below a consonant, like so: ਸੁ/8. The way that Unicode fonts handle this is with anchors, but when it comes to the ਿ/1, that is not the case. When opening a Unicode font on something like FontForge, you can see that there is no anchors in the ਿ/1 character (U+0A3F in case you want to see). Also, I've seen that right-to-left languages like Arabic don't have anchors either, so they are probably handled in a different way as well.

But how exactly are these cases handled?

  • 1
    You're example characters don't show using the default font on this page. As far as I can tell I don't have any font on my computer that contains the glyphs you use as an example. They do however show when I view on mobile. – Cai Jun 20 '16 at 20:16
  • I would suggest replacing your examples with images of the glyphs. – Cai Jun 20 '16 at 20:17
  • Thanks for letting me know. I tried to add images, but it says I need at least 10 reputation points to post more than 2 links. I guess I can try to just put them all in one image maybe. – gurs1kh Jun 20 '16 at 20:57
  • I have updated the question with an image and references to that image – gurs1kh Jun 20 '16 at 21:05
  • Not all script features can be expressed in an OpenType font. I can't find my recent comment on a similar question, but the gist of it was that for some complex scripts this needs software assistance. – usr2564301 Jun 20 '16 at 21:44
2

Combining characters and positioning

OpenType fonts have a Glyph Positioning table (GPOS) which is used to provide precise control over glyph placement for sophisticated text layout and rendering in different scripts. The GPOS table can position glyphs in a number of ways.

From the Microsoft OpenType Specification:

The GPOS table supports eight types of actions for positioning and attaching glyphs:

  • A cursive attachment describes cursive scripts and other glyphs that are connected with attachment points when rendered.

  • A MarkToBase attachment positions combining marks with respect to base glyphs, as when positioning vowels, diacritical marks, or tone marks in Arabic, Hebrew, and Vietnamese.

  • A MarkToLigature attachment positions combining marks with respect to ligature glyphs. Because ligatures may have multiple points for attaching marks, the font developer needs to associate each mark with one of the ligature glyph's components.

  • A MarkToMark attachment positions one mark relative to another, as when positioning tone marks with respect to vowel diacritical marks in Vietnamese.

  • Contextual positioning describes how to position one or more glyphs in context, within an identifiable sequence of specific glyphs, glyph classes, or varied sets of glyphs. One or more positioning operations may be performed on “input” context sequences. Figure 4e illustrates a context for positioning adjustments.

  • Chaining Contextual positioning describes how to position one or more glyphs in a chained context, within an identifiable sequence of specific glyphs, glyph classes, or varied sets of glyphs. One or more positioning operations may be performed on “input” context sequences.

The GPOS table in combination with combining characters can be used to create diacritics and other layout combinations.

There are OpenType specifications for the support of scripts that require repositioning and complex layouts, these features should be automatic and implemented by the OpenType layout engine.

An example of how the OpenType layout engine can combine complex Gurmukhi strings:

OpenType shaping engine combining characters

In reality these aren't implemented universally though, Adobe products (all except for Photoshop I believe) for example have a lot of trouble typesetting right-to-left and complex scripts without using specific "Middle Eastern" versions of the software.

References and reading:


Precomposed characters and ligatures

In reality, more complex structures required by some scripts are difficult or impossible to achieve with OpenType positioning and layout features so the character combinations are often precomposed characters or ligatures.

For example, Unicode has a large number of Arabic ligatures, some for whole words and phrases, such as Allah (U+FDF2):

Allah ligature

And bismillah ar-rahman ar-raheem:

enter image description here

As far as I can tell, the Gurmukhi Unicode block doesn't contain any ligatures or precomposed characters, but it is perfectly possible that a font will contain ligatures for certain combinations (I know a lot of Arabic and Bengali fonts do, which are the only scripts other than Latin that I have any experience with).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.