这里贴一段VB的代码,C#参照也是类似的,读取C盘字体库中的字体,判断字体是否存在,不存在即可使用特殊方法对字体进行安装
这对部分B/S搭建的软件还是能起到作用的,毕竟有些软件设置的字体在系统库中并不存在,如果不安得话,会出现各种乱码的情况,所以
才需要这么做
Private Sub CheckPmingLiuFont() Implements IHealthCheck.CheckPmingLiuFont Try Dim lo_Fkey As RegistryKey = Registry.LocalMachine Dim lo_Rkey As RegistryKey = lo_Fkey.OpenSubKey("SOFTWAREMicrosoftWindows NTCurrentVersionFonts") Dim ls_FontName() As String = lo_Rkey.GetValueNames() Print("20. Check the PMingLiu font.") For Each c In ls_FontName Dim myvalue As String = lo_Rkey.GetValue(c).ToString If myvalue = "mingliu.ttc" Then Print("PMingLiu is existing.") Exit Sub End If Next Catch ex As Exception End Try End Sub