Align() static public method

Align the vertices to be right or center-aligned given the line width specified by NGUIText.lineWidth.
static public Align ( BetterList verts, int indexOffset, float offset ) : void
verts BetterList
indexOffset int
offset float
return void
Example #1
0
    static int Align(IntPtr L)
    {
        LuaScriptMgr.CheckArgsCount(L, 3);
        BetterList <Vector3> arg0 = (BetterList <Vector3>)LuaScriptMgr.GetNetObject(L, 1, typeof(BetterList <Vector3>));
        int   arg1 = (int)LuaScriptMgr.GetNumber(L, 2);
        float arg2 = (float)LuaScriptMgr.GetNumber(L, 3);

        NGUIText.Align(arg0, arg1, arg2);
        return(0);
    }
Example #2
0
 static int Align(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 3);
         BetterList <UnityEngine.Vector3> arg0 = (BetterList <UnityEngine.Vector3>)ToLua.CheckObject(L, 1, typeof(BetterList <UnityEngine.Vector3>));
         int   arg1 = (int)LuaDLL.luaL_checknumber(L, 2);
         float arg2 = (float)LuaDLL.luaL_checknumber(L, 3);
         NGUIText.Align(arg0, arg1, arg2);
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
Example #3
0
 static public int Align_s(IntPtr l)
 {
     try {
         BetterList <UnityEngine.Vector3> a1;
         checkType(l, 1, out a1);
         System.Int32 a2;
         checkType(l, 2, out a2);
         System.Single a3;
         checkType(l, 3, out a3);
         NGUIText.Align(a1, a2, a3);
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
Example #4
0
    private static int Align(IntPtr L)
    {
        int result;

        try
        {
            ToLua.CheckArgsCount(L, 3);
            BetterList <Vector3> verts = (BetterList <Vector3>)ToLua.CheckObject(L, 1, typeof(BetterList <Vector3>));
            int   indexOffset          = (int)LuaDLL.luaL_checknumber(L, 2);
            float printedWidth         = (float)LuaDLL.luaL_checknumber(L, 3);
            NGUIText.Align(verts, indexOffset, printedWidth);
            result = 0;
        }
        catch (Exception e)
        {
            result = LuaDLL.toluaL_exception(L, e, null);
        }
        return(result);
    }
Example #5
0
    /// <summary>
    /// Print the specified text into the buffers.
    /// Note: 'lineWidth' parameter should be in pixels.
    /// </summary>

    public void Print(string text, int size, Color32 color, BetterList <Vector3> verts, BetterList <Vector2> uvs, BetterList <Color32> cols,
                      bool encoding, SymbolStyle symbolStyle, TextAlignment alignment, int lineWidth, bool premultiply)
    {
        if (mReplacement != null)
        {
            mReplacement.Print(text, size, color, verts, uvs, cols, encoding, symbolStyle, alignment, lineWidth, premultiply);
        }
        else if (text != null)
        {
            if (!isValid)
            {
                Debug.LogError("Attempting to print using an invalid font!");
                return;
            }

#if DYNAMIC_FONT
            if (isDynamic)
            {
                NGUIText.Print(text, dynamicFont, size, mDynamicFontStyle, color, encoding,
                               alignment, lineWidth, premultiply, verts, uvs, cols);
                return;
            }
#endif
            mColors.Clear();
            mColors.Add(color);

            int     fs = size;
            int     indexOffset = verts.size;
            int     maxX = 0;
            int     x = 0;
            int     y = 0;
            int     prev = 0;
            int     lineHeight = (fs + mSpacingY);
            Vector3 v0 = Vector3.zero, v1 = Vector3.zero;
            Vector2 u0 = Vector2.zero, u1 = Vector2.zero;

            float invX = uvRect.width / mFont.texWidth;
            float invY = mUVRect.height / mFont.texHeight;

            int  textLength = text.Length;
            bool useSymbols = encoding && symbolStyle != SymbolStyle.None && hasSymbols && sprite != null;

            for (int i = 0; i < textLength; ++i)
            {
                char c = text[i];

                if (c == '\n')
                {
                    if (x > maxX)
                    {
                        maxX = x;
                    }

                    if (alignment != TextAlignment.Left)
                    {
                        NGUIText.Align(verts, indexOffset, alignment, x, lineWidth);
                        indexOffset = verts.size;
                    }

                    x    = 0;
                    y   += lineHeight;
                    prev = 0;
                    continue;
                }

                if (c < ' ')
                {
                    prev = 0;
                    continue;
                }

                if (encoding && NGUIText.ParseSymbol(text, ref i, mColors, premultiply))
                {
                    color = mColors[mColors.size - 1];
                    --i;
                    continue;
                }

                // See if there is a symbol matching this text
                BMSymbol symbol = useSymbols ? MatchSymbol(text, i, textLength) : null;

                if (symbol == null)
                {
                    BMGlyph glyph = mFont.GetGlyph(c);
                    if (glyph == null)
                    {
                        continue;
                    }

                    if (prev != 0)
                    {
                        x += glyph.GetKerning(prev);
                    }

                    if (c == ' ')
                    {
                        x   += mSpacingX + glyph.advance;
                        prev = c;
                        continue;
                    }

                    v0.x = (x + glyph.offsetX);
                    v0.y = -(y + glyph.offsetY);

                    v1.x = v0.x + glyph.width;
                    v1.y = v0.y - glyph.height;

                    u0.x = mUVRect.xMin + invX * glyph.x;
                    u0.y = mUVRect.yMax - invY * glyph.y;

                    u1.x = u0.x + invX * glyph.width;
                    u1.y = u0.y - invY * glyph.height;

                    x   += mSpacingX + glyph.advance;
                    prev = c;

                    if (glyph.channel == 0 || glyph.channel == 15)
                    {
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(color);
                        }
                    }
                    else
                    {
                        // Packed fonts come as alpha masks in each of the RGBA channels.
                        // In order to use it we need to use a special shader.
                        //
                        // Limitations:
                        // - Effects (drop shadow, outline) will not work.
                        // - Should not be a part of the atlas (eastern fonts rarely are anyway).
                        // - Lower color precision

                        Color col = color;

                        col *= 0.49f;

                        switch (glyph.channel)
                        {
                        case 1: col.b += 0.51f; break;

                        case 2: col.g += 0.51f; break;

                        case 4: col.r += 0.51f; break;

                        case 8: col.a += 0.51f; break;
                        }

                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(col);
                        }
                    }
                }
                else
                {
                    v0.x = (x + symbol.offsetX);
                    v0.y = -(y + symbol.offsetY);

                    v1.x = v0.x + symbol.width;
                    v1.y = v0.y - symbol.height;

                    Rect uv = symbol.uvRect;

                    u0.x = uv.xMin;
                    u0.y = uv.yMax;
                    u1.x = uv.xMax;
                    u1.y = uv.yMin;

                    x   += mSpacingX + symbol.advance;
                    i   += symbol.length - 1;
                    prev = 0;

                    if (symbolStyle == SymbolStyle.Colored)
                    {
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(color);
                        }
                    }
                    else
                    {
                        Color32 col = Color.white;
                        col.a = color.a;
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(col);
                        }
                    }
                }

                verts.Add(new Vector3(v1.x, v0.y));
                verts.Add(new Vector3(v1.x, v1.y));
                verts.Add(new Vector3(v0.x, v1.y));
                verts.Add(new Vector3(v0.x, v0.y));

                uvs.Add(new Vector2(u1.x, u0.y));
                uvs.Add(new Vector2(u1.x, u1.y));
                uvs.Add(new Vector2(u0.x, u1.y));
                uvs.Add(new Vector2(u0.x, u0.y));
            }

            if (alignment != TextAlignment.Left && indexOffset < verts.size)
            {
                NGUIText.Align(verts, indexOffset, alignment, x, lineWidth);
                indexOffset = verts.size;
            }
        }
    }
