diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1e1bf66..18f8e48 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -57,11 +57,13 @@ Rightmost vertical column (should be 20 px tall) contains the tags. Tags are def Y |= Diacritics Anchor Points (see below) X -' A -,_ 0 Align 1 Align 0 Align 1 Align before - A -' 0 left 0 right 1 centre 1 the glyph + A -' 0 Left 0 Right 1 Centre* 1 the glyph D --Diacritics Type Bit (see below; not all diacritics are actually marked as a diacritics on the spritesheet) S -,_ 0 Stack 1 Stack 0 Before 1 Up & (MSB) S -' 0 up 0 down 1 &After 1 Down* (e.g. U+0C48) +Align Centre is actually "align to where the anchor point is". Said anchor point default to the X-centre of the glyph. + Up&Down: 1. when two pixels are both #00FF00 it's "don't stack" 2. otherwise, it's actually up&down diff --git a/PUA_allocation_chart.xlsx b/PUA_allocation_chart.xlsx index db6d3c0..1a3b850 100755 Binary files a/PUA_allocation_chart.xlsx and b/PUA_allocation_chart.xlsx differ diff --git a/assets/sundanese_variable.tga b/assets/sundanese_variable.tga index 593a4c5..b30b756 100644 --- a/assets/sundanese_variable.tga +++ b/assets/sundanese_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:841367dea57f764384e8b6a4f8e11fd64bdd3f54ca611aef2af252e44488f649 -size 102418 +oid sha256:7c6dd7d71404c8d528038fcdefd254b08097f5e50db9d863f2eab8aa52ffdbd3 +size 122898 diff --git a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt index c01dc78..c275e6a 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -657,6 +657,7 @@ class TerrarumSansBitmap( // if (directiveOpcode != 0) dbgprn("Directive opcode ${directiveOpcode.toString(2)}: ${code.charInfo()}") // if (glyphProps[code]?.isPragma("replacewith") == true) dbgprn("Replacer: ${code.charInfo()} into ${glyphProps[code]!!.extInfo.map { it.toString(16) }.joinToString()}") // if (stackWhere == GlyphProps.STACK_DONT) dbgprn("Diacritics Don't stack: ${code.charInfo()}") + if (stackWhere == GlyphProps.STACK_DOWN) dbgprn("Diacritics stack down: ${code.charInfo()}") } } @@ -790,7 +791,7 @@ class TerrarumSansBitmap( stackUpwardCounter = 0 stackDownwardCounter = 0 - extraWidth = thisProp.nudgeX // NOTE: sign is flipped! + extraWidth = thisProp.nudgeX // This resets extraWidth. NOTE: sign is flipped! } // FIXME HACK: using 0th diacritics' X-anchor pos as a type selector /*else if (thisProp.writeOnTop && thisProp.diacriticsAnchors[0].x == GlyphProps.DIA_JOINER) { @@ -808,36 +809,37 @@ class TerrarumSansBitmap( else { val diacriticsType = thisProp.writeOnTop // set X pos according to alignment information - posXbuffer[charIndex] = when (thisProp.alignWhere) { - GlyphProps.ALIGN_LEFT, GlyphProps.ALIGN_BEFORE -> posXbuffer[nonDiacriticCounter] - GlyphProps.ALIGN_RIGHT -> { - val alignXPos = if (!itsProp.diacriticsAnchors[diacriticsType].xUsed) itsProp.width else itsProp.diacriticsAnchors[diacriticsType].x + posXbuffer[charIndex] = -thisProp.nudgeX + + when (thisProp.alignWhere) { + GlyphProps.ALIGN_LEFT, GlyphProps.ALIGN_BEFORE -> posXbuffer[nonDiacriticCounter] + GlyphProps.ALIGN_RIGHT -> { + println("thisprop alignright $kerning, $extraWidth") - posXbuffer[nonDiacriticCounter] - W_VAR_INIT + alignXPos - } - GlyphProps.ALIGN_CENTRE -> { - val alignXPos = if (!itsProp.diacriticsAnchors[diacriticsType].xUsed) itsProp.width.div(2) else itsProp.diacriticsAnchors[diacriticsType].x + extraWidth += thisProp.width + posXbuffer[nonDiacriticCounter]+ kerning + extraWidth - thisProp.width + } + GlyphProps.ALIGN_CENTRE -> { + val anchorPoint = + if (!itsProp.diacriticsAnchors[diacriticsType].xUsed) itsProp.width.div(2) else itsProp.diacriticsAnchors[diacriticsType].x - if (itsProp.alignWhere == GlyphProps.ALIGN_RIGHT) { - posXbuffer[nonDiacriticCounter] + alignXPos + (itsProp.width + 1).div(2) + if (itsProp.alignWhere == GlyphProps.ALIGN_RIGHT) { + posXbuffer[nonDiacriticCounter] + anchorPoint + (itsProp.width + 1).div(2) + } else { + posXbuffer[nonDiacriticCounter] + anchorPoint - HALF_VAR_INIT + } + } + else -> throw InternalError("Unsupported alignment: ${thisProp.alignWhere}") } - else { - posXbuffer[nonDiacriticCounter] + alignXPos - HALF_VAR_INIT - } - } - else -> throw InternalError("Unsupported alignment: ${thisProp.alignWhere}") - } // set Y pos according to diacritics position -// if (thisProp.alignWhere == GlyphProps.ALIGN_CENTRE) { when (thisProp.stackWhere) { GlyphProps.STACK_DOWN -> { - posYbuffer[charIndex] = (H_DIACRITICS * stackDownwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = -thisProp.nudgeY + (H_DIACRITICS * stackDownwardCounter + -thisProp.nudgeY) * flipY.toSign() stackDownwardCounter++ } GlyphProps.STACK_UP -> { - posYbuffer[charIndex] = (-H_DIACRITICS * stackUpwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = -thisProp.nudgeY + (-H_DIACRITICS * stackUpwardCounter + -thisProp.nudgeY) * flipY.toSign() // shift down on lowercase if applicable if (getSheetType(thisChar) in autoShiftDownOnLowercase && lastNonDiacriticChar.isLowHeight()) { @@ -855,11 +857,11 @@ class TerrarumSansBitmap( // dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.charInfo()}; stack counter: $stackUpwardCounter") } GlyphProps.STACK_UP_N_DOWN -> { - posYbuffer[charIndex] = (H_DIACRITICS * stackDownwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = -thisProp.nudgeY + (H_DIACRITICS * stackDownwardCounter + -thisProp.nudgeY) * flipY.toSign() stackDownwardCounter++ - posYbuffer[charIndex] = (-H_DIACRITICS * stackUpwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = -thisProp.nudgeY + (-H_DIACRITICS * stackUpwardCounter + -thisProp.nudgeY) * flipY.toSign() // shift down on lowercase if applicable if (getSheetType(thisChar) in autoShiftDownOnLowercase && lastNonDiacriticChar.isLowHeight()) { @@ -873,7 +875,8 @@ class TerrarumSansBitmap( } // for BEFORE_N_AFTER, do nothing in here } -// } + + // Don't reset extraWidth here! } } } @@ -2163,6 +2166,14 @@ class TerrarumSansBitmap( private const val MARWARI_HALFLIG_DD_Y = 0xF016F private const val MARWARI_LIG_DD_R = 0xF010E + private const val SUNDANESE_ING = 0xF0500 + private const val SUNDANESE_ENG = 0xF0501 + private const val SUNDANESE_EUNG = 0xF0502 + private const val SUNDANESE_IR = 0xF0503 + private const val SUNDANESE_ER = 0xF0504 + private const val SUNDANESE_EUR = 0xF0505 + private const val SUNDANESE_LU = 0xF0506 + private val devanagariConsonants = ((0x0915..0x0939) + (0x0958..0x095F) + (0x0978..0x097F) + (0xF0140..0xF04FF) + (0xF0106..0xF0109)).toHashSet() diff --git a/work_files/sundanese_variable.psd b/work_files/sundanese_variable.psd index 7d6725a..6306acd 100644 --- a/work_files/sundanese_variable.psd +++ b/work_files/sundanese_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:0bf46128d45064b295971007c72440636209393af1018ef850f7d0d7d81025ca -size 142846 +oid sha256:89cf949203a094fdae7391efbd0fd01f8599e9b88df3f80aeaea486a75a0ffb3 +size 166291