Color codes (RGBA4444), NOT tested with Slick2D

This commit is contained in:
minjaesong
2017-07-02 03:29:11 +09:00
parent 3aba6aacc7
commit 4cd29b5230
6 changed files with 410 additions and 180 deletions

View File

@@ -1,6 +1,6 @@
<component name="ArtifactManager">
<artifact type="jar" name="TerrarumSansBitmap">
<output-path>$PROJECT_DIR$/out/artifacts/TerrarumSansBitmap</output-path>
<output-path>$PROJECT_DIR$</output-path>
<root id="archive" name="TerrarumSansBitmap.jar">
<element id="module-output" name="BuildJAR_TerrarumSansBitmap" />
<element id="directory" name="META-INF">

230
.idea/workspace.xml generated
View File

@@ -7,14 +7,12 @@
</component>
<component name="ChangeListManager">
<list default="true" id="22c5bc80-996c-4846-b173-7dc8c2096fe3" name="Default" comment="">
<change type="DELETED" beforePath="$PROJECT_DIR$/terrarumsansbitmap/gdx/GameFontBase.kt" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/terrarumsansbitmap/gdx/TextureRegionPack.kt" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/terrarumsansbitmap/readme.md" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/terrarumsansbitmap/slick2d/GameFontBase.kt" afterPath="" />
<change type="DELETED" beforePath="$PROJECT_DIR$/terrarumsansbitmap/slick2d/GameFontImpl.kt" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/assets/hangul_johab.tga" afterPath="$PROJECT_DIR$/assets/hangul_johab.tga" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.gitignore" afterPath="$PROJECT_DIR$/.gitignore" />
<change type="DELETED" beforePath="$PROJECT_DIR$/TerrarumSansBitmap.jar" afterPath="" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/artifacts/TerrarumSansBitmap.xml" afterPath="$PROJECT_DIR$/.idea/artifacts/TerrarumSansBitmap.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/demo/.idea/workspace.xml" afterPath="$PROJECT_DIR$/demo/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" afterPath="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" />
</list>
<ignored path="$PROJECT_DIR$/out/" />
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -26,30 +24,49 @@
</component>
<component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
<component name="FileEditorManager">
<leaf>
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="40" column="2" lean-forward="false" selection-start-line="40" selection-start-column="2" selection-end-line="40" selection-end-column="2" />
<folding />
</state>
</provider>
</entry>
</file>
<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="630">
<caret line="67" column="39" lean-forward="false" selection-start-line="67" selection-start-column="39" selection-end-line="67" selection-end-column="39" />
<folding>
<element signature="e#1202#1474#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
<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">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5600">
<caret line="455" column="22" lean-forward="true" selection-start-line="455" selection-start-column="22" selection-end-line="455" selection-end-column="22" />
<folding>
<element signature="e#1206#3954#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</split-first>
<split-second>
<leaf>
<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="602">
<caret line="66" column="93" lean-forward="false" selection-start-line="66" selection-start-column="93" selection-end-line="66" selection-end-column="93" />
<folding>
<element signature="n#!!doc" expanded="true" />
<marker date="1498933632357" expanded="true" signature="21660:22104" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</file>
</leaf>
</split-second>
</splitter>
</component>
<component name="FindInProjectRecents">
<findStrings>
<find>getWidth</find>
<find>getG</find>
<find>getWidt</find>
<find>batch.color =</find>
</findStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
@@ -63,14 +80,17 @@
<option name="CHANGED_PATHS">
<list>
<option value="$PROJECT_DIR$/.gitignore" />
<option value="$PROJECT_DIR$/lib/slick.jar!/org/newdawn/slick/Color.class" />
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt" />
<option value="$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/gdx/GameFontBase.kt" />
</list>
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-1208" />
<option name="y" value="-647" />
<option name="width" value="1216" />
<option name="height" value="1896" />
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1176" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
@@ -87,7 +107,6 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -164,8 +183,9 @@
</PATH>
</subPane>
</pane>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -364,31 +384,31 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-1208" y="-647" width="1216" height="1896" extended-state="6" />
<frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3295519" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3295519" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.12953092" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
</layout>
</component>
<component name="VcsContentAnnotationSettings">
@@ -403,20 +423,23 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/.gitignore">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="56">
<caret line="4" column="5" lean-forward="false" selection-start-line="4" selection-start-column="5" selection-end-line="4" selection-end-column="5" />
<folding />
<state relative-caret-position="112">
<caret line="40" column="2" lean-forward="false" selection-start-line="40" selection-start-column="2" selection-end-line="40" selection-end-column="2" />
<folding>
<element signature="e#1206#3954#0" expanded="true" />
</folding>
</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="630">
<caret line="67" column="39" lean-forward="false" selection-start-line="67" selection-start-column="39" selection-end-line="67" selection-end-column="39" />
<state relative-caret-position="336">
<caret line="24" column="14" lean-forward="false" selection-start-line="24" selection-start-column="14" selection-end-line="24" selection-end-column="14" />
<folding>
<element signature="e#1202#1474#0" expanded="true" />
<element signature="n#!!doc" expanded="true" />
<marker date="1498933632357" expanded="true" signature="21660:22104" ph="{...}" />
</folding>
</state>
</provider>
@@ -425,10 +448,101 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="112">
<caret line="40" column="2" lean-forward="false" selection-start-line="40" selection-start-column="2" selection-end-line="40" selection-end-column="2" />
<folding>
<element signature="e#1206#3954#0" expanded="true" />
</folding>
</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="28">
<caret line="24" column="14" lean-forward="false" selection-start-line="24" selection-start-column="14" selection-end-line="24" selection-end-column="14" />
<folding>
<element signature="n#!!doc" expanded="true" />
<marker date="1498933632357" expanded="true" signature="21660:22104" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#1206#3954#0" expanded="true" />
</folding>
</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="504">
<caret line="43" column="39" lean-forward="false" selection-start-line="43" selection-start-column="39" selection-end-line="43" selection-end-column="39" />
<folding>
<element signature="n#!!doc" expanded="true" />
<marker date="1498933632357" expanded="true" signature="21660:22104" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#1206#3954#0" expanded="true" />
</folding>
</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="532">
<caret line="67" column="39" lean-forward="false" selection-start-line="67" selection-start-column="39" selection-end-line="67" selection-end-column="39" />
<folding>
<element signature="n#!!doc" expanded="true" />
<marker date="1498933632357" expanded="true" signature="21660:22104" ph="{...}" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.gitignore">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="56">
<caret line="4" column="5" lean-forward="false" selection-start-line="4" selection-start-column="5" selection-end-line="4" selection-end-column="5" />
</state>
</provider>
</entry>
<entry file="jar://$PROJECT_DIR$/lib/slick.jar!/org/newdawn/slick/Color.class">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="339">
<caret line="76" column="11" lean-forward="false" selection-start-line="76" selection-start-column="11" selection-end-line="76" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarumsansbitmap/slick2d/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="5600">
<caret line="455" column="22" lean-forward="true" selection-start-line="455" selection-start-column="22" selection-end-line="455" selection-end-column="22" />
<folding>
<element signature="e#1206#3954#0" expanded="true" />
</folding>
</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="602">
<caret line="66" column="93" lean-forward="false" selection-start-line="66" selection-start-column="93" selection-end-line="66" selection-end-column="93" />
<folding>
<element signature="n#!!doc" expanded="true" />
<marker date="1498933632357" expanded="true" signature="21660:22104" ph="{...}" />
</folding>
</state>
</provider>
</entry>
</component>
<component name="masterDetails">
<states>

