mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 20:01:52 +09:00
glyph control bits spec change
This commit is contained in:
@@ -50,12 +50,12 @@ Rightmost vertical column (should be 20 px tall) contains the tags. Tags are def
|
||||
K -,
|
||||
K |= Tags used by the "Keming Machine"
|
||||
K |
|
||||
K -' ,-Unused
|
||||
· --'
|
||||
X -, Align to this X pos of prev char, only valid if write-on-top is 1
|
||||
X |= and is centre-aligned and non-zero
|
||||
X | (if this is zero, floorOf(width/2) will be used instead)
|
||||
X -'
|
||||
K -' ,-Nudging control bit (see below)
|
||||
N --'
|
||||
X -, write-on-top and centre-aligned: Align to this X pos of prev char
|
||||
X | (if this is zero, floorOf(width/2) will be used instead)
|
||||
X | NOT write-on-top: nudge the texture by this pixels to the
|
||||
X -' left (if N is unset) or right (if N is set)
|
||||
A -,_ 0 Align 1 Align 0 Align 1 Align before
|
||||
A -' 0 left 0 right 1 centre 1 the glyph
|
||||
D --write-on-top, usually it's diatritics but not always (e.g. devanagari vowel sign O)
|
||||
|
||||
@@ -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