diff --git a/FontTestGDX/src/FontTestGDX.kt b/FontTestGDX/src/FontTestGDX.kt index ce74b4a..e018bca 100755 --- a/FontTestGDX/src/FontTestGDX.kt +++ b/FontTestGDX/src/FontTestGDX.kt @@ -27,13 +27,15 @@ class FontTestGDX : Game() { lateinit var camera: OrthographicCamera - private val testing = true + private val testing = false 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 + private val lineHeight = 24 + override fun create() { font = TerrarumSansBitmap("./assets", debug = true, flipY = false, errorOnUnknownChar = false, shadowAlpha = 0.5f) // must test for two flipY cases @@ -45,9 +47,6 @@ class FontTestGDX : Game() { batch = SpriteBatch() - println(font.getWidth("हिन्दी")) - - // create faketex val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888) fakepix.drawPixel(0,0,-1) @@ -99,7 +98,7 @@ class FontTestGDX : Game() { batch.color = Color.WHITE inputText.forEachIndexed { index, s -> - font.draw(batch, s, 10f, TEXH - 30f - index * font.lineHeight) + font.draw(batch, s, 10f, TEXH - 30f - index * lineHeight) } batch.end() @@ -155,11 +154,11 @@ class FontTestGDX : Game() { } fun scrollAdd(x: Int = 1) { - scrollOffsetY -= (TEXH.toFloat() / HEIGHT) * 20f * x + scrollOffsetY -= (TEXH.toFloat() / HEIGHT) * lineHeight * x } fun scrollSub(x: Int = 1) { - scrollOffsetY += (TEXH.toFloat() / HEIGHT) * 20f * x + scrollOffsetY += (TEXH.toFloat() / HEIGHT) * lineHeight * x } class Navigator(val main: FontTestGDX) : InputAdapter() { @@ -270,7 +269,7 @@ class FontTestGDX : Game() { lateinit var appConfig: Lwjgl3ApplicationConfiguration const val TEXW = 874 -const val TEXH = 128 * 20 +const val TEXH = 24 * 130 const val WIDTH = TEXW const val HEIGHT = 768 diff --git a/assets/devanagari_variable.tga b/assets/devanagari_variable.tga index 56bfc4d..0e394ae 100644 --- a/assets/devanagari_variable.tga +++ b/assets/devanagari_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9593752c15758c0f90e93c151667d0e224d36f7f522205927f64f98f3f5485fb +oid sha256:c8f238f2e5e7d136588b5aa0610b20baa625adfac6915045bb9a423870e105e4 size 1474578 diff --git a/demo.PNG b/demo.PNG index f605fa1..73fe8e8 100644 Binary files a/demo.PNG and b/demo.PNG differ diff --git a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt index ae77797..37f2100 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -87,7 +87,10 @@ internal typealias Hash = Long * Shiftdown only occurs when non-diacritic character before the mark is lowercase, and the mark itself would stack up. * Stack-up or down is defined using Tag system. * + * ## Line Height * + * The line height is defined as 20 pixels on the font, and this number will not change on the source code to ensure backwards compatibility, + * **but I recommend you to use 24 pixels for the line height** for increased legibility. * * * @param noShadow Self-explanatory diff --git a/work_files/devanagari_variable.psd b/work_files/devanagari_variable.psd index be45fef..733af77 100644 --- a/work_files/devanagari_variable.psd +++ b/work_files/devanagari_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c52722437b9797747ec62b5d56834cc333bd0236d328b3a57b8b8779ffe75d41 -size 1464802 +oid sha256:dc2b832eba880bf1ccda7428603499d17202d1e4f5b520ff3bbf122c6494a379 +size 1464773