Esempio 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
Esempio n. 2
0
File: banner.py Progetto: 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
Esempio 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