unicode super/subscripts (fractions)
160
.idea/workspace.xml
generated
@@ -7,18 +7,12 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="22c5bc80-996c-4846-b173-7dc8c2096fe3" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CONTRIBUTING.md" beforeDir="false" afterPath="$PROJECT_DIR$/CONTRIBUTING.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/lib/TerrarumSansBitmap.jar" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" beforeDir="false" afterPath="$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/ascii_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/ascii_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/devanagari_bengali_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/devanagari_bengali_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/assets/unipunct_variable.tga" beforeDir="false" afterPath="$PROJECT_DIR$/assets/unipunct_variable.tga" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/demo.PNG" beforeDir="false" afterPath="$PROJECT_DIR$/demo.PNG" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/demotext.txt" beforeDir="false" afterPath="$PROJECT_DIR$/demotext.txt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" beforeDir="false" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/testing.PNG" beforeDir="false" afterPath="$PROJECT_DIR$/testing.PNG" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/testtext.txt" beforeDir="false" afterPath="$PROJECT_DIR$/testtext.txt" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/out/" />
|
||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||
@@ -35,11 +29,11 @@
|
||||
<splitter split-orientation="horizontal" split-proportion="0.5">
|
||||
<split-first>
|
||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="521">
|
||||
<caret line="1076" column="27" selection-start-line="1076" selection-start-column="27" selection-end-line="1076" selection-end-column="27" />
|
||||
<state relative-caret-position="469">
|
||||
<caret line="280" column="26" selection-start-line="280" selection-start-column="26" selection-end-line="280" selection-end-column="26" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -47,7 +41,7 @@
|
||||
<file leaf-file-name="GlyphProps.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="28">
|
||||
<state relative-caret-position="91">
|
||||
<caret line="7" column="22" selection-start-line="7" selection-start-column="22" selection-end-line="7" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -62,6 +56,11 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="demo.PNG" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/demo.PNG">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
</file>
|
||||
</leaf>
|
||||
</split-first>
|
||||
<split-second>
|
||||
@@ -69,8 +68,8 @@
|
||||
<file leaf-file-name="FontTestGDX.kt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="338">
|
||||
<caret line="26" column="36" selection-start-line="26" selection-start-column="36" selection-end-line="26" selection-end-column="36" />
|
||||
<state relative-caret-position="559">
|
||||
<caret line="43" column="32" selection-start-line="43" selection-start-column="32" selection-end-line="43" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#384#0" expanded="true" />
|
||||
</folding>
|
||||
@@ -90,27 +89,17 @@
|
||||
<file leaf-file-name="demotext.txt" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/demotext.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="611">
|
||||
<caret line="96" column="57" selection-start-line="96" selection-start-column="57" selection-end-line="96" selection-end-column="57" />
|
||||
<state relative-caret-position="508">
|
||||
<caret line="94" column="36" selection-start-line="94" selection-start-column="36" selection-end-line="94" selection-end-column="36" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="testing.PNG" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/testing.PNG">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="demo.PNG" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/demo.PNG">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
|
||||
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="568">
|
||||
<caret line="1091" column="26" selection-start-line="1091" selection-start-column="26" selection-end-line="1091" selection-end-column="26" />
|
||||
<state relative-caret-position="381">
|
||||
<caret line="983" column="31" lean-forward="true" selection-start-line="983" selection-start-column="31" selection-end-line="983" selection-end-column="31" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
@@ -119,7 +108,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/CONTRIBUTING.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="FIRST">
|
||||
<first_editor relative-caret-position="507">
|
||||
<first_editor relative-caret-position="663">
|
||||
<caret line="51" column="45" selection-start-line="51" selection-start-column="45" selection-end-line="51" selection-end-column="45" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
@@ -142,7 +131,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="FIRST">
|
||||
<first_editor relative-caret-position="13">
|
||||
<first_editor relative-caret-position="325">
|
||||
<caret line="25" column="97" selection-start-line="25" selection-start-column="97" selection-end-line="25" selection-end-column="97" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
@@ -165,7 +154,6 @@
|
||||
</component>
|
||||
<component name="FindInProjectRecents">
|
||||
<findStrings>
|
||||
<find>Unexpected</find>
|
||||
<find>Unexp</find>
|
||||
<find>fun getSh</find>
|
||||
<find>codeRange</find>
|
||||
@@ -195,6 +183,7 @@
|
||||
<find>demo.PNG</find>
|
||||
<find>joiner</find>
|
||||
<find>va-</find>
|
||||
<find>'</find>
|
||||
</findStrings>
|
||||
<replaceStrings>
|
||||
<replace>.141</replace>
|
||||
@@ -513,34 +502,34 @@
|
||||
<window_info anchor="right" id="Palette	" order="3" />
|
||||
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
|
||||
<window_info anchor="right" id="Maven Projects" order="3" />
|
||||
<window_info anchor="bottom" id="Version Control" order="7" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.2591522" />
|
||||
<window_info anchor="bottom" id="Version Control" order="7" />
|
||||
<window_info anchor="bottom" id="Terminal" order="7" />
|
||||
<window_info id="Designer" order="2" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.122068234" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32931355" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.12313433" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info id="UI Designer" order="2" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.23005566" />
|
||||
<window_info id="Favorites" order="2" side_tool="true" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32931355" />
|
||||
</layout>
|
||||
<layout-to-restore>
|
||||
<window_info anchor="right" id="Palette" order="3" />
|
||||
<window_info anchor="right" content_ui="combo" id="Hierarchy" order="2" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.2591522" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.122068234" />
|
||||
<window_info id="Structure" order="1" side_tool="true" weight="0.25" />
|
||||
<window_info anchor="right" id="Commander" order="0" weight="0.4" />
|
||||
<window_info anchor="right" id="Ant Build" order="1" weight="0.25" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||
<window_info anchor="bottom" id="Run" order="2" weight="0.2591522" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32931355" />
|
||||
<window_info id="Designer" order="2" />
|
||||
<window_info id="UI Designer" order="3" />
|
||||
<window_info active="true" anchor="bottom" id="Debug" order="3" visible="true" weight="0.23005566" />
|
||||
@@ -549,7 +538,7 @@
|
||||
<window_info anchor="bottom" id="Event Log" order="8" side_tool="true" />
|
||||
<window_info anchor="bottom" id="Inspection" order="5" weight="0.4" />
|
||||
<window_info anchor="bottom" id="Cvs" order="4" weight="0.25" />
|
||||
<window_info anchor="bottom" id="Find" order="1" weight="0.32931355" />
|
||||
<window_info anchor="bottom" id="Message" order="0" />
|
||||
<window_info anchor="bottom" id="Messages" order="10" weight="0.3283859" />
|
||||
<window_info anchor="right" id="Maven Projects" order="5" />
|
||||
<window_info id="Favorites" order="4" side_tool="true" />
|
||||
@@ -568,6 +557,18 @@
|
||||
<option name="FILTER_TARGETS" value="false" />
|
||||
</component>
|
||||
<component name="editorHistoryManager">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="FIRST">
|
||||
<first_editor relative-caret-position="325">
|
||||
<caret line="25" column="97" selection-start-line="25" selection-start-column="97" selection-end-line="25" selection-end-column="97" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<js_state />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="SPLIT">
|
||||
@@ -857,7 +858,7 @@
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="FIRST">
|
||||
<first_editor relative-caret-position="13">
|
||||
<first_editor relative-caret-position="325">
|
||||
<caret line="25" column="97" selection-start-line="25" selection-start-column="97" selection-end-line="25" selection-end-column="97" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
@@ -866,6 +867,35 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="91">
|
||||
<caret line="7" column="22" selection-start-line="7" selection-start-column="22" selection-end-line="7" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CONTRIBUTING.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="FIRST">
|
||||
<first_editor relative-caret-position="663">
|
||||
<caret line="51" column="45" selection-start-line="51" selection-start-column="45" selection-end-line="51" selection-end-column="45" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<js_state />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="559">
|
||||
<caret line="43" column="32" selection-start-line="43" selection-start-column="32" selection-end-line="43" selection-end-column="32" />
|
||||
<folding>
|
||||
<element signature="e#0#384#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CONTRIBUTORS.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
@@ -880,28 +910,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/GlyphProps.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="28">
|
||||
<caret line="7" column="22" selection-start-line="7" selection-start-column="22" selection-end-line="7" selection-end-column="22" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CONTRIBUTING.md">
|
||||
<provider selected="true" editor-type-id="split-provider[text-editor;MarkdownPreviewEditor]">
|
||||
<state split_layout="FIRST">
|
||||
<first_editor relative-caret-position="507">
|
||||
<caret line="51" column="45" selection-start-line="51" selection-start-column="45" selection-end-line="51" selection-end-column="45" />
|
||||
</first_editor>
|
||||
<second_editor>
|
||||
<js_state />
|
||||
</second_editor>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/testing.PNG">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/testtext.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="52">
|
||||
@@ -909,30 +917,20 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/FontTestGDX/src/FontTestGDX.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="338">
|
||||
<caret line="26" column="36" selection-start-line="26" selection-start-column="36" selection-end-line="26" selection-end-column="36" />
|
||||
<folding>
|
||||
<element signature="e#0#384#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/demotext.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="611">
|
||||
<caret line="96" column="57" selection-start-line="96" selection-start-column="57" selection-end-line="96" selection-end-column="57" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/demo.PNG">
|
||||
<provider selected="true" editor-type-id="images" />
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/demotext.txt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="508">
|
||||
<caret line="94" column="36" selection-start-line="94" selection-start-column="36" selection-end-line="94" selection-end-column="36" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="521">
|
||||
<caret line="1076" column="27" selection-start-line="1076" selection-start-column="27" selection-end-line="1076" selection-end-column="27" />
|
||||
<state relative-caret-position="381">
|
||||
<caret line="983" column="31" lean-forward="true" selection-start-line="983" selection-start-column="31" selection-end-line="983" selection-end-column="31" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
||||
@@ -23,8 +23,8 @@ class FontTestGDX : Game() {
|
||||
lateinit var camera: OrthographicCamera
|
||||
|
||||
|
||||
private val demotextName = "demotext.txt"
|
||||
private val outimageName = "demo.png"
|
||||
private val demotextName = "testtext.txt"
|
||||
private val outimageName = "testing.png"
|
||||
|
||||
override fun create() {
|
||||
font = GameFontBase("./assets", flipY = false, errorOnUnknownChar = true) // must test for two flipY cases
|
||||
|
||||
|
Before Width: | Height: | Size: 320 KiB After Width: | Height: | Size: 320 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 200 KiB |
BIN
demo.PNG
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 130 KiB |
13
demotext.txt
@@ -10,7 +10,7 @@ You somehow found a multilingual one, and it makes your game look like an old co
|
||||
“Well, better than nothing… no, it’s ugly.”
|
||||
|
||||
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.
|
||||
Japanese, it’s not even multilingual, and their English look uncanny and inconsistent as hell.
|
||||
|
||||
Eventually you just mix different fonts together, and the results were always infuriating.
|
||||
|
||||
@@ -91,13 +91,20 @@ How multilingual? Real multilingual!
|
||||
|
||||
For all those dash-pedants, we have en-dash, em-dash, and even horizontal bars!
|
||||
|
||||
5¹⁹⁄₃₂ inch is 142.1 mm · (C₂F₄)ₙ is godly · Error = MoreCode²
|
||||
NOTE: we don’t do fractions. 142¹⁄₁₀ mm is illegal!
|
||||
|
||||
Did you know Unicode supports arbitrary fractions? Actually I didn’t… as they abused super/subscripts!
|
||||
|
||||
Unicode References:
|
||||
|
||||
Basic Latin Latin-1 Latin Extension A Latin Extionsion B IPA Extension Greek Cyrillic
|
||||
Cyrillic Supplement Armenian Devanagari Bengali 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
|
||||
General Punctuations Superscripts and Subscripts 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.
|
||||
|
||||
<EFBFBD> 文字化け! <20>
|
||||
@@ -309,7 +309,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
0x3400..0x9FFF,
|
||||
0x400..0x52F,
|
||||
0xFF00..0xFF1F,
|
||||
0x2000..0x205F,
|
||||
0x2000..0x209F,
|
||||
0x370..0x3CE,
|
||||
0xE00..0xE5F,
|
||||
0x530..0x58F,
|
||||
@@ -471,123 +471,13 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
if (charSeq.isNotBlank()) {
|
||||
if (oldCharSequence != charSeq || firstRun) {
|
||||
textBuffer = charSeq.toCodePoints()
|
||||
val str = textBuffer
|
||||
val widths = getWidthOfCharSeq(str)
|
||||
val texWidth = widths.sum()
|
||||
//val texWidth = widths.sum()
|
||||
|
||||
//if (!firstRun) textTexture.dispose()
|
||||
//textTexture = FrameBuffer(Pixmap.Format.RGBA8888, texWidth, H, true)
|
||||
|
||||
|
||||
glyphWidthBuffer = widths
|
||||
|
||||
posXbuffer = IntArray(str.size, { 0 })
|
||||
posYbuffer = IntArray(str.size, { 0 })
|
||||
|
||||
|
||||
var nonDiacriticCounter = 0 // index of last instance of non-diacritic char
|
||||
var stackUpwardCounter = 0
|
||||
var stackDownwardCounter = 0
|
||||
for (charIndex in 0 until posXbuffer.size) {
|
||||
if (charIndex > 0) {
|
||||
// nonDiacriticCounter allows multiple diacritics
|
||||
|
||||
val thisChar = str[charIndex]
|
||||
if (glyphProps[thisChar] == null && errorOnUnknownChar) {
|
||||
val errorGlyphSB = StringBuilder()
|
||||
Character.toChars(thisChar).forEach { errorGlyphSB.append(it) }
|
||||
|
||||
throw InternalError("No GlyphProps for char '$errorGlyphSB' " +
|
||||
"(${thisChar.charInfo()})")
|
||||
}
|
||||
val thisProp = glyphProps[thisChar] ?: nullProp
|
||||
val lastNonDiacriticChar = str[nonDiacriticCounter]
|
||||
val itsProp = glyphProps[lastNonDiacriticChar] ?: nullProp
|
||||
|
||||
|
||||
//println("char: ${thisChar.charInfo()}\nproperties: $thisProp")
|
||||
|
||||
|
||||
val alignmentOffset = when (thisProp.alignWhere) {
|
||||
GlyphProps.ALIGN_LEFT -> 0
|
||||
GlyphProps.ALIGN_RIGHT -> thisProp.width - W_VAR_INIT
|
||||
GlyphProps.ALIGN_CENTRE -> Math.ceil((thisProp.width - W_VAR_INIT) / 2.0).toInt()
|
||||
else -> 0 // implies "diacriticsBeforeGlyph = true"
|
||||
}
|
||||
|
||||
if (!thisProp.writeOnTop) {
|
||||
posXbuffer[charIndex] =
|
||||
if (itsProp.alignWhere == GlyphProps.ALIGN_RIGHT)
|
||||
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset + interchar
|
||||
else
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar
|
||||
|
||||
nonDiacriticCounter = charIndex
|
||||
|
||||
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) {
|
||||
GlyphProps.ALIGN_LEFT, GlyphProps.ALIGN_BEFORE -> posXbuffer[nonDiacriticCounter]
|
||||
GlyphProps.ALIGN_RIGHT -> {
|
||||
posXbuffer[nonDiacriticCounter] - (W_VAR_INIT - itsProp.width)
|
||||
}
|
||||
GlyphProps.ALIGN_CENTRE -> {
|
||||
val alignXPos = if (itsProp.alignXPos == 0) itsProp.width.div(2) else itsProp.alignXPos
|
||||
|
||||
if (itsProp.alignWhere == GlyphProps.ALIGN_RIGHT) {
|
||||
posXbuffer[nonDiacriticCounter] + alignXPos + (itsProp.width + 1).div(2)
|
||||
}
|
||||
else {
|
||||
posXbuffer[nonDiacriticCounter] + alignXPos - (W_VAR_INIT - 1).div(2)
|
||||
}
|
||||
}
|
||||
else -> throw InternalError("Unsupported alignment: ${thisProp.alignWhere}")
|
||||
}
|
||||
|
||||
|
||||
// set Y pos according to diacritics position
|
||||
if (thisProp.alignWhere == GlyphProps.ALIGN_CENTRE) {
|
||||
when (thisProp.stackWhere) {
|
||||
GlyphProps.STACK_DOWN -> {
|
||||
posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter
|
||||
stackDownwardCounter++
|
||||
}
|
||||
GlyphProps.STACK_UP -> {
|
||||
posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter
|
||||
|
||||
// shift down on lowercase if applicable
|
||||
if (getSheetType(thisChar) in autoShiftDownOnLowercase &&
|
||||
lastNonDiacriticChar.isLowHeight()) {
|
||||
if (thisProp.alignXPos == GlyphProps.DIA_OVERLAY)
|
||||
posYbuffer[charIndex] += H_OVERLAY_LOWERCASE_SHIFTDOWN
|
||||
else
|
||||
posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN
|
||||
}
|
||||
|
||||
stackUpwardCounter++
|
||||
}
|
||||
GlyphProps.STACK_UP_N_DOWN -> {
|
||||
posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter
|
||||
stackDownwardCounter++
|
||||
posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter
|
||||
stackUpwardCounter++
|
||||
}
|
||||
// for BEFORE_N_AFTER, do nothing in here
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
buildWidthAndPosBuffers()
|
||||
|
||||
|
||||
//print("[TerrarumSansBitmap] widthTable for $textBuffer: ")
|
||||
@@ -1037,6 +927,133 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
|
||||
}
|
||||
|
||||
|
||||
private fun buildWidthAndPosBuffers() {
|
||||
val str = textBuffer
|
||||
val widths = getWidthOfCharSeq(str)
|
||||
|
||||
glyphWidthBuffer = widths
|
||||
|
||||
posXbuffer = IntArray(str.size, { 0 })
|
||||
posYbuffer = IntArray(str.size, { 0 })
|
||||
|
||||
|
||||
var nonDiacriticCounter = 0 // index of last instance of non-diacritic char
|
||||
var stackUpwardCounter = 0
|
||||
var stackDownwardCounter = 0
|
||||
|
||||
val HALF_VAR_INIT = W_VAR_INIT.minus(1).div(2)
|
||||
|
||||
for (charIndex in 0 until posXbuffer.size) {
|
||||
if (charIndex > 0) {
|
||||
// nonDiacriticCounter allows multiple diacritics
|
||||
|
||||
val thisChar = str[charIndex]
|
||||
if (glyphProps[thisChar] == null && errorOnUnknownChar) {
|
||||
val errorGlyphSB = StringBuilder()
|
||||
Character.toChars(thisChar).forEach { errorGlyphSB.append(it) }
|
||||
|
||||
throw InternalError("No GlyphProps for char '$errorGlyphSB' " +
|
||||
"(${thisChar.charInfo()})")
|
||||
}
|
||||
val thisProp = glyphProps[thisChar] ?: nullProp
|
||||
val lastNonDiacriticChar = str[nonDiacriticCounter]
|
||||
val itsProp = glyphProps[lastNonDiacriticChar] ?: nullProp
|
||||
|
||||
|
||||
//println("char: ${thisChar.charInfo()}\nproperties: $thisProp")
|
||||
|
||||
|
||||
val alignmentOffset = when (thisProp.alignWhere) {
|
||||
GlyphProps.ALIGN_LEFT -> 0
|
||||
GlyphProps.ALIGN_RIGHT -> thisProp.width - W_VAR_INIT
|
||||
GlyphProps.ALIGN_CENTRE -> Math.ceil((thisProp.width - W_VAR_INIT) / 2.0).toInt()
|
||||
else -> 0 // implies "diacriticsBeforeGlyph = true"
|
||||
}
|
||||
|
||||
if (!thisProp.writeOnTop) {
|
||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||
GlyphProps.ALIGN_RIGHT ->
|
||||
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset + interchar
|
||||
GlyphProps.ALIGN_CENTRE ->
|
||||
posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset + interchar
|
||||
else ->
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset + interchar
|
||||
|
||||
}
|
||||
|
||||
nonDiacriticCounter = charIndex
|
||||
|
||||
stackUpwardCounter = 0
|
||||
stackDownwardCounter = 0
|
||||
}
|
||||
else if (thisProp.writeOnTop && thisProp.alignXPos == GlyphProps.DIA_JOINER) {
|
||||
posXbuffer[charIndex] = when (itsProp.alignWhere) {
|
||||
GlyphProps.ALIGN_RIGHT ->
|
||||
posXbuffer[nonDiacriticCounter] + W_VAR_INIT + alignmentOffset
|
||||
//GlyphProps.ALIGN_CENTRE ->
|
||||
// posXbuffer[nonDiacriticCounter] + HALF_VAR_INIT + itsProp.width + alignmentOffset
|
||||
else ->
|
||||
posXbuffer[nonDiacriticCounter] + itsProp.width + alignmentOffset
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
// set X pos according to alignment information
|
||||
posXbuffer[charIndex] = when (thisProp.alignWhere) {
|
||||
GlyphProps.ALIGN_LEFT, GlyphProps.ALIGN_BEFORE -> posXbuffer[nonDiacriticCounter]
|
||||
GlyphProps.ALIGN_RIGHT -> {
|
||||
posXbuffer[nonDiacriticCounter] - (W_VAR_INIT - itsProp.width)
|
||||
}
|
||||
GlyphProps.ALIGN_CENTRE -> {
|
||||
val alignXPos = if (itsProp.alignXPos == 0) itsProp.width.div(2) else itsProp.alignXPos
|
||||
|
||||
if (itsProp.alignWhere == GlyphProps.ALIGN_RIGHT) {
|
||||
posXbuffer[nonDiacriticCounter] + alignXPos + (itsProp.width + 1).div(2)
|
||||
}
|
||||
else {
|
||||
posXbuffer[nonDiacriticCounter] + alignXPos - HALF_VAR_INIT
|
||||
}
|
||||
}
|
||||
else -> throw InternalError("Unsupported alignment: ${thisProp.alignWhere}")
|
||||
}
|
||||
|
||||
|
||||
// set Y pos according to diacritics position
|
||||
if (thisProp.alignWhere == GlyphProps.ALIGN_CENTRE) {
|
||||
when (thisProp.stackWhere) {
|
||||
GlyphProps.STACK_DOWN -> {
|
||||
posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter
|
||||
stackDownwardCounter++
|
||||
}
|
||||
GlyphProps.STACK_UP -> {
|
||||
posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter
|
||||
|
||||
// shift down on lowercase if applicable
|
||||
if (getSheetType(thisChar) in autoShiftDownOnLowercase &&
|
||||
lastNonDiacriticChar.isLowHeight()) {
|
||||
if (thisProp.alignXPos == GlyphProps.DIA_OVERLAY)
|
||||
posYbuffer[charIndex] += H_OVERLAY_LOWERCASE_SHIFTDOWN
|
||||
else
|
||||
posYbuffer[charIndex] += H_STACKUP_LOWERCASE_SHIFTDOWN
|
||||
}
|
||||
|
||||
stackUpwardCounter++
|
||||
}
|
||||
GlyphProps.STACK_UP_N_DOWN -> {
|
||||
posYbuffer[charIndex] = H_DIACRITICS * stackDownwardCounter
|
||||
stackDownwardCounter++
|
||||
posYbuffer[charIndex] = -H_DIACRITICS * stackUpwardCounter
|
||||
stackUpwardCounter++
|
||||
}
|
||||
// for BEFORE_N_AFTER, do nothing in here
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** UTF-16 to ArrayList of Int. UTF-16 is because of Java
|
||||
* Note: CharSequence IS a String. java.lang.String implements CharSequence.
|
||||
*/
|
||||
|
||||
BIN
testing.PNG
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 42 KiB |
23
testtext.txt
@@ -3,3 +3,26 @@
|
||||
हैहैहै
|
||||
সিওল কোরিয়া রাজধানী
|
||||
सियोल कोरिया की राजधानी है
|
||||
|
||||
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ʊøɘɵɤəɛœɜɞʌɔæɐɶɑɒɚɝɩɪʅʈʏʞ
|
||||