BIN
assets/futhark.tga Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -24,7 +24,7 @@
<file leaf-file-name="GameFontDemo.kt" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="602">
<state relative-caret-position="434">
<caret line="43" column="0" lean-forward="false" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
<folding>
<element signature="e#40#255#0" expanded="true" />
@@ -36,8 +36,8 @@
<file leaf-file-name="GameFontBase.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="8582">
<caret line="613" column="0" lean-forward="false" selection-start-line="613" selection-start-column="0" selection-end-line="613" selection-end-column="0" />
<state relative-caret-position="405">
<caret line="561" column="32" lean-forward="true" selection-start-line="561" selection-start-column="32" selection-end-line="561" selection-end-column="32" />
<folding>
<element signature="e#48#391#0" expanded="true" />
</folding>
@@ -92,10 +92,10 @@
</option>
</component>
<component name="ProjectFrameBounds">
<option name="x" value="-1208" />
<option name="y" value="-647" />
<option name="width" value="1216" />
<option name="height" value="1896" />
<option name="x" value="-8" />
<option name="y" value="-8" />
<option name="width" value="1936" />
<option name="height" value="1176" />
</component>
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
@@ -112,6 +112,8 @@
<foldersAlwaysOnTop value="true" />
</navigator>
<panes>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="ProjectPane">
<subPane>
<PATH>
@@ -158,9 +160,7 @@
</PATH>
</subPane>
</pane>
<pane id="PackagesPane" />
<pane id="Scratches" />
<pane id="Scope" />
</panes>
</component>
<component name="PropertiesComponent">
@@ -384,11 +384,12 @@
<servers />
</component>
<component name="ToolWindowManager">
<frame x="-1208" y="-647" width="1216" height="1896" extended-state="6" />
<frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
<editor active="true" />
<layout>
<window_info id="Palette" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32898468" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960597" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
@@ -396,11 +397,11 @@
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="9" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.17301038" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.17430703" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Structure" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3054371" sideWeight="0.5" order="11" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2580828" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25790986" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="4" side_tool="true" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
@@ -409,7 +410,6 @@
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="9" side_tool="false" content_ui="combo" />
<window_info id="LuaJ" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32960597" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Code Iris" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.32960597" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.32898468" sideWeight="0.5" order="10" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="8" side_tool="false" content_ui="tabs" />
<window_info id="Documentation" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.1544196" sideWeight="0.4651163" order="10" side_tool="false" content_ui="tabs" x="1380" y="-157" width="1720" height="857" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
@@ -431,6 +431,46 @@
<option name="FILTER_TARGETS" value="false" />
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="518">
<caret line="43" column="0" lean-forward="false" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
<folding>
<element signature="e#40#255#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="8442">
<caret line="613" column="0" lean-forward="false" selection-start-line="613" selection-start-column="0" selection-end-line="613" selection-end-column="0" />
<folding>
<element signature="e#48#391#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="0" lean-forward="false" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding>
<element signature="e#40#255#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="8442">
<caret line="613" column="0" lean-forward="false" selection-start-line="613" selection-start-column="0" selection-end-line="613" selection-end-column="0" />
<folding>
<element signature="e#48#391#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
@@ -660,7 +700,6 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="504">
<caret line="48" column="14" lean-forward="false" selection-start-line="48" selection-start-column="14" selection-end-line="48" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
@@ -668,14 +707,13 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="392">
<caret line="34" column="11" lean-forward="false" selection-start-line="34" selection-start-column="11" selection-end-line="34" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="8582">
<caret line="613" column="0" lean-forward="false" selection-start-line="613" selection-start-column="0" selection-end-line="613" selection-end-column="0" />
<state relative-caret-position="405">
<caret line="561" column="32" lean-forward="true" selection-start-line="561" selection-start-column="32" selection-end-line="561" selection-end-column="32" />
<folding>
<element signature="e#48#391#0" expanded="true" />
</folding>
@@ -684,7 +722,7 @@
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="602">
<state relative-caret-position="434">
<caret line="43" column="0" lean-forward="false" selection-start-line="43" selection-start-column="0" selection-end-line="43" selection-end-column="0" />
<folding>
<element signature="e#40#255#0" expanded="true" />

