From 3aa961808297f80b4a3000c76633814a1b550ef7 Mon Sep 17 00:00:00 2001 From: Christoph Diehl Date: Wed, 12 Apr 2017 21:43:30 +0300 Subject: [PATCH] Add fonts.js --- make/fonts.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 make/fonts.js diff --git a/make/fonts.js b/make/fonts.js new file mode 100644 index 0000000..06e00ac --- /dev/null +++ b/make/fonts.js @@ -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 + "'"; + }; +}