public void FillTextRun(TextRun textRun, float x, float y) { //fill text run at spefic pos List <GlyphRun> glyphs = textRun._glyphs; int j = glyphs.Count; float accX = 0; float accY = 0; float nx = x; float ny = y; float pxscale = _textPrinter.Typeface.CalculateScaleToPixelFromPointSize(_textPrinter.FontSizeInPoints); for (int i = 0; i < j; ++i) { //render each glyph GlyphRun run = glyphs[i]; Typography.TextLayout.UnscaledGlyphPlan plan = run.GlyphPlan; nx = x + accX + plan.OffsetX * pxscale; ny = y + accY + plan.OffsetY * pxscale; _fillShader.SetOffset(nx, ny); accX += (plan.AdvanceX * pxscale); _fillShader.FillTriangles( run.tessData, run.nTessElements, this.FillColor ); } _fillShader.SetOffset(0, 0); }
public ushort nTessElements; //2 internal GlyphRun(Typography.TextLayout.UnscaledGlyphPlan glyphPlan, float[] tessData, ushort nTessElements) { _glyphPlan = glyphPlan; this.tessData = tessData; this.nTessElements = nTessElements; }
internal GlyphRun(Typography.TextLayout.UnscaledGlyphPlan glyphPlan, float[] tessData, ushort vertextCount) { _glyphPlan = glyphPlan; _tessData = tessData; _vertextCount = vertextCount; }