aboutsummaryrefslogtreecommitdiff
path: root/exampleData/ruleSets/fontRules.json
blob: 297d24285f50d7461b892cf8d5439fd5a9328038 (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
35
/*
 * 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': [
  //---------------------------------------------------------
  { 'id': 5141301
  , '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);
        }
      });
  }
  }//,
  //---------------------------------------------------------
]
}