hirohisa / font-awesome Goto Github PK
View Code? Open in Web Editor NEWUse Font Awesome in project written in Swift.
License: MIT License
Use Font Awesome in project written in Swift.
License: MIT License
I added the Font-Awesome.swift - Looking at the code, it's not able to get the contents of the file. I also tried using the get contents of file but data is always coming as nil.
I also added the font to the info.plist but no luck. Am i missing anything. I tried with .ttf as well as .otf with no luck.
class FontManager {
class func load(fontName: String) {
if (UIFont.fontNamesForFamilyName(fontName).count > 0) {
return
}
let fontURL = NSBundle.mainBundle().URLForResource(fontName, withExtension: "otf")
**let data = NSData(contentsOfURL: fontURL!)!**
let provider = CGDataProviderCreateWithCFData(data)
let font = CGFontCreateWithDataProvider(provider)!
var error: Unmanaged<CFError>?
if !CTFontManagerRegisterGraphicsFont(font, &error) {
println(error)
}
}
}
I copied both the Font-Awesome folder and the FontAwesome.swift to the projects folder but when i tried to use one of the example I received the above error.
This is the example:
let label = UILabel(frame: frame)
label.font = UIFont.fontAwesome(size: 40)
label.text = String.fontAwesome(unicode: 0xf092) // f092 = fa-github-square
I tried it on others with the same error.
I am unable to italicize the fa icons. Can you please let me know how to italicize the font-awesome icons?
Use sizeThatFits or better solution, UIImageView and UIButton
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.