Ejemplo n.º 1
0
        /// <summary>
        /// Create a <see cref="PixelGlyphMap"/> for the given system font.
        /// </summary>
        /// <param name="name">Name of the system font.</param>
        /// <param name="size">Size to render the font at.</param>
        /// <param name="ranges">The character ranges to render to the font atlas.</param>
        /// <param name="glyphMap">The glyph map of the font atlas.</param>
        /// <param name="image">The image of the font atlas.</param>
        public static void CreateSystemFont(string name, float size, IEnumerable <Range <int> > ranges, out PixelGlyphMap glyphMap, out Image <Rgba32> image)
        {
            var fab = new FontAtlasBuilder();

            fab.AddSystemFont(name, size, ranges);
            RenderGlyphMap(fab, out glyphMap, out image);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a <see cref="PixelGlyphMap"/> for the given system font.
        /// </summary>
        /// <param name="fontStream">Stream of the font data.</param>
        /// <param name="size">Size to render the font at.</param>
        /// <param name="ranges">The character ranges to render to the font atlas.</param>
        /// <param name="glyphMap">The glyph map of the font atlas.</param>
        /// <param name="image">The image of the font atlas.</param>
        public static void CreateFont(Stream fontStream, float size, IEnumerable <Range <int> > ranges, out PixelGlyphMap glyphMap, out Image <Rgba32> image)
        {
            var fab = new FontAtlasBuilder();

            fab.AddFont(fontStream, size, ranges);
            RenderGlyphMap(fab, out glyphMap, out image);
        }
Ejemplo n.º 3
0
        private static void RenderGlyphMap(FontAtlasBuilder fab, out PixelGlyphMap glyphMap, out Image <Rgba32> img)
        {
            var atlas = fab.CreateAtlas();

            glyphMap = atlas[0];
            img      = atlas.RenderImage();
        }