コード例 #1
0
        public async Task build_full_unicode_table()
        {
            var textureCount = 0;

            GlyphLoadResult lastGlyph = new GlyphLoadResult();

            var font = await DrawingContext.FontLoader.LoadFont("simhei");

            for (var c = char.MinValue; c < char.MaxValue; c++)
            {
                var glyph = font.LoadGlyph(c);
                if (glyph.CreatesNewTexture && lastGlyph.Texture != null)
                {
                    SaveFrame(
                        ExpandMonoTexture(lastGlyph.Texture),
                        $"{ nameof(build_full_unicode_table) }-{ textureCount++ }.png");
                }

                if (glyph.Texture != null)
                {
                    lastGlyph = glyph;
                }
            }

            if (lastGlyph.Texture != null)
            {
                SaveFrame(
                    ExpandMonoTexture(lastGlyph.Texture),
                    $"{ nameof(build_full_unicode_table) }-{ textureCount++ }.png");
            }
        }
コード例 #2
0
        private Texture CreateGlyphTexture(GlyphLoadResult glyph)
        {
            if (glyph.Texture == null)
            {
                return(null);
            }

            if (glyph.CreatesNewTexture)
            {
                // TODO:
                //return PlatformCreateNewTexture(glyph.Texture.Width, glyph.Texture.Height, glyph.Texture.Pixels);
            }

            //PlatformUpdateTexture(glyph.Texture.Pixels);
            return(null);
        }
コード例 #3
0
        private Texture <T> CreateGlyphTexture(GlyphLoadResult glyph)
        {
            if (glyph.Texture == null)
            {
                return(null);
            }

            if (glyph.CreatesNewTexture)
            {
                return(textureBuilder = Create8BppTexture(glyph.Texture.Width, glyph.Texture.Height, glyph.Texture.Pixels));
            }

            Debug.Assert(textureBuilder != null);

            Update8bppTexture(textureBuilder.PlatformTexture, glyph.Texture.Width, glyph.Texture.Height, glyph.Texture.Pixels);

            return(textureBuilder);
        }
コード例 #4
0
        public async Task build_default_ascii_table()
        {
            var fontLoader = Container.Get <IFontLoader>();
            var font       = await fontLoader.LoadFont();

            var textureCount = 0;

            GlyphLoadResult lastGlyph = new GlyphLoadResult();

            for (var c = 0; c < 128; c++)
            {
                var glyph = font.LoadGlyph((char)c);
                if (glyph.Texture != null)
                {
                    lastGlyph = glyph;
                }
            }
            var output = $"{ OutputPath }/{ nameof(FontRendererTest) }/{ nameof(build_default_ascii_table) }-{ textureCount++ }.png";

            SaveFrame(ExpandMonoTexture(lastGlyph.Texture), output);
        }
コード例 #5
0
        public async Task build_default_ascii_table()
        {
            var textureCount = 0;

            GlyphLoadResult lastGlyph = new GlyphLoadResult();

            var font = await DrawingContext.FontLoader.LoadFont();

            for (var c = '\0'; c <= '\u00FF'; c++)
            {
                var glyph = font.LoadGlyph(c);
                if (glyph.Texture != null)
                {
                    lastGlyph = glyph;
                }
            }

            SaveFrame(
                ExpandMonoTexture(lastGlyph.Texture),
                $"{ nameof(build_default_ascii_table) }-{ textureCount++ }.png");
        }