ManimPango 0.4.3__cp310-cp310-win32.whl → 1.0.0a2__cp310-cp310-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/METADATA +2 -2
- ManimPango-1.0.0a2.dist-info/RECORD +85 -0
- {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/WHEEL +1 -1
- manimpango/__init__.py +5 -7
- manimpango/_distributor_init.py +36 -0
- manimpango/_version.py +1 -1
- manimpango/attributes/__init__.py +324 -0
- manimpango/attributes/attributes.pxi +219 -0
- manimpango/buffer.pxi +15 -0
- manimpango/cmanimpango.c +10025 -0
- manimpango/cmanimpango.cp310-win32.pyd +0 -0
- manimpango/enums.c +3721 -0
- manimpango/enums.cp310-win32.pyd +0 -0
- manimpango/enums.pyx +1 -10
- manimpango/exceptions.py +5 -0
- manimpango/fonts/__init__.py +153 -0
- manimpango/fonts/_font_desc.c +7576 -0
- manimpango/fonts/_font_desc.cp310-win32.pyd +0 -0
- manimpango/fonts/_font_desc.pxd +5 -0
- manimpango/fonts/_font_desc.pyi +25 -0
- manimpango/fonts/_font_desc.pyx +114 -0
- manimpango/fonts/enums.c +3628 -0
- manimpango/fonts/enums.cp310-win32.pyd +0 -0
- manimpango/fonts/enums.pyi +23 -0
- manimpango/fonts/enums.pyx +84 -0
- manimpango/{cairo.pxd → include/cairo.pxd} +21 -0
- manimpango/include/glib.pxd +36 -0
- manimpango/{pango.pxd → include/pango.pxd} +61 -0
- manimpango/include/pango_attributes.pxd +184 -0
- manimpango/layout/__init__.py +266 -0
- manimpango/layout/_layout.c +8630 -0
- manimpango/layout/_layout.cp310-win32.pyd +0 -0
- manimpango/layout/_layout.pyx +60 -0
- manimpango/layout/layout.pxi +52 -0
- manimpango/register_font.c +5016 -0
- manimpango/register_font.cp310-win32.pyd +0 -0
- manimpango/renderer/__init__.py +5 -0
- manimpango/renderer/cairo_utils.pxi +72 -0
- manimpango/renderer/image_renderer.c +12319 -0
- manimpango/renderer/image_renderer.cp310-win32.pyd +0 -0
- manimpango/renderer/image_renderer.pxd +23 -0
- manimpango/renderer/image_renderer.pyi +21 -0
- manimpango/renderer/image_renderer.pyx +219 -0
- manimpango/renderer/svg_renderer.c +10671 -0
- manimpango/renderer/svg_renderer.cp310-win32.pyd +0 -0
- manimpango/renderer/svg_renderer.pxd +23 -0
- manimpango/renderer/svg_renderer.pyi +17 -0
- manimpango/renderer/svg_renderer.pyx +174 -0
- manimpango/utils/__init__.py +3 -0
- manimpango/utils/_utils.cp310-win32.pyd +0 -0
- manimpango/utils/_utils.pyi +2 -0
- manimpango/utils/utils.c +3533 -0
- manimpango/{utils.py → utils/utils.py} +3 -1
- manimpango/utils/utils.pyx +27 -0
- ManimPango-0.4.3.dist-info/RECORD +0 -44
- manimpango/glib.pxd +0 -13
- {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE +0 -0
- {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE.win32 +0 -0
- {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/top_level.txt +0 -0
- /manimpango/{CORE_MANIM_cairo-2.dll → .libs/CORE_MANIM_cairo-2.dll} +0 -0
- /manimpango/{CORE_MANIM_cairo-gobject-2.dll → .libs/CORE_MANIM_cairo-gobject-2.dll} +0 -0
- /manimpango/{CORE_MANIM_cairo-script-interpreter-2.dll → .libs/CORE_MANIM_cairo-script-interpreter-2.dll} +0 -0
- /manimpango/{CORE_MANIM_expat.dll → .libs/CORE_MANIM_expat.dll} +0 -0
- /manimpango/{CORE_MANIM_ffi-7.dll → .libs/CORE_MANIM_ffi-7.dll} +0 -0
- /manimpango/{CORE_MANIM_fontconfig-1.dll → .libs/CORE_MANIM_fontconfig-1.dll} +0 -0
- /manimpango/{CORE_MANIM_freetype-6.dll → .libs/CORE_MANIM_freetype-6.dll} +0 -0
- /manimpango/{CORE_MANIM_fribidi-0.dll → .libs/CORE_MANIM_fribidi-0.dll} +0 -0
- /manimpango/{CORE_MANIM_gio-2.0-0.dll → .libs/CORE_MANIM_gio-2.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_glib-2.0-0.dll → .libs/CORE_MANIM_glib-2.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_gmodule-2.0-0.dll → .libs/CORE_MANIM_gmodule-2.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_gobject-2.0-0.dll → .libs/CORE_MANIM_gobject-2.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_gthread-2.0-0.dll → .libs/CORE_MANIM_gthread-2.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_harfbuzz-gobject.dll → .libs/CORE_MANIM_harfbuzz-gobject.dll} +0 -0
- /manimpango/{CORE_MANIM_harfbuzz-subset.dll → .libs/CORE_MANIM_harfbuzz-subset.dll} +0 -0
- /manimpango/{CORE_MANIM_harfbuzz.dll → .libs/CORE_MANIM_harfbuzz.dll} +0 -0
- /manimpango/{CORE_MANIM_intl-8.dll → .libs/CORE_MANIM_intl-8.dll} +0 -0
- /manimpango/{CORE_MANIM_pango-1.0-0.dll → .libs/CORE_MANIM_pango-1.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_pangocairo-1.0-0.dll → .libs/CORE_MANIM_pangocairo-1.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_pangoft2-1.0-0.dll → .libs/CORE_MANIM_pangoft2-1.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_pangowin32-1.0-0.dll → .libs/CORE_MANIM_pangowin32-1.0-0.dll} +0 -0
- /manimpango/{CORE_MANIM_pixman-1-0.dll → .libs/CORE_MANIM_pixman-1-0.dll} +0 -0
- /manimpango/{CORE_MANIM_png16-16.dll → .libs/CORE_MANIM_png16-16.dll} +0 -0
- /manimpango/{CORE_MANIM_z.dll → .libs/CORE_MANIM_z.dll} +0 -0
Binary file
|
@@ -0,0 +1,72 @@
|
|
1
|
+
from cairo cimport *
|
2
|
+
from pango cimport *
|
3
|
+
|
4
|
+
from ..layout import Layout
|
5
|
+
|
6
|
+
include "../attributes/attributes.pxi"
|
7
|
+
include "../layout/layout.pxi"
|
8
|
+
|
9
|
+
cdef str is_context_fine(cairo_t* context):
|
10
|
+
cdef cairo_status_t status
|
11
|
+
status = cairo_status(context)
|
12
|
+
if status == CAIRO_STATUS_NO_MEMORY:
|
13
|
+
cairo_destroy(context)
|
14
|
+
raise MemoryError("Cairo returned memory error")
|
15
|
+
elif status != CAIRO_STATUS_SUCCESS:
|
16
|
+
temp_bytes = <bytes>cairo_status_to_string(status)
|
17
|
+
return temp_bytes.decode('utf-8')
|
18
|
+
return ""
|
19
|
+
|
20
|
+
cdef cairo_t* create_cairo_context_from_surface(cairo_surface_t* surface):
|
21
|
+
cr = cairo_create(surface)
|
22
|
+
status = cairo_status(cr)
|
23
|
+
|
24
|
+
if cr is NULL or status == CAIRO_STATUS_NO_MEMORY:
|
25
|
+
cairo_destroy(cr)
|
26
|
+
cairo_surface_destroy(surface)
|
27
|
+
raise MemoryError("Cairo.Context can't be created.")
|
28
|
+
elif status != CAIRO_STATUS_SUCCESS:
|
29
|
+
cairo_destroy(cr)
|
30
|
+
cairo_surface_destroy(surface)
|
31
|
+
# TODO: raise specific excpetions
|
32
|
+
raise Exception(cairo_status_to_string(status))
|
33
|
+
|
34
|
+
return cr
|
35
|
+
|
36
|
+
cdef PangoLayout* create_pango_layout(cairo_t* context):
|
37
|
+
# the resulting layout should be freed seperately
|
38
|
+
cdef PangoLayout* layout = pango_cairo_create_layout(context)
|
39
|
+
if layout is NULL:
|
40
|
+
cairo_destroy(context)
|
41
|
+
raise MemoryError("Pango.Layout can't be created from Cairo Context.")
|
42
|
+
return layout
|
43
|
+
|
44
|
+
cdef PangoFontDescription* create_font_desc():
|
45
|
+
# the resulting font_desc should be freed seperately
|
46
|
+
pango_font_desc = pango_font_description_new()
|
47
|
+
if pango_font_desc is NULL:
|
48
|
+
raise MemoryError("pango_font_description_new() returned NULL")
|
49
|
+
|
50
|
+
return pango_font_desc
|
51
|
+
|
52
|
+
cdef PangoAttrList* create_attr_list():
|
53
|
+
# the resulting attr_list should be freed seperately
|
54
|
+
attr_list = pango_attr_list_new()
|
55
|
+
if attr_list is NULL:
|
56
|
+
raise MemoryError("pango_attr_list_new() returned NULL")
|
57
|
+
|
58
|
+
return attr_list
|
59
|
+
|
60
|
+
cdef pyfontdesc_to_pango_font_desc(PangoFontDescription* font_desc, object py_font_desc):
|
61
|
+
if py_font_desc.family:
|
62
|
+
pango_font_description_set_family(
|
63
|
+
font_desc, py_font_desc.family.encode())
|
64
|
+
if py_font_desc.size:
|
65
|
+
pango_font_description_set_size(font_desc,
|
66
|
+
py_font_desc.size * PANGO_SCALE)
|
67
|
+
pango_font_description_set_style(font_desc,
|
68
|
+
py_font_desc.style.value)
|
69
|
+
pango_font_description_set_weight(font_desc,
|
70
|
+
py_font_desc.weight.value)
|
71
|
+
pango_font_description_set_variant(font_desc,
|
72
|
+
py_font_desc.variant.value)
|