diff --git a/res/books/polyglot_test.txt b/res/books/polyglot_test.txt index 24b0742cc..6d13ed242 100644 --- a/res/books/polyglot_test.txt +++ b/res/books/polyglot_test.txt @@ -26,6 +26,6 @@ Og som krystaller står en tanke ganske klar Ще спра да бъда аз на миналото в плен La den gå, la den gå, jeg skal stige lik solen nå -[thai language not supported] +ปล่อยออกมา เลิกซ่อนเร้น เด็กดี ไม่เห็นมีค่า Je suis là, comme je l'ai rêvé En de storm raast door! De vrieskou, daar zat ik toch al niet mee \ No newline at end of file diff --git a/res/graphics/fonts/romana_ef.png b/res/graphics/fonts/romana_ef.png new file mode 100644 index 000000000..48c1735e7 Binary files /dev/null and b/res/graphics/fonts/romana_ef.png differ diff --git a/res/graphics/fonts/romana_majuscule.png b/res/graphics/fonts/romana_majuscule.png new file mode 100644 index 000000000..7cd48090b Binary files /dev/null and b/res/graphics/fonts/romana_majuscule.png differ diff --git a/res/graphics/fonts/thai_fullwidth.png b/res/graphics/fonts/thai_fullwidth.png new file mode 100644 index 000000000..803ac7378 Binary files /dev/null and b/res/graphics/fonts/thai_fullwidth.png differ diff --git a/res/locales/en/configurator.json b/res/locales/en/configurator.json index 2e3cfff53..153afbf10 100644 --- a/res/locales/en/configurator.json +++ b/res/locales/en/configurator.json @@ -9,5 +9,7 @@ "MENU_MONITOR_CALI_LABEL_7": "On a good monitor, you should see roughly equal steps in brightness", "MENU_MONITOR_CALI_LABEL_8": "over the full 1 to 32 range", "MENU_MONITOR_CALI_LABEL_9": " ", - "MENU_MONITOR_CALI_LABEL_10": "Adjust the contrast and brightness setting of the monitor to improve the image" + "MENU_MONITOR_CALI_LABEL_10": "Adjust the contrast and brightness setting of your monitor to improve the image", + "MENU_MONITOR_CALI_LABEL_11": " ", + "MENU_MONITOR_CALI_LABEL_12": " " } \ No newline at end of file diff --git a/res/locales/frFR/configurator.json b/res/locales/frFR/configurator.json new file mode 100644 index 000000000..c8dc88664 --- /dev/null +++ b/res/locales/frFR/configurator.json @@ -0,0 +1,15 @@ +{ + "MENU_MONITOR_CALI_TITLE": "Vérification d’écran", + "MENU_MONITOR_CALI_LABEL_1": "Vous devriez être capable de voir la barre 1 de l’arrière-plan", + "MENU_MONITOR_CALI_LABEL_2": "et distinguer clairement la barre 30, 31 et 32", + "MENU_MONITOR_CALI_LABEL_3": " ", + "MENU_MONITOR_CALI_LABEL_4": "Un mauvais écran ne sera pas afficher quelques barres de l’extrême gauche,", + "MENU_MONITOR_CALI_LABEL_5": "ne sera pas afficher une différence entre la droite quelques-uns,", + "MENU_MONITOR_CALI_LABEL_6": "ou montre un assez grand saut entre barre 31 et 32", + "MENU_MONITOR_CALI_LABEL_7": " ", + "MENU_MONITOR_CALI_LABEL_8": "Sur un bon écran, vous devries voir les étapes à peu près égales de", + "MENU_MONITOR_CALI_LABEL_9": "luminosité sur toute la plate 1 à 32", + "MENU_MONITOR_CALI_LABEL_10": " ", + "MENU_MONITOR_CALI_LABEL_11": "Régler le contraste et luminosité de votre écran pour améliorer l’image", + "MENU_MONITOR_CALI_LABEL_12": " " +} \ No newline at end of file diff --git a/res/locales/jaJP/configurator.json b/res/locales/jaJP/configurator.json index 26328f62d..ebd35df04 100644 --- a/res/locales/jaJP/configurator.json +++ b/res/locales/jaJP/configurator.json @@ -9,5 +9,7 @@ "MENU_MONITOR_CALI_LABEL_7": " ", "MENU_MONITOR_CALI_LABEL_8": "調整したモニターでは、1から32番まで、ほぼ同じステップの明るさが示しています。", "MENU_MONITOR_CALI_LABEL_9": " ", - "MENU_MONITOR_CALI_LABEL_10": "モニターのコントラストと明るさ設定を調整してください。" + "MENU_MONITOR_CALI_LABEL_10": "モニターのコントラストと明るさ設定を調整してください。", + "MENU_MONITOR_CALI_LABEL_11": " ", + "MENU_MONITOR_CALI_LABEL_12": " " } \ No newline at end of file diff --git a/res/locales/koKR/configurator.json b/res/locales/koKR/configurator.json index 09128b401..39e6de442 100644 --- a/res/locales/koKR/configurator.json +++ b/res/locales/koKR/configurator.json @@ -9,5 +9,7 @@ "MENU_MONITOR_CALI_LABEL_7": " ", "MENU_MONITOR_CALI_LABEL_8": "조정된 모니터에서는 1번 막대에서 32번 막대까지 거의 일정하게 밝아지는 것으로 보입니다", "MENU_MONITOR_CALI_LABEL_9": " ", - "MENU_MONITOR_CALI_LABEL_10": "모니터의 대비와 밝기 설정을 조절해 모니터를 조정해 주십시오" + "MENU_MONITOR_CALI_LABEL_10": "모니터의 대비와 밝기 설정을 조절해 모니터를 조정해 주십시오", + "MENU_MONITOR_CALI_LABEL_11": " ", + "MENU_MONITOR_CALI_LABEL_12": " " } \ No newline at end of file diff --git a/src/net/torvald/imagefont/GameFontBase.kt b/src/net/torvald/imagefont/GameFontBase.kt index 39891bd1c..486d8bfa5 100644 --- a/src/net/torvald/imagefont/GameFontBase.kt +++ b/src/net/torvald/imagefont/GameFontBase.kt @@ -71,14 +71,28 @@ constructor() : Font { private fun isWenQuanYi2(c: Char) = c.toInt() >= 0x69FD && c.toInt() <= 0x9FDC private fun isGreek(c: Char) = c.toInt() >= 0x370 && c.toInt() <= 0x3CE private fun isGreekEF(c: Char) = greekEFList.contains(c) + private fun isRomanian(c: Char) = c.toInt() >= 0x218 && c.toInt() <= 0x21A + private fun isRomanianEF(c: Char) = c.toInt() == 0x21B + private fun isThai(c: Char) = c.toInt() >= 0xE00 && c.toInt() <= 0xE7F + private fun isThaiDiacritics(c: Char) = (c.toInt() >= 0xE34 && c.toInt() <= 0xE3A) + || (c.toInt() >= 0xE47 && c.toInt() <= 0xE4E) + || (c.toInt() == 0xE31) + private fun isThaiEF(c: Char) = c.toInt() == 0xE40 private fun asciiEFindexX(c: Char) = asciiEFList.indexOf(c) % 16 private fun asciiEFindexY(c: Char) = asciiEFList.indexOf(c) / 16 - private fun extAEFindexX(c: Char) = extAEFList.indexOf(c) % 16 - private fun extAEFindexY(c: Char) = extAEFList.indexOf(c) / 16 + private fun extAindexX(c: Char) = (c.toInt() - 0x100) % 16 + private fun extAindexY(c: Char) = (c.toInt() - 0x100) / 16 + + private fun extAEFindexX(c: Char) = + if (isThaiEF(c)) 3 // thai เ + else extAEFList.indexOf(c) % 16 + private fun extAEFindexY(c: Char) = + if (isThaiEF(c)) 0 // thai เ + else extAEFList.indexOf(c) / 16 private fun runicIndexX(c: Char) = runicList.indexOf(c) % 16 private fun runicIndexY(c: Char) = runicList.indexOf(c) / 16 @@ -115,12 +129,21 @@ constructor() : Font { private fun greekEFIndexX(c: Char) = greekEFList.indexOf(c) % 16 private fun greekEFIndexY(c: Char) = greekEFList.indexOf(c) / 16 + private fun romanianIndexX(c: Char) = c.toInt() - 0x218 + private fun romanianIndexY(c: Char) = 0 + + private fun thaiIndexX(c: Char) = (c.toInt() - 0xE00) % 16 + private fun thaiIndexY(c: Char) = (c.toInt() - 0xE00) / 16 + + private fun thaiEFIndexX(c: Char) = 3 + private fun thaiEFIndexY(c: Char) = 0 private val narrowWidthSheets = arrayOf( SHEET_ASCII_EF, SHEET_EXTA_EF, SHEET_CYRILIC_EF, - SHEET_GREEK_EF + SHEET_GREEK_EF, + SHEET_EXTB_ROMANIAN_EF ) private val unihanWidthSheets = arrayOf( SHEET_UNIHAN, @@ -169,17 +192,19 @@ constructor() : Font { len += W_CJK else if (unihanWidthSheets.contains(ctype)) len += W_UNIHAN + else if (isThaiDiacritics(s[i])) + len = len // set width of the glyph as -W_LATIN_WIDE else len += W_LATIN_WIDE if (i < endIndex - 1) len += interchar } - return len + return len * scale } - override fun getHeight(s: String) = H + override fun getHeight(s: String) = H * scale - override fun getLineHeight() = H + override fun getLineHeight() = H * scale override fun drawString(x: Float, y: Float, s: String) = drawString(x, y, s, Color.white) @@ -236,17 +261,17 @@ constructor() : Font { hangulSheet.getSubImage(indexCho, choRow).draw( Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), - thisCol + scale.toFloat(), thisCol ) hangulSheet.getSubImage(indexJung, jungRow).draw( Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), - thisCol + scale.toFloat(), thisCol ) hangulSheet.getSubImage(indexJong, jongRow).draw( Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), - thisCol + scale.toFloat(), thisCol ) } } @@ -294,7 +319,7 @@ constructor() : Font { wenQuanYi_1.getSubImage(wenQuanYiIndexX(ch), wenQuanYi1IndexY(ch)).draw( Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round((H - H_UNIHAN) / 2 + y).toFloat(), - thisCol + scale.toFloat(), thisCol ) } } @@ -322,7 +347,7 @@ constructor() : Font { wenQuanYi_2.getSubImage(wenQuanYiIndexX(ch), wenQuanYi2IndexY(ch)).draw( Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round((H - H_UNIHAN) / 2 + y).toFloat(), - thisCol + scale.toFloat(), thisCol ) } } @@ -364,8 +389,8 @@ constructor() : Font { sheetY = runicIndexY(ch) } SHEET_EXTA_EM -> { - sheetX = (ch.toInt() - 0x100) % 16 - sheetY = (ch.toInt() - 0x100) / 16 + sheetX = extAindexX(ch) + sheetY = extAindexY(ch) } SHEET_KANA -> { sheetX = kanaIndexX(ch) @@ -399,6 +424,18 @@ constructor() : Font { sheetX = greekEFIndexX(ch) sheetY = greekEFIndexY(ch) } + SHEET_EXTB_ROMANIAN_EM -> { + sheetX = romanianIndexX(ch) + sheetY = romanianIndexY(ch) + } + SHEET_EXTB_ROMANIAN_EF -> { + sheetX = 0 + sheetY = 0 + } + SHEET_THAI_EM -> { + sheetX = thaiIndexX(ch) + sheetY = thaiIndexY(ch) + } else -> { sheetX = ch.toInt() % 16 sheetY = ch.toInt() / 16 @@ -415,7 +452,7 @@ constructor() : Font { else 0, sheetX, sheetY )*/ - sheetKey[prevInstance].getSubImage(sheetX, sheetY).draw( + sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).draw( Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat() // Interchar: pull punct right next to hangul to the left + if (i > 0 && isHangul(s[i - 1])) -3f else 0f, @@ -424,7 +461,7 @@ constructor() : Font { else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2 else 0).toFloat(), - thisCol + scale.toFloat(), thisCol ) } catch (e: ArrayIndexOutOfBoundsException) { @@ -454,6 +491,10 @@ constructor() : Font { return SHEET_CYRILIC_EF else if (isGreekEF(c)) return SHEET_GREEK_EF + else if (isRomanianEF(c)) + return SHEET_EXTB_ROMANIAN_EF + else if (isThaiEF(c)) + return SHEET_EXTA_EF // will use fourth glyph in EXTA_EF else if (isRunic(c)) return SHEET_RUNIC else if (isHangul(c)) @@ -476,6 +517,10 @@ constructor() : Font { return SHEET_FW_UNI else if (isGreek(c)) return SHEET_GREEK_EM + else if (isRomanian(c)) + return SHEET_EXTB_ROMANIAN_EM + else if (isThai(c)) + return SHEET_THAI_EM else if (c.isColourCode()) return SHEET_COLOURCODE else @@ -506,19 +551,6 @@ constructor() : Font { drawString(x + xoff, y, printedBody, color) } - @Throws(SlickException::class) - open fun reloadUnihan() { - - } - - /** - * Set margin between characters - * @param margin - */ - fun setInterchar(margin: Int) { - interchar = margin - } - private fun setBlendModeMul() { GL11.glEnable(GL11.GL_BLEND) GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_ONE_MINUS_SRC_ALPHA) @@ -550,6 +582,9 @@ constructor() : Font { lateinit internal var wenQuanYi_2: SpriteSheet lateinit internal var greekSheet: SpriteSheet lateinit internal var greekSheetEF: SpriteSheet + lateinit internal var romanianSheet: SpriteSheet + lateinit internal var romanianSheetEF: SpriteSheet + lateinit internal var thaiSheet: SpriteSheet internal val JUNG_COUNT = 21 internal val JONG_COUNT = 28 @@ -580,9 +615,13 @@ constructor() : Font { internal val SHEET_WENQUANYI_2 = 14 internal val SHEET_GREEK_EM = 15 internal val SHEET_GREEK_EF = 16 + internal val SHEET_EXTB_ROMANIAN_EM = 17 + internal val SHEET_EXTB_ROMANIAN_EF = 18 + internal val SHEET_THAI_EM = 19 + internal val SHEET_THAI_EF = 20 internal val SHEET_COLOURCODE = 255 - lateinit internal var sheetKey: Array + lateinit internal var sheetKey: Array internal val asciiEFList = arrayOf(' ', '!', '"', '\'', '(', ')', ',', '.', ':', ';', 'I', '[', ']', '`', 'f', 'i', 'j', 'l', 't', '{', '|', '}', 0xA1.toChar(), 'Ì', 'Í', 'Î', 'Ï', 'ì', 'í', 'î', 'ï', '·') internal val extAEFList = arrayOf( 0x12E.toChar(), @@ -632,6 +671,11 @@ constructor() : Font { internal val runicList = arrayOf('ᚠ', 'ᚢ', 'ᚦ', 'ᚬ', 'ᚱ', 'ᚴ', 'ᚼ', 'ᚾ', 'ᛁ', 'ᛅ', 'ᛋ', 'ᛏ', 'ᛒ', 'ᛘ', 'ᛚ', 'ᛦ', 'ᛂ', '᛬', '᛫', '᛭', 'ᛮ', 'ᛯ', 'ᛰ') internal var interchar = 0 + internal var scale = 1 + set(value) { + if (value > 0) field = value + else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)") + } val colourKey = hashMapOf( Pair(0x10.toChar(), Color(0xFFFFFF)), //*w hite diff --git a/src/net/torvald/imagefont/GameFontWhite.kt b/src/net/torvald/imagefont/GameFontWhite.kt index 622f3494c..d91f570d0 100644 --- a/src/net/torvald/imagefont/GameFontWhite.kt +++ b/src/net/torvald/imagefont/GameFontWhite.kt @@ -50,6 +50,12 @@ constructor() : GameFontBase() { "./res/graphics/fonts/greek_majuscule.png", GameFontBase.W_LATIN_WIDE, GameFontBase.H) GameFontBase.greekSheetEF = SpriteSheet( "./res/graphics/fonts/greek_ef.png", GameFontBase.W_LATIN_NARROW, GameFontBase.H) + GameFontBase.romanianSheet = SpriteSheet( + "./res/graphics/fonts/romana_majuscule.png", GameFontBase.W_LATIN_WIDE, GameFontBase.H) + GameFontBase.romanianSheetEF = SpriteSheet( + "./res/graphics/fonts/romana_ef.png", GameFontBase.W_LATIN_NARROW, GameFontBase.H) + GameFontBase.thaiSheet = SpriteSheet( + "./res/graphics/fonts/thai_fullwidth.png", GameFontBase.W_LATIN_WIDE, GameFontBase.H) val shk = arrayOf( GameFontBase.asciiSheet, @@ -60,7 +66,7 @@ constructor() : GameFontBase() { GameFontBase.extASheetEF, GameFontBase.kanaSheet, GameFontBase.cjkPunct, - GameFontBase.asciiSheet, // Filler + null, // Filler GameFontBase.cyrilic, GameFontBase.cyrilicEF, GameFontBase.fullwidthForms, @@ -68,19 +74,12 @@ constructor() : GameFontBase() { GameFontBase.wenQuanYi_1, GameFontBase.wenQuanYi_2, // uniHan GameFontBase.greekSheet, - GameFontBase.greekSheetEF + GameFontBase.greekSheetEF, + GameFontBase.romanianSheet, + GameFontBase.romanianSheetEF, + GameFontBase.thaiSheet, + null // Filler ) GameFontBase.sheetKey = shk } - - @Throws(SlickException::class) - override fun reloadUnihan() { - /*uniHan = new SpriteSheet( - "./res/graphics/fonts/unifont_unihan" - + ((!terrarum.gameLocale.contains("zh")) - ? "_ja" : "") - +".png" - , W_UNIHAN, H_UNIHAN - );*/ - } } diff --git a/src/net/torvald/terrarum/StateMonitorCheck.kt b/src/net/torvald/terrarum/StateMonitorCheck.kt index 1be2ec2bf..0c3190e4a 100644 --- a/src/net/torvald/terrarum/StateMonitorCheck.kt +++ b/src/net/torvald/terrarum/StateMonitorCheck.kt @@ -117,7 +117,7 @@ class StateMonitorCheck : BasicGameState() { this, g ) - (1..10).forEach { + (1..12).forEach { Typesetter.printCentered( Lang["MENU_MONITOR_CALI_LABEL_$it"], instructionY + it.minus(2).times(g.font.lineHeight), diff --git a/src/net/torvald/terrarum/gameactors/Hitbox.kt b/src/net/torvald/terrarum/gameactors/Hitbox.kt index 1b748827b..327a3a877 100644 --- a/src/net/torvald/terrarum/gameactors/Hitbox.kt +++ b/src/net/torvald/terrarum/gameactors/Hitbox.kt @@ -100,13 +100,13 @@ class Hitbox(x1: Double, y1: Double, width: Double, height: Double) { return this } - fun snapToPixel(): Hitbox { + /*fun snapToPixel(): Hitbox { hitboxStart.x = Math.round(hitboxStart.x - HALF_PIXEL).toDouble() hitboxStart.y = Math.round(hitboxStart.y - HALF_PIXEL).toDouble() hitboxEnd.x = Math.round(hitboxEnd.x - HALF_PIXEL).toDouble() hitboxEnd.y = Math.round(hitboxEnd.y - HALF_PIXEL).toDouble() return this - } + }*/ /** * Returns x value of start point diff --git a/src/net/torvald/terrarum/ui/ConsoleWindow.kt b/src/net/torvald/terrarum/ui/ConsoleWindow.kt index 32080648a..f9c514adb 100644 --- a/src/net/torvald/terrarum/ui/ConsoleWindow.kt +++ b/src/net/torvald/terrarum/ui/ConsoleWindow.kt @@ -28,10 +28,10 @@ class ConsoleWindow : UICanvas, UITypable { private var commandHistory = HistoryArray(COMMAND_HISTORY_MAX) private val LINE_HEIGHT = 20 - private val MESSAGES_DISPLAY_COUNT = 9 + private val MESSAGES_DISPLAY_COUNT = 11 override var width: Int = Terrarum.WIDTH - override var height: Int = 200 + override var height: Int = LINE_HEIGHT * (MESSAGES_DISPLAY_COUNT + 1) override var openCloseTime: Int = 0