From 91a6b7a6f6b24d58066fa769feed2b6abf2b8230 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 8 Jun 2011 06:29:17 +0000 Subject: [PATCH] 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 --- .../fpvviewer/fpvectorialsrc/fpvectorial.pas | 20 ++++++++++++++----- .../fpvviewer/fpvectorialsrc/fpvtocanvas.pas | 7 +++++-- .../fpvectorialsrc/svgvectorialwriter.pas | 2 +- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/applications/fpvviewer/fpvectorialsrc/fpvectorial.pas b/applications/fpvviewer/fpvectorialsrc/fpvectorial.pas index b3cebc146..db5a83306 100644 --- a/applications/fpvviewer/fpvectorialsrc/fpvectorial.pas +++ b/applications/fpvviewer/fpvectorialsrc/fpvectorial.pas @@ -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; diff --git a/applications/fpvviewer/fpvectorialsrc/fpvtocanvas.pas b/applications/fpvviewer/fpvectorialsrc/fpvtocanvas.pas index 4e035d2f3..b4900e082 100644 --- a/applications/fpvviewer/fpvectorialsrc/fpvtocanvas.pas +++ b/applications/fpvviewer/fpvectorialsrc/fpvtocanvas.pas @@ -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; diff --git a/applications/fpvviewer/fpvectorialsrc/svgvectorialwriter.pas b/applications/fpvviewer/fpvectorialsrc/svgvectorialwriter.pas index 65a42f5f8..6fad037e2 100644 --- a/applications/fpvviewer/fpvectorialsrc/svgvectorialwriter.pas +++ b/applications/fpvviewer/fpvectorialsrc/svgvectorialwriter.pas @@ -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('