答案 0 :(得分:3)
此代码似乎有效:
procedure TForm1.GetFormFontName;
var
S : String;
begin
S := GetFontData(Self.Font.Handle).Name;
Caption := S;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
GetFormFontName;
end;
GetFontData
返回 TFontData 记录
TFontData = record
Handle: HFont;
Height: Integer;
Pitch: TFontPitch;
Style: TFontStylesBase;
CharSet: TFontCharSet;
Quality: TFontQuality;
Name: TFontDataName;
Orientation: Integer;
end;
这不包括字体的 Size
,它是字体的显式发布属性。
上面的代码来自这个线程:https://forum.lazarus.freepascal.org/index.php?topic=16697.0,我发现它是这个谷歌查询返回的第一个命中
<块引用>字体名称默认站点:freepascal.org