Skip to content

Commit 9db7521

Browse files
committed
scale stroke_width if font_size is too small or too big
1 parent 40987d5 commit 9db7521

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

manim/animation/creation.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ def construct(self):
9494
from ..animation.animation import Animation
9595
from ..animation.composition import Succession
9696
from ..mobject.mobject import Group, Mobject
97+
from ..mobject.svg.svg_mobject import SVGMobject
9798
from ..mobject.types.vectorized_mobject import VMobject
9899
from ..utils.bezier import integer_interpolate
99100
from ..utils.rate_functions import double_smooth, linear
@@ -385,9 +386,9 @@ def _adjust_stroke_width_for_text(
385386
) -> float:
386387
if stroke_width is not None:
387388
return stroke_width
388-
if not hasattr(vmobject, "font_size") or vmobject.height == 0:
389+
if not isinstance(vmobject, SVGMobject) or vmobject.height == 0:
389390
return 2
390-
font_size = vmobject.font_size
391+
font_size = getattr(vmobject, "font_size", DEFAULT_FONT_SIZE)
391392
if font_size < 20 or font_size > 6 * DEFAULT_FONT_SIZE:
392393
# adjust stroke_width if font_size is too small or too big
393394
return (font_size / DEFAULT_FONT_SIZE) * DEFAULT_STROKE_WIDTH * scale_factor

0 commit comments

Comments
 (0)