public override void Draw(DrawingContext drawingContext, float scale, float x, float y) { base.Draw(drawingContext, scale, x, y); // Draw character at given position. Vector2 vPos = new Vector2((x - bearing) * scale, (y - depth) * scale); Vector2 vSize = new Vector2((bearing + italic) * scale, totalHeight * scale); switch (type) { case TexAssetType.Font: drawingContext.Draw(i, vPos, vSize, c.uvBottomRight, c.uvTopRight, c.uvTopLeft, c.uvBottomLeft); break; case TexAssetType.Sprite: var uv = this.uv; if (o.alphaOnly) { drawingContext.Draw(i, vPos, vSize, uv.min, new Vector2(uv.xMax, uv.y), uv.max, new Vector2(uv.x, uv.yMax)); } else { //Using RGB? then the color should be black //see the shader why it's happen to be like that TexContext.Color.Push(new Color32(0, 0, 0, 1)); drawingContext.Draw(i, vPos, vSize, new Vector2(uv.xMax, uv.y), uv.max, new Vector2(uv.x, uv.yMax), uv.min); TexContext.Color.Pop(); } break; #if TEXDRAW_TMP case TexAssetType.FontSigned: { uv = this.uv; drawingContext.Draw(i, vPos, vSize, new Vector2(uv.xMax, uv.y), uv.max, new Vector2(uv.x, uv.yMax), uv.min); } break; #endif } }
public override void Draw(DrawingContext drawingContext, float scale, float x, float y) { base.Draw(drawingContext, scale, x, y); // Draw character at given position. //CharacterInfo c; //DrawingContext.GetCharInfo(fontIndex, (char)character.index, drawingContext.prefFontSize, FontStyle.Normal, out c); Vector2 vPos, vSize; /*if (c.size > 0) { * var factor = scaleApplied / (float)c.size; * var ratio = scale * factor; * vPos = new Vector2((x + c.minX * factor) * scale, (y + c.minY * factor) * scale); * vSize = new Vector2(c.glyphWidth * ratio, c.glyphHeight * ratio); * width = c.advance * factor; * } else*/{ vPos = new Vector2((x - bearing) * scale, (y - depth) * scale); vSize = new Vector2((bearing + italic) * scale, totalHeight * scale); } var c = character; drawingContext.Draw(fontIndex, vPos, vSize, c.uvBottomLeft, c.uvBottomRight, c.uvTopRight, c.uvTopLeft); }
public override void Draw(DrawingContext drawingContext, float scale, float x, float y) { base.Draw(drawingContext, scale, x, y); Vector2 z = Vector2.zero; drawingContext.Draw(TexUtility.blockFontIndex + (useXDepth ? 1 : 0), new Vector2( (x) * scale, (y - depth) * scale), new Vector2(width * scale, totalHeight * scale) , z, z, z, z); }
public override void Draw(DrawingContext drawingContext, float scale, float x, float y) { base.Draw(drawingContext, scale, x, y); // Draw character at given position. Vector2 vPos = new Vector2((x - bearing) * scale, (y - depth) * scale); Vector2 vSize = new Vector2((bearing + italic) * scale, totalHeight * scale); TexChar ch = character.ch; if (ch.font.type == TexFontType.Font) { drawingContext.Draw(ch.fontIndex, vPos, vSize, c.uvBottomRight, c.uvTopRight, c.uvTopLeft, c.uvBottomLeft); } else { Rect u = ch.sprite_uv; if (!ch.font.sprite_alphaOnly) { //Using RGB? then the color should be black //see the shader why it's happen to be like that Color tmpC = TexUtility.RenderColor; TexUtility.RenderColor = Color.black; drawingContext.Draw(ch.fontIndex, vPos, vSize, new Vector2(u.xMax, u.yMin), u.max, new Vector2(u.xMin, u.yMax), u.min); TexUtility.RenderColor = tmpC; } else { drawingContext.Draw(ch.fontIndex, vPos, vSize, new Vector2(u.xMax, u.yMin), u.max, new Vector2(u.xMin, u.yMax), u.min); } } }
void Draw(DrawingContext context, Vector2[] verts) { context.Draw(fontIdx, verts, uv); }