From d14f22c5ba2b2ae2a4cc595b33f61a2c2bf255f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=B9=A4=E7=BF=94=E4=B8=87=E9=87=8C?= <44120331+TonyCrane@users.noreply.github.com> Date: Sat, 19 Jun 2021 13:11:36 +0800 Subject: [PATCH 1/4] Revert "Fixed the default size of Text" --- docs/source/development/changelog.rst | 1 - manimlib/mobject/svg/text_mobject.py | 22 ++++------------------ 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index 5fe48f08..573df074 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -16,7 +16,6 @@ Fixed bugs - Fixed chaining animation in example scenes - Fixed the default color of tip - Fixed a typo in ``ShowPassingFlashWithThinningStrokeWidth`` -- Fixed the default size of ``Text`` New Features ^^^^^^^^^^^^ diff --git a/manimlib/mobject/svg/text_mobject.py b/manimlib/mobject/svg/text_mobject.py index 39e8ff25..ed173272 100644 --- a/manimlib/mobject/svg/text_mobject.py +++ b/manimlib/mobject/svg/text_mobject.py @@ -11,14 +11,14 @@ import manimpango from manimlib.constants import * from manimlib.mobject.geometry import Dot from manimlib.mobject.svg.svg_mobject import SVGMobject -from manimlib.mobject.svg.tex_mobject import TexText from manimlib.mobject.types.vectorized_mobject import VGroup from manimlib.utils.config_ops import digest_config from manimlib.utils.customization import get_customization -from manimlib.utils.directories import get_downloads_dir, get_text_dir, get_temp_dir +from manimlib.utils.directories import get_downloads_dir, get_text_dir from manimpango import PangoUtils from manimpango import TextSetting +TEXT_MOB_SCALE_FACTOR = 1/100 DEFAULT_LINE_SPACING_SCALE = 0.3 class Text(SVGMobject): @@ -42,7 +42,6 @@ class Text(SVGMobject): "t2s": {}, "t2w": {}, "disable_ligatures": True, - "debug": False, } def __init__(self, text, **config): @@ -78,21 +77,8 @@ class Text(SVGMobject): self.set_color_by_t2g() # anti-aliasing - if self.height is None and not self.debug: - self.load_scale_factor() - self.scale(self.scale_factor * self.font_size) - - def load_scale_factor(self): - factor_file = os.path.join(get_temp_dir(), "text_scale_factor.txt") - if os.path.exists(factor_file): - with open(factor_file, 'r') as f: - self.scale_factor = float(f.read()) - else: - tex_height = TexText("b", font_size=1).get_height() - text_height = Text("b", font_size=1, debug=True).get_height() - self.scale_factor = tex_height / text_height - with open(factor_file, "w") as f: - f.write(str(self.scale_factor)) + if self.height is None: + self.scale(TEXT_MOB_SCALE_FACTOR) def remove_empty_path(self, file_name): with open(file_name, 'r') as fpr: From 892ce2db09c1ebd2bdad932ca442ee3495331111 Mon Sep 17 00:00:00 2001 From: TonyCrane <975062472@qq.com> Date: Sat, 19 Jun 2021 13:21:25 +0800 Subject: [PATCH 2/4] update docs --- docs/source/development/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/development/changelog.rst b/docs/source/development/changelog.rst index 573df074..5fe48f08 100644 --- a/docs/source/development/changelog.rst +++ b/docs/source/development/changelog.rst @@ -16,6 +16,7 @@ Fixed bugs - Fixed chaining animation in example scenes - Fixed the default color of tip - Fixed a typo in ``ShowPassingFlashWithThinningStrokeWidth`` +- Fixed the default size of ``Text`` New Features ^^^^^^^^^^^^ From 663c57ba74a55be103a3c1cec0c0dffe04db77d7 Mon Sep 17 00:00:00 2001 From: TonyCrane <975062472@qq.com> Date: Sat, 19 Jun 2021 19:33:53 +0800 Subject: [PATCH 3/4] a little fix to TEXT_MOB_SCALE_FACTOR --- manimlib/mobject/svg/text_mobject.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manimlib/mobject/svg/text_mobject.py b/manimlib/mobject/svg/text_mobject.py index ed173272..e36f222e 100644 --- a/manimlib/mobject/svg/text_mobject.py +++ b/manimlib/mobject/svg/text_mobject.py @@ -18,7 +18,7 @@ from manimlib.utils.directories import get_downloads_dir, get_text_dir from manimpango import PangoUtils from manimpango import TextSetting -TEXT_MOB_SCALE_FACTOR = 1/100 +TEXT_MOB_SCALE_FACTOR = 0.0076 DEFAULT_LINE_SPACING_SCALE = 0.3 class Text(SVGMobject): From 892df54c9ffaf7abeb676a5d6c508b82263b50d9 Mon Sep 17 00:00:00 2001 From: TonyCrane <975062472@qq.com> Date: Sat, 19 Jun 2021 20:13:41 +0800 Subject: [PATCH 4/4] remove lsh in OpeningManimExample --- example_scenes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example_scenes.py b/example_scenes.py index 23896b17..799c50c0 100644 --- a/example_scenes.py +++ b/example_scenes.py @@ -15,7 +15,7 @@ class OpeningManimExample(Scene): The original motivation for manim was to better illustrate mathematical functions as transformations. - """, lsh=1.5) + """) intro_words.to_edge(UP) self.play(Write(intro_words))