mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-10 07:54:05 +09:00
suppress debug prints if debug=false
This commit is contained in:
@@ -104,6 +104,8 @@ class TerrarumSansBitmap(
|
|||||||
val shadowAlphaPremultiply: Boolean = false
|
val shadowAlphaPremultiply: Boolean = false
|
||||||
) : BitmapFont() {
|
) : BitmapFont() {
|
||||||
|
|
||||||
|
private fun dbgprn(i: Any) { if (debug) println("[${this.javaClass.simpleName}] $i") }
|
||||||
|
|
||||||
constructor(fontDir: String, noShadow: Boolean, flipY: Boolean, invertShadow: Boolean) : this(fontDir, noShadow, flipY, invertShadow, false, 256, false)
|
constructor(fontDir: String, noShadow: Boolean, flipY: Boolean, invertShadow: Boolean) : this(fontDir, noShadow, flipY, invertShadow, false, 256, false)
|
||||||
|
|
||||||
/* This font is a collection of various subsystems, and thus contains copious amount of quick-and-dirty codes.
|
/* This font is a collection of various subsystems, and thus contains copious amount of quick-and-dirty codes.
|
||||||
@@ -184,9 +186,9 @@ class TerrarumSansBitmap(
|
|||||||
|
|
||||||
// idiocity check
|
// idiocity check
|
||||||
if (isVariable1 && !isVariable2)
|
if (isVariable1 && !isVariable2)
|
||||||
throw Error("[TerrarumSansBitmap] font is named as variable on the name but not enlisted as")
|
throw Error("font is named as variable on the name but not enlisted as")
|
||||||
else if (!isVariable1 && isVariable2)
|
else if (!isVariable1 && isVariable2)
|
||||||
throw Error("[TerrarumSansBitmap] font is enlisted as variable on the name but not named as")
|
throw Error("font is enlisted as variable on the name but not named as")
|
||||||
|
|
||||||
|
|
||||||
var pixmap: Pixmap
|
var pixmap: Pixmap
|
||||||
@@ -194,18 +196,18 @@ class TerrarumSansBitmap(
|
|||||||
|
|
||||||
if (isVariable) {
|
if (isVariable) {
|
||||||
if (isXYSwapped) {
|
if (isXYSwapped) {
|
||||||
println("[TerrarumSansBitmap] loading texture $it [VARIABLE, XYSWAP]")
|
dbgprn("loading texture $it [VARIABLE, XYSWAP]")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println("[TerrarumSansBitmap] loading texture $it [VARIABLE]")
|
dbgprn("loading texture $it [VARIABLE]")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (isXYSwapped) {
|
if (isXYSwapped) {
|
||||||
println("[TerrarumSansBitmap] loading texture $it [XYSWAP]")
|
dbgprn("loading texture $it [XYSWAP]")
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println("[TerrarumSansBitmap] loading texture $it")
|
dbgprn("loading texture $it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -227,7 +229,7 @@ class TerrarumSansBitmap(
|
|||||||
}
|
}
|
||||||
catch (e: GdxRuntimeException) {
|
catch (e: GdxRuntimeException) {
|
||||||
//e.printStackTrace()
|
//e.printStackTrace()
|
||||||
System.err.println("[TerrarumSansBitmap] said texture not found, skipping...")
|
dbgprn("said texture not found, skipping...")
|
||||||
|
|
||||||
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
||||||
}
|
}
|
||||||
@@ -239,13 +241,13 @@ class TerrarumSansBitmap(
|
|||||||
}
|
}
|
||||||
catch (e: GdxRuntimeException) {
|
catch (e: GdxRuntimeException) {
|
||||||
//e.printStackTrace()
|
//e.printStackTrace()
|
||||||
System.err.println("[TerrarumSansBitmap] said texture not found, skipping...")
|
dbgprn("said texture not found, skipping...")
|
||||||
|
|
||||||
// if non-ascii chart is missing, replace it with null sheet
|
// if non-ascii chart is missing, replace it with null sheet
|
||||||
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
|
||||||
// else, notify by error
|
// else, notify by error
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
System.err.println("[TerrarumSansBitmap] The ASCII sheet is gone, something is wrong.")
|
println("[${this.javaClass.simpleName}] The ASCII sheet is gone, something is wrong.")
|
||||||
System.exit(1)
|
System.exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -286,7 +288,7 @@ class TerrarumSansBitmap(
|
|||||||
else if (index == SHEET_RUNIC) {
|
else if (index == SHEET_RUNIC) {
|
||||||
PixmapRegionPack(pixmap, W_LATIN_WIDE, H)
|
PixmapRegionPack(pixmap, W_LATIN_WIDE, H)
|
||||||
}
|
}
|
||||||
else throw IllegalArgumentException("[TerrarumSansBitmap] Unknown sheet index: $index")
|
else throw IllegalArgumentException("Unknown sheet index: $index")
|
||||||
|
|
||||||
//texRegPack.texture.setFilter(minFilter, magFilter)
|
//texRegPack.texture.setFilter(minFilter, magFilter)
|
||||||
|
|
||||||
@@ -371,11 +373,11 @@ class TerrarumSansBitmap(
|
|||||||
|
|
||||||
flagFirstRun = false
|
flagFirstRun = false
|
||||||
|
|
||||||
//println("text not in buffer: $charSeq")
|
//dbgprn("text not in buffer: $charSeq")
|
||||||
|
|
||||||
|
|
||||||
//textBuffer.forEach { print("${it.toHex()} ") }
|
//textBuffer.forEach { print("${it.toHex()} ") }
|
||||||
//println()
|
//dbgprn()
|
||||||
|
|
||||||
|
|
||||||
// resetHash(charSeq, x.toFloat(), y.toFloat())
|
// resetHash(charSeq, x.toFloat(), y.toFloat())
|
||||||
@@ -739,9 +741,9 @@ class TerrarumSansBitmap(
|
|||||||
val hasKerningBit = kerningBit1 and 255 != 0//(kerningBit1 and 255 != 0 && kerningMask != 0xFFFF)
|
val hasKerningBit = kerningBit1 and 255 != 0//(kerningBit1 and 255 != 0 && kerningMask != 0xFFFF)
|
||||||
|
|
||||||
|
|
||||||
//println("$code: Width $width, tags $tags")
|
//dbgprn("$code: Width $width, tags $tags")
|
||||||
if (hasKerningBit)
|
if (hasKerningBit)
|
||||||
println("$code: W $width, tags $tags, low? $isLowHeight, kern ${kerningMask.toString(16).padStart(6,'0')} (raw: ${kerningBit1.toLong().and(4294967295).toString(16).padStart(8,'0')})")
|
dbgprn("$code: W $width, tags $tags, low? $isLowHeight, kern ${kerningMask.toString(16).padStart(6,'0')} (raw: ${kerningBit1.toLong().and(4294967295).toString(16).padStart(8,'0')})")
|
||||||
|
|
||||||
/*val isDiacritics = pixmap.getPixel(codeStartX, codeStartY + H - 1).and(0xFF) != 0
|
/*val isDiacritics = pixmap.getPixel(codeStartX, codeStartY + H - 1).and(0xFF) != 0
|
||||||
if (isDiacritics)
|
if (isDiacritics)
|
||||||
@@ -851,7 +853,7 @@ class TerrarumSansBitmap(
|
|||||||
val kerning = getKerning(lastNonDiacriticChar, thisChar)
|
val kerning = getKerning(lastNonDiacriticChar, thisChar)
|
||||||
|
|
||||||
|
|
||||||
//println("char: ${thisChar.charInfo()}\nproperties: $thisProp")
|
//dbgprn("char: ${thisChar.charInfo()}\nproperties: $thisProp")
|
||||||
|
|
||||||
|
|
||||||
var alignmentOffset = when (thisProp.alignWhere) {
|
var alignmentOffset = when (thisProp.alignWhere) {
|
||||||
@@ -872,8 +874,8 @@ class TerrarumSansBitmap(
|
|||||||
nextHangulJungseong1 !in jungseongWide ||
|
nextHangulJungseong1 !in jungseongWide ||
|
||||||
nextHangulJungseong2 !in jungseongWide
|
nextHangulJungseong2 !in jungseongWide
|
||||||
)) {
|
)) {
|
||||||
//println("char: ${thisChar.charInfo()}\nproperties: $thisProp")
|
//dbgprn("char: ${thisChar.charInfo()}\nproperties: $thisProp")
|
||||||
//println("${thisChar.charInfo()} ${str.getOrNull(charIndex + 2)?.charInfo()} ${str.getOrNull(charIndex + 3)?.charInfo()}")
|
//dbgprn("${thisChar.charInfo()} ${str.getOrNull(charIndex + 2)?.charInfo()} ${str.getOrNull(charIndex + 3)?.charInfo()}")
|
||||||
extraWidth += 1
|
extraWidth += 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -942,9 +944,9 @@ class TerrarumSansBitmap(
|
|||||||
// shift down on lowercase if applicable
|
// shift down on lowercase if applicable
|
||||||
if (getSheetType(thisChar) in autoShiftDownOnLowercase &&
|
if (getSheetType(thisChar) in autoShiftDownOnLowercase &&
|
||||||
lastNonDiacriticChar.isLowHeight()) {
|
lastNonDiacriticChar.isLowHeight()) {
|
||||||
//println("AAARRRRHHHH for character ${thisChar.toHex()}")
|
//dbgprn("AAARRRRHHHH for character ${thisChar.toHex()}")
|
||||||
//println("lastNonDiacriticChar: ${lastNonDiacriticChar.toHex()}")
|
//dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.toHex()}")
|
||||||
//println("cond: ${thisProp.alignXPos == GlyphProps.DIA_OVERLAY}, charIndex: $charIndex")
|
//dbgprn("cond: ${thisProp.alignXPos == GlyphProps.DIA_OVERLAY}, charIndex: $charIndex")
|
||||||
if (thisProp.alignXPos == GlyphProps.DIA_OVERLAY)
|
if (thisProp.alignXPos == GlyphProps.DIA_OVERLAY)
|
||||||
posYbuffer[charIndex] -= H_OVERLAY_LOWERCASE_SHIFTDOWN * (!flipY).toSign() // if minus-assign doesn't work, try plus-assign
|
posYbuffer[charIndex] -= H_OVERLAY_LOWERCASE_SHIFTDOWN * (!flipY).toSign() // if minus-assign doesn't work, try plus-assign
|
||||||
else
|
else
|
||||||
@@ -1363,7 +1365,7 @@ class TerrarumSansBitmap(
|
|||||||
if (it.first.matches(maskL!!) && it.second.matches(maskR!!)) {
|
if (it.first.matches(maskL!!) && it.second.matches(maskR!!)) {
|
||||||
val contraction = if (glyphProps[prevChar]?.isKernYtype == true || glyphProps[thisChar]?.isKernYtype == true) it.yy else it.bb
|
val contraction = if (glyphProps[prevChar]?.isKernYtype == true || glyphProps[thisChar]?.isKernYtype == true) it.yy else it.bb
|
||||||
|
|
||||||
println("Kerning rule match #${index+1}: ${prevChar.toChar()}${thisChar.toChar()}, Rule:${it.first} ${it.second}; Contraction: $contraction")
|
dbgprn("Kerning rule match #${index+1}: ${prevChar.toChar()}${thisChar.toChar()}, Rule:${it.first} ${it.second}; Contraction: $contraction")
|
||||||
|
|
||||||
return -contraction
|
return -contraction
|
||||||
}
|
}
|
||||||
@@ -2006,9 +2008,7 @@ print(','.join(a))
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
kerningRules.forEach {
|
// kerningRules.forEach { println("Keming ${it.first.s} - ${it.second.s} ; ${it.bb}/${it.yy}") }
|
||||||
println("Keming ${it.first.s} - ${it.second.s} ; ${it.bb}/${it.yy}")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of the Keming Machine
|
// End of the Keming Machine
|
||||||
|
|||||||
Reference in New Issue
Block a user