a guest Jun 16th, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # encoding: utf-8
- import os
- import pygame
- font_file = '/System/Library/Fonts/PingFang.ttc'
- chinese_dir = 'chinese'
- if not os.path.exists(chinese_dir):
- start,end = (0x4E00, 0x9FA5) # unicode range of Chinese Character
- for codepoint in range(int(start), int(end)):
- word = chr(codepoint)
- font = pygame.font.Font(font_file, 64)
- rtext = font.render(word, True, (0, 0, 0), (255, 255, 255))
- pygame.image.save(rtext, os.path.join(chinese_dir, word + ".png"))
RAW Paste Data