fix: 排版调整

This commit is contained in:
Zhang Muyu
2023-09-17 11:57:03 +08:00
parent d8cb14963c
commit 5ac25a159a
2 changed files with 7 additions and 6 deletions

View File

@@ -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):

View File

@@ -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)