void Showfont(IFont font, Color c) { graphics.Clear(); graphics.CurrentFont = font; Console.WriteLine(font.GetType().Name); if (font is GFXFontBase) { graphics.CurrentFont = new Font8x12(); graphics.DrawText(3, 3, font.GetType().Name.Replace("GFXFont_", "").Replace("7b", ""), Color.LawnGreen); graphics.CurrentFont = font; GFXCharacterTest(c); } else if (font.GetType().Name == "Petscii8x8" || font.GetType().Name == "ibm327012x20") { graphics.CurrentFont = font; UnicodeTest(c); } else { graphics.CurrentFont = font; CharacterTest(c); } MonitorMemory(); Thread.Sleep(1000); }
private static void CacheFont(IFont font) { if (!Directory.Exists(FontCacheDirectory)) { Directory.CreateDirectory(FontCacheDirectory); } var outputPath = Path.Combine(FontCacheDirectory, font.FontFileName); if (!File.Exists(outputPath)) { var assembly = font.GetType().Assembly; var resourceId = assembly.GetManifestResourceNames().FirstOrDefault(x => x.EndsWith(font.FontFileName)); if (string.IsNullOrEmpty(resourceId)) { throw new FontNotFoundException(font); } using var resourceStream = assembly.GetManifestResourceStream(resourceId); using var fileStream = File.OpenWrite(outputPath); resourceStream.CopyTo(fileStream); } PlatformInitFont(outputPath, font); }
public void SetCellFont(ICellStyle hssfCellStyle, IWorkbook hssfWorkbook) { if (IFont == null) { IFont = hssfWorkbook.CreateFont(); Type hssfFontType = IFont.GetType(); for (int iLoop = 0; iLoop < Properties.Count; iLoop++) { PropertyInfo property = hssfFontType.GetProperty(Properties[iLoop]); object value = Arguments[iLoop].GetValue(); property.SetValue(IFont, value, null); } } hssfCellStyle.SetFont(IFont); }