c# - 如何让 C# 使用基于 css/svg 字体系列字符串的字体?

标签 c# css c#-4.0 svg font-family

在微软的 C# SVG 渲染引擎中,font-family 属性定义如下:

[SvgAttribute("font-family")]
public virtual Font FontFamily
{
    get { return this._font; }
    set { this._font = value; this.IsPathDirty = true; }
}

但是,这只适用于诸如

<text style='font-family:"Lucida Sans Unicode";font-size:12px;'>

当有多个字体系列时,例如

<text style='font-family:"Lucida Grande", "Lucida Sans Unicode", Verdana, Arial, Helvetica, sans-serif;font-size:12px;'>

已指定,它只是采用默认字体(Times New Roman)。

如何修改属性 FontFamily 以使用指定的第一个字体(如果存在)或后续字体(如果存在)?

最佳答案

不要单独包围字体系列类型,而是将它们作为一个单独的分组。

<text style='font-family:"Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica";font-size:12px;'>

关于c# - 如何让 C# 使用基于 css/svg 字体系列字符串的字体?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7841605/

相关文章:

c# - 为什么 XmlWriter 总是输出 utf-16 编码?

c# - 如何检查是否已选择/切换 winforms 控件?

c# - UWP - MediaPlayerElement 与 MediaElement

javascript设置宽度尺寸更改元素位置

SQL 到大数据的迁移?

c#-4.0 - 我们如何在 C# 中使用回调函数

c# - 使用 C# 和 AutoIt 向 Flash 游戏发送消息

jquery - CSS伪类覆盖类

html - CSS堆栈多个全宽div

c#-4.0 - XmlDocument选择节点: find an element by an attribute value only