Skip to content

Commit 7b6ae92

Browse files
committed
scale stroke_width if font_size is too small or too big
1 parent 04cc8be commit 7b6ae92

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

manim/animation/creation.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ 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
9897
from ..mobject.types.vectorized_mobject import VMobject
9998
from ..utils.bezier import integer_interpolate
10099
from ..utils.rate_functions import double_smooth, linear
@@ -386,9 +385,9 @@ def _adjust_stroke_width_for_text(
386385
) -> float:
387386
if stroke_width is not None:
388387
return stroke_width
389-
if not isinstance(vmobject, SVGMobject) or vmobject.height == 0:
388+
if not hasattr(vmobject, "font_size") or vmobject.height == 0:
390389
return 2
391-
font_size = getattr(vmobject, "font_size", DEFAULT_FONT_SIZE)
390+
font_size = vmobject.font_size
392391
if font_size < 20 or font_size > 6 * DEFAULT_FONT_SIZE:
393392
# adjust stroke_width if font_size is too small or too big
394393
return (font_size / DEFAULT_FONT_SIZE) * DEFAULT_STROKE_WIDTH * scale_factor

0 commit comments

Comments
 (0)