Exemplo n.º 1
0
def loadFont(font, size):
    if font is None:
        return pygame.font.Font(res.defaultFont(), size)

    elif isinstance(font, str):
        return pygame.font.Font(res.fontPath(font), size)

    elif isinstance(font, pygame.font.Font):
        return font

    else:
        return font
Exemplo n.º 2
0
Arquivo: banner.py Projeto: MacLeek/mh
def loadFont(font, size):
    if font is None:
        return pygame.font.Font(res.defaultFont(), size)
            
    elif isinstance(font, str):
        return pygame.font.Font(res.fontPath(font), size)

    elif isinstance(font, pygame.font.Font):
        return font

    else:
        return font
Exemplo n.º 3
0
    def __init__(self, text, color=[0,0,0], size=12, font=None):
        super(TextBanner, self).__init__()

        self._font_size = size
        self._text      = text
        self._color     = color
        self._rect = pygame.rect.Rect(0,0,0,0)

        if font == None:
            font = res.defaultFont()
            self._font      = pygame.font.Font(font, size)
            self._font_name = font
                
        else:
            if isinstance(font, str):
                fullpath = res.fontPath(font)
                self.set_font(fullpath)
            else:
                self._font = font
                self._font_name = font

        self.dirty = 1