[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

SysFont wrongly italicizes text on XP, was Re: [pygame] BUG: SysFont hangs when loading certain fonts (with cause and fix ideas)



Hi,

I noticed another SysFont issue is the issue tracker:
    "SysFont wrongly italicizes text on XP"
    https://bitbucket.org/pygame/pygame/issue/64/sysfont-wrongly-italicizes-text-on-xp

Is anyone on Windows XP able to confirm that the script below shows italic fonts when ran?

The screen shot here sure does look like they are italic:
    http://www.pygame.org/old_bug_attachments/39/test_fonts.PNG




#!/usr/bin/env python
# coding: cp1251

import sys
import os
import pygame

font_names = [
        'Courier New',
        'Verdana',
        'Tahoma',
        'Times New Roman',
        'Lucida Console',
        'Comic Sans MS',
        'Garamond',
]

pygame.init()
screen = pygame.display.set_mode((640, 480))

background = pygame.Surface(screen.get_size()).convert()
background.fill((255, 255, 255))

top = 0
for font_name in font_names:
        font = pygame.font.SysFont(font_name, 32)
        text = font.render(font_name, 1, (0, 0, 0))
        textpos = text.get_rect(left = 0, top = top)
        top += textpos.height
        
        background.blit(text, textpos)

screen.blit(background, (0, 0))
pygame.display.flip()
clock = pygame.time.Clock()

running = True
while running:
        clock.tick(60)
        screen.blit(background, (0, 0))
        pygame.display.flip()
        
        for event in pygame.event.get():
                if (event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE) or (event.type == pygame.QUIT):
                        running = False

pygame.quit()