Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/matplotlib/_api/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def check_isinstance(
def list_suggestion_error_msg(name: str, potential: Any, values: Sequence[Any]) -> str: ...
def check_in_list(values: Sequence[Any], /, **kwargs: Any) -> None: ...
def check_shape(shape: tuple[int | None, ...], /, **kwargs: NDArray) -> None: ...
def getitem_checked(
mapping: Mapping[Any, _T], /, _error_cls: type[Exception], **kwargs: Any
) -> _T: ...
def getitem_checked(mapping: Mapping[Any, _T], /, _error_cls: type[Exception] = ..., **kwargs: Any) -> _T: ...
def caching_module_getattr(cls: type) -> Callable[[str], Any]: ...
@overload
def define_aliases(
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/_mathtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,8 @@ def ship(box: Box, xy: tuple[float, float] = (0, 0)) -> Output:
off_h = ox
off_v = oy + box.height
output = Output(box)

phantom: list[bool] = []

def render(node, *args):
if not any(phantom):
node.render(*args)
Expand Down
3 changes: 2 additions & 1 deletion lib/matplotlib/backend_bases.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ from matplotlib.figure import Figure
from matplotlib.font_manager import FontProperties
from matplotlib.path import Path
from matplotlib.texmanager import TexManager
from matplotlib.text import Text
from matplotlib.text import Text, TextToPath
from matplotlib.transforms import Bbox, BboxBase, Transform, TransformedPath

from collections.abc import Callable, Iterable, Sequence
Expand All @@ -40,6 +40,7 @@ def register_backend(
def get_registered_canvas_class(format: str) -> type[FigureCanvasBase]: ...

class RendererBase:
_text2path: TextToPath
def __init__(self) -> None: ...
def open_group(self, s: str, gid: str | None = ...) -> None: ...
def close_group(self, s: str) -> None: ...
Expand Down
5 changes: 3 additions & 2 deletions lib/matplotlib/backends/_backend_pdf_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


if typing.TYPE_CHECKING:
from .font_manager import FontPath
from .ft2font import CharacterCodeType, FT2Font, GlyphIndexType
from fontTools.ttLib import TTFont

Expand All @@ -34,7 +35,7 @@ def _cached_get_afm_from_fname(fname):
return AFM(fh)


def get_glyphs_subset(fontfile: str, glyphs: set[GlyphIndexType]) -> TTFont:
def get_glyphs_subset(fontfile: FontPath, glyphs: set[GlyphIndexType]) -> TTFont:
"""
Subset a TTF font.

Expand Down Expand Up @@ -199,7 +200,7 @@ def __init__(self, subset_size: int = 0):
self.subset_size = subset_size

def track(self, font: FT2Font, s: str,
features: tuple[str, ...] | None = ...,
features: tuple[str, ...] | None = None,
language: str | tuple[tuple[str, int, int], ...] | None = None
) -> list[tuple[int, CharacterCodeType]]:
"""
Expand Down
5 changes: 4 additions & 1 deletion lib/matplotlib/backends/backend_cairo.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ def _draw_mathtext(self, gc, x, y, s, prop, angle):
ctx.new_path()
ctx.select_font_face(*_cairo_font_args_from_font_prop(ttfFontProperty(font)))
ctx.set_font_size(self.points_to_pixels(fontsize))
ctx.show_glyphs([(idx, ox, -oy) for _, _, idx, ox, oy in font_glyphs])
ctx.show_glyphs([
(glyph_index, ox, -oy)
for _font, _size, _ccode, glyph_index, ox, oy in font_glyphs
])

for ox, oy, w, h in rects:
ctx.new_path()
Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/dviread.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def glyph_name_or_index(self):
# control all involved versions and are deeply familiar with the
# implementation", but a further mapping bug was fixed in luaotfload
# commit 8f2dca4, first included in v3.23).
entry = self._get_pdftexmap_entry()
entry = PsfontsMap(find_tex_file("pdftex.map"))[self.font.texname]
return (_parse_enc(entry.encoding)[self.glyph]
if entry.encoding is not None else self.glyph)

Expand Down
14 changes: 11 additions & 3 deletions lib/matplotlib/font_manager.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,19 @@ class FontManager:
self,
prop: str | FontProperties,
fontext: Literal["ttf", "afm"] = ...,
directory: str | None = ...,
directory: str | os.PathLike | None = ...,
fallback_to_default: bool = ...,
rebuild_if_missing: bool = ...,
) -> FontPath: ...
def get_font_names(self) -> list[str]: ...
def _find_fonts_by_props(
self,
prop: str | FontProperties,
fontext: Literal["ttf", "afm"] = ...,
directory: str | os.PathLike | None = ...,
fallback_to_default: bool = ...,
rebuild_if_missing: bool = ...,
) -> list[FontPath]: ...

def is_opentype_cff_font(filename: str) -> bool: ...
def get_font(
Expand All @@ -149,8 +157,8 @@ fontManager: FontManager
def findfont(
prop: str | FontProperties,
fontext: Literal["ttf", "afm"] = ...,
directory: str | None = ...,
directory: str | os.PathLike | None = ...,
fallback_to_default: bool = ...,
rebuild_if_missing: bool = ...,
) -> str: ...
) -> FontPath: ...
def get_font_names() -> list[str]: ...
3 changes: 2 additions & 1 deletion lib/matplotlib/ft2font.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ class FT2Font(Buffer):
*,
face_index: int = ...,
_fallback_list: list[FT2Font] | None = ...,
_kerning_factor: int | None = ...
_kerning_factor: int | None = ...,
_warn_if_used: bool = ...,
) -> None: ...
if sys.version_info[:2] >= (3, 12):
def __buffer__(self, /, flags: int) -> memoryview: ...
Expand Down
Loading