更新脚本
This commit is contained in:
@@ -11,7 +11,7 @@ Usage:
|
||||
python font2bin.py <font_module> <output_binary>
|
||||
|
||||
Example:
|
||||
python font2bin.py proverbs_font font_data.bin
|
||||
python font2bin.py proverbs_font font_data.font
|
||||
"""
|
||||
|
||||
import importlib.util
|
||||
@@ -87,7 +87,13 @@ def write_binary_file(font_data, output_path):
|
||||
|
||||
def create_info_file(font_data, output_path):
|
||||
"""Create a text file with font information"""
|
||||
info_path = output_path.replace(".bin", ".info")
|
||||
# Extract the base filename without extension
|
||||
base_name = os.path.splitext(os.path.basename(output_path))[0]
|
||||
# Get the py directory path (assuming output_path is in bin directory)
|
||||
bin_dir = os.path.dirname(output_path)
|
||||
py_dir = os.path.join(os.path.dirname(bin_dir), "py")
|
||||
info_path = os.path.join(py_dir, base_name + ".info")
|
||||
|
||||
try:
|
||||
with open(info_path, "w") as f:
|
||||
f.write(f"Font Information\n")
|
||||
@@ -114,7 +120,7 @@ def create_info_file(font_data, output_path):
|
||||
def main():
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: python font2bin.py <font_module> <output_binary>")
|
||||
print("Example: python font2bin.py proverbs_font font_data.bin")
|
||||
print("Example: python font2bin.py proverbs_font font_data.font")
|
||||
return 1
|
||||
|
||||
font_module_path = sys.argv[1]
|
||||
|
||||
Reference in New Issue
Block a user