当前位置: 首页>>代码示例>>Python>>正文


Python fontManager.findfont函数代码示例

本文整理汇总了Python中matplotlib.font_manager.fontManager.findfont函数的典型用法代码示例。如果您正苦于以下问题:Python findfont函数的具体用法?Python findfont怎么用?Python findfont使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了findfont函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_json_serialization

def test_json_serialization():
    with tempfile.NamedTemporaryFile() as temp:
        json_dump(fontManager, temp.name)
        copy = json_load(temp.name)
    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
        for prop in ({'family': 'STIXGeneral'},
                     {'family': 'Bitstream Vera Sans', 'weight': 700},
                     {'family': 'no such font family'}):
            fp = FontProperties(**prop)
            assert_equal(fontManager.findfont(fp, rebuild_if_missing=False),
                         copy.findfont(fp, rebuild_if_missing=False))
开发者ID:Acanthostega,项目名称:matplotlib,代码行数:12,代码来源:test_font_manager.py

示例2: test_json_serialization

def test_json_serialization(tmpdir):
    # Can't open a NamedTemporaryFile twice on Windows, so use a temporary
    # directory instead.
    path = Path(tmpdir, "fontlist.json")
    json_dump(fontManager, path)
    copy = json_load(path)
    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
        for prop in ({'family': 'STIXGeneral'},
                     {'family': 'Bitstream Vera Sans', 'weight': 700},
                     {'family': 'no such font family'}):
            fp = FontProperties(**prop)
            assert (fontManager.findfont(fp, rebuild_if_missing=False) ==
                    copy.findfont(fp, rebuild_if_missing=False))
开发者ID:HubertHolin,项目名称:matplotlib,代码行数:14,代码来源:test_font_manager.py

示例3: test_json_serialization

def test_json_serialization():
    # on windows, we can't open a file twice, so save the name and unlink
    # manually...
    try:
        name = None
        with tempfile.NamedTemporaryFile(delete=False) as temp:
            name = temp.name
        json_dump(fontManager, name)
        copy = json_load(name)
    finally:
        if name and os.path.exists(name):
            os.remove(name)
    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', 'findfont: Font family.*not found')
        for prop in ({'family': 'STIXGeneral'},
                     {'family': 'Bitstream Vera Sans', 'weight': 700},
                     {'family': 'no such font family'}):
            fp = FontProperties(**prop)
            assert (fontManager.findfont(fp, rebuild_if_missing=False) ==
                    copy.findfont(fp, rebuild_if_missing=False))
开发者ID:Eric89GXL,项目名称:matplotlib,代码行数:20,代码来源:test_font_manager.py


注:本文中的matplotlib.font_manager.fontManager.findfont函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。