#1 2022-06-26 14:21:43

shragam
Member
Registered: 2013-07-01
Posts: 24

RightToLeft string with numbers or English characters not show correct

Hi
I'm using the last update of the library (download it today).
The is an issue with Hebrew/Arabic string with numbers/English characters inside.
Here is the export code:

procedure TForm15.PdfDocumentClick(Sender: TObject);
var
    ppdf : TPdfDocument;
    pagemeta : TMetafile;
    p : integer;
begin
  Application.CreateForm(tForm16,Form16);
  form16.ADODataSet1.Open;
    ppdf := TPdfDocumentGDI.Create;
    ppdf.EmbeddedTTF:=true;
    pPdf.UseUniscribe:=True;
    form16.QuickRep1.prepare;
    for p := 1 to form16.QuickRep1.QRPrinter.PageCount do
    begin
      pagemeta := form16.QuickRep1.QRPrinter.GetPage(p);
      try
        pPdf.DefaultPageWidth := MulDiv(pagemeta.Width,72,pPdf.ScreenLogPixels);
        pPdf.DefaultPageHeight := MulDiv(pagemeta.Height,72,pPdf.ScreenLogPixels);
        pPdf.AddPage;
        // draw the page content
        pPdf.Canvas.RenderMetaFile(pagemeta,1,0,0);//
      finally
        pagemeta.Free;
      end;
    end;
    ppdf.SaveToFile('c:\temp\PdfDocument.pdf');
    ppdf.free;
end;

for examples if i tried to export the string: יום א 26/06/2022 10:00:02
it exported ok if bidimode is LeftToRight, but wrong if it's RightToLeft as it should be.
Screenshot-1.jpg

If I change the code to

AScriptState.uBidiLevel := 0; 

then it's ok, but still there are other issues like this:

Screenshot-2.jpg

This is how it's looking when

AScriptState.uBidiLevel := 1; 

Screenshot-1.jpg

Any help about create PDF correctly in Hebrew/Arabic ?
Shraga

Last edited by shragam (2022-06-27 05:03:46)

Offline

#2 2022-06-29 05:26:34

shragam
Member
Registered: 2013-07-01
Posts: 24

Re: RightToLeft string with numbers or English characters not show correct

Hi, Any Help about it ?

Offline

#3 2022-06-29 12:47:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,620
Website

Re: RightToLeft string with numbers or English characters not show correct

Is the output from UniScribe correct in the debugger?
(i.e. are the glyph blocks correct?)

Could you try with another font?

Offline

#4 2022-06-29 14:06:35

shragam
Member
Registered: 2013-07-01
Posts: 24

Re: RightToLeft string with numbers or English characters not show correct

ab wrote:

Is the output from UniScribe correct in the debugger?
(i.e. are the glyph blocks correct?)

Could you try with another font?

The output is wrong if UniScribe =true.
If it's false, than the Hebrew/Arabic strings are in reverse order.
This is how I'm working now.  I reverse it and it shows ok, but there are issues with the alignment.

I'm using Times New Roman and Tahoma fonts in the demo.
I changed to Segoe UI with no success.
They are global fonts, it should not happened.
Shraga

Offline

#5 2022-07-05 06:48:20

shragam
Member
Registered: 2013-07-01
Posts: 24

Re: RightToLeft string with numbers or English characters not show correct

Hi ab
Any updates or direction how to solve it ?
Thanks

Offline

#6 2022-07-26 10:12:05

shragam
Member
Registered: 2013-07-01
Posts: 24

Re: RightToLeft string with numbers or English characters not show correct

Hi
Is there any solution for this ?

Offline

#7 2022-07-26 11:00:43

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,620
Website

Re: RightToLeft string with numbers or English characters not show correct

If the Uniscribe API is not correctly computing the output, I don't see how to solve it.

Offline

Board footer

Powered by FluxBB