Skip to content

Commit 439e1fb

Browse files
committed
Merge branch 'master' into refactor-config-subpkg
2 parents 504ac73 + e809542 commit 439e1fb

File tree

23 files changed

+988
-244
lines changed

23 files changed

+988
-244
lines changed

.github/manimdependency.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"windows": {
3-
"ffmpeg": "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.1-2020-09-21-full_build.zip"
3+
"ffmpeg": "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.1-2020-09-21-full_build.zip",
4+
"pango": "v0.1.0"
45
}
5-
}
6+
}

.github/workflows/ci.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ jobs:
6060
brew cask install basictex
6161
eval "$(/usr/libexec/path_helper -s)"
6262
sudo tlmgr update --self
63+
brew install pkg-config
64+
brew install libffi
65+
brew install pango
66+
brew install glib
6367
sudo tlmgr install standalone preview doublestroke relsize fundus-calligra wasysym physics dvisvgm.x86_64-darwin dvisvgm rsfs wasy cm-super
6468
echo "::add-path::$HOME/.poetry/bin"
6569
echo "::set-env name=PATH::$PATH"
@@ -76,6 +80,7 @@ jobs:
7680
if: runner.os == 'Windows' && steps.cache-windows.outputs.cache-hit != 'true'
7781
run: |
7882
$ffmpegUrl = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['ffmpeg'])"
83+
$pangoVersion = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['pango'])"
7984
$OriPath = $env:PATH
8085
echo "Install Tinytex"
8186
Invoke-WebRequest "https://ci.appveyor.com/api/projects/yihui/tinytex/artifacts/TinyTeX.zip?job=image:%20Visual%20Studio%202019" -O "$($env:TMP)\TinyTex.zip"
@@ -88,12 +93,16 @@ jobs:
8893
Invoke-WebRequest "$ffmpegUrl" -O "$($env:TMP)\ffmpeg.zip"
8994
7z x "$($env:TMP)\ffmpeg.zip" -o"$($PWD)\ManimCache"
9095
Move-Item "ManimCache\ffmpeg-*" "ManimCache\FFmpeg"
96+
Invoke-WebRequest "https://github.com/ManimCommunity/manim-windows/releases/download/$($pangoVersion)/pango-windows-binaires-x64.zip" -O "$($env:TMP)\Pango.zip"
97+
mkdir "$($PWD)\ManimCache\Pango"
98+
7z x "$($env:TMP)\Pango.zip" -o"$($PWD)\ManimCache\Pango"
9199
92100
- name: Add Windows dependecies to path
93101
if: runner.os == 'Windows'
94102
run: |
95103
$env:Path += ";" + "$($PWD)\ManimCache\FFmpeg\bin"
96104
$env:Path += ";" + "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\win32"
105+
$env:Path += ";" + "$($PWD)\ManimCache\Pango\pango"
97106
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
98107
echo "::set-env name=Path::$env:Path"
99108

docs/source/_templates/autosummary/class.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
.. currentmodule:: {{ module }}
44

55
.. autoclass:: {{ objname }}
6+
:show-inheritance:
67
:members:
78

89
{% block methods %}

docs/source/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Mobjects, Scenes, and Animations
6666
#. :code:`VGroup` now supports printing the class names of contained mobjects and :code:`VDict` supports printing the internal dict of mobjects
6767
#. :code:`Scene` now renders when :code:`Scene.render()` is called rather than upon instantiation.
6868
#. :code:`ValueTracker` now supports increment using the `+=` operator (in addition to the already existing `increment_value` method)
69+
#. Add :class:`PangoText` for rendering texts using Pango.
6970

7071

7172
Documentation

docs/source/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# documentation root, use os.path.abspath to make it absolute, like shown here.
1212

1313
import os
14+
import subprocess
1415
import sys
1516
from distutils.sysconfig import get_python_lib
1617

@@ -19,8 +20,12 @@
1920

2021

