-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Use Manimpango #878
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use Manimpango #878
Conversation
I suspect one of the dependency has published wrong wheels or something and because of that, there is a segmentation fault of MacOS 3.8 and 3.7 need to investigate. And I don't think it is because of Github Actions update. |
AFAICS |
I can confirm that this works fine on Mac OS Catalina with Python 3.9 and Pango 1.48 installed |
I have just released it. It will take some time for wheels to build and uploaded to PyPi. After that, |
This is ready for Review. |
I've played around with this a little, some observations (I'm on Ubuntu):
>>> from manim import *
>>> Text("asdf")
[12/29/20 13:27:54] INFO Text now uses Pango for rendering. In case of problems, the old implementation is available as CairoText. text_mobject.py:717
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 72: non-double matrix element
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 80: saw unknown, expected number
Text('asdf') and the same thing for
$ manim av.py TextTest -qm
[12/29/20 13:34:01] INFO Text now uses Pango for rendering. In case of problems, the old implementation is available as CairoText. text_mobject.py:717
Traceback (most recent call last):
File "/home/behackl/code/manim/manim/__main__.py", line 95, in main
scene.render()
File "/home/behackl/code/manim/manim/scene/scene.py", line 165, in render
self.construct()
File "av.py", line 5, in construct
c = Code("./ag.py")
File "/home/behackl/code/manim/manim/mobject/svg/code_mobject.py", line 188, in __init__
self.code = self.gen_colored_lines()
File "/home/behackl/code/manim/manim/mobject/svg/code_mobject.py", line 316, in gen_colored_lines
stroke_width=self.stroke_width,
File "/home/behackl/code/manim/manim/mobject/svg/text_mobject.py", line 441, in __init__
self.lines_text = Text(lines_str, **config)
File "/home/behackl/code/manim/manim/mobject/svg/text_mobject.py", line 759, in __init__
file_name = self.text2svg()
File "/home/behackl/code/manim/manim/mobject/svg/text_mobject.py", line 964, in text2svg
self.text,
File "cmanimpango.pyx", line 234, in manimpango.cmanimpango.text2svg
File "/usr/lib/python3.7/xml/sax/saxutils.py", line 27, in escape
data = data.replace("&", "&")
TypeError: a bytes-like object is required, not 'str' This is from trying to run from manim import *
class TextTest(Scene):
def construct(self):
c = Code("./ag.py")
self.play(ShowCreation(c)) which simply uses from manim import *
class SimpleScene(Scene):
def construct(self):
s = Square()
self.play(ShowCreation(s)) as
|
Oh! I didn't notice that. I see where the bug is. I will quickly patch it, in an hour or so. Meanwhile, this time after update, there would be a different wheel released for linux which latest Pango version. I will also update this PR so that it uses that version as the minimum one. |
Also, I will update the docs about loading from a TTF file, also specify it is only available for linux. |
Also, I think @behackl would need to update the docker image so that this wheel for ManimPango works. I have tested this on default python file but it fails on |
Good to know, thank you. I'll investigate docker a bit later. |
Also, when can it be merged? Before or after this month's release? |
This PR is ready. Just some docs on Linux only feature of font from file is remaining. |
I just tested this branch on Ubuntu 20.04. >>> from manim import *
>>> Text("Hello")
[12/31/20 10:09:17] INFO Text now uses Pango for text_mobject.py:716
rendering. In case of problems,
the old implementation is
available as CairoText. I do not get any errors. TextTest.mp4 |
A bit late, but I still managed: I've looked into potential issues with docker, found that our CodeTest.mp4is very good; no further adaptions seem to be required. I'm positively leaning towards merging this before the release, I'll test it some more before approving. |
I've updated the troubleshooting page via cdb9178. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the fact that this
- (has the potential to) significantly simplify the installation procedure and free us from pango-related issues (especially for Windows users),
- replaces an interface that will not be maintained any longer soon,
- and works really well,
I will go ahead and approve this, with the intention of merging it before the release. I do believe that this time around, the switch will be smoother than when switching from CairoText
to PangoText
-- but in case something seriously breaks, nothing stops us from releasing a bugfix version earlier than our usual release schedule.
Let both CairoText and ManimText be there as it is and can be seen in next release. |
Motivation
Stop of pangocffi, pangocairocffi and cairofffi.
Use Manimpango instead.
The problem started with
cairocffi
, stating that it wouldn't be maintained in future Kozea/cairocffi#173 (comment)Created a custom binding for Pango which seems to work, also fixes installation issues on Windows(:wink:). The only thing which doesn't work for now is the newly made
MarkupText
(sorry @PhilippImhof ). I will try to fix that soon. Need new tests for this though, removed the old ones.Need to check the docs whether things work correctly.
Oneline Summary of Changes
Testing Status
Worked as expected on my machine.
Acknowledgements
Reviewer Checklist