2626$ only_nonempty_diffs = @$ _GET ['only_nonempty_diffs ' ] === 'on ' ;
2727$ bb_diffs = (@$ _GET ['bb_diffs ' ] === 'on ' and user_can_mentor_in_any_round ());
2828
29+ $ user_diff_font = Settings::get_Settings (User::current_username ())->get_value ("diff_font " , "DP Sans Mono " );
30+ $ diff_fonts = array_diff (array_values (get_available_proofreading_font_faces ()), ['' ]);
31+ $ diff_font = get_enumerated_param ($ _GET , "diff_font " , $ user_diff_font , $ diff_fonts );
32+ if ($ diff_font != $ user_diff_font ) {
33+ Settings::get_Settings (User::current_username ())->set_value ("diff_font " , $ diff_font );
34+ }
2935
3036$ project = new Project ($ projectid );
3137$ state = $ project ->state ;
9298$ image_url = "$ code_url/tools/page_browser.php?project= $ projectid&imagefile= $ image " ;
9399$ image_link = sprintf ($ link_text , new_window_link ($ image_url , $ image ));
94100$ extra_args = [
95- "css_data " => get_DifferenceEngine_css_data (),
101+ "css_data " => get_DifferenceEngine_css_data ($ diff_font ),
96102 "js_data " => "
97103 function copyToClip(textstring) {
98104 navigator.clipboard.writeText(textstring).catch(function () {alert('Unable to copy!');});
@@ -113,7 +119,8 @@ function copyToClip(textstring) {
113119 $ L_user ,
114120 $ format ,
115121 $ only_nonempty_diffs ,
116- $ bb_diffs
122+ $ bb_diffs ,
123+ $ diff_font
117124);
118125echo $ navigation_text ;
119126
@@ -183,8 +190,11 @@ function get_navigation(
183190 $ L_user ,
184191 $ format ,
185192 $ only_nonempty_diffs ,
186- $ bb_diffs
193+ $ bb_diffs ,
194+ $ diff_font
187195) {
196+ global $ diff_fonts ;
197+
188198 $ navigation_text = "" ;
189199 $ jump_to_js = "this.form.image.value=this.form.jumpto[this.form.jumpto.selectedIndex].value; this.form.submit(); " ;
190200
@@ -273,6 +283,17 @@ function get_navigation(
273283
274284 $ navigation_text .= "\n<input type='checkbox' name='only_nonempty_diffs' $ checked_attribute id='only_nonempty_diffs' onclick='this.form.submit()'> \n" ;
275285 $ navigation_text .= "\n<label for='only_nonempty_diffs'> " . html_safe (_ ('Skip empty diffs ' )) . "</label> \n" ;
286+
287+ $ navigation_text .= " · " ;
288+
289+ $ navigation_text .= "\n<label for='diff_font'> " . html_safe (_ ('Font ' )) . ": </label> \n" ;
290+ $ navigation_text .= "\n<select name='diff_font' id='diff_font' onchange='this.form.submit()'> \n" ;
291+ foreach ($ diff_fonts as $ font_family ) {
292+ $ selected = $ font_family == $ diff_font ? "selected " : "" ;
293+ $ navigation_text .= "\n<option value=' " . attr_safe ($ font_family ) . "' $ selected> " . html_safe ($ font_family ) . "</option> " ;
294+ }
295+ $ navigation_text .= "\n</select> " ;
296+
276297 $ navigation_text .= "\n</form> \n" ;
277298
278299 return $ navigation_text ;
0 commit comments