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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
make.font = {
|
make.font = {
|
||||||
|
globalValue: function() {
|
||||||
|
return random.pick(["inherit", "initial", "unset"]);
|
||||||
|
},
|
||||||
style: function () {
|
style: function () {
|
||||||
return ["italic", "normal", "oblique", "inherit"];
|
return random.pick(["italic", "normal", "oblique", "inherit", make.font.globalValue()]);
|
||||||
},
|
},
|
||||||
variant: function () {
|
variant: function () {
|
||||||
return ["normal", "small-caps", "inherit"];
|
return random.pick(["normal", "small-caps", "inherit", make.font.globalValue()]);
|
||||||
},
|
},
|
||||||
weight: function () {
|
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 () {
|
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 () {
|
genericFamily: function () {
|
||||||
return ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
|
return random.pick(["serif", "sans-serif", "cursive", "fantasy", "monospace"]);
|
||||||
},
|
},
|
||||||
fammilyName: function () {
|
familyName: function () {
|
||||||
return ["Times New Roman", "Arial", "Courier", "Helvetica"];
|
return random.pick(["Times New Roman", "Arial", "Courier", "Helvetica"]);
|
||||||
},
|
},
|
||||||
family: function () {
|
family: function () {
|
||||||
let s = random.pick(make.fonts.fontFamilies);
|
let s = random.pick(make.font.familyName);
|
||||||
if (random.chance(8)) {
|
if (random.chance(8)) {
|
||||||
s += ", " + random.pick(make.fonts.fontFamiliesGeneric);
|
s += ", " + random.pick(make.font.genericFamily);
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
},
|
},
|
||||||
font: function () {
|
font: function () {
|
||||||
let s = "";
|
let s = "";
|
||||||
if (random.chance(4)) {
|
if (random.chance(4)) {
|
||||||
s += random.pick(make.fonts.style) + " ";
|
s += random.pick(make.font.style) + " ";
|
||||||
}
|
}
|
||||||
if (random.chance(4)) {
|
if (random.chance(4)) {
|
||||||
s += random.pick(make.fonts.variant) + " ";
|
s += random.pick(make.font.variant) + " ";
|
||||||
}
|
}
|
||||||
if (random.chance(4)) {
|
if (random.chance(4)) {
|
||||||
s += random.pick(make.fonts.weight) + " ";
|
s += random.pick(make.font.weight) + " ";
|
||||||
}
|
}
|
||||||
if (random.chance(4)) {
|
if (random.chance(4)) {
|
||||||
s += make.numbers.number() + "/";
|
s += make.numbers.number() + "/";
|
||||||
}
|
}
|
||||||
s += make.fonts.size();
|
s += make.font.size();
|
||||||
s += " ";
|
s += " ";
|
||||||
s += make.fonts.family();
|
s += make.font.family();
|
||||||
return "'" + s + "'";
|
return "'" + s + "'";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue