Latest 1.0.2
Homepage https://github.com/rootstrap/RSFontSizes
License MIT
Platforms ios 8.0
Dependencies Device
Authors

CI Status
Version
License
Platform

What is it?

RSFontSize allows you to manage different font sizes for every device screen size in a flexible manner.

  • No more family name and styles typing/guessing every time you use a font.
  • Flexible size configurations(Fixed, Proportional to screen size and user specific).
  • Smart size estimation for vague specifications.
  • Save your font configurations for different UIFontTextStyle(.body, .headline, etc).

Installation

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

pod "RSFontSizes"

Quick peek

From poorly managed font sizes:

Normal Preview

Fonts are set directly from IB.

To readable texts:

Preview With RSFontSizes

Fonts using RSFontSizes.

Start using RSFontSizes

Just link your font assets to the project. Very detailed guide here.

If there are too many font files to add, FontBlaster pod is strongly recommended.
It’s a simple solution to load your assets automatically instead of manually adding every file to the Info.plist.

Optionally add your favourite fonts.

extension Font {
  //Your Custom font family names
  static let raleway = "Raleway"
}

Perks

There are different types to get your fonts correctly sized:

-Fixed: The consumer sets the font point size or uses one of the provided classes(.small, .medium, etc).

let font = Font.raleway.with(style: .regular, size: .medium)

No magic here :)

-Proportional: The consumer will specify a base font size asociated with a device screen size.

let font = Font.raleway.with(style: .thin, size: .proportional(to: (.screen3_5Inch, 10)))

The result will be a font resized accordingly for the current device screen size.

-Screen Specific: The consumer defines a set of font sizes linked to an specific screen size.

let font = Font.raleway.with(style: .regular, 
                             size: .specific(with: [.screen4Inch:12, 
                                                    .screen4_7Inch: 13.5,
                                                    .screen5_5Inch: 16,
                                                    .screen9_7Inch: 20.2]))

If a screen size is not specified the library will try to estimate the correct value for the font size.

You can also…

Use a String as the Font family name

let font = "Raleway".with(style: .bold, size: .fixed(20))

Save your ‘templates’ to reuse

Font.save(font: someFont, forClass: .body)

And then use it elsewhere:

let label.font = Font.with(class: .body)

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Author

Rootstrap Inc., [email protected]

License

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

Latest podspec

{
    "name": "RSFontSizes",
    "version": "1.0.2",
    "summary": "Easily manage your font styles and sizes for every screen size.",
    "description": "RSFontSize allows you to manage different font sizes for every device screen size in a flexible manner.n- No more family name and styles typing/guessing every time you use a font.n- Flexible size configurations(Fixed, Proportional to screen size and user specific).n- Smart size estimation for vague specifications.n- Save your font configurations for different UIFontTextStyle(.body, .title, etc).",
    "homepage": "https://github.com/rootstrap/RSFontSizes",
    "screenshots": "https://github.com/rootstrap/RSFontSizes/blob/master/dynamic-font-sizes.jpg?raw=true",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "German Lopez": "[email protected]"
    },
    "source": {
        "git": "https://github.com/rootstrap/RSFontSizes.git",
        "tag": "1.0.2"
    },
    "social_media_url": "https://twitter.com/Rootstrap_UY",
    "platforms": {
        "ios": "8.0"
    },
    "source_files": "RSFontSizes/Classes/**/*",
    "dependencies": {
        "Device": [
            "~> 3.1.2"
        ]
    }
}

Pin It on Pinterest

Share This