1

I can write superscripts in python with the following code:

numbers = [f"\N{SUPERSCRIPT ONE}",f"\N{SUPERSCRIPT TWO}",f"\N{SUPERSCRIPT THREE}",f"\N{SUPERSCRIPT FOUR}"]
numbers2 = ["\u00b9","\u00b2","\u00b3","\u2074"]
print(numbers)
print(numbers2)

However when I try to render the superscript on a pygame surface the superscripted 4 displays as an empty square instead. The other numbers work fine. I've added a picture of what my output looks like.

img = font.render(str(math.floor(random.randrange(1,11))) +random.choice(numbers2),True,(0,0,0))
screen.blit(img,imgpos)
pygame.display.flip()

code output

Sneezo
  • 11
  • 2
  • 2
    Your font cannot represent the unicode character "\u2074". You must use a different font. You will likely need to stich the text using different fonts. – Rabbid76 Sep 30 '21 at 06:38
  • 1
    Thank you! Turns out a lot of fonts don't have that unicode character. Also thanks for fixing the post. – Sneezo Sep 30 '21 at 06:49

0 Answers0