我想知道为什么 TFontDialog 提供的字体比 Screen.Fonts 少? (例如Arial*字体、Comic字体等,在TFontDialog中不显示)
另外看来TFontDialog给出的字体列表和WordPad一样,而Screen.Fonts给出的字体列表和Word基本一致。
非常感谢您的见解!
附言: 德尔福XE, Windows 7
PS:相关的 SO 主题:
- Too many fonts when enumerating with EnumFontFamiliesEx function
- Finding System Fonts with Delphi
- How to use external fonts?
PS:相关网页:
- TFontDialog to show all Fonts @ borland.newsgroups.archived
- TFontDialog to show all Fonts @ delphigroups
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm2 = class(TForm)
lst1: TListBox;
dlgFont1: TFontDialog;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.FormCreate(Sender: TObject);
begin
lst1.Items.AddStrings(Screen.Fonts);
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
dlgFont1.Device := fdBoth;
if dlgFont1.Execute then
begin
end;
end;
end.
最佳答案
Screen.Fonts
返回所有已安装的字体,包括在 Registry\HKCU\Software\Microsoft\Windows NT\CurrentVersion\Font Management\Inactive Fonts 中管理的隐藏字体。 ( Source ) 显然,TFontDialog
不显示这些隐藏的字体。
此外,Screen.Fonts
中列出的一些字体在TFontDialog
的Font 组合框中未提及,而是添加到< em>字体样式 组合框。以Arial为例:Font样式列出了10项,似乎是Arial、Arial Black和字体的组合Arial Narrow。
关于windows - 为什么 TFontDialog 提供的字体比 Screen.Fonts 少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11300277/