ManimPango 0.4.3__cp38-cp38-win32.whl → 1.0.0a2__cp38-cp38-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.cp38-win32.pyd +0 -0
- manimpango/enums.c +3721 -0
- manimpango/enums.cp38-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.cp38-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.cp38-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.cp38-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.cp38-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.cp38-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.cp38-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.cp38-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,60 @@
|
|
1
|
+
from cairo cimport *
|
2
|
+
from pango cimport *
|
3
|
+
|
4
|
+
from . import Layout
|
5
|
+
|
6
|
+
include "../renderer/cairo_utils.pxi"
|
7
|
+
|
8
|
+
def get_bbox(py_layout: Layout) -> tuple:
|
9
|
+
cdef cairo_surface_t* surface = cairo_image_surface_create(
|
10
|
+
CAIRO_FORMAT_ARGB32,
|
11
|
+
10,
|
12
|
+
10
|
13
|
+
)
|
14
|
+
if surface == NULL:
|
15
|
+
raise MemoryError("Cairo.ImageSurface can't be created.")
|
16
|
+
|
17
|
+
cdef cairo_t* cairo_context = create_cairo_context_from_surface(surface)
|
18
|
+
if cairo_context == NULL:
|
19
|
+
raise MemoryError("Cairo.Context can't be created.")
|
20
|
+
|
21
|
+
cdef PangoLayout* pango_layout = create_pango_layout(cairo_context)
|
22
|
+
if pango_layout == NULL:
|
23
|
+
raise MemoryError("Pango.Layout can't be created.")
|
24
|
+
|
25
|
+
cdef PangoAttrList* pango_attr_list = create_attr_list()
|
26
|
+
if pango_attr_list == NULL:
|
27
|
+
raise MemoryError("Pango.AttrList can't be created.")
|
28
|
+
|
29
|
+
cdef PangoFontDescription* pango_font_desc = create_font_desc()
|
30
|
+
if pango_font_desc == NULL:
|
31
|
+
raise MemoryError("Pango.FontDescription can't be created.")
|
32
|
+
|
33
|
+
pylayout_to_pango_layout(
|
34
|
+
pango_layout,
|
35
|
+
py_layout,
|
36
|
+
pango_attr_list
|
37
|
+
)
|
38
|
+
|
39
|
+
pyfontdesc_to_pango_font_desc(pango_font_desc, py_layout.font_desc)
|
40
|
+
|
41
|
+
pango_layout_set_font_description(
|
42
|
+
pango_layout,
|
43
|
+
pango_font_desc
|
44
|
+
)
|
45
|
+
|
46
|
+
cdef PangoRectangle ink_rect, logical_rect
|
47
|
+
pango_layout_get_pixel_extents (pango_layout, &ink_rect, &logical_rect)
|
48
|
+
|
49
|
+
pango_font_description_free(pango_font_desc)
|
50
|
+
pango_attr_list_unref(pango_attr_list)
|
51
|
+
g_object_unref(pango_layout)
|
52
|
+
cairo_destroy(cairo_context)
|
53
|
+
cairo_surface_destroy(surface)
|
54
|
+
|
55
|
+
return (
|
56
|
+
logical_rect.x,
|
57
|
+
logical_rect.y,
|
58
|
+
logical_rect.width,
|
59
|
+
logical_rect.height
|
60
|
+
)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
cdef pylayout_to_pango_layout(
|
2
|
+
PangoLayout* layout,
|
3
|
+
object py_layout,
|
4
|
+
PangoAttrList* attr_list,
|
5
|
+
):
|
6
|
+
if py_layout.text:
|
7
|
+
pango_layout_set_text(
|
8
|
+
layout,
|
9
|
+
py_layout.text.encode('utf-8'),
|
10
|
+
-1,
|
11
|
+
)
|
12
|
+
if py_layout.markup:
|
13
|
+
pango_layout_set_markup(
|
14
|
+
layout,
|
15
|
+
py_layout.markup.encode('utf-8'),
|
16
|
+
-1,
|
17
|
+
)
|
18
|
+
if py_layout.width:
|
19
|
+
pango_layout_set_width(
|
20
|
+
layout,
|
21
|
+
pango_units_from_double(py_layout.width),
|
22
|
+
)
|
23
|
+
if py_layout.height:
|
24
|
+
if py_layout.height > 0:
|
25
|
+
pango_layout_set_height(
|
26
|
+
layout,
|
27
|
+
pango_units_from_double(py_layout.height),
|
28
|
+
)
|
29
|
+
else:
|
30
|
+
pango_layout_set_height(
|
31
|
+
layout,
|
32
|
+
py_layout.height,
|
33
|
+
)
|
34
|
+
if py_layout.alignment:
|
35
|
+
pango_layout_set_alignment(
|
36
|
+
layout,
|
37
|
+
py_layout.alignment.value,
|
38
|
+
)
|
39
|
+
if py_layout.attributes:
|
40
|
+
convert_to_pango_attributes(
|
41
|
+
py_layout.attributes,
|
42
|
+
attr_list,
|
43
|
+
)
|
44
|
+
pango_layout_set_attributes(
|
45
|
+
layout,
|
46
|
+
attr_list,
|
47
|
+
)
|
48
|
+
if py_layout.justify:
|
49
|
+
pango_layout_set_justify(
|
50
|
+
layout,
|
51
|
+
py_layout.justify,
|
52
|
+
)
|