Add missing font characters for Polish and Romanian translations

* Also explicitly ignore non-breaking space
* Fail string generation if any font characters are missing
This commit is contained in:
Matt Penny 2024-11-20 21:43:01 -05:00
parent 5d482bbcd8
commit bbb6f7b095
10 changed files with 246 additions and 208 deletions

View File

@ -70,7 +70,7 @@ add_executable(portal)
target_link_libraries(portal PRIVATE
platform
asm_sources
asm
code_segment
materials_images
levels

View File

@ -9,16 +9,16 @@ set(ASM_FILES
sound_data.s
)
add_library(asm_sources OBJECT)
target_sources(asm_sources PRIVATE
add_library(asm OBJECT)
target_sources(asm PRIVATE
${ASM_FILES}
)
target_link_libraries(asm_sources
target_link_libraries(asm
platform
)
# CMake doesn't track .incbin file dependencies, so some manual work is needed
add_dependencies(asm_sources
add_dependencies(asm
sound_data_tables
)
get_target_property(SOUND_DATA_TABLE_FILES sound_data_tables OUTPUTS)

View File

@ -358,7 +358,7 @@
},
{
"height": 10,
"id": 379,
"id": 377,
"width": 9,
"x": 29,
"xadvance": 8,
@ -368,7 +368,7 @@
},
{
"height": 10,
"id": 381,
"id": 379,
"width": 9,
"x": 39,
"xadvance": 8,
@ -376,11 +376,21 @@
"y": 25,
"yoffset": 0
},
{
"height": 10,
"id": 381,
"width": 9,
"x": 49,
"xadvance": 8,
"xoffset": 0,
"y": 25,
"yoffset": 0
},
{
"height": 9,
"id": 902,
"width": 9,
"x": 49,
"x": 59,
"xadvance": 8,
"xoffset": 0,
"y": 26,
@ -390,7 +400,7 @@
"height": 9,
"id": 904,
"width": 9,
"x": 59,
"x": 69,
"xadvance": 8,
"xoffset": 0,
"y": 26,
@ -400,7 +410,7 @@
"height": 9,
"id": 911,
"width": 9,
"x": 69,
"x": 79,
"xadvance": 9,
"xoffset": 0,
"y": 26,
@ -410,7 +420,7 @@
"height": 8,
"id": 913,
"width": 9,
"x": 79,
"x": 89,
"xadvance": 8,
"xoffset": 0,
"y": 27,
@ -420,7 +430,7 @@
"height": 8,
"id": 916,
"width": 9,
"x": 89,
"x": 99,
"xadvance": 8,
"xoffset": 0,
"y": 27,
@ -430,7 +440,7 @@
"height": 8,
"id": 918,
"width": 9,
"x": 99,
"x": 109,
"xadvance": 8,
"xoffset": 0,
"y": 27,
@ -440,17 +450,17 @@
"height": 8,
"id": 923,
"width": 9,
"x": 109,
"x": 1,
"xadvance": 8,
"xoffset": 0,
"y": 27,
"y": 39,
"yoffset": 2
},
{
"height": 8,
"id": 924,
"width": 9,
"x": 1,
"x": 11,
"xadvance": 9,
"xoffset": 1,
"y": 39,
@ -460,7 +470,7 @@
"height": 8,
"id": 932,
"width": 9,
"x": 11,
"x": 21,
"xadvance": 7,
"xoffset": -1,
"y": 39,
@ -470,7 +480,7 @@
"height": 8,
"id": 933,
"width": 9,
"x": 21,
"x": 31,
"xadvance": 7,
"xoffset": -1,
"y": 39,
@ -480,7 +490,7 @@
"height": 8,
"id": 935,
"width": 9,
"x": 31,
"x": 41,
"xadvance": 8,
"xoffset": 0,
"y": 39,
@ -490,7 +500,7 @@
"height": 8,
"id": 937,
"width": 9,
"x": 41,
"x": 51,
"xadvance": 8,
"xoffset": 0,
"y": 39,
@ -500,7 +510,7 @@
"height": 11,
"id": 213,
"width": 10,
"x": 51,
"x": 61,
"xadvance": 9,
"xoffset": 0,
"y": 36,
@ -510,7 +520,7 @@
"height": 10,
"id": 336,
"width": 10,
"x": 62,
"x": 72,
"xadvance": 9,
"xoffset": 0,
"y": 37,
@ -520,7 +530,7 @@
"height": 9,
"id": 905,
"width": 10,
"x": 73,
"x": 83,
"xadvance": 10,
"xoffset": 0,
"y": 38,
@ -530,7 +540,7 @@
"height": 9,
"id": 908,
"width": 10,
"x": 84,
"x": 94,
"xadvance": 9,
"xoffset": 0,
"y": 38,
@ -540,7 +550,7 @@
"height": 8,
"id": 920,
"width": 10,
"x": 95,
"x": 105,
"xadvance": 9,
"xoffset": 0,
"y": 39,
@ -550,7 +560,7 @@
"height": 8,
"id": 927,
"width": 10,
"x": 106,
"x": 116,
"xadvance": 9,
"xoffset": 0,
"y": 39,
@ -636,11 +646,21 @@
"y": 51,
"yoffset": 4
},
{
"height": 11,
"id": 536,
"width": 8,
"x": 69,
"xadvance": 7,
"xoffset": 0,
"y": 49,
"yoffset": 2
},
{
"height": 11,
"id": 538,
"width": 9,
"x": 69,
"x": 78,
"xadvance": 7,
"xoffset": -1,
"y": 49,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
Below are the characters used in each of the font pages
Note that the space charcter is intentionally left in the first group
Note that the space character is intentionally left in the first group
!'()*,-./0123456789:;?ABCDEFGHIJKLMNOPQRSTUVWXYZ[]abcdefghijklmnopqrstuvwxyz¡«°»¿
ÀÁÂÃÄÅÆÇĆÈÉÊÍÎÑÓÔÖØÚÜÝßàáâãäåæçèéêëìíîïñòóôõöøùúûüýĂ㥹ćČčďĘęĚěĞğİıŁł
ŃńŇňŐÕőŘřŚśŞşŠšŢȚţťŮůűźŻżŽžșțΆΈΉΊΌΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΩάέήίΰ
ŃńŇňŐÕőŘřŚśŞşŠšŢȚţťŮůűŹźŻżŽžȘșțΆΈΉΊΌΏΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΩάέήίΰ
αβγδεζηθικλμνξοπρςστυφχψωϋόύώЄІЇАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩ
ЪЫЬЭЮЯΨабвгдежзийклмнопрстуфхцчшщъыьэюяёєіїҐ–—’“”„…

View File

@ -1,5 +1,5 @@
Below are the characters used in each of the font pages
Note that the space charcter is intentionally left in the first group
Note that the space character is intentionally left in the first group
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

View File

@ -263,7 +263,6 @@ function(_add_texture_transform_command TEXTURE_SCRIPT OUTPUT_LIST)
${TEXTURE_SCRIPT}
${OUTPUT_FILE}
WORKING_DIRECTORY
# TODO: Change this to PAK_MODIFIED_MATERIALS_DIR and update .ims files with relative path
${PROJECT_SOURCE_DIR}
COMMENT
"Transforming $<PATH:RELATIVE_PATH,${INPUT_FILE},${PROJECT_SOURCE_DIR}>"

View File

@ -4,7 +4,7 @@
// Usage:
// 1. Use fontbuilder to generate multiple font files
// - Settings used by game fonts: layout=optimized box, padding=1px right
// - Each image must be smaller than 4 KB
// - Each image must fit in tmem (e.g., up to 128x64 when using 4 bits per texel)
// - Name each JSON file <font>_0.json, <font>_1.json, ..., <font>_N.json
// - Name the font directory the same as the font
//

View File

@ -106,8 +106,6 @@ STRINGS_PORTAL = {
"VALVE_SECONDARY_ATTACK",
}
# TODO: whitelist captions
# Validation
def check_font(language_strings, font_data):
@ -122,13 +120,13 @@ def check_font(language_strings, font_data):
)
unused_chars = supported_chars - used_chars
# TODO: add missing characters to font and make this an error
print(f"Used characters ({len(used_chars)})\n{''.join(sorted(used_chars))}\n")
print(f"Unused characters ({len(unused_chars)})\n{''.join(sorted(unused_chars))}\n")
invalid_chars = used_chars - supported_chars
if len(invalid_chars) > 0:
print(f"Invalid characters ({len(invalid_chars)})\n{''.join(sorted(invalid_chars))}\n")
print(f"Used characters ({len(used_chars)})\n{''.join(sorted(used_chars))}\n")
print(f"Unused characters ({len(unused_chars)})\n{''.join(sorted(unused_chars))}\n")
raise RuntimeError("Font is missing required characters")
# Code generation
@ -281,6 +279,7 @@ def parse_strings_file(filepath, whitelist={}, encoding="utf-16-le"):
.replace('"', "") \
.replace("\n", "") \
.replace("\\n", " ") \
.replace("\xA0", "") \
.replace("\\", "") \
.strip()
value = re.sub(r"\<clr.+\>", "", value)