Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Gradient Text Rendering, Resolves Issue #4096 #4099

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions manim/mobject/text/text_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ def _text2hash(self, color: ManimColor):
settings += str(self.t2f) + str(self.t2s) + str(self.t2w) + str(self.t2c)
settings += str(self.line_spacing) + str(self._font_size)
settings += str(self.disable_ligatures)
settings += str(self.gradient)
id_str = self.text + settings
hasher = hashlib.sha256()
hasher.update(id_str.encode())
Expand All @@ -703,7 +704,7 @@ def _merge_settings(
default = default_args[arg]
if left != default and getattr(right_setting, arg) != default:
raise ValueError(
f"Ambiguous style for text '{self.text[right_setting.start:right_setting.end]}':"
f"Ambiguous style for text '{self.text[right_setting.start : right_setting.end]}':"
+ f"'{arg}' cannot be both '{left}' and '{right}'."
)
setattr(right_setting, arg, left if left != default else right)
Expand Down Expand Up @@ -1561,7 +1562,7 @@ def register_font(font_file: str | Path):
logger.debug("Found file at %s", file_path.absolute())
break
else:
error = f"Can't find {font_file}." f"Tried these : {possible_paths}"
error = f"Can't find {font_file}.Tried these : {possible_paths}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a bad idea to make this error a bit more readable:

Suggested change
error = f"Can't find {font_file}.Tried these : {possible_paths}"
error = f"Can't find {font_file}. Checked paths: {possible_paths}"

raise FileNotFoundError(error)

try:
Expand Down
Loading