Advertisement
Saxy_Guy

Untitled

Jan 7th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.05 KB | None | 0 0
  1. protected override VectorImageSet GenerateIconSet(string fontDataContent)
  2.         {
  3.             VectorImageSet vectorImageSet = new VectorImageSet();
  4.             Glyph currentGlyph = null;
  5.  
  6.             bool canStartReading = false;
  7.             foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
  8.             {
  9.                 if (!canStartReading)
  10.                 {
  11.                     if (line.StartsWith("glyphs:"))
  12.                     {
  13.                         canStartReading = true;
  14.                     }
  15.  
  16.                     continue;
  17.                 }
  18.  
  19.                 if (line.Contains("css:"))
  20.                 {
  21.                     currentGlyph = new Glyph();
  22.  
  23.                     string name = line.Substring(line.IndexOf("css:") + 5).Trim();
  24.                     currentGlyph.name = name;
  25.                 }
  26.  
  27.                 if (line.Contains("code:") && line.Contains("0x"))
  28.                 {
  29.                     if (currentGlyph != null)
  30.                     {
  31.                         string unicode = line.Substring(line.IndexOf("code:") + 6).Trim();
  32.                         unicode = unicode.Replace("0x", string.Empty);
  33.                         currentGlyph.unicode = unicode;
  34.  
  35.                         vectorImageSet.iconGlyphList.Add(currentGlyph);
  36.                         currentGlyph = null;
  37.                     }
  38.                 }
  39.             }
  40.  
  41.             return vectorImageSet;
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement