✨
This commit is contained in:
10
main.py
10
main.py
@@ -340,7 +340,7 @@ def main(data: dict):
|
||||
new_text.append("")
|
||||
text_words = t.split(" ")
|
||||
for w in text_words:
|
||||
res = re.findall(r"\[(.*?)\/(\d)\]([^\[ ]*)",w)
|
||||
res = re.findall(r"([^\] ]*)\[(.*?)\/(\d)\]([^\[ ]*)",w)
|
||||
if res == []:
|
||||
new_text = add_to_text(new_text,w)
|
||||
else:
|
||||
@@ -348,19 +348,19 @@ def main(data: dict):
|
||||
new_text = add_to_text(new_text,"")
|
||||
|
||||
for slot in res:
|
||||
new_text = add_to_text(new_text,WORD_SLOT_SPACING+slot[2],"")
|
||||
new_text = add_to_text(new_text,slot[0]+WORD_SLOT_SPACING+slot[3],"")
|
||||
height = WORD_FONT_SIZE*len(new_text)
|
||||
width, _ = font.size(new_text[-1])
|
||||
extra_width, _ = font.size(slot[2])
|
||||
extra_width, _ = font.size(slot[3])
|
||||
pos = Vector2(
|
||||
TEXT_MARGIN + width - extra_width - WORD_WIDTH,
|
||||
TEXT_MARGIN + height - WORD_HEIGHT//2 + TEXT_TOP_MARGIN*len(new_text) + WORD_SLOT_NUDGE_DOWN
|
||||
)
|
||||
# if new_text[-1] != WORD_SLOT_SPACING+slot[2]:
|
||||
pos.x += WORD_SLOT_NUDGING
|
||||
new_slot = WordSlot(WordColor(int(slot[1])),p,pos)
|
||||
new_slot = WordSlot(WordColor(int(slot[2])),p,pos)
|
||||
word_slots.append(new_slot)
|
||||
p.slots.append((slot[0].replace("%"," "),new_slot))
|
||||
p.slots.append((slot[1].replace("%"," "),new_slot))
|
||||
|
||||
p.text = new_text
|
||||
|
||||
|
||||
Reference in New Issue
Block a user