Проблема: я не могу отобразить диакритические знаки («точки умляута») в тексте на немецком языке, когда они прописные.
Я хотел бы отобразить слово типа 'Übung'
(Практика / Упражнение на английском языке).) Но вершины обрезаются, в результате чего две точки не отображаются, а отображаются как «Ubung».
Это не может быть кодировка, поскольку нижний регистр 'ü'
действительно отображает свойство.Попытка отобразить 'Üü'
результаты в «Uü».
У меня есть этот MWE из «Изобретите свои собственные компьютерные игры с Python», глава 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()
ОС: MacOS 10.14.Пробовал 4 шрифта: Системный шрифт (None), 'Palatino', 'helveticattc', 'comicsansmsttf'.
Странно то, что когда я запускаю этот код в PyCharm, ComicSans ('comicsansmsttf') будет отображать Ü, ноHelvetica и Palatino не будут отображать точки.