OpenSansSwift - Easily use the OpenSans font in Swift.

Overview

Carthage compatible

OpenSansSwift

Easily use the OpenSans font in Swift.

Screenshot

Why use OpenSansSwift frameworks ?

The usual process of embedding any custom fonts in your IOS applications has a few steps:

  1. Copy all your font resources to your project
  2. Make sure they're copied to the bundle
  3. Add UIAppFonts key to info.plist.
  4. Painstakingly add all the font names with the right extension
  5. Find out the font family and font names programatically
  6. Use the fonts

For the OpenSans font, this framework does all that for you. All you have to do is link the compiled framework.

How to Install - Carthage

If you dont' already have Carthage, Install it with:

$ brew update
$ brew install carthage

Add github "hemantasapkota/OpenSansSwift" to your Cartfile.

Execute carthage install

Swift 3

Add github "hemantasapkota/OpenSansSwift" "swift3" to your Cartfile.

Execute carthage install

How to Install - Manual

Clone the repo and add OpenSansSwift.xcodeproj to you project. Link OpenSansSwift.framework to your project.

OpenSans Font Methods

Based on OpenSans v2.0, OpenSansSwift registers the following methods:

    openSansFontOfSize(size: Float) -> UIFont!
    openSansBoldFontOfSize(size: Float) -> UIFont!
    openSansBoldItalicFontOfSize(size: Float) -> UIFont!
    openSansExtraBoldFontOfSize(size: Float) -> UIFont!
    openSansExtraBoldItalicFontOfSize(size: Float) -> UIFont!
    openSansItalicFontOfSize(size: Float) -> UIFont!
    openSansLightFontOfSize(size: Float) -> UIFont!
    openSansLightItalicFontOfSize(size: Float) -> UIFont!
    openSansSemiboldFontOfSize(size: Float) -> UIFont!
    openSansSemiboldItalicFontOfSize(size: Float) -> UIFont!

Retina Scale Factor

Set OpenSans.retinaScaleFactor to scale out font sizes for the iPad. Default is 2.

Usage - Programmatically

See Example for more details.

import UIKit
import OpenSansSwift

class ViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()    
        
        //Register Open Sans fonts. Register only once.
        OpenSans.registerFonts()
        
        // Set the scale for iPad. Default is 2.
        OpenSans.retinaScaleFactor = 1.5
        
        // Create a label
        let lbl1 = UILabel(frame: CGRectMake(x, y, size.width, size.height))
        
        lbl1.font = UIFont.openSansFontOfSize(30)
        
        lbl1.text = "This is OpenSans-Regular"
        self.view.addSubView(lbl1)
    }
}

Usage - Storyboard

XCode automatically detects the fonts present in the bundle, so you don't have to perform any registration for use in Storyboards.

Screenshot

Usage - With NSAttributedString

For use with NSAttributedString, Use the following strings: OpenSans, OpenSans-Bold, OpenSans-Italic

let regularAttribute = [NSFontAttributeName: UIFont(name: "OpenSans", size: 12)!]
let boldAttribute = [NSFontAttributeName: UIFont(name: "OpenSans-Bold", size: 12)!]
let italicAttribute = [NSFontAttributeName: UIFont(name: "OpenSans-Italic", size: 12)!]

Licence

You might also like...
Use FontAwesome in your Swift projects
Use FontAwesome in your Swift projects

FontAwesome.swift Use Font Awesome in your Swift projects To see the complete set of 3,978 icons in Font Awesome 5, please check the FontAwesome.com s

Use Ionicons in your Swift projects.
Use Ionicons in your Swift projects.

IoniconsKit IoniconsKit internally use ionicons.ttf v2.0.1 Example To run the example project, clone the repo, and run pod install from the Example di

Use Octicons in your Swift projects.
Use Octicons in your Swift projects.

OcticonsKit OcticonsKit internally use octicons.ttf v4.3.0 Example To run the example project, clone the repo, and run pod install from the Example di

Use 1600+ icons (and more!) from FontAwesome and Google Material Icons in your swift/iOS project in an easy and space-efficient way!
Use 1600+ icons (and more!) from FontAwesome and Google Material Icons in your swift/iOS project in an easy and space-efficient way!

Swicon Use 1600+ icons from FontAwesome and Google Material Icons in your iOS project in an easy and space-efficient way! The built-in icons are from

