Re: Text Scaling in Metafile

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Shine wrote:
Hi All,

I am trying to do a text Scaling in Delphi using the following code Snippet.
But the result is not as expected it is giving extra space between each character. In the code I'm creating a font with size 1 and using SetmapMode I'm scaling it to 10. My expected output is the string written in Arial font with size 10. But the result is some overlapped text...I'm not sure weather I'm doing something wrong. Please help me....
Following is the code snippet what i am using

****************************************
Delphi Code Snippet
****************************************
procedure TForm1.Button1Click(Sender: TObject);
var
LMetafile: TMetafile;
LMetafilecan: TMetafileCanvas;
LHDC: HDC;
LXFORM: XFORM;
begin
LMetafile := TMetafile.Create;
LMetafilecan := TMetafileCanvas.Create(LMetafile, 0);
LHDC := LMetafilecan.Handle;
SetGraphicsMode(LHDC,GM_ADVANCED);
SelectObject(LHDC, CreateFont(-1,0,0,0,400,0,0,0,0,0,0,0,0,'Arial'));
with LXFORM do
begin
eM11 := 10;
eM12 := 0;
eM21 := 0;
eM22 := 10;
eDx := 248.75999;
eDy := 128.20000;
end;
SetWorldTransform(LHDC, LXFORM);
TextOut(LHDC,0, 0, 'Hello World', 11);
LMetafilecan.Free;
LMetafile.SaveToFile('C:\EMF.emf');
end;
*******************************************

Any help would be most appreciated.

Regards,
Shine

Sorry for the mistake it is not SetMapMode it's SetWorldTransform.
.


Quantcast