diff --git a/FontTestGDX/src/FontTestGDX.kt b/FontTestGDX/src/FontTestGDX.kt index 6a5eeb8..0d70cd1 100755 --- a/FontTestGDX/src/FontTestGDX.kt +++ b/FontTestGDX/src/FontTestGDX.kt @@ -26,7 +26,7 @@ class FontTestGDX : Game() { lateinit var camera: OrthographicCamera - private val testing = false + private val testing = true private val demotextName = if (testing) "testtext.txt" else "demotext.txt" private val outimageName = if (testing) "testing.PNG" else "demo.PNG" diff --git a/assets/thai_variable.tga b/assets/thai_variable.tga index 4783b52..590787a 100755 --- a/assets/thai_variable.tga +++ b/assets/thai_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:134e9efce4e298b623bb3f977c5a8d65d05bdc3924e4be0564cebb4683ee5692 +oid sha256:ceb3411baa2b6aabb7a2de2404abed96082b057a72ae5d98632c062fdb0c3dd6 size 122898 diff --git a/demo.PNG b/demo.PNG index 772d2f2..629835e 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 6aa5fbf..226c3a0 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -849,7 +849,7 @@ class TerrarumSansBitmap( var nonDiacriticCounter = 0 // index of last instance of non-diacritic char - var stackUpwardCounter = 0 + var stackUpwardCounter = 0 // TODO separate stack counter for centre- and right aligned var stackDownwardCounter = 0 val HALF_VAR_INIT = W_VAR_INIT.minus(1).div(2) @@ -963,15 +963,14 @@ class TerrarumSansBitmap( // set Y pos according to diacritics position - if (thisProp.alignWhere == GlyphProps.ALIGN_CENTRE) { +// if (thisProp.alignWhere == GlyphProps.ALIGN_CENTRE) { when (thisProp.stackWhere) { GlyphProps.STACK_DOWN -> { - posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter + posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter * flipY.toSign() stackDownwardCounter++ } GlyphProps.STACK_UP -> { - posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter - + posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter * flipY.toSign() // shift down on lowercase if applicable if (getSheetType(thisChar) in autoShiftDownOnLowercase && lastNonDiacriticChar.isLowHeight()) { @@ -979,22 +978,35 @@ class TerrarumSansBitmap( //dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.toHex()}") //dbgprn("cond: ${thisProp.alignXPos == GlyphProps.DIA_OVERLAY}, charIndex: $charIndex") if (diacriticsType == GlyphProps.DIA_OVERLAY) - posYbuffer[charIndex] -= H_OVERLAY_LOWERCASE_SHIFTDOWN * (!flipY).toSign() // if minus-assign doesn't work, try plus-assign + posYbuffer[charIndex] += H_OVERLAY_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign else - posYbuffer[charIndex] -= H_STACKUP_LOWERCASE_SHIFTDOWN * (!flipY).toSign() // if minus-assign doesn't work, try plus-assign + posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign + } + + stackUpwardCounter++ + + dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.charInfo()}; stack counter: $stackUpwardCounter") + } + GlyphProps.STACK_UP_N_DOWN -> { + posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter * flipY.toSign() + stackDownwardCounter++ + + + posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter * flipY.toSign() + // shift down on lowercase if applicable + if (getSheetType(thisChar) in autoShiftDownOnLowercase && + lastNonDiacriticChar.isLowHeight()) { + if (diacriticsType == GlyphProps.DIA_OVERLAY) + posYbuffer[charIndex] += H_OVERLAY_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign + else + posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign } stackUpwardCounter++ } - GlyphProps.STACK_UP_N_DOWN -> { - posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter - stackDownwardCounter++ - posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter - stackUpwardCounter++ - } // for BEFORE_N_AFTER, do nothing in here } - } +// } } } } diff --git a/testing.PNG b/testing.PNG index 5dd3bb0..185a67c 100755 Binary files a/testing.PNG and b/testing.PNG differ diff --git a/testtext.txt b/testtext.txt index 481a614..81f1aff 100755 --- a/testtext.txt +++ b/testtext.txt @@ -1,4 +1,5 @@ A ดุ ตี ปู่ พี่ ป่ ม่ ปั มั พีุ - U̸ u̸ \ No newline at end of file + ทิ่ท่ท่ิ ปิ่ป่ป่ิ ทิ้ ปิ้ มำด มําด + diff --git a/work_files/thai_variable.psd b/work_files/thai_variable.psd index 3a4f11b..662744a 100644 --- a/work_files/thai_variable.psd +++ b/work_files/thai_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b68e8c5f51f896fd24f4c93db2bc8488acb3959da791599733d9333f26117dd7 -size 122981 +oid sha256:d20dd7374ebacdbb38c8d8a431d4ba357f478ff18735b7a7f169c158f18569ab +size 123326