fix: wide glue with size multiple of 16 would cause issues

This commit is contained in:
minjaesong
2024-05-02 17:47:58 +09:00
parent a719d872c2
commit b7ecfd910e
2 changed files with 26 additions and 12 deletions

View File

@@ -883,16 +883,28 @@ class MovableType(
else { else {
val fullGlues = this.absoluteValue / 16 val fullGlues = this.absoluteValue / 16
val smallGlues = this.absoluteValue % 16 val smallGlues = this.absoluteValue % 16
if (this > 0) if (smallGlues > 0) {
tokens.addAll( if (this > 0)
List(fullGlues) { GLUE_POSITIVE_SIXTEEN } + tokens.addAll(
listOf(GLUE_POSITIVE_ONE + (smallGlues - 1)) List(fullGlues) { GLUE_POSITIVE_SIXTEEN } +
) listOf(GLUE_POSITIVE_ONE + (smallGlues - 1))
else )
tokens.addAll( else
List(fullGlues) { GLUE_NEGATIVE_SIXTEEN } + tokens.addAll(
listOf(GLUE_NEGATIVE_ONE + (smallGlues - 1)) List(fullGlues) { GLUE_NEGATIVE_SIXTEEN } +
) listOf(GLUE_NEGATIVE_ONE + (smallGlues - 1))
)
}
else {
if (this > 0)
tokens.addAll(
List(fullGlues) { GLUE_POSITIVE_SIXTEEN }
)
else
tokens.addAll(
List(fullGlues) { GLUE_NEGATIVE_SIXTEEN }
)
}
} }
return tokens return tokens

View File

@@ -751,6 +751,7 @@ class TerrarumSansBitmap(
for (i in 0 until 16) { for (i in 0 until 16) {
glyphProps[i] = GlyphProps(0) glyphProps[i] = GlyphProps(0)
glyphProps[i + 16] = GlyphProps(0) glyphProps[i + 16] = GlyphProps(0)
glyphProps[FIXED_BLOCK_1 + i] = GlyphProps(i + 1)
glyphProps[MOVABLE_BLOCK_1 + i] = GlyphProps(i + 1) glyphProps[MOVABLE_BLOCK_1 + i] = GlyphProps(i + 1)
glyphProps[MOVABLE_BLOCK_M1 + i] = GlyphProps(-i - 1) glyphProps[MOVABLE_BLOCK_M1 + i] = GlyphProps(-i - 1)
} }
@@ -2180,8 +2181,9 @@ class TerrarumSansBitmap(
internal const val CHARSET_OVERRIDE_BG_BG = 0xFFFC1 internal const val CHARSET_OVERRIDE_BG_BG = 0xFFFC1
internal const val CHARSET_OVERRIDE_SR_SR = 0xFFFC2 internal const val CHARSET_OVERRIDE_SR_SR = 0xFFFC2
internal const val MOVABLE_BLOCK_1 = 0xFFFF0 internal const val FIXED_BLOCK_1 = 0xFFFD0
internal const val MOVABLE_BLOCK_M1 = 0xFFFE0 internal const val MOVABLE_BLOCK_M1 = 0xFFFE0
internal const val MOVABLE_BLOCK_1 = 0xFFFF0
private val autoShiftDownOnLowercase = arrayOf( private val autoShiftDownOnLowercase = arrayOf(
@@ -2541,7 +2543,7 @@ class TerrarumSansBitmap(
private fun isBulgarian(c: CodePoint) = c in 0xF0000..0xF005F private fun isBulgarian(c: CodePoint) = c in 0xF0000..0xF005F
private fun isSerbian(c: CodePoint) = c in 0xF0060..0xF00BF private fun isSerbian(c: CodePoint) = c in 0xF0060..0xF00BF
fun isColourCode(c: CodePoint) = c == 0x100000 || c in 0x10F000..0x10FFFF fun isColourCode(c: CodePoint) = c == 0x100000 || c in 0x10F000..0x10FFFF
private fun isCharsetOverride(c: CodePoint) = c in 0xFFFC0..0xFFFDF private fun isCharsetOverride(c: CodePoint) = c in 0xFFFC0..0xFFFCF
private fun isDevanagari(c: CodePoint) = c in codeRange[SHEET_DEVANAGARI_VARW] private fun isDevanagari(c: CodePoint) = c in codeRange[SHEET_DEVANAGARI_VARW]
private fun isHangulCompat(c: CodePoint) = c in codeRangeHangulCompat private fun isHangulCompat(c: CodePoint) = c in codeRangeHangulCompat