Example #6
0
    /// <summary>
    /// Print the specified text into the buffers.
    /// Note: 'lineWidth' parameter should be in pixels.
    /// </summary>

    public void Print(string text, BetterList <Vector3> verts, BetterList <Vector2> uvs, BetterList <Color32> cols)
    {
        if (mReplacement != null)
        {
            mReplacement.Print(text, verts, uvs, cols);
        }
        else if (!string.IsNullOrEmpty(text))
        {
            if (!isValid)
            {
                Debug.LogError("Attempting to print using an invalid font!");
                return;
            }

#if DYNAMIC_FONT
            if (isDynamic)
            {
                // NOTE: This shouldn't be used anymore. All dynamic font printing goes directly through NGUIText instead.
                NGUIText.current.size  = mDynamicFontSize;
                NGUIText.current.style = mDynamicFontStyle;
                NGUIText.Print(dynamicFont, text, verts, uvs, cols);
                return;
            }
#endif
            mColors.Add(Color.white);

            int     fs = NGUIText.current.size;
            int     indexOffset = verts.size;
            int     maxX = 0;
            int     x = 0;
            int     y = 0;
            int     prev = 0;
            int     lineHeight = (fs + NGUIText.current.spacingY);
            Vector3 v0 = Vector3.zero, v1 = Vector3.zero;
            Vector2 u0 = Vector2.zero, u1 = Vector2.zero;
            Color   gb = NGUIText.current.tint * NGUIText.current.gradientBottom;
            Color   gt = NGUIText.current.tint * NGUIText.current.gradientTop;
            Color32 uc = NGUIText.current.tint;

            float invX = uvRect.width / mFont.texWidth;
            float invY = mUVRect.height / mFont.texHeight;

            int  textLength = text.Length;
            bool useSymbols = NGUIText.current.encoding && NGUIText.current.symbolStyle != NGUIText.SymbolStyle.None && hasSymbols && sprite != null;

            for (int i = 0; i < textLength; ++i)
            {
                char c = text[i];

                if (c == '\n')
                {
                    if (x > maxX)
                    {
                        maxX = x;
                    }

                    if (NGUIText.current.alignment != TextAlignment.Left)
                    {
                        NGUIText.Align(verts, indexOffset, x - NGUIText.current.spacingX);
                        indexOffset = verts.size;
                    }

                    x    = 0;
                    y   += lineHeight;
                    prev = 0;
                    continue;
                }

                if (c < ' ')
                {
                    prev = 0;
                    continue;
                }

                bool isMineColor = false;

                if (NGUIText.current.encoding && NGUIText.ParseSymbol(text, ref i, mColors, NGUIText.current.premultiply, ref isMineColor))
                {
                    Color fc = mColors[mColors.size - 1];

                    if (isMineColor)
                    {
                        fc *= NGUIText.current.tint;
                    }

                    // *******************
                    // add sj.
                    // *******************
                    fc.a = uc.a / 255.0f;
                    // *******************
                    uc = fc;

                    if (NGUIText.current.gradient)
                    {
                        gb = NGUIText.current.gradientBottom * fc;
                        gt = NGUIText.current.gradientTop * fc;
                    }
                    --i;
                    continue;
                }

                // See if there is a symbol matching this text
                BMSymbol symbol = useSymbols ? MatchSymbol(text, i, textLength) : null;

                if (symbol == null)
                {
                    BMGlyph glyph = mFont.GetGlyph(c);
                    if (glyph == null)
                    {
                        continue;
                    }

                    if (prev != 0)
                    {
                        x += glyph.GetKerning(prev);
                    }

                    if (c == ' ')
                    {
                        x   += NGUIText.current.spacingX + glyph.advance;
                        prev = c;
                        continue;
                    }

                    v0.x = (x + glyph.offsetX);
                    v0.y = -(y + glyph.offsetY);

                    v1.x = v0.x + glyph.width;
                    v1.y = v0.y - glyph.height;

                    u0.x = mUVRect.xMin + invX * glyph.x;
                    u0.y = mUVRect.yMax - invY * glyph.y;

                    u1.x = u0.x + invX * glyph.width;
                    u1.y = u0.y - invY * glyph.height;

                    x   += NGUIText.current.spacingX + glyph.advance;
                    prev = c;

                    if (NGUIText.current.gradient)
                    {
                        float min = NGUIText.current.size - glyph.offsetY;
                        float max = min - glyph.height;

                        min /= NGUIText.current.size;
                        max /= NGUIText.current.size;

                        s_c0 = Color.Lerp(gb, gt, min);
                        s_c1 = Color.Lerp(gb, gt, max);

                        cols.Add(s_c0);
                        cols.Add(s_c1);
                        cols.Add(s_c1);
                        cols.Add(s_c0);
                    }
                    else
                    {
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(uc);
                        }
                    }
                }
                else
                {
                    v0.x = (x + symbol.offsetX);
                    v0.y = -(y + symbol.offsetY);

                    v1.x = v0.x + symbol.width;
                    v1.y = v0.y - symbol.height;

                    Rect uv = symbol.uvRect;

                    u0.x = uv.xMin;
                    u0.y = uv.yMax;
                    u1.x = uv.xMax;
                    u1.y = uv.yMin;

                    x   += NGUIText.current.spacingX + symbol.advance;
                    i   += symbol.length - 1;
                    prev = 0;

                    if (NGUIText.current.symbolStyle == NGUIText.SymbolStyle.Colored)
                    {
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(uc);
                        }
                    }
                    else
                    {
                        Color32 col = Color.white;
                        col.a = uc.a;
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(col);
                        }
                    }
                }

                verts.Add(new Vector3(v1.x, v0.y));
                verts.Add(new Vector3(v1.x, v1.y));
                verts.Add(new Vector3(v0.x, v1.y));
                verts.Add(new Vector3(v0.x, v0.y));

                uvs.Add(new Vector2(u1.x, u0.y));
                uvs.Add(new Vector2(u1.x, u1.y));
                uvs.Add(new Vector2(u0.x, u1.y));
                uvs.Add(new Vector2(u0.x, u0.y));
            }

            if (NGUIText.current.alignment != TextAlignment.Left && indexOffset < verts.size)
            {
                NGUIText.Align(verts, indexOffset, x - NGUIText.current.spacingX);
                indexOffset = verts.size;
            }
            mColors.Clear();
        }
    }
