From: Mischa POSLAWSKY Date: Mon, 10 Apr 2017 17:49:03 +0000 (+0200) Subject: latin: support repeat glyph substitution in sample X-Git-Tag: v1.10~180 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/da9b71275d04f35c77a48e3bbaee356c04fd24b2 latin: support repeat glyph substitution in sample Optional 28th glyph to be shown instead of a doubled letter in sample texts. --- diff --git a/latinsample.js b/latinsample.js index cff51e3..b576f95 100644 --- a/latinsample.js +++ b/latinsample.js @@ -29,8 +29,12 @@ function appendsample() { for (var i = 0; i < input.length; i++) { var col = input.charCodeAt(i) - 64; if (col < 1) col = 27; // space + else if (cols[28] && i && col == input.charCodeAt(i - 1) - 64) { + col = 28; // repetition char + } + if (col < cols.length) { - output += '' + cols[col].innerHTML.trimRight() + ''; + output += '' + (cols[col].innerHTML.trimRight() || ' ') + ''; } else { output += ' ';