コード例 #1
0
def get_cached_font(fontname, fontsize):
    key = (fontname, fontsize)
    try:
        return font_asst.get_cache(key)

    except KeyError:
        # see if we can build the font
        info = font_asst.get_font_info(fontname, subst_ok=True)

        font = ImageFont.truetype(info.font_path, fontsize)
        font_asst.add_cache(key, font)

        return font
コード例 #2
0
def get_cached_font(fontname, fontsize, color, alpha):
    key = (fontname, fontsize, color, alpha)
    try:
        return font_asst.get_cache(key)

    except KeyError:
        # see if we can build the font
        info = font_asst.get_font_info(fontname, subst_ok=True)

        font = agg.Font(color, info.font_path, size=fontsize, opacity=alpha)
        font_asst.add_cache(key, font)

        return font
コード例 #3
0
def get_cached_font(fontname, fontsize):
    key = (fontname, fontsize)
    try:
        return font_asst.get_cache(key)

    except KeyError:
        # see if we can build the font
        info = font_asst.get_font_info(fontname, subst_ok=True)

        font = ImageFont.truetype(info.font_path, fontsize)
        font_asst.add_cache(key, font)

        return font
コード例 #4
0
ファイル: AggHelp.py プロジェクト: ejeschke/ginga
def get_cached_font(fontname, fontsize, color, alpha):
    key = (fontname, fontsize, color, alpha)
    try:
        return font_asst.get_cache(key)

    except KeyError:
        # see if we can build the font
        info = font_asst.get_font_info(fontname, subst_ok=True)

        font = agg.Font(color, info.font_path, size=fontsize, opacity=alpha)
        font_asst.add_cache(key, font)

        return font
コード例 #5
0
ファイル: CvHelp.py プロジェクト: mfwofford/ginga
def get_cached_font(fontname, fontsize):
    key = (fontname, fontsize)
    try:
        return font_asst.get_cache(key)

    except KeyError:
        # see if we can build the font
        info = font_asst.get_font_info(fontname, subst_ok=True)

        font = cv2.freetype.createFreeType2()
        font.loadFontData(info.font_path, id=0)
        font_asst.add_cache(key, font)

        return font