__init__.py 文件源码

python
阅读 57 收藏 0 点赞 0 评论 0

项目:cryptogram 作者: xinmingzhang 项目源码 文件源码
def add_file(font):
    """Add a font to pyglet's search path.

    In order to load a font that is not installed on the system, you must
    call this method to tell pyglet that it exists.  You can supply
    either a filename or any file-like object.

    The font format is platform-dependent, but is typically a TrueType font
    file containing a single font face. Note that to use a font added with this method,
    you should pass the face name (not the file name) to :meth:`pyglet.font.load` or any
    other place where you normally specify a font.

    :Parameters:
        `font` : str or file
            Filename or file-like object to load fonts from.

    """
    if isinstance(font, basestring):
        font = open(font, 'rb')
    if hasattr(font, 'read'):
        font = font.read()
    _font_class.add_font_data(font)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号