mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-06 05:58:30 +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 -,
|
||||||
K |= Tags used by the "Keming Machine"
|
K |= Tags used by the "Keming Machine"
|
||||||
K |
|
K |
|
||||||
K -' ,-Unused
|
K -' ,-Nudging control bit (see below)
|
||||||
· --'
|
N --'
|
||||||
X -, Align to this X pos of prev char, only valid if write-on-top is 1
|
X -, write-on-top and centre-aligned: Align to this X pos of prev char
|
||||||
X |= and is centre-aligned and non-zero
|
X | (if this is zero, floorOf(width/2) will be used instead)
|
||||||
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 -'
|
X -' left (if N is unset) or right (if N is set)
|
||||||
A -,_ 0 Align 1 Align 0 Align 1 Align before
|
A -,_ 0 Align 1 Align 0 Align 1 Align before
|
||||||
A -' 0 left 0 right 1 centre 1 the glyph
|
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)
|
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(
|
data class GlyphProps(
|
||||||
val width: Int,
|
val width: Int,
|
||||||
val writeOnTop: Boolean,
|
val writeOnTop: Boolean,
|
||||||
val alignWhere: Int,
|
val alignWhere: Int, // ALIGN_LEFT..ALIGN_BEFORE
|
||||||
val alignXPos: Int,
|
val alignXPos: Int, // 0..15 or DIA_OVERLAY/DIA_JOINER depends on the context
|
||||||
val rtl: Boolean = false,
|
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,
|
var extInfo: IntArray? = null,
|
||||||
|
|
||||||
val hasKernData: Boolean = false,
|
val hasKernData: Boolean = false,
|
||||||
@@ -35,12 +36,13 @@ data class GlyphProps(
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(width: Int, tags: Int) : this(
|
constructor(width: Int, tags: Int) : this(
|
||||||
width,
|
width,
|
||||||
tags.ushr(7).and(1) == 1,
|
tags.ushr(7).and(1) == 1,
|
||||||
tags.ushr(5).and(3),
|
tags.ushr(5).and(3),
|
||||||
tags.ushr(1).and(15),
|
tags.ushr(1).and(15),
|
||||||
tags.and(1) == 1,
|
tags.and(1) == 1,
|
||||||
tags.ushr(8).and(3)
|
tags.ushr(8).and(3),
|
||||||
|
tags.and(1) == 1
|
||||||
)
|
)
|
||||||
|
|
||||||
constructor(width: Int, tags: Int, isLowheight: Boolean, isKernYtype: Boolean, kerningMask: Int) : this(
|
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.ushr(1).and(15),
|
||||||
tags.and(1) == 1,
|
tags.and(1) == 1,
|
||||||
tags.ushr(8).and(3),
|
tags.ushr(8).and(3),
|
||||||
|
tags.and(1) == 1,
|
||||||
null,
|
null,
|
||||||
|
|
||||||
true,
|
true,
|
||||||
|
|||||||
@@ -884,20 +884,21 @@ class TerrarumSansBitmap(
|
|||||||
posXbuffer[charIndex] = posXbuffer[nonDiacriticCounter]
|
posXbuffer[charIndex] = posXbuffer[nonDiacriticCounter]
|
||||||
}
|
}
|
||||||
else if (!thisProp.writeOnTop) {
|
else if (!thisProp.writeOnTop) {
|
||||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
posXbuffer[charIndex] = ((if (thisProp.nudgeRight) 1 else -1) * thisProp.alignXPos) +
|
||||||
GlyphProps.ALIGN_RIGHT ->
|
when (itsProp.alignWhere) {
|
||||||
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
GlyphProps.ALIGN_RIGHT ->
|
||||||
GlyphProps.ALIGN_CENTRE ->
|
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
||||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
GlyphProps.ALIGN_CENTRE ->
|
||||||
else ->
|
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
else ->
|
||||||
}
|
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||||
|
}
|
||||||
|
|
||||||
nonDiacriticCounter = charIndex
|
nonDiacriticCounter = charIndex
|
||||||
|
|
||||||
stackUpwardCounter = 0
|
stackUpwardCounter = 0
|
||||||
stackDownwardCounter = 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) {
|
else if (thisProp.writeOnTop && thisProp.alignXPos == GlyphProps.DIA_JOINER) {
|
||||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ class TerrarumTypewriterBitmap(
|
|||||||
|
|
||||||
var interchar = 0
|
var interchar = 0
|
||||||
|
|
||||||
private val glyphProps = HashMap<CodePoint, GlyphProps>()
|
val glyphProps = HashMap<CodePoint, GlyphProps>()
|
||||||
private val sheets = HashMap<String, PixmapRegionPack>()
|
private val sheets = HashMap<String, PixmapRegionPack>()
|
||||||
|
|
||||||
private val spriteSheetNames = HashMap<String, String>()
|
private val spriteSheetNames = HashMap<String, String>()
|
||||||
@@ -424,20 +424,21 @@ class TerrarumTypewriterBitmap(
|
|||||||
|
|
||||||
|
|
||||||
if (!thisProp.writeOnTop) {
|
if (!thisProp.writeOnTop) {
|
||||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
posXbuffer[charIndex] = ((if (thisProp.nudgeRight) 1 else -1) * thisProp.alignXPos) +
|
||||||
GlyphProps.ALIGN_RIGHT ->
|
when (itsProp.alignWhere) {
|
||||||
posXbuffer[nonDiacriticCounter] + TerrarumSansBitmap.W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
GlyphProps.ALIGN_RIGHT ->
|
||||||
GlyphProps.ALIGN_CENTRE ->
|
posXbuffer[nonDiacriticCounter] + TerrarumSansBitmap.W_VAR_INIT + alignmentOffset + interchar + kerning + extraWidth
|
||||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
GlyphProps.ALIGN_CENTRE ->
|
||||||
else ->
|
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
else ->
|
||||||
}
|
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar + kerning + extraWidth
|
||||||
|
}
|
||||||
|
|
||||||
nonDiacriticCounter = charIndex
|
nonDiacriticCounter = charIndex
|
||||||
|
|
||||||
stackUpwardCounter = 0
|
stackUpwardCounter = 0
|
||||||
stackDownwardCounter = 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) {
|
else if (thisProp.writeOnTop && thisProp.alignXPos == GlyphProps.DIA_JOINER) {
|
||||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||||
|
|||||||
Reference in New Issue
Block a user