improved font handling and updated demo by Luiz Americo Pereira Camara

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@529 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
eugene1
2008-08-15 19:28:55 +00:00
parent e8f965bb06
commit 1a7f321de7
13 changed files with 647 additions and 454 deletions

View File

@ -66,7 +66,7 @@ type
private
FBitmap : TBitmap;
FText : String;
procedure SetText(Value: String);
procedure SetText(const Value: String);
function GetCanvas : TCanvas;
procedure PaintText;
public
@ -240,7 +240,7 @@ begin
PaintText;
end;
procedure TRotatedText.SetText(Value: String);
procedure TRotatedText.SetText(const Value: String);
begin
if FText <> Value then
begin
@ -261,12 +261,24 @@ var
begin
TextSize := FBitmap.Canvas.TextExtent(FText);
FBitmap.Width:=TextSize.cx;
FBitmap.Height:=TextSize.cy;
{$ifdef LCLWin32}
//win32 does not comput correct text extent when Italic style is set.
//small workaround to this bug
//not sure if other widgetsets alsoa have this bug. Enable it only for win32 for now
if fsItalic in FBitmap.Canvas.Font.Style then
Inc(TextSize.cx, 4);
{$endif}
FBitmap.SetSize(TextSize.cx, TextSize.cy);
FBitmap.Canvas.FillRect(0,0,FBitmap.Width, FBitmap.Height);
//check to allow Text with Fuchsia color
if FBitmap.Canvas.Font.Color = clFuchsia then
FBitmap.Canvas.Brush.Color := clWhite
else
FBitmap.Canvas.Brush.Color := clFuchsia;
FBitmap.Canvas.TextOut(0,0,FText);
FBitmap.Canvas.FillRect(0,0, FBitmap.Width, FBitmap.Height);
FBitmap.Canvas.TextOut(0,0, FText);
Inherited LoadBitmap(FBitmap);
end;