static Typefaces GetGlobalTypefaces() { var reader = new OpenFontReader(); Typeface LoadFont(string fileName) { var typeface = reader.Read( System.Reflection.Assembly.GetExecutingAssembly() .GetManifestResourceStream($"CSharpMath.Rendering.Reference_Fonts.{fileName}") ); if (typeface == null) { throw new Structures.InvalidCodePathException("Invalid predefined font!"); } typeface.UpdateAllCffGlyphBounds(); return(typeface); } var globalTypefaces = new Typefaces(LoadFont("latinmodern-math.otf")); globalTypefaces.AddOverride(LoadFont("AMS-Capital-Blackboard-Bold.otf")); globalTypefaces.AddSupplement(LoadFont("cyrillic-modern-nmr10.otf")); return(globalTypefaces); }
public Fonts(IEnumerable <Typeface> localTypefaces, float pointSize) { PointSize = pointSize; Typefaces = localTypefaces.Concat(GlobalTypefaces); MathTypeface = Typefaces.First(t => t.HasMathTable()); MathConsts = MathTypeface.MathConsts ?? throw new Structures.InvalidCodePathException(nameof(MathTypeface) + " doesn't have " + nameof(MathConsts)); }
static Fonts() { var reader = new OpenFontReader(); Typeface LoadFont(string fileName) { var typeface = reader.Read( System.Reflection.Assembly.GetExecutingAssembly() .GetManifestResourceStream($"CSharpMath.Rendering.Reference_Fonts.{fileName}") ); typeface.UpdateAllCffGlyphBounds(); return(typeface); } GlobalTypefaces = new Typefaces(LoadFont("latinmodern-math.otf")); GlobalTypefaces.AddOverride(LoadFont("AMS-Capital-Blackboard-Bold.otf")); GlobalTypefaces.AddSupplement(LoadFont("cyrillic-modern-nmr10.otf")); }
IEnumerator IEnumerable.GetEnumerator() => Typefaces.GetEnumerator();
public IEnumerator <Typeface> GetEnumerator() => Typefaces.GetEnumerator();
public Fonts(IList <Typeface> localTypefaces, float pointSize) { PointSize = pointSize; Typefaces = localTypefaces.Concat(GlobalTypefaces); MathTypeface = Typefaces.First(t => t.HasMathTable()); }