From fc040f5da2ba912ff2fba4089a59f80d644caabd Mon Sep 17 00:00:00 2001 From: Brian Granger Date: Fri, 8 Jun 2012 11:02:15 -0700 Subject: [PATCH] Resolving conflict in utils.js. --- IPython/frontend/html/notebook/static/js/utils.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/IPython/frontend/html/notebook/static/js/utils.js b/IPython/frontend/html/notebook/static/js/utils.js index c741b3912..6225014ad 100644 --- a/IPython/frontend/html/notebook/static/js/utils.js +++ b/IPython/frontend/html/notebook/static/js/utils.js @@ -126,12 +126,24 @@ IPython.utils = (function (IPython) { DOWN : 40, }; + + points_to_pixels = function (points) { + // A reasonably good way of converting between points and pixels. + var test = $('
'); + $(body).append(test); + var pixel_per_point = test.width()/10000; + test.remove(); + return Math.floor(points*pixel_per_point); + } + + return { uuid : uuid, fixConsole : fixConsole, keycodes : keycodes, grow : grow, fixCarriageReturn : fixCarriageReturn + points_to_pixels : points_to_pixels }; }(IPython));