From c295430866bdbb61431ce12d571be561e40a612d Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 11 Nov 2021 16:48:53 +0900 Subject: [PATCH] more errorOnUnknownChar flag check --- src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt index 719089e..4acc85c 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -940,7 +940,9 @@ class TerrarumSansBitmap( // fill the last of the posXbuffer if (str.isNotEmpty()) { val lastCharProp = glyphProps[str.last()] - val penultCharProp = glyphProps[str[nonDiacriticCounter]]!! + val penultCharProp = glyphProps[str[nonDiacriticCounter]] ?: + (if (errorOnUnknownChar) throw throw InternalError("No GlyphProps for char '${str[nonDiacriticCounter]}' " + + "(${str[nonDiacriticCounter].charInfo()})") else nullProp) posXbuffer[posXbuffer.lastIndex] = 1 + posXbuffer[posXbuffer.lastIndex - 1] + // adding 1 to house the shadow if (lastCharProp?.writeOnTop == true) { val realDiacriticWidth = if (lastCharProp.alignWhere == GlyphProps.ALIGN_CENTRE) {