UnityEngine.UI.Text.OnPopulateMesh C# (CSharp) Method

OnPopulateMesh() protected method

protected OnPopulateMesh ( VertexHelper toFill ) : void
toFill VertexHelper
return void
        protected override void OnPopulateMesh(VertexHelper toFill)
        {
            if (this.font != null)
            {
                this.m_DisableFontTextureRebuiltCallback = true;
                Vector2 size = base.rectTransform.rect.size;
                TextGenerationSettings generationSettings = this.GetGenerationSettings(size);
                this.cachedTextGenerator.PopulateWithErrors(this.text, generationSettings, base.gameObject);
                IList<UIVertex> verts = this.cachedTextGenerator.verts;
                float num = 1f / this.pixelsPerUnit;
                int num2 = verts.Count - 4;
                UIVertex vertex = verts[0];
                UIVertex vertex2 = verts[0];
                Vector2 point = (Vector2) (new Vector2(vertex.position.x, vertex2.position.y) * num);
                point = base.PixelAdjustPoint(point) - point;
                toFill.Clear();
                if (point != Vector2.zero)
                {
                    for (int i = 0; i < num2; i++)
                    {
                        int index = i & 3;
                        this.m_TempVerts[index] = verts[i];
                        this.m_TempVerts[index].position = (Vector3) (this.m_TempVerts[index].position * num);
                        this.m_TempVerts[index].position.x += point.x;
                        this.m_TempVerts[index].position.y += point.y;
                        if (index == 3)
                        {
                            toFill.AddUIVertexQuad(this.m_TempVerts);
                        }
                    }
                }
                else
                {
                    for (int j = 0; j < num2; j++)
                    {
                        int num6 = j & 3;
                        this.m_TempVerts[num6] = verts[j];
                        this.m_TempVerts[num6].position = (Vector3) (this.m_TempVerts[num6].position * num);
                        if (num6 == 3)
                        {
                            toFill.AddUIVertexQuad(this.m_TempVerts);
                        }
                    }
                }
                this.m_DisableFontTextureRebuiltCallback = false;
            }
        }