source: frontend/node_modules/cssstyle/lib/properties/font.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.1 KB
Line 
1'use strict';
2
3var TYPES = require('../parsers').TYPES;
4var valueType = require('../parsers').valueType;
5var shorthandParser = require('../parsers').shorthandParser;
6var shorthandSetter = require('../parsers').shorthandSetter;
7var shorthandGetter = require('../parsers').shorthandGetter;
8
9var shorthand_for = {
10 'font-family': require('./fontFamily'),
11 'font-size': require('./fontSize'),
12 'font-style': require('./fontStyle'),
13 'font-variant': require('./fontVariant'),
14 'font-weight': require('./fontWeight'),
15 'line-height': require('./lineHeight'),
16};
17
18var static_fonts = [
19 'caption',
20 'icon',
21 'menu',
22 'message-box',
23 'small-caption',
24 'status-bar',
25 'inherit',
26];
27
28var setter = shorthandSetter('font', shorthand_for);
29
30module.exports.definition = {
31 set: function(v) {
32 var short = shorthandParser(v, shorthand_for);
33 if (short !== undefined) {
34 return setter.call(this, v);
35 }
36 if (valueType(v) === TYPES.KEYWORD && static_fonts.indexOf(v.toLowerCase()) !== -1) {
37 this._setProperty('font', v);
38 }
39 },
40 get: shorthandGetter('font', shorthand_for),
41 enumerable: true,
42 configurable: true,
43};
Note: See TracBrowser for help on using the repository browser.