1
1
from xml.sax.saxutils import escape
2
- from .utils import *
3
- from .enums import Alignment
2
+ from .. utils import *
3
+ from .. enums import Alignment
4
4
import warnings
5
+ from glib cimport *
6
+ from cairo cimport *
7
+ from pango cimport *
8
+ import warnings
9
+
10
+ def raise_deprecation_warning (name ):
11
+ msg = (
12
+ " `manimpango.{n}` is a deprecated. "
13
+ " This warning may have happen because you have used newer "
14
+ " version of manimpango with older version of Manim. "
15
+ " Either upgrade Manim or downgrade ManimPango."
16
+ ).format(n = name)
17
+ warnings.warn(msg, DeprecationWarning , stacklevel = 2 )
5
18
6
19
class TextSetting :
7
20
""" Formatting for slices of a :class:`manim.mobject.svg.text_mobject.Text` object."""
@@ -14,6 +27,7 @@ class TextSetting:
14
27
weight ,
15
28
line_num = - 1
16
29
):
30
+ raise_deprecation_warning(" TextSetting" )
17
31
self .start = start
18
32
self .end = end
19
33
self .font = font.encode(' utf-8' )
@@ -34,6 +48,7 @@ def text2svg(
34
48
orig_text:str
35
49
) -> int:
36
50
"""Render an SVG file from a :class:`manim.mobject.svg.text_mobject.Text` object."""
51
+ raise_deprecation_warning("text2svg")
37
52
cdef cairo_surface_t* surface
38
53
cdef cairo_t* cr
39
54
cdef PangoFontDescription* font_desc
@@ -130,6 +145,7 @@ def text2svg(
130
145
class MarkupUtils:
131
146
@staticmethod
132
147
def validate(text: str ) -> bool:
148
+ raise_deprecation_warning("MarkupUtils.validate")
133
149
text_bytes = text.encode(" utf-8" )
134
150
return pango_parse_markup(text_bytes , -1, 0, NULL , NULL , NULL , NULL )
135
151
@@ -154,6 +170,7 @@ class MarkupUtils:
154
170
alignment: Alignment = None
155
171
) -> int:
156
172
"""Render an SVG file from a :class:`manim.mobject.svg.text_mobject.MarkupText` object."""
173
+ raise_deprecation_warning("MarkupUtils.text2svg")
157
174
cdef cairo_surface_t* surface
158
175
cdef cairo_t* context
159
176
cdef PangoFontDescription* font_desc
@@ -251,9 +268,3 @@ class MarkupUtils:
251
268
cairo_surface_destroy(surface )
252
269
g_object_unref(layout )
253
270
return file_name
254
-
255
- cpdef str pango_version():
256
- return pango_version_string().decode(' utf-8' )
257
-
258
- cpdef str cairo_version():
259
- return cairo_version_string().decode(' utf-8' )
0 commit comments