mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
Romanian and Thai language support, GameFont: scaling
Former-commit-id: 960bbc00b2d16111b5b63fc31a71a8093bae9dc1 Former-commit-id: 159beb538d151a6b332809ddfeb66ce1e02be52d
This commit is contained in:
@@ -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
|
||||
BIN
res/graphics/fonts/romana_ef.png
Normal file
BIN
res/graphics/fonts/romana_ef.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 134 B |
BIN
res/graphics/fonts/romana_majuscule.png
Normal file
BIN
res/graphics/fonts/romana_majuscule.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 197 B |
BIN
res/graphics/fonts/thai_fullwidth.png
Normal file
BIN
res/graphics/fonts/thai_fullwidth.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
@@ -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": " "
|
||||
}
|
||||
15
res/locales/frFR/configurator.json
Normal file
15
res/locales/frFR/configurator.json
Normal file
@@ -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": " "
|
||||
}
|
||||
@@ -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": " "
|
||||
}
|
||||
@@ -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": " "
|
||||
}
|
||||
@@ -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<SpriteSheet>
|
||||
lateinit internal var sheetKey: Array<SpriteSheet?>
|
||||
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
|
||||
|
||||
@@ -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
|
||||
);*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,10 +28,10 @@ class ConsoleWindow : UICanvas, UITypable {
|
||||
private var commandHistory = HistoryArray<String>(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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user