summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-05-16 16:04:20 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-05-16 16:04:20 +0100
commitc0790a489b1cf4cc02d4f5a82fc65564256ae636 (patch)
tree06dbd213d57a0acbcbadcc4a875ec6a801b23b74 /src
parent55ddef26ee20f21fcae48b2589a93ce95773bebc (diff)
downloadfpGUI-c0790a489b1cf4cc02d4f5a82fc65564256ae636.tar.xz
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
Diffstat (limited to 'src')
-rw-r--r--src/corelib/render/software/Agg2D.pas2
-rw-r--r--src/corelib/render/software/agg_platform_x11.inc6
-rw-r--r--src/corelib/render/software/fpg_fontcache.pas4
3 files changed, 9 insertions, 3 deletions
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 }