The Problem: I cannot display the diacritics ('Umlaut points') in German text when they're upper case.
I would like to display a word like 'Übung'
(Practice/Exercise in Engl.) But the tops gets cut off resulting in the the two dots not being displayed but comes out as 'Ubung'.
It cannot be the encoding since lower caser 'ü'
does get displayed property. Trying to display 'Üü'
results in 'Uü'.
I have this MWE from 'Invent your own Computer Games with Python', Chapter 17.
import pygame
from pygame.locals import *
# Set up pygame.
pygame.init()
# Set up the window.
windowSurface = pygame.display.set_mode((500, 400), 0, 32)
pygame.display.set_caption('Hello world!')
# Set up the colors.
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
# Set up the fonts.
basicFont = pygame.font.SysFont(None, 48)
# Set up the text.
text = basicFont.render('Hello Übungswörld!', True, GREEN, BLUE)
textRect = text.get_rect()
textRect.centerx = windowSurface.get_rect().centerx
textRect.centery = windowSurface.get_rect().centery
# Draw the white background onto the surface.
windowSurface.fill(WHITE)
# Get a pixel array of the surface.
pixArray = pygame.PixelArray(windowSurface)
pixArray[480][380] = BLACK
del pixArray
# Draw the text onto the surface.
windowSurface.blit(text, textRect)
# Draw the window onto the screen.
pygame.display.update()
# Run the game loop.
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
OS: MacOS 10.14.4 Fonts tried: System font (None), 'Palatino', 'helveticattc', 'comicsansmsttf'.
The odd thing is when I run this code in PyCharm, ComicSans ('comicsansmsttf') will render Ü but Helvetica and Palatino won't display the dots.