Skip to content

Sherman's Circular Gallifreyan

erroronline1 edited this page Oct 9, 2020 · 2 revisions

setup.js

Defines basic variables

  • const consonant = 30; // radius of consonants
  • const vowel = Math.floor(consonant / 2); // radius of vowels

shermansGlyphs.js

Contains the construction dictionaries

Sherman's follows a quite easy pattern consisting of big and small circles, arcs, dots and lines all arranged in a clear fashion following plain rules. Like in the original guidance table consonants are grouped to their respective base (b,j,t,th), also vowels with base e (for e,i,u), a and o, punctuation and numbers. On stacking characters every base has its own center and positioning of elements to its arc, relative to the base center, therefore every base has its specific properties and methods to return the specific relative placements. To determine the characters base the shermansBase-Object has a method to return the correct base.

export class shermansBase {
	constructor(consonant, vowel) {
		this.consonant = consonant;
		this.vowel = vowel;
		this.scgtable = {
			/* example: { // name of group
				contains: [...], // array of characters for which the handling and properties apply
				centerYoffset: NUMBER, // relative offset to the y-position of the word line/circle
				radialPlacement: function (radiant=DEFAULTVALUE){ // position of items to be placed relative to the center of the base
					let options = {
						ve: {x: 0, y: 0}, // e.g. placing of e-vowel on the center of the base
						va: {x: 0, y: -this.centerYoffset}, // e.g. placing of the a-vowel still outside of the word-circle
						vo: { // e.g. placing of the o-vowel or everything else on the base-circle/-arc
							x: consonant * Math.cos(radiant),
							y: -consonant * Math.sin(radiant)
						}
					}
					if (!(item in options)) item = "vo"; // same rules for o, diacritics, line-decorators
					return options[item]; // returns x- and y-properties
				},
				draw: function (x, y, r, rad=0, group) { // drawing instructions based on center of character
					SVGRenderingContext-draw instructions...
				}
			}*/
		}
	}
	getBase(char) { // return name of base the given character is assigned to
		let rtrn = false;
		Object.keys(this.scgtable).forEach(row => {
			if (includes(this.scgtable[row].contains, char)) rtrn = row;
		});
		return rtrn;
	}
}

The decorator object shermansDeco has a comparable pattern, whereas the table consists of relative radiant and radius positions of decorators, and a draw-method exists on its own to handle partial repetitive instruction. The getDeco-method returns an array of decorators (e.g. diacritics and u-line for ü). Decorators can be sets of multiple radiants to be processed and given relative positions or ranges of relative diameters of the parent character circle/arc.

render.js

The input is processed, canvas size set and characters stacked before iterating through the result and applying the drawing instructions

Recurring Variables Within Global Scope

  • cLetter: false by default, true if detected. if true a warning is displayed and drawings are red.
  • qLetter: false by default, true if detected. if true a warning is displayed and drawings are red.
  • width: width of the output canvas
  • height: height of the output canvas
  • x: current x coordinate for drawing, representing the left starting coordinate
  • y: current y coordinate for drawing, representing the words baseline
  • glyph: glyphs dimension object
  • option: object to shortify user selected options

Translation

render(input) is the main wrapper for the algorithm and is passed the actual input. It retrieves the users settings for the translation, sets up the initial coordinates for the words baseline, sets up an array of characters and sets the canvas size according to the number of (grouped) characters or the size of word circles.

Then the array of characters is processed for each word and each group of characters. Grouping of characters makes resizing of the base necessary. The index for the last consonant of the group is determined and used as a resizing factor. In case of numbers a bigger line thickness indicates the end of the number or the decimal point so it has to be checked if it applies to the current character. The positioning offsets for drawing of the current character in relation to the former is set and the character is drawn.

Sherman's takes the phonetical k or s instead of c. C and single q are "allowed" in names only so there is a reminder thrown if these characters are detected.

Replacements

replacements(word) returns the full word after converting c to k or s depending on position, following vowel, or reduced ck, if selected. ß is always replaced with ss.

Grouping (SCG)

shermansGrouped.groups(input) returns a multidimensional array of grouped characters. It initiates the sentence array and loops through the whitespace-splitted input. The word group is initiated and the word optionally converted in regards of c-handling. The following loop iterates over each character of the word, sets the current character, occasionally overrides single characters to double ones (like th, gh, ng, etc.) and corrects the index in this case.

If grouping is active the current characters is added to the former group if

  • there is a former group and
  • it's a vowel and the former isn't a vowel or number, or the same vowel or
  • it's a consonant with the same base as the former character or
  • it's a number and the former one is too a decimal- or a minus-sign

Otherwise the current character is added to the recent group.

If the current word is a number there are control characters added to the end of the word that will add the last thick circle or the minus sign for negative numbers. control characters will not show up on the top translations but may be drawn out of context. The official guide has no recommendations for / and \ . Shown drawings of these characters in a single position do not represent these.

The group is then pushed to the last word.

shermansGrouped.resetOffset(lastStackedConsonantIndex) resets all positioning offsets and resizing factors. The lastStackedConsonantIndex sets the initial resizing factor for the first drawn consonant. Stacked consonants are bigger and will shrink down to default size.

shermansGrouped.setOffset(former, actual) sets the resizing, linewidth and positioning offsets fetching the respective values for offsets from the methods and properties of the parent base.

It also sets the carriage return to true to have the characters drawn at the same x-position on the canvas.

Character Drawing

shermansDraw(ctx, letter, grouped, thicknumberline) actually draws a character to the canvas. X and y coordiantes are set. If not grouped the x-"pointer" is set to the next characters / word-circle position, if the end of the viewport is reached the next line is set. Word-circle size and rotation steps, vowel-offsets and relative centers of the characters are set or calculated.

The base line / word line and sentence line in case of puntuation ist drawn first. Then the base is drawn by calling the respective draw method for the pased characters base. Same goes for the decorators. ...unless isNumber is set. Then the current "," is supposed to be the decimal sign that is of course not to be displayed as an actual "," but a thick line within the number-group.

Finally aligned with the letter/group the respective latin characters are drawn (again with exceptional control character handling).