Add fonts.js

This commit is contained in:
Christoph Diehl 2017-04-12 21:43:30 +03:00
parent 146009da0e
commit 3aa9618082
1 changed files with 49 additions and 0 deletions

49
make/fonts.js Normal file
View File

@ -0,0 +1,49 @@
make.fonts = {
fontStyles: function() {
return ["italic", "normal", "oblique", "inherit"];
},
fontVariants: function() {
return ["normal", "small-caps", "inherit"];
},
fontWeights: function() {
return ["normal", "bold", "bolder", "lighter"];
},
fontSizeAbsolute: function() {
return ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
},
fontFamiliesGeneric: function() {
return ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
},
fontFamilies: function() {
return ['"' + "Times New Roman" + '"', "Arial", "Courier", "Helvetica"];
},
fontFamily: function () {
let s = random.pick(make.fontFamilies);
if (random.chance(8)) {
s += ", " + random.pick(make.fontFamiliesGeneric);
}
return s;
},
fontSize: function () {
return make.unsignedNumber() + make.lengthUnit();
},
font: function () {
let s = "";
if (random.chance(4)) {
s += random.pick(make.fontStyles) + " ";
}
if (random.chance(4)) {
s += random.pick(make.fontVariants) + " ";
}
if (random.chance(4)) {
s += random.pick(make.fontWeights) + " ";
}
if (random.chance(4)) {
s += make.number() + "/";
}
s += make.fontSize();
s += " ";
s += Make.fontFamily();
return "'" + s + "'";
};
}