本文整理汇总了Python中matplotlib.cbook.get_realpath_and_stat方法的典型用法代码示例。如果您正苦于以下问题:Python cbook.get_realpath_and_stat方法的具体用法?Python cbook.get_realpath_and_stat怎么用?Python cbook.get_realpath_and_stat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook.get_realpath_and_stat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeFonts
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import get_realpath_and_stat [as 别名]
def writeFonts(self):
fonts = {}
for dviname, info in sorted(self.dviFontInfo.items()):
Fx = info.pdfname
_log.debug('Embedding Type-1 font %s from dvi.', dviname)
fonts[Fx] = self._embedTeXFont(info)
for filename in sorted(self.fontNames):
Fx = self.fontNames[filename]
_log.debug('Embedding font %s.', filename)
if filename.endswith('.afm'):
# from pdf.use14corefonts
_log.debug('Writing AFM font.')
fonts[Fx] = self._write_afm_font(filename)
else:
# a normal TrueType font
_log.debug('Writing TrueType font.')
realpath, stat_key = cbook.get_realpath_and_stat(filename)
chars = self.used_characters.get(stat_key)
if chars is not None and len(chars[1]):
fonts[Fx] = self.embedTTF(realpath, chars[1])
self.writeObject(self.fontObject, fonts)
示例2: render_glyph
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import get_realpath_and_stat [as 别名]
def render_glyph(self, ox, oy, facename, font_class, sym, fontsize, dpi):
"""
Draw a glyph at
- *ox*, *oy*: position
- *facename*: One of the TeX face names
- *font_class*:
- *sym*: TeX symbol name or single character
- *fontsize*: fontsize in points
- *dpi*: The dpi to draw at.
"""
info = self._get_info(facename, font_class, sym, fontsize, dpi)
realpath, stat_key = get_realpath_and_stat(info.font.fname)
used_characters = self.used_characters.setdefault(
stat_key, (realpath, set()))
used_characters[1].add(info.num)
self.mathtext_backend.render_glyph(ox, oy, info)
示例3: track_characters
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import get_realpath_and_stat [as 别名]
def track_characters(self, font, s):
"""Keeps track of which characters are required from each font."""
if isinstance(font, str):
fname = font
else:
fname = font.fname
realpath, stat_key = cbook.get_realpath_and_stat(fname)
used_characters = self.file.used_characters.setdefault(
stat_key, (realpath, set()))
used_characters[1].update(map(ord, s))