mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 11:51:50 +09:00
more whitespaces for typesetting
This commit is contained in:
@@ -7,10 +7,21 @@ import com.badlogic.gdx.utils.Disposable
|
||||
import net.torvald.terrarumsansbitmap.gdx.CodePoint
|
||||
import net.torvald.terrarumsansbitmap.gdx.CodepointSequence
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.EMSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.ENSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.FIXED_BLOCK_1
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.FSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.HSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.MQSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.NBSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.NQSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.OBJ
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.PSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.QUARTER_EMSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.SHY
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.SIX_PER_EMSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.THREE_PER_EMSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.THSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.ZWSP
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.getHash
|
||||
import net.torvald.terrarumsansbitmap.gdx.TerrarumSansBitmap.Companion.glueCharToGlueSize
|
||||
@@ -986,8 +997,17 @@ class MovableType(
|
||||
private val controlOuts = listOf(0xFFFBF, 0xFFFC0).toSortedSet()
|
||||
private val whitespaceGlues = hashMapOf(
|
||||
0x20 to 5, // this is deliberately 1 px wider!
|
||||
0x2009 to 2,
|
||||
0x200A to 1,
|
||||
NQSP to 7,
|
||||
MQSP to 13,
|
||||
ENSP to 7,
|
||||
EMSP to 13,
|
||||
THREE_PER_EMSP to 5,
|
||||
QUARTER_EMSP to 4,
|
||||
SIX_PER_EMSP to 3,
|
||||
FSP to 9,
|
||||
PSP to 6,
|
||||
THSP to 2,
|
||||
HSP to 1,
|
||||
ZWSP to 0,
|
||||
0x3000 to 16,
|
||||
0xF0520 to 7, // why????
|
||||
|
||||
@@ -47,6 +47,7 @@ import java.io.FileOutputStream
|
||||
import java.util.*
|
||||
import java.util.zip.CRC32
|
||||
import java.util.zip.GZIPInputStream
|
||||
import kotlin.math.floor
|
||||
import kotlin.math.roundToInt
|
||||
import kotlin.math.sign
|
||||
|
||||
@@ -1029,6 +1030,8 @@ class TerrarumSansBitmap(
|
||||
|
||||
}
|
||||
|
||||
private fun Int.halveWidth() = this / 2 + 1
|
||||
|
||||
private fun buildWidthTableInternal() {
|
||||
for (i in 0 until 16) {
|
||||
glyphProps[i] = GlyphProps(0)
|
||||
@@ -1046,9 +1049,25 @@ class TerrarumSansBitmap(
|
||||
glyphProps[i] = GlyphProps(0)
|
||||
}
|
||||
|
||||
val figWidth = glyphProps[0x30]!!.width // 9 by default
|
||||
val punctWidth = glyphProps[0x2E]!!.width // 6 by default
|
||||
val em = 12 + 1
|
||||
|
||||
glyphProps[NQSP] = GlyphProps(em.halveWidth()) // 7
|
||||
glyphProps[MQSP] = GlyphProps(em) // 13
|
||||
glyphProps[ENSP] = GlyphProps(em.halveWidth()) // 7
|
||||
glyphProps[EMSP] = GlyphProps(em) // 13
|
||||
glyphProps[THREE_PER_EMSP] = GlyphProps(em / 3 + 1) // 5
|
||||
glyphProps[QUARTER_EMSP] = GlyphProps(em / 4 + 1) // 4
|
||||
glyphProps[SIX_PER_EMSP] = GlyphProps(em / 6 + 1) // 3
|
||||
glyphProps[FSP] = GlyphProps(figWidth) // 9
|
||||
glyphProps[PSP] = GlyphProps(punctWidth) // 6
|
||||
glyphProps[THSP] = GlyphProps(2)
|
||||
glyphProps[HSP] = GlyphProps(1)
|
||||
glyphProps[ZWSP] = GlyphProps(0)
|
||||
glyphProps[ZWNJ] = GlyphProps(0)
|
||||
glyphProps[ZWJ] = GlyphProps(0)
|
||||
glyphProps[ZWSP] = GlyphProps(0)
|
||||
|
||||
glyphProps[SHY] = GlyphProps(0)
|
||||
glyphProps[OBJ] = GlyphProps(0)
|
||||
}
|
||||
@@ -2620,9 +2639,20 @@ class TerrarumSansBitmap(
|
||||
|
||||
internal fun Int.charInfo() = "U+${this.toString(16).padStart(4, '0').toUpperCase()}: ${Character.getName(this)}"
|
||||
|
||||
const val NQSP = 0x2000
|
||||
const val MQSP = 0x2001
|
||||
const val ENSP = 0x2002
|
||||
const val EMSP = 0x2003
|
||||
const val THREE_PER_EMSP = 0x2004
|
||||
const val QUARTER_EMSP = 0x2005
|
||||
const val SIX_PER_EMSP = 0x2006
|
||||
const val FSP = 0x2007
|
||||
const val PSP = 0x2008
|
||||
const val THSP = 0x2009
|
||||
const val HSP = 0x200A
|
||||
const val ZWSP = 0x200B
|
||||
const val ZWNJ = 0x200C
|
||||
const val ZWJ = 0x200D
|
||||
const val ZWSP = 0x200B
|
||||
const val SHY = 0xAD
|
||||
const val NBSP = 0xA0
|
||||
const val OBJ = 0xFFFC
|
||||
|
||||
Reference in New Issue
Block a user