Example #7
0
    /// <summary>
    /// Print the caret and selection vertices. Note that it's expected that 'text' has been stripped clean of symbols.
    /// </summary>

    static public void PrintCaretAndSelection(string text, int start, int end, BetterList <Vector3> caret, BetterList <Vector3> highlight)
    {
        if (string.IsNullOrEmpty(text))
        {
            text = " ";
        }

        Prepare(text);

        int caretPos = end;

        if (start > end)
        {
            end   = start;
            start = caretPos;
        }

        float x = 0f, y = 0f, maxX = 0f, fs = size;
        float lineHeight = size + spacingY;
        int   caretOffset = (caret != null) ? caret.size : 0;
        int   highlightOffset = (highlight != null) ? highlight.size : 0;
        int   textLength = text.Length, index = 0, ch = 0, prev = 0;
        bool  highlighting = false, caretSet = false;

        Vector2 last0 = Vector2.zero;
        Vector2 last1 = Vector2.zero;

        for (; index < textLength; ++index)
        {
            // Print the caret
            if (caret != null && !caretSet && caretPos <= index)
            {
                caretSet = true;
                caret.Add(new Vector3(x - 1f, -y - fs));
                caret.Add(new Vector3(x - 1f, -y));
                caret.Add(new Vector3(x + 1f, -y));
                caret.Add(new Vector3(x + 1f, -y - fs));
            }

            ch = text[index];

            if (ch == '\n')
            {
                // Used for alignment purposes
                if (x > maxX)
                {
                    maxX = x;
                }

                // Align the caret
                if (caret != null && caretSet)
                {
                    if (NGUIText.alignment != TextAlignment.Left)
                    {
                        NGUIText.Align(caret, caretOffset, x - spacingX);
                    }
                    caret = null;
                }

                if (highlight != null)
                {
                    if (highlighting)
                    {
                        // Close the selection on this line
                        highlighting = false;
                        highlight.Add(last1);
                        highlight.Add(last0);
                    }
                    else if (start <= index && end > index)
                    {
                        // This must be an empty line. Add a narrow vertical highlight.
                        highlight.Add(new Vector3(x, -y - fs));
                        highlight.Add(new Vector3(x, -y));
                        highlight.Add(new Vector3(x + 2f, -y));
                        highlight.Add(new Vector3(x + 2f, -y - fs));
                    }

                    // Align the highlight
                    if (NGUIText.alignment != TextAlignment.Left && highlightOffset < highlight.size)
                    {
                        NGUIText.Align(highlight, highlightOffset, x - spacingX);
                        highlightOffset = highlight.size;
                    }
                }

                x    = 0;
                y   += lineHeight;
                prev = 0;
                continue;
            }
            else if (ch < ' ')
            {
                prev = 0;
                continue;
            }

            if (encoding && ParseSymbol(text, ref index, mColors, premultiply))
            {
                --index;
                continue;
            }

            // See if there is a symbol matching this text
            BMSymbol symbol = useSymbols ? GetSymbol(text, index, textLength) : null;
            float    w      = (symbol != null) ? symbol.advance : GetGlyphWidth(ch, prev);

            if (w != 0f)
            {
                float v0x = x;
                float v1x = x + w;
                float v0y = -y - fs;
                float v1y = -y;

                x += w + spacingX;

                // Print the highlight
                if (highlight != null)
                {
                    if (start > index || end <= index)
                    {
                        if (highlighting)
                        {
                            // Finish the highlight
                            highlighting = false;
                            highlight.Add(last1);
                            highlight.Add(last0);
                        }
                    }
                    else if (!highlighting)
                    {
                        // Start the highlight
                        highlighting = true;
                        highlight.Add(new Vector3(v0x, v0y));
                        highlight.Add(new Vector3(v0x, v1y));
                    }
                }

                // Save what the character ended with
                last0 = new Vector2(v1x, v0y);
                last1 = new Vector2(v1x, v1y);
                prev  = ch;
            }
        }

        // Ensure we always have a caret
        if (caret != null)
        {
            if (!caretSet)
            {
                caret.Add(new Vector3(x - 1f, -y - fs));
                caret.Add(new Vector3(x - 1f, -y));
                caret.Add(new Vector3(x + 1f, -y));
                caret.Add(new Vector3(x + 1f, -y - fs));
            }

            if (NGUIText.alignment != TextAlignment.Left)
            {
                NGUIText.Align(caret, caretOffset, x - spacingX);
            }
        }

        // Close the selection
        if (highlight != null)
        {
            if (highlighting)
            {
                // Finish the highlight
                highlight.Add(last1);
                highlight.Add(last0);
            }
            else if (start < index && end == index)
            {
                // Happens when highlight ends on an empty line. Highlight it with a thin line.
                highlight.Add(new Vector3(x, -y - fs));
                highlight.Add(new Vector3(x, -y));
                highlight.Add(new Vector3(x + 2f, -y));
                highlight.Add(new Vector3(x + 2f, -y - fs));
            }

            // Align the highlight
            if (NGUIText.alignment != TextAlignment.Left && highlightOffset < highlight.size)
            {
                NGUIText.Align(highlight, highlightOffset, x - spacingX);
            }
        }
    }
