CanvasSetFont

Top  Previous  Next

Prototype

 

CanvasSetFont (intHandle,strName,intSize,boolBold,boolItalic,boolUnderline,intColor)

 

Description

 

Sets canvas font

 

Parameters

 

IntHandle: integer value corresponding to the canvas handle.

 

StrName: string corresponding to the font name.

 

IntSize: integer value corresponding to the font size.

 

BoolBold: boolean value true or false that enable bold character.

 

BoolItalic: boolean value true or false that enable italic character.

 

BoolUnderline: boolean value true or false that enable underline character.

 

IntColor: integer value corresponding to the character color: $000000 (black), $FFFFFF (white), $FF0000 (red), $00FF00 (green), $0000FF (bleu)…

 

Returned value

 

None.

 

Notes

 

None.

 

Example

 

// It selects printer

PrinterSelect('HP LaserJet III');

 

// Start print

if not PrinterStart('Test print',1) then

 begin

   // Abort sprint if there are errors

   PrinterAbort;

   PrinterStart('Test print',1);

 end;

 

//It gets canvas handle

Paper:=PrinterGetCanvas;

 

//It gets print area size and resolution

WidthArea:=CanvasGetHorzSize(Paper);

HeightArea:=CanvasGetVertSize(Paper);

ResHorz:=CanvasGetHorzRes(Foglio);

ResVert:=CanvasGetVertRes(Foglio);

 

// It calculates distance among grid cells to draw

StepV:=HeightArea div 10;

StepH:=WidthArea div 10;

 

// Draw grid

CanvasSetPen(Paper,3,0,$000000);

For L:=0 to 10 do

 begin

  CanvasDrawLine(Paper,L*StepH,0,L*StepH,HeightArea);

  CanvasDrawLine(Paper,0,L*StepV,WidthArea,L*StepV);

 end;

 

// Text draw

CanvasSetFont(Paper,'Arial',18,True,True,True,$000000);

CanvasDrawText(Paper,100,100,'Test print');

 

// End print operation

PrinterEnd;