Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
/ TiDynamicTypeUtils Public archive

TiDynamicTypeUtils gives you access to dynamic system font sizes (iOS 7)

License

Notifications You must be signed in to change notification settings

smclab/TiDynamicTypeUtils

Repository files navigation

TiDynamicTypeUtils

Built for Titanium SDK Available through gitTio

Use Dynamic Type, introduced by iOS 7, in your Titanium SDK application!

Installation

You can install this module using gitTio with

gittio install it.smc.dynamictypeutils

Alternatively you can download a specific release for manual installation.

Example

You can run the example running the following command

gittio demo it.smc.dynamictypeutils

The source for this demo application can be found in the example folder.

Usage overview

var dynamictype = require('it.smc.dynamictypeutils')

var label = Ti.UI.createLabel({
	font: {
		fontSize: dynamictype.getFontSize(Ti.UI.TEXT_STYLE_SUBHEADLINE)
	}
});

Remember: when you use Dynamic Type, the interface does not update automatically if has already been created and the user changes the system font size. This is the expected behaviour on iOS 7.

Support for Android

In Android you do not need this module, nor any module at all, just use the 'sp' unit.

Credits

Humbly made by the spry ladies and gents at SMC.

License

This library, TiDynamicTypeUtils, is free software ("Licensed Software"); you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; including but not limited to, the implied warranty of MERCHANTABILITY, NONINFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA