.net - 字体文件中的什么属性使程序决定模拟粗体?

标签 .net wpf fonts

我正在寻找字体文件中的属性(来自 WPF 的 System.Windows.Media.Fonts TypefaceGlyphTypeface )或直接访问 .ttf/.otf 文件,这将允许我确定 Windows 中是否有类似 Write/WordPad 的程序将粗体应用于字体。基本上,一些具有 Bold 属性的字体仍然会应用额外的粗体,而有些则不会。我试图发现用于做出此决定的逻辑是什么。

要手动查看此内容,请将以下内容复制并粘贴到 Write/WordPad(或 OOo 的 Writer 或 MS Word 或...)中,并将每行的字体更改为其名称(即将 Arial Black 应用于 Arial Black)

  • Arial Black
  • Arial 圆形 MT 粗体
  • 宋体窄

  • 现在对它们应用粗体。您会看到 #2 和 #3 发生变化,但不会看到 #1。

    With #3 though, something different is happening than the other two - a different font all together is being applied. Namely ARIALNB .TTF ('NB' appended, which is Arial Narrow Bold) in place of ARIALN.TTF ('N' appended, which is Arial Narrow). So in the case of this font, bold is not actually being applied.



    回到列表。 #1 不会改变,但 #2 会。 #1 的权重是“黑色”,#2 的权重是“粗体”。如果您采用#3 ARIALNB.TTF 的粗体版本,并对其应用粗体,它会像#1 一样运行——它不会改变。但它与#2 的权重相同,即“Bold”。

    换句话说,有两个是粗体(Arial Rounded MT Bold 和 Arrow Narrow Bold),但只有 Arial Rounded MT Bold 得到了更粗的应用。对于 Arial Black,它没有粗体字重,但仍然没有应用粗体字。

    这是它的样子:
    alt text

    有趣的是,WPF 不会表现出这种行为(即添加更多粗体),但 Silverlight 会:

    WPF(注意 FontFamily 是“Arial Rounded MT”):
    <StackPanel Orientation="Vertical">
        <TextBlock FontSize="24" Text="Arial Rounded MT Bold" FontFamily="Arial Rounded MT"/>
        <TextBlock FontSize="24" Text="Arial Rounded MT Bold" FontWeight="Black" FontFamily="Arial Rounded MT"/>
    </StackPanel>
    

    Silverlight(注意 FontFamily 是“Arial Rounded MT Bold”):
    <StackPanel Orientation="Vertical">
        <TextBlock  FontSize="24" FontFamily="Arial Rounded MT Bold" >Arial Rounded MT Bold</TextBlock>
        <TextBlock  FontSize="24" FontFamily="Arial Rounded MT Bold" FontWeight="Bold" >Arial Rounded MT Bold</TextBlock>
    </StackPanel>
    

    问题又回到了:字体文件的什么属性告诉程序是否添加更多粗体?我正在字体文件中寻找一个标志或属性来告诉我这个逻辑。

    以下是应用“粗体”无效的其他字体列表:

    - Adob​​e Caslon Pro 粗体
    - Adob​​e Garamond Pro 粗体
    - 安迪
    - 宋体黑
    - 贝尔哥特式标准黑色
    - 贝尔哥特式浅黑色
    - 柏林 Sans FB Demi
    - Blackoak Std
    - Bodoni MT 黑色
    - 查理曼标准
    - Minion Pro Cond
    - 莫尔条纹超粗
    - Myriad Pro Light
    - 杨树标准
    - 威望精英标准
    - 罗克韦尔特别大胆
    - 脚本 MT 粗体
    - Segoe WP 黑色
    - Tekton Pro 分机
    - 模板标准

    最佳答案

    经过大量的试验,我已经弄清楚了。来自 OS/2表中,大多数程序查看 2 个值:

  • usWeightClass值为 549
    或以下,字体将变得更多
    胆大。
  • fsSelection设置了第 5 位,它
    无论 usWeightClass 中的值如何,都不会变得更粗。 (上面的#1)。
  • 关于.net - 字体文件中的什么属性使程序决定模拟粗体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3672803/

    相关文章:

    c# - 未针对 CompositeCollection 和嵌套 CollectionViewSource.Source 绑定(bind)正确引发依赖项 PropertyChangedHandler

    .net - WPF 图像 UriSource、数据绑定(bind)和缓存

    android - Android 中的泰米尔语字体

    java - 在 java servlet 中嵌入 Apache fop 2.1

    c# - 为什么这段代码不能证明读/写的非原子性?

    c# - 哪个由 C#.NET 的契约框架设计?

    c# - 为什么使用 GMAIL : text/html; is missing when use MailItem in Outlook plugin, GMAIL.COM 的 SMTP 服务器对 header 内容类型 : SMTP. 进行编码?

    .net - 我的项目的代码指标

    wpf - 我可以从工作线程初始化 ViewModel 吗?

    fonts - fontconfig 中 fc-cache 的目的是什么?