Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- # Version 2, December 2004
- #
- # Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
- #
- # Everyone is permitted to copy and distribute verbatim or modified
- # copies of this license document, and changing it is allowed as long
- # as the name is changed.
- #
- # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
- # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
- #
- # 0. You just DO WHAT THE FUCK YOU WANT TO.
- import os.path
- #import basic pygame modules
- import pygame
- from pygame.locals import *
- #see if we can load more than standard BMP
- if not pygame.image.get_extended():
- raise SystemExit("Sorry, extended image module required")
- levels = u"""\
- \
- \
- !"#$%&'()*+,-./\
- 0123456789:;<=>?\
- @ABCDEFGHIJKLMNO\
- PQRSTUVWXYZ[\]^_\
- `abcdefghijklmno\
- pqrstuvwxyz{|}~ \
- ,ƒ„…†‡^‰Š‹Œ Ž \
- ‘’“”·–—˜™š›œ žŸ\
- ¡ȼ£¤¥¦§¨©ª«¬-®¯\
- °±²³´µ¶·¸¹º»¼½¾¿\
- ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ\
- ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß\
- àáâãäåæçèéêëìíîï\
- ðñòóôõö÷øùúûüýþÿ\
- """
- DATA_PATH = os.path.split(os.path.abspath(__file__))[0]
- def get_text(surface):
- """ We render the char, and then convert the image to table
- """
- font = pygame.font.Font("DejaVuSerif.ttf", 48)
- for y in range(0, 16):
- for x in range(0, 16):
- pos = y * 16 + x
- limit = pos % (len(levels))
- image = font.render(levels[limit], True, Color("white"))
- _, _, width, height = image.get_rect()
- print levels[limit], width, height
- surface.blit(image, (x*64 + 5,y*64 + 5))
- def load_image(file):
- """ Loads an image, prepares it for play.
- **file** The file to load
- **return** the surface converted.
- """
- file = os.path.join(DATA_PATH, 'data', file)
- try:
- surface = pygame.image.load(file)
- except pygame.error:
- raise SystemExit('Could not load image "%s" %s'%(file, pygame.get_error()))
- return surface.convert_alpha()
- def main(winstyle = 0):
- pygame.init()
- surface = pygame.Surface((1024, 1024))
- #screen.blit(load_image("logo.png"), (0, 0))
- get_text(surface)
- pygame.image.save(surface,'oolite-font.png')
- pygame.quit()
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement