[英]AngleSharp.CSS to extract fontfamily does not work
我嘗試在 css 文件中提取字體系列名稱。 在調試中查看時,字體系列名稱存在,當我通過 SetFontFamily 修改它時,但 GetFontFamiliy 不返回任何內容。
public void CssStyleSheettractFontFamily()
{
var parser = new CssParser();
var source = "<!-- body { font-family: Verdana } div.hidden { display: none } -->";
ICssStyleSheet sheet = parser.ParseStyleSheet(source);
Debug.Print( sheet.Rules.Length.ToString());
foreach (ICssStyleRule rule in sheet.Rules)
{
Debug.Print(rule.CssText);
rule.Style.SetFontFamily("Verdana Bold");
Debug.Print("fontfamily", rule.Style.GetFontFamily());
Debug.Print("fontSize", rule.Style.GetFontSize());
}
}
有什么建議嗎?
如此基本,我並沒有真正打印出來。 請參閱下面的解決方案。
Debug.Print("fontfamily {0}", rule.Style.GetFontFamily());
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.