Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » Problem wiht non english text drawing

This thread is locked; no one can reply to it. rss feed Print
Problem wiht non english text drawing
Mustafa S.
Member #14,185
April 2012
avatar

hello everyone..
I have an issue with text rendering in allegro 5.1 .. I'm running this under linux ubuntu 12.04

the result should be

مرحبا

I included snapshots for a correct rendering and the rendering I'm getting from allegro..

I'm not sure how to fix this and if this bug is from the library being used in allegro..

thanks

Elias
Member #358
May 2000

Allegro's ttf addon has no rtl support right now. Could that be the problem?

--
"Either help out or stop whining" - Evert

Peter Wang
Member #23
April 2000

We would also need a smarter way to convert the string into glyphs, I think, due to the different letter forms depending on where they appear. Do we need to create an addon using Pango?

edit: attached test programs for fun. One using the pango-cairo backend, one using pango-freetype backend.

Mustafa S.
Member #14,185
April 2012
avatar

thanks for the response guys..

@Ellas
I don't think that is the problem..

from the way I understand how arabic character are encoded..

there are 4 or less representation for the same character

for example م which is M in english pronounced "meem"

Isolated ( م ) UFEE1
beginning of the word ( مـ ) UFEE3
middle of the word ( ـمـ ) FEE4
end of the word ( ـم ) UFEE2

and from what I believe that all representations are included in utf8

so when rendering م the render library should render it as different latter based on it's position in the word ,, but based on the result it's always maps م to UFEE1 without caring about it's position..

@Peter can you attach a snapshot.. it seems that I'm having a hard time compiling the code not knowing what to include.. :/

thanks again guys for the help.. I just want you to know I'm just pointing this out and it's not that important for me.. :D but it's always fun to share problems & solution.. ;D

Peter Wang
Member #23
April 2000

Attached screenshots. To compile you need something like:

gcc ex_pango.c $(pkg-config --cflags --libs pangocairo allegro-5.0)

The second one uses a feature from Allegro 5.1, and you need pangoft2 instead of pangocairo.

Mustafa S.
Member #14,185
April 2012
avatar

@peter thanks..
and woow it's working as I see from your shapshot..
so does this mean the problem is with allego draw text..??
again I had no luck compiling the code maybe because I'm missing the dev lib or the lib it self.. I'm running ubuntu 12.04 what package should I install..
and I wondering will allegro fix this issue in later versions and is this problem platform dependent or independent thanks again.. :D

@Ellas.. I generated the the assembly code for my program.. and it seems that the string stored in memory as
.string "\331\205\330\261\330\255\330\250\330\247" (this is in octal)
that means م is represented by \331\205 always even if it's in middle, end, beginning or isolated it has a fixed representation.. and it depends on the rendering lib to care about it's position and render it correctly according to it's position

Peter Wang
Member #23
April 2000

Exactly. The Allegro TTF addon is not smart enough for complex scripts. It just draws each code point one at a time from left to right, so for Arabic there are at least those two problems to solve. I would like Allegro to have a built-in solution, but in general it will be too much work to do it ourselves. That's why I'm thinking about a new addon using pango. It would not replace allegro_ttf, which is sufficient for many users and probably easier to install on platforms other than Linux.

I don't use Ubuntu but if you search for pangocairo you should be able to figure out the packages.

Go to: