windows - 为什么 TFontDialog 提供的字体比 Screen.Fonts 少?

标签 windows delphi fonts wordpad

我想知道为什么 TFontDialog 提供的字体比 Screen.Fonts 少? (例如Arial*字体、Comic字体等,在TFontDialog中不显示)

另外看来TFontDialog给出的字体列表和WordPad一样,而Screen.Fonts给出的字体列表和Word基本一致。

非常感谢您的见解!

附言: 德尔福XE, Windows 7

PS:相关的 SO 主题:

  1. Too many fonts when enumerating with EnumFontFamiliesEx function
  2. Finding System Fonts with Delphi
  3. How to use external fonts?

PS:相关网页:

  1. TFontDialog to show all Fonts @ borland.newsgroups.archived
  2. TFontDialog to show all Fonts @ delphigroups

sys app

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 中列出的一些字体在TFontDialogFont 组合框中未提及,而是添加到< em>字体样式 组合框。以Arial为例:Font样式列出了10项,似乎是ArialArial Black字体的组合Arial Narrow

关于windows - 为什么 TFontDialog 提供的字体比 Screen.Fonts 少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11300277/

相关文章:

c++ - 在 Windows 中执行 SetMonitorBrightness 函数时出现无效的监视器句柄错误 - C++

c++ - FFMPEG 设置网络摄像头编码器 C++

Delphi "for ... to"语句从结束值运行到开始值

delphi - 如何在delphi中获取字体大小

css - 使用字体作为图标库

linux - 超 V 错误。同时运行 Windows Phone 模拟器和 VM (Windows 8)

c++ - XmlHttpRequest 错误?

delphi - TWebBrowser 中是否有相当于 Chromium Embedded 的 OnResourceResponse 的功能? (德尔福)

delphi - 自动刷新 TDataSet/DBGrid

javascript - 将单个字符字体缩放到其父 div