Exemplo n.º 1
0
 public float MeasureFancyText(string line, out List<KeyValuePair<string, Rectangle2F>> links, string bcolor = "^r^7", bool bold = false, bool italic = false, bool sub = false, GLFont font = null)
 {
     List<KeyValuePair<string, Rectangle2F>> tlinks = new List<KeyValuePair<string, Rectangle2F>>();
     m_depth++;
     if (m_depth >= 100)
     {
         m_depth--;
         links = tlinks;
         return font.MeasureString("{{Recursion error}}");
     }
     float MeasWidth = 0;
     if (font == null)
     {
         font = font_default;
     }
     int start = 0;
     line = line.Replace("^q", "\"").Replace("^B", bcolor);
     for (int x = 0; x < line.Length; x++)
     {
         if ((line[x] == '^' && x + 1 < line.Length && (IsColorSymbol(line[x + 1]) || line[x + 1] == '[')) || (x + 1 == line.Length))
         {
             string drawme = line.Substring(start, (x - start) + ((x + 1 < line.Length) ? 0 : 1));
             start = x + 2;
             x++;
             if (drawme.Length > 0)
             {
                 MeasWidth += font.MeasureString(drawme);
             }
             if (x < line.Length)
             {
                 switch (line[x])
                 {
                     case '[':
                         {
                             StringBuilder sb = new StringBuilder();
                             x++;
                             int c = 0;
                             while (x < line.Length)
                             {
                                 if (line[x] == '[')
                                 {
                                     c++;
                                 }
                                 if (line[x] == ']')
                                 {
                                     c--;
                                     if (c == -1)
                                     {
                                         break;
                                     }
                                 }
                                 sb.Append(line[x]);
                                 x++;
                             }
                             bool highl = true;
                             string ttext;
                             if (x == line.Length)
                             {
                                 ttext = "^[" + sb.ToString();
                             }
                             else
                             {
                                 string sbt = sb.ToString();
                                 string sbl = sbt.ToLowerFast();
                                 if (sbl.StartsWith("lang="))
                                 {
                                     string langinfo = sbl.After("lang=");
                                     string[] subdats = csplit(langinfo).ToArray();
                                     ttext = Client.Central.Languages.GetText(Engine.TheClient.Files, subdats);
                                     highl = false;
                                 }
                                 else if (sbl.StartsWith("color="))
                                 {
                                     ttext = "";
                                     highl = false;
                                 }
                                 else if (sbl == "lb")
                                 {
                                     ttext = "[";
                                     highl = false;
                                 }
                                 else if (sbl == "rb")
                                 {
                                     ttext = "]";
                                     highl = false;
                                 }
                                 else
                                 {
                                     ttext = sbt.After("|");
                                 }
                             }
                             if (highl)
                             {
                                 float widt = font_default.MeasureString(ttext);
                                 tlinks.Add(new KeyValuePair<string, Rectangle2F>(sb.ToString().Before("|"), new Rectangle2F() { X = MeasWidth, Y = 0, Width = widt, Height = font_default.Height }));
                                 MeasWidth += widt;
                             }
                             else
                             {
                                 List<KeyValuePair<string, Rectangle2F>> ttlinks;
                                 float widt = MeasureFancyText(ttext, out ttlinks, bcolor, bold, italic, sub, font);
                                 MeasWidth += widt;
                             }
                             start = x + 1;
                         }
                             break;
                     case 'r':
                         font = font_default;
                         bold = false;
                         sub = false;
                         italic = false;
                         break;
                     case 'S':
                     case 'l':
                         font = bold && italic ? font_bolditalichalf : bold ? font_boldhalf :
                             italic ? font_italichalf : font_half;
                         sub = true;
                         break;
                     case 'i':
                         italic = true;
                         font = (sub) ? (bold ? font_bolditalichalf : font_italichalf) :
                             (bold ? font_bolditalic : font_italic);
                         break;
                     case 'b':
                         bold = true;
                         font = (sub) ? (italic ? font_bolditalichalf : font_boldhalf) :
                             (italic ? font_bolditalic : font_bold);
                         break;
                     default:
                         break;
                 }
             }
         }
     }
     links = tlinks;
     m_depth--;
     return MeasWidth;
 }
