pytheron pytheron - 1 year ago 70
Python Question

Text appearing low quality for unknown reason

I have 2 pieces of text which are using the exact same font settings to render.


font2 = pygame.font.SysFont(None, 18)


header_text = font2.render("Commodity", True, white)

text0 = font2.render(str(button[1]), True, white)

Header_text is just a plain string, whereas text0 is referencing an array.

There does not seem to be any reason why these text should be rendering differently but the following image shows the first is very low quality - it's bold and has no aliasing:


What is going on here? Is there some kind of cache that I need to clear in python?

Answer Source

If you are blitting the text multiple times without redrawing, this will remove the anti-aliasing, because it will be placing partially transparent pixels on top of each other multiple times. I discovered this when programming a pause message for a game.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download