From 9fad3c4eb874d17d37e7abff20a34be5e59c6bb2 Mon Sep 17 00:00:00 2001 From: Fabian Jakobs Date: Wed, 15 Dec 2010 12:35:17 +0100 Subject: [PATCH] we need more precision when measuring the character width fixes https://github.com/ajaxorg/editor/issues/issue/8 --- lib/ace/layer/text.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ace/layer/text.js b/lib/ace/layer/text.js index 724b5f36..c8f60391 100644 --- a/lib/ace/layer/text.js +++ b/lib/ace/layer/text.js @@ -79,7 +79,7 @@ var Text = function(parentEl) { self.$characterSize = size; self._dispatchEvent("changeCharaterSize", {data: size}); } - }, 500); + }, 1000); }; this.$fontStyles = { @@ -108,12 +108,12 @@ var Text = function(parentEl) { // in FF 3.6 monospace fonts can have a fixed sub pixel width. // that's why we have to measure many characters // Note: characterWidth can be a float! - measureNode.innerHTML = new Array(1000).join("Xy"); + measureNode.innerHTML = new Array(10000).join("Xy"); document.body.insertBefore(measureNode, document.body.firstChild); var size = { height: measureNode.offsetHeight, - width: measureNode.offsetWidth / 2000 + width: measureNode.offsetWidth / 20000 }; document.body.removeChild(measureNode);