View File

@@ -25,6 +25,7 @@
package net.torvald.terrarumsansbitmap.gdx
import com.badlogic.gdx.Gdx
import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.graphics.Pixmap
import com.badlogic.gdx.graphics.Texture
import com.badlogic.gdx.graphics.g2d.*
@@ -56,6 +57,8 @@ import java.util.zip.GZIPInputStream
* Glyphs are drawn lazily (calculated on-the-fly, rather than load up all), which is inevitable as we just can't load
* up 40k+ characters on the machine, which will certainly make loading time painfully long.
*
* Color Codes have following Unicode mapping: U+10RGBA, A must be non-zero to be visible. U+100000 reverts any colour code effects.
*
* @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```.
*
@@ -99,7 +102,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun isHangul(c: Char) = c.toInt() in codeRange[SHEET_HANGUL]
private fun isAscii(c: Char) = c.toInt() in codeRange[SHEET_ASCII_VARW]
//private fun isRunic(c: Char) = runicList.contains(c)
private fun isRunic(c: Char) = c.toInt() in codeRange[SHEET_RUNIC]
private fun isExtA(c: Char) = c.toInt() in codeRange[SHEET_EXTA_VARW]
private fun isExtB(c: Char) = c.toInt() in codeRange[SHEET_EXTB_VARW]
private fun isKana(c: Char) = c.toInt() in codeRange[SHEET_KANA]
@@ -117,6 +120,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun isArmenian(c: Char) = c.toInt() in codeRange[SHEET_HAYEREN_VARW]
private fun isKartvelian(c: Char) = c.toInt() in codeRange[SHEET_KARTULI_VARW]
private fun isIPA(c: Char) = c.toInt() in codeRange[SHEET_IPA_VARW]
private fun isColourCodeHigh(c: Char) = c.toInt() in 0b110110_1111000000..0b110110_1111111111
private fun isColourCodeLow(c: Char) = c.toInt() in 0b110111_0000000000..0b110111_1111111111
@@ -126,8 +131,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun extBindexX(c: Char) = (c.toInt() - 0x180) % 16
private fun extBindexY(c: Char) = (c.toInt() - 0x180) / 16
//private fun runicIndexX(c: Char) = runicList.indexOf(c) % 16
//private fun runicIndexY(c: Char) = runicList.indexOf(c) / 16
private fun runicIndexX(c: Char) = (c.toInt() - 0x16A0) % 16
private fun runicIndexY(c: Char) = (c.toInt() - 0x16A0) / 16
private fun kanaIndexX(c: Char) = (c.toInt() - 0x3040) % 16
private fun kanaIndexY(c: Char) = (c.toInt() - 0x3040) / 16
@@ -165,6 +170,26 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private fun ipaIndexX(c: Char) = (c.toInt() - 0x250) % 16
private fun ipaIndexY(c: Char) = (c.toInt() - 0x250) / 16
private fun getColour(charHigh: Char, charLow: Char): Color { // input: 0x10ARGB, out: RGBA8888
val codePoint = Character.toCodePoint(charHigh, charLow)
if (colourBuffer.containsKey(codePoint))
return colourBuffer[codePoint]!!
val r = codePoint.and(0xF000).ushr(12)
val g = codePoint.and(0x0F00).ushr(8)
val b = codePoint.and(0x00F0).ushr(4)
val a = codePoint.and(0x000F)
val col = Color(r.shl(28) or r.shl(24) or g.shl(20) or g.shl(16) or b.shl(12) or b.shl(8) or a.shl(4) or a)
colourBuffer[codePoint] = col
return col
}
private val colourBuffer = HashMap<Int, Color>()
private val unihanWidthSheets = arrayOf(
SHEET_UNIHAN,
SHEET_FW_UNI
@@ -199,6 +224,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
"hayeren_variable.tga",
"kartuli_variable.tga",
"ipa_ext_variable.tga",
"futhark.tga",
"puae000-e0ff.tga"
)
private val cyrilic_bg = "cyrilic_bulgarian_variable.tga"
@@ -219,6 +245,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
0x530..0x58F,
0x10D0..0x10FF,
0x250..0x2AF,
0x16A0..0x16FF,
0xE000..0xE0FF
)
private val glyphWidths: HashMap<Int, Int> = HashMap() // if the value is negative, it's diacritics
@@ -294,6 +321,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
else if (index == SHEET_CUSTOM_SYM) {
TextureRegionPack(texture, SIZE_CUSTOM_SYM, SIZE_CUSTOM_SYM) // TODO variable
}
else if (index == SHEET_RUNIC) {
TextureRegionPack(texture, W_LATIN_WIDE, H)
}
else throw IllegalArgumentException("[TerrarumSansBitmap] Unknown sheet index: $index")
@@ -359,6 +389,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
private var textBWidth = intArrayOf() // absolute posX of glyphs from print-origin
private var textBGSize = intArrayOf() // width of each glyph
private lateinit var originalColour: Color
override fun draw(batch: Batch, str: CharSequence, x: Float, y: Float): GlyphLayout? {
if (textBuffer != str) {
textBuffer = str
@@ -382,17 +414,38 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
//textBWidth.forEach { print("$it ") }; println()
val mainCol = batch.color.cpy()
val shadowCol = batch.color.cpy().mul(0.5f,0.5f,0.5f,1f)
originalColour = batch.color.cpy()
var mainCol = originalColour
var shadowCol = mainCol.cpy().mul(0.5f,0.5f,0.5f,1f)
textBuffer.forEachIndexed { index, c ->
var index = 0
while (index <= textBuffer.lastIndex) {
val c = textBuffer[index]
val sheetID = getSheetType(c)
val (sheetX, sheetY) = getSheetwisePosition(c)
//println("[TerrarumSansBitmap] sprite: $sheetID:${sheetX}x${sheetY}")
if (sheetID == SHEET_HANGUL) {
if (isColourCodeHigh(c)) {
val cchigh = c
val cclow = textBuffer[index + 1]
if (Character.toCodePoint(cchigh, cclow) == 0x100000) {
mainCol = originalColour
shadowCol = mainCol.cpy().mul(0.5f,0.5f,0.5f,1f)
}
else {
mainCol = getColour(cchigh, cclow)
shadowCol = mainCol.cpy().mul(0.5f, 0.5f, 0.5f, 1f)
}
index += 1
}
else if (isColourCodeLow(c)) {
throw Error("Unexpected encounter of ColourCodeLow at index $index of String '$textBuffer'")
}
else if (sheetID == SHEET_HANGUL) {
val hangulSheet = sheets[SHEET_HANGUL]
val hIndex = c.toInt() - 0xAC00
@@ -487,8 +540,13 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
batch.color = mainCol
}
}
index += 1
}
batch.color = originalColour
return null
}
@@ -513,6 +571,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
len[i] = glyphWidths[chr.toInt()]!!
}
else if (isColourCodeHigh(chr) || isColourCodeLow(chr))
len[i] = 0
else if (ctype == SHEET_CJK_PUNCT)
len[i] = W_ASIAN_PUNCT
else if (ctype == SHEET_HANGUL)
@@ -566,6 +626,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
return SHEET_KARTULI_VARW
else if (isIPA(c))
return SHEET_IPA_VARW
else if (isRunic(c))
return SHEET_RUNIC
else
return SHEET_UNKNOWN
// fixed width
@@ -677,8 +739,16 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
return glyphLayout.width.toInt()
}
companion object {
var interchar = 0
var scale = 1
set(value) {
if (value > 0) field = value
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
}
companion object {
internal val JUNG_COUNT = 21
internal val JONG_COUNT = 28
@@ -711,35 +781,10 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false, val flipY: Bo
internal val SHEET_HAYEREN_VARW = 12
internal val SHEET_KARTULI_VARW = 13
internal val SHEET_IPA_VARW = 14
internal val SHEET_CUSTOM_SYM = 15
internal val SHEET_RUNIC = 15
internal val SHEET_CUSTOM_SYM = 16
internal val SHEET_UNKNOWN = 254
/**
* Runic letters list used for game. The set is
* Younger Futhark + Medieval rune 'e' + Punct + Runic Almanac
* BEWARE OF SIMILAR-LOOKING RUNES, especially:
* * Algiz ᛉ instead of Maðr ᛘ
* * Short-Twig Hagall ᚽ instead of Runic Letter E ᛂ
* * Runic Letter OE ᚯ instead of Óss ᚬ
* Examples:
* ᛭ᛋᛁᚴᚱᛁᚦᛦ᛭
* ᛭ᛂᛚᛋᛅ᛭ᛏᚱᚢᛏᚾᛁᚾᚴᚢᚾᛅ᛬ᛅᚱᚾᛅᛏᛅᛚᛋ
*/
//internal val runicList = arrayOf('ᚠ', 'ᚢ', 'ᚦ', 'ᚬ', 'ᚱ', 'ᚴ', 'ᚼ', 'ᚾ', '', 'ᛅ', 'ᛋ', 'ᛏ', 'ᛒ', 'ᛘ', 'ᛚ', 'ᛦ', 'ᛂ', '', '᛫', '', 'ᛮ', 'ᛯ', 'ᛰ')
// TODO expand to full Unicode runes
var interchar = 0
var scale = 1
set(value) {
if (value > 0) field = value
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
}
}
}

View File

@@ -24,6 +24,37 @@
package net.torvald.terrarumsansbitmap.slick2d
import net.torvald.terrarumsansbitmap.gdx.GameFontBase
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.JUNG_COUNT
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.JONG_COUNT
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.W_ASIAN_PUNCT
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.W_HANGUL
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.W_KANA
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.W_UNIHAN
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.W_LATIN_WIDE
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.W_VAR_INIT
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.HGAP_VAR
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.H
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.H_UNIHAN
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SIZE_CUSTOM_SYM
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_ASCII_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_HANGUL
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_EXTA_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_EXTB_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_KANA
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_CJK_PUNCT
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_UNIHAN
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_CYRILIC_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_FW_UNI
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_UNI_PUNCT
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_GREEK_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_THAI_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_HAYEREN_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_KARTULI_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_IPA_VARW
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_CUSTOM_SYM
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_UNKNOWN
import net.torvald.terrarumsansbitmap.gdx.GameFontBase.Companion.SHEET_RUNIC
import org.newdawn.slick.Color
import org.newdawn.slick.Font
import org.newdawn.slick.Image
@@ -59,6 +90,8 @@ import java.util.zip.GZIPInputStream
* Glyphs are drawn lazily (calculated on-the-fly, rather than load up all), which is inevitable as we just can't load
* up 40k+ characters on the machine, which will certainly make loading time painfully long.
*
* Color Codes have following Unicode mapping: U+10RGBA, A must be non-zero to be visible. U+100000 reverts any colour code effects.
*
* @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```.
*
@@ -102,7 +135,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
private fun isHangul(c: Char) = c.toInt() in codeRange[SHEET_HANGUL]
private fun isAscii(c: Char) = c.toInt() in codeRange[SHEET_ASCII_VARW]
//private fun isRunic(c: Char) = runicList.contains(c)
private fun isRunic(c: Char) = c.toInt() in codeRange[SHEET_RUNIC]
private fun isExtA(c: Char) = c.toInt() in codeRange[SHEET_EXTA_VARW]
private fun isExtB(c: Char) = c.toInt() in codeRange[SHEET_EXTB_VARW]
private fun isKana(c: Char) = c.toInt() in codeRange[SHEET_KANA]
@@ -120,6 +153,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
private fun isArmenian(c: Char) = c.toInt() in codeRange[SHEET_HAYEREN_VARW]
private fun isKartvelian(c: Char) = c.toInt() in codeRange[SHEET_KARTULI_VARW]
private fun isIPA(c: Char) = c.toInt() in codeRange[SHEET_IPA_VARW]
private fun isColourCodeHigh(c: Char) = c.toInt() in 0b110110_1111000000..0b110110_1111111111
private fun isColourCodeLow(c: Char) = c.toInt() in 0b110111_0000000000..0b110111_1111111111
@@ -129,8 +165,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
private fun extBindexX(c: Char) = (c.toInt() - 0x180) % 16
private fun extBindexY(c: Char) = (c.toInt() - 0x180) / 16
//private fun runicIndexX(c: Char) = runicList.indexOf(c) % 16
//private fun runicIndexY(c: Char) = runicList.indexOf(c) / 16
private fun runicIndexX(c: Char) = (c.toInt() - 0x16A0) % 16
private fun runicIndexY(c: Char) = (c.toInt() - 0x16A0) / 16
private fun kanaIndexX(c: Char) = (c.toInt() - 0x3040) % 16
private fun kanaIndexY(c: Char) = (c.toInt() - 0x3040) / 16
@@ -168,6 +204,26 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
private fun ipaIndexX(c: Char) = (c.toInt() - 0x250) % 16
private fun ipaIndexY(c: Char) = (c.toInt() - 0x250) / 16
private fun getColour(charHigh: Char, charLow: Char): Color { // input: 0x10ARGB, out: RGBA8888
val codePoint = Character.toCodePoint(charHigh, charLow)
if (colourBuffer.containsKey(codePoint))
return colourBuffer[codePoint]!!
val r = codePoint.and(0xF000).ushr(12)
val g = codePoint.and(0x0F00).ushr(8)
val b = codePoint.and(0x00F0).ushr(4)
val a = codePoint.and(0x000F)
val col = Color(a.shl(28) or a.shl(24) or r.shl(20) or r.shl(16) or g.shl(12) or g.shl(8) or b.shl(4) or b)
colourBuffer[codePoint] = col
return col
}
private val colourBuffer = HashMap<Int, Color>()
private val unihanWidthSheets = arrayOf(
SHEET_UNIHAN,
SHEET_FW_UNI
@@ -202,6 +258,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
"hayeren_variable.tga",
"kartuli_variable.tga",
"ipa_ext_variable.tga",
"futhark.tga",
"puae000-e0ff.tga"
)
private val cyrilic_bg = "cyrilic_bulgarian_variable.tga"
@@ -222,6 +279,7 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
0x530..0x58F,
0x10D0..0x10FF,
0x250..0x2AF,
0x16A0..0x16FF,
0xE000..0xE0FF
)
private val glyphWidths: HashMap<Int, Int> = HashMap() // if the value is negative, it's diacritics
@@ -297,6 +355,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
else if (index == SHEET_CUSTOM_SYM) {
SpriteSheet(image, SIZE_CUSTOM_SYM, SIZE_CUSTOM_SYM) // TODO variable
}
else if (index == SHEET_RUNIC) {
SpriteSheet(image, W_LATIN_WIDE, H)
}
else throw IllegalArgumentException("[TerrarumSansBitmap] Unknown sheet index: $index")
@@ -372,17 +433,37 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
//textBWidth.forEach { print("$it ") }; println()
val mainCol = color
val shadowCol = color.darker(0.5f)
var mainCol = color
var shadowCol = color.darker(0.5f)
textBuffer.forEachIndexed { index, c ->
var index = 0
while (index <= textBuffer.lastIndex) {
val c = textBuffer[index]
val sheetID = getSheetType(c)
val sheetXY = getSheetwisePosition(c)
//println("[TerrarumSansBitmap] sprite: $sheetID:${sheetXY[0]}x${sheetXY[1]}")
if (sheetID == SHEET_HANGUL) {
if (isColourCodeHigh(c)) {
val cchigh = c
val cclow = textBuffer[index + 1]
if (Character.toCodePoint(cchigh, cclow) == 0x100000) {
mainCol = color
shadowCol = color.darker(0.5f)
}
else {
mainCol = getColour(cchigh, cclow)
shadowCol = mainCol.darker(0.5f)
}
index += 1
}
else if (isColourCodeLow(c)) {
throw Error("Unexpected encounter of ColourCodeLow at index $index of String '$textBuffer'")
}
else if (sheetID == SHEET_HANGUL) {
val hangulSheet = sheets[SHEET_HANGUL]
val hIndex = c.toInt() - 0xAC00
@@ -470,6 +551,9 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
catch (noSuchGlyph: ArrayIndexOutOfBoundsException) {
}
}
index += 1
}
}
@@ -493,6 +577,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
len[i] = glyphWidths[chr.toInt()]!!
}
else if (isColourCodeHigh(chr) || isColourCodeLow(chr))
len[i] = 0
else if (ctype == SHEET_CJK_PUNCT)
len[i] = W_ASIAN_PUNCT
else if (ctype == SHEET_HANGUL)
@@ -546,6 +632,8 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
return SHEET_KARTULI_VARW
else if (isIPA(c))
return SHEET_IPA_VARW
else if (isRunic(c))
return SHEET_RUNIC
else
return SHEET_UNKNOWN
// fixed width
@@ -656,69 +744,14 @@ class GameFontBase(fontDir: String, val noShadow: Boolean = false) : Font {
return getWidthOfCharSeq(text).sum()
}
companion object {
internal val JUNG_COUNT = 21
internal val JONG_COUNT = 28
internal val W_ASIAN_PUNCT = 10
internal val W_HANGUL = 12
internal val W_KANA = 12
internal val W_UNIHAN = 16
internal val W_LATIN_WIDE = 9 // width of regular letters
internal val W_VAR_INIT = 15
var interchar = 0
var scale = 1
set(value) {
if (value > 0) field = value
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
}
internal val HGAP_VAR = 1
internal val H = 20
internal val H_UNIHAN = 16
internal val SIZE_CUSTOM_SYM = 18
internal val SHEET_ASCII_VARW = 0
internal val SHEET_HANGUL = 1
internal val SHEET_EXTA_VARW = 2
internal val SHEET_EXTB_VARW = 3
internal val SHEET_KANA = 4
internal val SHEET_CJK_PUNCT = 5
internal val SHEET_UNIHAN = 6
internal val SHEET_CYRILIC_VARW = 7
internal val SHEET_FW_UNI = 8
internal val SHEET_UNI_PUNCT = 9
internal val SHEET_GREEK_VARW = 10
internal val SHEET_THAI_VARW = 11
internal val SHEET_HAYEREN_VARW = 12
internal val SHEET_KARTULI_VARW = 13
internal val SHEET_IPA_VARW = 14
internal val SHEET_CUSTOM_SYM = 15
internal val SHEET_UNKNOWN = 254
/**
* Runic letters list used for game. The set is
* Younger Futhark + Medieval rune 'e' + Punct + Runic Almanac
* BEWARE OF SIMILAR-LOOKING RUNES, especially:
* * Algiz ᛉ instead of Maðr ᛘ
* * Short-Twig Hagall ᚽ instead of Runic Letter E ᛂ
* * Runic Letter OE ᚯ instead of Óss ᚬ
* Examples:
* ᛭ᛋᛁᚴᚱᛁᚦᛦ᛭
* ᛭ᛂᛚᛋᛅ᛭ᛏᚱᚢᛏᚾᛁᚾᚴᚢᚾᛅ᛬ᛅᚱᚾᛅᛏᛅᛚᛋ
*/
//internal val runicList = arrayOf('ᚠ', 'ᚢ', 'ᚦ', 'ᚬ', 'ᚱ', 'ᚴ', 'ᚼ', 'ᚾ', '', 'ᛅ', 'ᛋ', 'ᛏ', 'ᛒ', 'ᛘ', 'ᛚ', 'ᛦ', 'ᛂ', '', '᛫', '', 'ᛮ', 'ᛯ', 'ᛰ')
// TODO expand to full Unicode runes
var interchar = 0
var scale = 1
set(value) {
if (value > 0) field = value
else throw IllegalArgumentException("Font scale cannot be zero or negative (input: $value)")
}
}
}