Beispiel #1
0
    static CustomIconHelper()
    {
        var fontName = "custom-icomoon";

        if (m_Font == null)
        {
            m_Font = VectorImageManager.GetIconFont(fontName);
        }

        if (m_IconSet == null)
        {
            m_IconSet = VectorImageManager.GetIconSet(fontName);
        }
    }
Beispiel #2
0
        static ImageData GetIconFromIconFont(string fontName, string iconName)
        {
            VectorImageSet iconSet = VectorImageManager.GetIconSet(fontName);
            Glyph          glyph   = iconSet.iconGlyphList.FirstOrDefault(x => x.name.ToLower().Equals(iconName.ToLower()));

            if (glyph == null)
            {
                Debug.LogError("Could not find an icon with the name: " + iconName + " inside the " + fontName + " icon font");
                return(null);
            }

            Font font = VectorImageManager.GetIconFont(fontName);

            return(new ImageData(new VectorImageData(glyph, font)));
        }
Beispiel #3
0
    // If you want to get the icon from a icon font you downloaded:
    private ImageData GetIconFromIconFont(string fontName, string iconName)
    {
        VectorImageFont vectorFont = VectorImageManager.GetIconFont(fontName);

        if (vectorFont != null)
        {
            var glyph = vectorFont.GetGlyphByName(iconName);
            if (glyph == null)
            {
                Debug.LogError("Could not find an icon with the name: " + name + " inside the " + fontName + " icon font");
                return(null);
            }
            return(new ImageData(new VectorImageData(glyph, vectorFont)));
        }

        return(null);
    }