fixing up diacritics; complete unipunct

This commit is contained in:
minjaesong
2018-08-22 18:17:48 +09:00
parent 97ef1ddc27
commit 04a375328c
13 changed files with 211 additions and 150 deletions

View File

@@ -9,7 +9,8 @@ data class GlyphProps(
val alignWhere: Int,
val alignXPos: Int,
val rtl: Boolean = false,
val stackWhere: Int = 0
val stackWhere: Int = 0,
var extInfo: IntArray? = null
) {
companion object {
const val ALIGN_LEFT = 0
@@ -24,6 +25,8 @@ data class GlyphProps(
const val DIA_OVERLAY = 1
const val DIA_JOINER = 2
private fun Boolean.toInt() = if (this) 1 else 0
}
constructor(width: Int, tags: Int) : this(
@@ -36,4 +39,28 @@ data class GlyphProps(
)
fun isOverlay() = writeOnTop && alignXPos == 1
override fun hashCode(): Int {
val tags = rtl.toInt() or alignXPos.shl(1) or alignWhere.shl(5) or
writeOnTop.toInt().shl(7) or stackWhere.shl(8)
var hash = -2128831034
extInfo?.forEach {
hash = hash xor it
hash = hash * 16777619
}
hash = hash xor tags
hash = hash * 167677619
return hash
}
override fun equals(other: Any?): Boolean {
// comparing hash because I'm lazy
return other is GlyphProps && this.hashCode() == other.hashCode()
}
fun requiredExtInfoCount() = if (stackWhere == STACK_BEFORE_N_AFTER) 2 else 0
}