mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-06-12 08:54:04 +09:00
better interchar handling for MovableType
This commit is contained in:
@@ -89,7 +89,7 @@ class MovableType(
|
|||||||
|
|
||||||
// println("Paper width: $paperWidth")
|
// println("Paper width: $paperWidth")
|
||||||
|
|
||||||
val lines = inputText.tokenise()
|
val lines = inputText.tokenise(font)
|
||||||
// lines.debugprint()
|
// lines.debugprint()
|
||||||
|
|
||||||
lines.forEachIndexed { linenum, it ->
|
lines.forEachIndexed { linenum, it ->
|
||||||
@@ -592,7 +592,7 @@ class MovableType(
|
|||||||
*
|
*
|
||||||
* Inner list (ArrayList) contains the boxes for the single line.
|
* Inner list (ArrayList) contains the boxes for the single line.
|
||||||
*/
|
*/
|
||||||
private fun CodepointSequence.tokenise(): List<ArrayList<CodepointSequence>> {
|
private fun CodepointSequence.tokenise(font: TerrarumSansBitmap): List<ArrayList<CodepointSequence>> {
|
||||||
val lines = ArrayList<ArrayList<CodepointSequence>>()
|
val lines = ArrayList<ArrayList<CodepointSequence>>()
|
||||||
var tokens = ArrayList<CodepointSequence>()
|
var tokens = ArrayList<CodepointSequence>()
|
||||||
var boxBuffer = ArrayList<CodePoint>()
|
var boxBuffer = ArrayList<CodePoint>()
|
||||||
@@ -657,7 +657,9 @@ class MovableType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun appendGlue(char: CodePoint) {
|
fun appendGlue(char: CodePoint) {
|
||||||
glue += whitespaceGlues[char] ?: throw NullPointerException("${char.toHex()} is not a whitespace")
|
glue += (whitespaceGlues[char] ?: throw NullPointerException("${char.toHex()} is not a whitespace")).let {
|
||||||
|
if (it == 0) it else it + font.interchar
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun appendZeroGlue() {
|
fun appendZeroGlue() {
|
||||||
|
|||||||
@@ -1182,7 +1182,7 @@ class TerrarumSansBitmap(
|
|||||||
// is this glyph NOT a diacritic?
|
// is this glyph NOT a diacritic?
|
||||||
else if (thisProp.writeOnTop < 0) {
|
else if (thisProp.writeOnTop < 0) {
|
||||||
// apply interchar only if this character is NOT a control char
|
// apply interchar only if this character is NOT a control char
|
||||||
val thisInterchar = if (thisChar.isLetter() || Character.isWhitespace(thisChar)) interchar else 0
|
val thisInterchar = if (thisChar.isLetter()) interchar else 0
|
||||||
|
|
||||||
posXbuffer[charIndex] = -thisProp.nudgeX +
|
posXbuffer[charIndex] = -thisProp.nudgeX +
|
||||||
when (itsProp.alignWhere) {
|
when (itsProp.alignWhere) {
|
||||||
|
|||||||
Reference in New Issue
Block a user