Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Issues while displaying Indian text (Malayalam)  (Read 3798 times)

0 Members and 1 Guest are viewing this topic.

Suhair Zain

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Issues while displaying Indian text (Malayalam)
« on: November 03, 2015, 12:25:35 pm »
Hi,
I'm trying to display a UTF-8 encoded malayalam text obtained from Wikipedia which is as follows: ദയവായി ഈ താളിലെ വിവരങ്ങൾ തർജ്ജമ ചെയ്യരുത്

This is how it is supposed to be displayed (screenshot from Firefox):


How it is actually displayed:


I had installed SFML using the libsfml-dev package in ubuntu, as described in http://www.sfml-dev.org/tutorials/2.0/start-linux.php.
The version, as obtained by dpkg -s is 2.1+dfsg-4ubuntu2

I spent a whole day on figuring this out to no avail. Could you help me out? The 1.6 version had a characterSet option (http://www.sfml-dev.org/tutorials/1.6/graphics-fonts.php). Was it removed in this version?

Following is my code:
Code: [Select]
sf::Font font { };
//sf::Uint32 mlCharset[] = {0x0d01, 0x0d02, 0x0d03, 0x0d04, 0x0d05, 0x0d06, 0x0d07, 0x0d08, 0x0d09, 0x0d0a, 0x0d0b, 0x0d0c, 0x0d0d, 0x0d0e, 0x0d0f, 0x0d10, 0x0d11, 0x0d12, 0x0d13, 0x0d14, 0x0d15, 0x0d16, 0x0d17, 0x0d18, 0x0d19, 0x0d1a, 0x0d1b, 0x0d1c, 0x0d1d, 0x0d1e, 0x0d1f, 0x0d20, 0x0d21, 0x0d22, 0x0d23, 0x0d24, 0x0d25, 0x0d26, 0x0d27, 0x0d28, 0x0d29, 0x0d2a, 0x0d2b, 0x0d2c, 0x0d2d, 0x0d2e, 0x0d2f, 0x0d30, 0x0d31, 0x0d32, 0x0d33, 0x0d34, 0x0d35, 0x0d36, 0x0d37, 0x0d38, 0x0d39, 0x0d3a, 0x0d3b, 0x0d3c, 0x0d3d, 0x0d3e, 0x0d3f, 0x0d40, 0x0d41, 0x0d42, 0x0d43, 0x0d44, 0x0d45, 0x0d46, 0x0d47, 0x0d48, 0x0d49, 0x0d4a, 0x0d4b, 0x0d4c, 0x0d4d, 0x0d4e, 0x0d4f, 0x0d50, 0x0d51, 0x0d52, 0x0d53, 0x0d54, 0x0d55, 0x0d56, 0x0d57, 0x0d58, 0x0d59, 0x0d5a, 0x0d5b, 0x0d5c, 0x0d5d, 0x0d5e, 0x0d5f, 0x0d60, 0x0d61, 0x0d62, 0x0d63, 0x0d64, 0x0d65, 0x0d66, 0x0d67, 0x0d68, 0x0d69, 0x0d6a, 0x0d6b, 0x0d6c, 0x0d6d, 0x0d6e, 0x0d6f, 0x0d70, 0x0d71, 0x0d72, 0x0d73, 0x0d74, 0x0d75, 0x0d76, 0x0d77, 0x0d78, 0x0d79, 0x0d7a, 0x0d7b, 0x0d7c, 0x0d7d, 0x0d7e, 0x0d7f};
font.loadFromFile("fonts/ml.ttf");

sf::Text text{};
text.setFont(font);
text.setString(L"ദയവായി ഈ താളിലെ വിവരങ്ങൾ തർജ്ജമ ചെയ്യരുത്");

For additional info, the specification for the Malayalam language is at http://www.fileformat.info/info/unicode/block/malayalam/list.htm, if you need it.
« Last Edit: November 03, 2015, 01:05:33 pm by Suhair Zain »

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #1 on: November 03, 2015, 03:21:42 pm »
Sorry but I can't find what's wrong with what SFML displays... ???
Can you describe the problem precisely?
Laurent Gomila - SFML developer

Rhimlock

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: Issues while displaying Indian text (Malayalam)
« Reply #2 on: November 03, 2015, 04:28:53 pm »
Did you try different fonts or just that one ml.ttf?

Hapax

  • Hero Member
  • *****
  • Posts: 3372
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Issues while displaying Indian text (Malayalam)
« Reply #3 on: November 04, 2015, 01:20:53 am »
The difference I could spot was this:

(the top version was a screenshot of the text posted in this forum in Firefox)

I also translated the text; it amused me.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

Suhair Zain

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #4 on: November 04, 2015, 08:36:15 am »
@Rhimlock I tried all of the fonts listed in the Malayalam Unicode support page, all of them displays it correctly within the browser/PC. To the best of my observation, this issue appears only when displayed using SFML.

I can give you an example of the issues:

1)
The first image shows how that particular set of character is supposed to be displayed(from Firefox). When stored programatically, it's stored in the order in which SFML displays it. But according to the rules of Malayalam (my native language), it's supposed to be displayed in the order Firefox/Ubuntu etc does, as follows:
Firfox(correct display)

SFML(incorrect, displayed without appropriate adjustments)

2)
Here, the three characters in the third image are supposed to be joined to be displayed as a single character as in the fourth image





These issues are repeated throughout the text. If these are some manual adjustments to be done per language, I think I can write something to pre-process the text before displaying it. But if there is some way SFML can already manage this, I won't have to re-invent the wheel. Please help.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #5 on: November 04, 2015, 09:09:22 am »
Ok I see. SFML doesn't support complex text layouts at the moment, it only replaces every single character in the string with its corresponding glyph.

See:
https://github.com/SFML/SFML/issues/246
https://github.com/SFML/SFML/pull/624
Laurent Gomila - SFML developer

Suhair Zain

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #6 on: November 04, 2015, 10:28:41 am »
Okay. So I have to make the changes specified at https://github.com/afiefh/SFML/commit/a09f55d3c3e264f1a66a486dfc098eb6a58dd6c1 right?

I used apt-get to install the SFML libraries. I'll have to download the source from the SFML site, make the necessary changes and build it now. Right?

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #7 on: November 04, 2015, 10:29:49 am »
Right :)
Laurent Gomila - SFML developer

Suhair Zain

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #8 on: November 04, 2015, 02:02:45 pm »
Just a small question:

SFML doesn't support complex text layouts at the moment

Any plans to support it in any upcoming versions? I wouldn't have to go ahead with my own implementation then.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #9 on: November 04, 2015, 02:19:06 pm »
Quote
Any plans to support it in any upcoming versions?
There's a github issue for this feature, so all you have to know is said there.
Laurent Gomila - SFML developer

Suhair Zain

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Issues while displaying Indian text (Malayalam)
« Reply #10 on: November 04, 2015, 06:04:05 pm »
Ok Cool. Thank you.  :)

 

anything