diff --git a/dist/bigtext.js b/dist/bigtext.js index 16a99ba..b07de64 100644 --- a/dist/bigtext.js +++ b/dist/bigtext.js @@ -1,4 +1,4 @@ -/*! BigText - v0.1.8 - 2015-02-28 +/*! BigText - v0.1.8 - 2015-04-25 * https://github.com/zachleat/bigtext * Copyright (c) 2015 Zach Leatherman (@zachleat) * MIT License */ @@ -136,7 +136,9 @@ function testLineDimensions($line, maxWidth, property, size, interval, units, previousWidth) { - var width; + var width, + return_size; + previousWidth = typeof previousWidth === 'number' ? previousWidth : 0; $line.css(property, size + units); @@ -147,9 +149,13 @@ $line.css(property, ''); if(width === maxWidth) { + return_size = parseFloat((parseFloat(size) - 0.1).toFixed(3)); + if(BigText.supports.wholeNumberFontSizeOnly) { + return_size = Math.round(return_size); + } return { match: 'exact', - size: parseFloat((parseFloat(size) - 0.1).toFixed(3)) + size: return_size }; } @@ -159,9 +165,14 @@ var under = maxWidth - previousWidth, over = width - maxWidth; + return_size = parseFloat((parseFloat(size) - (property === 'word-spacing' && previousWidth && ( over < under ) ? 0 : interval)).toFixed(3)); + if(BigText.supports.wholeNumberFontSizeOnly) { + return_size = Math.round(return_size); + } + return { match: 'estimate', - size: parseFloat((parseFloat(size) - (property === 'word-spacing' && previousWidth && ( over < under ) ? 0 : interval)).toFixed(3)) + size: return_size }; } @@ -258,7 +269,7 @@ // must re-use font-size, even though it was removed above. $line.css('font-size', fontSizes[lineNumber] + 'px'); - for(var m=1, n=3; m