diff --git a/assets/ascii_variable.tga b/assets/ascii_variable.tga index a649c59..1edecef 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:fdafd55bf0ef11d03a49f722c92332a85c1599d4586ff05f9afc947c117d6910 +oid sha256:48371438337ea73de6067bd70ac77ae2d1b59db379fc25d13b25d135fe0449d0 size 327698 diff --git a/src/net/torvald/terrarumsansbitmap/MovableType.kt b/src/net/torvald/terrarumsansbitmap/MovableType.kt index b353448..15a5186 100644 --- a/src/net/torvald/terrarumsansbitmap/MovableType.kt +++ b/src/net/torvald/terrarumsansbitmap/MovableType.kt @@ -3,6 +3,7 @@ package net.torvald.terrarumsansbitmap import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.graphics.g2d.Batch import com.badlogic.gdx.utils.Disposable +import net.torvald.terrarumsansbitmap.MovableType.Companion.isParenClose import net.torvald.terrarumsansbitmap.gdx.CodePoint import net.torvald.terrarumsansbitmap.gdx.CodepointSequence import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap @@ -652,6 +653,11 @@ class MovableType( appendToBuffer(c0) } + // tokenise camelCase + else if (cM.isMiniscule() && c0.isMajuscule()) { + sendoutBox() + appendToBuffer(c0) + } else { if (!isHangulPK(c0) && !c0.isKoreanPunct() && !c0.isCJpunct() && !c0.isParens() && isHangulPK(cM ?: 0)) { sendoutBox() @@ -703,7 +709,7 @@ class MovableType( private fun isHangulI(c: CodePoint) = hangulI.contains(c) private fun isHangulPK(c: CodePoint) = hangulPK.contains(c) - private fun CodePoint?.isNumeric() = if (this == null) false else (this in 0x30..0x39 || this in (0xFF10..0xFF19)) + private fun CodePoint?.isNumeric() = if (this == null) false else Character.isDigit(this) private fun CodePoint?.isWhiteSpace() = if (this == null) false else whitespaceGlues.contains(this) @@ -733,6 +739,9 @@ class MovableType( private fun CodePoint?.isParenOpen() = if (this == null) false else parenOpen.contains(this) private fun CodePoint?.isParenClose() = if (this == null) false else parenClose.contains(this) + private fun CodePoint?.isMajuscule() = if (this == null) false else Character.isUpperCase(this) + private fun CodePoint?.isMiniscule() = if (this == null) false else Character.isLowerCase(this) + /** * Hyphenates the word at the middle ("paragraph" -> "para-graph") * @@ -821,7 +830,7 @@ class MovableType( private val controlIns = listOf(0xFFFA2, 0xFFFA3, 0xFFFC1, 0xFFFC2).toSortedSet() private val controlOuts = listOf(0xFFFBF, 0xFFFC0).toSortedSet() private val whitespaceGlues = hashMapOf( - 0x20 to 5, + 0x20 to 4, 0x3000 to 16, ) private val cjpuncts = listOf(0x203c, 0x2047, 0x2048, 0x2049, 0x3001, 0x3002, 0x3006, 0x303b, 0x30a0, 0x30fb, 0x30fc, 0x301c, 0xff01, 0xff0c, 0xff0e, 0xff1a, 0xff1b, 0xff1f, 0xff5e, 0xff65).toSortedSet() diff --git a/work_files/ascii_variable.psd b/work_files/ascii_variable.psd index 390d966..a334fe9 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:55326e828c6b5febf29093aea15b28d07df2fb9055f613817bd96efbd518813a -size 317899 +oid sha256:67e36c0d986ce8c62bdc9a0bbfe900bcb73819885e2f91803537a26d0c33d3d0 +size 317905