@@ -94,6 +94,7 @@ def construct(self):
94
94
from ..animation .animation import Animation
95
95
from ..animation .composition import Succession
96
96
from ..mobject .mobject import Group , Mobject
97
+ from ..mobject .svg .svg_mobject import SVGMobject
97
98
from ..mobject .types .vectorized_mobject import VMobject
98
99
from ..utils .bezier import integer_interpolate
99
100
from ..utils .rate_functions import double_smooth , linear
@@ -293,9 +294,8 @@ def interpolate_submobject(
293
294
294
295
295
296
class Write (DrawBorderThenFill ):
296
- """Simulate hand-writing a text-based mobject, such as :class:`~.Text`,
297
- :class:`~.MarkupText`, :class:`~.Tex`, :class:`~.MathTex`,
298
- or :class:`~.VMobject` in general.
297
+ """Simulate hand-writing a text-based mobject, such as :class:`~.Text`
298
+ and :class:`~.Tex`, or simulate hand-drawing a :class:`~.VMobject`.
299
299
300
300
Parameters
301
301
----------
@@ -344,7 +344,6 @@ def __init__(
344
344
reverse : bool = False ,
345
345
** kwargs ,
346
346
) -> None :
347
- self ._typecheck_input (vmobject )
348
347
run_time : float | None = kwargs .pop ("run_time" , None )
349
348
lag_ratio : float | None = kwargs .pop ("lag_ratio" , None )
350
349
run_time , lag_ratio = self ._set_default_config_from_length (
@@ -387,17 +386,14 @@ def _adjust_stroke_width_for_text(
387
386
) -> float :
388
387
if stroke_width is not None :
389
388
return stroke_width
390
- if vmobject .height != 0 :
391
- # if the height is zero, accessing font_size causes ZeroDivisionError
392
- font_size = getattr (vmobject , "font_size" , DEFAULT_FONT_SIZE )
393
- if font_size < 20 or font_size > 6 * DEFAULT_FONT_SIZE :
394
- # Assuming the user is using MovingCameraScene and performing a zoom-in or zoom-out
395
- return (
396
- (font_size / DEFAULT_FONT_SIZE )
397
- * DEFAULT_STROKE_WIDTH
398
- * scale_factor
399
- )
400
- return 2 # default in DrawBorderThenFill
389
+ if not isinstance (vmobject , SVGMobject ) or vmobject .height == 0 :
390
+ return 2
391
+ font_size = getattr (vmobject , "font_size" , DEFAULT_FONT_SIZE )
392
+ if font_size < 20 or font_size > 6 * DEFAULT_FONT_SIZE :
393
+ # adjust stroke_width if font_size is too small or too big
394
+ return (font_size / DEFAULT_FONT_SIZE ) * DEFAULT_STROKE_WIDTH * scale_factor
395
+ else :
396
+ return 2
401
397
402
398
def reverse_submobjects (self ) -> None :
403
399
self .mobject .invert (recursive = True )
0 commit comments