mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-13 22:46:07 +09:00
dumping temp files to OS's temp directory
This commit is contained in:
@@ -27,7 +27,7 @@ class FontTestGDX : Game() {
|
|||||||
|
|
||||||
lateinit var camera: OrthographicCamera
|
lateinit var camera: OrthographicCamera
|
||||||
|
|
||||||
private val testing = false
|
private val testing = true
|
||||||
|
|
||||||
private val demotextName = if (testing) "testtext.txt" else "demotext.txt"
|
private val demotextName = if (testing) "testtext.txt" else "demotext.txt"
|
||||||
private val outimageName = if (testing) "testing.PNG" else "demo.PNG"
|
private val outimageName = if (testing) "testing.PNG" else "demo.PNG"
|
||||||
@@ -45,6 +45,9 @@ class FontTestGDX : Game() {
|
|||||||
batch = SpriteBatch()
|
batch = SpriteBatch()
|
||||||
|
|
||||||
|
|
||||||
|
println(font.getWidth("हिन्दी"))
|
||||||
|
|
||||||
|
|
||||||
// create faketex
|
// create faketex
|
||||||
val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888)
|
val fakepix = Pixmap(1,1,Pixmap.Format.RGBA8888)
|
||||||
fakepix.drawPixel(0,0,-1)
|
fakepix.drawPixel(0,0,-1)
|
||||||
@@ -149,7 +152,6 @@ class FontTestGDX : Game() {
|
|||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
font.dispose()
|
font.dispose()
|
||||||
faketex.dispose()
|
faketex.dispose()
|
||||||
File("./tmp_wenquanyi.tga").delete()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun scrollAdd(x: Int = 1) {
|
fun scrollAdd(x: Int = 1) {
|
||||||
|
|||||||
@@ -178,6 +178,9 @@ class TerrarumSansBitmap(
|
|||||||
|
|
||||||
private var charsetOverride = 0
|
private var charsetOverride = 0
|
||||||
|
|
||||||
|
private val tempDir = System.getProperty("java.io.tmpdir")
|
||||||
|
// private val tempFiles = ArrayList<String>()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val sheetsPack = ArrayList<PixmapRegionPack>()
|
val sheetsPack = ArrayList<PixmapRegionPack>()
|
||||||
|
|
||||||
@@ -202,18 +205,19 @@ class TerrarumSansBitmap(
|
|||||||
|
|
||||||
// unpack gz if applicable
|
// unpack gz if applicable
|
||||||
if (it.endsWith(".gz")) {
|
if (it.endsWith(".gz")) {
|
||||||
val tmpFileName = "tmp_${it.dropLast(7)}.tga"
|
val tmpFilePath = tempDir + "/tmp_${it.dropLast(7)}.tga"
|
||||||
|
|
||||||
try {
|
try {
|
||||||
val gzi = GZIPInputStream(Gdx.files.internal(fontParentDir + it).read(8192))
|
val gzi = GZIPInputStream(Gdx.files.internal(fontParentDir + it).read(8192))
|
||||||
val wholeFile = gzi.readBytes()
|
val wholeFile = gzi.readBytes()
|
||||||
gzi.close()
|
gzi.close()
|
||||||
val fos = BufferedOutputStream(FileOutputStream(tmpFileName))
|
val fos = BufferedOutputStream(FileOutputStream(tmpFilePath))
|
||||||
fos.write(wholeFile)
|
fos.write(wholeFile)
|
||||||
fos.flush()
|
fos.flush()
|
||||||
fos.close()
|
fos.close()
|
||||||
|
|
||||||
pixmap = Pixmap(Gdx.files.internal(tmpFileName))
|
pixmap = Pixmap(Gdx.files.absolute(tmpFilePath))
|
||||||
|
// tempFiles.add(tmpFilePath)
|
||||||
}
|
}
|
||||||
catch (e: GdxRuntimeException) {
|
catch (e: GdxRuntimeException) {
|
||||||
//e.printStackTrace()
|
//e.printStackTrace()
|
||||||
|
|||||||
Reference in New Issue
Block a user