mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-14 17:44:05 +09:00
fixing up diacritics; complete unipunct
This commit is contained in:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user