From c0790a489b1cf4cc02d4f5a82fc65564256ae636 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 16 May 2013 16:04:20 +0100 Subject: aggcanvas: added support for font rotation The FontDesc property now supports a new font attribute: for example: Arial-13:Angle=45.0 The Angle range is between 0-360 --- src/corelib/render/software/Agg2D.pas | 2 +- src/corelib/render/software/agg_platform_x11.inc | 6 ++++-- src/corelib/render/software/fpg_fontcache.pas | 4 ++++ 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas index 13860ffd..84bb2351 100644 --- a/src/corelib/render/software/Agg2D.pas +++ b/src/corelib/render/software/Agg2D.pas @@ -3570,7 +3570,7 @@ begin fnt := FontCacheItemFromFontDesc(TfpgFontResource(fntres).FontDesc, lSize); i := gFontCache.Find(fnt); if i > 0 then - Font(gFontCache.Items[i].FileName, lSize, fnt.IsBold, fnt.IsItalic); + Font(gFontCache.Items[i].FileName, lSize, fnt.IsBold, fnt.IsItalic, AGG_VectorFontCache, Deg2Rad(fnt.Angle)); end; {$ENDIF} diff --git a/src/corelib/render/software/agg_platform_x11.inc b/src/corelib/render/software/agg_platform_x11.inc index 0b070713..dc5556fa 100644 --- a/src/corelib/render/software/agg_platform_x11.inc +++ b/src/corelib/render/software/agg_platform_x11.inc @@ -49,7 +49,7 @@ var procedure NextToken; begin token := ''; - while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '0'..'9']) do + while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '0'..'9', '.']) do begin token := token + c; NextC; @@ -98,7 +98,9 @@ begin if prop = 'BOLD' then Result.IsBold := True else if prop = 'ITALIC' then - Result.IsItalic := True; + Result.IsItalic := True + else if prop = 'ANGLE' then + Result.Angle := StrToFloatDef(propval, 0.0); // else if prop = 'ANTIALIAS' then // if propval = 'FALSE' then // lf.lfQuality := NONANTIALIASED_QUALITY else diff --git a/src/corelib/render/software/fpg_fontcache.pas b/src/corelib/render/software/fpg_fontcache.pas index 46681938..15f65e40 100644 --- a/src/corelib/render/software/fpg_fontcache.pas +++ b/src/corelib/render/software/fpg_fontcache.pas @@ -34,6 +34,7 @@ uses type TFontCacheItem = class(TObject) private + FAngle: double; FFamilyName: TfpgString; FFileName: TfpgString; FFixedWidth: boolean; @@ -55,6 +56,8 @@ type property IsRegular: boolean read GetIsRegular write SetIsRegular; property IsItalic: boolean read GetIsItalic write SetIsItalic; property IsBold: boolean read GetIsBold write SetIsBold; + { following properties are used by FontCacheItemFromFontDesc() only } + property Angle: double read FAngle write FAngle; end; @@ -164,6 +167,7 @@ begin inherited Create; FFileName := AFilename; FStyleFlags := FPG_FONT_STYLE_REGULAR; + FAngle := 0.0; end; { TFontCacheList } -- cgit v1.2.3-70-g09d2