diff --git a/components/express_way.py b/components/express_way.py index 88ac27d..cee2b2f 100644 --- a/components/express_way.py +++ b/components/express_way.py @@ -12,9 +12,10 @@ class ExpressWayBaseComponent: self.sub_name = sub_name self.head_bg_color = head_bg_color self.head_text_color = head_text_color - self.main_text_height = 40 * SCALE + self.main_text_height = 50 * SCALE self.main_text_width = FontSize.get_font_width(self.main_name, 'resources/B.ttf', self.main_text_height) - self.sub_text_width = FontSize.get_font_width(self.sub_name, 'resources/B.ttf', 24 * SCALE) + self.sub_text_height = int(self.main_text_height * 0.6) + self.sub_text_width = FontSize.get_font_width(self.sub_name, 'resources/B.ttf', self.sub_text_height) self.inset = 5 * SCALE self.stroke_width = 2 * SCALE self.r = 8 * SCALE @@ -59,8 +60,8 @@ class ExpressWayBaseComponent: big_text.draw(container, name_start_x, y + self.head_height) if len(self.sub_name): - small_text = TextBComponent(self.sub_name, '#ffffff', 24 * SCALE) - small_text.draw(container, name_start_x + self.main_text_width, y + self.head_height + self.main_text_height * 0.33) + small_text = TextBComponent(self.sub_name, '#ffffff', self.sub_text_height) + small_text.draw(container, name_start_x + self.main_text_width, y + self.head_height + self.main_text_height * 0.32) class NationalExpressWayComponent(ExpressWayBaseComponent): diff --git a/test/main.py b/test/main.py index 48d6a10..1ae5103 100644 --- a/test/main.py +++ b/test/main.py @@ -108,12 +108,12 @@ for line in lines: elif item_type == 4: main_name = item_info.get('main_name') - sub_name = item_info.get('sub_name') + sub_name = item_info.get('sub_name') if item_info.get('sub_name') is not None else '' ele = NationalExpressWayComponent(main_name, sub_name) elif item_type == 5: main_name = item_info.get('main_name') - sub_name = item_info.get('sub_name') + sub_name = item_info.get('sub_name') if item_info.get('sub_name') is not None else '' prov = item_info.get('prov') ele = ProvincialExpressWayComponent(prov, main_name, sub_name)