mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
finalising fonts
Former-commit-id: e85038e433c9e451761a25ce93fa976b847c9e1e Former-commit-id: 0f59fe3a1b5a174ff63f5a79f11007f0e9d4a204
This commit is contained in:
@@ -52,7 +52,6 @@ open class GameFontBase : Font {
|
||||
8
|
||||
else
|
||||
9
|
||||
|
||||
}
|
||||
|
||||
private fun isHangul(c: Char) = c.toInt() >= 0xAC00 && c.toInt() < 0xD7A4
|
||||
@@ -68,13 +67,12 @@ open class GameFontBase : Font {
|
||||
private fun isWenQuanYi1(c: Char) = c.toInt() >= 0x33F3 && c.toInt() <= 0x69FC
|
||||
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 isRomanianNarrow(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)
|
||||
|| (c.toInt() >= 0xE47 && c.toInt() <= 0xE4E)
|
||||
|| (c.toInt() == 0xE31)
|
||||
private fun isThaiEF(c: Char) = c.toInt() == 0xE40
|
||||
private fun isKeycap(c: Char) = c.toInt() >= 0xE000 && c.toInt() <= 0xE07F
|
||||
|
||||
@@ -118,14 +116,14 @@ open class GameFontBase : Font {
|
||||
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 fun thaiNarrowIndexX(c: Char) = 3
|
||||
private fun thaiNarrowIndexY(c: Char) = 0
|
||||
|
||||
private fun keycapIndexX(c: Char) = (c.toInt() - 0xE000) % 16
|
||||
private fun keycapIndexY(c: Char) = (c.toInt() - 0xE000) / 16
|
||||
|
||||
private val narrowWidthSheets = arrayOf(
|
||||
SHEET_EXTB_ROMANIAN_EF
|
||||
SHEET_EXTB_ROMANIAN_NARROW
|
||||
)
|
||||
private val unihanWidthSheets = arrayOf(
|
||||
SHEET_UNIHAN,
|
||||
@@ -350,35 +348,35 @@ open class GameFontBase : Font {
|
||||
sheetX = cyrilicIndexX(ch)
|
||||
sheetY = cyrilicIndexY(ch)
|
||||
}
|
||||
SHEET_FW_UNI -> {
|
||||
SHEET_FW_UNI -> {
|
||||
sheetX = fullwidthUniIndexX(ch)
|
||||
sheetY = fullwidthUniIndexY(ch)
|
||||
}
|
||||
SHEET_UNI_PUNCT -> {
|
||||
SHEET_UNI_PUNCT -> {
|
||||
sheetX = uniPunctIndexX(ch)
|
||||
sheetY = uniPunctIndexY(ch)
|
||||
}
|
||||
SHEET_GREEK_VARW -> {
|
||||
SHEET_GREEK_VARW -> {
|
||||
sheetX = greekIndexX(ch)
|
||||
sheetY = greekIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_EM -> {
|
||||
SHEET_EXTB_ROMANIAN_WIDE -> {
|
||||
sheetX = romanianIndexX(ch)
|
||||
sheetY = romanianIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_EF -> {
|
||||
SHEET_EXTB_ROMANIAN_NARROW -> {
|
||||
sheetX = 0
|
||||
sheetY = 0
|
||||
}
|
||||
SHEET_THAI_EM -> {
|
||||
SHEET_THAI_WIDE -> {
|
||||
sheetX = thaiIndexX(ch)
|
||||
sheetY = thaiIndexY(ch)
|
||||
}
|
||||
SHEET_KEYCAP -> {
|
||||
SHEET_KEYCAP -> {
|
||||
sheetX = keycapIndexX(ch)
|
||||
sheetY = keycapIndexY(ch)
|
||||
}
|
||||
else -> {
|
||||
else -> {
|
||||
sheetX = ch.toInt() % 16
|
||||
sheetY = ch.toInt() / 16
|
||||
}
|
||||
@@ -417,8 +415,8 @@ open class GameFontBase : Font {
|
||||
|
||||
private fun getSheetType(c: Char): Int {
|
||||
// EFs
|
||||
if (isRomanianEF(c))
|
||||
return SHEET_EXTB_ROMANIAN_EF
|
||||
if (isRomanianNarrow(c))
|
||||
return SHEET_EXTB_ROMANIAN_NARROW
|
||||
else if (isThaiEF(c))
|
||||
return SHEET_EXTA_VARW // will use fourth glyph in EXTA_EF
|
||||
else if (isRunic(c))
|
||||
@@ -444,9 +442,9 @@ open class GameFontBase : Font {
|
||||
else if (isGreek(c))
|
||||
return SHEET_GREEK_VARW
|
||||
else if (isRomanian(c))
|
||||
return SHEET_EXTB_ROMANIAN_EM
|
||||
return SHEET_EXTB_ROMANIAN_WIDE
|
||||
else if (isThai(c))
|
||||
return SHEET_THAI_EM
|
||||
return SHEET_THAI_WIDE
|
||||
else if (c.isColourCode())
|
||||
return SHEET_COLOURCODE
|
||||
else if (isKeycap(c))
|
||||
@@ -536,7 +534,7 @@ open class GameFontBase : Font {
|
||||
lateinit internal var wenQuanYi_2: SpriteSheet
|
||||
lateinit internal var greekSheet: SpriteSheet
|
||||
lateinit internal var romanianSheet: SpriteSheet
|
||||
lateinit internal var romanianSheetEF: SpriteSheet
|
||||
lateinit internal var romanianSheetNarrow: SpriteSheet
|
||||
lateinit internal var thaiSheet: SpriteSheet
|
||||
lateinit internal var keycapSheet: SpriteSheet
|
||||
|
||||
@@ -570,24 +568,16 @@ open class GameFontBase : Font {
|
||||
internal val SHEET_WENQUANYI_1 = 10
|
||||
internal val SHEET_WENQUANYI_2 = 11
|
||||
internal val SHEET_GREEK_VARW = 12
|
||||
internal val SHEET_EXTB_ROMANIAN_EM = 13
|
||||
internal val SHEET_EXTB_ROMANIAN_EF = 14
|
||||
internal val SHEET_THAI_EM = 15
|
||||
internal val SHEET_THAI_EF = 16
|
||||
internal val SHEET_EXTB_ROMANIAN_WIDE = 13
|
||||
internal val SHEET_EXTB_ROMANIAN_NARROW = 14
|
||||
internal val SHEET_THAI_WIDE = 15
|
||||
internal val SHEET_THAI_NARROW = 16
|
||||
internal val SHEET_KEYCAP = 17
|
||||
|
||||
internal val SHEET_UNKNOWN = 254
|
||||
internal val SHEET_COLOURCODE = 255
|
||||
|
||||
lateinit internal var sheetKey: Array<SpriteSheet?>
|
||||
internal val greekEFList = arrayOf(
|
||||
0x390.toChar(),
|
||||
0x399.toChar(),
|
||||
0x3AA.toChar(),
|
||||
0x3AF.toChar(),
|
||||
0x3B9.toChar(),
|
||||
0x3CA.toChar()
|
||||
)
|
||||
|
||||
/**
|
||||
* Runic letters list used for game. The set is
|
||||
@@ -627,7 +617,7 @@ open class GameFontBase : Font {
|
||||
Pair(0x19.toChar(), Color(0x008000)), //v iridian
|
||||
Pair(0x1A.toChar(), Color(0x805030)), //x (khaki)
|
||||
Pair(0x1B.toChar(), Color(0x808080)) //*k
|
||||
//* marked: commonly used
|
||||
//* marked: commonly used
|
||||
)
|
||||
val colToCode = hashMapOf(
|
||||
Pair("w", 0x10.toChar()),
|
||||
|
||||
@@ -5,7 +5,7 @@ import org.newdawn.slick.*
|
||||
/**
|
||||
* Created by minjaesong on 16-01-20.
|
||||
*/
|
||||
class GameFontWhite : GameFontBase() {
|
||||
class GameFontImpl : GameFontBase() {
|
||||
|
||||
init {
|
||||
|
||||
@@ -41,11 +41,11 @@ class GameFontWhite : GameFontBase() {
|
||||
GameFontBase.greekSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/greek_variable.tga", 15, 19, 1)
|
||||
GameFontBase.romanianSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/romana_fullwidth.tga", GameFontBase.W_LATIN_WIDE, GameFontBase.H)
|
||||
GameFontBase.romanianSheetEF = SpriteSheet(
|
||||
"./assets/graphics/fonts/romana_ef.tga", GameFontBase.W_LATIN_NARROW, GameFontBase.H)
|
||||
"./assets/graphics/fonts/romana_wide.tga", GameFontBase.W_LATIN_WIDE, GameFontBase.H)
|
||||
GameFontBase.romanianSheetNarrow = SpriteSheet(
|
||||
"./assets/graphics/fonts/romana_narrow.tga", GameFontBase.W_LATIN_NARROW, GameFontBase.H)
|
||||
GameFontBase.thaiSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/thai_fullwidth.tga", GameFontBase.W_LATIN_WIDE, GameFontBase.H)
|
||||
"./assets/graphics/fonts/thai_wide.tga", GameFontBase.W_LATIN_WIDE, GameFontBase.H)
|
||||
GameFontBase.keycapSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/puae000-e07f.tga", GameFontBase.SIZE_KEYCAP, GameFontBase.SIZE_KEYCAP)
|
||||
|
||||
@@ -64,7 +64,7 @@ class GameFontWhite : GameFontBase() {
|
||||
GameFontBase.wenQuanYi_2,
|
||||
GameFontBase.greekSheet,
|
||||
GameFontBase.romanianSheet,
|
||||
GameFontBase.romanianSheetEF,
|
||||
GameFontBase.romanianSheetNarrow,
|
||||
GameFontBase.thaiSheet,
|
||||
null, // Thai EF, filler because not being used right now
|
||||
GameFontBase.keycapSheet
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum
|
||||
|
||||
import net.torvald.imagefont.GameFontWhite
|
||||
import net.torvald.imagefont.GameFontImpl
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import org.newdawn.slick.*
|
||||
import org.newdawn.slick.state.BasicGameState
|
||||
@@ -110,9 +110,10 @@ nopqrstuvwxyz
|
||||
"sjaldgæft ekki stjórnarskrárvarin",
|
||||
"",
|
||||
"Also supports:",
|
||||
"키스의 고유조건은 입술끼리 만나야 하고 특별한 기술은 필요치 않다. 대한민국! 머한민국? (대구) {머구} 명작, 띵작. 유식 윾싀",
|
||||
"‛Unicode’ „quotation marks“—dashes…‼",
|
||||
"으웽~. 얘! 위에 이 애 우유의 양 외워와! 아오~ 왜요? 어여! 예... 웬 초콜릿? 제가 원했던 건 뻥튀기 쬐끔과 의류예요. 얘야, 왜 또 불평? 퀡퇣풿횂",
|
||||
"とりなくこゑす ゆめさませ みよあけわたる ひんかしを そらいろはえて おきつへに ほふねむれゐぬ もやのうち",
|
||||
"鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中 (using WenQuanYi)",
|
||||
"鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中",
|
||||
""
|
||||
)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum
|
||||
import com.google.gson.JsonArray
|
||||
import com.google.gson.JsonObject
|
||||
import com.google.gson.JsonPrimitive
|
||||
import net.torvald.imagefont.GameFontWhite
|
||||
import net.torvald.imagefont.GameFontImpl
|
||||
import net.torvald.JsonFetcher
|
||||
import net.torvald.JsonWriter
|
||||
import net.torvald.imagefont.TinyAlphNum
|
||||
@@ -94,7 +94,7 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
||||
override fun initStatesList(gc: GameContainer) {
|
||||
gc.input.enableKeyRepeat()
|
||||
|
||||
fontGame = GameFontWhite()
|
||||
fontGame = GameFontImpl()
|
||||
fontSmallNumbers = TinyAlphNum()
|
||||
|
||||
// search for real controller
|
||||
@@ -130,14 +130,14 @@ constructor(gamename: String) : StateBasedGame(gamename) {
|
||||
//addState(StateTestingLightning())
|
||||
//addState(StateSplash())
|
||||
//addState(StateMonitorCheck())
|
||||
addState(StateFontTester())
|
||||
//addState(StateFontTester())
|
||||
//addState(StateNoiseTexGen())
|
||||
//addState(StateBlurTest())
|
||||
//addState(StateShaderTest())
|
||||
//addState(StateNoiseTester())
|
||||
|
||||
//ingame = StateInGame()
|
||||
//addState(ingame)
|
||||
ingame = StateInGame()
|
||||
addState(ingame)
|
||||
|
||||
|
||||
// foolproof
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package net.torvald.terrarum.langpack
|
||||
|
||||
import net.torvald.CSVFetcher
|
||||
import net.torvald.JsonFetcher
|
||||
import net.torvald.imagefont.GameFontWhite
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
import org.newdawn.slick.SlickException
|
||||
|
||||
import java.io.*
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package net.torvald.terrarum.ui
|
||||
|
||||
import net.torvald.imagefont.GameFontWhite
|
||||
import net.torvald.imagefont.GameFontImpl
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.blendDisable
|
||||
import net.torvald.terrarum.blendNormal
|
||||
@@ -40,7 +40,7 @@ constructor(override var width: Int, isBlackVariant: Boolean) : UICanvas {
|
||||
segmentRight = Image("./assets/graphics/gui/message_black_right.tga")
|
||||
segmentBody = Image("./assets/graphics/gui/message_black_body.tga")
|
||||
}
|
||||
uiFont = GameFontWhite()
|
||||
uiFont = GameFontImpl()
|
||||
height = segmentLeft!!.height
|
||||
messageWindowRadius = segmentLeft!!.width
|
||||
messagesList = arrayOf("", "")
|
||||
|
||||
Reference in New Issue
Block a user