|
30 | 30 |
|
31 | 31 | import numpy as np |
32 | 32 |
|
33 | | -from matplotlib import _api, cbook, rcParams |
| 33 | +from matplotlib import _api, cbook |
34 | 34 |
|
35 | 35 | _log = logging.getLogger(__name__) |
36 | 36 |
|
@@ -212,15 +212,8 @@ def __init__(self, filename, dpi): |
212 | 212 | self.dpi = dpi |
213 | 213 | self.fonts = {} |
214 | 214 | self.state = _dvistate.pre |
215 | | - self.baseline = self._get_baseline(filename) |
216 | | - |
217 | | - def _get_baseline(self, filename): |
218 | | - if dict.__getitem__(rcParams, 'text.latex.preview'): |
219 | | - baseline = Path(filename).with_suffix(".baseline") |
220 | | - if baseline.exists(): |
221 | | - height, depth, width = baseline.read_bytes().split() |
222 | | - return float(depth) |
223 | | - return None |
| 215 | + |
| 216 | + baseline = _api.deprecated("3.5")(property(lambda self: None)) |
224 | 217 |
|
225 | 218 | def __enter__(self): |
226 | 219 | """Context manager enter method, does nothing.""" |
@@ -290,10 +283,7 @@ def _output(self): |
290 | 283 |
|
291 | 284 | # convert from TeX's "scaled points" to dpi units |
292 | 285 | d = self.dpi / (72.27 * 2**16) |
293 | | - if self.baseline is None: |
294 | | - descent = (maxy - maxy_pure) * d |
295 | | - else: |
296 | | - descent = self.baseline |
| 286 | + descent = (maxy - maxy_pure) * d |
297 | 287 |
|
298 | 288 | text = [Text((x-minx)*d, (maxy-y)*d - descent, f, g, w*d) |
299 | 289 | for (x, y, f, g, w) in self.text] |
@@ -960,55 +950,6 @@ def _parse(self, file): |
960 | 950 | encoding=encoding, filename=filename) |
961 | 951 |
|
962 | 952 |
|
963 | | -@_api.deprecated("3.3") |
964 | | -class Encoding: |
965 | | - r""" |
966 | | - Parse a \*.enc file referenced from a psfonts.map style file. |
967 | | -
|
968 | | - The format this class understands is a very limited subset of PostScript. |
969 | | -
|
970 | | - Usage (subject to change):: |
971 | | -
|
972 | | - for name in Encoding(filename): |
973 | | - whatever(name) |
974 | | -
|
975 | | - Parameters |
976 | | - ---------- |
977 | | - filename : str or path-like |
978 | | -
|
979 | | - Attributes |
980 | | - ---------- |
981 | | - encoding : list |
982 | | - List of character names |
983 | | - """ |
984 | | - __slots__ = ('encoding',) |
985 | | - |
986 | | - def __init__(self, filename): |
987 | | - with open(filename, 'rb') as file: |
988 | | - _log.debug('Parsing TeX encoding %s', filename) |
989 | | - self.encoding = self._parse(file) |
990 | | - _log.debug('Result: %s', self.encoding) |
991 | | - |
992 | | - def __iter__(self): |
993 | | - yield from self.encoding |
994 | | - |
995 | | - @staticmethod |
996 | | - def _parse(file): |
997 | | - lines = (line.split(b'%', 1)[0].strip() for line in file) |
998 | | - data = b''.join(lines) |
999 | | - beginning = data.find(b'[') |
1000 | | - if beginning < 0: |
1001 | | - raise ValueError("Cannot locate beginning of encoding in {}" |
1002 | | - .format(file)) |
1003 | | - data = data[beginning:] |
1004 | | - end = data.find(b']') |
1005 | | - if end < 0: |
1006 | | - raise ValueError("Cannot locate end of encoding in {}" |
1007 | | - .format(file)) |
1008 | | - data = data[:end] |
1009 | | - return re.findall(br'/([^][{}<>\s]+)', data) |
1010 | | - |
1011 | | - |
1012 | 953 | # Note: this function should ultimately replace the Encoding class, which |
1013 | 954 | # appears to be mostly broken: because it uses b''.join(), there is no |
1014 | 955 | # whitespace left between glyph names (only slashes) so the final re.findall |
|
0 commit comments