different font families for people with dyslexia
This commit is contained in:
parent
5761e998de
commit
b72127c327
|
@ -39,6 +39,22 @@
|
||||||
"pad.settings.fontType": "Font type:",
|
"pad.settings.fontType": "Font type:",
|
||||||
"pad.settings.fontType.normal": "Normal",
|
"pad.settings.fontType.normal": "Normal",
|
||||||
"pad.settings.fontType.monospaced": "Monospace",
|
"pad.settings.fontType.monospaced": "Monospace",
|
||||||
|
"pad.settings.fontType.comicsans": "Comic Sans",
|
||||||
|
"pad.settings.fontType.couriernew": "Courier New",
|
||||||
|
"pad.settings.fontType.georgia": "Georgia",
|
||||||
|
"pad.settings.fontType.impact": "Impact",
|
||||||
|
"pad.settings.fontType.lucida": "Lucida",
|
||||||
|
"pad.settings.fontType.lucidasans": "Lucida Sans",
|
||||||
|
"pad.settings.fontType.palatino": "Palatino",
|
||||||
|
"pad.settings.fontType.tahoma": "Tahoma",
|
||||||
|
"pad.settings.fontType.timesnewroman": "Times New Roman",
|
||||||
|
"pad.settings.fontType.trebuchet": "Trebuchet",
|
||||||
|
"pad.settings.fontType.verdana": "Verdana",
|
||||||
|
"pad.settings.fontType.symbol": "Symbol",
|
||||||
|
"pad.settings.fontType.webdings": "Webdings",
|
||||||
|
"pad.settings.fontType.wingdings": "Wingdings",
|
||||||
|
"pad.settings.fontType.sansserif": "Sans Serif",
|
||||||
|
"pad.settings.fontType.serif": "Serif",
|
||||||
"pad.settings.globalView": "Global View",
|
"pad.settings.globalView": "Global View",
|
||||||
"pad.settings.language": "Language:",
|
"pad.settings.language": "Language:",
|
||||||
|
|
||||||
|
|
|
@ -576,9 +576,18 @@ var pad = {
|
||||||
if(padcookie.getPref("rtlIsTrue") == true){
|
if(padcookie.getPref("rtlIsTrue") == true){
|
||||||
pad.changeViewOption('rtlIsTrue', true);
|
pad.changeViewOption('rtlIsTrue', true);
|
||||||
}
|
}
|
||||||
if(padcookie.getPref("useMonospaceFont") == true){
|
|
||||||
pad.changeViewOption('useMonospaceFont', true);
|
var fonts = ['useMonospaceFont', 'useComicSansFont', 'useCourierNewFont', 'useGeorgiaFont', 'useImpactFont',
|
||||||
}
|
'useLucidaFont', 'useLucidaSansFont', 'usePalatinoFont', 'useTahomaFont', 'useTimesNewRomanFont',
|
||||||
|
'useTrebuchetFont', 'useVerdanaFont', 'useSymbolFont', 'useWebdingsFont', 'useWingDingsFont', 'useSansSerifFont',
|
||||||
|
'useSerifFont'];
|
||||||
|
|
||||||
|
$.each(fonts, function(i, font){
|
||||||
|
if(padcookie.getPref(font) == true){
|
||||||
|
pad.changeViewOption(font, true);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
hooks.aCallAll("postAceInit", {ace: padeditor.ace, pad: pad});
|
hooks.aCallAll("postAceInit", {ace: padeditor.ace, pad: pad});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -629,6 +638,7 @@ var pad = {
|
||||||
for (var k in opts.view)
|
for (var k in opts.view)
|
||||||
{
|
{
|
||||||
pad.padOptions.view[k] = opts.view[k];
|
pad.padOptions.view[k] = opts.view[k];
|
||||||
|
console.log("setpref", k, opts.view[k]);
|
||||||
padcookie.setPref(k, opts.view[k]);
|
padcookie.setPref(k, opts.view[k]);
|
||||||
}
|
}
|
||||||
padeditor.setViewOptions(pad.padOptions.view);
|
padeditor.setViewOptions(pad.padOptions.view);
|
||||||
|
|
|
@ -28,6 +28,13 @@ var padeditor = (function()
|
||||||
var Ace2Editor = undefined;
|
var Ace2Editor = undefined;
|
||||||
var pad = undefined;
|
var pad = undefined;
|
||||||
var settings = undefined;
|
var settings = undefined;
|
||||||
|
|
||||||
|
// Array of available fonts
|
||||||
|
var fonts = ['useMonospaceFont', 'useComicSansFont', 'useCourierNewFont', 'useGeorgiaFont', 'useImpactFont',
|
||||||
|
'useLucidaFont', 'useLucidaSansFont', 'usePalatinoFont', 'useTahomaFont', 'useTimesNewRomanFont',
|
||||||
|
'useTrebuchetFont', 'useVerdanaFont', 'useSymbolFont', 'useWebdingsFont', 'useWingDingsFont', 'useSansSerifFont',
|
||||||
|
'useSerifFont'];
|
||||||
|
|
||||||
var self = {
|
var self = {
|
||||||
ace: null,
|
ace: null,
|
||||||
// this is accessed directly from other files
|
// this is accessed directly from other files
|
||||||
|
@ -85,10 +92,15 @@ var padeditor = (function()
|
||||||
padutils.setCheckbox($("#options-rtlcheck"), ('rtl' == html10n.getDirection()));
|
padutils.setCheckbox($("#options-rtlcheck"), ('rtl' == html10n.getDirection()));
|
||||||
})
|
})
|
||||||
|
|
||||||
// font face
|
// font family change
|
||||||
$("#viewfontmenu").change(function()
|
$("#viewfontmenu").change(function()
|
||||||
{
|
{
|
||||||
pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace');
|
$.each(fonts, function(i, font){
|
||||||
|
var sfont = font.replace("use","");
|
||||||
|
sfont = sfont.replace("Font","");
|
||||||
|
sfont = sfont.toLowerCase();
|
||||||
|
pad.changeViewOption(font, $("#viewfontmenu").val() == sfont);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Language
|
// Language
|
||||||
|
@ -98,12 +110,12 @@ var padeditor = (function()
|
||||||
// this does not interfere with html10n's normal value-setting because html10n just ingores <input>s
|
// this does not interfere with html10n's normal value-setting because html10n just ingores <input>s
|
||||||
// also, a value which has been set by the user will be not overwritten since a user-edited <input>
|
// also, a value which has been set by the user will be not overwritten since a user-edited <input>
|
||||||
// does *not* have the editempty-class
|
// does *not* have the editempty-class
|
||||||
$('input[data-l10n-id]').each(function(key, input)
|
$('input[data-l10n-id]').each(function(key, input){
|
||||||
{
|
input = $(input);
|
||||||
input = $(input);
|
if(input.hasClass("editempty")){
|
||||||
if(input.hasClass("editempty"))
|
input.val(html10n.get(input.attr("data-l10n-id")));
|
||||||
input.val(html10n.get(input.attr("data-l10n-id")));
|
}
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
$("#languagemenu").val(html10n.getLanguage());
|
$("#languagemenu").val(html10n.getLanguage());
|
||||||
$("#languagemenu").change(function() {
|
$("#languagemenu").change(function() {
|
||||||
|
@ -136,13 +148,49 @@ var padeditor = (function()
|
||||||
v = getOption('showAuthorColors', true);
|
v = getOption('showAuthorColors', true);
|
||||||
self.ace.setProperty("showsauthorcolors", v);
|
self.ace.setProperty("showsauthorcolors", v);
|
||||||
padutils.setCheckbox($("#options-colorscheck"), v);
|
padutils.setCheckbox($("#options-colorscheck"), v);
|
||||||
// Override from parameters if true
|
|
||||||
if (settings.noColors !== false)
|
|
||||||
self.ace.setProperty("showsauthorcolors", !settings.noColors);
|
|
||||||
|
|
||||||
v = getOption('useMonospaceFont', false);
|
// Override from parameters if true
|
||||||
self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
|
if (settings.noColors !== false){
|
||||||
$("#viewfontmenu").val(v ? "monospace" : "normal");
|
self.ace.setProperty("showsauthorcolors", !settings.noColors);
|
||||||
|
}
|
||||||
|
|
||||||
|
var normalFont = true;
|
||||||
|
// Go through each font and see if the option is set..
|
||||||
|
$.each(fonts, function(i, font){
|
||||||
|
var isEnabled = getOption(font, false);
|
||||||
|
if(isEnabled){
|
||||||
|
font = font.replace("use","");
|
||||||
|
font = font.replace("Font","");
|
||||||
|
font = font.toLowerCase();
|
||||||
|
if(font === "monospace") self.ace.setProperty("textface", "Courier new");
|
||||||
|
if(font === "comicsans") self.ace.setProperty("textface", "Comic Sans MS");
|
||||||
|
if(font === "georgia") self.ace.setProperty("textface", "Georgia");
|
||||||
|
if(font === "impact") self.ace.setProperty("textface", "Impact");
|
||||||
|
if(font === "lucida") self.ace.setProperty("textface", "Lucida");
|
||||||
|
if(font === "lucidasans") self.ace.setProperty("textface", "Lucida Sans Unicode");
|
||||||
|
if(font === "palatino") self.ace.setProperty("textface", "Palatino Linotype");
|
||||||
|
if(font === "tahoma") self.ace.setProperty("textface", "Tahoma");
|
||||||
|
if(font === "timesnewroman") self.ace.setProperty("textface", "Times New Roman");
|
||||||
|
if(font === "trebuchet") self.ace.setProperty("textface", "Trebuchet MS");
|
||||||
|
if(font === "verdana") self.ace.setProperty("textface", "Verdana");
|
||||||
|
if(font === "symbol") self.ace.setProperty("textface", "Symbol");
|
||||||
|
if(font === "webdings") self.ace.setProperty("textface", "Webdings");
|
||||||
|
if(font === "wingdings") self.ace.setProperty("textface", "Wingdings");
|
||||||
|
if(font === "sansserif") self.ace.setProperty("textface", "MS Sans Serif");
|
||||||
|
if(font === "serif") self.ace.setProperty("textface", "MS Serif");
|
||||||
|
|
||||||
|
// $("#viewfontmenu").val(font);
|
||||||
|
normalFont = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// No font has been previously selected so use the Normal font
|
||||||
|
if(normalFont){
|
||||||
|
console.log("Enabling a normal font");
|
||||||
|
self.ace.setProperty("textface", "Arial, sans-serif");
|
||||||
|
// $("#viewfontmenu").val("normal");
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
dispose: function()
|
dispose: function()
|
||||||
{
|
{
|
||||||
|
|
|
@ -160,6 +160,21 @@
|
||||||
<select id="viewfontmenu">
|
<select id="viewfontmenu">
|
||||||
<option value="normal" data-l10n-id="pad.settings.fontType.normal"></option>
|
<option value="normal" data-l10n-id="pad.settings.fontType.normal"></option>
|
||||||
<option value="monospace" data-l10n-id="pad.settings.fontType.monospaced"></option>
|
<option value="monospace" data-l10n-id="pad.settings.fontType.monospaced"></option>
|
||||||
|
<option value="comicsans" data-l10n-id="pad.settings.fontType.comicsans"></option>
|
||||||
|
<option value="georgia" data-l10n-id="pad.settings.fontType.georgia"></option>
|
||||||
|
<option value="impact" data-l10n-id="pad.settings.fontType.impact"></option>
|
||||||
|
<option value="lucida" data-l10n-id="pad.settings.fontType.lucida"></option>
|
||||||
|
<option value="lucidasans" data-l10n-id="pad.settings.fontType.lucidasans"></option>
|
||||||
|
<option value="palatino" data-l10n-id="pad.settings.fontType.palatino"></option>
|
||||||
|
<option value="tahoma" data-l10n-id="pad.settings.fontType.tahoma"></option>
|
||||||
|
<option value="timesnewroman" data-l10n-id="pad.settings.fontType.timesnewroman"></option>
|
||||||
|
<option value="trebuchet" data-l10n-id="pad.settings.fontType.trebuchet"></option>
|
||||||
|
<option value="verdana" data-l10n-id="pad.settings.fontType.verdana"></option>
|
||||||
|
<option value="symbol" data-l10n-id="pad.settings.fontType.symbol"></option>
|
||||||
|
<option value="webdings" data-l10n-id="pad.settings.fontType.webdings"></option>
|
||||||
|
<option value="wingdings" data-l10n-id="pad.settings.fontType.wingdings"></option>
|
||||||
|
<option value="sansserif" data-l10n-id="pad.settings.fontType.sansserif"></option>
|
||||||
|
<option value="serif" data-l10n-id="pad.settings.fontType.serif"></option>
|
||||||
</select>
|
</select>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in New Issue