mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
fix Text incorrect coloring
This commit is contained in:
@ -52,6 +52,7 @@ class Text(SVGMobject):
|
||||
self.text = text_without_tabs
|
||||
file_name = self.text2svg()
|
||||
PangoUtils.remove_last_M(file_name)
|
||||
self.remove_empty_path(file_name)
|
||||
SVGMobject.__init__(self, file_name, **config)
|
||||
self.text = text
|
||||
if self.disable_ligatures:
|
||||
@ -67,6 +68,13 @@ class Text(SVGMobject):
|
||||
if self.height is None:
|
||||
self.scale(TEXT_MOB_SCALE_FACTOR * self.font_size)
|
||||
|
||||
def remove_empty_path(self, file_name):
|
||||
with open(file_name, 'r') as fpr:
|
||||
content = fpr.read()
|
||||
content = re.sub(r'<path .*?d=""/>', '', content)
|
||||
with open(file_name, 'w') as fpw:
|
||||
fpw.write(content)
|
||||
|
||||
def apply_space_chars(self):
|
||||
submobs = self.submobjects.copy()
|
||||
for char_index in range(len(self.text)):
|
||||
|
Reference in New Issue
Block a user