From 2be4cc6c5b50baa09f5d73f8925390e4715e5f4d Mon Sep 17 00:00:00 2001 From: Jean Do Date: Wed, 11 Dec 2024 15:18:19 -0400 Subject: [PATCH] resolves simulator support for ja-JP --- simulator/kruxsim/mocks/lcd.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/simulator/kruxsim/mocks/lcd.py b/simulator/kruxsim/mocks/lcd.py index 5100e2be..51391c73 100644 --- a/simulator/kruxsim/mocks/lcd.py +++ b/simulator/kruxsim/mocks/lcd.py @@ -34,6 +34,8 @@ WIDTH = BOARD_CONFIG["lcd"]["width"] HEIGHT = BOARD_CONFIG["lcd"]["height"] +JAPANESE_CODEPOINT_MIN = 0x3000 +JAPANESE_CODEPOINT_MAX = 0x30FF CHINESE_CODEPOINT_MIN = 0x4E00 CHINESE_CODEPOINT_MAX = 0x9FFF KOREAN_CODEPOINT_MIN = 0xAC00 @@ -153,7 +155,8 @@ def string_width_px(string): for c in string: if ( - CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX + JAPANESE_CODEPOINT_MIN <= ord(c) <= JAPANESE_CODEPOINT_MAX + or CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX or KOREAN_CODEPOINT_MIN <= ord(c) <= KOREAN_CODEPOINT_MAX ): string_width += wide_width @@ -165,7 +168,8 @@ def string_width_px(string): def string_has_wide_glyph(string): for c in string: if ( - CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX + JAPANESE_CODEPOINT_MIN <= ord(c) <= JAPANESE_CODEPOINT_MAX + or CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX or KOREAN_CODEPOINT_MIN <= ord(c) <= KOREAN_CODEPOINT_MAX ): return True @@ -173,13 +177,15 @@ def string_has_wide_glyph(string): def is_wide(c): return ( - CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX + JAPANESE_CODEPOINT_MIN <= ord(c) <= JAPANESE_CODEPOINT_MAX + or CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX or KOREAN_CODEPOINT_MIN <= ord(c) <= KOREAN_CODEPOINT_MAX ) def char_width(c): if ( - CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX + JAPANESE_CODEPOINT_MIN <= ord(c) <= JAPANESE_CODEPOINT_MAX + or CHINESE_CODEPOINT_MIN <= ord(c) <= CHINESE_CODEPOINT_MAX or KOREAN_CODEPOINT_MIN <= ord(c) <= KOREAN_CODEPOINT_MAX ): return BOARD_CONFIG["krux"]["display"]["font_wide"][0]