Fix bug
This commit is contained in:
@@ -89,14 +89,14 @@ def generate_chinese_array(input_str, font_str, size):
|
||||
|
||||
def format_chinese_array_as_text(chinese_array, size):
|
||||
text_output = "#pragma once\n\n"
|
||||
text_output += "#ifndef HW_LIB_OLED_FONT_CHUC_H\n"
|
||||
text_output += "#define HW_LIB_OLED_FONT_CHUC_H\n\n"
|
||||
text_output += "#ifndef HW_LIB_FONT_CHUC_H\n"
|
||||
text_output += "#define HW_LIB_FONT_CHUC_H\n\n"
|
||||
text_output += f"typedef struct {{\n"
|
||||
text_output += " uint8_t unicode[2];\n"
|
||||
text_output += f" uint8_t data[{size[0] * ((size[1] + 7) // 8 * 8) // 8}];\n"
|
||||
text_output += "} Chinese_t;\n\n"
|
||||
text_output += f"uint8_t Hzk_size={size[0]};\n\n"
|
||||
text_output += "Chinese_t Hzk[] = {\n"
|
||||
text_output += f"static uint8_t Hzk_size={size[0]};\n\n"
|
||||
text_output += "static Chinese_t Hzk[] = {\n"
|
||||
line_size = size[0] * size[1] // 8
|
||||
line_size = line_size // 2
|
||||
# line_size = 16 if line_size >= 16 else 8
|
||||
@@ -111,7 +111,7 @@ def format_chinese_array_as_text(chinese_array, size):
|
||||
text_output += '\n '.join(bytes_lines)
|
||||
text_output += ",\n }\n },\n"
|
||||
text_output += "};\n\n"
|
||||
text_output += "Chinese_t* find_chinese_data(uint8_t unicode_high, uint8_t unicode_low) {\n"
|
||||
text_output += "static Chinese_t* find_chinese_data(uint8_t unicode_high, uint8_t unicode_low) {\n"
|
||||
text_output += " for (int i = 0; i < sizeof(Hzk) / sizeof(Chinese_t); ++i) {\n"
|
||||
text_output += " if (Hzk[i].unicode[0] == unicode_high && Hzk[i].unicode[1] == unicode_low) {\n"
|
||||
text_output += " return &Hzk[i];\n"
|
||||
@@ -119,7 +119,7 @@ def format_chinese_array_as_text(chinese_array, size):
|
||||
text_output += " }\n"
|
||||
text_output += " return NULL;\n"
|
||||
text_output += "}\n"
|
||||
text_output += "\n#endif //HW_LIB_OLED_FONT_CHUC_H"
|
||||
text_output += "\n#endif //HW_LIB_FONT_CHUC_H"
|
||||
return text_output
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user