This repository was archived by the owner on Sep 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Expand file tree
/
Copy pathFontSettings.js
More file actions
65 lines (47 loc) · 1.83 KB
/
FontSettings.js
File metadata and controls
65 lines (47 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
* Brackets Themes Copyright (c) 2014 Miguel Castillo.
*
* Licensed under MIT
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global $, define, require */
define(function () {
"use strict";
var $lineHeight = $("<style type='text/css' id='lineHeight'>").appendTo("head"),
$fontSize = $("<style type='text/css' id='fontSize'>").appendTo("head"),
$fontType = $("<style type='text/css' id='fontType'>").appendTo("head");
var Settings = null;
function FontSettings(_settings) {
Settings = _settings;
$(Settings).on("change:lineHeight", FontSettings.updateLineHeight);
$(Settings).on("change:fontSize", FontSettings.updateFontSize);
$(Settings).on("change:fontType", FontSettings.updateFontType);
FontSettings.update();
}
FontSettings.updateLineHeight = function () {
clearFonts();
var value = Settings.getValue("lineHeight");
$lineHeight.text(".CodeMirror{" + "line-height: " + value + "; }");
};
FontSettings.updateFontSize = function () {
clearFonts();
var value = Settings.getValue("fontSize");
$fontSize.text(".CodeMirror{" + "font-size: " + value + " !important; }");
};
FontSettings.updateFontType = function () {
clearFonts();
var value = Settings.getValue("fontType");
$fontType.text(".CodeMirror{" + "font-family: " + value + " !important; }");
};
FontSettings.update = function () {
clearFonts();
FontSettings.updateLineHeight();
FontSettings.updateFontSize();
FontSettings.updateFontType();
};
function clearFonts() {
// Remove this tag that is intefering with font settings set in this module
$("#codemirror-dynamic-fonts").remove();
}
return FontSettings;
});