All Projects → XiangWuShuo → Eficonfont

XiangWuShuo / Eficonfont

Licence: mit
Yet another stupid wrapper of icon font.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Eficonfont

Fontisto
The iconic font and CSS toolkit. Fontisto gives you scalable vector icons that can instantly be customized: size, color, drop shadow and anything that can be done with the power of CSS.
Stars: ✭ 413 (+106.5%)
Mutual labels:  font, icon, icon-font
Svgtofont
Read a set of SVG icons and ouput a TTF/EOT/WOFF/WOFF2/SVG font.
Stars: ✭ 149 (-25.5%)
Mutual labels:  font, icon, icon-font
fontagon
Fontagon is a great tool that easily converts svg into icon font. Fontagon-cli allows faster conversion to commands.
Stars: ✭ 18 (-91%)
Mutual labels:  font, icon, icon-font
Openwebicons
A font!
Stars: ✭ 835 (+317.5%)
Mutual labels:  font, icon-font
React Fontawesome
A React Font Awesome component.
Stars: ✭ 662 (+231%)
Mutual labels:  font, icon
Sakurakit
🤡SakuraKit, a lightweight and powerful library for application to switching themes or skins.
Stars: ✭ 682 (+241%)
Mutual labels:  font, icon
Fontello Svg
Generate SVG icons from a Fontello icon set.
Stars: ✭ 59 (-70.5%)
Mutual labels:  font, icon
Yii2 Widget Rating
A Yii2 widget for the simple yet powerful bootstrap-star-rating plugin with fractional rating support (sub repo split from yii2-widgets)
Stars: ✭ 47 (-76.5%)
Mutual labels:  font, icon
Awesome Iconjar
44 Collect free icon sets for iconjar. 收集免费的图标包,iconjar 格式(44套)。
Stars: ✭ 188 (-6%)
Mutual labels:  icon, icon-font
Awesome Stock Resources
🌇 A collection of links for free stock photography, video and Illustration websites
Stars: ✭ 10,162 (+4981%)
Mutual labels:  font, icon-font
Icons
The premium icon font for @uiwjs Component Library. https://uiwjs.github.io/icons
Stars: ✭ 99 (-50.5%)
Mutual labels:  icon, icon-font
Coreui Icons
CoreUI Free Icons - Premium designed free icon set with marks in SVG, Webfont and raster formats
Stars: ✭ 1,813 (+806.5%)
Mutual labels:  font, icon-font
Academicons
An icon font for academics
Stars: ✭ 541 (+170.5%)
Mutual labels:  font, icon-font
Glyphsearch
Search for icons from Font Awesome, Glyphicons, IcoMoon, Ionicons, and Octicons
Stars: ✭ 448 (+124%)
Mutual labels:  font, icon-font
Nerd Fonts
Iconic font aggregator, collection, & patcher. 3,600+ icons, 50+ patched fonts: Hack, Source Code Pro, more. Glyph collections: Font Awesome, Material Design Icons, Octicons, & more
Stars: ✭ 31,778 (+15789%)
Mutual labels:  font, icon-font
Fontmin
Minify font seamlessly
Stars: ✭ 4,401 (+2100.5%)
Mutual labels:  font, icon-font
Eva Icons
A pack of more than 480 beautifully crafted Open Source icons. SVG, Sketch, Web Font and Animations support.
Stars: ✭ 8,114 (+3957%)
Mutual labels:  icon, icon-font
Remixicon
Open source neutral style icon system
Stars: ✭ 3,956 (+1878%)
Mutual labels:  icon, icon-font
Prestashop Icon Font
An open source icon pack made with love by the PrestaShop design team. You can use it everywhere to make your designs and websites look awesome.
Stars: ✭ 311 (+55.5%)
Mutual labels:  font, icon-font
Linearicons
Linearicons is the highest quality set of line icons, matching with minimalist UI designs in iOS.
Stars: ✭ 64 (-68%)
Mutual labels:  font, icon

An ordinary iconfont cocoapods package helps you to use iconfont more easily in your project, in Swift.

中文介绍

Preview

1 2 3 4

Example

To run the example project manually, clone the repo, demo is in the 'Example' folder, then open EFIconFont.xcworkspace with Xcode and select the target you want, run.

Or you can run the following command in terminal:

git clone [email protected]:EFPrefix/EFIconFont.git; cd EFIconFont/Example; pod install; open EFIconFont.xcworkspace

Requirements

Version Needs
<0.5 Xcode 10.0+
Swift 4.2+
iOS 8.0+
>=0.5 Xcode 10.2+
Swift 5.0+
iOS 8.0+

Installation

EFIconFont is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'EFIconFont'

You can get built-in iconfonts with subspecs, for example you will get icons of AntDesign and FontAwesome by the following way:

pod 'EFIconFont', :subspecs => ['AntDesign', 'FontAwesome']

You can also choose to get all built-in packs by using Complete subspec:

pod 'EFIconFont', :subspecs => ['Complete']

Then, run the following command:

pod install

Use

1. Core

Objects that implement the EFIconFontProtocol protocol can transform themselves into NSAttributedString or UIImage, which is as follows:

public protocol EFIconFontProtocol {

    // `name` is not necessarily equal to .ttf file name
    var name: String { get }

