Skip to content

Commit 5fe27c9

Browse files
committed
Merge remote-tracking branch 'origin' into moderngl
2 parents ff4eb33 + ad9789a commit 5fe27c9

File tree

4 files changed

+173
-122
lines changed

4 files changed

+173
-122
lines changed

manim/mobject/svg/text_mobject.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1429,8 +1429,8 @@ def register_font(font_file: typing.Union[str, Path]):
14291429
14301430
.. important ::
14311431
1432-
This method isn't available for macOS. Using this
1433-
method on macOS will raise an :class:`AttributeError`.
1432+
This method is available for macOS for ``ManimPango>=v0.2.3``. Using this
1433+
method with previous releases will raise an :class:`AttributeError` on macOS.
14341434
"""
14351435

14361436
input_folder = Path(config.input_file).parent.resolve()

manim/utils/tex_file_writing.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,30 @@ def compile_tex(tex_file, tex_compiler, output_format):
164164
exit_code = os.system(command)
165165
if exit_code != 0:
166166
log_file = tex_file.replace(".tex", ".log")
167+
if not Path(log_file).exists():
168+
raise RuntimeError(
169+
f"{tex_compiler} failed but did not produce a log file. "
170+
"Check your LaTeX installation."
171+
)
172+
with open(log_file, "r") as f:
173+
log = f.readlines()
174+
log_error_pos = [
175+
ind for (ind, line) in enumerate(log) if line.startswith("!")
176+
]
177+
if log_error_pos:
178+
logger.error(f"LaTeX compilation error! {tex_compiler} reports:")
179+
for lineno in log_error_pos:
180+
# search for a line starting with "l." in the next
181+
# few lines past the error; otherwise just print some lines.
182+
printed_lines = 1
183+
for _ in range(10):
184+
if log[lineno + printed_lines].startswith("l."):
185+
break
186+
printed_lines += 1
187+
188+
for line in log[lineno : lineno + printed_lines + 1]:
189+
logger.error(line)
190+
167191
raise ValueError(
168192
f"{tex_compiler} error converting to"
169193
f" {output_format[1:]}. See log output above or"

0 commit comments

Comments
 (0)