Expand some functions and wrap everything in random.pick
This commit is contained in:
parent
0983242806
commit
6dfe1ffca9
1 changed files with 37 additions and 14 deletions
|
@ -3,48 +3,71 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
make.font = {
|
||||
globalValue: function() {
|
||||
return random.pick(["inherit", "initial", "unset"]);
|
||||
},
|
||||
style: function () {
|
||||
return ["italic", "normal", "oblique", "inherit"];
|
||||
return random.pick(["italic", "normal", "oblique", "inherit", make.font.globalValue()]);
|
||||
},
|
||||
variant: function () {
|
||||
return ["normal", "small-caps", "inherit"];
|
||||
return random.pick(["normal", "small-caps", "inherit", make.font.globalValue()]);
|
||||
},
|
||||
weight: function () {
|
||||
return ["normal", "bold", "bolder", "lighter"];
|
||||
return random.pick([
|
||||
/* standard */
|
||||
["normal", "bold"],
|
||||
/* Relative to the parent */
|
||||
["bolder", "lighter"],
|
||||
/* numeric values */
|
||||
[100, 200, 300, 400, 500, 600, 700, 800, 900],
|
||||
/* Global values */
|
||||
make.font.globalValue()
|
||||
]);
|
||||
},
|
||||
size: function () {
|
||||
return ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
|
||||
return random.pick([
|
||||
/* <absolute-size> values */
|
||||
["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"],
|
||||
/* <relative-size> values */
|
||||
["larger", "smaller"],
|
||||
/* <length> values */
|
||||
make.numbers.unsignedNumber() + make.units.lengthUnit(),
|
||||
/* <percentage> values */
|
||||
make.units.percent(),
|
||||
/* Global values */
|
||||
make.font.globalValue()
|
||||
]);
|
||||
},
|
||||
genericFamily: function () {
|
||||
return ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
|
||||
return random.pick(["serif", "sans-serif", "cursive", "fantasy", "monospace"]);
|
||||
},
|
||||
fammilyName: function () {
|
||||
return ["Times New Roman", "Arial", "Courier", "Helvetica"];
|
||||
familyName: function () {
|
||||
return random.pick(["Times New Roman", "Arial", "Courier", "Helvetica"]);
|
||||
},
|
||||
family: function () {
|
||||
let s = random.pick(make.fonts.fontFamilies);
|
||||
let s = random.pick(make.font.familyName);
|
||||
if (random.chance(8)) {
|
||||
s += ", " + random.pick(make.fonts.fontFamiliesGeneric);
|
||||
s += ", " + random.pick(make.font.genericFamily);
|
||||
}
|
||||
return s;
|
||||
},
|
||||
font: function () {
|
||||
let s = "";
|
||||
if (random.chance(4)) {
|
||||
s += random.pick(make.fonts.style) + " ";
|
||||
s += random.pick(make.font.style) + " ";
|
||||
}
|
||||
if (random.chance(4)) {
|
||||
s += random.pick(make.fonts.variant) + " ";
|
||||
s += random.pick(make.font.variant) + " ";
|
||||
}
|
||||
if (random.chance(4)) {
|
||||
s += random.pick(make.fonts.weight) + " ";
|
||||
s += random.pick(make.font.weight) + " ";
|
||||
}
|
||||
if (random.chance(4)) {
|
||||
s += make.numbers.number() + "/";
|
||||
}
|
||||
s += make.fonts.size();
|
||||
s += make.font.size();
|
||||
s += " ";
|
||||
s += make.fonts.family();
|
||||
s += make.font.family();
|
||||
return "'" + s + "'";
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue