Support for the FreeMonoTengwar font and ConScript encoding master
authorCameron Ball <cameron@moodle.com>
Mon, 12 Sep 2016 16:47:13 +0000 (00:47 +0800)
committerCameron Ball <cameron@moodle.com>
Mon, 12 Sep 2016 17:04:10 +0000 (01:04 +0800)
FreeMonoTengwar.ttf [new file with mode: 0644]
conscript.js [new file with mode: 0644]
fonts.js
freemonotengwar.css [new file with mode: 0644]
freemonotengwar.js [new file with mode: 0644]

diff --git a/FreeMonoTengwar.ttf b/FreeMonoTengwar.ttf
new file mode 100644 (file)
index 0000000..dc9889a
Binary files /dev/null and b/FreeMonoTengwar.ttf differ
diff --git a/conscript.js b/conscript.js
new file mode 100644 (file)
index 0000000..c3e0d08
--- /dev/null
@@ -0,0 +1,132 @@
+
+exports.tengwar = {
+    // 1
+    "tinco": "", // t
+    "parma": "", // p
+    "calma": "", // c
+    "quesse": "", // qu
+    // 2
+    "ando" : "", // nd
+    "umbar": "", // mb
+    "anga" : "", // ng
+    "ungwe": "", // ngw
+    // 3
+    "thule" : "", // th
+    "formen": "", // ph / f
+    "harma" : "", // h / ch
+    "hwesta": "", // hw / chw
+    // 4
+    "anto" : "", // nt
+    "ampa" : "", // mp
+    "anca" : "", // nc
+    "unque": "", // nqu
+    // 5
+    "numen" : "", // n
+    "malta" : "", // m
+    "noldo" : "", // ng
+    "nwalme": "", // ngw / nw
+    // 6
+    "ore"  : "", // r
+    "vala" : "", // v
+    "anna" : "", // -
+    "wilya": "", // w / v
+    // 7
+    "romen": "", // medial r
+    "arda" : "", // rd / rh
+    "lambe": "", // l
+    "alda" : "", // ld / lh
+    // 8
+    "silme":          "", // s
+    "silme-nuquerna": "", // s
+    "esse":           "", // z
+    "esse-nuquerna":  "", // z
+    // 9
+    "hyarmen":           "", // hyarmen
+    "hwesta-sindarinwa": "", // hwesta sindarinwa
+    "yanta":             "", // yanta
+    "ure":               "", // ure
+    // 10
+    "halla": "", // halla
+    "short-carrier": "",
+    "long-carrier": "",
+    "round-carrier": "]",
+    // I
+    "tinco-extended": "",
+    "parma-extended": "",
+    "calma-extended": "",
+    "quesse-extended": "",
+    "ando-extended": "",
+    "umbar-extended": "",
+    "anga-extended": "",
+    "ungwe-extended": "",
+    // punctuation
+    "comma": "",
+    "full-stop": "",
+    "exclamation-point": "",
+    "question-mark": "",
+    "open-paren": "", // alt "&#140;",
+    "close-paren": "", // alt "&#156;",
+    "flourish-left": "",
+    "flourish-right": "",
+    // numbers
+    "0":  "",
+    "1":  "",
+    "2":  "",
+    "3":  "",
+    "4":  "",
+    "5":  "",
+    "6":  "",
+    "7":  "",
+    "8":  "",
+    "9":  "",
+    "10": "",
+    "11": ""
+};
+
+exports.tehtar = {
+    "a": "",
+    "e": "",
+    "i": "",
+    "o": "",
+    "u": "",
+    "í": "",
+    "w": "", // TODO custom hooks for tengwar parmaite from the alternate font
+    "y": "",
+    "o-below": "",
+    "i-below": "",
+    "s": {
+        "special": true,
+        "calma": "",
+        "quesse": "",
+        "short-carrier": ""
+    },
+    "s-final": {
+        "special": true,
+        "tinco": "",
+        "ando": "",
+        "numen": "",
+        "lambe": ""
+    },
+    "s-inverse": {
+        "special": true,
+        "tinco": ""
+    },
+    "s-extended": {
+        "special": true,
+        "tinco": ""
+    },
+    "s-flourish": {
+        "special": true,
+        "tinco": "",
+        "lambe": ""
+    },
+    "tilde-above": "",
+    "tilde-below": "",
+    "tilde-high-above": "",
+    "tilde-far-below": "",
+    "bar-above": "",
+    "bar-below": "",
+    "bar-high-above": "",
+    "bar-far-below": ""
+};
+
index 265e1f5..a5b9c10 100644 (file)
--- a/fonts.js
+++ b/fonts.js
@@ -1,4 +1,5 @@
 module.exports = {
     "parmaite": require("./tengwar-parmaite"),
-    "annatar": require("./tengwar-annatar")
+    "annatar": require("./tengwar-annatar"),
+    "freemono": require("./freemonotengwar")
 };
