Why does TFontDialog produce fewer fonts than Screen.Fonts?

I am wondering why TFontDialog gives fewer fonts than Screen.Fonts? (For example, Arial * font, Comic font, etc. Does not appear in TFontDialog)

It also seems that the font list given by TFontDialog is the same as WordPad, while the font list given by Screen.Fonts is basically the same as Word.

Thanks so much for your ideas!

PS: Delphi XE, Windows 7

PS: SO related topics:

  • Too many fonts to enumerate using the EnumFontFamiliesEx function
  • Finding system fonts with Delphi
  • How to use external fonts?

PS: linked web pages:

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. 
+4
windows fonts delphi wordpad
Jul 02 2018-12-12T00:
source share
2 answers

Screen.Fonts returns all installed fonts, including hidden fonts, that are administered in Registry \ HKCU \ Software \ Microsoft \ Windows NT \ CurrentVersion \ Font Management \ Inactive Fonts. ( Source ) TFontDialog does not appear to display these hidden fonts.

In addition, some fonts listed in Screen.Fonts are not listed in the Font TFontDialog , but are added to the Font style combo box. Take Arial, for example: the Font style contains 10 elements, which appear to be a combination of the Arial, Arial Black, and Arial Narrow fonts.

+6
Jul 03 '12 at 1:00
source share

Different APIs, different results. Screen.Fonts uses EnumFontFamiliesEx() , which returns all installed fonts. TFontDialog instead uses ChooseFont() , which displays only fonts compatible with the TFontDialog.Font and TFontDialog.Options .

+2
Jul 02 2018-12-12T00:
source share



All Articles