C# font远程服务器字体无法显示

项目中使用了System.Drawing相关的font,本地正常,远程显示方块,可以把本地字体文件复制到远程。关键代码:

System.Drawing.Text.PrivateFontCollection privateFonts = new System.Drawing.Text.PrivateFontCollection();
 
//添加字体文件,可以添加多个
//web中,路径映射方式参考:System.Web.HttpContext.Current.Server.MapPath("/font/SourceHanSansCN-Medium.otf")
privateFonts.AddFontFile("d:\\font\\SourceHanSansCN-Medium.otf");  
 
System.Drawing.Font font = new Font(privateFonts.Families[0], 12);

 

posted on 2022-12-27 09:24  静以修身俭以养德  阅读(66)  评论(0编辑  收藏  举报

导航