diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 918f895..c0d4f4e 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -9,8 +9,13 @@
-
-
+
+
+
+
+
+
+
@@ -29,34 +34,34 @@
-
+
-
-
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
+
+
@@ -68,8 +73,8 @@
-
-
+
+
@@ -77,30 +82,30 @@
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
@@ -136,23 +141,20 @@
- getColour
- .094
- өďñgetSheetTUnexpectedUnexp
- fun getSh
+ codeRangeisHangulᏵtoColo
- fun relo
+ 3633println(
- Width ta
+ getWidthglyphWidthBufferGlyphProps.LE
@@ -165,7 +167,10 @@
ArrayList<Int>appConfig.heighttextBuffer
- no stan
+
+ lowercase
+ SHEET_DIACRITICAL_MARKS
+ [()].141
@@ -188,10 +193,12 @@
+
+
@@ -206,6 +213,7 @@
+
@@ -236,11 +244,17 @@
+
+
+
+
+
+
+
-
@@ -476,7 +490,7 @@
-
+
@@ -491,15 +505,15 @@
+
-
+
+
-
-
@@ -507,8 +521,8 @@
-
-
+
+
@@ -527,18 +541,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
@@ -831,13 +833,6 @@
-
-
-
-
-
-
-
@@ -857,16 +852,6 @@
-
-
-
-
-
-
-
-
-
-
@@ -874,21 +859,19 @@
-
+
+
-
-
-
-
-
+
+
-
-
+
+
@@ -898,15 +881,35 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e021228..1518f42 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -50,6 +50,24 @@ Green-tinted area (should be 10 px tall) contains the tags. Tags are defined as
1 == 0 Stack 1 Stack 0 Before 1 Up &
(MSB) 0 == 0 up 0 down 1 &After 1 Down (e.g. U+0C48)
+Extra informations
+
+== Stack Up/Down ==
+
+When the tag is stack-up, it'll be drawn 4 px lower if the underlying
+character is lowercase.
+
+== Align-To-This-X-Pos ==
+
+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.
+ Will be drawn 2 px lower if the underlying character is lowercase
+ 2..15: undefined
+
+
NOTE: If the diacritics comes before AND after the glyph (e.g. U+103C),
"Align before the glyph" must be set too.
If glyphs are right or centre aligned, they must be aligned in
diff --git a/FontTestGDX/lib/TerrarumSansBitmap.jar b/FontTestGDX/lib/TerrarumSansBitmap.jar
index 51beba5..262cdc7 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 627304c..8817246 100644
--- a/FontTestGDX/src/FontTestGDX.kt
+++ b/FontTestGDX/src/FontTestGDX.kt
@@ -134,7 +134,8 @@ class FontTestGDX : Game() {
println("${font.noColorCode}\nEND")
- println(font.toColorCode(0xF_EEC))
+ println(font.toColorCode(0xF_F07))
+ println(font.toColorCode(0x0000))
frameBuffer = FrameBuffer(Pixmap.Format.RGBA8888, TEXW, TEXH, true)
diff --git a/assets/ascii_variable.tga b/assets/ascii_variable.tga
index 67967d2..b8c8963 100644
Binary files a/assets/ascii_variable.tga and b/assets/ascii_variable.tga differ
diff --git a/assets/cyrilic_variable.tga b/assets/cyrilic_variable.tga
index 038d3cf..42f8ca1 100644
Binary files a/assets/cyrilic_variable.tga and b/assets/cyrilic_variable.tga differ
diff --git a/assets/diacritical_marks_variable.tga b/assets/diacritical_marks_variable.tga
new file mode 100644
index 0000000..44a3cda
Binary files /dev/null and b/assets/diacritical_marks_variable.tga differ
diff --git a/assets/ipa_ext_variable.tga b/assets/ipa_ext_variable.tga
index 090d956..2ff0f3f 100644
Binary files a/assets/ipa_ext_variable.tga and b/assets/ipa_ext_variable.tga differ
diff --git a/demo.PNG b/demo.PNG
index 76ff774..1a7d200 100644
Binary files a/demo.PNG and b/demo.PNG differ
diff --git a/demotext.txt b/demotext.txt
index ab43f38..f4596d7 100644
--- a/demotext.txt
+++ b/demotext.txt
@@ -1,102 +1,19 @@
-The bitmap font for games developers who seek good font that has real multilingual support,
-for free (as in freedom and without cost)
+41°C
-There are many bitmap fonts on the internet. You care for the multilingual support, but alas!
-most of them do not support your language, vector fonts take too much time to load, and even
-then their legibility suffers because fuck built-in antialias.
+E=mc²
-You somehow found a multilingual one, and it makes your game look like an old computer, and you say:
+1º 2ª
-“Well, better than nothing… no, it’s ugly.”
+ÇC¸ued
-You speak japanese and you wish to support it, but then このクソなfont only goot for displaying
-Japanese, it's not even multilingual, and their English look uncanny and inconsistent as hell.
+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 ??)
-Eventually you just mix different fonts together, and the results were always infuriating.
-No more suffering. This font has everything you need.
-
-while (isVisible(BAD_FONTS)) {
- ripAndTear(BAD_FONTS).where { GUTS };
-}
-
-How multilingual? Real multilingual!
-
- Ианҵоуп ақьаад, нусхур аҩырала, ҩ ҽшьаҟакла, иҧшӡоу анапҩырала
- գրիչս վայր դրի, վեր կացա և պատրաստվում էի, որ քնեմ, երբ հանկարծ դռանս զանգակը հնչեց
- ՄՇԱԿԻՉ ԿԱՄ ԿԵՆՏՐՈՆԱԿԱՆ ՄՇԱԿԻՉ ՀԱՆԳՈՒՅՑԸ ՀԱՆԴԻՍԱՆՈՒՄ Է ՀԱՄԱԿԱՐԳՉԻ ՍԱՐՔԱՎՈՐՈՒՄՆԵՐԻՑ
- Zəfər, jaketini də papağını da götür, bu axşam hava çox soyuq olacaq
- Под южно дърво, цъфтящо в синьо, бягаше малко пухкаво зайче
- ᎠᏍᎦᏯᎡᎦᎢᎾᎨᎢᎣᏍᏓᎤᎩᏍᏗᎥᎴᏓᎯᎲᎢᏔᎵᏕᎦᏟᏗᏖᎸᎳᏗᏗᎧᎵᎢᏘᎴᎩ ᏙᏱᏗᏜᏫᏗᏣᏚᎦᏫᏛᏄᏓᎦᏝᏃᎠᎾᏗᎭᏞᎦᎯᎦᏘᏓᏠᎨᏏᏕᏡᎬᏢᏓᏥᏩᏝᎡᎢᎪᎢ
- ᎠᎦᏂᏗᎮᎢᎫᎩᎬᏩᎴᎢᎠᏆᏅᏛᎫᏊᎾᎥᎠᏁᏙᎲᏐᏈᎵᎤᎩᎸᏓᏭᎷᏤᎢᏏᏉᏯᏌᏊ ᎤᏂᏋᎢᏡᎬᎢᎰᏩᎬᏤᎵᏍᏗᏱᎩᎱᎱᎤᎩᎴᎢᏦᎢᎠᏂᏧᏣᏨᎦᏥᎪᎥᏌᏊᎤᎶᏒᎢᎢᏡᎬᎢ
- ᎹᎦᎺᎵᏥᎻᎼᏏᎽᏗᏩᏂᎦᏘᎾᎿᎠᏁᎬᎢᏅᎩᎾᏂᎡᎢᏌᎶᎵᏎᎷᎠᏑᏍᏗᏪᎩ ᎠᎴ ᏬᏗᏲᏭᎾᏓᏍᏓᏴᏁᎢᎤᎦᏅᏮᏰᎵᏳᏂᎨᎢ
- Příliš žluťoučký kůň úpěl ďábelské ódy
- Quizdeltagerne spiste jordbær med fløde, mens cirkusklovnen Walther spillede på xylofon
- PACK MY BOX WITH FIVE DOZEN LIQUOR JUGS
- hƿæt ƿe ᵹardena inᵹear ꝺaᵹum þeoꝺ cynninᵹa þꞃym ᵹeꝼꞃumon
- Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich GROẞEN GROẞE
- ζαφείρι δέξου πάγκαλο, βαθων ψυχης το σημα
- ΔΙΑΦΥΛΆΞΤΕ ΓΕΝΙΚΆ ΤΗ ΖΩΉ ΣΑΣ ΑΠΌ ΒΑΘΕΙΆ ΨΥΧΙΚΆ ΤΡΑΎΜΑΤΑ
- სწრაფი ყავისფერი მელა გადაახტა ზარმაც ძაღლს ᲘᲜᲢᲔᲚ ᲞᲔᲜᲢᲘᲣᲛᲘ ᲛᲘᲙᲠᲝᲞᲠᲝᲪᲔᲡᲝᲠᲘ
- ऋषियों को सताने वाले दुष्ट राक्षसों के राजा रावण का सर्वनाश करने वाले विष्णुवतार भगवान श्रीराम अयोध्या के महाराज दशरथ के
- Kæmi ný öxi hér, ykist þjófum nú bæði víl og ádrepa
- Ċuaiġ bé ṁórṡáċ le dlúṫspád fíorḟinn trí hata mo ḋea-ṗorcáin ḃig
- あめつちほしそら やまかはみねたに くもきりむろこけ ひといぬうへすゑ ゆわさるおふせよ えの𛀁をなれゐて
- トリナクコヱス ユメサマセ ミヨアケワタル ヒンカシヲ ソライロハエテ オキツヘニ ホフネムレヰヌ モヤノウチ
- 田居に出で 菜摘むわれをぞ 君召すと 求食り追ひゆく 山城の 打酔へる子ら 藻葉干せよ え舟繋けぬ
- 정 참판 양반댁 규수 큰 교자 타고 혼례 치른 날 하얬다 도럄직한 퀡봹퉪헰
- Četri psihi faķīri vēlu vakarā zāģēja guļbūvei durvis, fonā šņācot mežam
- Įlinkdama fechtuotojo špaga sublykčiojusi pragręžė apvalų arbūzą
- Ѕидарски пејзаж: шугав билмез со чудење џвака ќофте и кељ на туѓ цех
- Щётканы фермд пийшин цувъя. Бөгж зогсч хэльюү
- Pchnąć w tę łódź jeża lub ośm skrzyń fig
- कः खगौघाङचिच्छौजा झाञ्ज्ञोऽटौठीडडण्ढणः। तथोदधीन् पफर्बाभीर्मयोऽरिल्वाशिषां सहः॥
- Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila
- Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства
- Ајшо, лепото и чежњо, за љубав срца мога дођи у Хаџиће на кафу
- Jovencillo emponzoñado de whisky: ¡qué figurota exhibe!
- นายสังฆภัณฑ์ เฮงพิทักษ์ฝั่ง ผู้เฒ่าซึ่งมีอาชีพเป็นฅนขายฃวด ถูกตำรวจปฏิบัติการจับฟ้องศาล ฐานลักนาฬิกาคุณหญิงฉัตรชฎา ฌานสมาธิ
- Pijamalı hasta yağız şoföre çabucak güvendi
- Жебракують філософи при ґанку церкви в Гадячі, ще й шатро їхнє п’яне знаємо
- Do bạch kim rất quý nên sẽ dùng để lắp vô xương
- 日堀油告観観藤村抄海評業庁経賃室弁市。太撮収改売週法所何都慣次現。価紙一無三洋日話転手治稿載末替付致治。
-
-Features:
-
- Ever heard of « Guillemets »? You speak „Nederlands” or „Deutsch“? ”suomi”? 「日本語」しゃべる?或《中文》?
-
-Multilingual brackets; these are the most basic things, right?
-
- 99406 91902 59186 29182 45814 57862 34368 08240
- 31485 65379 04348 28952 42927 26157 42615 39526
-
-Fixed-width numbers, because number-crunching matters
-
- ᚱᛂᚴᛋᛂᛋᛏᛋᚮᚾᛔᚢᛏᛚᚮᛋ᛬ᚱᛂᚴᛋᛋᚢᚼᚾᚢᛘᚢᛚᚾᛏᚮ᛬ᛏᚮᛋᛁᚮᚵᛂᚢᛏᚮᚱᛘᛔᚱᛂᚴᛋᛏ᛭ᛋᚢᚼᚾᚢᛋᛘᚮᛁᚵᚾᛁᛂᛏᚮᛑ᛭ᚵᛂᚢᛏᚮᚱ
-
-Colour-code that supports 65535 opaque or semi-transparent colours via 4 bit ARGB
-
- Гномът Доцьо приключи спящ в шейна за жаби (Bulgarian)
- Љубазни фењерџија чађавог лица хоће да ми покаже штос (Serbian)
- Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика (Russian)
-
-Control characters to support Bulgarian and Serbian letter shapes on the fly
-
- Press to pay respects—or is it , or …
-
-Custom symbols for video games
-
- Can you distinguish following dashes: - – — - – — – - ――――――――――― 48–63 48-63
-
-For all those dash-pedants, we have en-dash, em-dash, and even horizontal bars!
-
-Unicode References:
-
- Basic Latin Latin-1 Latin Extension A Latin Extionsion B IPA Extension Greek Cyrillic
- Cyrillic Supplement Armenian Devanagari Thai Georgian Runic Cherokee Georgian Extended
- General Punctuations CJK Symbols Kana Kana Phonetic Extension CJK Unihan Extension A CJK Unihan
- Hangul Syllables Fullwidth Forms Kana Supplement
-
-GitHub’s issue page is open! You can report any errors, or leave suggestions.
-You can help this font to be more versatile. (for more languages, more frameworks) Clone this repo, make
-changes, and make a pull request! I appreciate any and all supports.
\ No newline at end of file
+ˈ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ʰ
diff --git a/src/net/torvald/terrarumsansbitmap/GlyphProps.kt b/src/net/torvald/terrarumsansbitmap/GlyphProps.kt
index a9e3517..5156659 100644
--- a/src/net/torvald/terrarumsansbitmap/GlyphProps.kt
+++ b/src/net/torvald/terrarumsansbitmap/GlyphProps.kt
@@ -31,4 +31,6 @@ data class GlyphProps(
tags.and(1) == 1,
tags.ushr(8).and(3)
)
+
+ fun isOverlay() = writeOnTop && alignXPos == 1
}
\ No newline at end of file
diff --git a/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt b/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt
index 39bcbbf..2f82b7f 100644
--- a/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt
+++ b/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt
@@ -70,6 +70,12 @@ typealias CodepointSequence = ArrayList
* - U+FFFF9: Charset override -- Bulgarian
* - U+FFFFA: Charset override -- Serbian
*
+ * ## Auto Shift Down
+ *
+ * Certain characters (e.g. Combining Diacritical Marks) will automatically shift down to accomodate lowercase letters. Shiftdown only occurs when non-diacritic character before the mark is lowercase, and the mark itself would stack up. Stack-up or down is defined using Tag system.
+ *
+ *
+ *
* @param noShadow Self-explanatory
* @param flipY If you have Y-down coord system implemented on your GDX (e.g. legacy codebase), set this to ```true``` so that the shadow won't be upside-down. For glyph getting upside-down, set ```TextureRegionPack.globalFlipY = true```.
*
@@ -139,6 +145,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun isInsular(c: Int) = c == 0x1D79 || c in 0xA779..0xA787
private fun isNagariBengali(c: Int) = c in codeRange[SHEET_NAGARI_BENGALI_VARW]
private fun isKartvelianCaps(c: Int) = c in codeRange[SHEET_KARTULI_CAPS_VARW]
+ private fun isDiacriticalMarks(c: Int) = c in codeRange[SHEET_DIACRITICAL_MARKS_VARW]
+
+ private fun isCaps(c: Int) = Character.isUpperCase(c) || isKartvelianCaps(c)
private fun extAindexX(c: Int) = (c - 0x100) % 16
@@ -206,6 +215,12 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun kartvelianCapsIndexX(c: Int) = (c - 0x1C90) % 16
private fun kartvelianCapsIndexY(c: Int) = (c - 0x1C90) / 16
+ private fun diacriticalMarksIndexX(c: Int) = (c - 0x300) % 16
+ private fun diacriticalMarksIndexY(c: Int) = (c - 0x300) / 16
+
+
+ private fun Int.isLowercase() = Character.isLowerCase(this) && !isKartvelianCaps(this)
+
private fun getColour(codePoint: Int): Color { // input: 0x10ARGB, out: RGBA8888
if (colourBuffer.containsKey(codePoint))
@@ -246,7 +261,11 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
SHEET_TSALAGI_VARW,
SHEET_INSUAR_VARW,
SHEET_NAGARI_BENGALI_VARW,
- SHEET_KARTULI_CAPS_VARW
+ SHEET_KARTULI_CAPS_VARW,
+ SHEET_DIACRITICAL_MARKS_VARW
+ )
+ private val autoShiftDownOnLowercase = arrayOf(
+ SHEET_DIACRITICAL_MARKS_VARW
)
private val fontParentDir = if (fontDir.endsWith('/') || fontDir.endsWith('\\')) fontDir else "$fontDir/"
@@ -274,7 +293,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
"tsalagi_variable.tga",
"insular_variable.tga",
"devanagari_bengali_variable.tga",
- "kartuli_allcaps_variable.tga"
+ "kartuli_allcaps_variable.tga",
+ "diacritical_marks_variable.tga"
)
private val codeRange = arrayOf( // MUST BE MATCHING WITH SHEET INDICES!!
0..0xFF,
@@ -291,7 +311,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
0xE00..0xE5F,
0x530..0x58F,
0x10D0..0x10FF,
- 0x250..0x2AF,
+ 0x250..0x2FF,
0x16A0..0x16FF,
0x1E00..0x1EFF,
0xE000..0xE0FF,
@@ -300,7 +320,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
0x13A0..0x13F5,
0xA770..0xA787,
0x900..0x9FF,
- 0x1C90..0x1CBF
+ 0x1C90..0x1CBF,
+ 0x300..0x36F
)
private val glyphProps: HashMap = HashMap()
private val sheets: Array
@@ -523,6 +544,13 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
}
GlyphProps.STACK_UP -> {
posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter
+
+ // shift down on lowercase if applicable
+ if (getSheetType(thisChar) in autoShiftDownOnLowercase &&
+ lastNonDiacriticChar.isLowercase()) {
+ posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN
+ }
+
stackUpwardCounter++
}
GlyphProps.STACK_UP_N_DOWN -> {
@@ -781,6 +809,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
return SHEET_NAGARI_BENGALI_VARW
else if (isKartvelianCaps(c))
return SHEET_KARTULI_CAPS_VARW
+ else if (isDiacriticalMarks(c))
+ return SHEET_DIACRITICAL_MARKS_VARW
else
return SHEET_UNKNOWN
// fixed width
@@ -874,6 +904,10 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
sheetX = kartvelianCapsIndexX(ch)
sheetY = kartvelianCapsIndexY(ch)
}
+ SHEET_DIACRITICAL_MARKS_VARW -> {
+ sheetX = diacriticalMarksIndexX(ch)
+ sheetY = diacriticalMarksIndexY(ch)
+ }
else -> {
sheetX = ch % 16
sheetY = ch / 16
@@ -1057,6 +1091,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
internal val H_DIACRITICS = 3
+ internal val H_STACKUP_LOWERCASE_SHIFTDOWN = 4
+ internal val H_OVERLAY_LOWERCASE_SHIFTDOWN = 2
+
internal val SIZE_CUSTOM_SYM = 18
internal val SHEET_ASCII_VARW = 0
@@ -1083,6 +1120,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
internal val SHEET_INSUAR_VARW = 21
internal val SHEET_NAGARI_BENGALI_VARW=22
internal val SHEET_KARTULI_CAPS_VARW = 23
+ internal val SHEET_DIACRITICAL_MARKS_VARW = 24
internal val SHEET_UNKNOWN = 254