Message-ID: <3E5D4B42.2090606@huckfinn.de> Date: Thu, 27 Feb 2003 00:18:26 +0100 From: Alex Weidauer User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; de-DE; rv:1.0.2) Gecko/20021120 Netscape/7.01 X-Accept-Language: de-de, de MIME-Version: 1.0 Newsgroups: borland.public.delphi.graphics Subject: Re: Text on Curve References: <3e5d384f$1@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 217.4.194.195 X-Trace: newsgroups.borland.com 1046301566 217.4.194.195 (26 Feb 2003 15:19:26 -0800) Lines: 201 Path: newsgroups.borland.com!not-for-mail Xref: newsgroups.borland.com borland.public.delphi.graphics:56716 Hi, The problem is a little complex You need a free turn able text and teh exact measurement of fonts ..I use the ATM metrix but you can try alsotextwidth,textheight. I us this code unde Windows NT to draw symbols along a polygon line. Bye Alex. Procedure TDrawer.fOutSymbolXYW(w:Double;x,y:Integer;S:String); Var nx,ny,xw,xh:Integer; O,T:TXForm; sc,cHg,fHg:Double; Begin nx:=0;ny:=0; cHg:=fFontMetrix.fY2-fFontMetrix.fY1; // I use Adobe one fHg:=TextHeight(S); if fHG=0 Then Exit; Sc:=cHg/fHg; xw:=OperateFont(Textwidth(S)); xh:=OperateFont(SymbolHeight(S)); Case TextJust of tjCenterTop : begin nx:=-xw div 2; ny:=0; End; tjCenterBottom : begin nx:=-xw div 2; ny:=-xh; End; tjCenterCenter : begin nx:=-xw div 2; ny:=-xh div 2; End; tjLeftTop : Begin nx:=0; ny:=0; End; tjLeftCenter : begin nx:=0; ny:=-xh div 2; End; tjLeftBottom : Begin nx:=0; ny:=-xh; End; tjRightCenter : begin nx:=-xw; ny:=-xh div 2; End; tjRightTop : Begin nx:=-xw; ny:=0; End; tjRightBottom : begin nx:=-xw; ny:=-xh; End; End; SetGraphicsMode(TheDraw.Handle,GM_Advanced); T.eM11:=1* Cos(w/360*Pi*2); T.eM22:=1* Cos(w/360*Pi*2); T.eM12:=1* Sin(w/360*Pi*2); T.eM21:=1*-Sin(w/360*Pi*2); T.eDX:=X; T.eDY:=Y; GetWorldTransform(TheDraw.Handle,O); ModifyWorldTransform(TheDraw.Handle,T,MWT_LEFTMULTIPLY); // TheDraw.Pen.Style:=psClear; // TheDraw.Rectangle(nx-1,ny-1,nx+xw+3,ny+xh+2); TheDraw.TextOut(nx+OperateFont(FFontMetrix.fX1/SC),ny-OperateFont(TextHeight(S)-SymbolHeight(S)+ FFontMetrix.fY1/sc),S); // SetPen(0,200,0,0.25,psSolid); // TheDraw.Ellipse(nx-1,ny-1,nx+1,ny+1); T.eM11:=1; T.eM22:=1; T.eM12:=0; T.eM21:=0; T.eDX :=0; T.eDY :=0; SetWorldTransform(TheDraw.Handle,O); End; Procedure TDrawer.SymbolLine(Poly:TXYPointList; Distance:Double; Offset:Double; StartAngle:Double; R,G,B:Byte; Lib:String; CharSet:Byte; Size :Double; Style:TFontStyles; Sign:Char); Var i,Segment:integer; PosX,PosY, TargetLength, CurrentLength:Double; // P,pxy:TXYpoint; s,c:Double; Angle:Double; (* locates the angle of symbol at one linepoint *) Procedure LANGLE(j:integer;VAR s,c:Double); Var x1,x2,y1,y2,l:Double; Begin x1:=Poly.Points[j].x; x2:=Poly.Points[j-1].x; y1:=Poly.Points[j].y; y2:=Poly.Points[j-1].y; l:=sqrt(sqr(x2-x1)+sqr(y2-y1)); s:=(x1-x2)/l; c:=(y2-y1)/l; End; (* locates the angle of symbol between to lines linepoints *) Procedure SLANGLE(j:integer;VAR s,c:Double); Var x1,x2,y1,y2,l:Double; Begin x1:=Poly.Points[j-1].x; x2:=Poly.Points[j+1].x; y1:=Poly.Points[j-1].y; y2:=Poly.Points[j+1].y; l:=sqrt(sqr(x2-x1)+sqr(y2-y1)); s:=(x1-x2)/l; c:=(y2-y1)/l; end; Function Place(L:Double;Var x,y:Double;Var Pl:Double;VAR Index:integer;VAR s,c:Double):Boolean; Var x1,x2,y1,y2:Real;l1,l2:Real;j:integer; Begin Place:=False; if L<0 then Exit; j:=index; while (l>=Pl) AND (j=Poly.MaxPoint) then exit; if (l=pl) then begin X:=Poly.Points[j].X; Y:=Poly.Points[j].Y; if j=Poly.MaxPoint then LAngle(j,s,c) Else if j=1 Then LAngle(2,s,c) Else SLAngle(j,s,c); Exit; end; x1:=Poly.Points[j-1].x; x2:=Poly.Points[j].x; y1:=Poly.Points[j-1].y; y2:=Poly.Points[j].y; l1:=sqrt(sqr(x2-x1)+sqr(y2-y1)); if j<3 then l2:=l else l2:=l-(Pl-l1); x:=l2/l1*(x2-x1)+Poly.Points[j-1].x; y:=l2/l1*(y2-y1)+Poly.Points[j-1].y; if j<>index then LANGLE(j,s,c); index:=j; Place:=True; end; Begin SetSymbols(R,G,B,LIB,Charset,Size,Style); if Distance=0 then Distance:=1; CurrentLength:=0; TargetLength:=Poly.PolyLength; Segment:=1; i:=-1; if (Poly.MaxPoint<2) OR (Poly.POlyLength=TargetLength; End; //--------------------- DP schrieb: > Hi, > How do I draw a Text on Curve, ex circle,ellipse,bezier etc > > DP > > --