Fix story page scrolling and ellipsis spacing
This commit is contained in:
@@ -8,7 +8,7 @@ function kap(text, measureText, measure, hyphenation) {
|
||||
let spaceWidth = measureText('\u00A0');
|
||||
let nodes = [];
|
||||
|
||||
text.split(/([.,:;!?] |\s|\||<.*?>)/u).forEach(function (fragment) {
|
||||
text.split(/([.,:;!?…] |\s|\||<.*?>)/u).forEach(function (fragment) {
|
||||
let fragmentWidth = measureText(fragment);
|
||||
|
||||
if (fragment === ' ') {
|
||||
@@ -21,8 +21,8 @@ function kap(text, measureText, measure, hyphenation) {
|
||||
nodes.push(linebreak.penalty(hyphenWidth * 0.25, 100, 1));
|
||||
} else if (fragment.match(/(<.*?>)/u)) {
|
||||
nodes.push(linebreak.tag(fragmentWidth, fragment));
|
||||
} else if (fragment.match(/[.,:;!?] /u)) {
|
||||
let punctuation = fragment.match(/([.,:;!?])( )/u);
|
||||
} else if (fragment.match(/[.,:;!?…] /u)) {
|
||||
let punctuation = fragment.match(/([.,:;!?…])( )/u);
|
||||
let punctuationSymbolWidth = measureText(punctuation[1]) * 0.25;
|
||||
let punctuationWidth = measureText(punctuation[1]) * 0.75 + spaceWidth;
|
||||
nodes.push(linebreak.box(punctuationSymbolWidth, punctuation[1]));
|
||||
|
||||
Reference in New Issue
Block a user