reading text from the keyboard input panel will return the string in Unicode NFC

This commit is contained in:
minjaesong
2022-01-11 17:30:52 +09:00
parent 65d9ae7ee1
commit dc595fdd51
6 changed files with 19 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.OrthographicCamera
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.graphics.glutils.FrameBuffer
import com.ibm.icu.text.Normalizer2
import com.jme3.math.FastMath
import net.torvald.terrarum.*
import net.torvald.terrarum.gamecontroller.*
@@ -433,9 +434,11 @@ class UIItemTextLineInput(
}
private fun textbufToString(): String {
return textbuf.toJavaString()
return textbuf.toJavaString().toUnicodeNFC()
}
private fun String.toUnicodeNFC() = Normalizer2.getNFCInstance().normalize(this)
private fun moveCursorToEnd(stride: Int) {
try {
cursorX += stride