#1 2017-11-06 15:07:02

amerswais
Member
Registered: 2017-11-06
Posts: 1

Problem with certain fonts

I use RenderMetafile to generate pdf from a printout.
the problem raises with certain fonts such as "Traditional Arabic", "Simplified Arabic", etc.

Most of the documents renders OK, but certain letters such as "فا", "تا" renders as an empty box.
the problem does not appear using "Arial" or "Tahoma".

The Code is as follow :

      try
        Doc := TPdfDocument.Create;
        Doc.DefaultPageWidth := Round(Printer.PaperWidth*0.2835);
        Doc.DefaultPageHeight := Round(Printer.PaperLength*0.2835);
        Doc.UseUniscribe := True;
        for p := 1 to Printer.PageCount do begin
          Pg := Doc.AddPage;
          PageMeta := Printer.GetPage(p);
          try
            Doc.Canvas.RenderMetaFile(pagemeta,1,0,0);
          finally
            pagemeta.free;
          end;
        end;
        if FileName='' then
          FileName := 'Report.Pdf';
        Doc.SaveToFile(FileName);
        ShellExecute(Application.Handle,'open',PChar(FileName),'','',SW_SHOWNORMAL);
      finally
        doc.Free;
      end;

P.S.

I found a bug in Synpdf.pas , function TPdfWrite.AddUnicodeHexTextUniScribe :

  if ScriptLayout(Count,pointer(level),pointer(VisualToLogical),nil)<>0 then
    exit;

Fixed As :

  if ScriptLayout(Count-1,pointer(level),pointer(VisualToLogical),nil)<>0 then

Offline

Board footer

Powered by FluxBB