An inkwell to use custom fonts on the fly.
An inkwell to use custom fonts on the fly.

Inkwell Introduction In brief, Inkwell is a font library to use custom fonts on the fly. Inkwell takes responsibilities for: Downloading fonts from Go

A better choice for iOS Developer to use FontAwesome Icon with UI.๐Ÿ˜
A better choice for iOS Developer to use FontAwesome Icon with UI.๐Ÿ˜

FontAwesomeKit.Swift ๐Ÿ˜€ ๐Ÿ˜˜ A better choice for iOS Developer to use FontAwesome Icon with UI. ๐Ÿ˜ Support Swift 4.2 & iOS 8.0+ FontAwesome 4.7.0 Storyb

Generator of settings icon by SF Symbols. Customisable background color and ready-use in table cell.

SPSettingsIcons Generate settings icons by Apple's SF Symbols. For safe using SFSymbols see SPSafeSymbols library. Installation Swift Package Manager

Google Material Design Icons for Swift and ObjC project
Google Material Design Icons for Swift and ObjC project

GoogleMaterialIconFont Google Material Design Icons for Swift and ObjC project This library is inspired by FontAwesome.swift Both Swift and Objctive-C

round icon drag control (made in swift) dock style
round icon drag control (made in swift) dock style

ASBubbleDrag Bubble drag control integrate in storyboard : Installation CocoaPods You can use CocoaPods to install ASBubbleDrag by adding it to your P

Owner
Hemant Sapkota
Software Architect. React Native, React, Golang, Swift, Objective-C, Android, Java, Kotlin, AWS - https://codeplayground.app
Hemant Sapkota
Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons.

FontAwesomeKit Icon font library for iOS. Currently supports Font-Awesome, Foundation icons, Zocial, and ionicons. Version 2.2 Notable Changes Not Jus

Pride Chung 2.8k Jan 6, 2023
๐ŸŽข Swift Library for Font Icons

Swift Library for Font Icons Please โ˜… this library. Now, you don't have to download different libraries to include different font icons. This SwiftIco

Saurabh Rane 781 Dec 6, 2022
Font Awesome swift library for iOS.

Font Awesome Swift Follow me: @vaberer I like โ˜…. Do not forget to โ˜… this super convenient library. Added UISegmentedControl & UITabbarItem & UISlider

Patrick Vaberer 746 Dec 17, 2022
Font Awesome support in Swift

MCFontAwesome Font Awesome v4.1.0 for Swift Font aliases has not been ported yet, in order to refer to a font you have to strip all the - (minus) insi

Matteo Crippa 19 Jun 9, 2020
Icons fonts for iOS (Font Awesome 5, Iconic, Ionicon, Octicon, Themify, MapIcon, MaterialIcon, Foundation 3, Elegant Icon, Captain Icon)

Installation SPM Not yet supported. Please use Cocoapods or Carthage Carthage github "0x73/SwiftIconFont" Cocoapods CocoaPods is a dependency manager

sedat รงiftรงi 1.1k Dec 14, 2022
SwiftUIFontIcon The easiest way to implement font icons in your SwiftUI project.

SwiftUIFontIcon The easiest way to implement font icons in your SwiftUI project. Usage The library is super super easy to use, just something like thi

Bui Dac Huy 81 Dec 27, 2022
Font management (System & Custom) for iOS and tvOS

UIFontComplete Font management (System & Custom) for iOS and tvOS Usage No more wasted time searching for names of UIFont fonts and no more surprises

Nicholas Maccharoli 1.3k Nov 14, 2022
Auto-generated icon font library for iOS, watchOS and tvOS

Iconic helps making icon fonts integration effortless on iOS, tvOS and watchOS. Its main component is in charge of auto-generating strongly typed Swif

Home Assistant 1.6k Nov 12, 2022
Google Material Design Icons Font for iOS

GoogleMaterialDesignIcons #Google Material Design Icons Font for iOS It is based on https://github.com/google/material-design-icons. it converts the m

Yuji Hato 365 Oct 19, 2022
This projects shows how we can server-side add/update "ANY" custom font in a live iOS App without needing to update the app.

Server-side-Dynamic-Fonts This projects shows how we can server-side add/update "ANY" custom font in a live iOS App without needing to update the app.

null 2 Mar 26, 2022