##// END OF EJS Templates
Add bad font detection, and a dialog informing the user.
mcelrath -
Show More
@@ -334,3 +334,7 b' p.dialog {'
334 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
334 to not honor it correctly. Webkit browsers (Chrome, rekonq, Safari) do.
335 */
335 */
336 pre, code, kbd, samp { white-space: pre-wrap; }
336 pre, code, kbd, samp { white-space: pre-wrap; }
337
338 #fonttest {
339 font-family: monospace;
340 }
@@ -35,6 +35,40 b' $(document).ready(function () {'
35
35
36 IPython.layout_manager.do_resize();
36 IPython.layout_manager.do_resize();
37
37
38 $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
39 '<span id="test2" style="font-weight: bold;">x</span>'+
40 '<span id="test3" style="font-style: italic;">x</span></pre></div>')
41 var nh = $('#test1').innerHeight();
42 var bh = $('#test2').innerHeight();
43 var ih = $('#test3').innerHeight();
44 var dialog = $('<div/>');
45 if(nh != bh || nh != ih) {
46 dialog.html('We have detected that your browser is using a '+
47 '<span style="font-family: monospace;">monospace</span> font that has an '+
48 'inconsistent size between '+
49 '<span style="font-family: monospace;">normal</span>, '+
50 '<span style="font-family: monospace; font-weight: bold;">bold</span>, and '+
51 '<span style="font-family: monospace; font-style: italic;">italic</span> '+
52 'variants, which are used by IPython for syntax highlighting. '+
53 'This will cause visual artifacts. (The font is probably "Courier New") '+
54 'We recommend that you configure your browser to use a different '+
55 'monospace font.<br/><br/>'+
56 'normal='+String(nh)+'px bold='+String(bh)+'px italic='+String(ih)+'px');
57 $(document).append(dialog);
58 dialog.dialog({
59 resizable: false,
60 modal: true,
61 title: "Bad fonts detected",
62 closeText: '',
63 buttons : {
64 "Ok": function () {
65 $(this).dialog('close');
66 }
67 }
68 });
69 $('#fonttest').remove();
70 }
71
38 if(IPython.read_only){
72 if(IPython.read_only){
39 // hide various elements from read-only view
73 // hide various elements from read-only view
40 $('div#pager').remove();
74 $('div#pager').remove();
General Comments 0
You need to be logged in to leave comments. Login now