关于打印字体的怪问题,是否是Borland的BUG!!!!!!(50分)

  • 主题发起人 mylai911
  • 开始时间
M

mylai911

Unregistered / Unconfirmed
GUEST, unregistred user!
下面程序C++ Builder的,照理是可以打印出长型的字体的,但是打印出来后却是标准的
比例字体,为什么?是不是 Borland的BUG呢?

#include <vcl.h>
#pragma hdrstop
#include <printers.hpp>

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
Graphics::TFont *tf;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{
TPrinter *Prntr = Printer();
tf=new Graphics::TFont;
tf->Assign(Form1->Font);
PLOGFONT plf = (PLOGFONT) LocalAlloc(LPTR, sizeof(LOGFONT));
GetObject(tf->Handle,sizeof(plf),plf);
plf->lfHeight=-29;
plf->lfWidth=8;
tf->Handle=CreateFontIndirect(plf);
Prntr->Title="打印测试";
Prntr->begin
Doc();
Prntr->Canvas->Font->Assign(tf);
Prntr->Canvas->TextOut(25,25,"打印测试");
Prntr->Canvas->TextOut(25,125,"1234567890.tt");
Prntr->Canvas->TextOut(25,225,"abcdefghijklmnopqrstuvwxyz");
Prntr->EndDoc();
tf->Free();
}
//---------------------------------------------------------------------------

 
你只是改动了逻辑字体,这样做对打印机无效,解决的方法最好是直接修改字库里面的字体,
请查找相应的软件
 
不管你怎样改lfHeight, lfWidth都没用, 一样是标准字体。
 

Similar threads

顶部