Exemplo n.º 2
0
        public float MeasureFancyText(string line, out List <KeyValuePair <string, Rectangle2F> > links, string bcolor = "^r^7", bool bold = false, bool italic = false, bool sub = false, GLFont font = null)
        {
            List <KeyValuePair <string, Rectangle2F> > tlinks = new List <KeyValuePair <string, Rectangle2F> >();

            m_depth++;
            if (m_depth >= 100)
            {
                m_depth--;
                links = tlinks;
                return(font.MeasureString("{{Recursion error}}"));
            }
            float MeasWidth = 0;

            if (font == null)
            {
                font = font_default;
            }
            int start = 0;

            line = line.Replace("^q", "\"").Replace("^B", bcolor);
            for (int x = 0; x < line.Length; x++)
            {
                if ((line[x] == '^' && x + 1 < line.Length && (IsColorSymbol(line[x + 1]) || line[x + 1] == '[')) || (x + 1 == line.Length))
                {
                    string drawme = line.Substring(start, (x - start) + ((x + 1 < line.Length) ? 0 : 1));
                    start = x + 2;
                    x++;
                    if (drawme.Length > 0)
                    {
                        MeasWidth += font.MeasureString(drawme);
                    }
                    if (x < line.Length)
                    {
                        switch (line[x])
                        {
                        case '[':
                        {
                            StringBuilder sb = new StringBuilder();
                            x++;
                            int c = 0;
                            while (x < line.Length)
                            {
                                if (line[x] == '[')
                                {
                                    c++;
                                }
                                if (line[x] == ']')
                                {
                                    c--;
                                    if (c == -1)
                                    {
                                        break;
                                    }
                                }
                                sb.Append(line[x]);
                                x++;
                            }
                            bool   highl = true;
                            string ttext;
                            if (x == line.Length)
                            {
                                ttext = "^[" + sb.ToString();
                            }
                            else
                            {
                                string sbt = sb.ToString();
                                string sbl = sbt.ToLowerFast();
                                if (sbl.StartsWith("lang="))
                                {
                                    string   langinfo = sbl.After("lang=");
                                    string[] subdats  = csplit(langinfo).ToArray();
                                    ttext = Client.Central.Languages.GetText(Engine.TheClient.Files, subdats);
                                    highl = false;
                                }
                                else if (sbl.StartsWith("color="))
                                {
                                    ttext = "";
                                    highl = false;
                                }
                                else if (sbl == "lb")
                                {
                                    ttext = "[";
                                    highl = false;
                                }
                                else if (sbl == "rb")
                                {
                                    ttext = "]";
                                    highl = false;
                                }
                                else
                                {
                                    ttext = sbt.After("|");
                                }
                            }
                            if (highl)
                            {
                                float widt = font_default.MeasureString(ttext);
                                tlinks.Add(new KeyValuePair <string, Rectangle2F>(sb.ToString().Before("|"), new Rectangle2F()
                                    {
                                        X = MeasWidth, Y = 0, Width = widt, Height = font_default.Height
                                    }));
                                MeasWidth += widt;
                            }
                            else
                            {
                                List <KeyValuePair <string, Rectangle2F> > ttlinks;
                                float widt = MeasureFancyText(ttext, out ttlinks, bcolor, bold, italic, sub, font);
                                MeasWidth += widt;
                            }
                            start = x + 1;
                        }
                        break;

                        case 'r':
                            font   = font_default;
                            bold   = false;
                            sub    = false;
                            italic = false;
                            break;

                        case 'S':
                        case 'l':
                            font = bold && italic ? font_bolditalichalf : bold ? font_boldhalf :
                                   italic ? font_italichalf : font_half;
                            sub = true;
                            break;

                        case 'i':
                            italic = true;
                            font   = (sub) ? (bold ? font_bolditalichalf : font_italichalf) :
                                     (bold ? font_bolditalic : font_italic);
                            break;

                        case 'b':
                            bold = true;
                            font = (sub) ? (italic ? font_bolditalichalf : font_boldhalf) :
                                   (italic ? font_bolditalic : font_bold);
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
            links = tlinks;
            m_depth--;
            return(MeasWidth);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Fully renders colorful/fancy text (unless the text is not marked as fancy, or fancy rendering is disabled)
 /// </summary>
 /// <param name="Text">The text to render.</param>
 /// <param name="Position">Where to render the text at.</param>
 /// <param name="MaxY">The maximum Y location to render text at.</param>
 /// <param name="transmod">Transparency modifier (EG, 0.5 = half opacity) (0.0 - 1.0).</param>
 /// <param name="extrashadow">Whether to always have a mini drop-shadow.</param>
 public void DrawColoredText(string Text, Location Position, int MaxY = int.MaxValue, float transmod = 1, bool extrashadow = false, string bcolor = "^r^7",
     int color = DefaultColor, bool bold = false, bool italic = false, bool underline = false, bool strike = false, bool overline = false, bool highlight = false, bool emphasis = false,
     int ucolor = DefaultColor, int scolor = DefaultColor, int ocolor = DefaultColor, int hcolor = DefaultColor, int ecolor = DefaultColor,
     bool super = false, bool sub = false, bool flip = false, bool pseudo = false, bool jello = false, bool obfu = false, bool random = false, bool shadow = false, GLFont font = null)
 {
     r_depth++;
     if (r_depth >= 100 && Text != "{{Recursion error}}")
     {
         r_depth--;
         DrawColoredText("{{Recursion error}}", Position);
         return;
     }
     Text = Text.Replace("^B", bcolor);
     string[] lines = Text.Replace('\r', ' ').Replace(' ', (char)0x00A0).Replace("^q", "\"").SplitFast('\n');
     int trans = (int)(255 * transmod);
     int otrans = (int)(255 * transmod);
     int etrans = (int)(255 * transmod);
     int htrans = (int)(255 * transmod);
     int strans = (int)(255 * transmod);
     int utrans = (int)(255 * transmod);
     float X = (float)Position.X;
     float Y = (float)Position.Y;
     Color bccolor = Color.FromArgb(0, 0, 0, 0);
     Color ccolor = bccolor;
     if (font == null)
     {
         font = font_default;
     }
     for (int i = 0; i < lines.Length; i++)
     {
         string line = lines[i];
         if (line.Length == 0)
         {
             Y += font_default.Height;
             continue;
         }
         int start = 0;
         for (int x = 0; x < line.Length; x++)
         {
             if ((line[x] == '^' && x + 1 < line.Length && (IsColorSymbol(line[x + 1]) || line[x + 1] == '[')) || (x + 1 == line.Length))
             {
                 string drawme = line.Substring(start, (x - start) + ((x + 1 < line.Length) ? 0 : 1));
                 start = x + 2;
                 x++;
                 if (drawme.Length > 0 && Y >= -font.Height && Y - (sub ? font.Height : 0) <= MaxY)
                 {
                     float width = font.MeasureString(drawme);
                     if (highlight)
                     {
                         DrawRectangle(X, Y, width, font_default.Height, font, ColorFor(hcolor, htrans));
                     }
                     if (underline)
                     {
                         DrawRectangle(X, Y + ((float)font.Height * 4f / 5f), width, 2, font, ColorFor(ucolor, utrans));
                     }
                     if (overline)
                     {
                         DrawRectangle(X, Y + 2f, width, 2, font, ColorFor(ocolor, otrans));
                     }
                     if (extrashadow)
                     {
                         foreach (Point point in ShadowPoints)
                         {
                             RenderBaseText(X + point.X, Y + point.Y, drawme, font, 0, trans / 2, flip);
                         }
                     }
                     if (shadow)
                     {
                         foreach (Point point in ShadowPoints)
                         {
                             RenderBaseText(X + point.X, Y + point.Y, drawme, font, 0, trans / 2, flip);
                         }
                         foreach (Point point in BetterShadowPoints)
                         {
                             RenderBaseText(X + point.X, Y + point.Y, drawme, font, 0, trans / 4, flip);
                         }
                     }
                     if (emphasis)
                     {
                         foreach (Point point in EmphasisPoints)
                         {
                             RenderBaseText(X + point.X, Y + point.Y, drawme, font, ecolor, etrans, flip);
                         }
                         foreach (Point point in BetterEmphasisPoints)
                         {
                             RenderBaseText(X + point.X, Y + point.Y, drawme, font, ecolor, etrans, flip);
                         }
                     }
                     RenderBaseText(X, Y, drawme, font, color, trans, flip, pseudo, random, jello, obfu, ccolor);
                     if (strike)
                     {
                         DrawRectangle(X, Y + (font.Height / 2), width, 2, font, ColorFor(scolor, strans));
                     }
                     X += width;
                 }
                 if (x < line.Length)
                 {
                     switch (line[x])
                     {
                         case '[':
                             {
                                 StringBuilder sb = new StringBuilder();
                                 x++;
                                 int c = 0;
                                 while (x < line.Length)
                                 {
                                     if (line[x] == '[')
                                     {
                                         c++;
                                     }
                                     if (line[x] == ']')
                                     {
                                         c--;
                                         if (c == -1)
                                         {
                                             break;
                                         }
                                     }
                                     sb.Append(line[x]);
                                     x++;
                                 }
                                 bool highl = true;
                                 string ttext;
                                 if (x == line.Length)
                                 {
                                     ttext = "^[" + sb.ToString();
                                 }
                                 else
                                 {
                                     string sbt = sb.ToString();
                                     string sbl = sbt.ToLowerFast();
                                     if (sbl.StartsWith("lang="))
                                     {
                                         string langinfo = sbl.After("lang=");
                                         string[] subdats = csplit(langinfo).ToArray();
                                         ttext = Client.Central.Languages.GetText(Engine.TheClient.Files, subdats);
                                         highl = false;
                                     }
                                     else if (sbl.StartsWith("color="))
                                     {
                                         string[] coldat = sbl.After("color=").SplitFast(',');
                                         if (coldat.Length == 4)
                                         {
                                             int r = Utilities.StringToInt(coldat[0]);
                                             int g = Utilities.StringToInt(coldat[1]);
                                             int b = Utilities.StringToInt(coldat[2]);
                                             int a = Utilities.StringToInt(coldat[3]);
                                             ccolor = Color.FromArgb((byte)a, (byte)r, (byte)g, (byte)b);
                                             ttext = "";
                                             highl = false;
                                         }
                                         else
                                         {
                                             ttext = "^[" + sb.ToString();
                                         }
                                     }
                                     else if (sbl == "lb")
                                     {
                                         ttext = "[";
                                         highl = false;
                                     }
                                     else if (sbl == "rb")
                                     {
                                         ttext = "]";
                                         highl = false;
                                     }
                                     else
                                     {
                                         ttext = sbt.After("|");
                                     }
                                 }
                                 if (highl)
                                 {
                                     float widt = font_default.MeasureString(ttext);
                                     DrawRectangle(X, Y, widt, font_default.Height, font_default, Color.Black);
                                     RenderBaseText(X, Y, ttext, font_default, 5);
                                     DrawRectangle(X, Y + ((float)font_default.Height * 4f / 5f), widt, 2, font_default, Color.Blue);
                                     X += widt;
                                 }
                                 else
                                 {
                                     float widt = MeasureFancyText(ttext);
                                     DrawColoredText(ttext, new Location(X, Y, 0), MaxY, transmod, extrashadow, bcolor,
                                         color, bold, italic, underline, strike, overline, highlight, emphasis, ucolor, scolor, ocolor, hcolor, ecolor, super,
                                         sub, flip, pseudo, jello, obfu, random, shadow, font);
                                     X += widt;
                                 }
                                 start = x + 1;
                             }
                             break;
                         case '1': color = 1; ccolor = bccolor;  break;
                         case '!': color = 11; ccolor = bccolor; break;
                         case '2': color = 2; ccolor = bccolor; break;
                         case '@': color = 12; ccolor = bccolor; break;
                         case '3': color = 3; ccolor = bccolor; break;
                         case '#': color = 13; ccolor = bccolor; break;
                         case '4': color = 4; ccolor = bccolor; break;
                         case '$': color = 14; ccolor = bccolor; break;
                         case '5': color = 5; ccolor = bccolor; break;
                         case '%': color = 15; ccolor = bccolor; break;
                         case '6': color = 6; ccolor = bccolor; break;
                         case '-': color = 16; ccolor = bccolor; break;
                         case '7': color = 7; ccolor = bccolor; break;
                         case '&': color = 17; ccolor = bccolor; break;
                         case '8': color = 8; ccolor = bccolor; break;
                         case '*': color = 18; ccolor = bccolor; break;
                         case '9': color = 9; ccolor = bccolor; break;
                         case '(': color = 19; ccolor = bccolor; break;
                         case '0': color = 0; ccolor = bccolor; break;
                         case ')': color = 20; ccolor = bccolor; break;
                         case 'a': color = 10; ccolor = bccolor; break;
                         case 'A': color = 21; ccolor = bccolor; break;
                         case 'i':
                             {
                                 italic = true;
                                 GLFont nfont = (super || sub) ? (bold ? font_bolditalichalf : font_italichalf) :
                                     (bold ? font_bolditalic : font_italic);
                                 if (nfont != font)
                                 {
                                     font = nfont;
                                 }
                             }
                             break;
                         case 'b':
                             {
                                 bold = true;
                                 GLFont nfont = (super || sub) ? (italic ? font_bolditalichalf : font_boldhalf) :
                                     (italic ? font_bolditalic : font_bold);
                                 if (nfont != font)
                                 {
                                     font = nfont;
                                 }
                             }
                             break;
                         case 'u': utrans = trans; underline = true; ucolor = color; break;
                         case 's': strans = trans; strike = true; scolor = color; break;
                         case 'h': htrans = trans; highlight = true; hcolor = color; break;
                         case 'e': etrans = trans; emphasis = true; ecolor = color; break;
                         case 'O': otrans = trans; overline = true; ocolor = color; break;
                         case 't': trans = (int)(128 * transmod); break;
                         case 'T': trans = (int)(64 * transmod); break;
                         case 'o': trans = (int)(255 * transmod); break;
                         case 'S':
                             if (!super)
                             {
                                 if (sub)
                                 {
                                     sub = false;
                                     Y -= font.Height / 2;
                                 }
                                 GLFont nfont = bold && italic ? font_bolditalichalf : bold ? font_boldhalf :
                                     italic ? font_italichalf : font_half;
                                 if (nfont != font)
                                 {
                                     font = nfont;
                                 }
                             }
                             super = true;
                             break;
                         case 'l':
                             if (!sub)
                             {
                                 if (super)
                                 {
                                     super = false;
                                 }
                                 Y += font_default.Height / 2;
                                 GLFont nfont = bold && italic ? font_bolditalichalf : bold ? font_boldhalf :
                                     italic ? font_italichalf : font_half;
                                 if (nfont != font)
                                 {
                                     font = nfont;
                                 }
                             }
                             sub = true;
                             break;
                         case 'd': shadow = true; break;
                         case 'j': jello = true; break;
                         case 'k': obfu = true; break;
                         case 'R': random = true; break;
                         case 'p': pseudo = true; break;
                         case 'f': flip = true; break;
                         case 'n':
                             break;
                         case 'r':
                             {
                                 GLFont nfont = font_default;
                                 if (nfont != font)
                                 {
                                     font = nfont;
                                 }
                                 if (sub)
                                 {
                                     Y -= font_default.Height / 2;
                                 }
                                 sub = false;
                                 super = false;
                                 flip = false;
                                 random = false;
                                 pseudo = false;
                                 jello = false;
                                 obfu = false;
                                 shadow = false;
                                 bold = false;
                                 italic = false;
                                 underline = false;
                                 strike = false;
                                 emphasis = false;
                                 highlight = false;
                                 trans = (int)(255 * transmod);
                                 overline = false;
                                 break;
                             }
                         default:
                             break;
                     }
                 }
             }
         }
         Y += font_default.Height;
         X = (float)Position.X;
     }
     Engine.GLFonts.Shaders.TextCleanerShader.Bind();
     GL.UniformMatrix4(1, false, ref Client.Central.Ortho); // TODO: Pass Client reference
     Matrix4 ident = Matrix4.Identity;
     GL.UniformMatrix4(2, false, ref ident);
     Vector3 col = new Vector3(1, 1, 1);
     GL.Uniform3(3, ref col);
     VBO.Build();
     VBO.Render();
     Engine.GLFonts.Shaders.ColorMultShader.Bind();
     r_depth--;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Fully renders colorful/fancy text (unless the text is not marked as fancy, or fancy rendering is disabled)
        /// </summary>
        /// <param name="Text">The text to render.</param>
        /// <param name="Position">Where to render the text at.</param>
        /// <param name="MaxY">The maximum Y location to render text at.</param>
        /// <param name="transmod">Transparency modifier (EG, 0.5 = half opacity) (0.0 - 1.0).</param>
        /// <param name="extrashadow">Whether to always have a mini drop-shadow.</param>
        public void DrawColoredText(string Text, Location Position, int MaxY = int.MaxValue, float transmod = 1, bool extrashadow = false, string bcolor = "^r^7",
                                    int color  = DefaultColor, bool bold  = false, bool italic       = false, bool underline    = false, bool strike = false, bool overline = false, bool highlight = false, bool emphasis = false,
                                    int ucolor = DefaultColor, int scolor = DefaultColor, int ocolor = DefaultColor, int hcolor = DefaultColor, int ecolor = DefaultColor,
                                    bool super = false, bool sub          = false, bool flip = false, bool pseudo = false, bool jello = false, bool obfu = false, bool random = false, bool shadow = false, GLFont font = null)
        {
            r_depth++;
            if (r_depth >= 100 && Text != "{{Recursion error}}")
            {
                r_depth--;
                DrawColoredText("{{Recursion error}}", Position);
                return;
            }
            Text = Text.Replace("^B", bcolor);
            string[] lines   = Text.Replace('\r', ' ').Replace(' ', (char)0x00A0).Replace("^q", "\"").SplitFast('\n');
            int      trans   = (int)(255 * transmod);
            int      otrans  = (int)(255 * transmod);
            int      etrans  = (int)(255 * transmod);
            int      htrans  = (int)(255 * transmod);
            int      strans  = (int)(255 * transmod);
            int      utrans  = (int)(255 * transmod);
            float    X       = (float)Position.X;
            float    Y       = (float)Position.Y;
            Color    bccolor = Color.FromArgb(0, 0, 0, 0);
            Color    ccolor  = bccolor;

            if (font == null)
            {
                font = font_default;
            }
            for (int i = 0; i < lines.Length; i++)
            {
                string line = lines[i];
                if (line.Length == 0)
                {
                    Y += font_default.Height;
                    continue;
                }
                int start = 0;
                for (int x = 0; x < line.Length; x++)
                {
                    if ((line[x] == '^' && x + 1 < line.Length && (IsColorSymbol(line[x + 1]) || line[x + 1] == '[')) || (x + 1 == line.Length))
                    {
                        string drawme = line.Substring(start, (x - start) + ((x + 1 < line.Length) ? 0 : 1));
                        start = x + 2;
                        x++;
                        if (drawme.Length > 0 && Y >= -font.Height && Y - (sub ? font.Height : 0) <= MaxY)
                        {
                            float width = font.MeasureString(drawme);
                            if (highlight)
                            {
                                DrawRectangle(X, Y, width, font_default.Height, font, ColorFor(hcolor, htrans));
                            }
                            if (underline)
                            {
                                DrawRectangle(X, Y + ((float)font.Height * 4f / 5f), width, 2, font, ColorFor(ucolor, utrans));
                            }
                            if (overline)
                            {
                                DrawRectangle(X, Y + 2f, width, 2, font, ColorFor(ocolor, otrans));
                            }
                            if (extrashadow)
                            {
                                foreach (Point point in ShadowPoints)
                                {
                                    RenderBaseText(X + point.X, Y + point.Y, drawme, font, 0, trans / 2, flip);
                                }
                            }
                            if (shadow)
                            {
                                foreach (Point point in ShadowPoints)
                                {
                                    RenderBaseText(X + point.X, Y + point.Y, drawme, font, 0, trans / 2, flip);
                                }
                                foreach (Point point in BetterShadowPoints)
                                {
                                    RenderBaseText(X + point.X, Y + point.Y, drawme, font, 0, trans / 4, flip);
                                }
                            }
                            if (emphasis)
                            {
                                foreach (Point point in EmphasisPoints)
                                {
                                    RenderBaseText(X + point.X, Y + point.Y, drawme, font, ecolor, etrans, flip);
                                }
                                foreach (Point point in BetterEmphasisPoints)
                                {
                                    RenderBaseText(X + point.X, Y + point.Y, drawme, font, ecolor, etrans, flip);
                                }
                            }
                            RenderBaseText(X, Y, drawme, font, color, trans, flip, pseudo, random, jello, obfu, ccolor);
                            if (strike)
                            {
                                DrawRectangle(X, Y + (font.Height / 2), width, 2, font, ColorFor(scolor, strans));
                            }
                            X += width;
                        }
                        if (x < line.Length)
                        {
                            switch (line[x])
                            {
                            case '[':
                            {
                                StringBuilder sb = new StringBuilder();
                                x++;
                                int c = 0;
                                while (x < line.Length)
                                {
                                    if (line[x] == '[')
                                    {
                                        c++;
                                    }
                                    if (line[x] == ']')
                                    {
                                        c--;
                                        if (c == -1)
                                        {
                                            break;
                                        }
                                    }
                                    sb.Append(line[x]);
                                    x++;
                                }
                                bool   highl = true;
                                string ttext;
                                if (x == line.Length)
                                {
                                    ttext = "^[" + sb.ToString();
                                }
                                else
                                {
                                    string sbt = sb.ToString();
                                    string sbl = sbt.ToLowerFast();
                                    if (sbl.StartsWith("lang="))
                                    {
                                        string   langinfo = sbl.After("lang=");
                                        string[] subdats  = csplit(langinfo).ToArray();
                                        ttext = Client.Central.Languages.GetText(Engine.TheClient.Files, subdats);
                                        highl = false;
                                    }
                                    else if (sbl.StartsWith("color="))
                                    {
                                        string[] coldat = sbl.After("color=").SplitFast(',');
                                        if (coldat.Length == 4)
                                        {
                                            int r = Utilities.StringToInt(coldat[0]);
                                            int g = Utilities.StringToInt(coldat[1]);
                                            int b = Utilities.StringToInt(coldat[2]);
                                            int a = Utilities.StringToInt(coldat[3]);
                                            ccolor = Color.FromArgb((byte)a, (byte)r, (byte)g, (byte)b);
                                            ttext  = "";
                                            highl  = false;
                                        }
                                        else
                                        {
                                            ttext = "^[" + sb.ToString();
                                        }
                                    }
                                    else if (sbl == "lb")
                                    {
                                        ttext = "[";
                                        highl = false;
                                    }
                                    else if (sbl == "rb")
                                    {
                                        ttext = "]";
                                        highl = false;
                                    }
                                    else
                                    {
                                        ttext = sbt.After("|");
                                    }
                                }
                                if (highl)
                                {
                                    float widt = font_default.MeasureString(ttext);
                                    DrawRectangle(X, Y, widt, font_default.Height, font_default, Color.Black);
                                    RenderBaseText(X, Y, ttext, font_default, 5);
                                    DrawRectangle(X, Y + ((float)font_default.Height * 4f / 5f), widt, 2, font_default, Color.Blue);
                                    X += widt;
                                }
                                else
                                {
                                    float widt = MeasureFancyText(ttext);
                                    DrawColoredText(ttext, new Location(X, Y, 0), MaxY, transmod, extrashadow, bcolor,
                                                    color, bold, italic, underline, strike, overline, highlight, emphasis, ucolor, scolor, ocolor, hcolor, ecolor, super,
                                                    sub, flip, pseudo, jello, obfu, random, shadow, font);
                                    X += widt;
                                }
                                start = x + 1;
                            }
                            break;

                            case '1': color = 1; ccolor = bccolor;  break;

                            case '!': color = 11; ccolor = bccolor; break;

                            case '2': color = 2; ccolor = bccolor; break;

                            case '@': color = 12; ccolor = bccolor; break;

                            case '3': color = 3; ccolor = bccolor; break;

                            case '#': color = 13; ccolor = bccolor; break;

                            case '4': color = 4; ccolor = bccolor; break;

                            case '$': color = 14; ccolor = bccolor; break;

                            case '5': color = 5; ccolor = bccolor; break;

                            case '%': color = 15; ccolor = bccolor; break;

                            case '6': color = 6; ccolor = bccolor; break;

                            case '-': color = 16; ccolor = bccolor; break;

                            case '7': color = 7; ccolor = bccolor; break;

                            case '&': color = 17; ccolor = bccolor; break;

                            case '8': color = 8; ccolor = bccolor; break;

                            case '*': color = 18; ccolor = bccolor; break;

                            case '9': color = 9; ccolor = bccolor; break;

                            case '(': color = 19; ccolor = bccolor; break;

                            case '0': color = 0; ccolor = bccolor; break;

                            case ')': color = 20; ccolor = bccolor; break;

                            case 'a': color = 10; ccolor = bccolor; break;

                            case 'A': color = 21; ccolor = bccolor; break;

                            case 'i':
                            {
                                italic = true;
                                GLFont nfont = (super || sub) ? (bold ? font_bolditalichalf : font_italichalf) :
                                               (bold ? font_bolditalic : font_italic);
                                if (nfont != font)
                                {
                                    font = nfont;
                                }
                            }
                            break;

                            case 'b':
                            {
                                bold = true;
                                GLFont nfont = (super || sub) ? (italic ? font_bolditalichalf : font_boldhalf) :
                                               (italic ? font_bolditalic : font_bold);
                                if (nfont != font)
                                {
                                    font = nfont;
                                }
                            }
                            break;

                            case 'u': utrans = trans; underline = true; ucolor = color; break;

                            case 's': strans = trans; strike = true; scolor = color; break;

                            case 'h': htrans = trans; highlight = true; hcolor = color; break;

                            case 'e': etrans = trans; emphasis = true; ecolor = color; break;

                            case 'O': otrans = trans; overline = true; ocolor = color; break;

                            case 't': trans = (int)(128 * transmod); break;

                            case 'T': trans = (int)(64 * transmod); break;

                            case 'o': trans = (int)(255 * transmod); break;

                            case 'S':
                                if (!super)
                                {
                                    if (sub)
                                    {
                                        sub = false;
                                        Y  -= font.Height / 2;
                                    }
                                    GLFont nfont = bold && italic ? font_bolditalichalf : bold ? font_boldhalf :
                                                   italic ? font_italichalf : font_half;
                                    if (nfont != font)
                                    {
                                        font = nfont;
                                    }
                                }
                                super = true;
                                break;

                            case 'l':
                                if (!sub)
                                {
                                    if (super)
                                    {
                                        super = false;
                                    }
                                    Y += font_default.Height / 2;
                                    GLFont nfont = bold && italic ? font_bolditalichalf : bold ? font_boldhalf :
                                                   italic ? font_italichalf : font_half;
                                    if (nfont != font)
                                    {
                                        font = nfont;
                                    }
                                }
                                sub = true;
                                break;

                            case 'd': shadow = true; break;

                            case 'j': jello = true; break;

                            case 'k': obfu = true; break;

                            case 'R': random = true; break;

                            case 'p': pseudo = true; break;

                            case 'f': flip = true; break;

                            case 'n':
                                break;

                            case 'r':
                            {
                                GLFont nfont = font_default;
                                if (nfont != font)
                                {
                                    font = nfont;
                                }
                                if (sub)
                                {
                                    Y -= font_default.Height / 2;
                                }
                                sub       = false;
                                super     = false;
                                flip      = false;
                                random    = false;
                                pseudo    = false;
                                jello     = false;
                                obfu      = false;
                                shadow    = false;
                                bold      = false;
                                italic    = false;
                                underline = false;
                                strike    = false;
                                emphasis  = false;
                                highlight = false;
                                trans     = (int)(255 * transmod);
                                overline  = false;
                                break;
                            }

                            default:
                                break;
                            }
                        }
                    }
                }
                Y += font_default.Height;
                X  = (float)Position.X;
            }
            Engine.GLFonts.Shaders.TextCleanerShader.Bind();
            GL.UniformMatrix4(1, false, ref Client.Central.Ortho); // TODO: Pass Client reference
            Matrix4 ident = Matrix4.Identity;

            GL.UniformMatrix4(2, false, ref ident);
            Vector3 col = new Vector3(1, 1, 1);

            GL.Uniform3(3, ref col);
            VBO.Build();
            VBO.Render();
            Engine.GLFonts.Shaders.ColorMultShader.Bind();
            r_depth--;
        }