mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-17 00:16:17 +09:00
tfw part of your code was full of hacks
This commit is contained in:
Binary file not shown.
BIN
src/assets/cyrilic_variable.tga
LFS
BIN
src/assets/cyrilic_variable.tga
LFS
Binary file not shown.
BIN
src/assets/thai_variable.tga
LFS
BIN
src/assets/thai_variable.tga
LFS
Binary file not shown.
@@ -1125,8 +1125,7 @@ class TerrarumSansBitmap(
|
|||||||
var nonDiacriticCounter = 0 // index of last instance of non-diacritic char
|
var nonDiacriticCounter = 0 // index of last instance of non-diacritic char
|
||||||
var stackUpwardCounter = 0 // TODO separate stack counter for centre- and right aligned
|
var stackUpwardCounter = 0 // TODO separate stack counter for centre- and right aligned
|
||||||
var stackDownwardCounter = 0
|
var stackDownwardCounter = 0
|
||||||
var nudgeUpwardCounter = 0
|
var nudgeUpHighWater = 0 // tracks max nudgeY seen in current stack, so subsequent marks with lower nudge still clear the previous one
|
||||||
var nudgeDownwardCounter = 0
|
|
||||||
|
|
||||||
val HALF_VAR_INIT = W_VAR_INIT.minus(1).div(2)
|
val HALF_VAR_INIT = W_VAR_INIT.minus(1).div(2)
|
||||||
|
|
||||||
@@ -1205,8 +1204,7 @@ class TerrarumSansBitmap(
|
|||||||
|
|
||||||
stackUpwardCounter = 0
|
stackUpwardCounter = 0
|
||||||
stackDownwardCounter = 0
|
stackDownwardCounter = 0
|
||||||
nudgeUpwardCounter = 0
|
nudgeUpHighWater = 0
|
||||||
nudgeDownwardCounter = 0
|
|
||||||
}
|
}
|
||||||
// FIXME HACK: using 0th diacritics' X-anchor pos as a type selector
|
// FIXME HACK: using 0th diacritics' X-anchor pos as a type selector
|
||||||
/*else if (thisProp.writeOnTop && thisProp.diacriticsAnchors[0].x == GlyphProps.DIA_JOINER) {
|
/*else if (thisProp.writeOnTop && thisProp.diacriticsAnchors[0].x == GlyphProps.DIA_JOINER) {
|
||||||
@@ -1286,12 +1284,12 @@ class TerrarumSansBitmap(
|
|||||||
// set Y pos according to diacritics position
|
// set Y pos according to diacritics position
|
||||||
when (thisProp.stackWhere) {
|
when (thisProp.stackWhere) {
|
||||||
GlyphProps.STACK_DOWN -> {
|
GlyphProps.STACK_DOWN -> {
|
||||||
posYbuffer[charIndex] = (-thisProp.nudgeY + H_DIACRITICS * stackDownwardCounter) * flipY.toSign() - thisProp.nudgeY - nudgeDownwardCounter
|
posYbuffer[charIndex] = (-thisProp.nudgeY + H_DIACRITICS * stackDownwardCounter) * flipY.toSign() - thisProp.nudgeY
|
||||||
stackDownwardCounter++
|
stackDownwardCounter++
|
||||||
nudgeDownwardCounter -= thisProp.nudgeY
|
|
||||||
}
|
}
|
||||||
GlyphProps.STACK_UP -> {
|
GlyphProps.STACK_UP -> {
|
||||||
posYbuffer[charIndex] = -thisProp.nudgeY + (-H_DIACRITICS * stackUpwardCounter + -thisProp.nudgeY) * flipY.toSign() + thisProp.nudgeY + nudgeUpwardCounter
|
val effectiveNudge = maxOf(thisProp.nudgeY, nudgeUpHighWater)
|
||||||
|
posYbuffer[charIndex] = -effectiveNudge + (-H_DIACRITICS * stackUpwardCounter + -effectiveNudge) * flipY.toSign() + effectiveNudge
|
||||||
// shift down on lowercase if applicable
|
// shift down on lowercase if applicable
|
||||||
if (lastNonDiacriticChar.isLowHeight()) {
|
if (lastNonDiacriticChar.isLowHeight()) {
|
||||||
//dbgprn("AAARRRRHHHH for character ${thisChar.toHex()}")
|
//dbgprn("AAARRRRHHHH for character ${thisChar.toHex()}")
|
||||||
@@ -1303,18 +1301,17 @@ class TerrarumSansBitmap(
|
|||||||
posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign
|
posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nudgeUpHighWater = effectiveNudge
|
||||||
stackUpwardCounter++
|
stackUpwardCounter++
|
||||||
nudgeUpwardCounter += thisProp.nudgeY
|
|
||||||
|
|
||||||
// dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.charInfo()}; stack counter: $stackUpwardCounter")
|
// dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.charInfo()}; stack counter: $stackUpwardCounter")
|
||||||
}
|
}
|
||||||
GlyphProps.STACK_UP_N_DOWN -> {
|
GlyphProps.STACK_UP_N_DOWN -> {
|
||||||
posYbuffer[charIndex] = (-thisProp.nudgeY + H_DIACRITICS * stackDownwardCounter) * flipY.toSign()
|
posYbuffer[charIndex] = (-thisProp.nudgeY + H_DIACRITICS * stackDownwardCounter) * flipY.toSign()
|
||||||
stackDownwardCounter++
|
stackDownwardCounter++
|
||||||
if (thisProp.nudgeY < 0)
|
|
||||||
nudgeDownwardCounter -= thisProp.nudgeY
|
|
||||||
|
|
||||||
posYbuffer[charIndex] = (-thisProp.nudgeY + -H_DIACRITICS * stackUpwardCounter) * flipY.toSign()
|
val effectiveNudge = maxOf(thisProp.nudgeY, nudgeUpHighWater)
|
||||||
|
posYbuffer[charIndex] = (-effectiveNudge + -H_DIACRITICS * stackUpwardCounter) * flipY.toSign()
|
||||||
// shift down on lowercase if applicable
|
// shift down on lowercase if applicable
|
||||||
if (lastNonDiacriticChar.isLowHeight()) {
|
if (lastNonDiacriticChar.isLowHeight()) {
|
||||||
if (diacriticsType == GlyphProps.DIA_OVERLAY)
|
if (diacriticsType == GlyphProps.DIA_OVERLAY)
|
||||||
@@ -1323,9 +1320,8 @@ class TerrarumSansBitmap(
|
|||||||
posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign
|
posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN * flipY.toSign() // if minus-assign doesn't work, try plus-assign
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nudgeUpHighWater = effectiveNudge
|
||||||
stackUpwardCounter++
|
stackUpwardCounter++
|
||||||
if (thisProp.nudgeY > 0)
|
|
||||||
nudgeUpwardCounter += thisProp.nudgeY
|
|
||||||
}
|
}
|
||||||
// for BEFORE_N_AFTER, do nothing in here
|
// for BEFORE_N_AFTER, do nothing in here
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
BIN
work_files/cyrilic_variable.psd
LFS
BIN
work_files/cyrilic_variable.psd
LFS
Binary file not shown.
BIN
work_files/thai_variable.psd
LFS
BIN
work_files/thai_variable.psd
LFS
Binary file not shown.
Reference in New Issue
Block a user