Hiya, got a wee question regarding font scaling, I'm writing a componet
with draws a scaled image, and I'm wanting to scale the text as well.
I'm trying to use the following function...
function TMapLabel.GetFontHeight(Canvas: TCanvas): Integer;
var
iWorldWidth, iCanvasWidth, iPixelsX: Integer;
begin
iWorldWidth := Field.WorldView.Xr - Field.WorldView.Xl;
iCanvasWidth := GetDeviceCaps(Canvas.Handle, HORZRES);
iPixelsX := GetDeviceCaps(Canvas.Handle, LOGPIXELSX);
Result := Round((iPixelsX / FontHeight) /
(iWorldWidth / iCanvasWidth));
end;
...which is assigned to Canvas.Font.Height. The value of FontHeight
(property of TMapLabel) is just an arbitrary size value which doesn't
really equate to points/twips/pixels. (iWorldWidth / iCanvasWidth) gives
me the scale ratio that is used to draw the rest of the picture.
When I draw to a screen canvas, say on a TImage everything works fine, but
whenever I draw to a TPrinter canvas, the fonts are WAY large, does anyone
have any hints?
Mark
--
"I love you, you love me, Bill's a bad monopoly..." ...as heard in shadows bar.
Mark Derricutt
Now Playing: Yngwie Malmsteen - Marching Out
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz