public bool Install() { if (Installed()) { Console.WriteLine($"Failed to install font {Name}-{Family}: Can't install a font if the font is already installed"); return(false); } try { FontInstaller.InstallFontFile(IntPtr.Zero, Path, FontInstallFlags.CopyAndInstall); // Alternative method //var shell = new Shell32.Shell(); //var fontsDirectory = shell.NameSpace(0x14); //fontsDirectory.CopyHere(Path); return(true); } catch (Exception ex) { Console.WriteLine($"Failed to install font {Name}-{Family}: {ex}"); return(false); } }
public void InstallFont(string fontFilePath) { FontInstaller.CopyFontToWindowsFontFolder(fontFilePath); }