From: "Wayne Sherman" Newsgroups: borland.public.delphi.graphics References: <3AF930FD.D44C78B8@NOSPAM.ibpc.fr> <3afa3662$1_1@dnews> Subject: Re: Vectorial fonts ? Date: Thu, 10 May 2001 10:32:51 -0700 Lines: 108 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 NNTP-Posting-Host: 63.23.66.161 Message-ID: <3afad0c8_1@dnews> X-Trace: dnews 989515976 63.23.66.161 (10 May 2001 10:32:56 -0700) Path: dnews Xref: dnews borland.public.delphi.graphics:38796 > PolyDraw isn't supported on W95 in case you weren't aware of it. You are correct, here is a workaround: type TPoints = array of TPoint; TPointTypes = array of byte; procedure TForm1.btnConvertClick(Sender: TObject); procedure ClearBitmap; begin with imgPreview.Picture.Bitmap do begin Canvas.Brush.Style := bsSolid; Canvas.Brush.Color := clWhite; Canvas.FillRect(Rect(0,0,Width,Height)); end; end; procedure ConnectPoints(const DC: hDC; const aPoints: TPoints; const aTypes: TPointTypes); var PointIdx: integer; PointCount: integer; LastMove: TPoint; begin PointIdx := 0; PointCount := Length(aPoints); while PointIdx < PointCount do begin case aTypes[PointIdx] of PT_MOVETO: begin MoveToEx(DC, aPoints[PointIdx].x, aPoints[PointIdx].y, nil); LastMove := aPoints[PointIdx]; end; PT_LINETO: LineTo(DC, aPoints[PointIdx].x, aPoints[PointIdx].y); PT_BEZIERTO: begin PolyBezierTo(DC, aPoints[PointIdx], 3); inc(PointIdx, 3); CONTINUE; end; PT_LINETO or PT_CLOSEFIGURE: begin LineTo(DC, aPoints[PointIdx].x, aPoints[PointIdx].y); LineTo(DC, LastMove.x, LastMove.y); end; PT_BEZIERTO or PT_CLOSEFIGURE: begin PolyBezierTo(DC, aPoints[PointIdx], 3); LineTo(DC, LastMove.x, LastMove.y); inc(PointIdx, 3); CONTINUE; end; else beep; //unsupported end; inc(PointIdx); end; end; procedure Convert; var Canvas : TCanvas; DC : hDC; aPoints : TPoints; // dynamic array of TPoint structures aTypes : TPointTypes; // dynamic array of bytes iNumPoints : integer; // number of points in path rOut : TRect; // clipping rectangle for DrawText() begin // get handle to target canvas Canvas := imgPreview.Picture.Bitmap.Canvas; // draw text transparently Canvas.Brush.Style := bsClear; // assign Font Canvas.Font := Label2.Font; // build Clipping rectangle rOut := Rect(0,0,imgPreview.Width,imgPreview.height); // Get DC DC := Canvas.Handle; // Start path BeginPath(DC); // draw text DrawText(DC, pchar(edText.Text), length(edText.Text), rOut, DT_LEFT or DT_WORDBREAK); // end path EndPath(DC); // retrieve number of points in path iNumPoints := GetPath(DC, aPoints, aTypes, 0); // resize arrays appropriately SetLength(aPoints, iNumPoints); SetLength(aTypes, iNumPoints); // retrieve path data (vectors) GetPath(DC, aPoints[0], aTypes[0], iNumPoints); // draw the path. You could scale, etc this or store it. // PolyDraw(DC,aPoints[0],aTypes[0],iNumPoints); //only on NT/2000 ConnectPoints(DC, aPoints, aTypes); //use this for NT/2000 or Win9x end; // procedure Convert