diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7840665..1e1bf66 100755 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,6 +149,10 @@ This tag can be used as a general "replace this with these" directive, as long a Also note that the font compiler will not "stack" these diacritics. +#### The Keming Machine Tags + +Keming Machine Tags define the rough shape of the glyph. Please read `keming_machine.txt` for further information. + #### NOTES - If glyphs are right or centre aligned, they must be aligned in the same way inside of the bitmap; the font compiler assumes every variable-width glyphs to have a width of 15, regardless of the tagged width. diff --git a/assets/devanagari_variable.tga b/assets/devanagari_variable.tga index 73c7cd5..713762c 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:2483a2ff5709e4d967d02ede154a014e01e5407a58e025ddf8a7ce20f5c189e1 +oid sha256:a0c83740b9077381925fb57175f57b74424b42627796cc4e628b16cbe6e41a10 size 1474578 diff --git a/demo.PNG b/demo.PNG index 970c5e5..f605fa1 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 559473b..aa0ef64 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -1370,6 +1370,52 @@ class TerrarumSansBitmap( // println(seq4.joinToString(" ")) + // replace devanagari I/II with variants + i = 0 + var lenacc = 0 + while (i < seq4.size) { + val cPrev = seq4.getOrElse(i - 1) { -1 } + val c = seq4[i] + + if (c == DEVANAGARI_I) { + var j = 1 + var w = 0 + while (true) { + val cj = seq4.getOrElse(i + j) { -1 } + if (j > 3 || cj !in 0xF0140..0xF04FF) + break + + if (cj in devanagariPresentationConsonants || cj in devanagariPresentationConsonantsWithRa) { + w += glyphProps[cj]?.diacriticsAnchors?.get(0)?.x ?: 0 + break + } + else if (cj in devanagariPresentationConsonantsHalf || cj in devanagariPresentationConsonantsWithRaHalf) { + w += glyphProps[cj]?.width ?: 0 + j += 1 + } + else + break + } + +// println("length: $w, consonant count: $j") + + seq4[i] = (w+2).coerceIn(6,11) - 6 + 0xF0110 + + if (j > 1) i += j + } + else if (c == DEVANAGARI_II && + (cPrev in devanagariPresentationConsonants || cPrev in devanagariPresentationConsonantsWithRa)) { + val w = ((glyphProps[cPrev]?.width ?: 0) - (glyphProps[cPrev]?.diacriticsAnchors?.get(0)?.x ?: 0)) + +// println("length: $w") + + seq4[i] = 0xF0125 - ((w+1).coerceIn(4,9) - 4) + } + + + i++ + } + return seq4 } @@ -2071,6 +2117,8 @@ class TerrarumSansBitmap( private val DEVANAGARI_HA = 0x939.toDevaInternal() private val DEVANAGARI_U = 0x941 private val DEVANAGARI_UU = 0x942 + private val DEVANAGARI_I = 0x093F + private val DEVANAGARI_II = 0x0940 private val DEVANAGARI_RYA = 0xF0106 private val DEVANAGARI_HALF_RYA = 0xF0107 @@ -2088,6 +2136,7 @@ class TerrarumSansBitmap( private val DEVANAGARI_RA_SUPER = 0xF010C private val DEVANAGARI_RA_SUPER_COMPLEX = 0xF010D + private val MARWARI_DD = 0x978 private val DEVANAGARI_LIG_K_T = 0xF01BC diff --git a/work_files/devanagari_variable.psd b/work_files/devanagari_variable.psd index 4862dcc..dcc750e 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:616212a361358bee971d7ef18c86f9a3a3541c42bcea6585ea8c47c6477bbb0b -size 1464510 +oid sha256:6dd51651d30fe78db3ce628f3779786ea71837245a5ff47c7971da9bc3dbaf61 +size 1464740