mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 20:01:52 +09:00
more tweaks on cyrillic family; control char impl to override RU/BG/SR mode
This commit is contained in:
57
.idea/workspace.xml
generated
57
.idea/workspace.xml
generated
@@ -10,7 +10,11 @@
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/demotext.txt" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/demotext.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/cyrilic_bulgarian_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/cyrilic_bulgarian_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/cyrilic_serbian_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/cyrilic_serbian_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/cyrilic_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/cyrilic_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@@ -30,8 +34,8 @@
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="534">
|
||||
<caret line="810" column="37" lean-forward="true" selection-start-line="810" selection-start-column="37" selection-end-line="810" selection-end-column="37" />
|
||||
<state relative-caret-position="588">
|
||||
<caret line="722" column="30" lean-forward="true" selection-start-line="722" selection-start-column="30" selection-end-line="722" selection-end-column="30" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -52,8 +56,8 @@
|
||||
<file leaf-file-name="FontTestGDX.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="541">
|
||||
<caret line="111" column="92" selection-start-line="111" selection-start-column="92" selection-end-line="111" selection-end-column="92" />
|
||||
<state relative-caret-position="491">
|
||||
<caret line="126" column="20" lean-forward="true" selection-start-line="126" selection-start-column="20" selection-end-line="126" selection-end-column="20" />
|
||||
<folding>
|
||||
<element signature="e#48#162#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -61,11 +65,20 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="demotext.txt" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="499">
|
||||
<caret line="273" lean-forward="true" selection-start-line="273" selection-end-line="273" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="demotext.txt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/demotext.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="566">
|
||||
<caret line="72" column="83" lean-forward="true" selection-start-line="72" selection-start-column="83" selection-end-line="72" selection-end-column="83" />
|
||||
<state relative-caret-position="514">
|
||||
<caret line="67" column="58" selection-start-line="67" selection-start-column="58" selection-end-line="67" selection-end-column="58" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -112,6 +125,13 @@
|
||||
<find>ө</find>
|
||||
<find>ď</find>
|
||||
<find>ñ</find>
|
||||
<find>fun relo</find>
|
||||
<find>getSheetT</find>
|
||||
<find>Unexpected</find>
|
||||
<find>Unexp</find>
|
||||
<find>fun getSh</find>
|
||||
<find>codeRange</find>
|
||||
<find>isHangul</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>.141</replace>
|
||||
@@ -130,9 +150,9 @@
|
||||
<option value="$PROJECT_DIR$/LICENSE.md" />
|
||||
<option value="$PROJECT_DIR$/README.md" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" />
|
||||
<option value="$PROJECT_DIR$/FontTestGDX/demotext.txt" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -654,10 +674,10 @@
|
||||
<entry file="file://$USER_HOME$/AppData/Local/Temp/Ихадоу адаҟьа.URL">
|
||||
<provider selected="true" editor-type-id="text-editor" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<entry file="jar://$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar!/net/torvald/terrarumsansbitmap/gdx/GameFontBase.class">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="534">
|
||||
<caret line="810" column="37" lean-forward="true" selection-start-line="810" selection-start-column="37" selection-end-line="810" selection-end-column="37" />
|
||||
<state relative-caret-position="241">
|
||||
<caret line="98" column="21" selection-start-line="98" selection-start-column="21" selection-end-line="98" selection-end-column="21" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -675,8 +695,8 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="541">
|
||||
<caret line="111" column="92" selection-start-line="111" selection-start-column="92" selection-end-line="111" selection-end-column="92" />
|
||||
<state relative-caret-position="491">
|
||||
<caret line="126" column="20" lean-forward="true" selection-start-line="126" selection-start-column="20" selection-end-line="126" selection-end-column="20" />
|
||||
<folding>
|
||||
<element signature="e#48#162#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -685,8 +705,15 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/demotext.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="566">
|
||||
<caret line="72" column="83" lean-forward="true" selection-start-line="72" selection-start-column="83" selection-end-line="72" selection-end-column="83" />
|
||||
<state relative-caret-position="514">
|
||||
<caret line="67" column="58" selection-start-line="67" selection-start-column="58" selection-end-line="67" selection-end-column="58" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="499">
|
||||
<caret line="273" lean-forward="true" selection-start-line="273" selection-end-line="273" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
||||
@@ -25,10 +25,9 @@ How multilingual? Real multilingual!
|
||||
Ианҵоуп ақьаад, нусхур аҩырала, ҩ ҽшьаҟакла, иҧшӡоу анапҩырала
|
||||
Գրիչս վայր դրի, վեր կացա և պատրաստվում էի, որ քնեմ, երբ հանկարծ դռանս զանգակը հնչեց
|
||||
Zəfər, jaketini də papağını da götür, bu axşam hava çox soyuq olacaq
|
||||
Под южно дърво, цъфтящо в синьо, бягаше малко пухкаво зайче (BG)
|
||||
Под южно дърво, цъфтящо в синьо, бягаше малко пухкаво зайче
|
||||
Příliš žluťoučký kůň úpěl ďábelské ódy
|
||||
Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen Walther spillede på xylofon
|
||||
Pack my box with five dozen liquor jugs
|
||||
Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich
|
||||
διαφυλάξτε γενικά τη ζωή σας από βαθειά ψυχικά τραύματα
|
||||
ΔΙΑΦΥΛΆΞΤΕ ΓΕΝΙΚΆ ΤΗ ΖΩΉ ΣΑΣ ΑΠΌ ΒΑΘΕΙΆ ΨΥΧΙΚΆ ΤΡΑΎΜΑΤΑ
|
||||
@@ -45,7 +44,7 @@ How multilingual? Real multilingual!
|
||||
Pchnąć w tę łódź jeża lub ośm skrzyń fig
|
||||
Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila
|
||||
Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства
|
||||
Ајшо, лепото и чежњо, за љубав срца мога дођи у Хаџиће на кафу (SR)
|
||||
Ајшо, лепото и чежњо, за љубав срца мога дођи у Хаџиће на кафу
|
||||
Jovencillo emponzoñado de whisky: ¡qué figurota exhibe!
|
||||
นายสังฆภัณฑ์ เฮงพิทักษ์ฝั่ง ผู้เฒ่าซึ่งมีอาชีพเป็นฅนขายฃวด ถูกตำรวจปฏิบัติการจับฟ้องศาล ฐานลักนาฬิกาคุณหญิงฉัตรชฎา ฌานสมาธิ
|
||||
Pijamalı hasta yağız şoföre çabucak güvendi
|
||||
@@ -53,7 +52,7 @@ How multilingual? Real multilingual!
|
||||
Do bạch kim rất quý nên sẽ dùng để lắp vô xương
|
||||
日堀油告観観藤村抄海評業庁経賃室弁市。太撮収改売週法所何都慣次現。価紙一無三洋日話転手治稿載末替付致治。
|
||||
|
||||
Featuring:
|
||||
Features:
|
||||
|
||||
Ever heard of « Guillemets »? You speak „Nederlands” or „Deutsch“? ”suomi”? 「日本語」しゃべる?或《中文》?
|
||||
|
||||
@@ -66,10 +65,10 @@ Fixed-width numbers, because number-crunching matters
|
||||
|
||||
ᚱᛂᚴᛋᛂᛋᛏᛋᚮᚾᛔᚢᛏᛚᚮᛋ᛬ᚱᛂᚴᛋᛋᚢᚼᚾᚢᛘᚢᛚᚾᛏᚮ᛬ᛏᚮᛋᛁᚮᚵᛂᚢᛏᚮᚱᛘᛔᚱᛂᚴᛋᛏ᛭ᛋᚢᚼᚾᚢᛋᛘᚮᛁᚵᚾᛁᛂᛏᚮᛑ᛭ᚵᛂᚢᛏᚮᚱ
|
||||
|
||||
Colour-coding that supports 65535 (semi-transparent) colours via 4 bit RGBA
|
||||
Colour-code that supports 65535 opaque or semi-transparent colours via 4 bit RGBA
|
||||
|
||||
За миг бях в чужд плюшен скърцащ фотьойл (Bulgarian)
|
||||
Љубазни фењерџија чађавог лица хоће да ми покаже штос (Serbian)
|
||||
Гномът Доцьо приключи спящ в шейна за жаби (Bulgarian)
|
||||
Љубазни фењерџија чађавог лица хоће да ми покаже штос (Serbian)
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика (Russian)
|
||||
|
||||
Control characters to support Bulgarian and Serbian letter shapes on the fly
|
||||
|
||||
Binary file not shown.
@@ -129,6 +129,12 @@ class FontTestGDX : Game() {
|
||||
}
|
||||
|
||||
println("${font.noColorCode}\nEND")
|
||||
|
||||
println(font.charsetOverrideNormal)
|
||||
println(font.charsetOverrideBulgarian)
|
||||
println(font.charsetOverrideSerbian)
|
||||
println(font.noColorCode)
|
||||
println(font.toColorCode(0xFFFF))
|
||||
}
|
||||
|
||||
override fun getScreen(): Screen? {
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 120 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 120 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 380 KiB After Width: | Height: | Size: 380 KiB |
@@ -128,10 +128,12 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
private fun isArmenian(c: Char) = c.toInt() in codeRange[SHEET_HAYEREN_VARW]
|
||||
private fun isKartvelian(c: Char) = c.toInt() in codeRange[SHEET_KARTULI_VARW]
|
||||
private fun isIPA(c: Char) = c.toInt() in codeRange[SHEET_IPA_VARW]
|
||||
private fun isColourCodeHigh(c: Char) = c.toInt() in 0b110110_1111000000..0b110110_1111111111 // only works with JVM (which uses UTF-16 internally)
|
||||
private fun isColourCodeLow(c: Char) = c.toInt() in 0b110111_0000000000..0b110111_1111111111 // only works with JVM (which uses UTF-16 internally)
|
||||
private fun isColourCodeHigh(c: Char) = c.toInt() in 0xDC00..0xDFFF // only works with JVM (which uses UTF-16 internally)
|
||||
private fun isColourCodeLow(c: Char) = c.toInt() in 0xDBC0..0xDBFF // only works with JVM (which uses UTF-16 internally)
|
||||
private fun isLatinExtAdd(c: Char) = c.toInt() in 0x1E00..0x1EFF
|
||||
|
||||
private fun isCharsetOverrideHigh(c: Char) = c.toInt() in 0xDFF8..0xDFFF // only works with JVM (which uses UTF-16 internally)
|
||||
private fun isCharsetOverrideLow(c: Char) = c.toInt() == 0xDBBF // only works with JVM (which uses UTF-16 internally)
|
||||
private fun isBulgarian(c: Char) = c.toInt() in 0x400..0x45F
|
||||
|
||||
|
||||
private fun extAindexX(c: Char) = (c.toInt() - 0x100) % 16
|
||||
@@ -217,7 +219,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
SHEET_HAYEREN_VARW,
|
||||
SHEET_KARTULI_VARW,
|
||||
SHEET_IPA_VARW,
|
||||
SHEET_LATIN_EXT_ADD
|
||||
SHEET_LATIN_EXT_ADD_VARW,
|
||||
SHEET_BULGARIAN_VARW,
|
||||
SHEET_SERBIAN_VARW
|
||||
)
|
||||
|
||||
private val fontParentDir = if (fontDir.endsWith('/') || fontDir.endsWith('\\')) fontDir else "$fontDir/"
|
||||
@@ -239,10 +243,10 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
"ipa_ext_variable.tga",
|
||||
"futhark.tga",
|
||||
"latinExt_additional_variable.tga",
|
||||
"puae000-e0ff.tga"
|
||||
"puae000-e0ff.tga",
|
||||
"cyrilic_bulgarian_variable.tga",
|
||||
"cyrilic_serbian_variable.tga"
|
||||
)
|
||||
private val cyrilic_bg = "cyrilic_bulgarian_variable.tga"
|
||||
private val cyrilic_sr = "cyrilic_serbian_variable.tga"
|
||||
private val codeRange = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!!
|
||||
0..0xFF,
|
||||
0xAC00..0xD7A3,
|
||||
@@ -261,11 +265,14 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
0x250..0x2AF,
|
||||
0x16A0..0x16FF,
|
||||
0x1E00..0x1EFF,
|
||||
0xE000..0xE0FF
|
||||
0xE000..0xE0FF,
|
||||
0xF00000..0xF0005F, // assign them to PUA
|
||||
0xF00060..0xF000BF // assign them to PUA
|
||||
)
|
||||
private val glyphWidths: HashMap<Int, Int> = HashMap() // if the value is negative, it's diacritics
|
||||
private val sheets: Array<TextureRegionPack>
|
||||
|
||||
private var charsetOverride = 0
|
||||
|
||||
init {
|
||||
val sheetsPack = ArrayList<TextureRegionPack>()
|
||||
@@ -351,34 +358,6 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
sheets = sheetsPack.toTypedArray()
|
||||
}
|
||||
|
||||
private var localeBuffer = ""
|
||||
|
||||
fun reload(locale: String) {
|
||||
if (!localeBuffer.startsWith("ru") && locale.startsWith("ru")) {
|
||||
val pixmap = Pixmap(Gdx.files.internal(fontParentDir + fileList[SHEET_CYRILIC_VARW]))
|
||||
val texture = Texture(pixmap)
|
||||
sheets[SHEET_CYRILIC_VARW].dispose()
|
||||
sheets[SHEET_CYRILIC_VARW] = TextureRegionPack(texture, W_VAR_INIT, H, HGAP_VAR, 0)
|
||||
pixmap.dispose()
|
||||
}
|
||||
else if (!localeBuffer.startsWith("bg") && locale.startsWith("bg")) {
|
||||
val pixmap = Pixmap(Gdx.files.internal(fontParentDir + cyrilic_bg))
|
||||
val texture = Texture(pixmap)
|
||||
sheets[SHEET_CYRILIC_VARW].dispose()
|
||||
sheets[SHEET_CYRILIC_VARW] = TextureRegionPack(texture, W_VAR_INIT, H, HGAP_VAR, 0)
|
||||
pixmap.dispose()
|
||||
}
|
||||
else if (!localeBuffer.startsWith("sr") && locale.startsWith("sr")) {
|
||||
val pixmap = Pixmap(Gdx.files.internal(fontParentDir + cyrilic_sr))
|
||||
val texture = Texture(pixmap)
|
||||
sheets[SHEET_CYRILIC_VARW].dispose()
|
||||
sheets[SHEET_CYRILIC_VARW] = TextureRegionPack(texture, W_VAR_INIT, H, HGAP_VAR, 0)
|
||||
pixmap.dispose()
|
||||
}
|
||||
|
||||
localeBuffer = locale
|
||||
}
|
||||
|
||||
override fun getLineHeight(): Float = H.toFloat()
|
||||
|
||||
override fun getXHeight() = lineHeight
|
||||
@@ -452,7 +431,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
|
||||
//println("[TerrarumSansBitmap] sprite: $sheetID:${sheetX}x${sheetY}")
|
||||
|
||||
if (isColourCodeHigh(c)) {
|
||||
if (isColourCodeLow(c)) {
|
||||
val cchigh = c
|
||||
val cclow = textBuffer[index + 1]
|
||||
|
||||
@@ -467,8 +446,16 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
|
||||
index += 1
|
||||
}
|
||||
else if (isColourCodeLow(c)) {
|
||||
throw Error("Unexpected encounter of ColourCodeLow at index $index of String '$textBuffer'")
|
||||
else if (isCharsetOverrideLow(c)) {
|
||||
val cchigh = c
|
||||
val cclow = textBuffer[index + 1]
|
||||
|
||||
charsetOverride = Character.toCodePoint(cchigh, cclow) - CHARSET_OVERRIDE_NULL
|
||||
|
||||
index += 1
|
||||
}
|
||||
else if (isCharsetOverrideHigh(c) || isColourCodeHigh(c)) {
|
||||
/* do nothing and advance */
|
||||
}
|
||||
else if (sheetID == SHEET_HANGUL) {
|
||||
val hangulSheet = sheets[SHEET_HANGUL]
|
||||
@@ -596,7 +583,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
|
||||
len[i] = glyphWidths[chr.toInt()]!!
|
||||
}
|
||||
else if (isColourCodeHigh(chr) || isColourCodeLow(chr))
|
||||
else if (isColourCodeHigh(chr) || isColourCodeLow(chr) || isCharsetOverrideHigh(chr) || isCharsetOverrideLow(chr))
|
||||
len[i] = 0
|
||||
else if (ctype == SHEET_CJK_PUNCT)
|
||||
len[i] = W_ASIAN_PUNCT
|
||||
@@ -619,7 +606,11 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
}
|
||||
|
||||
private fun getSheetType(c: Char): Int {
|
||||
if (isHangul(c))
|
||||
if (charsetOverride == 1 && isBulgarian(c))
|
||||
return SHEET_BULGARIAN_VARW
|
||||
else if (charsetOverride == 2 && isBulgarian(c))
|
||||
return SHEET_SERBIAN_VARW
|
||||
else if (isHangul(c))
|
||||
return SHEET_HANGUL
|
||||
else if (isKana(c))
|
||||
return SHEET_KANA
|
||||
@@ -654,7 +645,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
else if (isRunic(c))
|
||||
return SHEET_RUNIC
|
||||
else if (isLatinExtAdd(c))
|
||||
return SHEET_LATIN_EXT_ADD
|
||||
return SHEET_LATIN_EXT_ADD_VARW
|
||||
else
|
||||
return SHEET_UNKNOWN
|
||||
// fixed width
|
||||
@@ -724,10 +715,14 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
sheetX = runicIndexX(ch)
|
||||
sheetY = runicIndexY(ch)
|
||||
}
|
||||
SHEET_LATIN_EXT_ADD -> {
|
||||
SHEET_LATIN_EXT_ADD_VARW -> {
|
||||
sheetX = latinExtAddX(ch)
|
||||
sheetY = latinExtAddY(ch)
|
||||
}
|
||||
SHEET_BULGARIAN_VARW, SHEET_SERBIAN_VARW -> { // expects Unicode charpoint, NOT an internal one
|
||||
sheetX = cyrilicIndexX(ch)
|
||||
sheetY = cyrilicIndexY(ch)
|
||||
}
|
||||
else -> {
|
||||
sheetX = ch.toInt() % 16
|
||||
sheetY = ch.toInt() / 16
|
||||
@@ -786,6 +781,10 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
fun toColorCode(r: Int, g: Int, b: Int, a: Int = 0x0F): String = toColorCode(r.shl(12) or g.shl(8) or b.shl(4) or a)
|
||||
val noColorCode = toColorCode(0x0000)
|
||||
|
||||
val charsetOverrideNormal = Character.toChars(CHARSET_OVERRIDE_NULL)
|
||||
val charsetOverrideBulgarian = Character.toChars(CHARSET_OVERRIDE_BG_BG)
|
||||
val charsetOverrideSerbian = Character.toChars(CHARSET_OVERRIDE_SR_SR)
|
||||
|
||||
companion object {
|
||||
internal val JUNG_COUNT = 21
|
||||
internal val JONG_COUNT = 28
|
||||
@@ -820,15 +819,21 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
internal val SHEET_KARTULI_VARW = 13
|
||||
internal val SHEET_IPA_VARW = 14
|
||||
internal val SHEET_RUNIC = 15
|
||||
internal val SHEET_LATIN_EXT_ADD = 16
|
||||
internal val SHEET_LATIN_EXT_ADD_VARW= 16
|
||||
internal val SHEET_CUSTOM_SYM = 17
|
||||
internal val SHEET_BULGARIAN_VARW = 18
|
||||
internal val SHEET_SERBIAN_VARW = 19
|
||||
|
||||
internal val SHEET_UNKNOWN = 254
|
||||
|
||||
internal val CHARSET_OVERRIDE_NULL = 0xFFFF8
|
||||
internal val CHARSET_OVERRIDE_BG_BG = 0xFFFF9
|
||||
internal val CHARSET_OVERRIDE_SR_SR = 0xFFFFA
|
||||
|
||||
fun charsetOverrideNormal() = Character.toChars( 0xFFFF8)
|
||||
fun charsetOverrideBulgarian() = Character.toChars( 0xFFFF9)
|
||||
fun charsetOverrideSerbian() = Character.toChars( 0xFFFFA)
|
||||
|
||||
val charsetOverrideNormal = Character.toChars(CHARSET_OVERRIDE_NULL)
|
||||
val charsetOverrideBulgarian = Character.toChars(CHARSET_OVERRIDE_BG_BG)
|
||||
val charsetOverrideSerbian = Character.toChars(CHARSET_OVERRIDE_SR_SR)
|
||||
fun toColorCode(rgba4444: Int): String = Character.toChars(0x100000 + rgba4444).toColCode()
|
||||
fun toColorCode(r: Int, g: Int, b: Int, a: Int = 0x0F): String = toColorCode(r.shl(12) or g.shl(8) or b.shl(4) or a)
|
||||
private fun CharArray.toColCode(): String = "${this[0]}${this[1]}"
|
||||
|
||||
@@ -55,7 +55,7 @@ import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_IPA_VARW
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_CUSTOM_SYM
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_UNKNOWN
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_RUNIC
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_LATIN_EXT_ADD
|
||||
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_LATIN_EXT_ADD_VARW
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.Font
|
||||
import org.newdawn.slick.Image
|
||||
@@ -244,7 +244,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
|
||||
SHEET_HAYEREN_VARW,
|
||||
SHEET_KARTULI_VARW,
|
||||
SHEET_IPA_VARW,
|
||||
SHEET_LATIN_EXT_ADD
|
||||
SHEET_LATIN_EXT_ADD_VARW
|
||||
)
|
||||
|
||||
private val fontParentDir = if (fontDir.endsWith('/') || fontDir.endsWith('\\')) fontDir else "$fontDir/"
|
||||
@@ -648,7 +648,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
|
||||
else if (isRunic(c))
|
||||
return SHEET_RUNIC
|
||||
else if (isLatinExtAdd(c))
|
||||
return SHEET_LATIN_EXT_ADD
|
||||
return SHEET_LATIN_EXT_ADD_VARW
|
||||
else
|
||||
return SHEET_UNKNOWN
|
||||
// fixed width
|
||||
@@ -718,7 +718,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
|
||||
sheetX = runicIndexX(ch)
|
||||
sheetY = runicIndexY(ch)
|
||||
}
|
||||
SHEET_LATIN_EXT_ADD -> {
|
||||
SHEET_LATIN_EXT_ADD_VARW -> {
|
||||
sheetX = latinExtAddX(ch)
|
||||
sheetY = latinExtAddY(ch)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user