mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-12 06:01:51 +09:00
glyph control bits spec change
This commit is contained in:
@@ -6,10 +6,11 @@ package net.torvald.terrarumsansbitmap
|
||||
data class GlyphProps(
|
||||
val width: Int,
|
||||
val writeOnTop: Boolean,
|
||||
val alignWhere: Int,
|
||||
val alignXPos: Int,
|
||||
val alignWhere: Int, // ALIGN_LEFT..ALIGN_BEFORE
|
||||
val alignXPos: Int, // 0..15 or DIA_OVERLAY/DIA_JOINER depends on the context
|
||||
val rtl: Boolean = false,
|
||||
val stackWhere: Int = 0,
|
||||
val stackWhere: Int = 0, // STACK_UP..STACK_UP_N_DOWN
|
||||
var nudgeRight: Boolean = false,
|
||||
var extInfo: IntArray? = null,
|
||||
|
||||
val hasKernData: Boolean = false,
|
||||
@@ -35,12 +36,13 @@ data class GlyphProps(
|
||||
}
|
||||
|
||||
constructor(width: Int, tags: Int) : this(
|
||||
width,
|
||||
tags.ushr(7).and(1) == 1,
|
||||
tags.ushr(5).and(3),
|
||||
tags.ushr(1).and(15),
|
||||
tags.and(1) == 1,
|
||||
tags.ushr(8).and(3)
|
||||
width,
|
||||
tags.ushr(7).and(1) == 1,
|
||||
tags.ushr(5).and(3),
|
||||
tags.ushr(1).and(15),
|
||||
tags.and(1) == 1,
|
||||
tags.ushr(8).and(3),
|
||||
tags.and(1) == 1
|
||||
)
|
||||
|
||||
constructor(width: Int, tags: Int, isLowheight: Boolean, isKernYtype: Boolean, kerningMask: Int) : this(
|
||||
@@ -50,6 +52,7 @@ data class GlyphProps(
|
||||
tags.ushr(1).and(15),
|
||||
tags.and(1) == 1,
|
||||
tags.ushr(8).and(3),
|
||||
tags.and(1) == 1,
|
||||
null,
|
||||
|
||||
true,
|
||||
|
||||
@@ -884,20 +884,21 @@ class TerrarumSansBitmap(
|
||||
posXbuffer[charIndex] = posXbuffer[nonDiacriticCounter]
|
||||
}
|
||||
else if (!thisProp.writeOnTop) {
|
||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||
GlyphProps.ALIGN_RIGHT ->
|
||||
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
||||
GlyphProps.ALIGN_CENTRE ->
|
||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
else ->
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
}
|
||||
posXbuffer[charIndex] = ((if (thisProp.nudgeRight) 1 else -1) * thisProp.alignXPos) +
|
||||
when (itsProp.alignWhere) {
|
||||
GlyphProps.ALIGN_RIGHT ->
|
||||
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
||||
GlyphProps.ALIGN_CENTRE ->
|
||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
else ->
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
}
|
||||
|
||||
nonDiacriticCounter = charIndex
|
||||
|
||||
stackUpwardCounter = 0
|
||||
stackDownwardCounter = 0
|
||||
extraWidth = 0
|
||||
extraWidth = (if (thisProp.nudgeRight) -1 else 1) * thisProp.alignXPos // NOTE: sign is flipped!
|
||||
}
|
||||
else if (thisProp.writeOnTop && thisProp.alignXPos == GlyphProps.DIA_JOINER) {
|
||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||
|
||||
@@ -51,7 +51,7 @@ class TerrarumTypewriterBitmap(
|
||||
|
||||
var interchar = 0
|
||||
|
||||
private val glyphProps = HashMap<CodePoint, GlyphProps>()
|
||||
val glyphProps = HashMap<CodePoint, GlyphProps>()
|
||||
private val sheets = HashMap<String, PixmapRegionPack>()
|
||||
|
||||
private val spriteSheetNames = HashMap<String, String>()
|
||||
@@ -424,20 +424,21 @@ class TerrarumTypewriterBitmap(
|
||||
|
||||
|
||||
if (!thisProp.writeOnTop) {
|
||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||
GlyphProps.ALIGN_RIGHT ->
|
||||
posXbuffer[nonDiacriticCounter] + TerrarumSansBitmap.W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
||||
GlyphProps.ALIGN_CENTRE ->
|
||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
else ->
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
}
|
||||
posXbuffer[charIndex] = ((if (thisProp.nudgeRight) 1 else -1) * thisProp.alignXPos) +
|
||||
when (itsProp.alignWhere) {
|
||||
GlyphProps.ALIGN_RIGHT ->
|
||||
posXbuffer[nonDiacriticCounter] + TerrarumSansBitmap.W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
||||
GlyphProps.ALIGN_CENTRE ->
|
||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
else ->
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||
}
|
||||
|
||||
nonDiacriticCounter = charIndex
|
||||
|
||||
stackUpwardCounter = 0
|
||||
stackDownwardCounter = 0
|
||||
extraWidth = 0
|
||||
extraWidth = (if (thisProp.nudgeRight) -1 else 1) * thisProp.alignXPos // NOTE: sign is flipped!
|
||||
}
|
||||
else if (thisProp.writeOnTop && thisProp.alignXPos == GlyphProps.DIA_JOINER) {
|
||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||
|
||||
Reference in New Issue
Block a user