Example #8
0
    /// <summary>
    /// Print the specified text into the buffers.
    /// Note: 'lineWidth' parameter should be in pixels.
    /// </summary>

    public void Print(string text, BetterList <Vector3> verts, BetterList <Vector2> uvs, BetterList <Color32> cols)
    {
        if (mReplacement != null)
        {
            mReplacement.Print(text, verts, uvs, cols);
        }
        else if (!string.IsNullOrEmpty(text))
        {
            if (!isValid)
            {
                Debug.LogError("Attempting to print using an invalid font!");
                return;
            }

#if DYNAMIC_FONT
            if (isDynamic)
            {
                // NOTE: This shouldn't be used anymore. All dynamic font printing goes directly through NGUIText instead.
                NGUIText.current.size  = mDynamicFontSize;
                NGUIText.current.style = mDynamicFontStyle;
                NGUIText.Print(dynamicFont, text, verts, uvs, cols);
                return;
            }
#endif
            mColors.Add(Color.white);

            int     fs = NGUIText.current.size;
            int     indexOffset = verts.size;
            int     maxX = 0;
            int     x = 0;
            int     y = 0;
            int     prev = 0;
            int     lineHeight = (fs + NGUIText.current.spacingY);
            Vector3 v0 = Vector3.zero, v1 = Vector3.zero;
            Vector2 u0 = Vector2.zero, u1 = Vector2.zero;
            Color   gb = NGUIText.current.tint * NGUIText.current.gradientBottom;
            Color   gt = NGUIText.current.tint * NGUIText.current.gradientTop;
            Color32 uc = NGUIText.current.tint;

            float invX = uvRect.width / mFont.texWidth;
            float invY = mUVRect.height / mFont.texHeight;

            int  textLength = text.Length;
            bool useSymbols = NGUIText.current.encoding && NGUIText.current.symbolStyle != NGUIText.SymbolStyle.None && hasSymbols && sprite != null;

            for (int i = 0; i < textLength; ++i)
            {
                char c = text[i];

                if (c == '\n')
                {
                    if (x > maxX)
                    {
                        maxX = x;
                    }

                    if (NGUIText.current.alignment != TextAlignment.Left)
                    {
                        NGUIText.Align(verts, indexOffset, x - NGUIText.current.spacingX);
                        indexOffset = verts.size;
                    }

                    x    = 0;
                    y   += lineHeight;
                    prev = 0;
                    continue;
                }

                if (c < ' ')
                {
                    prev = 0;
                    continue;
                }

                if (NGUIText.current.encoding && NGUIText.ParseSymbol(text, ref i, mColors, NGUIText.current.premultiply))
                {
                    Color fc = NGUIText.current.tint * mColors[mColors.size - 1];
                    uc = fc;

                    if (NGUIText.current.gradient)
                    {
                        gb = NGUIText.current.gradientBottom * fc;
                        gt = NGUIText.current.gradientTop * fc;
                    }
                    --i;
                    continue;
                }

                // See if there is a symbol matching this text
                BMSymbol symbol = useSymbols ? MatchSymbol(text, i, textLength) : null;

                if (symbol == null)
                {
                    BMGlyph glyph = mFont.GetGlyph(c);
                    if (glyph == null)
                    {
                        continue;
                    }

                    if (prev != 0)
                    {
                        x += glyph.GetKerning(prev);
                    }

                    if (c == ' ')
                    {
                        x   += NGUIText.current.spacingX + glyph.advance;
                        prev = c;
                        continue;
                    }

                    v0.x = (x + glyph.offsetX);
                    v0.y = -(y + glyph.offsetY);

                    v1.x = v0.x + glyph.width;
                    v1.y = v0.y - glyph.height;

                    u0.x = mUVRect.xMin + invX * glyph.x;
                    u0.y = mUVRect.yMax - invY * glyph.y;

                    u1.x = u0.x + invX * glyph.width;
                    u1.y = u0.y - invY * glyph.height;

                    x   += NGUIText.current.spacingX + glyph.advance;
                    prev = c;

                    if (glyph.channel == 0 || glyph.channel == 15)
                    {
                        if (NGUIText.current.gradient)
                        {
                            float min = NGUIText.current.size - glyph.offsetY;
                            float max = min - glyph.height;

                            min /= NGUIText.current.size;
                            max /= NGUIText.current.size;

                            s_c0 = Color.Lerp(gb, gt, min);
                            s_c1 = Color.Lerp(gb, gt, max);

                            cols.Add(s_c0);
                            cols.Add(s_c1);
                            cols.Add(s_c1);
                            cols.Add(s_c0);
                        }
                        else
                        {
                            for (int b = 0; b < 4; ++b)
                            {
                                cols.Add(uc);
                            }
                        }
                    }
                    else
                    {
                        // Packed fonts come as alpha masks in each of the RGBA channels.
                        // In order to use it we need to use a special shader.
                        //
                        // Limitations:
                        // - Effects (drop shadow, outline) will not work.
                        // - Should not be a part of the atlas (eastern fonts rarely are anyway).
                        // - Lower color precision

                        Color col = uc;

                        col *= 0.49f;

                        switch (glyph.channel)
                        {
                        case 1: col.b += 0.51f; break;

                        case 2: col.g += 0.51f; break;

                        case 4: col.r += 0.51f; break;

                        case 8: col.a += 0.51f; break;
                        }

                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(col);
                        }
                    }
                }
                else
                {
                    v0.x = (x + symbol.offsetX);
                    v0.y = -(y + symbol.offsetY);

                    v1.x = v0.x + symbol.width;
                    v1.y = v0.y - symbol.height;

                    Rect uv = symbol.uvRect;

                    u0.x = uv.xMin;
                    u0.y = uv.yMax;
                    u1.x = uv.xMax;
                    u1.y = uv.yMin;

                    x   += NGUIText.current.spacingX + symbol.advance;
                    i   += symbol.length - 1;
                    prev = 0;

                    if (NGUIText.current.symbolStyle == NGUIText.SymbolStyle.Colored)
                    {
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(uc);
                        }
                    }
                    else
                    {
                        Color32 col = Color.white;
                        col.a = uc.a;
                        for (int b = 0; b < 4; ++b)
                        {
                            cols.Add(col);
                        }
                    }
                }

                verts.Add(new Vector3(v1.x, v0.y));
                verts.Add(new Vector3(v1.x, v1.y));
                verts.Add(new Vector3(v0.x, v1.y));
                verts.Add(new Vector3(v0.x, v0.y));

                uvs.Add(new Vector2(u1.x, u0.y));
                uvs.Add(new Vector2(u1.x, u1.y));
                uvs.Add(new Vector2(u0.x, u1.y));
                uvs.Add(new Vector2(u0.x, u0.y));
            }

            if (NGUIText.current.alignment != TextAlignment.Left && indexOffset < verts.size)
            {
                NGUIText.Align(verts, indexOffset, x - NGUIText.current.spacingX);
                indexOffset = verts.size;
            }
            mColors.Clear();
        }
    }