void RenderWithMiniAgg(Typeface typeface, char testChar, float sizeInPoint) { //2. glyph-to-vxs builder var builder = new GlyphPathBuilderVxs(typeface); builder.Build(testChar, sizeInPoint); VertexStore vxs = builder.GetVxs(); //5. use PixelFarm's Agg to render to bitmap... //5.1 clear background p.Clear(PixelFarm.Drawing.Color.White); //if (chkFillBackground.Checked) //{ //5.2 p.FillColor = PixelFarm.Drawing.Color.Black; //5.3 p.Fill(vxs); //} //if (chkBorder.Checked) //{ //5.4 p.StrokeColor = PixelFarm.Drawing.Color.Green; //user can specific border width here... //p.StrokeWidth = 2; //5.5 p.Draw(vxs); //} //6. use this util to copy image from Agg actual image to System.Drawing.Bitmap //BitmapHelper.CopyToWindowsBitmap(destImg, winBmp, new RectInt(0, 0, 300, 300)); ////--------------- ////7. just render our bitmap //g.Clear(Color.White); //g.DrawImage(winBmp, new Point(10, 0)); }
void LoadGlyphs() { using (FileStream fs = new FileStream("tahoma.ttf", FileMode.Open)) { OpenTypeReader reader = new OpenTypeReader(); Typeface typeface = reader.Read(fs); var testChar = 'a'; var builder = new GlyphPathBuilderVxs(typeface); float sizeInPoint = 48; builder.Build(testChar, sizeInPoint); vxs = builder.GetVxs(); } }