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

14
.idea/libraries/ibm_icu_icu4j.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<component name="libraryTable">
<library name="ibm.icu.icu4j" type="repository">
<properties maven-id="com.ibm.icu:icu4j:70.1" />
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/icu4j-70.1.jar!/" />
</CLASSES>
<JAVADOC>
<root url="jar://$PROJECT_DIR$/lib/icu4j-70.1-javadoc.jar!/" />
</JAVADOC>
<SOURCES>
<root url="jar://$PROJECT_DIR$/lib/icu4j-70.1-sources.jar!/" />
</SOURCES>
</library>
</component>

BIN
lib/icu4j-70.1-javadoc.jar Normal file

Binary file not shown.

BIN
lib/icu4j-70.1-sources.jar Normal file

Binary file not shown.

BIN
lib/icu4j-70.1.jar Normal file

Binary file not shown.

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

View File

@@ -23,5 +23,6 @@
<orderEntry type="library" name="gdx-platform-1.10.0-natives-desktop" level="project" />
<orderEntry type="library" name="graalvm-js-21.1.0 and graalvm-js-scriptengine-21.1.0" level="project" />
<orderEntry type="library" name="jetbrains.kotlinx.coroutines.core" level="project" />
<orderEntry type="library" name="ibm.icu.icu4j" level="project" />
</component>
</module>