resolving potential infinite loop

This commit is contained in:
minjaesong
2021-06-22 22:05:49 +09:00
parent d6b2f18b03
commit 2287683f8d

View File

@@ -36,7 +36,7 @@ const TYPESET_STRATEGY_JUSTIFIED = 3 // not implemented yet!
const typesetStrats = [undefined, undefined, typesetLessRagged, typesetJustified]
let PAGE_HEIGHT = 60
let PAGE_WIDTH = 80
let PAGE_WIDTH = 80 // minimum possible value is 3
// 80x60 -> 720x1080 text area; with 72px margin for each side, paper resolution is 864x1224, which is quite close to 1:sqrt(2) ratio
let scroll = 0
@@ -374,7 +374,7 @@ function typesetJustified(lineStart, lineEnd) {
}
}
// expand spaces
else if (!isLineEnd && justLen < paintWidth) {
else if (recDepth < 5 && !isLineEnd && justLen < paintWidth) {
printdbg("EXPAND SPACES BETWEEN")
let expandTargets = normalSpc.shuffle().concat(spcAfterPunct.shuffle())