Exemple #1
0
        void RenderByGlyphName(string selectedGlyphName)
        {
            //---------------------------------------------
            //this version only render with MiniAgg**
            //---------------------------------------------

            _painter.Clear(PixelFarm.Drawing.Color.White);
            _painter.UseSubPixelLcdEffect = _contourAnalysisOpts.LcdTechnique;
            _painter.FillColor            = PixelFarm.Drawing.Color.Black;

            _selectedTextPrinter                   = _devVxsTextPrinter;
            _selectedTextPrinter.Typeface          = _basicOptions.Typeface;
            _selectedTextPrinter.FontSizeInPoints  = _basicOptions.FontSizeInPoints;
            _selectedTextPrinter.ScriptLang        = _basicOptions.ScriptLang;
            _selectedTextPrinter.PositionTechnique = _basicOptions.PositionTech;

            _selectedTextPrinter.HintTechnique  = _glyphRenderOptions.HintTechnique;
            _selectedTextPrinter.EnableLigature = _glyphRenderOptions.EnableLigature;

            //test print 3 lines
#if DEBUG
            GlyphDynamicOutline.dbugTestNewGridFitting    = _contourAnalysisOpts.EnableGridFit;
            GlyphDynamicOutline.dbugActualPosToConsole    = _contourAnalysisOpts.WriteFitOutputToConsole;
            GlyphDynamicOutline.dbugUseHorizontalFitValue = _contourAnalysisOpts.UseHorizontalFitAlignment;
#endif


            float x_pos = 0, y_pos = 100;
            var   glyphPlanList = new Typography.TextLayout.UnscaledGlyphPlanList();


            //in this version
            //create a glyph-plan manully
            ushort selectedGlyphIndex =
                glyphNameListUserControl1.Typeface.GetGlyphIndexByName(selectedGlyphName);

            glyphPlanList.Append(
                new Typography.TextLayout.UnscaledGlyphPlan(0, selectedGlyphIndex, 0, 0, 0));

            var seq = new Typography.TextLayout.GlyphPlanSequence(
                glyphPlanList,
                0, 1);
            _selectedTextPrinter.DrawFromGlyphPlans(seq, x_pos, y_pos);

            char[] printTextBuffer = this.txtInputChar.Text.ToCharArray();
            float  lineSpacingPx   = _selectedTextPrinter.FontLineSpacingPx;
            for (int i = 0; i < 1; ++i)
            {
                _selectedTextPrinter.DrawString(printTextBuffer, x_pos, y_pos);
                y_pos -= lineSpacingPx;
            }


            //copy from Agg's memory buffer to gdi
            PixelFarm.CpuBlit.Imaging.BitmapHelper.CopyToGdiPlusBitmapSameSize(_destImg, _winBmp);
            _g.Clear(System.Drawing.Color.White);
            _g.DrawImage(_winBmp, new System.Drawing.Point(10, 0));
        }
Exemple #2
0
 internal void SetGlyphPlanSeq(GlyphPlanSequence seq)
 {
     this.glyphPlanSeq = seq;
     this._runWidth    = seq.CalculateWidth();
 }