diff --git a/src/locales/en.json b/src/locales/en.json
index 23bb3a040..b5713660b 100644
--- a/src/locales/en.json
+++ b/src/locales/en.json
@@ -39,6 +39,22 @@
"pad.settings.fontType": "Font type:",
"pad.settings.fontType.normal": "Normal",
"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.language": "Language:",
diff --git a/src/static/js/pad.js b/src/static/js/pad.js
index 77bfab7f1..0e54168b0 100644
--- a/src/static/js/pad.js
+++ b/src/static/js/pad.js
@@ -576,9 +576,18 @@ var pad = {
if(padcookie.getPref("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});
}
},
@@ -629,6 +638,7 @@ var pad = {
for (var k in opts.view)
{
pad.padOptions.view[k] = opts.view[k];
+console.log("setpref", k, opts.view[k]);
padcookie.setPref(k, opts.view[k]);
}
padeditor.setViewOptions(pad.padOptions.view);
diff --git a/src/static/js/pad_editor.js b/src/static/js/pad_editor.js
index b73409ff3..51b9355e5 100644
--- a/src/static/js/pad_editor.js
+++ b/src/static/js/pad_editor.js
@@ -28,6 +28,13 @@ var padeditor = (function()
var Ace2Editor = undefined;
var pad = 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 = {
ace: null,
// this is accessed directly from other files
@@ -85,10 +92,15 @@ var padeditor = (function()
padutils.setCheckbox($("#options-rtlcheck"), ('rtl' == html10n.getDirection()));
})
- // font face
+ // font family change
$("#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
@@ -98,12 +110,12 @@ var padeditor = (function()
// this does not interfere with html10n's normal value-setting because html10n just ingores s
// also, a value which has been set by the user will be not overwritten since a user-edited
// does *not* have the editempty-class
- $('input[data-l10n-id]').each(function(key, input)
- {
- input = $(input);
- if(input.hasClass("editempty"))
- input.val(html10n.get(input.attr("data-l10n-id")));
- });
+ $('input[data-l10n-id]').each(function(key, input){
+ input = $(input);
+ if(input.hasClass("editempty")){
+ input.val(html10n.get(input.attr("data-l10n-id")));
+ }
+ });
})
$("#languagemenu").val(html10n.getLanguage());
$("#languagemenu").change(function() {
@@ -136,13 +148,49 @@ var padeditor = (function()
v = getOption('showAuthorColors', true);
self.ace.setProperty("showsauthorcolors", 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);
- self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
- $("#viewfontmenu").val(v ? "monospace" : "normal");
+ // Override from parameters if true
+ if (settings.noColors !== false){
+ 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()
{
diff --git a/src/templates/pad.html b/src/templates/pad.html
index 7c7257cc6..99997615c 100644
--- a/src/templates/pad.html
+++ b/src/templates/pad.html
@@ -160,6 +160,21 @@