mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-13 22:46:07 +09:00
new armenian (#10)
- Redesigned glyphs - Update to Unicode 11 (2 chrs added)
This commit is contained in:
@@ -27,7 +27,7 @@ class FontTestGDX : Game() {
|
|||||||
private val outimageName = "demo.png"
|
private val outimageName = "demo.png"
|
||||||
|
|
||||||
override fun create() {
|
override fun create() {
|
||||||
font = GameFontBase("./assets", flipY = false, errorOnUnknownChar = false) // must test for two flipY cases
|
font = GameFontBase("./assets", flipY = false, errorOnUnknownChar = true) // must test for two flipY cases
|
||||||
|
|
||||||
val inTextFile = Gdx.files.internal("./$demotextName")
|
val inTextFile = Gdx.files.internal("./$demotextName")
|
||||||
val reader = inTextFile.reader("UTF-8")
|
val reader = inTextFile.reader("UTF-8")
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
@@ -386,6 +386,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
|||||||
val isVariable1 = it.endsWith("_variable.tga")
|
val isVariable1 = it.endsWith("_variable.tga")
|
||||||
val isVariable2 = variableWidthSheets.contains(index)
|
val isVariable2 = variableWidthSheets.contains(index)
|
||||||
val isVariable = isVariable1 && isVariable2
|
val isVariable = isVariable1 && isVariable2
|
||||||
|
val isXYSwapped = it.contains("xyswap", true)
|
||||||
|
|
||||||
// idiocity check
|
// idiocity check
|
||||||
if (isVariable1 && !isVariable2)
|
if (isVariable1 && !isVariable2)
|
||||||
@@ -442,7 +443,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
|||||||
|
|
||||||
val texture = Texture(pixmap)
|
val texture = Texture(pixmap)
|
||||||
val texRegPack = if (isVariable) {
|
val texRegPack = if (isVariable) {
|
||||||
TextureRegionPack(texture, W_VAR_INIT, H, HGAP_VAR, 0)
|
TextureRegionPack(texture, W_VAR_INIT, H, HGAP_VAR, 0, xySwapped = isXYSwapped)
|
||||||
}
|
}
|
||||||
else if (index == SHEET_UNIHAN) {
|
else if (index == SHEET_UNIHAN) {
|
||||||
TextureRegionPack(texture, W_UNIHAN, H_UNIHAN) // the only exception that is height is 16
|
TextureRegionPack(texture, W_UNIHAN, H_UNIHAN) // the only exception that is height is 16
|
||||||
@@ -592,8 +593,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
|||||||
charsetOverride = c - CHARSET_OVERRIDE_DEFAULT
|
charsetOverride = c - CHARSET_OVERRIDE_DEFAULT
|
||||||
}
|
}
|
||||||
else if (sheetID == SHEET_HANGUL) {
|
else if (sheetID == SHEET_HANGUL) {
|
||||||
// FIXME input text is normalised as Initial-Peak-Final
|
// Flookahead for {I, P, F}
|
||||||
// requires lookahead for {I, P, F}
|
|
||||||
|
|
||||||
val cNext = if (index + 1 <= textBuffer.size) textBuffer[index + 1] else 0
|
val cNext = if (index + 1 <= textBuffer.size) textBuffer[index + 1] else 0
|
||||||
val cNextNext = if (index + 2 <= textBuffer.size) textBuffer[index + 2] else 0
|
val cNextNext = if (index + 2 <= textBuffer.size) textBuffer[index + 2] else 0
|
||||||
@@ -607,12 +607,12 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
|||||||
val hangulSheet = sheets[SHEET_HANGUL]
|
val hangulSheet = sheets[SHEET_HANGUL]
|
||||||
|
|
||||||
|
|
||||||
println("${c.toHex()} ${cNext.toHex()} ${cNextNext.toHex()}")
|
//println("${c.toHex()} ${cNext.toHex()} ${cNextNext.toHex()}")
|
||||||
println("I: $indexCho,\t$choRow")
|
//println("I: $indexCho,\t$choRow")
|
||||||
println("P: $indexJung,\t$jungRow")
|
//println("P: $indexJung,\t$jungRow")
|
||||||
println("F: $indexJong,\t$jongRow")
|
//println("F: $indexJong,\t$jongRow")
|
||||||
println("skip: $hangulLength")
|
//println("skip: $hangulLength")
|
||||||
println("====")
|
//println("====")
|
||||||
|
|
||||||
|
|
||||||
when (run) {
|
when (run) {
|
||||||
|
|||||||
@@ -38,13 +38,14 @@ class TextureRegionPack(
|
|||||||
val hGap: Int = 0,
|
val hGap: Int = 0,
|
||||||
val vGap: Int = 0,
|
val vGap: Int = 0,
|
||||||
val hFrame: Int = 0,
|
val hFrame: Int = 0,
|
||||||
val vFrame: Int = 0
|
val vFrame: Int = 0,
|
||||||
|
val xySwapped: Boolean = false // because Unicode chart does, duh
|
||||||
) {
|
) {
|
||||||
|
|
||||||
constructor(ref: String, tileW: Int, tileH: Int, hGap: Int = 0, vGap: Int = 0, hFrame: Int = 0, vFrame: Int = 0) :
|
constructor(ref: String, tileW: Int, tileH: Int, hGap: Int = 0, vGap: Int = 0, hFrame: Int = 0, vFrame: Int = 0, xySwapped: Boolean = false) :
|
||||||
this(Texture(ref), tileW, tileH, hGap, vGap, hFrame, vFrame)
|
this(Texture(ref), tileW, tileH, hGap, vGap, hFrame, vFrame, xySwapped)
|
||||||
constructor(fileHandle: FileHandle, tileW: Int, tileH: Int, hGap: Int = 0, vGap: Int = 0, hFrame: Int = 0, vFrame: Int = 0) :
|
constructor(fileHandle: FileHandle, tileW: Int, tileH: Int, hGap: Int = 0, vGap: Int = 0, hFrame: Int = 0, vFrame: Int = 0, xySwapped: Boolean = false) :
|
||||||
this(Texture(fileHandle), tileW, tileH, hGap, vGap, hFrame, vFrame)
|
this(Texture(fileHandle), tileW, tileH, hGap, vGap, hFrame, vFrame, xySwapped)
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
/** Intented for Y-down coord system, typically fon Non-GDX codebase */
|
/** Intented for Y-down coord system, typically fon Non-GDX codebase */
|
||||||
@@ -59,18 +60,34 @@ class TextureRegionPack(
|
|||||||
init {
|
init {
|
||||||
//println("texture: $texture, dim: ${texture.width} x ${texture.height}, grid: $horizontalCount x $verticalCount, cellDim: $tileW x $tileH")
|
//println("texture: $texture, dim: ${texture.width} x ${texture.height}, grid: $horizontalCount x $verticalCount, cellDim: $tileW x $tileH")
|
||||||
|
|
||||||
regions = Array<TextureRegion>(horizontalCount * verticalCount, {
|
if (!xySwapped) {
|
||||||
val region = TextureRegion()
|
regions = Array<TextureRegion>(horizontalCount * verticalCount, {
|
||||||
val rx = (it % horizontalCount * (tileW + hGap)) + hFrame
|
val region = TextureRegion()
|
||||||
val ry = (it / horizontalCount * (tileH + vGap)) + vFrame
|
val rx = (it % horizontalCount * (tileW + hGap)) + hFrame
|
||||||
|
val ry = (it / horizontalCount * (tileH + vGap)) + vFrame
|
||||||
|
|
||||||
region.setRegion(texture)
|
region.setRegion(texture)
|
||||||
region.setRegion(rx, ry, tileW, tileH)
|
region.setRegion(rx, ry, tileW, tileH)
|
||||||
|
|
||||||
region.flip(false, globalFlipY)
|
region.flip(false, globalFlipY)
|
||||||
|
|
||||||
/*return*/region
|
/*return*/region
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
regions = Array<TextureRegion>(horizontalCount * verticalCount, {
|
||||||
|
val region = TextureRegion()
|
||||||
|
val rx = (it % verticalCount * (tileW + hGap)) + hFrame
|
||||||
|
val ry = (it / verticalCount * (tileH + vGap)) + vFrame
|
||||||
|
|
||||||
|
region.setRegion(texture)
|
||||||
|
region.setRegion(ry, rx, tileW, tileH)
|
||||||
|
|
||||||
|
region.flip(false, globalFlipY)
|
||||||
|
|
||||||
|
/*return*/region
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(x: Int, y: Int) = regions[y * horizontalCount + x]
|
fun get(x: Int, y: Int) = regions[y * horizontalCount + x]
|
||||||
|
|||||||
Reference in New Issue
Block a user