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

RE: [pygame] Can any one help me on how to render non_ascii(unicode) chars on pygame screen?



Yes, I have been preoccupied. That was a copyright symbol. It was unicode 
anyway. :-)

Lenard


Quoting Madhubala <madhubalav@xxxxxxxxxxxxxx>:

> Thank you, but u00a9 is not giving trademark. 
> Using u'Gap\u2122' gives Trademark Symbol. 
> 
> -Madhubala 
> 
> 
> -----Original Message-----
> From: owner-pygame-users@xxxxxxxx [mailto:owner-pygame-users@xxxxxxxx] On
> Behalf Of Lenard Lindstrom
> Sent: Tuesday, April 22, 2008 9:02 PM
> To: pygame-users@xxxxxxxx
> Subject: Re: [pygame] Can any one help me on how to render
> non_ascii(unicode) chars on pygame screen?
> 
> Quoting Madhubala <madhubalav@xxxxxxxxxxxxxx>:
> 
> > Hi,
> >  
> > can any one help me in  rendering  trademark symbol (char) on pygame 
> > surface.
> 
> Try this. The string passed to font.render is unicode ( u'GAP\u00a9' ).
> 
> # -*- coding: utf-8 -*-
> import pygame
> from pygame.locals import*
> 
> def main():
>     pygame.init()
>     resolution = 800, 400
>     screen = pygame.display.set_mode(resolution)
>     fg = 250, 240, 230
>     bg = 5, 5, 5
>     wincolor = 40, 40, 90
>     #fill background
>     screen.fill(wincolor)
>     font = pygame.font.Font(pygame.font.match_font('arial'),40) 
>     
>     testp = u'Gap\u00a9'
>     tm = font.render(testp,False,fg,bg)
>     screen.blit(tm, (10, 100))
>     pygame.display.flip()
>     while 1:
>         #use event.wait to keep from polling 100% cpu
>         e=pygame.event.wait()
>         if e.type in (QUIT, KEYDOWN):
>             if(e.key==K_ESCAPE):
>                 break
>  
>     pygame.quit()
>  
> 
> if __name__=='__main__':main()
> 
> --
> Lenard Lindstrom
> <len_l@xxxxxxxxx>
> 
> 


-- 
Lenard Lindstrom
<len_l@xxxxxxxxx>