Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b764aedb0c | ||
|
|
bfd648b34f | ||
|
|
8033d749c2 | ||
|
|
ddf2e28901 | ||
|
|
0e7e6ab934 | ||
|
|
f8da7923aa | ||
|
|
d3e58b823d | ||
|
|
f0ab3d0d79 | ||
|
|
316cb10ece | ||
|
|
f6f27986b2 | ||
|
|
5123218d6b | ||
|
|
3d4f430a6d | ||
|
|
bf13e341a4 | ||
|
|
26ca34ecde | ||
|
|
1689e39f6f | ||
|
|
ccc7be93f2 | ||
|
|
d603de9c69 | ||
|
|
f05c39b687 | ||
|
|
98ee3c97f8 | ||
|
|
db7c41e12a | ||
|
|
e75c81c071 | ||
|
|
9f8767f2b8 | ||
|
|
3fbc36a3e4 |
@@ -19,6 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
WenQuanYi font is distributed under GNU GPL Version 2. See their [license document here](http://wenq.org/wqy2/index.cgi?GPL)
|
||||
|
||||
30
README.md
@@ -4,7 +4,11 @@
|
||||
|
||||

|
||||
|
||||
This font is a bitmap font used in my game project, Terrarum (hence the name). It Supports ExtA, Romanian (subset of ExtB), Cyrillic (Russian, Bulgarian, Serbian), Greek, Chinese, Japanese and Korean.
|
||||
(note—you can't display Bulgarian and Russian glyphs at the same time, you must ```reload()``` them upon the change of locale of your game)
|
||||
|
||||
**Font demo** — head to the **[Release](https://github.com/minjaesong/Terrarum-sans-bitmap/releases)** tab
|
||||
|
||||
This font is a bitmap font used in [my game project called Terrarum](https://gitlab.com/minjaesong/terrarum) (hence the name). The font supports more than 90 % of european languages, as well as Chinese, Japanese and Korean. More technical side, it supports Latin-1 Supplement, Latin Ext-A, Latin Ext-B, Cyrillic (Russian, Bulgarian, Serbian), Greek, Chinese (limited to Unicode BMP), Japanese, Korean (all 11 172 possible syllables).
|
||||
|
||||
The code for the fonts are meant to be used with Slick2d (extends ```Font``` class). If you are not using the framework, please refer to the __Font metrics__ section to implement the font metrics correctly on your system.
|
||||
|
||||
@@ -13,20 +17,20 @@ The issue page is open. If you have some issues to submit, or have a question, p
|
||||
|
||||
## Contribution guidelines
|
||||
|
||||
You can contribute to the font by fixing wrong glyphs, suggesting better ones, extending character set (like Latin Extended B), or code for other game frameworks such as LibGDX. Please leave pull request for that.
|
||||
You can contribute to the font by fixing wrong glyphs, suggesting better ones, extending character set (like Georgian and Thai), or code for other game frameworks such as LibGDX. Please leave pull request for that.
|
||||
|
||||
Font images are stored in ```assets/graphics/fonts``` directory. Image format must be TGA with Alpha — no PNG. If someone needs PNG, they can batch-convert the font using utils like ImageMagick.
|
||||
Font Spritesheets are stored in ```assets/graphics/fonts``` directory. Image format must be TGA with Alpha — no PNG. If someone needs PNG, they can batch-convert the font using utils like ImageMagick.
|
||||
|
||||
|
||||
## Using on Slick2d
|
||||
|
||||
On your code (Kotlin):
|
||||
|
||||
class YourGame {
|
||||
class YourGame : BasicGame("YourGameName") {
|
||||
|
||||
lateinit var fontGame: Font
|
||||
|
||||
override fun initStatesList(gc: GameContainer) {
|
||||
override fun init(gc: GameContainer) {
|
||||
fontGame = GameFontImpl()
|
||||
...
|
||||
}
|
||||
@@ -39,16 +43,16 @@ On your code (Kotlin):
|
||||
|
||||
On your code (Java):
|
||||
|
||||
class YourGame {
|
||||
class YourGame extends BasicGame {
|
||||
|
||||
Font fontGame;
|
||||
|
||||
void initStatesList(GameContainer gc) {
|
||||
@Override void init(GameContainer gc) {
|
||||
fontGame = new GameFontImpl();
|
||||
...
|
||||
}
|
||||
|
||||
void render(GameContainer gc, Graphics g) {
|
||||
@Override void render(GameContainer gc, Graphics g) {
|
||||
g.setFont(fontGame);
|
||||
g.drawString(...);
|
||||
}
|
||||
@@ -56,11 +60,11 @@ On your code (Java):
|
||||
|
||||
## Font metrics
|
||||
|
||||
The font expects both variable widths and fixed width to be supported. Any images with ```_variable``` means it expects variable widths. Anything else expects fixed width. ```romana_narrow``` has width of 6 (no, not 5), ```romana_wide``` has width of 9, ```cjkpunct``` has width of 10, ```kana``` has width of 12, ```hangul_johab``` has width of 11, ```wenquanyi``` has width of 16.
|
||||
Although the font is basically a Spritesheet, some of the sheet expects variable widths to be supported. Any sheets with ```_variable``` means it expects variable widths. Anything else expects fixed width (regular Spritesheet behaviour). ```cjkpunct``` has width of 10, ```kana``` has width of 12, ```hangul_johab``` has width of 11, ```wenquanyi``` has width of 16.
|
||||
|
||||
### Parsing glyph widths for variable font sheets
|
||||
|
||||
Width is encoded in binary number, on pixels. On the font image, every glyph has vertical dots on their right side (to be exact, every (16k - 1)th pixel on x axis). From top to bottom, each dot represents 1, 2, 4 and 8. For example, ASCII glyph 'C' has width of 9, 'W' has width of 11, " (double quote) has width of 6.
|
||||
Width is encoded in binary number, on pixels. On the font spritesheet, every glyph has vertical dots on their right side (to be exact, every (16k - 1)th pixel on x axis). From top to bottom, each dot represents 1, 2, 4 and 8. For example, ASCII glyph 'C' has width of 9, 'W' has width of 11, " (double quote) has width of 6.
|
||||
|
||||
### Implementing the Korean writing system
|
||||
|
||||
@@ -68,6 +72,10 @@ On this font, Hangul letters are printed by assemblying two or three letter piec
|
||||
|
||||
This is a Kotlin-like pseudocode for assembling the glyph:
|
||||
|
||||
function getHanChosung(hanIndex: Int) = hanIndex / (21 * 28)
|
||||
function getHanJungseong(hanIndex: Int) = hanIndex / 28 % 21
|
||||
function getHanJongseong(hanIndex: Int) = hanIndex % 28
|
||||
|
||||
jungseongWide = arrayOf(8, 12, 13, 17, 18, 21)
|
||||
jungseongComplex = arrayOf(9, 10, 11, 14, 15, 16, 22)
|
||||
|
||||
@@ -143,3 +151,5 @@ This is a Kotlin-like pseudocode for assembling the glyph:
|
||||
## Acknowledgement
|
||||
|
||||
Thanks to kind people of [/r/Typography](https://www.reddit.com/r/typography/) for amazing feedbacks.
|
||||
|
||||
CJK Ideographs are powered by [WenQuanYi Font](http://wenq.org/wqy2/index.cgi?BitmapSong). The font is distributed under the GNU GPL version 2. Although the glyphs themselves are not copyrightable (the program codes—e.g. TTF—do), we would like to give a credit for the font and the people behind it.
|
||||
|
||||
@@ -54,26 +54,32 @@ open class GameFontBase : Font {
|
||||
9
|
||||
}
|
||||
|
||||
private fun isHangul(c: Char) = c.toInt() >= 0xAC00 && c.toInt() < 0xD7A4
|
||||
private fun isAscii(c: Char) = c.toInt() >= 0x20 && c.toInt() <= 0xFF
|
||||
private fun isExtA(c: Char) = c.toInt() >= 0x100 && c.toInt() < 0x180
|
||||
private fun isKana(c: Char) = c.toInt() >= 0x3040 && c.toInt() < 0x3100
|
||||
private fun isCJKPunct(c: Char) = c.toInt() >= 0x3000 && c.toInt() < 0x3040
|
||||
private fun isUniHan(c: Char) = c.toInt() >= 0x3400 && c.toInt() < 0xA000
|
||||
private fun isCyrilic(c: Char) = c.toInt() >= 0x400 && c.toInt() < 0x460
|
||||
private fun isFullwidthUni(c: Char) = c.toInt() >= 0xFF00 && c.toInt() < 0xFF20
|
||||
private fun isUniPunct(c: Char) = c.toInt() >= 0x2000 && c.toInt() < 0x2070
|
||||
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 isRomanian(c: Char) = c.toInt() >= 0x218 && c.toInt() <= 0x21A
|
||||
private fun isRomanianNarrow(c: Char) = c.toInt() == 0x21B
|
||||
private fun isHangul(c: Char) = c.toInt() in 0xAC00..0xD7A3
|
||||
private fun isAscii(c: Char) = c.toInt() in 0x20..0xFF
|
||||
private fun isRunic(c: Char) = runicList.contains(c)
|
||||
private fun isExtA(c: Char) = c.toInt() in 0x100..0x17F
|
||||
private fun isExtB(c: Char) = c.toInt() in 0x180..0x24F
|
||||
private fun isKana(c: Char) = c.toInt() in 0x3040..0x30FF
|
||||
private fun isCJKPunct(c: Char) = c.toInt() in 0x3000..0x303F
|
||||
private fun isUniHan(c: Char) = c.toInt() in 0x3400..0x9FFF
|
||||
private fun isCyrilic(c: Char) = c.toInt() in 0x400..0x45F
|
||||
private fun isFullwidthUni(c: Char) = c.toInt() in 0xFF00..0xFF1F
|
||||
private fun isUniPunct(c: Char) = c.toInt() in 0x2000..0x206F
|
||||
private fun isWenQuanYi1(c: Char) = c.toInt() in 0x33F3..0x69FC
|
||||
private fun isWenQuanYi2(c: Char) = c.toInt() in 0x69FD..0x9FDC
|
||||
private fun isGreek(c: Char) = c.toInt() in 0x370..0x3CE
|
||||
|
||||
|
||||
|
||||
private fun extAindexX(c: Char) = (c.toInt() - 0x100) % 16
|
||||
private fun extAindexY(c: Char) = (c.toInt() - 0x100) / 16
|
||||
|
||||
private fun extBindexX(c: Char) = (c.toInt() - 0x180) % 16
|
||||
private fun extBindexY(c: Char) = (c.toInt() - 0x180) / 16
|
||||
|
||||
private fun runicIndexX(c: Char) = runicList.indexOf(c) % 16
|
||||
private fun runicIndexY(c: Char) = runicList.indexOf(c) / 16
|
||||
|
||||
private fun kanaIndexX(c: Char) = (c.toInt() - 0x3040) % 16
|
||||
private fun kanaIndexY(c: Char) = (c.toInt() - 0x3040) / 16
|
||||
|
||||
@@ -100,19 +106,6 @@ open class GameFontBase : Font {
|
||||
private fun greekIndexX(c: Char) = (c.toInt() - 0x370) % 16
|
||||
private fun greekIndexY(c: Char) = (c.toInt() - 0x370) / 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 thaiNarrowIndexX(c: Char) = 3
|
||||
private fun thaiNarrowIndexY(c: Char) = 0
|
||||
|
||||
|
||||
private val narrowWidthSheets = arrayOf(
|
||||
SHEET_EXTB_ROMANIAN_NARROW
|
||||
)
|
||||
private val unihanWidthSheets = arrayOf(
|
||||
SHEET_UNIHAN,
|
||||
SHEET_FW_UNI,
|
||||
@@ -126,7 +119,8 @@ open class GameFontBase : Font {
|
||||
SHEET_ASCII_VARW,
|
||||
SHEET_CYRILIC_VARW,
|
||||
SHEET_EXTA_VARW,
|
||||
SHEET_GREEK_VARW
|
||||
SHEET_GREEK_VARW,
|
||||
SHEET_EXTB_VARW
|
||||
)
|
||||
|
||||
|
||||
@@ -138,21 +132,18 @@ open class GameFontBase : Font {
|
||||
val chr = s[i]
|
||||
val ctype = getSheetType(s[i])
|
||||
|
||||
if (chr.toInt() == 0x21B) // Romanian t; HAX!
|
||||
len += 6
|
||||
else if (variableWidthSheets.contains(ctype)) {
|
||||
try {
|
||||
len += asciiWidths[chr.toInt()]!!
|
||||
if (variableWidthSheets.contains(ctype)) {
|
||||
len += try {
|
||||
asciiWidths[chr.toInt()]!!
|
||||
}
|
||||
catch (e: kotlin.KotlinNullPointerException) {
|
||||
println("KotlinNullPointerException on glyph number ${Integer.toHexString(chr.toInt()).toUpperCase()}")
|
||||
System.exit(1)
|
||||
//System.exit(1)
|
||||
W_LATIN_WIDE // failsafe
|
||||
}
|
||||
}
|
||||
else if (zeroWidthSheets.contains(ctype))
|
||||
len += 0
|
||||
else if (narrowWidthSheets.contains(ctype))
|
||||
len += W_LATIN_NARROW
|
||||
else if (ctype == SHEET_CJK_PUNCT)
|
||||
len += W_ASIAN_PUNCT
|
||||
else if (ctype == SHEET_HANGUL)
|
||||
@@ -188,6 +179,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (isHangul(ch)) {
|
||||
val hIndex = ch.toInt() - 0xAC00
|
||||
|
||||
@@ -203,17 +199,17 @@ open class GameFontBase : Font {
|
||||
|
||||
hangulSheet.getSubImage(indexCho, choRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
@@ -246,6 +242,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (isWenQuanYi1(ch)) {
|
||||
val glyphW = getWidth("" + ch)
|
||||
wenQuanYi_1.getSubImage(wenQuanYiIndexX(ch), wenQuanYi1IndexY(ch)).drawWithShadow(
|
||||
@@ -263,6 +264,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (isWenQuanYi2(ch)) {
|
||||
val glyphW = getWidth("" + ch)
|
||||
wenQuanYi_2.getSubImage(wenQuanYiIndexX(ch), wenQuanYi2IndexY(ch)).drawWithShadow(
|
||||
@@ -280,6 +286,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (!isHangul(ch) && !isUniHan(ch)) {
|
||||
|
||||
// if not init, endUse first
|
||||
@@ -296,6 +307,10 @@ open class GameFontBase : Font {
|
||||
sheetX = extAindexX(ch)
|
||||
sheetY = extAindexY(ch)
|
||||
}
|
||||
SHEET_EXTB_VARW -> {
|
||||
sheetX = extBindexX(ch)
|
||||
sheetY = extBindexY(ch)
|
||||
}
|
||||
SHEET_KANA -> {
|
||||
sheetX = kanaIndexX(ch)
|
||||
sheetY = kanaIndexY(ch)
|
||||
@@ -320,14 +335,6 @@ open class GameFontBase : Font {
|
||||
sheetX = greekIndexX(ch)
|
||||
sheetY = greekIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_WIDE -> {
|
||||
sheetX = romanianIndexX(ch)
|
||||
sheetY = romanianIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_NARROW -> {
|
||||
sheetX = 0
|
||||
sheetY = 0
|
||||
}
|
||||
else -> {
|
||||
sheetX = ch.toInt() % 16
|
||||
sheetY = ch.toInt() / 16
|
||||
@@ -338,12 +345,7 @@ open class GameFontBase : Font {
|
||||
try {
|
||||
sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
|
||||
// to deal with the height difference of the sheets
|
||||
Math.round(y).toFloat() + (if (prevInstance == SHEET_CJK_PUNCT) -1 // height hack
|
||||
else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2 // completely legit height adjustment
|
||||
else 0).toFloat(),
|
||||
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
@@ -365,10 +367,7 @@ open class GameFontBase : Font {
|
||||
}
|
||||
|
||||
private fun getSheetType(c: Char): Int {
|
||||
// EFs
|
||||
if (isRomanianNarrow(c))
|
||||
return SHEET_EXTB_ROMANIAN_NARROW
|
||||
else if (isHangul(c))
|
||||
if (isHangul(c))
|
||||
return SHEET_HANGUL
|
||||
else if (isKana(c))
|
||||
return SHEET_KANA
|
||||
@@ -378,6 +377,8 @@ open class GameFontBase : Font {
|
||||
return SHEET_ASCII_VARW
|
||||
else if (isExtA(c))
|
||||
return SHEET_EXTA_VARW
|
||||
else if (isExtB(c))
|
||||
return SHEET_EXTB_VARW
|
||||
else if (isCyrilic(c))
|
||||
return SHEET_CYRILIC_VARW
|
||||
else if (isUniPunct(c))
|
||||
@@ -388,8 +389,8 @@ open class GameFontBase : Font {
|
||||
return SHEET_FW_UNI
|
||||
else if (isGreek(c))
|
||||
return SHEET_GREEK_VARW
|
||||
else if (isRomanian(c))
|
||||
return SHEET_EXTB_ROMANIAN_WIDE
|
||||
else if (c.isColourCode())
|
||||
return SHEET_COLOURCODE
|
||||
else
|
||||
return SHEET_UNKNOWN// fixed width punctuations
|
||||
// fixed width
|
||||
@@ -418,6 +419,8 @@ open class GameFontBase : Font {
|
||||
drawString(x + xoff, y, printedBody, color)
|
||||
}
|
||||
|
||||
fun Char.isColourCode() = colourKey.containsKey(this)
|
||||
|
||||
fun buildWidthTable(sheet: SpriteSheet, codeOffset: Int, codeRange: IntRange, rows: Int = 16) {
|
||||
fun Byte.toUint() = java.lang.Byte.toUnsignedInt(this)
|
||||
|
||||
@@ -483,6 +486,7 @@ open class GameFontBase : Font {
|
||||
internal val asciiWidths: HashMap<Int, Int> = HashMap()
|
||||
|
||||
lateinit internal var extASheet: SpriteSheet
|
||||
lateinit internal var extBSheet: SpriteSheet
|
||||
lateinit internal var kanaSheet: SpriteSheet
|
||||
lateinit internal var cjkPunct: SpriteSheet
|
||||
// static SpriteSheet uniHan;
|
||||
@@ -492,8 +496,6 @@ open class GameFontBase : Font {
|
||||
lateinit internal var wenQuanYi_1: SpriteSheet
|
||||
lateinit internal var wenQuanYi_2: SpriteSheet
|
||||
lateinit internal var greekSheet: SpriteSheet
|
||||
lateinit internal var romanianSheet: SpriteSheet
|
||||
lateinit internal var romanianSheetNarrow: SpriteSheet
|
||||
|
||||
internal val JUNG_COUNT = 21
|
||||
internal val JONG_COUNT = 28
|
||||
@@ -502,34 +504,49 @@ open class GameFontBase : Font {
|
||||
internal val W_HANGUL = 11
|
||||
internal val W_KANA = 12
|
||||
internal val W_UNIHAN = 16
|
||||
internal val W_LATIN_WIDE = 9 // width of regular letters, including m
|
||||
internal val W_LATIN_NARROW = 5 // width of letter f, t, i, l
|
||||
internal val W_LATIN_WIDE = 9 // width of regular letters
|
||||
|
||||
internal val H = 20
|
||||
internal val H_HANGUL = 16
|
||||
internal val H_UNIHAN = 16
|
||||
internal val H_KANA = 20
|
||||
|
||||
internal val SHEET_ASCII_VARW = 0
|
||||
internal val SHEET_HANGUL = 1
|
||||
internal val SHEET_EXTA_VARW = 2
|
||||
internal val SHEET_KANA = 3
|
||||
internal val SHEET_CJK_PUNCT = 4
|
||||
internal val SHEET_UNIHAN = 5
|
||||
internal val SHEET_CYRILIC_VARW = 6
|
||||
internal val SHEET_FW_UNI = 7
|
||||
internal val SHEET_UNI_PUNCT = 8
|
||||
internal val SHEET_WENQUANYI_1 = 9
|
||||
internal val SHEET_WENQUANYI_2 = 10
|
||||
internal val SHEET_GREEK_VARW = 11
|
||||
internal val SHEET_EXTB_ROMANIAN_WIDE = 12
|
||||
internal val SHEET_EXTB_ROMANIAN_NARROW = 13
|
||||
internal val SHEET_EXTA_VARW = 3
|
||||
internal val SHEET_EXTB_VARW = 4
|
||||
internal val SHEET_KANA = 5
|
||||
internal val SHEET_CJK_PUNCT = 6
|
||||
internal val SHEET_UNIHAN = 7
|
||||
internal val SHEET_CYRILIC_VARW = 8
|
||||
internal val SHEET_FW_UNI = 9
|
||||
internal val SHEET_UNI_PUNCT = 10
|
||||
internal val SHEET_WENQUANYI_1 = 11
|
||||
internal val SHEET_WENQUANYI_2 = 12
|
||||
internal val SHEET_GREEK_VARW = 13
|
||||
|
||||
|
||||
internal val SHEET_UNKNOWN = 254
|
||||
internal val SHEET_COLOURCODE = 255
|
||||
|
||||
lateinit internal var sheetKey: Array<SpriteSheet?>
|
||||
|
||||
/**
|
||||
* Runic letters list used for game. The set is
|
||||
* Younger Futhark + Medieval rune 'e' + Punct + Runic Almanac
|
||||
|
||||
* BEWARE OF SIMILAR-LOOKING RUNES, especially:
|
||||
|
||||
* * Algiz ᛉ instead of Maðr ᛘ
|
||||
|
||||
* * Short-Twig Hagall ᚽ instead of Runic Letter E ᛂ
|
||||
|
||||
* * Runic Letter OE ᚯ instead of Óss ᚬ
|
||||
|
||||
* Examples:
|
||||
* ᛭ᛋᛁᚴᚱᛁᚦᛦ᛭
|
||||
* ᛭ᛂᛚᛋᛅ᛭ᛏᚱᚢᛏᚾᛁᚾᚴᚢᚾᛅ᛬ᛅᚱᚾᛅᛏᛅᛚᛋ
|
||||
*/
|
||||
internal val runicList = arrayOf('ᚠ', 'ᚢ', 'ᚦ', 'ᚬ', 'ᚱ', 'ᚴ', 'ᚼ', 'ᚾ', 'ᛁ', 'ᛅ', 'ᛋ', 'ᛏ', 'ᛒ', 'ᛘ', 'ᛚ', 'ᛦ', 'ᛂ', '᛬', '᛫', '᛭', 'ᛮ', 'ᛯ', 'ᛰ')
|
||||
|
||||
internal var interchar = 0
|
||||
internal var scale = 1
|
||||
set(value) {
|
||||
@@ -537,6 +554,49 @@ open class GameFontBase : Font {
|
||||
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
|
||||
}
|
||||
|
||||
val colourKey = hashMapOf(
|
||||
Pair(0x10.toChar(), Color(0xFFFFFF)), //*w hite
|
||||
Pair(0x11.toChar(), Color(0xFFE080)), //*y ellow
|
||||
Pair(0x12.toChar(), Color(0xFFB020)), //o range
|
||||
Pair(0x13.toChar(), Color(0xFF8080)), //*r ed
|
||||
Pair(0x14.toChar(), Color(0xFFA0E0)), //f uchsia
|
||||
Pair(0x15.toChar(), Color(0xE0A0FF)), //*m agenta (purple)
|
||||
Pair(0x16.toChar(), Color(0x8080FF)), //*b lue
|
||||
Pair(0x17.toChar(), Color(0x80FFFF)), //c yan
|
||||
Pair(0x18.toChar(), Color(0x80FF80)), //*g reen
|
||||
Pair(0x19.toChar(), Color(0x008000)), //v iridian
|
||||
Pair(0x1A.toChar(), Color(0x805030)), //x (khaki)
|
||||
Pair(0x1B.toChar(), Color(0x808080)) //*k
|
||||
//* marked: commonly used
|
||||
)
|
||||
val colToCode = hashMapOf(
|
||||
Pair("w", 0x10.toChar()),
|
||||
Pair("y", 0x11.toChar()),
|
||||
Pair("o", 0x12.toChar()),
|
||||
Pair("r", 0x13.toChar()),
|
||||
Pair("f", 0x14.toChar()),
|
||||
Pair("m", 0x15.toChar()),
|
||||
Pair("b", 0x16.toChar()),
|
||||
Pair("c", 0x17.toChar()),
|
||||
Pair("g", 0x18.toChar()),
|
||||
Pair("v", 0x19.toChar()),
|
||||
Pair("x", 0x1A.toChar()),
|
||||
Pair("k", 0x1B.toChar())
|
||||
)
|
||||
val codeToCol = hashMapOf(
|
||||
Pair("w", colourKey[0x10.toChar()]),
|
||||
Pair("y", colourKey[0x11.toChar()]),
|
||||
Pair("o", colourKey[0x12.toChar()]),
|
||||
Pair("r", colourKey[0x13.toChar()]),
|
||||
Pair("f", colourKey[0x14.toChar()]),
|
||||
Pair("m", colourKey[0x15.toChar()]),
|
||||
Pair("b", colourKey[0x16.toChar()]),
|
||||
Pair("c", colourKey[0x17.toChar()]),
|
||||
Pair("g", colourKey[0x18.toChar()]),
|
||||
Pair("v", colourKey[0x19.toChar()]),
|
||||
Pair("x", colourKey[0x1A.toChar()]),
|
||||
Pair("k", colourKey[0x1B.toChar()])
|
||||
)
|
||||
}// end of companion object
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,17 @@ class GameFontImpl : GameFontBase() {
|
||||
init {
|
||||
|
||||
GameFontBase.hangulSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H_HANGUL)
|
||||
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H)
|
||||
GameFontBase.asciiSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1)
|
||||
GameFontBase.extASheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/LatinExtA_variable.tga", 15, 19, 1)
|
||||
GameFontBase.extBSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/LatinExtB_variable.tga", 15, 19, 1)
|
||||
GameFontBase.kanaSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H_KANA)
|
||||
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H)
|
||||
GameFontBase.cjkPunct = SpriteSheet(
|
||||
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H_KANA)
|
||||
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H)
|
||||
/*uniHan = new SpriteSheet(
|
||||
"./assets/graphics/fonts/unifont_unihan"
|
||||
+ ((!terrarum.gameLocale.contains("zh"))
|
||||
@@ -43,15 +45,13 @@ class GameFontImpl : GameFontBase() {
|
||||
"./assets/graphics/fonts/wenquanyi_11pt_part2.tga", 16, 18, 2)
|
||||
GameFontBase.greekSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/greek_variable.tga", 15, 19, 1)
|
||||
GameFontBase.romanianSheet = SpriteSheet(
|
||||
"./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)
|
||||
|
||||
val shk = arrayOf(
|
||||
GameFontBase.asciiSheet,
|
||||
GameFontBase.hangulSheet,
|
||||
null, // here was customised runic sheet
|
||||
GameFontBase.extASheet,
|
||||
GameFontBase.extBSheet,
|
||||
GameFontBase.kanaSheet,
|
||||
GameFontBase.cjkPunct,
|
||||
null, // Full unihan, filler because we're using WenQuanYi
|
||||
@@ -60,16 +60,25 @@ class GameFontImpl : GameFontBase() {
|
||||
GameFontBase.uniPunct,
|
||||
GameFontBase.wenQuanYi_1,
|
||||
GameFontBase.wenQuanYi_2,
|
||||
GameFontBase.greekSheet,
|
||||
GameFontBase.romanianSheet,
|
||||
GameFontBase.romanianSheetNarrow
|
||||
GameFontBase.greekSheet
|
||||
)
|
||||
GameFontBase.sheetKey = shk
|
||||
|
||||
|
||||
buildWidthTable(asciiSheet, 0, 0..0xFF)
|
||||
buildWidthTable(extASheet, 0x100, 0..0x7F)
|
||||
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
||||
buildWidthTable(asciiSheet, 0, 0..0xFF)
|
||||
buildWidthTable(extASheet, 0x100, 0..0x7F)
|
||||
buildWidthTable(extBSheet, 0x180, 0..0xCF)
|
||||
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
||||
buildWidthTable(greekSheet, 0x370, 0..0x5F)
|
||||
}
|
||||
|
||||
fun reload() {
|
||||
GameFontBase.cyrilic.destroy()
|
||||
GameFontBase.cyrilic = SpriteSheet(
|
||||
when (GameFontDemo.gameLocale.substring(0..1)) {
|
||||
"bg" -> "./assets/graphics/fonts/cyrilic_bulgarian_variable.tga"
|
||||
"sr" -> "./assets/graphics/fonts/cyrilic_serbian_variable.tga"
|
||||
else -> "./assets/graphics/fonts/cyrilic_variable.tga"
|
||||
}, 15, 19, 1)
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
BIN
assets/graphics/fonts/LatinExtB_variable.tga
Normal file
|
After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 50 KiB After Width: | Height: | Size: 50 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 192 KiB After Width: | Height: | Size: 241 KiB |
|
Before Width: | Height: | Size: 180 KiB After Width: | Height: | Size: 180 KiB |
|
Before Width: | Height: | Size: 444 B |
|
Before Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
186
demo/.idea/workspace.xml
generated
@@ -23,11 +23,11 @@
|
||||
</component>
|
||||
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
|
||||
<component name="FileEditorManager">
|
||||
<leaf>
|
||||
<file leaf-file-name="GameFontDemo.kt" pinned="false" current-in-tab="true">
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="GameFontDemo.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="610">
|
||||
<state relative-caret-position="924">
|
||||
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
@@ -36,11 +36,11 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="400">
|
||||
<caret line="516" column="36" lean-forward="false" selection-start-line="516" selection-start-column="36" selection-end-line="516" selection-end-column="36" />
|
||||
<state relative-caret-position="409">
|
||||
<caret line="204" column="48" lean-forward="false" selection-start-line="204" selection-start-column="48" selection-end-line="204" selection-end-column="48" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -48,12 +48,14 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="config.properties" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/config.properties">
|
||||
<file leaf-file-name="GameFontImpl.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
|
||||
<folding />
|
||||
<state relative-caret-position="518">
|
||||
<caret line="37" column="41" lean-forward="false" selection-start-line="37" selection-start-column="41" selection-end-line="37" selection-end-column="41" />
|
||||
<folding>
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -61,25 +63,13 @@
|
||||
<file leaf-file-name="text.txt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/text.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="95" lean-forward="false" selection-start-line="0" selection-start-column="95" selection-end-line="0" selection-end-column="95" />
|
||||
<state relative-caret-position="252">
|
||||
<caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GameFontImpl.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="190">
|
||||
<caret line="29" column="0" lean-forward="false" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</component>
|
||||
<component name="FileTemplateManagerImpl">
|
||||
@@ -112,13 +102,13 @@
|
||||
<component name="IdeDocumentHistory">
|
||||
<option name="CHANGED_PATHS">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt" />
|
||||
<option value="$PROJECT_DIR$/text.properties" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/text.txt" />
|
||||
<option value="$PROJECT_DIR$/config.properties" />
|
||||
<option value="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt" />
|
||||
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt" />
|
||||
<option value="$PROJECT_DIR$/text.txt" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -143,6 +133,9 @@
|
||||
<foldersAlwaysOnTop value="true" />
|
||||
</navigator>
|
||||
<panes>
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="ProjectPane">
|
||||
<subPane>
|
||||
<PATH>
|
||||
@@ -189,9 +182,6 @@
|
||||
</PATH>
|
||||
</subPane>
|
||||
</pane>
|
||||
<pane id="PackagesPane" />
|
||||
<pane id="Scope" />
|
||||
<pane id="Scratches" />
|
||||
</panes>
|
||||
</component>
|
||||
<component name="PropertiesComponent">
|
||||
@@ -202,6 +192,18 @@
|
||||
<property name="project.structure.proportion" value="0.15" />
|
||||
<property name="project.structure.side.proportion" value="0.32068965" />
|
||||
</component>
|
||||
<component name="RunDashboard">
|
||||
<option name="ruleStates">
|
||||
<list>
|
||||
<RuleState>
|
||||
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
<RuleState>
|
||||
<option name="name" value="StatusDashboardGroupingRule" />
|
||||
</RuleState>
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="RunManager" selected="Kotlin.net.torvald.terrarum.imagefont.GameFontDemoKt">
|
||||
<configuration default="false" name="net.torvald.terrarum.imagefont.GameFontDemoKt" type="JetRunConfigurationType" factoryName="Kotlin" temporary="true" nameIsGenerated="true">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
@@ -417,14 +419,13 @@
|
||||
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17948718" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.21100427" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
|
||||
<window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960597" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Structure" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3054371" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.26007676" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2581574" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
|
||||
@@ -434,6 +435,7 @@
|
||||
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.1544196" sideWeight="0.4651163" order="10" side_tool="false" content_ui="tabs" x="1380" y="-157" width="1720" height="857" />
|
||||
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
|
||||
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
|
||||
</layout>
|
||||
</component>
|
||||
@@ -449,6 +451,63 @@
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="924">
|
||||
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="6846">
|
||||
<caret line="493" column="0" lean-forward="false" selection-start-line="493" selection-start-column="0" selection-end-line="493" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="658">
|
||||
<caret line="48" column="26" lean-forward="false" selection-start-line="48" selection-start-column="26" selection-end-line="48" selection-end-column="26" />
|
||||
<folding>
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="7168">
|
||||
<caret line="516" column="36" lean-forward="false" selection-start-line="516" selection-start-column="36" selection-end-line="516" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/config.properties">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/text.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
@@ -459,7 +518,7 @@
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="190">
|
||||
<state relative-caret-position="392">
|
||||
<caret line="29" column="0" lean-forward="false" selection-start-line="29" selection-start-column="0" selection-end-line="29" selection-end-column="0" />
|
||||
<folding>
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
@@ -471,17 +530,6 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="28">
|
||||
<caret line="2" column="57" lean-forward="true" selection-start-line="2" selection-start-column="57" selection-end-line="2" selection-end-column="57" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="400">
|
||||
<caret line="516" column="36" lean-forward="false" selection-start-line="516" selection-start-column="36" selection-end-line="516" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -489,24 +537,58 @@
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="273">
|
||||
<caret line="428" column="8" lean-forward="false" selection-start-line="428" selection-start-column="8" selection-end-line="429" selection-end-column="87" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="924">
|
||||
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/config.properties">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="0">
|
||||
<caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
|
||||
<caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/kotlin/Primitives.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="338">
|
||||
<caret line="491" column="24" lean-forward="false" selection-start-line="491" selection-start-column="24" selection-end-line="491" selection-end-column="24" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
|
||||
<entry file="file://$PROJECT_DIR$/text.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="610">
|
||||
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
|
||||
<state relative-caret-position="252">
|
||||
<caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="518">
|
||||
<caret line="37" column="41" lean-forward="false" selection-start-line="37" selection-start-column="41" selection-end-line="37" selection-end-column="41" />
|
||||
<folding>
|
||||
<element signature="e#40#238#0" expanded="true" />
|
||||
<element signature="e#31#108#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="409">
|
||||
<caret line="204" column="48" lean-forward="false" selection-start-line="204" selection-start-column="48" selection-end-line="204" selection-end-column="48" />
|
||||
<folding>
|
||||
<element signature="e#31#171#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
|
||||
@@ -6,67 +6,20 @@
|
||||
<option name="compilerInfo">
|
||||
<KotlinCompilerInfo>
|
||||
<option name="compilerSettings">
|
||||
<CompilerSettings>
|
||||
<option name="additionalArguments" value="-version" />
|
||||
<option name="copyJsLibraryFiles" value="true" />
|
||||
<option name="outputDirectoryForJsLibraryFiles" value="lib" />
|
||||
</CompilerSettings>
|
||||
<CompilerSettings />
|
||||
</option>
|
||||
<option name="k2jsCompilerArguments">
|
||||
<K2JSCompilerArguments>
|
||||
<option name="outputFile" />
|
||||
<option name="noStdlib" value="false" />
|
||||
<option name="libraryFiles" />
|
||||
<option name="sourceMap" value="false" />
|
||||
<option name="metaInfo" value="false" />
|
||||
<option name="kjsm" value="false" />
|
||||
<option name="target" />
|
||||
<option name="moduleKind" />
|
||||
<option name="main" />
|
||||
<option name="outputPrefix" />
|
||||
<option name="outputPostfix" />
|
||||
<option name="languageVersion" />
|
||||
<option name="apiVersion" />
|
||||
<option name="suppressWarnings" value="false" />
|
||||
<option name="verbose" value="false" />
|
||||
<option name="version" value="false" />
|
||||
<option name="help" value="false" />
|
||||
<option name="extraHelp" value="false" />
|
||||
<option name="noInline" value="false" />
|
||||
<option name="repeat" />
|
||||
<option name="pluginClasspaths" />
|
||||
<option name="pluginOptions" />
|
||||
<option name="freeArgs">
|
||||
<list />
|
||||
</option>
|
||||
<option name="unknownExtraFlags">
|
||||
<list />
|
||||
</option>
|
||||
</K2JSCompilerArguments>
|
||||
<K2JSCompilerArguments />
|
||||
</option>
|
||||
<option name="k2jvmCompilerArguments">
|
||||
<K2JVMCompilerArguments />
|
||||
</option>
|
||||
<option name="_commonCompilerArguments">
|
||||
<DummyImpl>
|
||||
<option name="languageVersion" />
|
||||
<option name="apiVersion" />
|
||||
<option name="suppressWarnings" value="false" />
|
||||
<option name="verbose" value="false" />
|
||||
<option name="version" value="false" />
|
||||
<option name="help" value="false" />
|
||||
<option name="extraHelp" value="false" />
|
||||
<option name="noInline" value="false" />
|
||||
<option name="repeat" />
|
||||
<option name="pluginClasspaths" />
|
||||
<option name="pluginOptions" />
|
||||
<option name="freeArgs">
|
||||
<list />
|
||||
</option>
|
||||
<option name="unknownExtraFlags">
|
||||
<list />
|
||||
</option>
|
||||
</DummyImpl>
|
||||
<DummyImpl />
|
||||
</option>
|
||||
</KotlinCompilerInfo>
|
||||
</option>
|
||||
<option name="useProjectSettings" value="false" />
|
||||
<option name="versionInfo">
|
||||
<KotlinVersionInfo>
|
||||
<option name="apiLevel" value="1.0" />
|
||||
|
||||
@@ -54,26 +54,32 @@ open class GameFontBase : Font {
|
||||
9
|
||||
}
|
||||
|
||||
private fun isHangul(c: Char) = c.toInt() >= 0xAC00 && c.toInt() < 0xD7A4
|
||||
private fun isAscii(c: Char) = c.toInt() >= 0x20 && c.toInt() <= 0xFF
|
||||
private fun isExtA(c: Char) = c.toInt() >= 0x100 && c.toInt() < 0x180
|
||||
private fun isKana(c: Char) = c.toInt() >= 0x3040 && c.toInt() < 0x3100
|
||||
private fun isCJKPunct(c: Char) = c.toInt() >= 0x3000 && c.toInt() < 0x3040
|
||||
private fun isUniHan(c: Char) = c.toInt() >= 0x3400 && c.toInt() < 0xA000
|
||||
private fun isCyrilic(c: Char) = c.toInt() >= 0x400 && c.toInt() < 0x460
|
||||
private fun isFullwidthUni(c: Char) = c.toInt() >= 0xFF00 && c.toInt() < 0xFF20
|
||||
private fun isUniPunct(c: Char) = c.toInt() >= 0x2000 && c.toInt() < 0x2070
|
||||
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 isRomanian(c: Char) = c.toInt() >= 0x218 && c.toInt() <= 0x21A
|
||||
private fun isRomanianNarrow(c: Char) = c.toInt() == 0x21B
|
||||
private fun isHangul(c: Char) = c.toInt() in 0xAC00..0xD7A3
|
||||
private fun isAscii(c: Char) = c.toInt() in 0x20..0xFF
|
||||
private fun isRunic(c: Char) = runicList.contains(c)
|
||||
private fun isExtA(c: Char) = c.toInt() in 0x100..0x17F
|
||||
private fun isExtB(c: Char) = c.toInt() in 0x180..0x24F
|
||||
private fun isKana(c: Char) = c.toInt() in 0x3040..0x30FF
|
||||
private fun isCJKPunct(c: Char) = c.toInt() in 0x3000..0x303F
|
||||
private fun isUniHan(c: Char) = c.toInt() in 0x3400..0x9FFF
|
||||
private fun isCyrilic(c: Char) = c.toInt() in 0x400..0x45F
|
||||
private fun isFullwidthUni(c: Char) = c.toInt() in 0xFF00..0xFF1F
|
||||
private fun isUniPunct(c: Char) = c.toInt() in 0x2000..0x206F
|
||||
private fun isWenQuanYi1(c: Char) = c.toInt() in 0x33F3..0x69FC
|
||||
private fun isWenQuanYi2(c: Char) = c.toInt() in 0x69FD..0x9FDC
|
||||
private fun isGreek(c: Char) = c.toInt() in 0x370..0x3CE
|
||||
|
||||
|
||||
|
||||
private fun extAindexX(c: Char) = (c.toInt() - 0x100) % 16
|
||||
private fun extAindexY(c: Char) = (c.toInt() - 0x100) / 16
|
||||
|
||||
private fun extBindexX(c: Char) = (c.toInt() - 0x180) % 16
|
||||
private fun extBindexY(c: Char) = (c.toInt() - 0x180) / 16
|
||||
|
||||
private fun runicIndexX(c: Char) = runicList.indexOf(c) % 16
|
||||
private fun runicIndexY(c: Char) = runicList.indexOf(c) / 16
|
||||
|
||||
private fun kanaIndexX(c: Char) = (c.toInt() - 0x3040) % 16
|
||||
private fun kanaIndexY(c: Char) = (c.toInt() - 0x3040) / 16
|
||||
|
||||
@@ -100,19 +106,6 @@ open class GameFontBase : Font {
|
||||
private fun greekIndexX(c: Char) = (c.toInt() - 0x370) % 16
|
||||
private fun greekIndexY(c: Char) = (c.toInt() - 0x370) / 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 thaiNarrowIndexX(c: Char) = 3
|
||||
private fun thaiNarrowIndexY(c: Char) = 0
|
||||
|
||||
|
||||
private val narrowWidthSheets = arrayOf(
|
||||
SHEET_EXTB_ROMANIAN_NARROW
|
||||
)
|
||||
private val unihanWidthSheets = arrayOf(
|
||||
SHEET_UNIHAN,
|
||||
SHEET_FW_UNI,
|
||||
@@ -126,7 +119,8 @@ open class GameFontBase : Font {
|
||||
SHEET_ASCII_VARW,
|
||||
SHEET_CYRILIC_VARW,
|
||||
SHEET_EXTA_VARW,
|
||||
SHEET_GREEK_VARW
|
||||
SHEET_GREEK_VARW,
|
||||
SHEET_EXTB_VARW
|
||||
)
|
||||
|
||||
|
||||
@@ -138,21 +132,18 @@ open class GameFontBase : Font {
|
||||
val chr = s[i]
|
||||
val ctype = getSheetType(s[i])
|
||||
|
||||
if (chr.toInt() == 0x21B) // Romanian t; HAX!
|
||||
len += 6
|
||||
else if (variableWidthSheets.contains(ctype)) {
|
||||
try {
|
||||
len += asciiWidths[chr.toInt()]!!
|
||||
if (variableWidthSheets.contains(ctype)) {
|
||||
len += try {
|
||||
asciiWidths[chr.toInt()]!!
|
||||
}
|
||||
catch (e: kotlin.KotlinNullPointerException) {
|
||||
println("KotlinNullPointerException on glyph number ${Integer.toHexString(chr.toInt()).toUpperCase()}")
|
||||
System.exit(1)
|
||||
//System.exit(1)
|
||||
W_LATIN_WIDE // failsafe
|
||||
}
|
||||
}
|
||||
else if (zeroWidthSheets.contains(ctype))
|
||||
len += 0
|
||||
else if (narrowWidthSheets.contains(ctype))
|
||||
len += W_LATIN_NARROW
|
||||
else if (ctype == SHEET_CJK_PUNCT)
|
||||
len += W_ASIAN_PUNCT
|
||||
else if (ctype == SHEET_HANGUL)
|
||||
@@ -188,6 +179,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (isHangul(ch)) {
|
||||
val hIndex = ch.toInt() - 0xAC00
|
||||
|
||||
@@ -203,17 +199,17 @@ open class GameFontBase : Font {
|
||||
|
||||
hangulSheet.getSubImage(indexCho, choRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(),
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
@@ -246,6 +242,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (isWenQuanYi1(ch)) {
|
||||
val glyphW = getWidth("" + ch)
|
||||
wenQuanYi_1.getSubImage(wenQuanYiIndexX(ch), wenQuanYi1IndexY(ch)).drawWithShadow(
|
||||
@@ -263,6 +264,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (isWenQuanYi2(ch)) {
|
||||
val glyphW = getWidth("" + ch)
|
||||
wenQuanYi_2.getSubImage(wenQuanYiIndexX(ch), wenQuanYi2IndexY(ch)).drawWithShadow(
|
||||
@@ -280,6 +286,11 @@ open class GameFontBase : Font {
|
||||
for (i in 0..s.length - 1) {
|
||||
val ch = s[i]
|
||||
|
||||
if (ch.isColourCode()) {
|
||||
thisCol = colourKey[ch]!!
|
||||
continue
|
||||
}
|
||||
|
||||
if (!isHangul(ch) && !isUniHan(ch)) {
|
||||
|
||||
// if not init, endUse first
|
||||
@@ -296,6 +307,10 @@ open class GameFontBase : Font {
|
||||
sheetX = extAindexX(ch)
|
||||
sheetY = extAindexY(ch)
|
||||
}
|
||||
SHEET_EXTB_VARW -> {
|
||||
sheetX = extBindexX(ch)
|
||||
sheetY = extBindexY(ch)
|
||||
}
|
||||
SHEET_KANA -> {
|
||||
sheetX = kanaIndexX(ch)
|
||||
sheetY = kanaIndexY(ch)
|
||||
@@ -320,14 +335,6 @@ open class GameFontBase : Font {
|
||||
sheetX = greekIndexX(ch)
|
||||
sheetY = greekIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_WIDE -> {
|
||||
sheetX = romanianIndexX(ch)
|
||||
sheetY = romanianIndexY(ch)
|
||||
}
|
||||
SHEET_EXTB_ROMANIAN_NARROW -> {
|
||||
sheetX = 0
|
||||
sheetY = 0
|
||||
}
|
||||
else -> {
|
||||
sheetX = ch.toInt() % 16
|
||||
sheetY = ch.toInt() / 16
|
||||
@@ -338,12 +345,7 @@ open class GameFontBase : Font {
|
||||
try {
|
||||
sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow(
|
||||
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
|
||||
|
||||
// to deal with the height difference of the sheets
|
||||
Math.round(y).toFloat() + (if (prevInstance == SHEET_CJK_PUNCT) -1 // height hack
|
||||
else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2 // completely legit height adjustment
|
||||
else 0).toFloat(),
|
||||
|
||||
Math.round(y).toFloat(),
|
||||
scale.toFloat(), thisCol
|
||||
)
|
||||
}
|
||||
@@ -365,10 +367,7 @@ open class GameFontBase : Font {
|
||||
}
|
||||
|
||||
private fun getSheetType(c: Char): Int {
|
||||
// EFs
|
||||
if (isRomanianNarrow(c))
|
||||
return SHEET_EXTB_ROMANIAN_NARROW
|
||||
else if (isHangul(c))
|
||||
if (isHangul(c))
|
||||
return SHEET_HANGUL
|
||||
else if (isKana(c))
|
||||
return SHEET_KANA
|
||||
@@ -378,6 +377,8 @@ open class GameFontBase : Font {
|
||||
return SHEET_ASCII_VARW
|
||||
else if (isExtA(c))
|
||||
return SHEET_EXTA_VARW
|
||||
else if (isExtB(c))
|
||||
return SHEET_EXTB_VARW
|
||||
else if (isCyrilic(c))
|
||||
return SHEET_CYRILIC_VARW
|
||||
else if (isUniPunct(c))
|
||||
@@ -388,8 +389,8 @@ open class GameFontBase : Font {
|
||||
return SHEET_FW_UNI
|
||||
else if (isGreek(c))
|
||||
return SHEET_GREEK_VARW
|
||||
else if (isRomanian(c))
|
||||
return SHEET_EXTB_ROMANIAN_WIDE
|
||||
else if (c.isColourCode())
|
||||
return SHEET_COLOURCODE
|
||||
else
|
||||
return SHEET_UNKNOWN// fixed width punctuations
|
||||
// fixed width
|
||||
@@ -418,6 +419,8 @@ open class GameFontBase : Font {
|
||||
drawString(x + xoff, y, printedBody, color)
|
||||
}
|
||||
|
||||
fun Char.isColourCode() = colourKey.containsKey(this)
|
||||
|
||||
fun buildWidthTable(sheet: SpriteSheet, codeOffset: Int, codeRange: IntRange, rows: Int = 16) {
|
||||
fun Byte.toUint() = java.lang.Byte.toUnsignedInt(this)
|
||||
|
||||
@@ -483,6 +486,7 @@ open class GameFontBase : Font {
|
||||
internal val asciiWidths: HashMap<Int, Int> = HashMap()
|
||||
|
||||
lateinit internal var extASheet: SpriteSheet
|
||||
lateinit internal var extBSheet: SpriteSheet
|
||||
lateinit internal var kanaSheet: SpriteSheet
|
||||
lateinit internal var cjkPunct: SpriteSheet
|
||||
// static SpriteSheet uniHan;
|
||||
@@ -492,8 +496,6 @@ open class GameFontBase : Font {
|
||||
lateinit internal var wenQuanYi_1: SpriteSheet
|
||||
lateinit internal var wenQuanYi_2: SpriteSheet
|
||||
lateinit internal var greekSheet: SpriteSheet
|
||||
lateinit internal var romanianSheet: SpriteSheet
|
||||
lateinit internal var romanianSheetNarrow: SpriteSheet
|
||||
|
||||
internal val JUNG_COUNT = 21
|
||||
internal val JONG_COUNT = 28
|
||||
@@ -502,34 +504,49 @@ open class GameFontBase : Font {
|
||||
internal val W_HANGUL = 11
|
||||
internal val W_KANA = 12
|
||||
internal val W_UNIHAN = 16
|
||||
internal val W_LATIN_WIDE = 9 // width of regular letters, including m
|
||||
internal val W_LATIN_NARROW = 5 // width of letter f, t, i, l
|
||||
internal val W_LATIN_WIDE = 9 // width of regular letters
|
||||
|
||||
internal val H = 20
|
||||
internal val H_HANGUL = 16
|
||||
internal val H_UNIHAN = 16
|
||||
internal val H_KANA = 20
|
||||
|
||||
internal val SHEET_ASCII_VARW = 0
|
||||
internal val SHEET_HANGUL = 1
|
||||
internal val SHEET_EXTA_VARW = 2
|
||||
internal val SHEET_KANA = 3
|
||||
internal val SHEET_CJK_PUNCT = 4
|
||||
internal val SHEET_UNIHAN = 5
|
||||
internal val SHEET_CYRILIC_VARW = 6
|
||||
internal val SHEET_FW_UNI = 7
|
||||
internal val SHEET_UNI_PUNCT = 8
|
||||
internal val SHEET_WENQUANYI_1 = 9
|
||||
internal val SHEET_WENQUANYI_2 = 10
|
||||
internal val SHEET_GREEK_VARW = 11
|
||||
internal val SHEET_EXTB_ROMANIAN_WIDE = 12
|
||||
internal val SHEET_EXTB_ROMANIAN_NARROW = 13
|
||||
internal val SHEET_EXTA_VARW = 3
|
||||
internal val SHEET_EXTB_VARW = 4
|
||||
internal val SHEET_KANA = 5
|
||||
internal val SHEET_CJK_PUNCT = 6
|
||||
internal val SHEET_UNIHAN = 7
|
||||
internal val SHEET_CYRILIC_VARW = 8
|
||||
internal val SHEET_FW_UNI = 9
|
||||
internal val SHEET_UNI_PUNCT = 10
|
||||
internal val SHEET_WENQUANYI_1 = 11
|
||||
internal val SHEET_WENQUANYI_2 = 12
|
||||
internal val SHEET_GREEK_VARW = 13
|
||||
|
||||
|
||||
internal val SHEET_UNKNOWN = 254
|
||||
internal val SHEET_COLOURCODE = 255
|
||||
|
||||
lateinit internal var sheetKey: Array<SpriteSheet?>
|
||||
|
||||
/**
|
||||
* Runic letters list used for game. The set is
|
||||
* Younger Futhark + Medieval rune 'e' + Punct + Runic Almanac
|
||||
|
||||
* BEWARE OF SIMILAR-LOOKING RUNES, especially:
|
||||
|
||||
* * Algiz ᛉ instead of Maðr ᛘ
|
||||
|
||||
* * Short-Twig Hagall ᚽ instead of Runic Letter E ᛂ
|
||||
|
||||
* * Runic Letter OE ᚯ instead of Óss ᚬ
|
||||
|
||||
* Examples:
|
||||
* ᛭ᛋᛁᚴᚱᛁᚦᛦ᛭
|
||||
* ᛭ᛂᛚᛋᛅ᛭ᛏᚱᚢᛏᚾᛁᚾᚴᚢᚾᛅ᛬ᛅᚱᚾᛅᛏᛅᛚᛋ
|
||||
*/
|
||||
internal val runicList = arrayOf('ᚠ', 'ᚢ', 'ᚦ', 'ᚬ', 'ᚱ', 'ᚴ', 'ᚼ', 'ᚾ', 'ᛁ', 'ᛅ', 'ᛋ', 'ᛏ', 'ᛒ', 'ᛘ', 'ᛚ', 'ᛦ', 'ᛂ', '᛬', '᛫', '᛭', 'ᛮ', 'ᛯ', 'ᛰ')
|
||||
|
||||
internal var interchar = 0
|
||||
internal var scale = 1
|
||||
set(value) {
|
||||
@@ -537,6 +554,49 @@ open class GameFontBase : Font {
|
||||
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
|
||||
}
|
||||
|
||||
val colourKey = hashMapOf(
|
||||
Pair(0x10.toChar(), Color(0xFFFFFF)), //*w hite
|
||||
Pair(0x11.toChar(), Color(0xFFE080)), //*y ellow
|
||||
Pair(0x12.toChar(), Color(0xFFB020)), //o range
|
||||
Pair(0x13.toChar(), Color(0xFF8080)), //*r ed
|
||||
Pair(0x14.toChar(), Color(0xFFA0E0)), //f uchsia
|
||||
Pair(0x15.toChar(), Color(0xE0A0FF)), //*m agenta (purple)
|
||||
Pair(0x16.toChar(), Color(0x8080FF)), //*b lue
|
||||
Pair(0x17.toChar(), Color(0x80FFFF)), //c yan
|
||||
Pair(0x18.toChar(), Color(0x80FF80)), //*g reen
|
||||
Pair(0x19.toChar(), Color(0x008000)), //v iridian
|
||||
Pair(0x1A.toChar(), Color(0x805030)), //x (khaki)
|
||||
Pair(0x1B.toChar(), Color(0x808080)) //*k
|
||||
//* marked: commonly used
|
||||
)
|
||||
val colToCode = hashMapOf(
|
||||
Pair("w", 0x10.toChar()),
|
||||
Pair("y", 0x11.toChar()),
|
||||
Pair("o", 0x12.toChar()),
|
||||
Pair("r", 0x13.toChar()),
|
||||
Pair("f", 0x14.toChar()),
|
||||
Pair("m", 0x15.toChar()),
|
||||
Pair("b", 0x16.toChar()),
|
||||
Pair("c", 0x17.toChar()),
|
||||
Pair("g", 0x18.toChar()),
|
||||
Pair("v", 0x19.toChar()),
|
||||
Pair("x", 0x1A.toChar()),
|
||||
Pair("k", 0x1B.toChar())
|
||||
)
|
||||
val codeToCol = hashMapOf(
|
||||
Pair("w", colourKey[0x10.toChar()]),
|
||||
Pair("y", colourKey[0x11.toChar()]),
|
||||
Pair("o", colourKey[0x12.toChar()]),
|
||||
Pair("r", colourKey[0x13.toChar()]),
|
||||
Pair("f", colourKey[0x14.toChar()]),
|
||||
Pair("m", colourKey[0x15.toChar()]),
|
||||
Pair("b", colourKey[0x16.toChar()]),
|
||||
Pair("c", colourKey[0x17.toChar()]),
|
||||
Pair("g", colourKey[0x18.toChar()]),
|
||||
Pair("v", colourKey[0x19.toChar()]),
|
||||
Pair("x", colourKey[0x1A.toChar()]),
|
||||
Pair("k", colourKey[0x1B.toChar()])
|
||||
)
|
||||
}// end of companion object
|
||||
}
|
||||
|
||||
|
||||
@@ -11,15 +11,17 @@ class GameFontImpl : GameFontBase() {
|
||||
init {
|
||||
|
||||
GameFontBase.hangulSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H_HANGUL)
|
||||
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H)
|
||||
GameFontBase.asciiSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1)
|
||||
GameFontBase.extASheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/LatinExtA_variable.tga", 15, 19, 1)
|
||||
GameFontBase.extBSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/LatinExtB_variable.tga", 15, 19, 1)
|
||||
GameFontBase.kanaSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H_KANA)
|
||||
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H)
|
||||
GameFontBase.cjkPunct = SpriteSheet(
|
||||
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H_KANA)
|
||||
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H)
|
||||
/*uniHan = new SpriteSheet(
|
||||
"./assets/graphics/fonts/unifont_unihan"
|
||||
+ ((!terrarum.gameLocale.contains("zh"))
|
||||
@@ -43,15 +45,13 @@ class GameFontImpl : GameFontBase() {
|
||||
"./assets/graphics/fonts/wenquanyi_11pt_part2.tga", 16, 18, 2)
|
||||
GameFontBase.greekSheet = SpriteSheet(
|
||||
"./assets/graphics/fonts/greek_variable.tga", 15, 19, 1)
|
||||
GameFontBase.romanianSheet = SpriteSheet(
|
||||
"./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)
|
||||
|
||||
val shk = arrayOf(
|
||||
GameFontBase.asciiSheet,
|
||||
GameFontBase.hangulSheet,
|
||||
null, // here was customised runic sheet
|
||||
GameFontBase.extASheet,
|
||||
GameFontBase.extBSheet,
|
||||
GameFontBase.kanaSheet,
|
||||
GameFontBase.cjkPunct,
|
||||
null, // Full unihan, filler because we're using WenQuanYi
|
||||
@@ -60,16 +60,25 @@ class GameFontImpl : GameFontBase() {
|
||||
GameFontBase.uniPunct,
|
||||
GameFontBase.wenQuanYi_1,
|
||||
GameFontBase.wenQuanYi_2,
|
||||
GameFontBase.greekSheet,
|
||||
GameFontBase.romanianSheet,
|
||||
GameFontBase.romanianSheetNarrow
|
||||
GameFontBase.greekSheet
|
||||
)
|
||||
GameFontBase.sheetKey = shk
|
||||
|
||||
|
||||
buildWidthTable(asciiSheet, 0, 0..0xFF)
|
||||
buildWidthTable(extASheet, 0x100, 0..0x7F)
|
||||
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
||||
buildWidthTable(asciiSheet, 0, 0..0xFF)
|
||||
buildWidthTable(extASheet, 0x100, 0..0x7F)
|
||||
buildWidthTable(extBSheet, 0x180, 0..0xCF)
|
||||
buildWidthTable(cyrilic, 0x400, 0..0x5F)
|
||||
buildWidthTable(greekSheet, 0x370, 0..0x5F)
|
||||
}
|
||||
|
||||
fun reload() {
|
||||
GameFontBase.cyrilic.destroy()
|
||||
GameFontBase.cyrilic = SpriteSheet(
|
||||
when (GameFontDemo.gameLocale.substring(0..1)) {
|
||||
"bg" -> "./assets/graphics/fonts/cyrilic_bulgarian_variable.tga"
|
||||
"sr" -> "./assets/graphics/fonts/cyrilic_serbian_variable.tga"
|
||||
else -> "./assets/graphics/fonts/cyrilic_variable.tga"
|
||||
}, 15, 19, 1)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,37 +1,38 @@
|
||||
Set locale in config.properties to “bgBG” for alternative Bulgarian letters, “srSR” for Serbian.
|
||||
|
||||
ABCDEFGHIJKLM NOPQRSTUVWXYZ
|
||||
abcdefghijklm nopqrstuvwxyz
|
||||
ABCDEFGHIJKLM NOPQRSTUVWXYZ 12345?
|
||||
abcdefghijklm nopqrstuvwxyz 67890!
|
||||
|
||||
Syö salmiakkia, koska se on hyvää sinulle
|
||||
The bitmap font for game developers who seek good font that has real multilingual support,
|
||||
for free (as in freedom AND without cost).
|
||||
|
||||
The Olympic marmot (Marmota olympus) is a rodent in the squirrel family, Sciuridae.
|
||||
It lives only in the U.S. state of Washington, at middle elevations on the Olympic Peninsula.
|
||||
About the size of a domestic cat, an adult weighs around 8 kg (18 lb) in summer.
|
||||
There are many bitmap fonts on the internet. You care for the multilingual support, but alas!
|
||||
most of them does not support your language, vector fonts takes too much time to be loaded,
|
||||
even then their legibility suffers because fuck built-in antialias.
|
||||
You somehow found a good font, and it makes your game look like a linux terminal, and you say:
|
||||
“what the fuck? Is this a game or should I rm -rf this shit‽”
|
||||
You speak Japanese, and you wish to support it, but then このクソなfontは only good for Japanese,
|
||||
and it is not multilingual, and you don't have a time for this shenanigan.
|
||||
Eventually you give up, saying “fuck it!” and just use the fonts that do not match well.
|
||||
|
||||
Brná je část statutárního a krajského města Ústí nad Labem v České republice, spadající
|
||||
pod městský obvod Ústí nad Labem-Střekov. Nachází se asi pět kilometrů jižně od centra
|
||||
města v Českém středohoří na pravém břehu řeky Labe.
|
||||
No more suffering. This font has everything you need.
|
||||
|
||||
Malaysia er en forholdsvis ung stat. Sin endelige udstrækning fik den først i 1965 efter
|
||||
at Singapore trak sig ud. Staten blev grundlagt ved en sammenslutning af flere tidligere
|
||||
britiske besiddelser, foreløbigt i 1957 og endeligt i 1963.
|
||||
while (isVisible(BadFonts)) { ripAndTear(BadFonts).scope(Guts); }
|
||||
How multilingual? Real multilingual!
|
||||
|
||||
Το θάλλιο συνοδεύει κυρίως θειούχα ορυκτά βασικών μετάλλων, όπως ο σφαλερίτης, ο σιδηροπυρίτης
|
||||
και ο γαληνίτης ενώ αναφέρονται και εμφανίσεις του σε κονδύλους μαγγανίου στους βυθούς των ωκεανών.
|
||||
Příliš žluťoučký kůň úpěl ďábelské ódy
|
||||
Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich
|
||||
διαφυλάξτε γενικά τη ζωή σας από βαθειά ψυχικά τραύματα
|
||||
ΔΙΑΦΥΛΆΞΤΕ ΓΕΝΙΚΆ ΤΗ ΖΩΉ ΣΑΣ ΑΠΌ ΒΑΘΕΙΆ ΨΥΧΙΚΆ ΤΡΑΎΜΑΤΑ
|
||||
Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства.
|
||||
Příliš žluťoučký kůň úpěl ďábelské ódy. Árvíztűrő tükörfúrógép.
|
||||
Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich.
|
||||
Pijamalı hasta yağız şoföre çabucak güvendi. Kŕdeľ ďatľov učí koňa žrať kôru.
|
||||
Voix ambiguë d'un cœur qui au zéphyr préfère les jattes de kiwi.
|
||||
Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila.
|
||||
|
||||
sjaldgæft ekki stjórnarskrárvarin
|
||||
|
||||
Also supports:
|
||||
‛Unicode’ „quotation marks“—dashes…‼
|
||||
으웽~. 얘! 위에 이 애 우유의 양 외워와! 아오~ 왜요? 어여! 예... 웬 초콜릿? 제가 원했던 건 뻥튀기 쬐끔과 의류예요. 얘야, 왜 또 불평? 퀡퇣풿횂
|
||||
Pack my box with five dozen liquor jugs
|
||||
Voix ambiguë d'un cœur qui au zéphyr préfère les jattes de kiwi
|
||||
정 참판 양반댁 규수 큰 교자 타고 혼례 치른 날 뚫훍뚫훍뚫(읗) 뚫훍뚫훍뚫(읗) 뚫훍뚫훍뚫 따다다
|
||||
Kæmi ný öxi hér, ykist þjófum nú bæði víl og ádrepa
|
||||
Árvíztűrő tükörfúrógép Kŕdeľ ďatľov učí koňa žrať kôru
|
||||
とりなくこゑす ゆめさませ みよあけわたる ひんかしを そらいろはえて おきつへに ほふねむれゐぬ もやのうち
|
||||
鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中,
|
||||
鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中
|
||||
Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila
|
||||
Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства
|
||||
Pijamalı hasta yağız şoföre çabucak güvendi
|
||||
Also supports: ‛Unicode’ „quotation marks“—dashes…「括弧」‼
|
||||
ASCII Latin-1 Latin_Ext-A Latin_Ext-B Greek Cyrillic CJK-Ideo Kana Hangul_Syllables
|
||||
|
||||
BIN
font_test_3.PNG
|
Before Width: | Height: | Size: 53 KiB After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |