From 19d4062af6068dd0d7225e585e31b90adbfb3ae3 Mon Sep 17 00:00:00 2001 From: Randy Edmunds Date: Wed, 8 May 2013 17:00:32 -0700 Subject: [PATCH 1/3] round line-height up a pixel --- src/view/ViewCommandHandlers.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/view/ViewCommandHandlers.js b/src/view/ViewCommandHandlers.js index aa5d698ed35..594cd885708 100644 --- a/src/view/ViewCommandHandlers.js +++ b/src/view/ViewCommandHandlers.js @@ -63,9 +63,10 @@ define(function (require, exports, module) { * @const * @private * The ratio of line-height to font-size when they use the same units + * On Mac, there's a 1 px problem (#3478) with 1.25, so nudge it up. * @type {float} */ - var LINE_HEIGHT = 1.25; + var LINE_HEIGHT = 1.26; /** * @private @@ -161,7 +162,13 @@ define(function (require, exports, module) { var lhOld = parseFloat(lhStyle.substring(0, lhStyle.length - 2)); var fsNew = fsOld + (delta * adjustment); - var lhNew = (fsUnits === lhUnits) ? fsNew * LINE_HEIGHT : lhOld; + var lhNew = lhOld; + if (fsUnits === lhUnits) { + lhNew = fsNew * LINE_HEIGHT; + if (lhUnits === "px") { + lhNew = Math.ceil(lhNew); + } + } var fsStr = fsNew + fsUnits; var lhStr = lhNew + lhUnits; From 5fa531e075ee7246d9470e8e30ce0420f73cee37 Mon Sep 17 00:00:00 2001 From: Randy Edmunds Date: Wed, 8 May 2013 17:47:47 -0700 Subject: [PATCH 2/3] update comment --- src/view/ViewCommandHandlers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/ViewCommandHandlers.js b/src/view/ViewCommandHandlers.js index 594cd885708..e31c6664ce9 100644 --- a/src/view/ViewCommandHandlers.js +++ b/src/view/ViewCommandHandlers.js @@ -63,7 +63,7 @@ define(function (require, exports, module) { * @const * @private * The ratio of line-height to font-size when they use the same units - * On Mac, there's a 1 px problem (#3478) with 1.25, so nudge it up. + * There's a 1 px problem (#3478) with 1.25, so nudge it up. * @type {float} */ var LINE_HEIGHT = 1.26; From 1c2fc57ab7f376214fdc20e40e0f97de0af78344 Mon Sep 17 00:00:00 2001 From: Randy Edmunds Date: Thu, 9 May 2013 07:56:06 -0700 Subject: [PATCH 3/3] cleaner fix --- src/view/ViewCommandHandlers.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/view/ViewCommandHandlers.js b/src/view/ViewCommandHandlers.js index e31c6664ce9..2347446707a 100644 --- a/src/view/ViewCommandHandlers.js +++ b/src/view/ViewCommandHandlers.js @@ -63,10 +63,9 @@ define(function (require, exports, module) { * @const * @private * The ratio of line-height to font-size when they use the same units - * There's a 1 px problem (#3478) with 1.25, so nudge it up. * @type {float} */ - var LINE_HEIGHT = 1.26; + var LINE_HEIGHT = 1.3; /** * @private @@ -162,13 +161,7 @@ define(function (require, exports, module) { var lhOld = parseFloat(lhStyle.substring(0, lhStyle.length - 2)); var fsNew = fsOld + (delta * adjustment); - var lhNew = lhOld; - if (fsUnits === lhUnits) { - lhNew = fsNew * LINE_HEIGHT; - if (lhUnits === "px") { - lhNew = Math.ceil(lhNew); - } - } + var lhNew = (fsUnits === lhUnits) ? fsNew * LINE_HEIGHT : lhOld; var fsStr = fsNew + fsUnits; var lhStr = lhNew + lhUnits;