Closed GZTimeWalker closed 3 years ago
Manim will use the Video frame size (when rendering to a video) or DPI (when using preview) when rendering SVG and nothing can be done from this project's side? If that doesn't work it's a bug with Manim.
Device's DPI is important when rendering svgs.
SVG is scalable and screen DPI isn't needed to be considered when rendering SVG itself. It's something Manim must be doing for you when scaling the SVG. Also, the size
parameter is in a way useless when rendering into an SVG file. You can always do Mobject.scale()
instead of using the Size parameter.
With that said, the size
parameter is only used when your text doesn't fix the SVG itself, manim always renders it in a pre-defined size (500*400 I think?). Another idea would be that Manim can pass the screen size rather than an arbitrary constant but again it's on Manim's side and not this project.
OK, I will consider it's a bug with Manim. Let me check it's code more carefully.
I checkout the single file text_mobject.py
before commit https://github.com/3b1b/manim/commit/ad332c586341a665b2e69d4dbea8b023c66d575d , which is the last version using cairo instead of manimpango, and it works well.
Maybe it's a problem caused by the code of the new Text object with manimpango? Or maybe it's a problem caused by manimpango itself?
I don't know the difference between cairo and manimpango clearly, so I am not sure where I could get the solution.
Maybe it's a problem caused by the code of the new Text object with manimpango? Or maybe it's a problem caused by manimpango itself?
It looks like the problem with the code with Text
object. I know that this works well with the community edition, so I could say this. Especially, there should be a problem with SVGMobject where the default scale is larger than normal.
Can you share the code to reproduce that? Though this isn't related to ManimPango, I can help you.
Also, closing this issue as isn't related to ManimPango, but you can still use this issue for sharing details.
There is something wrong with text's vertical space when I use mutiline text (I change the TEXT_MOB_SCALE_FACTOR
to quarter). The code from example_scene.py
:
For the complex plane scene, here is the code:
class ComplexPlaneScene(Scene):
CONFIG = {
"plane_config": {
"x_range": [-8, 8],
"y_range": [-4, 4],
"height": 8,
"width": 16,
},
}
def construct(self):
c_grid = ComplexPlane(**self.plane_config)
moving_c_grid = ComplexPlane(**self.plane_config)
moving_c_grid.prepare_for_nonlinear_transform()
c_grid.set_stroke(BLUE_E, 1)
c_grid.add_coordinate_labels()
self.add(c_grid)
self.add(moving_c_grid)
self.wait()
self.play(
moving_c_grid.animate.apply_complex_function(lambda z: z ** 2),
run_time=6,
)
self.wait(2)
For Manim, it up to date.
If I did nothing with text_mobject.py
, the mutiline text looks like this:
Looks like something messed with manimgl. Need to look into it, it isn't actually related to ManimPango though.
I'm using manim to render a complex plane with coordinate labels, which render number with Text and render unit with Tex. My device has a 4k screen and uses 250% scale, and it's output has incorrect font size.
When I change
'manim/manimlib/mobject/svg/text_mobject.py:218'
tosize / 4
, it will render as expected.I think this problem should be solved in this project. Device's DPI is important when rendering svgs.