Why TFontDialog gives less fonts than Screen.Fonts?

◇◆丶佛笑我妖孽 提交于 2019-11-30 21:59:43

Screen.Fonts returns all installed fonts, including hidden fonts as administrated in Registry\HKCU\Software\Microsoft\Windows NT\CurrentVersion\Font Management\Inactive Fonts. (Source) Apparently, TFontDialog does not display these hidden fonts.

Furthermore, some fonts listed in Screen.Fonts are not mentioned in the Font combo box of TFontDialog, but are added to the Font style combo box. Take Arial for example: the Font style lists 10 items, which seems to be the combination of the fonts Arial, Arial Black and Arial Narrow.

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!