#1 2025-05-26 14:54:33

pierangelo.dalben
Member
Registered: 2025-05-26
Posts: 3

Arabic Textout is not rendered correctly on all font supporting Arabic

I'm using VCLCanvas to render TextOut text but I noticed that not all font supporting arabic script are rendered correctly.
For example, while on screen canvas both "Calibri" and "Segoe UI" are producing readable text, on VCLCanvas the Calibri is not good.
With other fonts is even worst.

I'm calling always same TextOut API preceded by SetTextAlign(ACanvas.Handle, TA_CENTER) to change allignment

        if SameText(lTextAlign, 'LEFT') then
        begin
          lDX := lRect.Left;
          SetTextAlign(ACanvas.Handle, TA_LEFT);
        end
        else if SameText(lTextAlign, 'CENTER') then
        begin
          lDX := lRect.Left + (lRect.Width div 2);
          SetTextAlign(ACanvas.Handle, TA_CENTER);
        end
        else if SameText(lTextAlign, 'RIGHT') then
        begin
          lDX := lRect.Left + lRect.Width;
          SetTextAlign(ACanvas.Handle, TA_RIGHT);
        end
        else
        begin
          lDX := lRect.Left;
          SetTextAlign(ACanvas.Handle, TA_LEFT);
        end;

        ACanvas.TextOut(lDX, lRect.Top, lBlock);
        SetTextAlign(ACanvas.Handle, TA_LEFT);


Any idea or is a bug?
Thanks

Offline

#2 2025-05-26 18:29:21

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,020
Website

Re: Arabic Textout is not rendered correctly on all font supporting Arabic

Did you enable UniScribe support?

Offline

#3 Today 08:34:59

pierangelo.dalben
Member
Registered: 2025-05-26
Posts: 3

Re: Arabic Textout is not rendered correctly on all font supporting Arabic

yes
UseUniScribe := True but is not rendered well for all arabic font families, in details some arabic ligatures are rendered in a bad way and the same text with same TextOut api render good on PaintBox Canvas on screen.

I can add a sample is there is a way to add attachment.
Thanks

Last edited by pierangelo.dalben (Today 08:36:30)

Offline

#4 Today 09:06:01

jonjbar
Member
Registered: 2012-12-27
Posts: 39

Re: Arabic Textout is not rendered correctly on all font supporting Arabic

Have you tried to set UseFontFallBack to True and defined a FontFallBackName ?
Here is a list of fallback fonts which should work based on the language:

    Chinese (Simplified): "Simsun" or "Microsoft YaHei"
    Chinese (Traditional): "MingLiU" or "Microsoft JhengHei"
    Japanese: "MS Mincho" or "Meiryo"
    Korean: "Malgun Gothic" or "Batang"
    Arabic: "Tahoma" or "Amiri"
    Hebrew: "David" or "Arial Hebrew"
    Hindi/Devanagari: "Mangal" or "Nirmala UI"
    Thai: "Tahoma" or "LilyUPC"
    Tamil: "Latha" or "Nirmala UI"
    Greek: "Arial" or "Georgia"
    Cyrillic (Russian): "Arial" or "Times New Roman"
    Vietnamese: "Arial" or "Tahoma"
    Bengali: "Vrinda" or "Nirmala UI"
    Ethiopic (Amharic): "Nyala" or "Ebrima"
    Georgian: "Sylfaen"
    Armenian: "Sylfaen"
    Khmer: "Khmer UI"
    Lao: "Lao UI"

Offline

#5 Today 09:35:39

pierangelo.dalben
Member
Registered: 2025-05-26
Posts: 3

Re: Arabic Textout is not rendered correctly on all font supporting Arabic

No, I'm not using FontFallBackName as I the font render correctly on PaintBox.Canvas I'm expecting that the same TextOut render in the same way on SynPDF.VCLCanvas.
More not all words are wrong, just some words depending on the font used. That's a bit wired.

Also for example same text with Segoe UI render correctly in PDF, but testing the same text is not render good with Calibri or "Adobe Arabic". 
All these 3 fonts otherwise are rendered well on display PaintBox Canvas.


jonjbar wrote:

Have you tried to set UseFontFallBack to True and defined a FontFallBackName ?

Last edited by pierangelo.dalben (Today 09:38:14)

Offline

Board footer

Powered by FluxBB