Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Material Design Icons #91

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,047 changes: 2,047 additions & 0 deletions CodeGenerators/MaterialDesignIcons/_icons.css

Large diffs are not rendered by default.

30 changes: 30 additions & 0 deletions CodeGenerators/MaterialDesignIcons/gen.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
require '../CodeGenerator.rb'

names = [];
codes = [];
iconNames = [];

File.read("_icons.css").each_line do |line|
name = ''
line.gsub(/(?<=mdi-).*(?=:before)/i) { |match| name = match }
iconNames.push "mdi-#{name}"
nameParts = name.split('-')
nameParts = nameParts.each_with_index.map do |p, i|
if i < 1
p
else
p = p.capitalize
end
end
name = nameParts.join
names.push name

code = ''
line.gsub(/".*"/) { |match| code = match[2..(match.length-2)] }
codes.push "\\u#{code}"
end

generator = CodeGenerator.new('MaterialDesignIcons', names, codes, iconNames)
generator.generate


8 changes: 7 additions & 1 deletion FontAwesomeKit.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "FontAwesomeKit"
s.version = "2.2.1"
s.version = "2.2.5"
s.summary = "Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons"
s.homepage = "https://github.com/PrideChung/FontAwesomeKit"
s.screenshots = "http://i.minus.com/i3vNn0fTwcJeI.png", "http://i.minus.com/ivKqhOLJLVvmJ.png"
Expand Down Expand Up @@ -53,4 +53,10 @@ Pod::Spec.new do |s|
ss.source_files = 'FontAwesomeKit/FAKMaterialIcons.{h,m}'
ss.resource = 'FontAwesomeKit/Material-Design-Iconic-Font.ttf'
end

s.subspec 'MaterialDesignIcons' do |ss|
ss.dependency 'FontAwesomeKit/Core'
ss.source_files = 'FontAwesomeKit/FAKMaterialDesignIcons.{h,m}'
ss.resource = 'FontAwesomeKit/materialdesignicons-webfont.ttf'
end
end
3 changes: 2 additions & 1 deletion FontAwesomeKit/FAKIcon.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
* Zocial icons identifier should look like "zocial.{icon}"
* Material icons identifier should look like "zmdi-var-{icon}"
* Octicons icons identifier should look like "octicon-{icon}"
* Material Design icons identifier should look like "mdi-{icon}"
* @param size The desired size (in points) of the icon font that will be used for the icon. This value must be greater than 0.0.
* @param error Returns an error in case the identifier does not exist.
*
Expand All @@ -82,7 +83,7 @@
/**
* Adds an attribute with the given name and value to the icon.
*
* @param name A string specifying the attribute name.
* @param name A string specifying the attribute name.
* @param value Adds an attribute with the given name and value to the icon.
*/
- (void)addAttribute:(NSString *)name value:(id)value;
Expand Down
2,054 changes: 2,054 additions & 0 deletions FontAwesomeKit/FAKMaterialDesignIcons.h

Large diffs are not rendered by default.

4,123 changes: 4,123 additions & 0 deletions FontAwesomeKit/FAKMaterialDesignIcons.m

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions FontAwesomeKit/FontAwesomeKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
#import "FAKIonIcons.h"
#import "FAKOcticons.h"
#import "FAKMaterialIcons.h"
#import "FAKMaterialDesignIcons.h"

#endif
Binary file modified FontAwesomeKit/Material-Design-Iconic-Font.ttf
100644 → 100755
Binary file not shown.
Binary file added FontAwesomeKit/materialdesignicons-webfont.ttf
Binary file not shown.
20 changes: 12 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Currently FontAwesomeKit supports **6** different icon fonts.
- [ionicons 2.0.0](http://ionicons.com/) Contains **733** icons, lots of iOS 7 style outlined icons.
- [Octicons 2.4.1](https://octicons.github.com/) Contains **206** icons, built with love by [Github](https://github.com/).
- [Material 2.0.0](https://google.github.io/material-design-icons/) Contains **743** icons, built by Google for Material design.
- [Material Design Icons 1.5.54](https://materialdesignicons.com/) Contains **1554** icons, based on Google's Material and community additions.

### API Reforged, Take Advantage of NSAttributedString
Thanks to `NSAttributedString` the API is more clean and object oriented. All hail `NSAttributedString`!
Expand All @@ -33,14 +34,15 @@ FontAwesomeKit now supports sub spec, only get the fonts you need.

Add `pod 'FontAwesomeKit', '~> 2.2.0'` to Podfile to install all icon fonts.

Or select icon fonts with:
Or select icon fonts with:

`pod 'FontAwesomeKit/FontAwesome'`
`pod 'FontAwesomeKit/FoundationIcons'`
`pod 'FontAwesomeKit/Zocial'`
`pod 'FontAwesomeKit/FontAwesome'`
`pod 'FontAwesomeKit/FoundationIcons'`
`pod 'FontAwesomeKit/Zocial'`
`pod 'FontAwesomeKit/IonIcons'`
`pod 'FontAwesomeKit/Octicons'`
`pod 'FontAwesomeKit/Material'`
`pod 'FontAwesomeKit/MaterialDesignIcons'`

Run `pod install` or `pod update` to install selected icon fonts.

Expand All @@ -50,12 +52,13 @@ Run `pod install` or `pod update` to install selected icon fonts.

Or import icon fonts you installed with sub specs

`#import FontAwesomeKit/FAKFontAwesome.h`
`#import FontAwesomeKit/FAKFoundationIcons.h`
`#import FontAwesomeKit/FAKZocial.h`
`#import FontAwesomeKit/FAKFontAwesome.h`
`#import FontAwesomeKit/FAKFoundationIcons.h`
`#import FontAwesomeKit/FAKZocial.h`
`#import FontAwesomeKit/FAKIonIcons.h`
`#import FontAwesomeKit/FAKOcticons.h`
`#import FontAwesomeKit/FAKMaterialIcons.h`
`#import FontAwesomeKit/FAKMaterialDesignIcons.h`

#####*important:*
If you deleted a sub spec in Podfile, please delete Xcode's derived data in organizer(command+shift+2 to bring up). Otherwise Xcode will keep copying font files those supposed to be deleted to the app bundle.
Expand All @@ -73,10 +76,11 @@ Download source code, then drag the folder `FontAwesomeKit` into your project, a
```objective-c
FAKFontAwesome *starIcon = [FAKFontAwesome starIconWithSize:15];
FAKFoundationIcons *bookmarkIcon = [FAKFoundationIcons bookmarkIconWithSize:15];
FAKZocial *twitterIcon = [FAKZocial twitterIconWithSize:15];
FAKZocial *twitterIcon = [FAKZocial twitterIconWithSize:15];
FAKIonIcons *mailIcon = [FAKIonIcons ios7EmailIconWithSize:48];
FAKOcticons *repoIcon = [FAKOcticons repoIconWithSize:48];
FAKMaterialIcons *androidIcon = [FAKMaterialIcons androidIconWithSize:48];
FAKMaterialDesignIcons *cameraTimerIcon = [FAKMaterialIcons cameraTimerIconWithSize:36];

```

Expand Down