    // `path` is path of .ttf file
    var path: String { get }

    // `attributes` is style of icon
    var attributes: [NSAttributedString.Key : Any] { set get }

    // `unicode` is unique identifier of particular icon
    var unicode: String { get }
}
  • name: Font name, not necessarily equal to .ttf file name, you can use BirdFont to see the Name attribute of the file;
  • path: Filepath of .ttf file, usually you can get it through code like Bundle.main.path(forResource: name, ofType: "ttf")(If filename is same as name, you can use the default implementation and do not need to implement this property);
  • attributes: Attributes of icon(You can use the default implementation and do not need to implement this property);
  • unicode: The unique unicode of an icon.

Objects that implement the protocol can be converted to strings and images by calling the following methods, you can also change the foreground color and size:

// MARK:- String
func attributedString(size fontSize: CGFloat, attributes: [NSAttributedString.Key : Any]?) -> NSAttributedString?
func attributedString(size fontSize: CGFloat, foregroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -> NSAttributedString?

// MARK:- Image
func image(size fontSize: CGFloat, attributes: [NSAttributedString.Key : Any]?) -> UIImage?
func image(size fontSize: CGFloat, foregroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -> UIImage?
func image(size imageSize: CGSize, attributes: [NSAttributedString.Key : Any]?) -> UIImage?
func image(size imageSize: CGSize, foregroundColor: UIColor? = nil, backgroundColor: UIColor? = nil) -> UIImage?

2. Built-in iconfont packs

This pod has integrated some free resources in the subspecs, like AntDesign and FontAwesome. It can be imported by who need to use it. The usage methods are as follows, you can get a return value of EFIconFontProtocol:

EFIconFontAntDesign.addteam

You can use the object which follow EFIconFontProtocol to get NSAttributedString and UIImage:

EFIconFontAntDesign.addteam.attributedString(size: 24)
EFIconFontFontAwesomeBrands.adobe.attributedString(size: 32, foregroundColor: UIColor.white, backgroundColor: UIColor.green)
EFIconFontFontAwesomeRegular.addressBook.image(size: 24, foregroundColor: UIColor.red)
EFIconFontFontAwesomeSolid.alignLeft.image(size: CGSize(width: 36, height: 48), foregroundColor: UIColor.white)

You can also get all icons of a EFIconFontCaseIterableProtocol object with type [String : EFIconFontProtocol] by the following code:

EFIconFont.antDesign.dictionary

PS: Although the libraries below are all free, please make sure that your way of using the icon conforms to the original author's protocol specification:

Name Version Count File Size Description License Preview
AntDesign 557 127KB Ant Design MIT iconfont.cn
ElusiveIcons 2.0.0 304 53KB Elusive Icons OFL elusiveicons.com
FontAwesome 5.8.1 1516 356KB Font Awesome Font Awesome Free License fontawesome.com
IcoMoon 1.0 490 94KB IcoMoon free icons CC BY 4.0 / GPL ionicons.com
Ionicons 4.5.5 696 143KB Ionicons MIT ionicons.com
MaterialIcons 3.0.1 932 128KB Google's material design icons Apache-2.0 material.io
Meteocons 47 15KB A set of weather icons, it containing 40+ icons Free alessioatzeni.com/meteocons
MetrizeIcons 1.0 300 74KB Free Collection of 300 Metro-Style Icons for Designers and Developers Free alessioatzeni.com/metrize-icons
OpenIconic 1.1.1 223 33KB An open source icon set with 223 marks in SVG OFL useiconic.com/open
Typicons 2.0.9 336 82KB 336 pixel perfect, all-purpose vector icons in a kit OFL s-ings.com/typicons

3. Extend custom packs

(1) Import Font File

Drag the .ttf file of the icon library into the Xcode project and ensure that the Copy Bundle Resources list in Build Phases contains this font file (It will be included by default, just check it).

In addition, the file will be loaded at runtime, do not need to add it to the Fonts provided by application item in the Info.plist file.

(2) Implement EFIconFontCaseIterableProtocol

By making a implementation of EFIconFontCaseIterableProtocol you can get your custom iconfont pack object, demo in this project demonstrates customization with GitHub's Octicons as an example:

import EFIconFont

public extension EFIconFont {
    public static let octicons = EFIconFontOcticons.self
}

extension EFIconFontOcticons: EFIconFontCaseIterableProtocol {
    public static var name: String {
        return "octicons"
    }
    public var unicode: String {
        return self.rawValue
    }
}

public enum EFIconFontOcticons: String {
    case thumbsup = "\u{e6d7}"
    case unverified = "\u{e6d6}"
    case unfold = "\u{e6d5}"
    case verified = "\u{e6d4}"
    // ...
}

(3) Call

Same as Built-in iconfont packs above:

EFIconFontOcticons.thumbsup

(4) Attention

The Octicons icon library in this project is owned by GitHub. This is only a demonstration, do not use it in any situation that violates the specifications set by its owner:

Name Version Count File Size Description License Preview
Octicons 8.4.2 184 34KB GitHub‘s icons GitHub Logos and Usage octicons.github.com

4. Other

Usage of some iconfont resource sites:

Author

EyreFree, [email protected]

License

EFIconFont is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].