SysFont wrongly italicizes text on XP

illume avatarillume created an issue

Alex, 2011-02-16 09:52:25 -0800

Created attachment 39
Screenshot of demo program running

Version: 1.9.2pre
Python: Python 2.7.1 x86
OS: XP SP3 x86
Source: http://www.bpaste.net/show/13729/

On Windows 7 this demo shows all fonts look regular, but on Windows XP some fonts are italic, like on attached screenshot.

Attachments: test_fonts.PNG

Comments (6)

  1. illume
    #!/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()
    
  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.