mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Remove get_downloads_dir reference from register_font
This commit is contained in:
parent
71e440be93
commit
c96734ace0
1 changed files with 3 additions and 14 deletions
|
@ -21,7 +21,6 @@ from manimlib.mobject.svg.string_mobject import StringMobject
|
||||||
from manimlib.utils.cache import cache_on_disk
|
from manimlib.utils.cache import cache_on_disk
|
||||||
from manimlib.utils.color import color_to_hex
|
from manimlib.utils.color import color_to_hex
|
||||||
from manimlib.utils.color import int_to_hex
|
from manimlib.utils.color import int_to_hex
|
||||||
from manimlib.utils.directories import get_downloads_dir
|
|
||||||
from manimlib.utils.simple_functions import hash_string
|
from manimlib.utils.simple_functions import hash_string
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
@ -493,20 +492,10 @@ def register_font(font_file: str | Path):
|
||||||
method with previous releases will raise an :class:`AttributeError` on macOS.
|
method with previous releases will raise an :class:`AttributeError` on macOS.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
input_folder = Path(get_downloads_dir()).parent.resolve()
|
file_path = Path(font_file).resolve()
|
||||||
possible_paths = [
|
if not file_path.exists():
|
||||||
Path(font_file),
|
error = f"Can't find {font_file}."
|
||||||
input_folder / font_file,
|
|
||||||
]
|
|
||||||
for path in possible_paths:
|
|
||||||
path = path.resolve()
|
|
||||||
if path.exists():
|
|
||||||
file_path = path
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
error = f"Can't find {font_file}." f"Tried these : {possible_paths}"
|
|
||||||
raise FileNotFoundError(error)
|
raise FileNotFoundError(error)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
assert manimpango.register_font(str(file_path))
|
assert manimpango.register_font(str(file_path))
|
||||||
yield
|
yield
|
||||||
|
|
Loading…
Add table
Reference in a new issue