if taLeft in Aligns then X := ARect.Left + J else if taHorzCenter in Aligns then X := (ARect.Right + ARect.Left + J) shr 1 else {if taRight in Aligns} X := ARect.Right - 2;
Y := ARect.Top + 2; end; -45..-1: begin Windows.GetTextMetrics(ACanvas.Handle,TextMetric); Interval := Ceil((TextMetric.tmHeight{ + TextMetric.tmExternalLeading})/Scaler); J := Interval * Texts.Count;
X := ARect.Left + 2;
if taBottom in Aligns then Y := ARect.Bottom - J else if taVertCenter in Aligns then Y := (ARect.Bottom + ARect.Top - J) shr 1 else {if taTop in Aligns then} Y := ARect.Top + 2;
end; end;
//OldBrushStyle := ACanvas.Brush.Style; //ACanvas.Brush.Style := bsClear; for I := 0 to Texts.Count - 1 do begin case Direction of tdVertChinese: begin J := Length(WideString(Texts[I])) * (TextMetric.tmHeight{ + TextMetric.tmExternalLeading});
if taBottom in Aligns then Y := ARect.Bottom - J else if taVertCenter in Aligns then Y := (ARect.Bottom + ARect.Top - J) shr 1 else {if taTop in Aligns then} Y := ARect.Top + 2;
TempExtent.CX := X; TempExtent.CY := Y; for J := 1 to Length(WideString(Texts[I])) do begin S := WideString(Texts[I])[J]; if DitheredFlag then DrawDitheredText(TempExtent.CX,TempExtent.CY,S) else begin //Windows.ExtTextOut(ACanvas.Handle,0,0,ETO_OPAQUE,@ARect, Nil,0,Nil); Windows.ExtTextOut(ACanvas.Handle, TempExtent.CX, TempExtent.CY,{ETO_OPAQUE or} ETO_CLIPPED, @ARect, PChar(S), Length(S),Nil); end; Inc(TempExtent.CY ,TextMetric.tmHeight{ + TextMetric.tmExternalLeading}); end; Dec(X,Interval); end; 0:{Horizontal} begin Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent); if taRight in Aligns then X := ARect.Right - TempExtent.CX else if taHorzCenter in Aligns then X := (ARect.Right + ARect.Left - TempExtent.CX) shr 1 else {if taLeft in Aligns then} X := ARect.Left + 2;
if DitheredFlag then DrawDitheredText(X,Y,Texts[I]) else begin //Windows.ExtTextOut(ACanvas.Handle,0,0,ETO_OPAQUE,@ARect, Nil,0,Nil); Windows.ExtTextOut(ACanvas.Handle, X, Y,{ETO_OPAQUE or} ETO_CLIPPED, @ARect, PChar(Texts[I]), Length(Texts[I]),Nil); end; Inc(Y,Interval); end;
1..45: begin Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent); J := Ceil(TempExtent.CX*Scaler); if taRight in Aligns then begin TempExtent.CX := ARect.Right - J; TempExtent.CY := Y + Ceil((X- TempExtent.CX)* Tan(Direction * Pi / 180)); end else if taHorzCenter in Aligns then begin TempExtent.CX := (ARect.Right + ARect.Left - J) shr 1; TempExtent.CY := Y + Ceil((X - TempExtent.CX )* Tan(Direction * Pi / 180)); end else {if taLeft in Aligns then} begin TempExtent.CX := ARect.Left + 2; TempExtent.CY := Y; end; if DitheredFlag then DrawDitheredText(TempExtent.CX,TempExtent.CY,Texts[I]) else begin //Windows.ExtTextOut(ACanvas.Handle,0,0,ETO_OPAQUE,@ARect, Nil,0,Nil); Windows.ExtTextOut(ACanvas.Handle, TempExtent.CX, TempExtent.CY,{ETO_OPAQUE or} ETO_CLIPPED, @ARect, PChar(Texts[I]), Length(Texts[I]),Nil); end; Inc(Y,Interval); end;
46..90: begin Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent); J := Ceil(TempExtent.CX*Scaler);
if taTop in Aligns then begin TempExtent.CY := ARect.Top + J; TempExtent.CX := X + Ceil((Y - TempExtent.CY)/ Tan(Direction * Pi / 180)); end else if taVertCenter in Aligns then begin TempExtent.CY := (ARect.Bottom + ARect.Top + J) shr 1; TempExtent.CX := X + Ceil((Y - TempExtent.CY)/ Tan(Direction * Pi / 180)); end else {if taLeft in Aligns then} begin TempExtent.CY := ARect.Top + 2; TempExtent.CX := X; end;
if DitheredFlag then DrawDitheredText(TempExtent.CX,TempExtent.CY,Texts[I]) else begin //Windows.ExtTextOut(ACanvas.Handle,0,0,ETO_OPAQUE,@ARect, Nil,0,Nil); Windows.ExtTextOut(ACanvas.Handle, TempExtent.CX, TempExtent.CY,{ETO_OPAQUE or} ETO_CLIPPED, @ARect, PChar(Texts[I]), Length(Texts[I]),Nil); end; Inc(X,Interval); end;
-90..-46: begin Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]), TempExtent); J := Ceil(TempExtent.CX*Scaler);
if taBottom in Aligns then begin TempExtent.CY := ARect.Bottom - J; TempExtent.CX := X + Ceil((TempExtent.CY - Y)/ Tan(-Direction * Pi / 180)); end else if taVertCenter in Aligns then begin TempExtent.CY := (ARect.Bottom + ARect.Top - J) shr 1; TempExtent.CX := X + Ceil((TempExtent.CY - Y)/ Tan(-Direction * Pi / 180)); end else {if taLeft in Aligns then} begin TempExtent.CY := ARect.Top + 2; TempExtent.CX := X; end;
if DitheredFlag then DrawDitheredText(TempExtent.CX,TempExtent.CY,Texts[I]) else begin //Windows.ExtTextOut(ACanvas.Handle,0,0,ETO_OPAQUE,@ARect, Nil,0,Nil); Windows.ExtTextOut(ACanvas.Handle, TempExtent.CX, TempExtent.CY,{ETO_OPAQUE or} ETO_CLIPPED, @ARect, PChar(Texts[I]), Length(Texts[I]),Nil); end; Dec(X,Interval); end;
-45..-1: begin Windows.GetTextExtentPoint32(ACanvas.Handle, PChar(Texts[I]), Length(Texts[I]),