You are not logged in.
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
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 (2025-05-28 08:36:30)
Offline
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
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.
Have you tried to set UseFontFallBack to True and defined a FontFallBackName ?
Last edited by pierangelo.dalben (2025-05-28 09:38:14)
Offline
Any one is able to check if I provide a sample code? Because I don't understand why the problem raise only with some fonts.
Thanks
Offline
My guess is that it comes from the fact that Font substitution is not fully implemented yet with UniScribe: the font should contain all needed glyphs.
Offline
The weird thing is that the 3 fonts used contain all the required glyphs. My test was to render the same text with 3 different fonts on both screen canvas, TPaintBox.Canvas on my test, and also on PDF on VCLCanvas.
As the text is the same and render correctly on the screen, I was expecting the same results on the PDF.
"Segoe UI" rendered correctly on both screen and pdf, while "Calibri" and "Adobe Arabic" rendered correctly only on screen and on the PDF presents defects on some words, not the same but different wrong words ligature depending on the font. If the pdf engine of the TextOut used to render on canvas I would expect to archive the same result.
Text used is the following one, but If you have time I can send by email the small test app I made to do the test.
عند تجاوز قيمة الفاتورة
أكثر من 50 درهم سوف يتم تحصيل
مبلغ (3 دراهم) غير مستردة
لصالح بنك أبوظبي الأول
نظير استخدام منصة
الدفع الرقمي الموحدة
لحكومة أبوظبي (سداد أبوظبي)
Offline