The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Unit: SDL_sdlbase
Class: none
Declaration: procedure SetCanvasFontSizeScaled (const Canvas: TCanvas; FontSize: integer);

Setting the font size of a canvas which exhibits a pixel resolution different to the standard screen resolution (i.e. setting the font size of a printer canvas) results in characters drawn far too big (or too small) as compared to the screen.

The procedure SetCanvasFontSizeScaled checks whether the pixel resolution of the font deviates from that of the screen. If so, the procedure adjusts the font size of the canvas (parameter Canvas) in a way that any text rendered on the canvas has the same size as a text rendered on screen. The parameter FontSize is the size of the font on the screen.

Remark: If the resolution of the canvas is equal to the screen resolution the call to the procedure SetCanvasFontSizeScaled is in effect just a simple assignment of the font size: Canvas.Font.Size := FontSize;

Last Update: 2012-Oct-25