Ejemplo n.º 1
0
        public static CharInfo Parse(LineDescription lineDesc)
        {
            CharInfo result = new CharInfo();

              result.ID = lineDesc.Args["id"].Value;
              result.X = lineDesc.Args["x"].Value;
              result.Y = lineDesc.Args["y"].Value;
              result.Width = lineDesc.Args["width"].Value;
              result.Height = lineDesc.Args["height"].Value;
              result.XOffset = lineDesc.Args["xoffset"].Value;
              result.YOffset = lineDesc.Args["yoffset"].Value;
              result.XAdvance = lineDesc.Args["xadvance"].Value;

              return result;
        }
Ejemplo n.º 2
0
        public static LineDescription Parse(string line)
        {
            // Trim all spaces first to be safe
              line = line.Trim();

              LineDescription result = new LineDescription();

              // Parse line operation
              int cursor = line.IndexOf(' ');

              if (cursor < 0)
            cursor = line.Length;

              result.Operation = line.Substring(0, cursor).ToLower();

              while (cursor < line.Length)
              {
            int eqPos = line.IndexOf('=', cursor);
            if (eqPos < 0)
              break;

            LineArg arg = new LineArg();
            arg.Name = line.Substring(cursor, eqPos - cursor).Trim().ToLower();

            if (line[eqPos + 1] == '"')
            {
              cursor = line.IndexOf('"', eqPos + 2);
              if (cursor < 0)
            throw new Exception("Parsing error!");

              ++eqPos;
            }
            else
            {
              cursor = line.IndexOf(' ', eqPos + 1);
              if (cursor < 0)
            cursor = line.Length;
            }

            arg.Text = line.Substring(eqPos + 1, cursor - eqPos - 1).Trim();

            int value = 0;
            if (int.TryParse(arg.Text, out value))
              arg.Value = value;

            result.Args.Add(arg.Name, arg);
            ++cursor;
              }

              return result;
        }
Ejemplo n.º 3
0
        public static KerningInfo Parse(LineDescription lineDesc)
        {
            KerningInfo result = new KerningInfo();

              result.First = lineDesc.Args["first"].Value;
              result.Second = lineDesc.Args["second"].Value;
              result.Amount = lineDesc.Args["amount"].Value;

              return result;
        }