Exemple #1
0
        public MySimpleGLBitmapFontManager(TextureKind textureKind, LayoutFarm.OpenFontTextService textServices)
        {
            this.textServices = textServices;
            //glyph cahce for specific atlas
            _loadedGlyphs = new GLBitmapCache <SimpleFontAtlas>(atlas =>
            {
                //create new one
                Typography.Rendering.GlyphImage totalGlyphImg = atlas.TotalGlyph;
                //load to glbmp
                GLBitmap found = new GLBitmap(totalGlyphImg.Width, totalGlyphImg.Height, totalGlyphImg.GetImageBuffer(), false);
                found.IsInvert = false;
                return(found);
            });

            _textureKind = textureKind;
        }
        public GLBmpGlyphTextPrinter(GLCanvasPainter painter, IFontLoader fontLoader)
        {
            //create text printer for use with canvas painter
            this.painter       = painter;
            this.canvas2d      = painter.Canvas;
            GlyphPosPixelSnapX = GlyphPosPixelSnapKind.Integer;
            GlyphPosPixelSnapY = GlyphPosPixelSnapKind.Integer;

            _fontLoader = fontLoader;
            ChangeFont(painter.CurrentFont);
            this._glyphLayout.ScriptLang = painter.CurrentFont.GetOpenFontScriptLang();

            _loadedGlyphs = new GLBitmapCache <SimpleFontAtlas>(atlas =>
            {
                //create new one
                Typography.Rendering.GlyphImage totalGlyphImg = atlas.TotalGlyph;
                //load to glbmp
                GLBitmap found = new GLBitmap(totalGlyphImg.Width, totalGlyphImg.Height, totalGlyphImg.GetImageBuffer(), false);
                found.IsInvert = false;
                return(found);
            });
        }