用Delphi查找系统字体 [英] Finding System Fonts with Delphi

查看:823
本文介绍了用Delphi查找系统字体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

找到用户可用的所有系统字体的最佳方法是什么,以便它们可以显示在下拉列表中?

What is the best way to find all the system fonts a user has available so they can be displayed in a dropdown selection box?

我也想区分Unicode和非Unicode字体。

I would also like to distinguish between Unicode and non-Unicode fonts.

我使用的是Delphi 2009完全启用Unicode,并且希望使用Delphi解决方案。

I am using Delphi 2009 which is fully Unicode enabled, and would like a Delphi solution.

推荐答案

Screen.Fonts 属性通过 EnumFontFamiliesEx API函数。查看 Forms.pas 中的例子来调用该函数。

The Screen.Fonts property is populated via the EnumFontFamiliesEx API function. Look in Forms.pas for an example of calling that function.

它调用的回调函数将会收到一个 TNewTextMetricEx 记录,其中一个成员的记录是 TFontSignature fsUsb 字段表示字体声明支持哪些Unicode子字符。

The callback function that it calls will receive a TNewTextMetricEx record, and one of the members of that record is a TFontSignature. The fsUsb field indicates which Unicode subranges the font claims to support.

系统实际上没有Unicode字体。即使在其名称中具有单词 Unicode 的字体,也不具有所有 Unicode字符的字形。您可以区分位图,打印机和TrueType字体,但除此之外,您可以做的最好的事情是确定您正在考虑的字体是否支持您想要的字符。如果字体不是您认为的Unicode字体,但它支持所有需要的字符,那么它有什么区别呢?要获取此信息,您可能对 GetFontUnicodeRanges

The system doesn't actually have "Unicode fonts." Even the fonts that have the word Unicode in their names don't have glyphs for all Unicode characters. You can distinguish between bitmap, printer, and TrueType fonts, but beyond that, the best you can do is to figure out whether the font you're considering supports the characters you want. And if the font isn't what you'd consider a "Unicode font," but it supports all the characters you need, then what difference does it make? To get this information, you may be interested in GetFontUnicodeRanges.

Microsoft技术用于根据哪些字体包含哪些字符 Uniscribe ,特别是 font fallback 。我不知道Delphi对Uniscribe的支持;我开始写一套进口单位一次,但我的兴趣是变幻莫测的,我在完成之前就转移到别的地方。 Michael Kaplan的博客有时会谈到Uniscribe,所以这是另一个地方。

The Microsoft technology for displaying text with different fonts based on which fonts contain which characters is Uniscribe, particularly font fallback. I'm not aware of any Delphi support for Uniscribe; I started writing a set of import units for it once, but my interests are fickle, and I moved on to something else before I completed it. Michael Kaplan's blog talks about Uniscribe sometimes, so that's another place to look.

这篇关于用Delphi查找系统字体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