2017-04-22 22:49:49 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2017-04-25 14:12:48 +00:00
|
|
|
make.font = {
|
2017-04-25 22:21:31 +00:00
|
|
|
globalValue: function () {
|
|
|
|
return random.pick(['inherit', 'initial', 'unset'])
|
2017-04-25 15:00:01 +00:00
|
|
|
},
|
2017-04-25 14:12:48 +00:00
|
|
|
style: function () {
|
2017-04-25 22:21:31 +00:00
|
|
|
return random.pick(['italic', 'normal', 'oblique', 'inherit'])
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
2017-04-25 14:12:48 +00:00
|
|
|
variant: function () {
|
2017-04-25 22:21:31 +00:00
|
|
|
return random.pick(['normal', 'small-caps', 'inherit'])
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
2017-04-25 14:12:48 +00:00
|
|
|
weight: function () {
|
2017-04-25 15:00:01 +00:00
|
|
|
return random.pick([
|
|
|
|
/* standard */
|
2017-04-25 22:21:31 +00:00
|
|
|
['normal', 'bold'],
|
2017-04-25 15:00:01 +00:00
|
|
|
/* Relative to the parent */
|
2017-04-25 22:21:31 +00:00
|
|
|
['bolder', 'lighter'],
|
2017-04-25 15:00:01 +00:00
|
|
|
/* numeric values */
|
2017-04-25 22:21:31 +00:00
|
|
|
[100, 200, 300, 400, 500, 600, 700, 800, 900]
|
|
|
|
])
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
2017-04-25 14:12:48 +00:00
|
|
|
size: function () {
|
2017-04-25 15:00:01 +00:00
|
|
|
return random.pick([
|
|
|
|
/* <absolute-size> values */
|
2017-04-25 22:21:31 +00:00
|
|
|
['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'],
|
2017-04-25 15:00:01 +00:00
|
|
|
/* <relative-size> values */
|
2017-04-25 22:21:31 +00:00
|
|
|
['larger', 'smaller'],
|
2017-04-25 15:00:01 +00:00
|
|
|
/* <length> values */
|
2017-04-25 15:24:56 +00:00
|
|
|
make.number.unsignedNumber() + make.unit.unit(),
|
2017-04-25 15:00:01 +00:00
|
|
|
/* <percentage> values */
|
2017-04-25 22:21:31 +00:00
|
|
|
make.unit.percent()
|
|
|
|
])
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
2017-04-25 14:12:48 +00:00
|
|
|
genericFamily: function () {
|
2017-04-25 22:21:31 +00:00
|
|
|
return random.pick(['serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'])
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
2017-04-25 15:00:01 +00:00
|
|
|
familyName: function () {
|
2017-04-25 22:21:31 +00:00
|
|
|
return random.pick(['Times New Roman', 'Arial', 'Courier', 'Helvetica'])
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
2017-04-25 14:12:48 +00:00
|
|
|
family: function () {
|
2017-04-25 22:21:31 +00:00
|
|
|
let s = random.pick(make.font.familyName)
|
2017-04-22 22:49:49 +00:00
|
|
|
if (random.chance(8)) {
|
2017-04-25 22:21:31 +00:00
|
|
|
s += ', ' + random.pick(make.font.genericFamily)
|
2017-04-22 22:49:49 +00:00
|
|
|
}
|
2017-04-25 22:21:31 +00:00
|
|
|
return s
|
2017-04-22 22:49:49 +00:00
|
|
|
},
|
|
|
|
font: function () {
|
2017-04-25 22:21:31 +00:00
|
|
|
let s = ''
|
2017-04-22 22:49:49 +00:00
|
|
|
if (random.chance(4)) {
|
2017-04-25 22:21:31 +00:00
|
|
|
s += random.pick(make.font.style) + ' '
|
2017-04-22 22:49:49 +00:00
|
|
|
}
|
|
|
|
if (random.chance(4)) {
|
2017-04-25 22:21:31 +00:00
|
|
|
s += random.pick(make.font.variant) + ' '
|
2017-04-22 22:49:49 +00:00
|
|
|
}
|
|
|
|
if (random.chance(4)) {
|
2017-04-25 22:21:31 +00:00
|
|
|
s += random.pick(make.font.weight) + ' '
|
2017-04-22 22:49:49 +00:00
|
|
|
}
|
|
|
|
if (random.chance(4)) {
|
2017-04-25 22:21:31 +00:00
|
|
|
s += make.number.any() + '/'
|
2017-04-22 22:49:49 +00:00
|
|
|
}
|
2017-04-25 22:21:31 +00:00
|
|
|
s += make.font.size()
|
|
|
|
s += ' '
|
|
|
|
s += make.font.family()
|
|
|
|
return '\'' + s + '\''
|
2017-04-22 22:49:49 +00:00
|
|
|
}
|
2017-04-25 22:21:31 +00:00
|
|
|
}
|