diff --git a/.gitignore b/.gitignore
index 760aaa2..e86f730 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ lib/*
Terrarum-sans-bitmap*.zip
TerrarumSansBitmap*.jar
Font*.jar
+tmp_*
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index c0d4f4e..7924c08 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,14 +7,13 @@
+
-
-
+
-
@@ -37,22 +36,22 @@
-
-
+
+
-
-
+
+
-
-
+
+
@@ -60,7 +59,7 @@
-
+
@@ -73,8 +72,8 @@
-
-
+
+
@@ -82,20 +81,20 @@
-
+
-
-
+
+
-
+
-
-
+
+
@@ -104,8 +103,8 @@
-
-
+
+
@@ -141,7 +140,6 @@
- ď
ñ
getSheetT
Unexpected
@@ -171,6 +169,7 @@
lowercase
SHEET_DIACRITICAL_MARKS
[()]
+ demo.PNG
.141
@@ -195,10 +194,10 @@
-
-
+
+
@@ -490,7 +489,7 @@
-
+
@@ -505,15 +504,15 @@
-
+
-
+
-
+
@@ -522,7 +521,7 @@
-
+
@@ -541,13 +540,6 @@
-
-
-
-
-
-
-
@@ -860,18 +852,28 @@
+
+
+
-
+
+
+
+
+
+
+
+
-
-
+
+
@@ -879,17 +881,20 @@
-
+
+
+
+
-
-
+
+
-
-
+
+
@@ -898,18 +903,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 1518f42..f1f073a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -62,10 +62,11 @@ character is lowercase.
Since this tag does not make sense for diacritics, they will use the va-
lue for compeletely different perporse:
- 0 : nothing special
- 1 : covers previous character; it's neither stack-up nor down.
+ 0 : Nothing special
+ 1 : Covers previous character; it's neither stack-up nor down.
Will be drawn 2 px lower if the underlying character is lowercase
- 2..15: undefined
+ 2 : Joiner.
+ 3..15: undefined
NOTE: If the diacritics comes before AND after the glyph (e.g. U+103C),
diff --git a/FontTestGDX/lib/TerrarumSansBitmap.jar b/FontTestGDX/lib/TerrarumSansBitmap.jar
index 262cdc7..c15e6d4 100644
Binary files a/FontTestGDX/lib/TerrarumSansBitmap.jar and b/FontTestGDX/lib/TerrarumSansBitmap.jar differ
diff --git a/FontTestGDX/src/FontTestGDX.kt b/FontTestGDX/src/FontTestGDX.kt
index 8817246..2c49018 100644
--- a/FontTestGDX/src/FontTestGDX.kt
+++ b/FontTestGDX/src/FontTestGDX.kt
@@ -186,7 +186,7 @@ class FontTestGDX : Game() {
if (!screenshotExported) {
val pixmap = ScreenUtils.getFrameBufferPixmap(0, 0, frameBuffer.width, frameBuffer.height)
- PixmapIO.writePNG(Gdx.files.local("demo.PNG"), pixmap)
+ PixmapIO.writePNG(Gdx.files.local("testing.PNG"), pixmap)
pixmap.dispose()
screenshotExported = true
diff --git a/assets/diacritical_marks_variable.tga b/assets/diacritical_marks_variable.tga
index 44a3cda..e749b22 100644
Binary files a/assets/diacritical_marks_variable.tga and b/assets/diacritical_marks_variable.tga differ
diff --git a/assets/ipa_ext_variable.tga b/assets/ipa_ext_variable.tga
index 2ff0f3f..452d88f 100644
Binary files a/assets/ipa_ext_variable.tga and b/assets/ipa_ext_variable.tga differ
diff --git a/demotext.txt b/demotext.txt
index f4596d7..a080c9e 100644
--- a/demotext.txt
+++ b/demotext.txt
@@ -1,19 +1,22 @@
-41°C
-
-E=mc²
-
-1º 2ª
-
-ÇC¸ued
+O̸
+o̸
Received Pronunciation IPA: /ˌɪntəˈnæʃənəl/, [ˌɪntəˈnæʃənəɫ]
General American IPA: /ˌɪntɚˈnæʃənəl/, [ˌɪntɚˈnæʃənəɫ], [ˌɪɾ̃ɚˈnæʃənəɫ]
Rhymes: -ɛntəl (wtf wiktionary ??)
-
ˈkʰomɐ gɛts ɐ ˈkʰjuɚ wɛl çiəz ə ˈstʌɹi fɔ ˈju ˈsɐɾə ˈpɛɾi wɔz ə bɛtʰəˈna˞li ˈnʌɚs hu hæd bin ˈwʌ˞kɪŋ deɪli æt æn
ˈɔʊl̴də d͡zʉ in ə dɪˈzʌɚtɪdə dɪsˈtɹʷɪkt ɔv zə tʰ ˈtʰɛɹɪtəɹi soʊ ʃi wʌz ˈvɛɹi ˈhæpi s tʉ stat ə njʉ d͡ʒɔb æt ə
ˈsʌbʌb˺ ˈpɹaɪbɛt pɹaktis in noʊsə ˈskweɚ niə zə ˈdjʉk ˈstoʊi ˈtaʊɚ ðæt ˈeɾiə wəz mʌt͡ʃ ˈniɾə fɔ hɐ ænd mɔə
tʉ laɪk˺ hɐ ˈlaɪkiŋgə ˈibn̩ so ɔ̃ ha fa˞st ˈmɔnɪŋ ʃi fɛlt͡s s t͡stɹɛst ʃi eɪt ə bɔl̴ ɔb˺ ˈpɔɹʷɪd͡ʒ t͡ʃɛkt hɐ˞sɛlf ɪn ðə
ˈmiɹəɚ ænd wɑʃt hɐ˞ ɸeɪs ɪn ə ˈhʌ˞li zɛn ʃi pʊt ɑn ə pɹeɪn bə ˈjɛloʊ dɹɛs ænd ə ɸʊlɪɸʊlis ˈd͡ʒækɛt pikt ap
hɐ˞ kʰit ænd ˈhɛdɪdə fɔ ˈwʌ˞kʰ
+
+ˈkʊmɐ gɛts ə ˈkjɚ wɛl̴ ˈɸ͜hi˞ɹɪzə ˈstʌɾi fɔ ʔəju saɹəʔ ˈpɛɹi wɑzə bə ˈbɛtənəɹi bɛt˺ ˈbɛtəˌɹɪnəɹi ənʌs f f hu havə bin
+ˈw̰ʌ˞kɪŋ deɹi ʔat˺ ʔan ʔat an ol̴d͜zʉ in zə diˈzɑɹɛd d ˈdistɹɪkt ɔb ðəʔ ˈtɛɹɪtəɹʷi soʊ çi wʌz ˈbɛɹɪ ˈhɑpi tʉ stɑ˞t˺
+njʉ ə ˈnjʉ d͡ʒoʊb̥ ɐʔ to s̩ˈpɚb pɹaɪvɛt ˈpɹaktɪs ɪn nɔsˈkwɛɚ niə ðə ˈdʌk sɹit˺ t ˈtɔʌ˞ zat˺ ˈeɹiə wɑz mat͡ʃ ˈniɹɪ ˈniɹə fɔ
+hʌ̥ɕʉ̥ fɔ hɚ ændə mɔ̰ mɔə tu ˈħə ˈɹaɪkɪŋ ˈivn̩ zoʊ ɔn ɸ hɐ fɐst mɔɹɪŋ ʃi fɛlt ˈsɹɛɾɛ ɛ̰ ʃi eɪt˺ ʌ boʊl̴ ɔb ˈpɹis æ̃ ˈt͡ʃɛkʰt
+ˈhɑsɛlf ɪnə ˈmiɹə and wɔʃt hɐ fʷeɪs ɪn ˈhʌ˞ɹi ʌ ˈðɛn si pʊt ɔn ðə pɹeɪnə ˈjɛɹoʊ ˈdɹɛsɪz an fɹis ˈd͡ʒækɛt n̩ pik ʌpt
+ˈhɑ kɪt an ˈhɛdɪd fɔ ə fɔ wɔk fɔ ˈwʌ˞kʰ æ̰̃
+
+acegijmnopqrsuvwxyzɱɳʙɾɽʒʂʐʋɹɻɥɟɡɢʛȵɲŋɴʀɕʑçʝxɣχʁʜʍɰʟɨʉɯuʊøɘɵɤəɛœɜɞʌɔæɐɶɑɒɚɝɩɪʅʈʏʞ
\ No newline at end of file
diff --git a/src/net/torvald/terrarumsansbitmap/GlyphProps.kt b/src/net/torvald/terrarumsansbitmap/GlyphProps.kt
index 5156659..b3ccd96 100644
--- a/src/net/torvald/terrarumsansbitmap/GlyphProps.kt
+++ b/src/net/torvald/terrarumsansbitmap/GlyphProps.kt
@@ -21,6 +21,9 @@ data class GlyphProps(
const val STACK_DOWN = 1
const val STACK_BEFORE_N_AFTER = 2
const val STACK_UP_N_DOWN = 3
+
+ const val DIA_OVERLAY = 1
+ const val DIA_JOINER = 2
}
constructor(width: Int, tags: Int) : this(
diff --git a/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt b/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt
index 2f82b7f..55cfc26 100644
--- a/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt
+++ b/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt
@@ -219,7 +219,11 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun diacriticalMarksIndexY(c: Int) = (c - 0x300) / 16
- private fun Int.isLowercase() = Character.isLowerCase(this) && !isKartvelianCaps(this)
+ private val lowHeightLetters = "acegijmnopqrsuvwxyzɱɳʙɾɽʒʂʐʋɹɻɥɟɡɢʛȵɲŋɴʀɕʑçʝxɣχʁʜʍɰʟɨʉɯuʊøɘɵɤəɛœɜɞʌɔæɐɶɑɒɚɝɩɪʅʈʏʞ".toSortedSet()
+ /**
+ * lowercase AND the height is equal to x-height (e.g. lowercase B, D, F, H, K, L, ... does not count
+ */
+ private fun Int.isLowHeight() = this.and(0xFFFF).toChar() in lowHeightLetters
private fun getColour(codePoint: Int): Color { // input: 0x10ARGB, out: RGBA8888
@@ -347,6 +351,14 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
val pixmap: Pixmap
+ if (isVariable) {
+ println("[TerrarumSansBitmap] loading texture $it [VARIABLE]")
+ }
+ else {
+ println("[TerrarumSansBitmap] loading texture $it")
+ }
+
+
// unpack gz if applicable
if (it.endsWith(".gz")) {
val tmpFileName = "tmp_${it.dropLast(7)}.tga"
@@ -361,22 +373,16 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
pixmap = Pixmap(Gdx.files.internal(tmpFileName))
- File(tmpFileName).delete()
+ //File(tmpFileName).delete()
}
else {
pixmap = Pixmap(Gdx.files.internal(fontParentDir + it))
}
+ if (isVariable) buildWidthTable(pixmap, codeRange[index], 16)
buildWidthTableFixed()
- if (isVariable) {
- println("[TerrarumSansBitmap] loading texture $it [VARIABLE]")
- buildWidthTable(pixmap, codeRange[index], 16)
- }
- else {
- println("[TerrarumSansBitmap] loading texture $it")
- }
val texture = Texture(pixmap)
val texRegPack = if (isVariable) {
@@ -506,7 +512,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
val alignmentOffset = when (thisProp.alignWhere) {
GlyphProps.ALIGN_LEFT -> 0
GlyphProps.ALIGN_RIGHT -> thisProp.width - W_VAR_INIT
- GlyphProps.ALIGN_CENTRE -> Math.floor((thisProp.width - W_VAR_INIT) / 2.0).toInt()
+ GlyphProps.ALIGN_CENTRE -> Math.ceil((thisProp.width - W_VAR_INIT) / 2.0).toInt()
else -> 0 // implies "diacriticsBeforeGlyph = true"
}
@@ -520,6 +526,13 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
stackUpwardCounter = 0
stackDownwardCounter = 0
}
+ else if (thisProp.writeOnTop && thisProp.alignXPos == GlyphProps.DIA_JOINER) {
+ posXbuffer[charIndex] =
+ if (itsProp.alignWhere == GlyphProps.ALIGN_RIGHT)
+ posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset
+ else
+ posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset
+ }
else {
// set X pos according to alignment information
posXbuffer[charIndex] = when (thisProp.alignWhere) {
@@ -547,8 +560,11 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
// shift down on lowercase if applicable
if (getSheetType(thisChar) in autoShiftDownOnLowercase &&
- lastNonDiacriticChar.isLowercase()) {
- posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN
+ lastNonDiacriticChar.isLowHeight()) {
+ if (thisProp.alignXPos == GlyphProps.DIA_OVERLAY)
+ posYbuffer[charIndex] += H_OVERLAY_LOWERCASE_SHIFTDOWN
+ else
+ posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN
}
stackUpwardCounter++
diff --git a/testing.PNG b/testing.PNG
new file mode 100644
index 0000000..18a33b7
Binary files /dev/null and b/testing.PNG differ