What is a good way to make selected fonts?

I am writing a python game with pygame and should display the text on the screen.

I want to make this text the same color as the outline, so I don’t have to worry about which background will be displayed above the text.

pygame.font doesn't seem to offer support for this kind of thing directly, and I wonder if anyone has any good solutions to achieve this?

+6
python fonts pygame
source share
2 answers

I can give you a quick and bad solution:

print the text 8 times, surround it, plus one more time for the inner text, for example,

UUU UIU UUU 

U for outer color and i for inner color.

+2
source share

The quick and dirty way is to make your text several times in outline color, shifted by small amounts in a circle around the text position:

  one
        8 |  2
         \ | |  /
          \ | /
      7 ---- * ---- 3
          / | \
         / |  \ 
        6 |  4
           5

Edit : Doh you were faster! I will not delete my answer, although this ASCII art is simply too good and deserves to live!

Edit 2: As mentioned in OregonGhost, you may need more or fewer steps to render outlines, depending on the outline's width.

+3
source share

All Articles