0

This is a follow-up of this question. I'm interested by different glyphs for the same character, also known as "Unicode Compatibility Characters".

Let's take the following two Arabic "reversed-character" words: كلمة ةملك

First word is:

كلمة

in hex code:

0643 0644 0645 0629

Second word is:

ةملك

in hex code:

0629 0645 0644 0643

If I paste those two words in Microsoft Word using Deja Vu Sans, I get this:

Word

With the following pseudo-code using FreeType2, I get:

FT_Face face;
FT_New_Face(library, "DejaVuSans.ttf", 0, &face);
FT_GlyphSlot slot;
FT_Load_Char(face, each_character, FT_LOAD_RENDER);
slot = face->glyph;
//Use slot->bitmap.buffer
FT_Done_Face(face);

Implementation

What am I missing? How can I have the right glyphs depending of the context?

My key issue is that I store each "character" (I should say glyph - but for me, character was equivalent to glyph) in a table so it's going to be complicated. I'm limited in speed, not in space. Can I have two different unicode characters for the same logical character?

gregoiregentil
  • 1,793
  • 1
  • 26
  • 56
  • From your link: _Contextual glyphs or forms These arise primarily in the Arabic script. Using fonts with glyph substitution capabilities such as OpenType and TrueTypeGX, Unicode conforming software **can substitute the proper glyphs** for the same character **depending on whether that character appears at the beginning, end, middle of a word or in isolation**._ And _Arabic Letter Kaf_ has all those forms: Isolated, Final, Initial, Medial… – JosefZ Jun 25 '21 at 05:54
  • Those are ﻙ U+FED9 Arabic Letter Kaf Isolated Form, ﻚ U+FEDA Arabic Letter Kaf Final Form, ﻛ U+FEDB Arabic Letter Kaf Initial Form, ﻜ U+FEDC Arabic Letter Kaf Medial Form. – JosefZ Jun 25 '21 at 06:05
  • libraqm gives me the glyth of a character in a sentence and I can then use FT_Load_Glyth. But is there a simpler way to get the 4 glyths of each Arabic character to bypass libraqm? Do they follow in the same order for each character? And how to get the first one? – gregoiregentil Jun 25 '21 at 06:27

1 Answers1

0

libraqm is a solution to get the glyth for each character depending of its position in the sentence. But I'm still interested to get the character corresponding to the glyth (I know it's not a 1-to-1 relation). For instance, there are 4 characters for the 4 glyths of the letter Kaf as stated in the comment above.

gregoiregentil
  • 1,793
  • 1
  • 26
  • 56