2122
if os.environ.get("READTHEDOCS") == "True":
22-
# we need to add ffmpeg to the path
2323
site_path = get_python_lib()
24+
# bindings for pangocffi, cairocffi, pangocairocffi need to be generated
25+
subprocess.run(["python", "pangocffi/ffi_build.py"], cwd=site_path)
26+
subprocess.run(["python", "cairocffi/ffi_build.py"], cwd=site_path)
27+
subprocess.run(["python", "pangocairocffi/ffi_build.py"], cwd=site_path)
28+
# we need to add ffmpeg to the path
2429
ffmpeg_path = os.path.join(site_path, "imageio_ffmpeg", "binaries")
2530
# the included binary is named ffmpeg-linux..., create a symlink
2631
[ffmpeg_bin] = [

docs/source/examples/advanced_projects.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ Advanced Projects
2929

3030
def add_x_labels(self):
3131
x_labels = [
32-
TexMobject("\pi"), TexMobject("2 \pi"),
33-
TexMobject("3 \pi"), TexMobject("4 \pi"),
32+
MathTex("\pi"), MathTex("2 \pi"),
33+
MathTex("3 \pi"), MathTex("4 \pi"),
3434
]
3535

3636
for i in range(len(x_labels)):

docs/source/examples/annotations.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,35 @@ Annotations
1515
b2text = b2.get_tex("x-x_1")
1616
self.add(dot, dot2, line, b1, b2, b1text, b2text)
1717

18+
.. manim:: ExampleArrow
19+
:quality: medium
20+
:save_last_frame:
21+
22+
class ExampleArrow(Scene):
23+
def construct(self):
24+
dot = Dot(ORIGIN)
25+
arrow = Arrow(ORIGIN, [2, 2, 0], buff=0)
26+
numberplane = NumberPlane()
27+
origin_text = TextMobject('(0, 0)').next_to(dot, DOWN)
28+
tip_text = TextMobject('(2, 2)').next_to(arrow.get_end(), RIGHT)
29+
self.add(numberplane, dot, arrow, origin_text, tip_text)
30+
31+
.. manim:: ExampleArrowTips
32+
:quality: medium
33+
:save_last_frame:
34+
35+
from manim.mobject.geometry import ArrowTriangleTip, ArrowSquareTip, ArrowSquareFilledTip,\
36+
ArrowCircleTip, ArrowCircleFilledTip
37+
class ExampleArrowTips(Scene):
38+
def construct(self):
39+
a00 = Arrow(start=[-2, 3, 0], end=[2, 3, 0], color=YELLOW)
40+
a11 = Arrow(start=[-2, 2, 0], end=[2, 2, 0], tip_shape=ArrowTriangleTip)
41+
a12 = Arrow(start=[-2, 1, 0], end=[2, 1, 0])
42+
a21 = Arrow(start=[-2, 0, 0], end=[2, 0, 0], tip_shape=ArrowSquareTip)
43+
a22 = Arrow([-2, -1, 0], [2, -1, 0], tip_shape=ArrowSquareFilledTip)
44+
a31 = Arrow([-2, -2, 0], [2, -2, 0], tip_shape=ArrowCircleTip)
45+
a32 = Arrow([-2, -3, 0], [2, -3, 0], tip_shape=ArrowCircleFilledTip)
46+
b11 = a11.copy().scale(0.5, scale_tips=True).next_to(a11, RIGHT)
47+
b12 = a12.copy().scale(0.5, scale_tips=True).next_to(a12, RIGHT)
48+
b21 = a21.copy().scale(0.5, scale_tips=True).next_to(a21, RIGHT)
49+
self.add(a00, a11, a12, a21, a22, a31, a32, b11, b12, b21)

docs/source/examples/formulas.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,14 @@
11
Formulas
22
=================================
33

4-
.. manim:: Formula1
5-
:save_last_frame:
64

7-
class Formula1(Scene):
8-
def construct(self):
9-
t = MathTex(r"\int_a^b f'(x) dx = f(b)- f(a)")
10-
self.add(t)
11-
self.wait(1)
125

136

147
.. manim:: MoveFrameBox
158

169
class MoveFrameBox(Scene):
1710
def construct(self):
18-
text=TexMobject(
11+
text=MathTex(
1912
"\\frac{d}{dx}f(x)g(x)=","f(x)\\frac{d}{dx}g(x)","+",
2013
"g(x)\\frac{d}{dx}f(x)"
2114
)
@@ -35,7 +28,7 @@ Formulas
3528

3629
class MoveBraces(Scene):
3730
def construct(self):
38-
text=TexMobject(
31+
text=MathTex(
3932
"\\frac{d}{dx}f(x)g(x)=", #0
4033
"f(x)\\frac{d}{dx}g(x)", #1
4134
"+", #2

docs/source/examples/text.rst

Lines changed: 2 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -9,108 +9,6 @@ Text
99
text = Text('Hello world').scale(3)
1010
self.add(text)
1111

12-
.. manim:: Example2Text
13-
:save_last_frame:
14-
15-
class Example2Text(Scene):
16-
def construct(self):
17-
text = Text('Hello world', color=BLUE).scale(3)
18-
self.add(text)
19-
20-
21-
.. manim:: Example3Text
22-
:save_last_frame:
23-
24-
class Example3Text(Scene):
25-
def construct(self):
26-
text = Text('Hello world', gradient=(BLUE, GREEN)).scale(3)
27-
self.add(text)
28-
29-
30-
.. manim:: Example4Text
31-
:save_last_frame:
32-
33-
class Example4Text(Scene):
34-
def construct(self):
35-
text = Text('Hello world', t2g={'world':(BLUE, GREEN)}).scale(3)
36-
self.add(text)
37-
38-
.. manim:: Example5Text
39-
:save_last_frame:
40-
41-
class Example5Text(Scene):
42-
def construct(self):
43-
text = Text('Hello world', font='Source Han Sans').scale(3)
44-
self.add(text)
45-
46-
.. manim:: Example5bText
47-
:save_last_frame:
48-
49-
class Example5bText(Scene):
50-
def construct(self):
51-
text = Text('Hello world', t2f={'world':'Forte'}).scale(3)
52-
self.add(text)
53-
54-
.. manim:: Example6Text
55-
:save_last_frame:
56-
57-
class Example6Text(Scene):
58-
def construct(self):
59-
text = Text('Hello world', slant=ITALIC).scale(3)
60-
self.add(text)
61-
62-
.. manim:: Example7Text
63-
:save_last_frame:
64-
65-
class Example7Text(Scene):
66-
def construct(self):
67-
text = Text('Hello world!', t2s={'world':ITALIC}).scale(3)
68-
self.add(text)
69-
70-
.. manim:: Example8Text
71-
:save_last_frame:
72-
73-
class Example8Text(Scene):
74-
def construct(self):
75-
text = Text('Hello world', weight=BOLD).scale(3)
76-
self.add(text)
77-
78-
.. manim:: Example9Text
79-
:save_last_frame:
80-
81-
class Example9Text(Scene):
82-
def construct(self):
83-
text = Text('Hello world', t2w={'world':BOLD}).scale(3)
84-
self.add(text)
85-
86-
.. manim:: Example10Text
87-
:save_last_frame:
88-
89-
class Example10Text(Scene):
90-
def construct(self):
91-
text = Text('Hello', size=0.3).scale(3)
92-
self.add(text)
93-
94-
.. manim:: Example11Text
95-
:save_last_frame:
96-
97-
class Example11Text(Scene):
98-
def construct(self):
99-
text = Text('Hello\nWorld', lsh=1.5).scale(3)
100-
self.add(text)
101-
102-
.. manim:: Example12Text
103-
:save_last_frame:
104-
105-
class Example12Text(Scene):
106-
def construct(self):
107-
text = Text(
108-
'Google',
109-
t2c={'[:1]':'#3174f0', '[1:2]':'#e53125',
110-
'[2:3]':'#fbb003', '[3:4]':'#3174f0',
111-
'[4:5]':'#269a43', '[5:]':'#e53125', }).scale(3)
112-
self.add(text)
113-
114-
`Text` works also with other languages like `你好` or `こんにちは` or `안녕하세요` or `مرحبا بالعالم`.
115-
Be sure you have the font that supports those languages!
12+
This is an example that illustrates how to use the :class:`~.Text` class.
11613

14+
In case you want to use other alphabets like `你好` or `こんにちは` or `안녕하세요` or `مرحبا بالعالم`, you can have a look at :class:`~.PangoText`

docs/source/installation/mac.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ To install cairo:
1515
1616
brew install cairo
1717
18+
To install Pango and it dependencies:
19+
20+
.. code-block:: bash
21+
22+
brew install pkg-config
23+
brew install libffi
24+
brew install pango
25+
brew install glib
26+
27+
1828
To install ffmpeg:
1929

2030
.. code-block:: bash

0 commit comments

Comments
 (0)