W
whitelion
Unregistered / Unconfirmed
GUEST, unregistred user!
我做了一个程序,其中有一部分字体要求为倾斜显示,代码如下,但是字体在倾斜后严重变形,在打印机打印出来后几乎不能辨认,谁能帮忙。
void __fastcall Tmain::cctextout(int x, int y, String cctext, int tx, int ty)
{
//TODO: Add your source code here
//在坐标x,y的位置画出字符串cctext,倾斜角度为ty/tx
double temptag;
int langle;
if (tx!=0)
{
//temptag=ty/tx;
double tempangle;
tempangle=ArcTan2(-ty,tx);
langle=int(0.001*1000*tempangle*180/3.1415926*10);
}
else
{
if (ty>0)
{
langle=-900;
}
else
{
langle=900;
}
}
TFont * pFont;
TFont * sFont;
TLogFont rFont;
pFont=new TFont;
sFont=new TFont;
pFont->Assign(mycanvas->Font);
sFont->Assign(mycanvas->Font);
::GetObject(pFont->Handle,sizeof(rFont),&rFont);
rFont.lfEscapement=langle; //角度的十倍
rFont.lfOrientation=langle;
rFont.lfQuality=PROOF_QUALITY;
pFont->Handle=::CreateFontIndirect(&rFont);
mycanvas->Font->Assign(pFont);
pFont->Free();
mycanvas->TextOut(x,y,cctext);
mycanvas->Font->Assign(sFont);
sFont->Free();
}
这是一段bcb程序,希望高手能够指点一下
void __fastcall Tmain::cctextout(int x, int y, String cctext, int tx, int ty)
{
//TODO: Add your source code here
//在坐标x,y的位置画出字符串cctext,倾斜角度为ty/tx
double temptag;
int langle;
if (tx!=0)
{
//temptag=ty/tx;
double tempangle;
tempangle=ArcTan2(-ty,tx);
langle=int(0.001*1000*tempangle*180/3.1415926*10);
}
else
{
if (ty>0)
{
langle=-900;
}
else
{
langle=900;
}
}
TFont * pFont;
TFont * sFont;
TLogFont rFont;
pFont=new TFont;
sFont=new TFont;
pFont->Assign(mycanvas->Font);
sFont->Assign(mycanvas->Font);
::GetObject(pFont->Handle,sizeof(rFont),&rFont);
rFont.lfEscapement=langle; //角度的十倍
rFont.lfOrientation=langle;
rFont.lfQuality=PROOF_QUALITY;
pFont->Handle=::CreateFontIndirect(&rFont);
mycanvas->Font->Assign(pFont);
pFont->Free();
mycanvas->TextOut(x,y,cctext);
mycanvas->Font->Assign(sFont);
sFont->Free();
}
这是一段bcb程序,希望高手能够指点一下