##// END OF EJS Templates
Alternative solution: silently apply some CSS instead of a dialog box.
mcelrath -
Show More
@@ -242,9 +242,16 b' div.text_cell_render {'
242 color: black;
242 color: black;
243 }
243 }
244
244
245 .CodeMirror span {
245 /* The following gets added to the <head> if it is detected that the user has a
246 vertical-align: bottom;
246 * monospace font with inconsistent normal/bold/italic height. See
247 }
247 * notebookmain.js. Such fonts will have keywords vertically offset with
248 * respect to the rest of the text. The user should select a better font.
249 * See: https://github.com/ipython/ipython/issues/1503
250 *
251 * .CodeMirror span {
252 * vertical-align: bottom;
253 * }
254 */
248
255
249 .CodeMirror {
256 .CodeMirror {
250 line-height: 1.231; /* Changed from 1em to our global default */
257 line-height: 1.231; /* Changed from 1em to our global default */
@@ -41,31 +41,8 b' $(document).ready(function () {'
41 var nh = $('#test1').innerHeight();
41 var nh = $('#test1').innerHeight();
42 var bh = $('#test2').innerHeight();
42 var bh = $('#test2').innerHeight();
43 var ih = $('#test3').innerHeight();
43 var ih = $('#test3').innerHeight();
44 var dialog = $('<div/>');
45 if(nh != bh || nh != ih) {
44 if(nh != bh || nh != ih) {
46 dialog.html('We have detected that your browser is using a '+
45 $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
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();
46 $('#fonttest').remove();
70 }
47 }
71
48
General Comments 0
You need to be logged in to leave comments. Login now