mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 20:01:52 +09:00
(in a Crocodile Dundee vibe) that's not a fix; this is a fix
This commit is contained in:
@@ -57,12 +57,15 @@ Rightmost vertical column (should be 20 px tall) contains the tags. Tags are def
|
|||||||
Y |= Diacritics Anchor Points (see below)
|
Y |= Diacritics Anchor Points (see below)
|
||||||
X -'
|
X -'
|
||||||
A -,_ 0 Align 1 Align 0 Align 1 Align before
|
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)
|
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 &
|
S -,_ 0 Stack 1 Stack 0 Before 1 Up &
|
||||||
(MSB) S -' 0 up 0 down 1 &After 1 Down* (e.g. U+0C48)
|
(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.
|
Align Centre and Align Right will respect the diacritics anchor points.
|
||||||
|
The Align Right AND Custom anchor point is being used for Thai diacritics.
|
||||||
|
When a width AND diacritics type bit is set, the entire glyph is shifted to the right as specified and the space of same width will be inserted.
|
||||||
|
(See SUNDANESE PAMINGKAL U+1BA1)
|
||||||
|
|
||||||
Up&Down:
|
Up&Down:
|
||||||
1. when two pixels are both #00FF00 it's "don't stack"
|
1. when two pixels are both #00FF00 it's "don't stack"
|
||||||
|
|||||||
BIN
assets/sundanese_variable.tga
LFS
BIN
assets/sundanese_variable.tga
LFS
Binary file not shown.
BIN
assets/thai_variable.tga
LFS
BIN
assets/thai_variable.tga
LFS
Binary file not shown.
BIN
demo.PNG
BIN
demo.PNG
Binary file not shown.
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 152 KiB |
@@ -333,10 +333,7 @@ class TerrarumSansBitmap(
|
|||||||
// If the line starts with a letter-with-diacritic, it will error out
|
// If the line starts with a letter-with-diacritic, it will error out
|
||||||
// Some diacritics (e.g. COMBINING TILDE) do not obey lowercase letters
|
// Some diacritics (e.g. COMBINING TILDE) do not obey lowercase letters
|
||||||
val charSeqNotBlank = codepoints.size > 0 // determine emptiness BEFORE you hack a null chars in
|
val charSeqNotBlank = codepoints.size > 0 // determine emptiness BEFORE you hack a null chars in
|
||||||
val newCodepoints = CodepointSequence()
|
val newCodepoints = codepoints
|
||||||
newCodepoints.add(0)
|
|
||||||
newCodepoints.addAll(codepoints)
|
|
||||||
newCodepoints.add(0)
|
|
||||||
|
|
||||||
fun Int.flipY() = this * if (flipY) 1 else -1
|
fun Int.flipY() = this * if (flipY) 1 else -1
|
||||||
|
|
||||||
@@ -657,7 +654,8 @@ class TerrarumSansBitmap(
|
|||||||
// if (directiveOpcode != 0) dbgprn("Directive opcode ${directiveOpcode.toString(2)}: ${code.charInfo()}")
|
// 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 (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_DONT) dbgprn("Diacritics Don't stack: ${code.charInfo()}")
|
||||||
if (stackWhere == GlyphProps.STACK_DOWN) dbgprn("Diacritics stack down: ${code.charInfo()}")
|
// if (stackWhere == GlyphProps.STACK_DOWN) dbgprn("Diacritics stack down: ${code.charInfo()}")
|
||||||
|
// if (writeOnTop > -1 && alignWhere == GlyphProps.ALIGN_RIGHT && width > 0) dbgprn("Diacritics aligned to the right with width of $width: ${code.charInfo()}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,10 +786,10 @@ class TerrarumSansBitmap(
|
|||||||
posYbuffer[charIndex] = -thisProp.nudgeY
|
posYbuffer[charIndex] = -thisProp.nudgeY
|
||||||
|
|
||||||
nonDiacriticCounter = charIndex
|
nonDiacriticCounter = charIndex
|
||||||
|
extraWidth = thisProp.nudgeX // This resets extraWidth. NOTE: sign is flipped!
|
||||||
|
|
||||||
stackUpwardCounter = 0
|
stackUpwardCounter = 0
|
||||||
stackDownwardCounter = 0
|
stackDownwardCounter = 0
|
||||||
extraWidth = thisProp.nudgeX // This resets extraWidth. NOTE: sign is flipped!
|
|
||||||
}
|
}
|
||||||
// FIXME HACK: using 0th diacritics' X-anchor pos as a type selector
|
// FIXME HACK: using 0th diacritics' X-anchor pos as a type selector
|
||||||
/*else if (thisProp.writeOnTop && thisProp.diacriticsAnchors[0].x == GlyphProps.DIA_JOINER) {
|
/*else if (thisProp.writeOnTop && thisProp.diacriticsAnchors[0].x == GlyphProps.DIA_JOINER) {
|
||||||
@@ -813,10 +811,13 @@ class TerrarumSansBitmap(
|
|||||||
when (thisProp.alignWhere) {
|
when (thisProp.alignWhere) {
|
||||||
GlyphProps.ALIGN_LEFT, GlyphProps.ALIGN_BEFORE -> posXbuffer[nonDiacriticCounter]
|
GlyphProps.ALIGN_LEFT, GlyphProps.ALIGN_BEFORE -> posXbuffer[nonDiacriticCounter]
|
||||||
GlyphProps.ALIGN_RIGHT -> {
|
GlyphProps.ALIGN_RIGHT -> {
|
||||||
println("thisprop alignright $kerning, $extraWidth")
|
// println("thisprop alignright $kerning, $extraWidth")
|
||||||
|
|
||||||
|
val anchorPoint =
|
||||||
|
if (!itsProp.diacriticsAnchors[diacriticsType].xUsed) itsProp.width else itsProp.diacriticsAnchors[diacriticsType].x
|
||||||
|
|
||||||
extraWidth += thisProp.width
|
extraWidth += thisProp.width
|
||||||
posXbuffer[nonDiacriticCounter]+ kerning + extraWidth - thisProp.width
|
posXbuffer[nonDiacriticCounter] + anchorPoint - W_VAR_INIT + kerning + extraWidth
|
||||||
}
|
}
|
||||||
GlyphProps.ALIGN_CENTRE -> {
|
GlyphProps.ALIGN_CENTRE -> {
|
||||||
val anchorPoint =
|
val anchorPoint =
|
||||||
@@ -964,7 +965,7 @@ class TerrarumSansBitmap(
|
|||||||
val c = dis[i]
|
val c = dis[i]
|
||||||
val cNext = dis.getOrElse(i+1) { -1 }
|
val cNext = dis.getOrElse(i+1) { -1 }
|
||||||
|
|
||||||
// turn Unicode Devanagari consonants into the internal one
|
// turn Unicode Devanagari consonants into the internal counterpart
|
||||||
if (c in 0x0915..0x0939 || c in 0x0958..0x095F)
|
if (c in 0x0915..0x0939 || c in 0x0958..0x095F)
|
||||||
if (cNext == DEVANAGARI_NUQTA) {
|
if (cNext == DEVANAGARI_NUQTA) {
|
||||||
seq0.add(c.toDevaInternal().internalDevaAddNukta())
|
seq0.add(c.toDevaInternal().internalDevaAddNukta())
|
||||||
@@ -973,9 +974,22 @@ class TerrarumSansBitmap(
|
|||||||
else {
|
else {
|
||||||
seq0.add(c.toDevaInternal())
|
seq0.add(c.toDevaInternal())
|
||||||
}
|
}
|
||||||
|
// re-order Sundanese diacritics
|
||||||
|
else if ((c == 0x1BA1 || c == 0x1BA2) && cNext == 0x1BA5) {
|
||||||
|
seq0.add(cNext); seq0.add(c); i += 1
|
||||||
|
}
|
||||||
|
// combine two Sundanese diacritics to internal counterpart
|
||||||
|
else if (c == 0x1BA4 && cNext == 0x1B80) { seq0.add(SUNDANESE_ING); i += 1 }
|
||||||
|
else if (c == 0x1BA8 && cNext == 0x1B80) { seq0.add(SUNDANESE_ENG); i += 1 }
|
||||||
|
else if (c == 0x1BA9 && cNext == 0x1B80) { seq0.add(SUNDANESE_EUNG); i += 1 }
|
||||||
|
else if (c == 0x1BA4 && cNext == 0x1B81) { seq0.add(SUNDANESE_IR); i += 1 }
|
||||||
|
else if (c == 0x1BA8 && cNext == 0x1B81) { seq0.add(SUNDANESE_ER); i += 1 }
|
||||||
|
else if (c == 0x1BA9 && cNext == 0x1B81) { seq0.add(SUNDANESE_EUR); i += 1 }
|
||||||
|
else if (c == 0x1BA3 && cNext == 0x1BA5) { seq0.add(SUNDANESE_LU); i += 1 }
|
||||||
else
|
else
|
||||||
seq0.add(c)
|
seq0.add(c)
|
||||||
|
|
||||||
|
|
||||||
i += 1
|
i += 1
|
||||||
}
|
}
|
||||||
seq0.add(0)
|
seq0.add(0)
|
||||||
@@ -2094,7 +2108,7 @@ class TerrarumSansBitmap(
|
|||||||
(0x0B80..0x0BFF) + (0xF00C0..0xF00FF), // SHEET_TAMIL_VARW
|
(0x0B80..0x0BFF) + (0xF00C0..0xF00FF), // SHEET_TAMIL_VARW
|
||||||
0x980..0x9FF, // SHEET_BENGALI_VARW
|
0x980..0x9FF, // SHEET_BENGALI_VARW
|
||||||
0x2800..0x28FF, // SHEET_BRAILLE_VARW
|
0x2800..0x28FF, // SHEET_BRAILLE_VARW
|
||||||
(0x1B80..0x1BBF) + (0x1CC0..0x1CCF), // SHEET_SUNDANESE_VARW
|
(0x1B80..0x1BBF) + (0x1CC0..0x1CCF) + (0xF0500..0xF050F), // SHEET_SUNDANESE_VARW
|
||||||
0xF0110..0xF012F, // SHEET_DEVANAGARI2_INTERNAL_VARW
|
0xF0110..0xF012F, // SHEET_DEVANAGARI2_INTERNAL_VARW
|
||||||
)
|
)
|
||||||
private val codeRangeHangulCompat = 0x3130..0x318F
|
private val codeRangeHangulCompat = 0x3130..0x318F
|
||||||
@@ -2394,7 +2408,7 @@ class TerrarumSansBitmap(
|
|||||||
private fun enclosedAlphnumSuplY(c: CodePoint) = (c - 0x1F100) / 16
|
private fun enclosedAlphnumSuplY(c: CodePoint) = (c - 0x1F100) / 16
|
||||||
private fun tamilIndexY(c: CodePoint) = (if (c < 0xF0000) (c - 0x0B80) else (c - 0xF0040)) / 16
|
private fun tamilIndexY(c: CodePoint) = (if (c < 0xF0000) (c - 0x0B80) else (c - 0xF0040)) / 16
|
||||||
private fun brailleIndexY(c: CodePoint) = (c - 0x2800) / 16
|
private fun brailleIndexY(c: CodePoint) = (c - 0x2800) / 16
|
||||||
private fun sundaneseIndexY(c: CodePoint) = (if (c < 0x1BC0) (c - 0x1B80) else (c - 0x1C80)) / 16
|
private fun sundaneseIndexY(c: CodePoint) = (if (c >= 0xF0500) (c - 0xF04B0) else if (c < 0x1BC0) (c - 0x1B80) else (c - 0x1C80)) / 16
|
||||||
private fun devanagari2IndexY(c: CodePoint) = (c - 0xF0110) / 16
|
private fun devanagari2IndexY(c: CodePoint) = (c - 0xF0110) / 16
|
||||||
|
|
||||||
val charsetOverrideDefault = Character.toChars(CHARSET_OVERRIDE_DEFAULT).toSurrogatedString()
|
val charsetOverrideDefault = Character.toChars(CHARSET_OVERRIDE_DEFAULT).toSurrogatedString()
|
||||||
|
|||||||
Binary file not shown.
BIN
work_files/thai_variable.psd
LFS
BIN
work_files/thai_variable.psd
LFS
Binary file not shown.
Reference in New Issue
Block a user