0

i'm trying to get pygame to display unicode glyphs. I noticed that my system font, Ubuntu Mono, is used in both command-line and text editor and it's able to display almost every character. Chineese included.

So i wanted to use this font but... no success.. unicode characters are missing!

here's my snippet (python 2.7)

# -*- coding: utf8 -*- 
import pygame
import pygame.freetype

pygame.init()
font = pygame.freetype.SysFont('Ubuntu Mono', 13)
font.ucs4 = True #should be useless. defaults to true
surf = font.render(u'黒 ♧')[0]
pygame.image.save(surf, 'image.png')

no way.. it draws squares only

i used a characters map application and i saw that almost every font in my system can display this character: ♧

Suggestions? Thank you in advance

EDIT

The characters map application automatically replace missing glyphs with alternatives from other fonts..

So now i'm searching if it's possible to reproduce this behaviour in pygame. Otherwise i will have to do that manually

nonsensei
  • 480
  • 4
  • 15
  • Are you actually running this program in Ubuntu? – Mark Ransom Mar 02 '16 at 19:57
  • 1
    I know that Windows can do font substitution if you ask for a character that's outside the font, but I don't know about Linux; that's why I ask. If the other applications you're using to check if the font has this character do substitutions, it may lead you to believe the character is there when it really isn't. – Mark Ransom Mar 03 '16 at 18:37
  • I verified this... sadly the "characters map" application defaults to this behaviour.. – nonsensei Mar 05 '16 at 19:51

0 Answers0