diff --git a/components/richmemo/richmemo.pas b/components/richmemo/richmemo.pas index cfa493c80..9bbc1ea31 100644 --- a/components/richmemo/richmemo.pas +++ b/components/richmemo/richmemo.pas @@ -292,19 +292,25 @@ end; function GetFontParams(AFont: TFont): TFontParams; overload; var - data : TFontData; + data : TFontData; + wstest : Boolean; begin InitFontParams(Result); if not Assigned(AFont) then Exit; if AFont.Reference.Handle <> 0 then begin - data:=GetFontData(AFont.Reference.Handle); - if data.Height<0 - then Result.Size:=round(abs(data.Height)/ScreenInfo.PixelsPerInchY*72) - else Result.Size:=data.Height; - Result.Name:=data.Name; - Result.Color:=AFont.Color; - Result.Style:=data.Style; + // WSGetFontParams is introduced, because default Gtk widgetset returns + // only FontName from the handle. + wstest:= Assigned(WSGetFontParams) and WSGetFontParams(AFont.Reference.Handle, Result); + if not wstest then begin + data:=GetFontData(AFont.Reference.Handle); + if data.Height<0 + then Result.Size:=round(abs(data.Height)/ScreenInfo.PixelsPerInchY*72) + else Result.Size:=data.Height; + Result.Name:=data.Name; + Result.Color:=AFont.Color; + Result.Style:=data.Style; + end; end else begin Result.Name := AFont.Name; Result.Color := AFont.Color; diff --git a/components/richmemo/wsrichmemo.pas b/components/richmemo/wsrichmemo.pas index 28db2730f..3aa1bc421 100644 --- a/components/richmemo/wsrichmemo.pas +++ b/components/richmemo/wsrichmemo.pas @@ -25,6 +25,7 @@ interface uses Types, Classes, SysUtils, + LCLType, Graphics, Controls, StdCtrls, WSStdCtrls, RichMemo; @@ -103,6 +104,10 @@ type function WSRegisterCustomRichMemo: Boolean; external name 'WSRegisterCustomRichMemo'; +var + //note: this internal function might go away eventually! + WSGetFontParams: function (wsfontref: HFONT; var params: TFontParams): Boolean = nil; + implementation { TWSCustomRichMemo }