예제 #1
0
        public static FontFace LoadFont(string fontfile,
                                        ScriptLang scriptLang,
                                        WriteDirection writeDirection,
                                        out SimpleFontAtlas fontAtlas)
        {
            //1. read font info
            ManagedFontFace openFont = (ManagedFontFace)OpenFontLoader.LoadFont(fontfile, scriptLang, writeDirection);

            //2. build texture font on the fly! OR load from prebuilt file
            //
            //2.1 test build texture on the fly
            SimpleFontAtlasBuilder atlas1    = CreateSampleMsdfTextureFont(fontfile, 14, 0, 255);
            GlyphImage             glyphImg2 = atlas1.BuildSingleImage();

            fontAtlas            = atlas1.CreateSimpleFontAtlas();
            fontAtlas.TotalGlyph = glyphImg2;

            //string xmlFontFileInfo = "";
            //GlyphImage glyphImg = null;
            //MySimpleFontAtlasBuilder atlasBuilder = new MySimpleFontAtlasBuilder();
            //SimpleFontAtlas fontAtlas = atlasBuilder.LoadFontInfo(xmlFontFileInfo);
            //glyphImg = atlasBuilder.BuildSingleImage(); //we can create a new glyph or load from prebuilt file
            //fontAtlas.TotalGlyph = glyphImg;


            var textureFontFace = new TextureFontFace(openFont, fontAtlas);

            return(textureFontFace);
        }
예제 #2
0
 internal TextureFont(TextureFontFace typeface, float sizeInPoints)
 {
     this.typeface  = typeface;
     this.fontAtlas = typeface.FontAtlas;
     actualFont     = typeface.InnerFontFace.GetFontAtPointsSize(sizeInPoints);
 }