#1 Re: PDF Engine » Problems with Courier New font » 2011-01-31 13:02:22

Arnaud,

I have to (positively) disagree with you.

It is not about users (like me), they have to anyway transfer their problems to their suppliers. When the problem is then understandable to supplier, then it starts to be interesting. And your reaction was - GRREEAATT.

Pavel

#2 Re: PDF Engine » Problems with Courier New font » 2011-01-28 16:34:13

TextOut/TextOutW: I had to look to interfaces, sorry to disturb you.
Thanks for landscape support.
If everybody (every company) would support it's product like you, life would be so much easier.

Many thanks,

Pavel

#3 Re: PDF Engine » Problems with Courier New font » 2011-01-28 10:53:05

1. Look please possibly to printer Orientation
2. SetPDFA1 declaration: it's OK - my mistake
3. Try please following code (VclCanvas/Canvas).
    Maybe it works correct, maybe there is some wrong conversion from Unicode, comments are in source.
    It works the same way for fixed-width and proportional fonts.

procedure TForm3.Button2Click(Sender: TObject);
begin
  with TPdfDocumentGDI.Create do
  try
    AddPage;
    UseUniScribe := true;
    with VCLCanvas do begin
      Font.Name := 'Courier New';
      Font.Size := 14;
      Font.Style := [fsBold,fsItalic];
      TextOut(100, 100,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
      // all characters printed correctly
    end;
    SaveToFile('TestVcl.pdf');
  finally
    Free;
  end;

  with TPdfDocument.Create do
  try
    AddPage;
    UseUniScribe := true;
    Canvas.SetFont('Courier New',14,[fsItalic,fsBold]);
    Canvas.TextOut(100, 700,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
    // ? only characters that exists in range 0..255 prints OK,
    // others with removed signs
    SaveToFile('TestDirect.pdf');
  finally
    Free;
  end;
end;

#4 Re: PDF Engine » Problems with Courier New font » 2011-01-27 22:19:10

Works great through TPdfDocumentGDI.VclCanvas.
There are some buts with TPdfDocument.Canvas that I post with example tomorrow, maybe they are not on your side.
SynPdf: missing SetPDFA1 declaration.

#5 Re: PDF Engine » Problems with Courier New font » 2011-01-27 21:07:19

I download it from code repository, many thanks for your immediate action.

Just a small remark - you have DefaultPaperSize for PdfDocument. I need from time to time also different orientation, i.e. poLandscape and I add it to every new version. Wouldn't it be useful to have it there from you?

I know you tried not to be dependent on Printers unit.

procedure TPdfDocument.SetOrientation(const Value: TPrinterOrientation);
var tmp: integer;
begin
  FOrientation := Value;
  if Value=poPortrait then begin
    if FDefaultPageWidth>FDefaultPageHeight then begin
      tmp:=FDefaultPageWidth;
      FDefaultPageWidth:=FDefaultPageHeight;
      FDefaultPageHeight:=tmp;
    end
  end
  else begin // landscape
    if FDefaultPageHeight>FDefaultPageWidth then begin
      tmp:=FDefaultPageWidth;
      FDefaultPageWidth:=FDefaultPageHeight;
      FDefaultPageHeight:=tmp;
    end
  end;
end;

#6 Re: PDF Engine » Problems with Courier New font » 2011-01-27 12:49:42

You wrote answer when I was writing my another comment.
Greetings to France.
Pavel

#7 Re: PDF Engine » Problems with Courier New font » 2011-01-27 12:46:32

Arnaud,

please, look to my sample code below.

When writing to VclCanvas SEPARATE CHARACTERS (range 32-511), they appear normally.
When writing to VclCanvas the same characters as STRING, they are overwriting each other for codes above 255.

I think this is something between your code and Courier New font and doesn't has to do anything with FontFallBack.

Pavel

procedure TForm3.Button1Click(Sender: TObject);
var
  i, j: Integer;
  s: string;
  ch: char;
  PdfDocumentGDI: TPdfDocumentGDI;
begin
  PdfDocumentGDI:=TPdfDocumentGDI.Create;
  with PdfDocumentGDI do
  try
    AddPage;
    //UseUniScribe := true; {gives error during savetofile}
    with VCLCanvas do begin
      Font.Name := 'Courier New';
      Font.Size := 12;
      for i := 0 to 15 do begin
        s := '';
        for j := 0 to 31 do
          if i*32+j>=32 then begin
            ch := chr(i*32+j);
            s := s+ch;
            TextOut(10+j*20, i*50, ch);
          end;
          TextOut(10, i*50+25, s);
      end;
    end;
    SaveToFile('TestVcl.pdf');
  finally
    Free;
  end;
end;

#8 Re: PDF Engine » Problems with Courier New font » 2011-01-26 18:39:15

Arnaud,

I used version 1.12 from few days ago.

I tried UseUniScribe:=true, no success.

In SynPdf you write:

    // must contain ALL glyphs necessary for the supplied unicode text - squares
    // or blanks will be drawn for any missing glyph/character

My output (either run my example or look to my email with testvcl.pdf) has for writing in COURIER NEW no squares or blanks, it just has 'international' characters overwritten over previous character.

And this is for Czech, Greek and Cyrilic (others I don't know).

I tried also Arabic, and it gives above mentioned squares.

Pavel

#9 PDF Engine » Problems with Courier New font » 2011-01-26 13:47:49

Pavel
Replies: 15

Hello Arnaud,

Your Pdf Engine is a great product.

I use it for more then last half year. At a very beginning I found problem with Courier New font (pdf from example below I send you to email mentioned during registration). Then I used Lucida Console instead, that works OK, but people don't like this font.

I always thaught new version of pdf engine corrects this, that never happend. Now I tried last one, 1.12 and it is the same.

My computer is W7 64 bit, Delphi XE.
I even tried D2007 and WXP 32 bit w.o. success.

Would you be so kind and try to look to this problem?

Thanks,
Pavel

procedure TForm1.btnViaCanvasClick(Sender: TObject);
var
  i:Integer;
  PdfDocumentGDI: TPdfDocumentGDI;
begin
  PdfDocumentGDI:=TPdfDocumentGDI.Create;
  with PdfDocumentGDI do
  try
    AddPage;
    with VCLCanvas do
    begin
      for i := 0 to 9 do
      begin
        Font.Name := 'Courier New';//'Courier';
        Font.Size := 12;
        //Font.Style := [fsBold,fsItalic];
        TextOut(20, 100 + i*40,'Příliš žluťoučký kůň');
        //TextOut(20, 100 + i*40,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
        TextOut(20, 100 + i*40+20,'ερτυθσδφγη йцукенгш asdffghj');
      end;

      for i := 0 to 9 do
      begin
        Font.Name := 'Lucida console';
        Font.Size := 12;
        //Font.Style := [fsBold,fsItalic];
        TextOut(20, 600 + i*40,'Příliš žluťoučký kůň');
        //TextOut(20, 100 + i*40,'áÁčČďĎéÉíÍňŇóÓřŘšŠťŤúÚůýÝžŽ');
        TextOut(20, 600 + i*40+20,'ερτυθσδφγη йцукенгш asdffghj');
      end;
    end;

    SaveToFile('TestVcl.pdf');
  finally
    Free;
  end;
end;

Board footer

Powered by FluxBB