protected override VectorImageSet GenerateIconSet(string fontDataContent)
		{
			VectorImageSet vectorImageSet = new VectorImageSet();
			Glyph currentGlyph = null;
			
			foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
			{
				if (line.StartsWith(".icon-") && line.Contains(":before"))
				{
					currentGlyph = new Glyph();

					string name = line.Replace(".icon-", string.Empty).Trim();
					name = name.Substring(0, name.IndexOf(":")).Trim();

					currentGlyph.name = name;
				}

				if (line.StartsWith("  content:"))
				{
					if (currentGlyph != null)
					{
						string unicode = line.Substring(line.IndexOf("content:") + 10);
						unicode = unicode.Substring(0, unicode.IndexOf("\";"));
						unicode = ((int)unicode[0]).ToString("X4");

						currentGlyph.unicode = unicode;

						vectorImageSet.iconGlyphList.Add(currentGlyph);
						currentGlyph = null;
					}
				}
			}

            return vectorImageSet;
		}
		protected override VectorImageSet GenerateIconSet(string fontDataContent)
		{
			VectorImageSet vectorImageSet = new VectorImageSet();
			Glyph currentGlyph = null;
			
			foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
			{
				if (line.StartsWith("            <div class=\"icon-wrap\">"))
				{
					currentGlyph = new Glyph();
				}

				if (line.StartsWith("              <div class=\"icon-name\">"))
				{
					string name = line.Substring(line.IndexOf(">") + 1).Trim();
					name = name.Substring(0, name.IndexOf("</div>")).Trim();
					currentGlyph.name = name;
				}
				
				if (line.StartsWith("              <div class=\"icon_unicode\">"))
				{
					if (currentGlyph != null)
					{
						string unicode = line.Substring(line.IndexOf(">") + 1).Trim();
						unicode = unicode.Substring(0, unicode.IndexOf("</div>")).Trim();
						currentGlyph.unicode = unicode;

						vectorImageSet.iconGlyphList.Add(currentGlyph);
						currentGlyph = null;
					}
				}
			}

            return vectorImageSet;
		}
        protected override VectorImageSet GenerateIconSet(string fontDataContent)
        {
            VectorImageSet vectorImageSet = new VectorImageSet();

            bool canStartReading = false;
            foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
            {
                if (!canStartReading)
                {
                    if (line.StartsWith(".ki-"))
                    {
                        canStartReading = true;
                    }
                    else
                    {
                        continue;
                    }
                }

                if (line.Contains(".ki-"))
                {
                    Glyph currentGlyph = new Glyph();

                    string[] lineParts = line.Split(':');

                    currentGlyph.name = lineParts[0].Replace(".ki-", "");

                    currentGlyph.unicode = lineParts[2].Replace(" ", "").Replace("\"", "").Replace("\\", "").Replace(";}", "");

                    vectorImageSet.iconGlyphList.Add(currentGlyph);
                }
            }

            return vectorImageSet;
        }
		protected override VectorImageSet GenerateIconSet(string fontDataContent)
		{
			VectorImageSet vectorImageSet = new VectorImageSet();
			Glyph currentGlyph = null;
			
			foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
			{
				if (line.StartsWith("    id:"))
				{
					currentGlyph = new Glyph();
					currentGlyph.name = line.Substring(line.IndexOf(":") + 1).Trim();
				}
				
				if (line.StartsWith("    unicode:"))
				{
					if (currentGlyph != null)
					{
						currentGlyph.unicode = line.Substring(line.IndexOf(":") + 1).Trim();
						vectorImageSet.iconGlyphList.Add(currentGlyph);
						currentGlyph = null;
					}
				}
			}
			
            return vectorImageSet;
		}
		public static VectorImageSet GenerateSpecificIconSet(string fontDataContent)
		{
			VectorImageSet vectorImageSet = new VectorImageSet();
			Glyph currentGlyph = null;

			foreach (string line in fontDataContent.Split(new [] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
			{
				if (line.StartsWith("				\"code\":"))
				{
					currentGlyph = new Glyph();
					string stringcode = line.Substring(line.IndexOf(":") + 1).Replace(",", "").Replace("\"", "").Trim();
					int intcode = int.Parse(stringcode);

					if (intcode < 1000)
					{
						currentGlyph = null;
						continue;
					}

                    currentGlyph.unicode = intcode.ToString("X4");
				}
				
				if (line.StartsWith("				\"name\":"))
				{
					if (currentGlyph != null)
					{
                        currentGlyph.name = line.Substring(line.IndexOf(":") + 1).Replace(",", "").Replace("\"", "").Trim();
                        vectorImageSet.iconGlyphList.Add(currentGlyph);
						currentGlyph = null;
					}
				}
			}

			return vectorImageSet;
		}
示例#6
0
        public VectorImageData(Glyph glyph, Font font)
        {
            m_Glyph = glyph;
            if (!m_Glyph.unicode.StartsWith(@"\u"))
            {
                m_Glyph.unicode = @"\u" + m_Glyph.unicode;
            }

            m_Font = font;
        }
		protected override VectorImageSet GenerateIconSet(string fontDataContent)
		{
			VectorImageSet vectorImageSet = new VectorImageSet();
			Glyph currentGlyph = null;

			bool canStartReading = false;
			foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
			{
				if (!canStartReading)
				{
					if (line.StartsWith("glyphs:"))
					{
						canStartReading = true;
					}

					continue;
				}

				if (line.Contains("css:"))
				{
					currentGlyph = new Glyph();

					string name = line.Substring(line.IndexOf("css:") + 5).Trim();
					currentGlyph.name = name;
				}

				if (line.Contains("code:") && line.Contains("0x"))
				{
					if (currentGlyph != null)
					{
						string unicode = line.Substring(line.IndexOf("code:") + 6).Trim();
						unicode = unicode.Replace("0x", string.Empty);
						currentGlyph.unicode = unicode;

						vectorImageSet.iconGlyphList.Add(currentGlyph);
						currentGlyph = null;
					}
				}
			}

            return vectorImageSet;
		}
		protected override VectorImageSet GenerateIconSet(string fontDataContent)
		{
			VectorImageSet vectorImageSet = new VectorImageSet();
			
			foreach (string line in fontDataContent.Split(new string[] { "\n" }, StringSplitOptions.RemoveEmptyEntries))
			{
				if (line.StartsWith(".oi[data-glyph") && line.Contains("content:"))
				{
					string name = line.Replace(".oi[data-glyph=", string.Empty).Trim();
					name = name.Substring(0, name.IndexOf("]")).Trim();

					string unicode = line.Substring(line.IndexOf("content:'") + 10);
					unicode = unicode.Substring(0, unicode.IndexOf("'; }"));

					Glyph glyph = new Glyph(name, unicode, false);
					vectorImageSet.iconGlyphList.Add(glyph);
				}
			}

            return vectorImageSet;
		}