another devanagari changes

This commit is contained in:
minjaesong
2022-03-19 10:42:00 +09:00
parent 23c7ae15a2
commit bfaa190e49
5 changed files with 13 additions and 11 deletions

View File

@@ -27,13 +27,15 @@ class FontTestGDX : Game() {
lateinit var camera: OrthographicCamera lateinit var camera: OrthographicCamera
private val testing = true private val testing = false
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 private lateinit var faketex: Texture
private val lineHeight = 24
override fun create() { override fun create() {
font = TerrarumSansBitmap("./assets", debug = true, flipY = false, errorOnUnknownChar = false, shadowAlpha = 0.5f) // must test for two flipY cases 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() batch = SpriteBatch()
println(font.getWidth("हिन्दी"))
// create faketex // create faketex
val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888) val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888)
fakepix.drawPixel(0,0,-1) fakepix.drawPixel(0,0,-1)
@@ -99,7 +98,7 @@ class FontTestGDX : Game() {
batch.color = Color.WHITE 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 * lineHeight)
} }
batch.end() batch.end()
@@ -155,11 +154,11 @@ class FontTestGDX : Game() {
} }
fun scrollAdd(x: Int = 1) { fun scrollAdd(x: Int = 1) {
scrollOffsetY -= (TEXH.toFloat() / HEIGHT) * 20f * x scrollOffsetY -= (TEXH.toFloat() / HEIGHT) * lineHeight * x
} }
fun scrollSub(x: Int = 1) { fun scrollSub(x: Int = 1) {
scrollOffsetY += (TEXH.toFloat() / HEIGHT) * 20f * x scrollOffsetY += (TEXH.toFloat() / HEIGHT) * lineHeight * x
} }
class Navigator(val main: FontTestGDX) : InputAdapter() { class Navigator(val main: FontTestGDX) : InputAdapter() {
@@ -270,7 +269,7 @@ class FontTestGDX : Game() {
lateinit var appConfig: Lwjgl3ApplicationConfiguration lateinit var appConfig: Lwjgl3ApplicationConfiguration
const val TEXW = 874 const val TEXW = 874
const val TEXH = 128 * 20 const val TEXH = 24 * 130
const val WIDTH = TEXW const val WIDTH = TEXW
const val HEIGHT = 768 const val HEIGHT = 768

Binary file not shown.

BIN
demo.PNG

Binary file not shown.

Before

Width:  |  Height:  |  Size: 148 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

@@ -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. * 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. * 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 * @param noShadow Self-explanatory

Binary file not shown.