Skip to content

Instantly share code, notes, and snippets.

@uwezi
Last active May 23, 2024 14:42
Show Gist options
  • Save uwezi/1099f42aaed45b503628d6c71fb508c8 to your computer and use it in GitHub Desktop.
Save uwezi/1099f42aaed45b503628d6c71fb508c8 to your computer and use it in GitHub Desktop.
[font for DecimalNumber] render DecimalNumber objects in different fonts. #manim #decimalnumber #integer #font
from manim.mobject.text.numbers import string_to_mob_map as cache
# https://discord.com/channels/581738731934056449/1243063440206073907/1243210818837811230
class numText(Text):
def __init__(self, text: str, **kwargs) -> None:
print('hello')
super().__init__(text, font="Roboto", **kwargs)
class Test(Scene):
def construct(self):
num0 = DecimalNumber(1234567.789)
cache.clear()
num1 = DecimalNumber(1234567.789, mob_class=numText).next_to(num0, DOWN)
cache.clear()
num2 = Integer(98765).next_to(num1, DOWN)
cache.clear()
num3 = Integer(98765, mob_class=numText).next_to(num2, DOWN)
self.add(num0,num1,num2,num3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment