Implements a default font size for non-native text platforms

git-svn-id: trunk@35700 -
This commit is contained in:
sekelsenmat 2012-03-03 22:52:55 +00:00
parent 3e083b0851
commit 0fd18b3788
3 changed files with 5 additions and 1 deletions

View File

@ -178,6 +178,8 @@ type
// For generic methods added in customdrawn
// They are used internally in LCL-CustomDrawn, LCL app should not use them
public
DefaultFontSize: Integer;
//
AccumulatedStr: string;
// The currently focused control
FocusedControl: TWinControl;

View File

@ -92,6 +92,7 @@ begin
CDWidgetSet := Self;
FTerminating := False;
DefaultFontSize := 10;
BackendCreate;
end;

View File

@ -2195,7 +2195,7 @@ begin
if not IsValidDC(DC) then Exit;
lDestIntfImage := TLazIntfImage(lDestCanvas.Image);
if (lDestCanvas.Font = nil) or (lDestCanvas.Font.Size = 0) then lFontSize := 10
if (lDestCanvas.Font = nil) or (lDestCanvas.Font.Size = 0) then lFontSize := DefaultFontSize
else lFontSize := Abs(lDestCanvas.Font.Size);
// Preparations finished, draw it using LazFreeType
@ -4110,6 +4110,7 @@ begin
ftFont := TFreeTypeFont(LazDC.ExtraFontData);
Size.cx := Round(ftFont.TextWidth(Str));
Size.cy := LazDC.AssignedFont.Size;
if Size.cy = 0 then Size.cy := DefaultFontSize;
Result := True;
end;