Adds a font orientation property and moves the font to a separate record

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1667 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2011-06-08 06:29:17 +00:00
parent be3e53b19f
commit 91a6b7a6f6
3 changed files with 21 additions and 8 deletions

View File

@ -153,6 +153,18 @@ type
function Next(): TPathSegment;
end;
TvFont = record
Color: TvColor;
Size: integer;
Name: utf8string;
{@@
Font orientation is measured in degrees and uses the
same direction as the LCL TFont.orientation, which is counter-clockwise.
Zero is the normal, horizontal, orientation.
}
Orientation: Double;
end;
{@@
TvText represents a text in memory.
@ -163,9 +175,7 @@ type
public
X, Y, Z: Double; // Z is ignored in 2D formats
Value: utf8string;
FontColor: TvColor;
FontSize: integer;
FontName: utf8string;
Font: TvFont;
end;
{@@
@ -744,8 +754,8 @@ begin
lText.X := AX;
lText.Y := AY;
lText.Z := AZ;
lText.FontName := FontName;
lText.FontSize := FontSize;
lText.Font.Name := FontName;
lText.Font.Size := FontSize;
FTexts.Add(lText);
end;

View File

@ -491,7 +491,8 @@ begin
for i := 0 to ASource.GetTextCount - 1 do
begin
CurText := ASource.GetText(i);
ADest.Font.Size := Round(AmulX * CurText.FontSize);
ADest.Font.Size := Round(AmulX * CurText.Font.Size);
ADest.Pen.Style := psSolid;
{$ifdef USE_LCL_CANVAS}
ADest.Pen.Color := clBlack;
@ -499,7 +500,9 @@ begin
ADest.Pen.FPColor := colBlack;
{$endif}
ADest.Brush.Style := bsClear;
LowerDim.Y := CurText.Y + CurText.FontSize;
ADest.Font.Orientation := Round(CurText.Font.Orientation * 16);
LowerDim.Y := CurText.Y + CurText.Font.Size;
ADest.TextOut(CoordToCanvasX(CurText.X), CoordToCanvasY(LowerDim.Y), CurText.Value);
end;
end;

View File

@ -243,7 +243,7 @@ begin
AData, lText.X, lText.Y, PtX, PtY);
TextStr := lText.Value;
FontSize:= ceil(lText.FontSize / FLOAT_MILIMETERS_PER_PIXEL);
FontSize:= ceil(lText.Font.Size / FLOAT_MILIMETERS_PER_PIXEL);
SVGFontFamily := 'Arial, sans-serif';//lText.FontName;
AStrings.Add(' <text ');