diff --git a/FontTestGDX/src/FontTestGDX.kt b/FontTestGDX/src/FontTestGDX.kt index d397b9c..7a0cd73 100755 --- a/FontTestGDX/src/FontTestGDX.kt +++ b/FontTestGDX/src/FontTestGDX.kt @@ -31,6 +31,8 @@ class FontTestGDX : Game() { private val demotextName = if (testing) "testtext.txt" else "demotext.txt" private val outimageName = if (testing) "testing.PNG" else "demo.PNG" + private lateinit var faketex: Texture + override fun create() { 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() + // create faketex + val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888) + fakepix.drawPixel(0,0,-1) + faketex = Texture(fakepix) + fakepix.dispose() println(font.charsetOverrideDefault) @@ -71,6 +78,8 @@ class FontTestGDX : Game() { var tex: Texture? = null var screenshotExported = false + private val backcol = Color(.141f, .141f, .141f, 1f) + override fun render() { if (tex == null) { @@ -88,7 +97,10 @@ class FontTestGDX : Game() { batch.projectionMatrix = camera.combined 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 -> font.draw(batch, s, 10f, TEXH - 30f - index * font.lineHeight) } @@ -142,6 +154,7 @@ class FontTestGDX : Game() { override fun dispose() { font.dispose() + faketex.dispose() } fun scrollAdd(x: Int = 1) { diff --git a/assets/currencies_variable.tga b/assets/currencies_variable.tga new file mode 100644 index 0000000..af81d04 Binary files /dev/null and b/assets/currencies_variable.tga differ diff --git a/assets/latinExtA_variable.tga b/assets/latinExtA_variable.tga index 307a702..2117e14 100755 Binary files a/assets/latinExtA_variable.tga and b/assets/latinExtA_variable.tga differ diff --git a/assets/latinExtB_variable.tga b/assets/latinExtB_variable.tga index 3423718..102a576 100755 Binary files a/assets/latinExtB_variable.tga and b/assets/latinExtB_variable.tga differ diff --git a/assets/latinExtC_variable.tga b/assets/latinExtC_variable.tga index 4cdf489..cfa703f 100755 Binary files a/assets/latinExtC_variable.tga and b/assets/latinExtC_variable.tga differ diff --git a/assets/latinExtD_variable.tga b/assets/latinExtD_variable.tga index eb4975f..a2b8e8a 100644 Binary files a/assets/latinExtD_variable.tga and b/assets/latinExtD_variable.tga differ diff --git a/demo.PNG b/demo.PNG index 01fe085..8ce215e 100755 Binary files a/demo.PNG and b/demo.PNG differ diff --git a/demotext.txt b/demotext.txt index 55e8891..3175f9d 100755 --- a/demotext.txt +++ b/demotext.txt @@ -107,10 +107,10 @@ How multilingual? Real multilingual! 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 - Georgian Extended Greek Extended General Punctuations Superscripts and Subscripts CJK Symbols - Latin Extended-C Kana Hangul Compatibility Jamo Kana Phonetic Extensions CJK Unihan Extension A - CJK Unihan Latin Extended-D Hangul Jamo Extended-A Hangul Syllables Hangul Jamo Extended-B - Fullwidth Forms Kana Supplement + Georgian Extended Greek Extended General Punctuations Superscripts and Subscripts Currency Symbols + CJK Symbols Latin Extended-C Kana Hangul Compatibility Jamo Kana Phonetic Extensions + CJK Unihan Extension A CJK Unihan Latin Extended-D Hangul Jamo Extended-A Hangul Syllables + Hangul Jamo Extended-B Fullwidth Forms Kana Supplement 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 diff --git a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt index 4acc85c..0608fcb 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -563,6 +563,8 @@ class TerrarumSansBitmap( return SHEET_EXTC_VARW else if (isExtD(c)) return SHEET_EXTD_VARW + else if (isCurrencies(c)) + return SHEET_CURRENCIES_VARW else return SHEET_UNKNOWN // fixed width @@ -672,6 +674,10 @@ class TerrarumSansBitmap( sheetX = extDIndexX(ch) sheetY = extDIndexY(ch) } + SHEET_CURRENCIES_VARW -> { + sheetX = currenciesIndexX(ch) + sheetY = currenciesIndexY(ch) + } else -> { sheetX = ch % 16 sheetY = ch / 16 @@ -1393,6 +1399,7 @@ class TerrarumSansBitmap( internal val SHEET_GREEK_POLY_VARW = 25 internal val SHEET_EXTC_VARW = 26 internal val SHEET_EXTD_VARW = 27 + internal val SHEET_CURRENCIES_VARW = 28 internal val SHEET_UNKNOWN = 254 @@ -1434,7 +1441,8 @@ class TerrarumSansBitmap( SHEET_DIACRITICAL_MARKS_VARW, SHEET_GREEK_POLY_VARW, SHEET_EXTC_VARW, - SHEET_EXTD_VARW + SHEET_EXTD_VARW, + SHEET_CURRENCIES_VARW ) private val autoShiftDownOnLowercase = arrayOf( SHEET_DIACRITICAL_MARKS_VARW @@ -1468,7 +1476,8 @@ class TerrarumSansBitmap( "diacritical_marks_variable.tga", "greek_polytonic_xyswap_variable.tga", "latinExtC_variable.tga", - "latinExtD_variable.tga" + "latinExtD_variable.tga", + "currencies_variable.tga" ) private val codeRange = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!! 0..0xFF, // SHEET_ASCII_VARW @@ -1498,7 +1507,8 @@ class TerrarumSansBitmap( 0x300..0x36F, // SHEET_DIACRITICAL_MARKS_VARW 0x1F00..0x1FFF, // SHEET_GREEK_POLY_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 @@ -1650,6 +1660,7 @@ class TerrarumSansBitmap( private fun isExtC(c: CodePoint) = c in codeRange[SHEET_EXTC_VARW] private fun isExtD(c: CodePoint) = c in codeRange[SHEET_EXTD_VARW] private fun isHangulCompat(c: CodePoint) = c in codeRangeHangulCompat + private fun isCurrencies(c: CodePoint) = c in codeRange[SHEET_CURRENCIES_VARW] // underscored name: not a charset 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 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 diff --git a/work_files/currencies_variable.psd b/work_files/currencies_variable.psd new file mode 100644 index 0000000..6c2a39f Binary files /dev/null and b/work_files/currencies_variable.psd differ diff --git a/work_files/latinExtA_variable.psd b/work_files/latinExtA_variable.psd index 2275f32..69493e2 100644 Binary files a/work_files/latinExtA_variable.psd and b/work_files/latinExtA_variable.psd differ diff --git a/work_files/latinExtB_variable.psd b/work_files/latinExtB_variable.psd index 224604e..de87233 100644 Binary files a/work_files/latinExtB_variable.psd and b/work_files/latinExtB_variable.psd differ diff --git a/work_files/latinExtC_variable.psd b/work_files/latinExtC_variable.psd index a990702..6ef947e 100644 Binary files a/work_files/latinExtC_variable.psd and b/work_files/latinExtC_variable.psd differ diff --git a/work_files/latinExtD_variable.psd b/work_files/latinExtD_variable.psd index 9bf6350..9a7946a 100644 Binary files a/work_files/latinExtD_variable.psd and b/work_files/latinExtD_variable.psd differ