LCL: Add support for custom font of TSpeedButton (see https://forum.lazarus.freepascal.org/index.php/topic,42635.msg297800.html#msg297800, patch by Ondrej)

git-svn-id: trunk@59149 -
This commit is contained in:
wp 2018-09-23 16:03:23 +00:00
parent fc89b79dc9
commit a7ce6e3055

View File

@ -572,6 +572,7 @@ var
HasGlyph: Boolean;
HasText: Boolean;
CurLayout: TButtonLayout;
SysFont: TFont;
begin
if FGlyph = nil then exit;
@ -736,8 +737,19 @@ begin
TextFlags := TextFlags or DT_RTLREADING;
if Draw then
ThemeServices.DrawText(Canvas, DrawDetails, Caption, PaintRect,
TextFlags, 0);
begin
SysFont := Screen.SystemFont;
if (SysFont.Color=Font.Color)
and ((SysFont.Name=Font.Name) or IsFontNameDefault(Font.Name))
and (SysFont.Pitch=Font.Pitch)
and (SysFont.Style=Font.Style) then
ThemeServices.DrawText(Canvas, DrawDetails, Caption, PaintRect, TextFlags, 0)
else
begin
Canvas.Brush.Style := bsClear;
DrawText(Canvas.Handle, PChar(Caption), Length(Caption), PaintRect, TextFlags);
end;
end;
end;
end else begin
// measuring, not drawing