removing height hacks by making all fonts (except unihan) have same height, taller hangul

This commit is contained in:
Song Minjae
2017-03-24 14:55:56 +09:00
parent ddf2e28901
commit 8033d749c2
10 changed files with 163 additions and 165 deletions

View File

@@ -54,20 +54,20 @@ open class GameFontBase : Font {
9 9
} }
private fun isHangul(c: Char) = c.toInt() >= 0xAC00 && c.toInt() < 0xD7A4 private fun isHangul(c: Char) = c.toInt() in 0xAC00..0xD7A3
private fun isAscii(c: Char) = c.toInt() >= 0x20 && c.toInt() <= 0xFF private fun isAscii(c: Char) = c.toInt() in 0x20..0xFF
private fun isRunic(c: Char) = runicList.contains(c) private fun isRunic(c: Char) = runicList.contains(c)
private fun isExtA(c: Char) = c.toInt() >= 0x100 && c.toInt() < 0x180 private fun isExtA(c: Char) = c.toInt() in 0x100..0x17F
private fun isExtB(c: Char) = c.toInt() >= 0x180 && c.toInt() < 0x250 private fun isExtB(c: Char) = c.toInt() in 0x180..0x24F
private fun isKana(c: Char) = c.toInt() >= 0x3040 && c.toInt() < 0x3100 private fun isKana(c: Char) = c.toInt() in 0x3040..0x30FF
private fun isCJKPunct(c: Char) = c.toInt() >= 0x3000 && c.toInt() < 0x3040 private fun isCJKPunct(c: Char) = c.toInt() in 0x3000..0x303F
private fun isUniHan(c: Char) = c.toInt() >= 0x3400 && c.toInt() < 0xA000 private fun isUniHan(c: Char) = c.toInt() in 0x3400..0x9FFF
private fun isCyrilic(c: Char) = c.toInt() >= 0x400 && c.toInt() < 0x460 private fun isCyrilic(c: Char) = c.toInt() in 0x400..0x45F
private fun isFullwidthUni(c: Char) = c.toInt() >= 0xFF00 && c.toInt() < 0xFF20 private fun isFullwidthUni(c: Char) = c.toInt() in 0xFF00..0xFF1F
private fun isUniPunct(c: Char) = c.toInt() >= 0x2000 && c.toInt() < 0x2070 private fun isUniPunct(c: Char) = c.toInt() in 0x2000..0x206F
private fun isWenQuanYi1(c: Char) = c.toInt() >= 0x33F3 && c.toInt() <= 0x69FC private fun isWenQuanYi1(c: Char) = c.toInt() in 0x33F3..0x69FC
private fun isWenQuanYi2(c: Char) = c.toInt() >= 0x69FD && c.toInt() <= 0x9FDC private fun isWenQuanYi2(c: Char) = c.toInt() in 0x69FD..0x9FDC
private fun isGreek(c: Char) = c.toInt() >= 0x370 && c.toInt() <= 0x3CE private fun isGreek(c: Char) = c.toInt() in 0x370..0x3CE
@@ -199,17 +199,17 @@ open class GameFontBase : Font {
hangulSheet.getSubImage(indexCho, choRow).drawWithShadow( hangulSheet.getSubImage(indexCho, choRow).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), Math.round(y).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow( hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), Math.round(y).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow( hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), Math.round(y).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
} }
@@ -345,12 +345,7 @@ open class GameFontBase : Font {
try { try {
sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow( sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(y).toFloat(),
// to deal with the height difference of the sheets
Math.round(y).toFloat() + (if (prevInstance == SHEET_CJK_PUNCT) -1 // height hack
else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2 // completely legit height adjustment
else 0).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
} }
@@ -512,9 +507,7 @@ open class GameFontBase : Font {
internal val W_LATIN_WIDE = 9 // width of regular letters internal val W_LATIN_WIDE = 9 // width of regular letters
internal val H = 20 internal val H = 20
internal val H_HANGUL = 16
internal val H_UNIHAN = 16 internal val H_UNIHAN = 16
internal val H_KANA = 20
internal val SHEET_ASCII_VARW = 0 internal val SHEET_ASCII_VARW = 0
internal val SHEET_HANGUL = 1 internal val SHEET_HANGUL = 1

View File

@@ -11,7 +11,7 @@ class GameFontImpl : GameFontBase() {
init { init {
GameFontBase.hangulSheet = SpriteSheet( GameFontBase.hangulSheet = SpriteSheet(
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H_HANGUL) "./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H)
GameFontBase.asciiSheet = SpriteSheet( GameFontBase.asciiSheet = SpriteSheet(
"./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1) "./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1)
GameFontBase.extASheet = SpriteSheet( GameFontBase.extASheet = SpriteSheet(
@@ -19,9 +19,9 @@ class GameFontImpl : GameFontBase() {
GameFontBase.extBSheet = SpriteSheet( GameFontBase.extBSheet = SpriteSheet(
"./assets/graphics/fonts/LatinExtB_variable.tga", 15, 19, 1) "./assets/graphics/fonts/LatinExtB_variable.tga", 15, 19, 1)
GameFontBase.kanaSheet = SpriteSheet( GameFontBase.kanaSheet = SpriteSheet(
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H_KANA) "./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H)
GameFontBase.cjkPunct = SpriteSheet( GameFontBase.cjkPunct = SpriteSheet(
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H_KANA) "./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H)
/*uniHan = new SpriteSheet( /*uniHan = new SpriteSheet(
"./assets/graphics/fonts/unifont_unihan" "./assets/graphics/fonts/unifont_unihan"
+ ((!terrarum.gameLocale.contains("zh")) + ((!terrarum.gameLocale.contains("zh"))

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 192 KiB

After

Width:  |  Height:  |  Size: 241 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

118
demo/.idea/workspace.xml generated
View File

@@ -27,7 +27,7 @@
<file leaf-file-name="GameFontDemo.kt" pinned="false" current-in-tab="false"> <file leaf-file-name="GameFontDemo.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt"> <entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="610"> <state relative-caret-position="924">
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" /> <caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
<folding> <folding>
<element signature="e#40#238#0" expanded="true" /> <element signature="e#40#238#0" expanded="true" />
@@ -36,11 +36,11 @@
</provider> </provider>
</entry> </entry>
</file> </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/terrarum/imagefont/GameFontBase.kt"> <entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="202"> <state relative-caret-position="409">
<caret line="493" column="0" lean-forward="false" selection-start-line="493" selection-start-column="0" selection-end-line="493" selection-end-column="0" /> <caret line="204" column="48" lean-forward="false" selection-start-line="204" selection-start-column="48" selection-end-line="204" selection-end-column="48" />
<folding> <folding>
<element signature="e#31#171#0" expanded="true" /> <element signature="e#31#171#0" expanded="true" />
</folding> </folding>
@@ -48,11 +48,11 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="GameFontImpl.kt" pinned="false" current-in-tab="true"> <file leaf-file-name="GameFontImpl.kt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt"> <entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="356"> <state relative-caret-position="518">
<caret line="48" column="26" lean-forward="false" selection-start-line="48" selection-start-column="26" selection-end-line="48" selection-end-column="26" /> <caret line="37" column="41" lean-forward="false" selection-start-line="37" selection-start-column="41" selection-end-line="37" selection-end-column="41" />
<folding> <folding>
<element signature="e#31#108#0" expanded="true" /> <element signature="e#31#108#0" expanded="true" />
</folding> </folding>
@@ -60,6 +60,16 @@
</provider> </provider>
</entry> </entry>
</file> </file>
<file leaf-file-name="text.txt" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/text.txt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="252">
<caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf> </leaf>
</component> </component>
<component name="FileTemplateManagerImpl"> <component name="FileTemplateManagerImpl">
@@ -96,17 +106,17 @@
<option value="$PROJECT_DIR$/config.properties" /> <option value="$PROJECT_DIR$/config.properties" />
<option value="$PROJECT_DIR$/META-INF/MANIFEST.MF" /> <option value="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt" /> <option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt" />
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt" />
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt" /> <option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt" />
<option value="$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt" />
<option value="$PROJECT_DIR$/text.txt" /> <option value="$PROJECT_DIR$/text.txt" />
</list> </list>
</option> </option>
</component> </component>
<component name="ProjectFrameBounds"> <component name="ProjectFrameBounds">
<option name="x" value="-1688" /> <option name="x" value="-8" />
<option name="y" value="-8" /> <option name="y" value="-8" />
<option name="width" value="1696" /> <option name="width" value="1936" />
<option name="height" value="1026" /> <option name="height" value="1176" />
</component> </component>
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1"> <navigator currentView="ProjectPane" proportions="" version="1">
@@ -123,6 +133,9 @@
<foldersAlwaysOnTop value="true" /> <foldersAlwaysOnTop value="true" />
</navigator> </navigator>
<panes> <panes>
<pane id="Scope" />
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="ProjectPane"> <pane id="ProjectPane">
<subPane> <subPane>
<PATH> <PATH>
@@ -169,9 +182,6 @@
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="PackagesPane" />
<pane id="Scope" />
<pane id="Scratches" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
@@ -182,6 +192,18 @@
<property name="project.structure.proportion" value="0.15" /> <property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.32068965" /> <property name="project.structure.side.proportion" value="0.32068965" />
</component> </component>
<component name="RunDashboard">
<option name="ruleStates">
<list>
<RuleState>
<option name="name" value="ConfigurationTypeDashboardGroupingRule" />
</RuleState>
<RuleState>
<option name="name" value="StatusDashboardGroupingRule" />
</RuleState>
</list>
</option>
</component>
<component name="RunManager" selected="Kotlin.net.torvald.terrarum.imagefont.GameFontDemoKt"> <component name="RunManager" selected="Kotlin.net.torvald.terrarum.imagefont.GameFontDemoKt">
<configuration default="false" name="net.torvald.terrarum.imagefont.GameFontDemoKt" type="JetRunConfigurationType" factoryName="Kotlin" temporary="true" nameIsGenerated="true"> <configuration default="false" name="net.torvald.terrarum.imagefont.GameFontDemoKt" type="JetRunConfigurationType" factoryName="Kotlin" temporary="true" nameIsGenerated="true">
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" /> <extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
@@ -384,7 +406,7 @@
<servers /> <servers />
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-1688" y="-8" width="1696" height="1026" extended-state="6" /> <frame x="-8" y="-8" width="1936" height="1176" extended-state="6" />
<editor active="true" /> <editor active="true" />
<layout> <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="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" />
@@ -397,13 +419,13 @@
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3292683" sideWeight="0.5" order="1" 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.3292683" 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="9" 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="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="true" show_stripe_button="true" weight="0.20833333" 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.21100427" sideWeight="0.5" order="0" 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="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="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="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="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="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="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="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="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25896862" 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.2581574" sideWeight="0.5" order="2" side_tool="false" 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="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" /> <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="7" 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="7" side_tool="false" content_ui="tabs" />
@@ -429,6 +451,36 @@
<option name="FILTER_TARGETS" value="false" /> <option name="FILTER_TARGETS" value="false" />
</component> </component>
<component name="editorHistoryManager"> <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="924">
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
<folding>
<element signature="e#40#238#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="6846">
<caret line="493" column="0" lean-forward="false" selection-start-line="493" selection-start-column="0" selection-end-line="493" selection-end-column="0" />
<folding>
<element signature="e#31#171#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="658">
<caret line="48" column="26" lean-forward="false" selection-start-line="48" selection-start-column="26" selection-end-line="48" selection-end-column="26" />
<folding>
<element signature="e#31#108#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt"> <entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
@@ -453,7 +505,6 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" /> <caret line="0" column="10" lean-forward="true" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
@@ -491,7 +542,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt"> <entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontDemo.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="610"> <state relative-caret-position="924">
<caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" /> <caret line="72" column="55" lean-forward="false" selection-start-line="72" selection-start-column="55" selection-end-line="72" selection-end-column="55" />
<folding> <folding>
<element signature="e#40#238#0" expanded="true" /> <element signature="e#40#238#0" expanded="true" />
@@ -503,38 +554,45 @@
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="0">
<caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" /> <caret line="0" column="10" lean-forward="false" selection-start-line="0" selection-start-column="10" selection-end-line="0" selection-end-column="10" />
<folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontBase.kt"> <entry file="jar://$KOTLIN_BUNDLED$/lib/kotlin-runtime-sources.jar!/kotlin/Primitives.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="202"> <state relative-caret-position="338">
<caret line="493" column="0" lean-forward="false" selection-start-line="493" selection-start-column="0" selection-end-line="493" selection-end-column="0" /> <caret line="491" column="24" lean-forward="false" selection-start-line="491" selection-start-column="24" selection-end-line="491" selection-end-column="24" />
<folding> <folding />
<element signature="e#31#171#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/text.txt"> <entry file="file://$PROJECT_DIR$/text.txt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="84"> <state relative-caret-position="252">
<caret line="6" column="0" lean-forward="true" selection-start-line="6" selection-start-column="0" selection-end-line="6" selection-end-column="0" /> <caret line="18" column="0" lean-forward="true" selection-start-line="18" selection-start-column="0" selection-end-line="18" selection-end-column="0" />
<folding /> <folding />
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt"> <entry file="file://$PROJECT_DIR$/src/net/torvald/terrarum/imagefont/GameFontImpl.kt">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="356"> <state relative-caret-position="518">
<caret line="48" column="26" lean-forward="false" selection-start-line="48" selection-start-column="26" selection-end-line="48" selection-end-column="26" /> <caret line="37" column="41" lean-forward="false" selection-start-line="37" selection-start-column="41" selection-end-line="37" selection-end-column="41" />
<folding> <folding>
<element signature="e#31#108#0" expanded="true" /> <element signature="e#31#108#0" expanded="true" />
</folding> </folding>
</state> </state>
</provider> </provider>
</entry> </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="409">
<caret line="204" column="48" lean-forward="false" selection-start-line="204" selection-start-column="48" selection-end-line="204" selection-end-column="48" />
<folding>
<element signature="e#31#171#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</component> </component>
<component name="masterDetails"> <component name="masterDetails">
<states> <states>

View File

@@ -6,67 +6,20 @@
<option name="compilerInfo"> <option name="compilerInfo">
<KotlinCompilerInfo> <KotlinCompilerInfo>
<option name="compilerSettings"> <option name="compilerSettings">
<CompilerSettings> <CompilerSettings />
<option name="additionalArguments" value="-version" />
<option name="copyJsLibraryFiles" value="true" />
<option name="outputDirectoryForJsLibraryFiles" value="lib" />
</CompilerSettings>
</option> </option>
<option name="k2jsCompilerArguments"> <option name="k2jsCompilerArguments">
<K2JSCompilerArguments> <K2JSCompilerArguments />
<option name="outputFile" /> </option>
<option name="noStdlib" value="false" /> <option name="k2jvmCompilerArguments">
<option name="libraryFiles" /> <K2JVMCompilerArguments />
<option name="sourceMap" value="false" />
<option name="metaInfo" value="false" />
<option name="kjsm" value="false" />
<option name="target" />
<option name="moduleKind" />
<option name="main" />
<option name="outputPrefix" />
<option name="outputPostfix" />
<option name="languageVersion" />
<option name="apiVersion" />
<option name="suppressWarnings" value="false" />
<option name="verbose" value="false" />
<option name="version" value="false" />
<option name="help" value="false" />
<option name="extraHelp" value="false" />
<option name="noInline" value="false" />
<option name="repeat" />
<option name="pluginClasspaths" />
<option name="pluginOptions" />
<option name="freeArgs">
<list />
</option>
<option name="unknownExtraFlags">
<list />
</option>
</K2JSCompilerArguments>
</option> </option>
<option name="_commonCompilerArguments"> <option name="_commonCompilerArguments">
<DummyImpl> <DummyImpl />
<option name="languageVersion" />
<option name="apiVersion" />
<option name="suppressWarnings" value="false" />
<option name="verbose" value="false" />
<option name="version" value="false" />
<option name="help" value="false" />
<option name="extraHelp" value="false" />
<option name="noInline" value="false" />
<option name="repeat" />
<option name="pluginClasspaths" />
<option name="pluginOptions" />
<option name="freeArgs">
<list />
</option>
<option name="unknownExtraFlags">
<list />
</option>
</DummyImpl>
</option> </option>
</KotlinCompilerInfo> </KotlinCompilerInfo>
</option> </option>
<option name="useProjectSettings" value="false" />
<option name="versionInfo"> <option name="versionInfo">
<KotlinVersionInfo> <KotlinVersionInfo>
<option name="apiLevel" value="1.0" /> <option name="apiLevel" value="1.0" />

View File

@@ -54,20 +54,20 @@ open class GameFontBase : Font {
9 9
} }
private fun isHangul(c: Char) = c.toInt() >= 0xAC00 && c.toInt() < 0xD7A4 private fun isHangul(c: Char) = c.toInt() in 0xAC00..0xD7A3
private fun isAscii(c: Char) = c.toInt() >= 0x20 && c.toInt() <= 0xFF private fun isAscii(c: Char) = c.toInt() in 0x20..0xFF
private fun isRunic(c: Char) = runicList.contains(c) private fun isRunic(c: Char) = runicList.contains(c)
private fun isExtA(c: Char) = c.toInt() >= 0x100 && c.toInt() < 0x180 private fun isExtA(c: Char) = c.toInt() in 0x100..0x17F
private fun isExtB(c: Char) = c.toInt() >= 0x180 && c.toInt() < 0x250 private fun isExtB(c: Char) = c.toInt() in 0x180..0x24F
private fun isKana(c: Char) = c.toInt() >= 0x3040 && c.toInt() < 0x3100 private fun isKana(c: Char) = c.toInt() in 0x3040..0x30FF
private fun isCJKPunct(c: Char) = c.toInt() >= 0x3000 && c.toInt() < 0x3040 private fun isCJKPunct(c: Char) = c.toInt() in 0x3000..0x303F
private fun isUniHan(c: Char) = c.toInt() >= 0x3400 && c.toInt() < 0xA000 private fun isUniHan(c: Char) = c.toInt() in 0x3400..0x9FFF
private fun isCyrilic(c: Char) = c.toInt() >= 0x400 && c.toInt() < 0x460 private fun isCyrilic(c: Char) = c.toInt() in 0x400..0x45F
private fun isFullwidthUni(c: Char) = c.toInt() >= 0xFF00 && c.toInt() < 0xFF20 private fun isFullwidthUni(c: Char) = c.toInt() in 0xFF00..0xFF1F
private fun isUniPunct(c: Char) = c.toInt() >= 0x2000 && c.toInt() < 0x2070 private fun isUniPunct(c: Char) = c.toInt() in 0x2000..0x206F
private fun isWenQuanYi1(c: Char) = c.toInt() >= 0x33F3 && c.toInt() <= 0x69FC private fun isWenQuanYi1(c: Char) = c.toInt() in 0x33F3..0x69FC
private fun isWenQuanYi2(c: Char) = c.toInt() >= 0x69FD && c.toInt() <= 0x9FDC private fun isWenQuanYi2(c: Char) = c.toInt() in 0x69FD..0x9FDC
private fun isGreek(c: Char) = c.toInt() >= 0x370 && c.toInt() <= 0x3CE private fun isGreek(c: Char) = c.toInt() in 0x370..0x3CE
@@ -199,17 +199,17 @@ open class GameFontBase : Font {
hangulSheet.getSubImage(indexCho, choRow).drawWithShadow( hangulSheet.getSubImage(indexCho, choRow).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), Math.round(y).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow( hangulSheet.getSubImage(indexJung, jungRow).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), Math.round(y).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow( hangulSheet.getSubImage(indexJong, jongRow).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(((H - H_HANGUL) / 2).toFloat() + y + 1f).toFloat(), Math.round(y).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
} }
@@ -345,12 +345,7 @@ open class GameFontBase : Font {
try { try {
sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow( sheetKey[prevInstance]!!.getSubImage(sheetX, sheetY).drawWithShadow(
Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(), Math.round(x + getWidthSubstr(s, i + 1) - glyphW).toFloat(),
Math.round(y).toFloat(),
// to deal with the height difference of the sheets
Math.round(y).toFloat() + (if (prevInstance == SHEET_CJK_PUNCT) -1 // height hack
else if (prevInstance == SHEET_FW_UNI) (H - H_HANGUL) / 2 // completely legit height adjustment
else 0).toFloat(),
scale.toFloat(), thisCol scale.toFloat(), thisCol
) )
} }
@@ -512,9 +507,7 @@ open class GameFontBase : Font {
internal val W_LATIN_WIDE = 9 // width of regular letters internal val W_LATIN_WIDE = 9 // width of regular letters
internal val H = 20 internal val H = 20
internal val H_HANGUL = 16
internal val H_UNIHAN = 16 internal val H_UNIHAN = 16
internal val H_KANA = 20
internal val SHEET_ASCII_VARW = 0 internal val SHEET_ASCII_VARW = 0
internal val SHEET_HANGUL = 1 internal val SHEET_HANGUL = 1

View File

@@ -11,7 +11,7 @@ class GameFontImpl : GameFontBase() {
init { init {
GameFontBase.hangulSheet = SpriteSheet( GameFontBase.hangulSheet = SpriteSheet(
"./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H_HANGUL) "./assets/graphics/fonts/hangul_johab.tga", GameFontBase.W_HANGUL, GameFontBase.H)
GameFontBase.asciiSheet = SpriteSheet( GameFontBase.asciiSheet = SpriteSheet(
"./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1) "./assets/graphics/fonts/ascii_variable.tga", 15, 19, 1)
GameFontBase.extASheet = SpriteSheet( GameFontBase.extASheet = SpriteSheet(
@@ -19,9 +19,9 @@ class GameFontImpl : GameFontBase() {
GameFontBase.extBSheet = SpriteSheet( GameFontBase.extBSheet = SpriteSheet(
"./assets/graphics/fonts/LatinExtB_variable.tga", 15, 19, 1) "./assets/graphics/fonts/LatinExtB_variable.tga", 15, 19, 1)
GameFontBase.kanaSheet = SpriteSheet( GameFontBase.kanaSheet = SpriteSheet(
"./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H_KANA) "./assets/graphics/fonts/kana.tga", GameFontBase.W_KANA, GameFontBase.H)
GameFontBase.cjkPunct = SpriteSheet( GameFontBase.cjkPunct = SpriteSheet(
"./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H_KANA) "./assets/graphics/fonts/cjkpunct.tga", GameFontBase.W_ASIAN_PUNCT, GameFontBase.H)
/*uniHan = new SpriteSheet( /*uniHan = new SpriteSheet(
"./assets/graphics/fonts/unifont_unihan" "./assets/graphics/fonts/unifont_unihan"
+ ((!terrarum.gameLocale.contains("zh")) + ((!terrarum.gameLocale.contains("zh"))

View File

@@ -1,37 +1,38 @@
Set locale in config.properties to “bgBG” for alternative Bulgarian letters, “srSR” for Serbian. Set locale in config.properties to “bgBG” for alternative Bulgarian letters, “srSR” for Serbian.
ABCDEFGHIJKLM NOPQRSTUVWXYZ ABCDEFGHIJKLM NOPQRSTUVWXYZ 12345?
abcdefghijklm nopqrstuvwxyz abcdefghijklm nopqrstuvwxyz 67890!
Syö salmiakkia, koska se on hyvää sinulle The bitmap font for game developers who seek good font that has real multilingual support,
for free (as in freedom AND without cost).
The Olympic marmot (Marmota olympus) is a rodent in the squirrel family, Sciuridae. There are many bitmap fonts on the internet. You care for the multilingual support, but alas!
It lives only in the U.S. state of Washington, at middle elevations on the Olympic Peninsula. most of them does not support your language, vector fonts takes too much time to be loaded,
About the size of a domestic cat, an adult weighs around 8 kg (18 lb) in summer. even then their legibility suffers because fuck built-in antialias.
You somehow found a good font, and it makes your game look like a linux terminal, and you say:
“what the fuck? Is this a game or should I rm -rf this shit‽”
You speak Japanese, and you wish to support it, but then このクソなfontは only good for Japanese,
and it is not multilingual, and you don't have a time for this shenanigan.
Eventually you give up, saying “fuck it!” and just use the fonts that do not match well.
Brná je část statutárního a krajského města Ústí nad Labem v České republice, spadající No more suffering. This font has everything you need.
pod městský obvod Ústí nad Labem-Střekov. Nachází se asi pět kilometrů jižně od centra
města v Českém středohoří na pravém břehu řeky Labe.
Malaysia er en forholdsvis ung stat. Sin endelige udstrækning fik den først i 1965 efter while (isVisible(BadFonts)) { ripAndTear(BadFonts).scope(Guts); }
at Singapore trak sig ud. Staten blev grundlagt ved en sammenslutning af flere tidligere How multilingual? Real multilingual!
britiske besiddelser, foreløbigt i 1957 og endeligt i 1963.
Το θάλλιο συνοδεύει κυρίως θειούχα ορυκτά βασικών μετάλλων, όπως ο σφαλερίτης, ο σιδηροπυρίτης Příliš žluťoučký kůň úpěl ďábelské ódy
και ο γαληνίτης ενώ αναφέρονται και εμφανίσεις του σε κονδύλους μαγγανίου στους βυθούς των ωκεανών. Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich
διαφυλάξτε γενικά τη ζωή σας από βαθειά ψυχικά τραύματα διαφυλάξτε γενικά τη ζωή σας από βαθειά ψυχικά τραύματα
ΔΙΑΦΥΛΆΞΤΕ ΓΕΝΙΚΆ ΤΗ ΖΩΉ ΣΑΣ ΑΠΌ ΒΑΘΕΙΆ ΨΥΧΙΚΆ ΤΡΑΎΜΑΤΑ ΔΙΑΦΥΛΆΞΤΕ ΓΕΝΙΚΆ ΤΗ ΖΩΉ ΣΑΣ ΑΠΌ ΒΑΘΕΙΆ ΨΥΧΙΚΆ ΤΡΑΎΜΑΤΑ
Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства. Pack my box with five dozen liquor jugs
Příliš žluťoučký kůň úpěl ďábelské ódy. Árvíztűrő tükörfúrógép. Voix ambiguë d'un cœur qui au zéphyr préfère les jattes de kiwi
Victor jagt zwölf Boxkämpfer quer über den großen Sylter Deich. 정 참판 양반댁 규수 큰 교자 타고 혼례 치른 날 뚫훍뚫훍뚫(읗) 뚫훍뚫훍뚫(읗) 뚫훍뚫훍뚫 따다다
Pijamalı hasta yağız şoföre çabucak güvendi. Kŕdeľ ďatľov učí koňa žrať kôru. Kæmi ný öxi hér, ykist þjófum nú bæði víl og ádrepa
Voix ambiguë d'un cœur qui au zéphyr préfère les jattes de kiwi. Árvíztűrő tükörfúrógép Kŕdeľ ďatľov učí koňa žrať kôru
Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila.
sjaldgæft ekki stjórnarskrárvarin
Also supports:
Unicode „quotation marks“—dashes…‼
으웽~. 얘! 위에 이 애 우유의 양 외워와! 아오~ 왜요? 어여! 예... 웬 초콜릿? 제가 원했던 건 뻥튀기 쬐끔과 의류예요. 얘야, 왜 또 불평? 퀡퇣풿횂
とりなくこゑす ゆめさませ みよあけわたる ひんかしを そらいろはえて おきつへに ほふねむれゐぬ もやのうち とりなくこゑす ゆめさませ みよあけわたる ひんかしを そらいろはえて おきつへに ほふねむれゐぬ もやのうち
鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中, 鳥啼く声す 夢覚ませ 見よ明け渡る 東を 空色栄えて 沖つ辺に 帆船群れゐぬ 靄の中
Înjurând pițigăiat, zoofobul comandă vexat whisky și tequila
Широкая электрификация южных губерний даст мощный толчок подъёму сельского хозяйства
Pijamalı hasta yağız şoföre çabucak güvendi
Also supports: Unicode „quotation marks“—dashes…「括弧」‼
ASCII Latin-1 Latin_Ext-A Latin_Ext-B Greek Cyrillic CJK-Ideo Kana Hangul_Syllables