# ng-FitText.js ### ng-FitText.js makes font-sizes flexible. Use this AngularJS directive in your fluid or responsive layout to achieve scalable headlines that fill the width of a parent element. This is a rework of the original jQuery plugin which can be found here: https://github.com/davatron5000/FitText.js. ### Install and Inclusion Grab it with Bower: `bower install ngFitText` Include it in your AngularJS application ```javascript var myApp = angular.module('myApp', ['ngFitText']); ``` ### Implementation ```html

FitText

FitText

FitText

FitText

FitText

FitText

FitText

FitText

Short line
Font size of this element will be used
Short
Single line of text spans 100% width

Custom font

Custom font

``` ### FitText Config Provider Because MODULARIZATION, this module doesn't come with debounce functionality included. Instead you will need to specify the functionality in the `fitTextConfigProvider`: ```javascript module.config(['fitTextConfigProvider', function(fitTextConfigProvider) { fitTextConfigProvider.config = { debounce: _.debounce, // include a vender function like underscore or lodash debounce: function(a,b,c) { // specify your own function var d;return function(){var e=this,f=arguments;clearTimeout(d),d=setTimeout(function(){d=null,c||a.apply(e,f)},b),c&&!d&&a.apply(e,f)} }, delay: 1000, // debounce delay loadDelay: 10, // global default delay before initial calculation compressor: 1, // global default calculation multiplier min: 0, // global default min max: Number.POSITIVE_INFINITY // global default max }; }]); ``` ### Changelog #### [v4.1.0](https://github.com/patrickmarabeas/ng-FitText.js/releases/tag/v4.1.0) + Replace `'initial'` value with more semantic `'inherit'` + Both `data-fittext-min` and `data-fittext-max` can use the inherited CSS value by using `'inherit'` #### [v4.0.0](https://github.com/patrickmarabeas/ng-FitText.js/releases/tag/v4.0.0) + `data-fittext-max` can now take `'initial'` as a value to use inherited CSS value. This allows for PX, EM or REM to be used. + Line heights are preserved + Display property is now preserved + New lines no longer need to be specified with an attribute + `ng-model` was mistakenly used for `ng-bind` - No longer need to use both `ng-model` and `{{}}` for dynamic values + Minified version now delivered via Bower + Config provider namespaced to avoid conflicts #### [v3.0.0](https://github.com/patrickmarabeas/ng-FitText.js/releases/tag/v3.0.0) + Element now defaults to 100% width + Compressor now fine tunes from this point + Debounce functionality now needs to be passed in via fitTextConfigProvider #### < v2.4.0 + Specifying a value for data-fittext allows you to fine tune the text size. Defaults to 1. Increasing this number (ie 1.5) will resize the text more aggressively. Decreasing this number (ie 0.5) will reduce the aggressiveness of resize. data-fittext-min and data-fittext-max allow you to set upper and lower limits. + The element needs to either be a block element or an inline-block element with a width specified (% or px). + Font sizes can be limited with `data-fittext-max` and `data-fittext-max` + Debouncing addded