minor modifications on LatinExtABCD; added support for unicode Currency Symbols
@@ -31,6 +31,8 @@ class FontTestGDX : Game() {
|
|||||||
private val demotextName = if (testing) "testtext.txt" else "demotext.txt"
|
private val demotextName = if (testing) "testtext.txt" else "demotext.txt"
|
||||||
private val outimageName = if (testing) "testing.PNG" else "demo.PNG"
|
private val outimageName = if (testing) "testing.PNG" else "demo.PNG"
|
||||||
|
|
||||||
|
private lateinit var faketex: Texture
|
||||||
|
|
||||||
override fun create() {
|
override fun create() {
|
||||||
font = TerrarumSansBitmap("./assets", flipY = false, errorOnUnknownChar = false, shadowAlpha = 0.796f) // must test for two flipY cases
|
font = TerrarumSansBitmap("./assets", flipY = false, errorOnUnknownChar = false, shadowAlpha = 0.796f) // must test for two flipY cases
|
||||||
|
|
||||||
@@ -42,6 +44,11 @@ class FontTestGDX : Game() {
|
|||||||
batch = SpriteBatch()
|
batch = SpriteBatch()
|
||||||
|
|
||||||
|
|
||||||
|
// create faketex
|
||||||
|
val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888)
|
||||||
|
fakepix.drawPixel(0,0,-1)
|
||||||
|
faketex = Texture(fakepix)
|
||||||
|
fakepix.dispose()
|
||||||
|
|
||||||
|
|
||||||
println(font.charsetOverrideDefault)
|
println(font.charsetOverrideDefault)
|
||||||
@@ -71,6 +78,8 @@ class FontTestGDX : Game() {
|
|||||||
var tex: Texture? = null
|
var tex: Texture? = null
|
||||||
var screenshotExported = false
|
var screenshotExported = false
|
||||||
|
|
||||||
|
private val backcol = Color(.141f, .141f, .141f, 1f)
|
||||||
|
|
||||||
override fun render() {
|
override fun render() {
|
||||||
|
|
||||||
if (tex == null) {
|
if (tex == null) {
|
||||||
@@ -88,7 +97,10 @@ class FontTestGDX : Game() {
|
|||||||
batch.projectionMatrix = camera.combined
|
batch.projectionMatrix = camera.combined
|
||||||
batch.begin()
|
batch.begin()
|
||||||
|
|
||||||
batch.color = Color(-1)
|
batch.color = backcol
|
||||||
|
batch.draw(faketex, 0f, 0f, TEXW.toFloat(), TEXH.toFloat())
|
||||||
|
|
||||||
|
batch.color = Color.WHITE
|
||||||
inputText.forEachIndexed { index, s ->
|
inputText.forEachIndexed { index, s ->
|
||||||
font.draw(batch, s, 10f, TEXH - 30f - index * font.lineHeight)
|
font.draw(batch, s, 10f, TEXH - 30f - index * font.lineHeight)
|
||||||
}
|
}
|
||||||
@@ -142,6 +154,7 @@ class FontTestGDX : Game() {
|
|||||||
|
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
font.dispose()
|
font.dispose()
|
||||||
|
faketex.dispose()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun scrollAdd(x: Int = 1) {
|
fun scrollAdd(x: Int = 1) {
|
||||||
|
|||||||
BIN
assets/currencies_variable.tga
Normal file
|
After Width: | Height: | Size: 60 KiB |
|
Before Width: | Height: | Size: 160 KiB After Width: | Height: | Size: 160 KiB |
|
Before Width: | Height: | Size: 260 KiB After Width: | Height: | Size: 260 KiB |
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 40 KiB |
|
Before Width: | Height: | Size: 280 KiB After Width: | Height: | Size: 280 KiB |
BIN
demo.PNG
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 142 KiB |
@@ -107,10 +107,10 @@ How multilingual? Real multilingual!
|
|||||||
|
|
||||||
Basic Latin Latin-1 Supplement Latin Extended-A Latin Extended-B IPA Extension Greek Cyrillic
|
Basic Latin Latin-1 Supplement Latin Extended-A Latin Extended-B IPA Extension Greek Cyrillic
|
||||||
Cyrillic Supplement Armenian Devanagari Bengali Thai Georgian Hangul Jamo Cherokee Runic
|
Cyrillic Supplement Armenian Devanagari Bengali Thai Georgian Hangul Jamo Cherokee Runic
|
||||||
Georgian Extended Greek Extended General Punctuations Superscripts and Subscripts CJK Symbols
|
Georgian Extended Greek Extended General Punctuations Superscripts and Subscripts Currency Symbols
|
||||||
Latin Extended-C Kana Hangul Compatibility Jamo Kana Phonetic Extensions CJK Unihan Extension A
|
CJK Symbols Latin Extended-C Kana Hangul Compatibility Jamo Kana Phonetic Extensions
|
||||||
CJK Unihan Latin Extended-D Hangul Jamo Extended-A Hangul Syllables Hangul Jamo Extended-B
|
CJK Unihan Extension A CJK Unihan Latin Extended-D Hangul Jamo Extended-A Hangul Syllables
|
||||||
Fullwidth Forms Kana Supplement
|
Hangul Jamo Extended-B Fullwidth Forms Kana Supplement
|
||||||
|
|
||||||
GitHub’s issue page is open! You can report any errors, or leave suggestions.
|
GitHub’s issue page is open! You can report any errors, or leave suggestions.
|
||||||
You can help this font to be more versatile. (for more languages, more frameworks) Clone this repo, make
|
You can help this font to be more versatile. (for more languages, more frameworks) Clone this repo, make
|
||||||
|
|||||||
@@ -563,6 +563,8 @@ class TerrarumSansBitmap(
|
|||||||
return SHEET_EXTC_VARW
|
return SHEET_EXTC_VARW
|
||||||
else if (isExtD(c))
|
else if (isExtD(c))
|
||||||
return SHEET_EXTD_VARW
|
return SHEET_EXTD_VARW
|
||||||
|
else if (isCurrencies(c))
|
||||||
|
return SHEET_CURRENCIES_VARW
|
||||||
else
|
else
|
||||||
return SHEET_UNKNOWN
|
return SHEET_UNKNOWN
|
||||||
// fixed width
|
// fixed width
|
||||||
@@ -672,6 +674,10 @@ class TerrarumSansBitmap(
|
|||||||
sheetX = extDIndexX(ch)
|
sheetX = extDIndexX(ch)
|
||||||
sheetY = extDIndexY(ch)
|
sheetY = extDIndexY(ch)
|
||||||
}
|
}
|
||||||
|
SHEET_CURRENCIES_VARW -> {
|
||||||
|
sheetX = currenciesIndexX(ch)
|
||||||
|
sheetY = currenciesIndexY(ch)
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
sheetX = ch % 16
|
sheetX = ch % 16
|
||||||
sheetY = ch / 16
|
sheetY = ch / 16
|
||||||
@@ -1393,6 +1399,7 @@ class TerrarumSansBitmap(
|
|||||||
internal val SHEET_GREEK_POLY_VARW = 25
|
internal val SHEET_GREEK_POLY_VARW = 25
|
||||||
internal val SHEET_EXTC_VARW = 26
|
internal val SHEET_EXTC_VARW = 26
|
||||||
internal val SHEET_EXTD_VARW = 27
|
internal val SHEET_EXTD_VARW = 27
|
||||||
|
internal val SHEET_CURRENCIES_VARW = 28
|
||||||
|
|
||||||
internal val SHEET_UNKNOWN = 254
|
internal val SHEET_UNKNOWN = 254
|
||||||
|
|
||||||
@@ -1434,7 +1441,8 @@ class TerrarumSansBitmap(
|
|||||||
SHEET_DIACRITICAL_MARKS_VARW,
|
SHEET_DIACRITICAL_MARKS_VARW,
|
||||||
SHEET_GREEK_POLY_VARW,
|
SHEET_GREEK_POLY_VARW,
|
||||||
SHEET_EXTC_VARW,
|
SHEET_EXTC_VARW,
|
||||||
SHEET_EXTD_VARW
|
SHEET_EXTD_VARW,
|
||||||
|
SHEET_CURRENCIES_VARW
|
||||||
)
|
)
|
||||||
private val autoShiftDownOnLowercase = arrayOf(
|
private val autoShiftDownOnLowercase = arrayOf(
|
||||||
SHEET_DIACRITICAL_MARKS_VARW
|
SHEET_DIACRITICAL_MARKS_VARW
|
||||||
@@ -1468,7 +1476,8 @@ class TerrarumSansBitmap(
|
|||||||
"diacritical_marks_variable.tga",
|
"diacritical_marks_variable.tga",
|
||||||
"greek_polytonic_xyswap_variable.tga",
|
"greek_polytonic_xyswap_variable.tga",
|
||||||
"latinExtC_variable.tga",
|
"latinExtC_variable.tga",
|
||||||
"latinExtD_variable.tga"
|
"latinExtD_variable.tga",
|
||||||
|
"currencies_variable.tga"
|
||||||
)
|
)
|
||||||
private val codeRange = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!!
|
private val codeRange = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!!
|
||||||
0..0xFF, // SHEET_ASCII_VARW
|
0..0xFF, // SHEET_ASCII_VARW
|
||||||
@@ -1498,7 +1507,8 @@ class TerrarumSansBitmap(
|
|||||||
0x300..0x36F, // SHEET_DIACRITICAL_MARKS_VARW
|
0x300..0x36F, // SHEET_DIACRITICAL_MARKS_VARW
|
||||||
0x1F00..0x1FFF, // SHEET_GREEK_POLY_VARW
|
0x1F00..0x1FFF, // SHEET_GREEK_POLY_VARW
|
||||||
0x2C60..0x2C7F, // SHEET_EXTC_VARW
|
0x2C60..0x2C7F, // SHEET_EXTC_VARW
|
||||||
0xA720..0xA7FF // SHEET_EXTD_VARW
|
0xA720..0xA7FF, // SHEET_EXTD_VARW
|
||||||
|
0x20A0..0x20CF // SHEET_CURRENCIES_VARW
|
||||||
)
|
)
|
||||||
private val codeRangeHangulCompat = 0x3130..0x318F
|
private val codeRangeHangulCompat = 0x3130..0x318F
|
||||||
|
|
||||||
@@ -1650,6 +1660,7 @@ class TerrarumSansBitmap(
|
|||||||
private fun isExtC(c: CodePoint) = c in codeRange[SHEET_EXTC_VARW]
|
private fun isExtC(c: CodePoint) = c in codeRange[SHEET_EXTC_VARW]
|
||||||
private fun isExtD(c: CodePoint) = c in codeRange[SHEET_EXTD_VARW]
|
private fun isExtD(c: CodePoint) = c in codeRange[SHEET_EXTD_VARW]
|
||||||
private fun isHangulCompat(c: CodePoint) = c in codeRangeHangulCompat
|
private fun isHangulCompat(c: CodePoint) = c in codeRangeHangulCompat
|
||||||
|
private fun isCurrencies(c: CodePoint) = c in codeRange[SHEET_CURRENCIES_VARW]
|
||||||
|
|
||||||
// underscored name: not a charset
|
// underscored name: not a charset
|
||||||
private fun _isCaps(c: CodePoint) = Character.isUpperCase(c) || isKartvelianCaps(c)
|
private fun _isCaps(c: CodePoint) = Character.isUpperCase(c) || isKartvelianCaps(c)
|
||||||
@@ -1732,6 +1743,8 @@ class TerrarumSansBitmap(
|
|||||||
private fun extDIndexX(c: CodePoint) = (c - 0xA720) % 16
|
private fun extDIndexX(c: CodePoint) = (c - 0xA720) % 16
|
||||||
private fun extDIndexY(c: CodePoint) = (c - 0xA720) / 16
|
private fun extDIndexY(c: CodePoint) = (c - 0xA720) / 16
|
||||||
|
|
||||||
|
private fun currenciesIndexX(c: CodePoint) = (c - 0x20A0) % 16
|
||||||
|
private fun currenciesIndexY(c: CodePoint) = (c - 0x20A0) / 16
|
||||||
/*
|
/*
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
|||||||