Describe the feature you want to add
Refactor the random font selection logic in indirect_font() to reduce duplicated code and make adding new random font groups easier.
Describe your proposed solution
Create a new helper function random_from_group() in utils.py that receives a font size group name (small, medium, large, xlarge) and returns a random font from the corresponding list in RND_SIZE_DICT.
Replace the repeated conditional blocks inside indirect_font():
rnd-small
rnd-medium
rnd-large
rnd-xlarge
with a dictionary-based mapping between aliases and font groups. Use the helper function to return the selected font.
This reduces duplicated random.choice() calls and makes future random font categories easier to add.
Describe alternatives you've considered, if relevant
No response
Additional context
No response
Describe the feature you want to add
Refactor the random font selection logic in
indirect_font()to reduce duplicated code and make adding new random font groups easier.Describe your proposed solution
Create a new helper function
random_from_group()inutils.pythat receives a font size group name (small,medium,large,xlarge) and returns a random font from the corresponding list inRND_SIZE_DICT.Replace the repeated conditional blocks inside
indirect_font():rnd-smallrnd-mediumrnd-largernd-xlargewith a dictionary-based mapping between aliases and font groups. Use the helper function to return the selected font.
This reduces duplicated
random.choice()calls and makes future random font categories easier to add.Describe alternatives you've considered, if relevant
No response
Additional context
No response