Hello all,
for fontsetting, i use a Label with different 
fonts for many tests.

Procedure TForm1.Button1Click(Sender: TObject);

var
  px, py : Integer; // position for printing
  dx, dy : Integer; // dpi from printer

  function setxy(x: Integer; d: Integer): Integer;
  begin
    Result:=Round(( x / 25.4 ) * d ); // Result in mm
  end;
  
begin
  If PrintDialog1.Execute then
  begin
    dx:=Printer.XDPI;
    dy:=Printer.YDPI;
    Printer.BeginDoc;
    Printer.Canvas.Font:=Label1.Font;
    Printer.Canvas.Font.Size:=8;
    Printer.Canvas.Font.Color:=clBlack;

{
    // For testing only    
    ShowMessage('XDPI= '+IntToStr(dx)+#10#13+
                'YDPI= '+IntToStr(dy));
    Printer.EndDoc;
    Halt;
}
        
    px:=setxy(20, dx); // 20 mm
    py:=setxy(20, dy); // 20 mm   
    Printer.Canvas.TextOut(px, py, 'WWW   iii');
    
    px:=setxy(20, dx); // 20 mm
    py:=setxy(30, dy); // 30 mm   
    Printer.Canvas.TextOut(px, py, 'iii   WWW');
    Printer.EndDoc;
  end;
end;  

Regards Th. Moritz

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to