aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/fontRules.json
blob: 819604f6ca8b2d5fa54ad4b83f5323bdb58075fe (plain)
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
/*
 * fontRules.json
 *
 * Simple rules for checking that fonts (family/weight/size) of specific elements are
 * in a specific set.
 *
 */

{ 'name': "Fonts"
, 'description': "Guidelines regarding site fonts"
, 'rules': [
  //---------------------------------------------------------
  { 'name': "Font properties check"
  , 'description': "Verify that fonts (family, size, weight) are \"standard\""
  , 'rule':
  function() {
    var allow = {
      "Verdana": { "bold": [25, 22, 12, 10]
                 , "normal": [12, 11, 10] }};
    fiveui.query('body p,:header').each(
      function(i, elt) {
        var font = fiveui.font.getFont($(elt));
        if (!fiveui.font.validate(allow, font)) {
          report('non-standard font: ' +
                 font.family + ", " +
                 font.size + ", " +
                 font.weight, elt);
        }
      });
  }
  }//,
  //---------------------------------------------------------
]
}