I just can't seem to get pygame fonts to work how I want them to.
What I want is for the rendered text itself to have a pixel height of 100. In other words, font.get_rect(text).height
should be 100. The only way I've found to do this is brute force the resolution until I get 100. However, this doesn't work for all text, and I want to be able to change the desired height without having to also change the resolution.
Here's an example:
# pygame.freetype.Font(file, size)
font = pygame.freetype.Font(None, 100)
print(font.get_rect("text").height) # prints 69
font = pygame.freetype.Font(None, 100, resolution=104)
print(font.get_rect("text").height) # prints 100
font = pygame.freetype.Font(None, 100)
print(font.get_rect("Other Text!").height) # prints 76
font = pygame.freetype.Font(None, 100, resolution=104)
print(font.get_rect("Other Text!").height) # prints 110
What am I not understanding?