Scalabium Software

SMReport Autogenerated
Knowledge for your independence'.
Home Delphi and C++Builder tips


#68: How can I use a resident font for printing? (part 2)

If you want to print a data on printer with max speed, you must print with resident font which installed in your printer.

At first, you must receive the handle of font (using the Windows API's GetStockObject function with DEVICE_DEFAUL_FONT parameter).

After that you must assign this handle to font handle of printer canvas.

procedure TForm1.Button1Click(Sender: TObject);
var
  tm: TTextMetric;
  i: Integer;
begin
  if PrintDialog1.Execute then
  begin
    Printer.BeginDoc;
    Printer.Canvas.Font.Handle := GetStockObject(DEVICE_DEFAULT_FONT);
    GetTextMetrics(Printer.Canvas.Handle, tm);
    for i := 1 to 10 do
      Printer.Canvas.TextOut(100, i*tm.tmHeight + tm.tmExternalLeading, 'Test string');
    Printer.EndDoc;
  end;
end;


Published: March 9, 2000

See also
 
Word Web-stream
DBExport tools
Paradox to Text converter
DBISAM Viewer
Database Information Manager
DBISAM Password Recovery
Viewer for TNEF-files (winmail.dat)
Clarion to Text converter
Paradox Viewer
Protected Storage Viewer
 
 


Contact to webmaster

 

Borland Software Code Gear Scalabium Delphi tips

Copyright© 1998-2024, Scalabium Software. All rights reserved.
webmaster@scalabium.com

SMExport/SMImport suites