diff --git a/assets/ascii_variable.tga b/assets/ascii_variable.tga index dd7f2ca..b957092 100755 --- a/assets/ascii_variable.tga +++ b/assets/ascii_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8ac70bb0fcb78b25371b5cbe434cf3394c78ab7d06f8b0ffdbd39480619e2f92 +oid sha256:8ea21823dac2028f6a622eb4fc0c573c37260b7229f844b43aca103c451249b5 size 327698 diff --git a/assets/unipunct_variable.tga b/assets/unipunct_variable.tga index bf927f0..acc0572 100755 --- a/assets/unipunct_variable.tga +++ b/assets/unipunct_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:5bd4d16ab15d30afc24c542568dee28a3eadfe16b74634597b406b6c1c13dbcf +oid sha256:987e27bd955fcf1d18203fc59739a6dabeb5e1d45a81cdb6588404364bfe5ce0 size 204818 diff --git a/src/net/torvald/terrarumsansbitmap/MovableType.kt b/src/net/torvald/terrarumsansbitmap/MovableType.kt index 80eb179..43b2623 100644 --- a/src/net/torvald/terrarumsansbitmap/MovableType.kt +++ b/src/net/torvald/terrarumsansbitmap/MovableType.kt @@ -50,7 +50,12 @@ class MovableType( var width = 0; private set - constructor(font: TerrarumSansBitmap, string: String, paperWidth: Int) : this(font, font.normaliseStringForMovableType(string), paperWidth) + constructor( + font: TerrarumSansBitmap, + string: String, + paperWidth: Int, + strategy: TypesettingStrategy = TypesettingStrategy.JUSTIFIED + ) : this(font, font.normaliseStringForMovableType(string), paperWidth, strategy) override fun dispose() { if (!disposed) { @@ -68,7 +73,7 @@ class MovableType( // println("Paper width: $paperWidth") val lines = inputText.tokenise() - lines.debugprint() +// lines.debugprint() lines.forEachIndexed { linenum, it -> // println("Processing input text line ${linenum + 1} (word count: ${it.size})...") @@ -141,7 +146,7 @@ class MovableType( // don't hyphenate if: // - the word is too short (5 chars or less) // - the word is pre-hyphenated (ends with hyphen-null) - val glyphCount = box.text.count { it in 32..0xfffff } + val glyphCount = box.text.count { it in 32..0xFFF6F && it !in 0xFFF0..0xFFFF } if (glyphCount <= (if (paperWidth < 350) 4 else if (paperWidth < 480) 5 else 6) || box.text.penultimate() == 0x2D) return Triple(Double.POSITIVE_INFINITY, 2147483647, null) @@ -375,7 +380,7 @@ class MovableType( private val periods = listOf(0x2E, 0x3A, 0x21, 0x3F, 0x2026, 0x3002, 0xff0e).toSortedSet() private val quots = listOf(0x22, 0x27, 0xAB, 0xBB, 0x2018, 0x2019, 0x201A, 0x201B, 0x201C, 0x201D, 0x201E, 0x201F, 0x2039, 0x203A).toSortedSet() private val commas = listOf(0x2C, 0x3B, 0x3001, 0xff0c).toSortedSet() - private val hangable = (listOf(0x2E, 0x2C, 0x3A, 0x3B, 0x22, 0x27) + (0x2018..0x201f)).toSortedSet() + private val hangable = (listOf(0x2E, 0x2C, 0x2D, 0x3A, 0x3B, 0x22, 0x27) + (0x2018..0x201f)).toSortedSet() private val hangableFW = listOf(0x3001, 0x3002, 0xff0c, 0xff0e).toSortedSet() private const val hangWidth = 6 private const val hangWidthFW = 16 diff --git a/work_files/ascii_variable.psd b/work_files/ascii_variable.psd index 9368851..53d6097 100644 --- a/work_files/ascii_variable.psd +++ b/work_files/ascii_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bdb1eb7504373d64208269310c34cce6dca345636698b53f28570d7fffd8f192 +oid sha256:77d60516a43a02565320c452f9dcfcee04fa4466c372d795cb59d912b6475ad7 size 348790 diff --git a/work_files/unipunct_variable.psd b/work_files/unipunct_variable.psd index 7b2cae3..f5698ee 100644 --- a/work_files/unipunct_variable.psd +++ b/work_files/unipunct_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f2e3c0622799fcfa112fee48c3b0d132894fe51ddbd86d6b49ef65fcf2c5f148 -size 194446 +oid sha256:a91cec0883a461a7b93ffc4d3e53239bc61004e025d76ab55ea685782ae414e9 +size 194604