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); } } }