public AggTextSpanPrinter(GLPainter canvasPainter, int w, int h)
        {
            //this class print long text into agg canvas
            //then copy pixel buffer from aff canvas to gl-bmp
            //then draw the  gl-bmp into target gl canvas


            //TODO: review here
            this.canvasPainter = canvasPainter;
            this._glsx         = canvasPainter.Canvas;
            bmpWidth           = w;
            bmpHeight          = h;

            _actualImage            = new ActualImage(bmpWidth, bmpHeight);
            _aggsx                  = new AggRenderSurface(_actualImage);
            _aggPainter             = new AggPainter(_aggsx);
            _aggPainter.FillColor   = Color.Black;
            _aggPainter.StrokeColor = Color.Black;

            //set default1
            _aggPainter.CurrentFont = canvasPainter.CurrentFont;
            var openFontStore = new Typography.TextServices.OpenFontStore();

            _vxsTextPrinter         = new VxsTextPrinter(_aggPainter, openFontStore);
            _aggPainter.TextPrinter = _vxsTextPrinter;
        }
        public GLBitmapGlyphTextPrinter(GLPainter painter, LayoutFarm.OpenFontTextService textServices)
        {
            //create text printer for use with canvas painter
            this.painter       = painter;
            this._glsx         = painter.Canvas;
            this._textServices = textServices;

            //_currentTextureKind = TextureKind.Msdf;
            //_currentTextureKind = TextureKind.StencilGreyScale;

            _myGLBitmapFontMx = new MySimpleGLBitmapFontManager(TextureKind.StencilLcdEffect, textServices);
            //change this to fit yours.
            _myGLBitmapFontMx.SetCurrentScriptLangs(
                new ScriptLang[]
            {
                ScriptLangs.Latin,
                ScriptLangs.Thai     //eg. Thai, for test with complex script, you can change to your own
            });

            //test textures...

            //GlyphPosPixelSnapX = GlyphPosPixelSnapKind.Integer;
            //GlyphPosPixelSnapY = GlyphPosPixelSnapKind.Integer;


            ChangeFont(painter.CurrentFont);
        }
Пример #3
0
 public GLPainter(GLRenderSurface glsx)
 {
     _glsx          = glsx;
     _width         = glsx.CanvasWidth;
     _height        = glsx.CanvasHeight;
     _fontFillColor = Color.Black;
     _clipBox       = new RectInt(0, 0, _width, _height);
     _arcTool       = new Arc();
     CurrentFont    = new RequestFont("tahoma", 14);
     UseVertexBufferObjectForRenderVx = true;
     //tools
     _igfxPathBuilder = InternalGraphicsPathBuilder.CreateNew();
 }
        public WinGdiFontPrinter(GLRenderSurface glsx, int w, int h)
        {
            this._glsx = glsx;
            _width     = w;
            _height    = h;
            bmpWidth   = w;
            bmpHeight  = h;

            memdc = new Win32.NativeWin32MemoryDc(bmpWidth, bmpHeight);
            //TODO: review here
            //use default font from current platform
            InitFont("tahoma", 14);
            memdc.SetTextColor(0);
        }