Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonFont"/> class.
 /// </summary>
 /// <param name="name">The name of the font.</param>
 /// <param name="factory">The factory that this font is registered with.</param>
 /// <param name="info">The information used to create the font.</param>
 /// <param name="fontHeight">The height of the font, in pixels.</param>
 /// <param name="lineHeight">The height of a line, in pixels.</param>
 /// <param name="ascent">The font ascent, in pixels.</param>
 /// <param name="descent">The font descent, in pixels.</param>
 /// <param name="glyphs">The glyphs for the font.</param>
 /// <param name="textures">The textures for the font.</param>
 /// <param name="kerningPairs">The kerning pairs for the font.</param>
 internal GorgonFont(string name,
                     GorgonFontFactory factory,
                     IGorgonFontInfo info,
                     float fontHeight,
                     float lineHeight,
                     float ascent,
                     float descent,
                     IReadOnlyList <GorgonGlyph> glyphs,
                     IReadOnlyList <GorgonTexture2D> textures,
                     IReadOnlyDictionary <GorgonKerningPair, int> kerningPairs)
     : base(name)
 {
     Factory = factory;
     _info   = new GorgonFontInfo(info)
     {
         Brush = info.Brush.Clone()
     };
     Graphics          = Factory.Graphics;
     FontHeight        = fontHeight;
     LineHeight        = lineHeight;
     Ascent            = ascent;
     Descent           = descent;
     Glyphs            = new GorgonGlyphCollection(glyphs);
     KerningPairs      = kerningPairs?.ToDictionary(k => k.Key, v => v.Value) ?? new Dictionary <GorgonKerningPair, int>();
     _internalTextures = new List <GorgonTexture2D>(textures);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GorgonFont"/> class.
 /// </summary>
 /// <param name="name">The name of the font.</param>
 /// <param name="factory">The factory that created this font.</param>
 /// <param name="info">The information used to generate the font.</param>
 internal GorgonFont(string name, GorgonFontFactory factory, IGorgonFontInfo info)
     : base(name)
 {
     Factory  = factory;
     Graphics = Factory.Graphics;
     _info    = new GorgonFontInfo(info)
     {
         Brush = info.Brush?.Clone()
     };
     _internalTextures = new List <GorgonTexture2D>();
     Glyphs            = new GorgonGlyphCollection();
     KerningPairs      = new Dictionary <GorgonKerningPair, int>();
 }