diff --git a/freemonotengwar.css b/freemonotengwar.css
new file mode 100644 (file)
index 0000000..122e7a6
--- /dev/null
@@ -0,0 +1,13 @@
+
+@font-face {
+    font-family: FreeMonoTengwar;
+    src: url('freemonotengwar.ttf') format('truetype'),
+    font-weight: normal;
+    font-style: normal;
+}
+
+.tengwar.freemono.rendered {
+    font-family: FreeMonoTengwar;
+    size: 16px;
+}
+
diff --git a/freemonotengwar.js b/freemonotengwar.js
new file mode 100644 (file)
index 0000000..5484d0e
--- /dev/null
@@ -0,0 +1,145 @@
+
+var Alphabet = require("./alphabet");
+var Bindings = require("./conscript.js");
+var makeFontColumn = require("./column");
+
+var tengwar = exports.tengwar = Bindings.tengwar;
+var tehtar = exports.tehtar = Bindings.tehtar;
+window.console.log('hello');
+var positions = exports.positions = {
+
+    "tinco": 0,
+    "parma": 0,
+    "calma": 0,
+    "quesse": 0,
+
+    "ando": 0,
+    "umbar": 0,
+    "anga": 0,
+    "ungwe": 0,
+
+    "thule": 0,
+    "formen": 0,
+    "harma": 0,
+    "hwesta": 0,
+
+    "anto": 0,
+    "ampa": 0,
+    "anca": 0,
+    "unque": 0,
+
+    "numen": 0,
+    "malta": 0,
+    "noldo": 0,
+    "nwalme": 0,
+
+    "ore": 0,
+    "vala": 0,
+    "anna": 0,
+    "wilya": 0,
+
+    "romen": 0,
+    "arda": 0,
+    "lambe": 0,
+    "alda": 0,
+
+    "silme": {
+        "y": 0,
+        "o-below": 0,
+        "i-below": 0,
+        "others": null
+    },
+    "silme-nuquerna": {
+        "e": 0,
+        "o": 0,
+        "u": 0,
+        "y": null,
+        "o-below": null,
+        "i-below": null,
+        "others": 0
+    },
+    "esse": 0,
+    "esse-nuquerna": 0,
+
+    "hyarmen": 0,
+    "hwesta-sindarinwa": 0,
+    "yanta": 0,
+    "ure": 0,
+
+    // should not occur:
+    "halla": 0,
+    "short-carrier": 0,
+    "long-carrier": 0,
+    "round-carrier": 0,
+
+    "tinco-extended": 0,
+    "parma-extended": 0,
+    "calma-extended": 0,
+    "quesse-extended": 0,
+    "ando-extended": 0,
+    "umbar-extended": 0,
+    "anga-extended": 0,
+    "ungwe-extended": 0
+};
+
+exports.transcribe = transcribe;
+function transcribe(sections, options) {
+    options = options || {};
+    var block = options.block || false;
+    var beginParagraph = block ? "<p>" : "";
+    var delimitParagraph = "<br>";
+    var endParagraph = block ? "</p>" : "";
+    return sections.map(function (section) {
+        return section.map(function (paragraph) {
+            return beginParagraph + paragraph.map(function (line) {
+                return line.map(function (word) {
+                    return word.map(function (column) {
+                        return transcribeColumn(column, options);
+                    }).join("");
+                }).join(" ");;
+            }).join(delimitParagraph + "\n") + endParagraph;
+        }).join("\n\n");
+    }).join("\n\n\n");
+}
+
+exports.transcribeColumn = transcribeColumn;
+function transcribeColumn(column, options) {
+    options = options || {};
+    var plain = options.plain || false;
+    var tengwa = column.tengwa || "anna";
+    var tehtar = [];
+    if (column.above) tehtar.push(column.above);
+    if (column.below) tehtar.push(column.below);
+    if (column.tildeBelow) tehtar.push("tilde-below");
+    if (column.tildeAbove) tehtar.push("tilde-above");
+    if (column.following) tehtar.push(column.following);
+    var html = tengwar[tengwa] + tehtar.map(function (tehta) {
+        return tehtaForTengwa(tengwa, tehta);
+    }).join("");
+    if (column.errors && !plain) {
+        html = "<abbr class=\"error\" title=\"" + column.errors.join("\n").replace(/"/g, "&quot;") + "\">" + html + "</abbr>";
+    }
+    return html;
+}
+
+exports.tehtaForTengwa = tehtaForTengwa;
+function tehtaForTengwa(tengwa, tehta) {
+    var tehtaKey = tehtaKeyForTengwa(tengwa, tehta);
+    if (tehtaKey == null)
+        return null;
+    return (
+        tehtar[tehta][tengwa] ||
+        tehtar[tehta][tehtaKey] ||
+        ""
+    );
+}
+
+function tehtaKeyForTengwa(tengwa, tehta) {
+    return 0;
+}
+
+exports.makeColumn = makeColumn;
+function makeColumn(tengwa, tengwarFrom) {
+    return makeFontColumn(exports, tengwa, tengwarFrom);
+}
+