diff --git a/IPython/frontend/html/notebook/static/js/utils.js b/IPython/frontend/html/notebook/static/js/utils.js index c741b39..6225014 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));