Merge pull request #13 from pyoor/master

Refactored font class names
This commit is contained in:
pyoor 2017-04-25 10:13:26 -04:00 committed by GitHub
commit 99e4b89738

View file

@ -2,52 +2,49 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
make.fonts = { make.font = {
fontStyles: function () { style: function () {
return ["italic", "normal", "oblique", "inherit"]; return ["italic", "normal", "oblique", "inherit"];
}, },
fontVariants: function () { variant: function () {
return ["normal", "small-caps", "inherit"]; return ["normal", "small-caps", "inherit"];
}, },
fontWeights: function () { weight: function () {
return ["normal", "bold", "bolder", "lighter"]; return ["normal", "bold", "bolder", "lighter"];
}, },
fontSizeAbsolute: function () { size: function () {
return ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"]; return ["xx-small", "x-small", "small", "medium", "large", "x-large", "xx-large"];
}, },
fontFamiliesGeneric: function () { genericFamily: function () {
return ["serif", "sans-serif", "cursive", "fantasy", "monospace"]; return ["serif", "sans-serif", "cursive", "fantasy", "monospace"];
}, },
fontFamilies: function () { fammilyName: function () {
return ["'Times New Roman'", "Arial", "Courier", "Helvetica"]; return ["Times New Roman", "Arial", "Courier", "Helvetica"];
}, },
fontFamily: function () { family: function () {
let s = random.pick(make.fonts.fontFamilies); let s = random.pick(make.fonts.fontFamilies);
if (random.chance(8)) { if (random.chance(8)) {
s += ", " + random.pick(make.fonts.fontFamiliesGeneric); s += ", " + random.pick(make.fonts.fontFamiliesGeneric);
} }
return s; return s;
}, },
fontSize: function () {
return make.numbers.unsignedNumber() + make.fonts.lengthUnit();
},
font: function () { font: function () {
let s = ""; let s = "";
if (random.chance(4)) { if (random.chance(4)) {
s += random.pick(make.fonts.fontStyles) + " "; s += random.pick(make.fonts.style) + " ";
} }
if (random.chance(4)) { if (random.chance(4)) {
s += random.pick(make.fonts.fontVariants) + " "; s += random.pick(make.fonts.variant) + " ";
} }
if (random.chance(4)) { if (random.chance(4)) {
s += random.pick(make.fonts.fontWeights) + " "; s += random.pick(make.fonts.weight) + " ";
} }
if (random.chance(4)) { if (random.chance(4)) {
s += make.numbers.number() + "/"; s += make.numbers.number() + "/";
} }
s += make.fonts.fontSize(); s += make.fonts.size();
s += " "; s += " ";
s += make.fonts.fontFamily(); s += make.fonts.family();
return "'" + s + "'"; return "'" + s + "'";
} }
}; };