void DrawLabel() { // Exit if label layout not defined if (labelLayout.glyphLayout == null || labelLayout.glyphLayout.Length == 0) { return; } // Set render area Material material = font.GetMaterial(); Vector4 scissorRect = (useRestrictedRenderArea) ? GetRestrictedRenderScissorRect() : new Vector4(0, 1, 0, 1); material.SetVector("_ScissorRect", scissorRect); // Draw glyphs with classic layout Rect totalRect = Rectangle; for (int i = 0; i < labelLayout.glyphLayout.Length; i++) { GlyphLayoutData glyphLayout = labelLayout.glyphLayout[i]; Rect targetRect = new Rect( totalRect.x + glyphLayout.x * LocalScale.x * textScale + HorzPixelScrollOffset * LocalScale.x * textScale, totalRect.y + glyphLayout.y * LocalScale.y * textScale, glyphLayout.glyphWidth * LocalScale.x * textScale, font.GlyphHeight * LocalScale.y * textScale); font.DrawClassicGlyph(glyphLayout.glyphRawAscii, targetRect, textColor, shadowPosition * LocalScale, shadowColor); } }
void DrawLabel() { // Exit if no layout if (glyphLayout.Count == 0) { return; } // Set render area Material material = font.GetMaterial(); Vector4 scissorRect = (UseRestrictedRenderArea) ? GetRestrictedRenderScissorRect() : new Vector4(0, 1, 0, 1); material.SetVector("_ScissorRect", scissorRect); // Draw glyphs with classic layout if (!font.IsSDFCapable) { Rect totalRect = Rectangle; for (int i = 0; i < glyphLayout.Count; i++) { GlyphLayoutData glyph = glyphLayout[i]; Rect targetRect = new Rect( totalRect.x + glyph.x * LocalScale.x * textScale + HorzPixelScrollOffset * LocalScale.x * textScale, totalRect.y + glyph.y * LocalScale.y * textScale, glyph.width * LocalScale.x * textScale, font.GlyphHeight * LocalScale.y * textScale); font.DrawClassicGlyph((byte)glyph.code, targetRect, textColor, shadowPosition * LocalScale, shadowColor); } } else { Rect totalRect = Rectangle; for (int i = 0; i < glyphLayout.Count; i++) { GlyphLayoutData glyph = glyphLayout[i]; Vector2 position = new Vector2( totalRect.x + glyph.x * LocalScale.x * textScale + HorzPixelScrollOffset * LocalScale.x * textScale, totalRect.y + glyph.y * LocalScale.y * textScale); font.DrawSDFGlyph(glyph.code, position, LocalScale * textScale, textColor, shadowPosition * LocalScale, shadowColor); } } }