Search code examples
htmlc++csswebkityocto

Problem with displaying arabic font on webkit


I'm trying to display Arabic characters on webkit with a custon font but I have some issues with connections between characters.

I'm working with an embedded Webkit version in my c++ code and have a HTML page that show arabic sentence.

When I open my HTML page on my computer (Windows10 - Chrome/Mozilla), arabic is correctly displayed with or without applying a custom font.

I also tried on my VM (Debian - Mozilla) and it work the same at the exception that the default arabic font looks different.

On my target (Yocto - Webkit), default font is the same as default on my debian, but when I try to apply a custom font, all character are separated, but still print in the right way (From right to left for arabic).

"charset=utf-8" is present in my HTML head

I configure my webkit with utf-8 encoding:

WebKitWebSettings*  WebSettings = NULL;
    g_object_set(WebSettings, "default-encoding", "utf-8", NULL);

Here is difference between with and without custom font on my target https://i.sstatic.net/YehTC.jpg

I'm not very experimented with encoding, and I don't know if this is the real source of my problem. May it be something else to configure in my OS or in Webkit to support correctly arabic content ?


Solution

  • Looks like all fonts aren't compatible with my OS but I succeed to use some: SEGOUI.tff and Simplified Arabic Fixed.

    To do so, I have to install the font on my OS. (copy/paste the font into /usr/share/fonts/truetype/Myfont.tff)

    Before that my font was copied next to my HTML file and my HTML file was using the .ttf to add the font. Now that the font is install on my OS, I just need to use the font name in font-family to make it work.

    Hope it can help some :)