Skip to content

Commit 7f28769

Browse files
Aathish04Aathish Sivasubrahmanian
and
Aathish Sivasubrahmanian
authored
Use file_writer_config instead of config to get text_dir for Text() (#220)
* Use file_writer_config instead if config for Text() Fixes a bug where a keyerror would be thrown when rendering a Text() mobject. * Make testing_utils.py use file_writer_config. Thank you @huguesdevimeux ! Co-authored-by: Aathish Sivasubrahmanian <aathishs@Aathishs-MacBook-Air.local>
1 parent f4c9c7a commit 7f28769

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

manim/mobject/svg/text_mobject.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import cairo
66

77
from ...constants import *
8-
from ...config import config
8+
from ...config import config,file_writer_config
99
from ...container.container import Container
1010
from ...logger import logger
1111
from ...mobject.geometry import Dot, Rectangle
@@ -96,7 +96,7 @@ def __init__(self, text, **config):
9696
def get_space_width(self):
9797
size = self.size * 10
9898

99-
dir_name = config['text_dir']
99+
dir_name = file_writer_config['text_dir']
100100
file_name = os.path.join(dir_name, "space") + '.svg'
101101

102102
surface = cairo.SVGSurface(file_name, 600, 400)
@@ -291,8 +291,7 @@ def text2svg(self):
291291
if self.font == '':
292292
if NOT_SETTING_FONT_MSG != '':
293293
logger.warning(NOT_SETTING_FONT_MSG)
294-
295-
dir_name = config['text_dir']
294+
dir_name = file_writer_config['text_dir']
296295
hash_name = self.text2hash()
297296
file_name = os.path.join(dir_name, hash_name)+'.svg'
298297
if os.path.exists(file_name):

tests/testing_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def __init__(self, scene_object, module_tested, caching_needed=False):
3838
self.path_tests_data = os.path.join('tests', 'tests_data', module_tested)
3939

4040
if caching_needed:
41-
config['text_dir'] = os.path.join(
41+
file_writer_config['text_dir'] = os.path.join(
4242
self.path_tests_medias_cache, scene_object.__name__, 'Text')
4343
file_writer_config['tex_dir'] = os.path.join(
4444
self.path_tests_medias_cache, scene_object.__name__, 'Tex')

0 commit comments

Comments
 (0)