本文整理匯總了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))