ManimPango 1.0.0a1__cp310-cp310-macosx_10_9_x86_64.whl → 1.0.0a2__cp310-cp310-macosx_10_9_x86_64.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.
Files changed (30) hide show
  1. {ManimPango-1.0.0a1.dist-info → ManimPango-1.0.0a2.dist-info}/METADATA +1 -1
  2. {ManimPango-1.0.0a1.dist-info → ManimPango-1.0.0a2.dist-info}/RECORD +30 -26
  3. manimpango/_version.py +1 -1
  4. manimpango/attributes/attributes.pxi +219 -0
  5. manimpango/buffer.pxi +15 -0
  6. manimpango/cmanimpango.c +14 -14
  7. manimpango/cmanimpango.cpython-310-darwin.so +0 -0
  8. manimpango/enums.c +14 -14
  9. manimpango/enums.cpython-310-darwin.so +0 -0
  10. manimpango/fonts/_font_desc.c +137 -74
  11. manimpango/fonts/_font_desc.cpython-310-darwin.so +0 -0
  12. manimpango/fonts/_font_desc.pyx +3 -0
  13. manimpango/fonts/enums.c +14 -14
  14. manimpango/fonts/enums.cpython-310-darwin.so +0 -0
  15. manimpango/layout/_layout.c +14 -14
  16. manimpango/layout/_layout.cpython-310-darwin.so +0 -0
  17. manimpango/layout/layout.pxi +52 -0
  18. manimpango/register_font.c +14 -14
  19. manimpango/register_font.cpython-310-darwin.so +0 -0
  20. manimpango/renderer/cairo_utils.pxi +72 -0
  21. manimpango/renderer/image_renderer.c +14 -14
  22. manimpango/renderer/image_renderer.cpython-310-darwin.so +0 -0
  23. manimpango/renderer/svg_renderer.c +14 -14
  24. manimpango/renderer/svg_renderer.cpython-310-darwin.so +0 -0
  25. manimpango/utils/_utils.cpython-310-darwin.so +0 -0
  26. manimpango/utils/utils.c +14 -14
  27. {ManimPango-1.0.0a1.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE +0 -0
  28. {ManimPango-1.0.0a1.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE.bin +0 -0
  29. {ManimPango-1.0.0a1.dist-info → ManimPango-1.0.0a2.dist-info}/WHEEL +0 -0
  30. {ManimPango-1.0.0a1.dist-info → ManimPango-1.0.0a2.dist-info}/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ManimPango
3
- Version: 1.0.0a1
3
+ Version: 1.0.0a2
4
4
  Summary: Bindings for Pango for using with Manim.
5
5
  Home-page: https://manimpango.manim.community/
6
6
  Author: Naveen M K
@@ -1,47 +1,50 @@
1
- ManimPango-1.0.0a1.dist-info/RECORD,,
2
- ManimPango-1.0.0a1.dist-info/LICENSE,sha256=PkzdSXTMd8X-B3IFjUlsGc9eDGAM9x7DAt8iBgLj7sg,1067
3
- ManimPango-1.0.0a1.dist-info/WHEEL,sha256=doY7Ynwndq62v9G9yH4QQiKEI6qNEsMeVrkmo76vHLE,111
4
- ManimPango-1.0.0a1.dist-info/top_level.txt,sha256=_7RXNU2cbck8IbstWHzYv6YV58wtKUDBX-pmUjE6SKs,11
5
- ManimPango-1.0.0a1.dist-info/LICENSE.bin,sha256=qM2kte-MyVxokaHNRdgyYS0aH1yP2uLXfOwzqkLPtlA,160378
6
- ManimPango-1.0.0a1.dist-info/METADATA,sha256=Tqnkeh1RUKzumhnKUSoFjKBGaBbFUw1R8NpuBEtt0bo,8386
7
- manimpango/enums.c,sha256=Rk9nk3Vblb1j9iElAFbTPRdJvq-3hqkx3qqagZGLl1M,149541
1
+ ManimPango-1.0.0a2.dist-info/RECORD,,
2
+ ManimPango-1.0.0a2.dist-info/LICENSE,sha256=PkzdSXTMd8X-B3IFjUlsGc9eDGAM9x7DAt8iBgLj7sg,1067
3
+ ManimPango-1.0.0a2.dist-info/WHEEL,sha256=doY7Ynwndq62v9G9yH4QQiKEI6qNEsMeVrkmo76vHLE,111
4
+ ManimPango-1.0.0a2.dist-info/top_level.txt,sha256=_7RXNU2cbck8IbstWHzYv6YV58wtKUDBX-pmUjE6SKs,11
5
+ ManimPango-1.0.0a2.dist-info/LICENSE.bin,sha256=qM2kte-MyVxokaHNRdgyYS0aH1yP2uLXfOwzqkLPtlA,160378
6
+ ManimPango-1.0.0a2.dist-info/METADATA,sha256=JnK9Ut_Z8X8-yoDX4ZPSCMylQWZmWJTOsWFZ-csM6Fg,8386
7
+ manimpango/enums.c,sha256=VxKEhDIYIVzDfUM8e5wPh_9kFPUZA39WNLtj5ze4RCc,149541
8
8
  manimpango/cmanimpango.pxd,sha256=qmQydFpNgEPYcDtfDhcaiAhu6-WyvQA0Tth09fO0sl4,62
9
- manimpango/enums.cpython-310-darwin.so,sha256=pPSJHVuugUQHPE1r8oDF2xnbtdbgQdFHK1vV9l7CzNc,81696
10
- manimpango/_version.py,sha256=sIYCWfTgiDt6ZUL4kPhSN-3RYmVCmuFUEHU4t0cZzC0,48
11
- manimpango/cmanimpango.cpython-310-darwin.so,sha256=JgfntXWXBuZ4Iu_Ed4G42v6Zgn2yg1Oju-23Yc79o8E,142176
12
- manimpango/register_font.cpython-310-darwin.so,sha256=bNghZU5vvd4TgFKttumuz-mf7EIV4OmfkpPCO7gLJKQ,84944
13
- manimpango/register_font.c,sha256=cF7r3UBy-jZEHlMsMwfOce8ULandKwq7lMkoV1bcsZg,205452
9
+ manimpango/enums.cpython-310-darwin.so,sha256=rwi-jlNrih7kzQmYsI0IeGNCz8sTSxTvbufqthvR4ZU,81696
10
+ manimpango/_version.py,sha256=H0a6dwq3S70TBArE-MWODlthdJKYbS6PQo2yWPTHAIk,48
11
+ manimpango/cmanimpango.cpython-310-darwin.so,sha256=TjEn_JO_VzPgxOfgLQ9-QtBlywgTu3s2bJKMYdqUVGo,142176
12
+ manimpango/register_font.cpython-310-darwin.so,sha256=ihgu1eh6tW_y1Q5GIugZskTjXc-ZUoKoa9NIa4-fKck,84944
13
+ manimpango/register_font.c,sha256=6z6vtKO4ZgYjzeIZpYzsl4BpZGDJtCr3R6yCAWh4Zt0,205452
14
14
  manimpango/__init__.py,sha256=N4htCfNXQlJDUyk4aQPuEy2X94ET80LD5g1jYBQGOUA,1120
15
15
  manimpango/_distributor_init.py,sha256=KEvWgF0ScF4L5ZxHtCXfme3VsMc0bvpwmS1c0unBzYE,523
16
16
  manimpango/enums.pyx,sha256=0v02ywJtVb2pDk_kxL9hoXr7VxCN4Spn693QiWaU6XE,2266
17
17
  manimpango/register_font.pxd,sha256=QvOyEtJex0Vl5neHAgpSniu11Qzb8O5hLlCFCsfFBfM,1597
18
- manimpango/cmanimpango.c,sha256=FaHXdcXYth2j3lbWei4LAmTk7gnNvQY8BZZTeRCrpuM,418168
18
+ manimpango/cmanimpango.c,sha256=K4R1WAdTcUCAd8YE-Qrpj_rSLiz2X_HHeo_s3XWde6Y,418168
19
19
  manimpango/register_font.pyx,sha256=L2_ftxuZwZzFTUMOAGbVqhZNWkMtgdeXRFzMliQdZ0U,7309
20
20
  manimpango/exceptions.py,sha256=aZ2FNGwtPk-bApRs3d0QhuWNb8eYcpI9PcGZQwtbFeQ,141
21
21
  manimpango/cmanimpango.pyx,sha256=1B8lvoZdJdiQmyIK02pU6I7udIfiGDXueODpWFozthk,10438
22
- manimpango/renderer/svg_renderer.cpython-310-darwin.so,sha256=VdHQHBmNH-0uqqHYZj8sLc-MvUV7p1EqYqXmoe6HWao,135664
22
+ manimpango/buffer.pxi,sha256=izIeXKKbRafuzdurTworXck004e0pqVOGk9M9MA7ISs,404
23
+ manimpango/renderer/svg_renderer.cpython-310-darwin.so,sha256=B2xwR8sJVG4NDxe3WFuEvQ3Eblb-bdiq5apt-WJ930A,135664
23
24
  manimpango/renderer/svg_renderer.pyi,sha256=60MrH2fLj8lowxo9n0tWaxYAkw-vyWi4QP4IrOqlrlY,401
24
- manimpango/renderer/svg_renderer.c,sha256=FcpuvpdAHHxeYjdORxtyNjxF9BIaj2aWRENqovhR_Bs,448105
25
+ manimpango/renderer/svg_renderer.c,sha256=AubIdoVwhtIjhvmnEPTDlAoao6kKommxdG-seb95a0s,448105
25
26
  manimpango/renderer/__init__.py,sha256=V4MTFzxrCbUHC6lLlhPszdz0wHX86_W25DLXbg2Ht1A,186
26
27
  manimpango/renderer/image_renderer.pyx,sha256=RiBacUWEN73jEmCZEHNdsU8o6c_GeVEhxTRohCskvOM,6538
27
28
  manimpango/renderer/svg_renderer.pxd,sha256=XzirDbTz9uxxORGgoXNjK5y64ty1A6NWlXILTqMxiJg,539
28
- manimpango/renderer/image_renderer.c,sha256=nAwZieIgF2Sez3_bzW3rdWPpigKtTm9fVlaiMOMZmlU,521869
29
+ manimpango/renderer/image_renderer.c,sha256=PzWrcBzBGgwVNWTrjZpsQbbmZyUv1rNE5T1Z7b-LT-o,521869
29
30
  manimpango/renderer/svg_renderer.pyx,sha256=bDttE-VsogOPPDDoyIC7nm3hL1v_23e9V3j73i3Oc7M,5110
31
+ manimpango/renderer/cairo_utils.pxi,sha256=hcVLvQhkvfyMb6lZnx_f55ZudAAHPuDPWM_2vGlcxEo,2531
30
32
  manimpango/renderer/image_renderer.pxd,sha256=ijvm4t2D42981OneXhyfzriAMsD1eMF78xc8leo3C_Q,537
31
- manimpango/renderer/image_renderer.cpython-310-darwin.so,sha256=u46m5tMkKb87ZUEAkPWJlR84CYC71EXJkOwRW1AM2oc,144768
33
+ manimpango/renderer/image_renderer.cpython-310-darwin.so,sha256=92aMzqFgbSSIyqInZY0WazhQVEpihlvMAdUp1UfgQnM,144768
32
34
  manimpango/renderer/image_renderer.pyi,sha256=CyB1ubpsF5lsK88IPyY9sj5dR0Y4IuhLj4Ys3tkfM5A,500
33
35
  manimpango/layout/__init__.py,sha256=NTSgiHqqfNrG3qHUOtmEKxPEASYuQ7htzvoM5FGSbW8,7575
34
- manimpango/layout/_layout.c,sha256=x5mDB9PlDDEps3c3SUA9_3kMS0EfA4ZNcQQ3VbzwWl0,360866
36
+ manimpango/layout/_layout.c,sha256=gSQgGixH4kXUkbufJ1Cmcdtdj1ZtwoNSz84QmdEe27Q,360866
35
37
  manimpango/layout/_layout.pyx,sha256=DPdadzx94L2JZQJNrcruDuJOHK3HrHv9_91_vYMDM7A,1724
36
- manimpango/layout/_layout.cpython-310-darwin.so,sha256=2qRf2ddDaQeoTh8325QigIp5R1UVRFzPyjnfjfHo3V4,111088
38
+ manimpango/layout/_layout.cpython-310-darwin.so,sha256=QMjDjx0KPjDGWQqBqpibiO4yPqWg_ixfVBUHEDfuQ18,111088
39
+ manimpango/layout/layout.pxi,sha256=SWUi2za6U7L0Sa78Y1o3e98yjiWd8VuqWN8hoZbxuXQ,1337
37
40
  manimpango/include/cairo.pxd,sha256=ejJx_QEQtikfDt0hu3t6Ug-8ZVx3GpZeHvs4zODoNHw,1321
38
41
  manimpango/include/pango_attributes.pxd,sha256=m5Jy0H60jBis2iSkTuztqVlQYJJRUTD9oArxId6nYSU,5056
39
42
  manimpango/include/pango.pxd,sha256=9rgNLg4S5kxzwF4k7w0gByr6Dfd9EmvPHLs5gJnHBbg,5980
40
43
  manimpango/include/glib.pxd,sha256=Ikn7MziB8s8GSzcS3g0YkCJiNTYKUsQiVv-oc6Ugm0Y,871
41
- manimpango/utils/_utils.cpython-310-darwin.so,sha256=H9iXyk115WvRLG5RXsazLChaSgy4f2EeoRPqnMdjOqQ,61536
44
+ manimpango/utils/_utils.cpython-310-darwin.so,sha256=PCEgeIegOCzns8JgPhNBqo4ePbZnEn-ObsPSikceE_Q,61536
42
45
  manimpango/utils/__init__.py,sha256=LW3qbiPmn_vd1sMJ8TRRVeAHOFwf_vjxZ6V1Myj9Eps,107
43
46
  manimpango/utils/_utils.pyi,sha256=d0WDj5jC2WzdEumcW-OyTjKPfnnXjiWPkEfQoF1EqsY,110
44
- manimpango/utils/utils.c,sha256=VywNR7KAFVeNfbmnzaJfBppZYvfIzqwfpfeo8hYd230,136741
47
+ manimpango/utils/utils.c,sha256=ua4mt2dd2A8KbudWC1BnclTcB9k3evqxwCo9RFLgSSQ,136741
45
48
  manimpango/utils/utils.py,sha256=TcKSs2oJkFg_ipWzSpyF48owc1onrJmhNeyyb3Ja4_0,1648
46
49
  manimpango/utils/utils.pyx,sha256=oaUw-rPeIeUS3ux_FF9rrJtCU-tZPWr64pPl8ptqVWg,631
47
50
  manimpango/.dylibs/libpango-1.0.0.dylib,sha256=mg4Jtk8fMkuXqoxR3yJulksD5w_OPOMCnuEGA10hmpY,445424
@@ -62,14 +65,15 @@ manimpango/.dylibs/libfontconfig.1.dylib,sha256=o4KsB_j6lp2Ew5wWG8DCgOb4W_T9eNax
62
65
  manimpango/.dylibs/libffi.7.dylib,sha256=bWEx32zS9IZl-OwHLsh93-NcdBpA8rbLWnGHfcTsem8,73632
63
66
  manimpango/.dylibs/libpixman-1.0.dylib,sha256=uKzUTWdcGBbXVnLjAg-yliF4GzaUYpBs0Lv5evA7ljM,816768
64
67
  manimpango/.dylibs/libgio-2.0.0.dylib,sha256=UWYbPYIrYECmEQLAJVxuax-tle1O4S4De77T8U5yJHw,1919136
68
+ manimpango/attributes/attributes.pxi,sha256=VWMMCfG4m-ATs4qQLU6sNAYID3rhJF-voMItMZHp8w8,6079
65
69
  manimpango/attributes/__init__.py,sha256=E9pDNWijgWUTk8nxKdROthlhMfLt-vIwvIcXoNFxFao,10453
66
- manimpango/fonts/enums.c,sha256=VN-lFhOZGl-06fVXZulAoV4h_N0zP1eLcQrefzcoA9c,146008
67
- manimpango/fonts/_font_desc.pyx,sha256=t6wzOHJS4Yiw_mCL-VAJRTkq8hQ8FnmsY-ZTmN4t7Xw,3098
68
- manimpango/fonts/enums.cpython-310-darwin.so,sha256=Z-D-N8TJ9k9hw4PaDBRIGqqb8owrlWYGsvJ-AlcaoiA,64576
69
- manimpango/fonts/_font_desc.cpython-310-darwin.so,sha256=afHtB8QF8HCkUMhZdTPGYNgpTE9j-WEC6mC2Q-JQBSA,92224
70
+ manimpango/fonts/enums.c,sha256=Euc8ogH-m7tLKfLUXi1NkPjT4qDwBPhUOgrT1_bj4ik,146008
71
+ manimpango/fonts/_font_desc.pyx,sha256=oUuruTfWasLHczD7PwP_uS1y3mFHro_JpZSrTlfQ7Os,3272
72
+ manimpango/fonts/enums.cpython-310-darwin.so,sha256=VXRUFJBQ5snK7_odg_lCFIfBeaSWeeBduIMomY_TXsM,64576
73
+ manimpango/fonts/_font_desc.cpython-310-darwin.so,sha256=0s92M358tWH9qrMN5L790Hi3oAXzZDQreM5cxliNiqw,92752
70
74
  manimpango/fonts/__init__.py,sha256=e9PxTdK86y640cgLp49nxMBtU63RU7JY-DDJGnaWuKo,3989
71
75
  manimpango/fonts/enums.pyx,sha256=NY3khxIYTTtoZ9NLUgRI9GFgoFeOGXpkAyTbeTtBct0,2221
72
- manimpango/fonts/_font_desc.c,sha256=lKETXquJ-e9RcraC4SA1JiGu44yLfu97hI5hFLvbJ_g,303089
76
+ manimpango/fonts/_font_desc.c,sha256=3cYq_3WbLqwT4xS8ydnbisN9oMS0NZndQz7_WwsUai8,306310
73
77
  manimpango/fonts/_font_desc.pyi,sha256=u24xzGuJSk5XzBAyJ0qG2yZ_QmqnnTzSGdvmjRZm4HM,645
74
78
  manimpango/fonts/_font_desc.pxd,sha256=ahDwjhczn3Ogxb7eYp2uZuhxPyVLg6JyH2tgnOgl5Dg,99
75
79
  manimpango/fonts/enums.pyi,sha256=Jt1A9vRmeEUrtKSsyWCm5iP84_e2t9g6i_x8IvKf39o,367
manimpango/_version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = "1.0.0a1"
2
+ __version__ = "1.0.0a2"
@@ -0,0 +1,219 @@
1
+ from pango cimport *
2
+ from pango_attributes cimport *
3
+
4
+ from manimpango.attributes import TextAttribute
5
+
6
+
7
+ cdef PangoAttribute* raise_on_null_attr(PangoAttribute* ptr):
8
+ if not ptr:
9
+ raise MemoryError("Could not allocate memory for attribute")
10
+ return ptr
11
+
12
+ cdef set_indexes(PangoAttribute* attr, start_index: int, end_index: int):
13
+ """Sets the start and end indexes of a PangoAttribute.
14
+
15
+ Parameters
16
+ ----------
17
+ attr
18
+ The PangoAttribute to set the indexes for.
19
+ start_index
20
+ The start index.
21
+ end_index
22
+ The end index.
23
+ """
24
+ if start_index is not None:
25
+ attr.start_index = start_index
26
+ if end_index != -1:
27
+ attr.end_index = end_index
28
+
29
+ cdef insert_into_queue(
30
+ GQueue* queue,
31
+ PangoAttribute* attr,
32
+ start_index: int,
33
+ end_index: int,
34
+ ):
35
+ """Inserts a PangoAttribute into a PangoAttrList.
36
+
37
+ Parameters
38
+ ----------
39
+ queue
40
+ The GQueue to insert the attribute into.
41
+ attr
42
+ The PangoAttribute to insert.
43
+ """
44
+ set_indexes(attr, start_index, end_index)
45
+ g_queue_push_tail(queue, attr)
46
+
47
+ cdef GQueue* create_attr_list_for_attribute (
48
+ attr: TextAttribute,
49
+ ):
50
+ """Creates a GQueue from a TextAttribute. The Queue will contain a list
51
+ of PangoAttributes.
52
+
53
+ Multiple PangoAttributes are to be created for a single TextAttribute. That's
54
+ because for a given `start` and `end` index value, the user can set various
55
+ attributes like `color`, `font`, `size`, etc. So, we need to create a
56
+ PangoAttribute for each of these attributes. Finally, we add all these
57
+ PangoAttributes to a Queue and return it.
58
+
59
+ Note: the caller is responsible for freeing the returned GQueue as well as
60
+ the created attributes.
61
+
62
+ Parameters
63
+ ----------
64
+ attr
65
+ The TextAttribute to convert.
66
+ """
67
+ cdef PangoAttribute* pango_attr = NULL
68
+ cdef GQueue* queue = g_queue_new()
69
+ if not queue:
70
+ raise MemoryError("Could not allocate memory for GQueue.")
71
+
72
+ # allow_breaks
73
+ if attr.allow_breaks is not None:
74
+ pango_attr = raise_on_null_attr(
75
+ pango_attr_allow_breaks_new(attr.allow_breaks))
76
+ insert_into_queue(
77
+ queue,
78
+ pango_attr,
79
+ attr.start_index,
80
+ attr.end_index,
81
+ )
82
+
83
+ # background_alpha
84
+ if attr.background_alpha is not None:
85
+ pango_attr = raise_on_null_attr(
86
+ pango_attr_background_alpha_new(attr.background_alpha))
87
+ insert_into_queue(
88
+ queue,
89
+ pango_attr,
90
+ attr.start_index,
91
+ attr.end_index,
92
+ )
93
+
94
+ # background_color
95
+ if attr.background_color is not None:
96
+ pango_attr = raise_on_null_attr(
97
+ pango_attr_background_new(
98
+ attr.background_color[0],
99
+ attr.background_color[1],
100
+ attr.background_color[2],
101
+ ),
102
+ )
103
+ insert_into_queue(
104
+ queue,
105
+ pango_attr,
106
+ attr.start_index,
107
+ attr.end_index,
108
+ )
109
+
110
+ # foreground_alpha
111
+ if attr.foreground_alpha is not None:
112
+ pango_attr = raise_on_null_attr(
113
+ pango_attr_foreground_alpha_new(attr.foreground_alpha))
114
+ insert_into_queue(
115
+ queue,
116
+ pango_attr,
117
+ attr.start_index,
118
+ attr.end_index,
119
+ )
120
+
121
+ # foreground_color
122
+ if attr.foreground_color is not None:
123
+ pango_attr = raise_on_null_attr(
124
+ pango_attr_foreground_new(
125
+ attr.foreground_color[0],
126
+ attr.foreground_color[1],
127
+ attr.foreground_color[2],
128
+ ),
129
+ )
130
+ insert_into_queue(
131
+ queue,
132
+ pango_attr,
133
+ attr.start_index,
134
+ attr.end_index,
135
+ )
136
+
137
+ # fallback
138
+ if attr.fallback is not None:
139
+ pango_attr = raise_on_null_attr(
140
+ pango_attr_fallback_new(attr.fallback))
141
+ insert_into_queue(
142
+ queue,
143
+ pango_attr,
144
+ attr.start_index,
145
+ attr.end_index,
146
+ )
147
+
148
+ # family
149
+ if attr.family is not None:
150
+ pango_attr = raise_on_null_attr(
151
+ pango_attr_family_new(
152
+ attr.family.encode("utf-8")
153
+ ))
154
+ insert_into_queue(
155
+ queue,
156
+ pango_attr,
157
+ attr.start_index,
158
+ attr.end_index,
159
+ )
160
+
161
+ # weight
162
+ if attr.weight is not None:
163
+ pango_attr = raise_on_null_attr(
164
+ pango_attr_weight_new(attr.weight.value))
165
+ insert_into_queue(
166
+ queue,
167
+ pango_attr,
168
+ attr.start_index,
169
+ attr.end_index,
170
+ )
171
+
172
+ # line height
173
+ if attr.line_height is not None:
174
+ pango_attr = raise_on_null_attr(
175
+ pango_attr_line_height_new(attr.line_height))
176
+ insert_into_queue(
177
+ queue,
178
+ pango_attr,
179
+ attr.start_index,
180
+ attr.end_index,
181
+ )
182
+
183
+ return queue
184
+
185
+
186
+ cdef convert_to_pango_attributes(
187
+ attrs: list[TextAttribute],
188
+ PangoAttrList* pango_attr_list
189
+ ):
190
+ """Converts a list of TextAttributes to a PangoAttribute.
191
+
192
+ Note: the caller owns pango_attrlist and is responsible for freeing it.
193
+
194
+ Parameters
195
+ ----------
196
+ attrs
197
+ The list of TextAttributes to convert.
198
+ pango_attrlist
199
+ The PangoAttrList to add the attributes to.
200
+ """
201
+ cdef GQueue* temp_queue = NULL;
202
+ cdef PangoAttribute* temp_attr = NULL;
203
+
204
+ if not pango_attr_list:
205
+ raise ValueError("pango_attr_list must not be NULL.")
206
+
207
+ # Use pango_attr_list_change() to add the attributes to the list.
208
+ for attr in attrs:
209
+ temp_queue = create_attr_list_for_attribute(attr)
210
+ if not temp_queue:
211
+ raise MemoryError("holy shit")
212
+ while not g_queue_is_empty(temp_queue):
213
+ temp_attr = <PangoAttribute*>g_queue_pop_head(temp_queue)
214
+ pango_attr_list_insert(
215
+ pango_attr_list,
216
+ temp_attr
217
+ )
218
+ # Don't free the attribute
219
+ g_queue_free (temp_queue)
manimpango/buffer.pxi ADDED
@@ -0,0 +1,15 @@
1
+ cdef class ImageBuffer:
2
+ cdef unsigned char * data
3
+ cdef int height
4
+ cdef int stride
5
+
6
+ def __getbuffer__(self, Py_buffer *buffer, int flags):
7
+ buffer.buf = self.data
8
+ buffer.format = 'B'
9
+ buffer.len = self.height * self.stride
10
+ buffer.obj = self
11
+ buffer.ndim = 1
12
+ buffer.readonly = 1
13
+
14
+ def __releasebuffer__(self, Py_buffer *buffer):
15
+ pass
manimpango/cmanimpango.c CHANGED
@@ -11,29 +11,29 @@
11
11
  "/Users/runner/pangobuild/include/pango-1.0/pango/pangocairo.h"
12
12
  ],
13
13
  "include_dirs": [
14
- "/Users/runner/pangobuild/lib/glib-2.0/include",
15
- "/Users/runner/pangobuild/include/pango-1.0",
16
- "/Users/runner/pangobuild/include/harfbuzz",
17
14
  "/Users/runner/pangobuild/include/freetype2",
18
- "/Users/runner/pangobuild/include/glib-2.0",
15
+ "/Users/runner/pangobuild/include/fribidi",
16
+ "/Users/runner/pangobuild/include/harfbuzz",
17
+ "/usr/local/Cellar/pcre2/10.42/include",
19
18
  "/Users/runner/pangobuild/include",
19
+ "/Users/runner/pangobuild/include/pango-1.0",
20
+ "/Users/runner/pangobuild/include/cairo",
21
+ "/Users/runner/pangobuild/lib/glib-2.0/include",
20
22
  "/Users/runner/pangobuild/include/pixman-1",
21
23
  "/usr/local/Cellar/lzo/2.10/include/lzo",
22
- "/usr/local/Cellar/pcre2/10.42/include",
23
- "/Users/runner/pangobuild/include/cairo",
24
- "/Users/runner/pangobuild/include/fribidi"
24
+ "/Users/runner/pangobuild/include/glib-2.0"
25
25
  ],
26
26
  "libraries": [
27
- "pangoft2-1.0",
28
- "harfbuzz",
29
- "freetype",
30
- "gobject-2.0",
31
27
  "pangocairo-1.0",
28
+ "freetype",
32
29
  "glib-2.0",
33
- "pango-1.0",
34
- "cairo",
30
+ "harfbuzz",
31
+ "pangoft2-1.0",
35
32
  "fontconfig",
36
- "intl"
33
+ "gobject-2.0",
34
+ "intl",
35
+ "pango-1.0",
36
+ "cairo"
37
37
  ],
38
38
  "library_dirs": [
39
39
  "/Users/runner/pangobuild/lib"
manimpango/enums.c CHANGED
@@ -11,29 +11,29 @@
11
11
  "/Users/runner/pangobuild/include/pango-1.0/pango/pangocairo.h"
12
12
  ],
13
13
  "include_dirs": [
14
- "/Users/runner/pangobuild/lib/glib-2.0/include",
15
- "/Users/runner/pangobuild/include/pango-1.0",
16
- "/Users/runner/pangobuild/include/harfbuzz",
17
14
  "/Users/runner/pangobuild/include/freetype2",
18
- "/Users/runner/pangobuild/include/glib-2.0",
15
+ "/Users/runner/pangobuild/include/fribidi",
16
+ "/Users/runner/pangobuild/include/harfbuzz",
17
+ "/usr/local/Cellar/pcre2/10.42/include",
19
18
  "/Users/runner/pangobuild/include",
19
+ "/Users/runner/pangobuild/include/pango-1.0",
20
+ "/Users/runner/pangobuild/include/cairo",
21
+ "/Users/runner/pangobuild/lib/glib-2.0/include",
20
22
  "/Users/runner/pangobuild/include/pixman-1",
21
23
  "/usr/local/Cellar/lzo/2.10/include/lzo",
22
- "/usr/local/Cellar/pcre2/10.42/include",
23
- "/Users/runner/pangobuild/include/cairo",
24
- "/Users/runner/pangobuild/include/fribidi"
24
+ "/Users/runner/pangobuild/include/glib-2.0"
25
25
  ],
26
26
  "libraries": [
27
- "pangoft2-1.0",
28
- "harfbuzz",
29
- "freetype",
30
- "gobject-2.0",
31
27
  "pangocairo-1.0",
28
+ "freetype",
32
29
  "glib-2.0",
33
- "pango-1.0",
34
- "cairo",
30
+ "harfbuzz",
31
+ "pangoft2-1.0",
35
32
  "fontconfig",
36
- "intl"
33
+ "gobject-2.0",
34
+ "intl",
35
+ "pango-1.0",
36
+ "cairo"
37
37
  ],
38
38
  "library_dirs": [
39
39
  "/Users/runner/pangobuild/lib"
Binary file