3b1b / 3b1b/manim

How to choose a font with Text object?

未關閉
#884 48 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Python
星號
93.9k
分支
7.7k
平均合併
2 天 13 小時
30 天內合併 PR
4

描述

This code does not change the font and letter become distorted (click on the image to enlarge and look at letters: `B, D, f, g, P, U...`):
```
script = '''
AaBbCcDdEeFfGg
HhIiJjKkLlMmNn
OoPpQqRrSsTtUu
VvWwXxYyZz
'''

class WriteText(Scene):
def construct(self):
text = Text(script, font='/usr/share/fonts/truetype/open-sans/OpenSans-Regular.ttf')
self.play(Write(text))
self.wait(.1)
```
`!python3 -m manim example_scenes.py WriteText -r 480,854`
![image](https://user-images.githubusercontent.com/35609308/74466920-00a63e80-4eba-11ea-9bbb-cf11407616ab.png)

If I change this line the result is kind of similar to the target, but I can't choose `regular` and letters are distorted (look at the small `g` it has a stair on the top):
`text = Text(script, font="Open Sans")`
![image](https://user-images.githubusercontent.com/35609308/74467977-e5d4c980-4ebb-11ea-9e91-6ee2bc882828.png)

貢獻指南

這個儲存庫沒有索引到貢獻指南

研究方向

查看 manim 原始碼中的 Text 類別,可能在 manimlib/mobject/svg/text_mobject.py 或類似位置。調查字體路徑是如何處理和渲染的。執行提供的腳本以重現失真,然後檢查字體載入和文字渲染邏輯。檢查是否有現有文字渲染測試以了解預期行為。

由索引模型根據 Issue 內容生成。

評估

領域
computer-graphics
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
停滯
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。