2 module
.exports
= makeColumn
;
3 function makeColumn(font
, tengwa
, tengwaNote
) {
4 return new Column(font
, tengwa
, tengwaNote
);
7 var Column
= function (font
, tengwa
, tengwaNote
) {
10 this.tildeAbove
= void 0;
12 this.tildeBelow
= void 0;
14 this.following
= void 0;
17 this.aboveNote
= void 0;
18 this.tildeAboveNote
= void 0;
19 this.tengwaNote
= tengwaNote
;
20 this.tildeBelowNote
= void 0;
21 this.belowNote
= void 0;
22 this.followingNote
= void 0;
24 this.hasVariant
= false;
27 Column
.prototype.canAddAbove
= function (tehta
, reversed
) {
29 !this.above
&& !!this.font
.tehtaForTengwa(this.tengwa
, tehta
)
31 !reversed
&& !this.below
&& this.reversed().canAddAbove(tehta
, true)
35 Column
.prototype.addAbove
= function (above
, aboveNote
) {
36 if (!this.font
.tehtaForTengwa(this.tengwa
, above
)) {
40 this.aboveNote
= aboveNote
;
44 Column
.prototype.canAddBelow
= function (tehta
, reversed
) {
46 !this.below
&& !!this.font
.tehtaForTengwa(this.tengwa
, tehta
)
48 !reversed
&& !this.above
&& this.reversed().canAddBelow(tehta
, true)
52 Column
.prototype.addBelow
= function (below
, belowNote
) {
53 if (!this.font
.tehtaForTengwa(this.tengwa
, below
)) {
57 this.belowNote
= belowNote
;
61 Column
.prototype.addTildeAbove
= function (tildeAboveNote
) {
62 this.tildeAbove
= true;
63 this.tildeAboveNote
= tildeAboveNote
;
67 Column
.prototype.addTildeBelow
= function (tildeBelowNote
) {
68 this.tildeBelow
= true;
69 this.tildeBelowNote
= tildeBelowNote
;
73 Column
.prototype.canAddFollowing
= function (following
) {
74 return !this.following
&& !!this.font
.tehtaForTengwa(this.tengwa
, following
);
77 Column
.prototype.addFollowing
= function (following
, followingNote
) {
78 this.following
= following
;
79 this.followingNote
= followingNote
;
83 Column
.prototype.reversed
= function () {
84 return this.clone().reverse();
87 Column
.prototype.clone
= function () {
88 var column
= new Column(this.font
, this.tengwa
);
89 if (this.above
) column
.addAbove(this.above
, this.aboveNote
);
90 if (this.below
) column
.addBelow(this.below
, this.belowNote
);
91 if (this.following
) column
.addFollowing(this.following
, this.followingNote
);
92 if (this.tildeBelow
) column
.addTildeBelow(this.tildeBelowNote
);
93 if (this.tildeAbove
) column
.addTildeAbove(this.tildeAboveNote
);
98 "silme": "silme-nuquerna",
99 "esse": "esse-nuquerna",
100 "silme-nuquerna": "silme",
101 "esse-nuquerna": "esse"
104 Column
.prototype.reverse
= function () {
105 this.tengwa
= reversed
[this.tengwa
] || this.tengwa
;
109 Column
.prototype.addError
= function (error
) {
110 this.errors
= this.errors
|| [];
111 this.errors
.push(error
);
115 Column
.prototype.varies
= function () {
116 this.hasVariant
= true;