manim
manim copied to clipboard
Crash: Using a font with ligatures crashes manim-code
Description of bug / unexpected behavior
If I try to render some Rust code with a ligature font like Fira Mono and add a :: it crashes
Expected behavior
Should render the code
How to reproduce the issue
Code for reproducing the problem
def play_rust(self):
rust = """
impl<'cl> CuTask<'cl> for GenericPIDTask {
type Input = input_msg!('cl, f32);
type Output = output_msg!('cl, PIDControlOutput);
fn process( &mut self,
clock: &RobotClock,
input: Self :: Input,
output: Self :: Output) -> CuResult<()> {
}
}
"""
rendered_code = Code(code=rust, tab_width=2, background="window", language="Rust", font="Fira Code", font_size=20)
self.add(rendered_code)
self.wait(1)
Additional media files
Images/GIFs
Logs
Terminal output
``` File "/home/gbin/projects/CopperPitch/pres.py", line 461, inSystem specifications
System Details
- OS (with version, e.g., Windows 10 v2004 or macOS 10.15 (Catalina)):
- RAM:
- Python version (
python/py/python3 --version): - Installed modules (provide output from
pip list):
PASTE HERE
LaTeX details
- LaTeX distribution (e.g. TeX Live 2020):
- Installed LaTeX packages:
Additional comments
Currently there is no support for ligature fonts in Code blocks because it will mess coloring indexing like so:
Crashing is due to unexpected ligature text in Text-Mobject builder.
To resolve this, there is need for custom Paragraph builder that can store proper color indexing with ligatures.