S
shxm
Unregistered / Unconfirmed
GUEST, unregistred user!
我想显示某一汉字的ttf字体(如楷体)的笔画轮廓,苦于不知有关字体的详细说明,更无法编程实现.有哪位高手能指点?最好能有读取并显示字体笔画的程序源码.
<br>procedure TForm1.BitBtn1Click(Sender: TObject);<br>var<br> dc : HDC;<br> bakClrPen, bakClrBrush : TColor;<br> rgn : HRGN;<br>begin<br> Image1.Canvas.Font := fontdialog1.Font;<br><br> dc := Image1.Canvas.Handle;<br><br> BeginPath(dc);<br><br> Image1.Canvas.TextOut(0, 0, '中国');<br> CloseFigure(dc);<br><br> EndPath(dc);<br><br> // SelectClipPath(dc, RGN_COPY);<br><br> bakClrPen := Image1.Canvas.Brush.Color;<br> bakClrBrush := Image1.Canvas.Pen.Color;<br> Image1.Canvas.Brush.Color := clRed;<br> Image1.Canvas.pen.Color := clBlue;<br><br> rgn := PathToRegion(dc);<br><br> if rgn<>0 then<br> FrameRgn(dc, rgn, Image1.Canvas.Brush.Handle, 1, 1);<br><br> Image1.Canvas.Brush.Color := bakClrBrush;<br> Image1.Canvas.Pen.Color := bakClrPen;<br><br> DeleteObject(rgn);<br>end;<br>
procedure TForm1.BitBtn1Click(Sender: TObject);<br>var<br> dc : HDC;<br> bakClrPen, bakClrBrush : TColor;<br> tmpRgn : HRGN;<br> rgn : HRGN;<br> rgnRect : TRect;<br>begin<br> Image1.Canvas.Font := fontdialog1.Font;<br><br> dc := Image1.Canvas.Handle;<br><br> BeginPath(dc);<br><br> Image1.Canvas.TextOut(0, 0, '中国');<br> CloseFigure(dc);<br><br> EndPath(dc);<br><br> bakClrPen := Image1.Canvas.Brush.Color;<br> bakClrBrush := Image1.Canvas.Pen.Color;<br> Image1.Canvas.Brush.Color := clRed;<br> Image1.Canvas.pen.Color := clBlue;<br><br> rgn := PathToRegion(dc);<br> GetRgnBox(rgn, rgnRect);<br> tmpRgn := CreateRectRgn(rgnRect.left, rgnRect.top, rgnRect.Right, rgnRect.Bottom);<br> CombineRgn(rgn, tmpRgn, rgn, RGN_DIFF);<br><br> if rgn<>0 then<br> FrameRgn(dc, rgn, Image1.Canvas.Brush.Handle, 1, 1);<br><br> Image1.Canvas.Brush.Color := bakClrBrush;<br> Image1.Canvas.Pen.Color := bakClrPen;<br> SelectClipRgn(dc, 0);<br><br> DeleteObject(rgn);<br> DeleteObject(tmpRgn);<br>end;