ManimPango 0.4.3__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 (65) hide show
  1. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/METADATA +2 -2
  2. ManimPango-1.0.0a2.dist-info/RECORD +79 -0
  3. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/WHEEL +1 -1
  4. manimpango/.dylibs/libcairo.2.dylib +0 -0
  5. manimpango/.dylibs/libgio-2.0.0.dylib +0 -0
  6. manimpango/.dylibs/libglib-2.0.0.dylib +0 -0
  7. manimpango/.dylibs/libgmodule-2.0.0.dylib +0 -0
  8. manimpango/.dylibs/libgobject-2.0.0.dylib +0 -0
  9. manimpango/.dylibs/libpcre2-8.0.dylib +0 -0
  10. manimpango/__init__.py +5 -7
  11. manimpango/_distributor_init.py +17 -0
  12. manimpango/_version.py +1 -1
  13. manimpango/attributes/__init__.py +324 -0
  14. manimpango/attributes/attributes.pxi +219 -0
  15. manimpango/buffer.pxi +15 -0
  16. manimpango/cmanimpango.c +10020 -0
  17. manimpango/cmanimpango.cpython-310-darwin.so +0 -0
  18. manimpango/enums.c +3716 -0
  19. manimpango/enums.cpython-310-darwin.so +0 -0
  20. manimpango/enums.pyx +1 -10
  21. manimpango/exceptions.py +5 -0
  22. manimpango/fonts/__init__.py +153 -0
  23. manimpango/fonts/_font_desc.c +7571 -0
  24. manimpango/fonts/_font_desc.cpython-310-darwin.so +0 -0
  25. manimpango/fonts/_font_desc.pxd +5 -0
  26. manimpango/fonts/_font_desc.pyi +25 -0
  27. manimpango/fonts/_font_desc.pyx +114 -0
  28. manimpango/fonts/enums.c +3623 -0
  29. manimpango/fonts/enums.cpython-310-darwin.so +0 -0
  30. manimpango/fonts/enums.pyi +23 -0
  31. manimpango/fonts/enums.pyx +84 -0
  32. manimpango/{cairo.pxd → include/cairo.pxd} +21 -0
  33. manimpango/include/glib.pxd +36 -0
  34. manimpango/{pango.pxd → include/pango.pxd} +61 -0
  35. manimpango/include/pango_attributes.pxd +184 -0
  36. manimpango/layout/__init__.py +266 -0
  37. manimpango/layout/_layout.c +8625 -0
  38. manimpango/layout/_layout.cpython-310-darwin.so +0 -0
  39. manimpango/layout/_layout.pyx +60 -0
  40. manimpango/layout/layout.pxi +52 -0
  41. manimpango/register_font.c +5101 -0
  42. manimpango/register_font.cpython-310-darwin.so +0 -0
  43. manimpango/renderer/__init__.py +5 -0
  44. manimpango/renderer/cairo_utils.pxi +72 -0
  45. manimpango/renderer/image_renderer.c +12314 -0
  46. manimpango/renderer/image_renderer.cpython-310-darwin.so +0 -0
  47. manimpango/renderer/image_renderer.pxd +23 -0
  48. manimpango/renderer/image_renderer.pyi +21 -0
  49. manimpango/renderer/image_renderer.pyx +219 -0
  50. manimpango/renderer/svg_renderer.c +10666 -0
  51. manimpango/renderer/svg_renderer.cpython-310-darwin.so +0 -0
  52. manimpango/renderer/svg_renderer.pxd +23 -0
  53. manimpango/renderer/svg_renderer.pyi +17 -0
  54. manimpango/renderer/svg_renderer.pyx +174 -0
  55. manimpango/utils/__init__.py +3 -0
  56. manimpango/utils/_utils.cpython-310-darwin.so +0 -0
  57. manimpango/utils/_utils.pyi +2 -0
  58. manimpango/utils/utils.c +3528 -0
  59. manimpango/{utils.py → utils/utils.py} +3 -1
  60. manimpango/utils/utils.pyx +27 -0
  61. ManimPango-0.4.3.dist-info/RECORD +0 -38
  62. manimpango/glib.pxd +0 -13
  63. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE +0 -0
  64. {ManimPango-0.4.3.dist-info → ManimPango-1.0.0a2.dist-info}/LICENSE.bin +0 -0
  65. {ManimPango-0.4.3.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: 0.4.3
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
@@ -24,7 +24,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
24
24
  Classifier: License :: OSI Approved :: MIT License
25
25
  Classifier: Operating System :: OS Independent
26
26
  Classifier: Programming Language :: Cython
27
- Requires-Python: >=3.7
27
+ Requires-Python: >=3.8
28
28
  Description-Content-Type: text/markdown
29
29
  License-File: LICENSE
30
30
  License-File: LICENSE.bin
@@ -0,0 +1,79 @@
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
+ manimpango/cmanimpango.pxd,sha256=qmQydFpNgEPYcDtfDhcaiAhu6-WyvQA0Tth09fO0sl4,62
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
+ manimpango/__init__.py,sha256=N4htCfNXQlJDUyk4aQPuEy2X94ET80LD5g1jYBQGOUA,1120
15
+ manimpango/_distributor_init.py,sha256=KEvWgF0ScF4L5ZxHtCXfme3VsMc0bvpwmS1c0unBzYE,523
16
+ manimpango/enums.pyx,sha256=0v02ywJtVb2pDk_kxL9hoXr7VxCN4Spn693QiWaU6XE,2266
17
+ manimpango/register_font.pxd,sha256=QvOyEtJex0Vl5neHAgpSniu11Qzb8O5hLlCFCsfFBfM,1597
18
+ manimpango/cmanimpango.c,sha256=K4R1WAdTcUCAd8YE-Qrpj_rSLiz2X_HHeo_s3XWde6Y,418168
19
+ manimpango/register_font.pyx,sha256=L2_ftxuZwZzFTUMOAGbVqhZNWkMtgdeXRFzMliQdZ0U,7309
20
+ manimpango/exceptions.py,sha256=aZ2FNGwtPk-bApRs3d0QhuWNb8eYcpI9PcGZQwtbFeQ,141
21
+ manimpango/cmanimpango.pyx,sha256=1B8lvoZdJdiQmyIK02pU6I7udIfiGDXueODpWFozthk,10438
22
+ manimpango/buffer.pxi,sha256=izIeXKKbRafuzdurTworXck004e0pqVOGk9M9MA7ISs,404
23
+ manimpango/renderer/svg_renderer.cpython-310-darwin.so,sha256=B2xwR8sJVG4NDxe3WFuEvQ3Eblb-bdiq5apt-WJ930A,135664
24
+ manimpango/renderer/svg_renderer.pyi,sha256=60MrH2fLj8lowxo9n0tWaxYAkw-vyWi4QP4IrOqlrlY,401
25
+ manimpango/renderer/svg_renderer.c,sha256=AubIdoVwhtIjhvmnEPTDlAoao6kKommxdG-seb95a0s,448105
26
+ manimpango/renderer/__init__.py,sha256=V4MTFzxrCbUHC6lLlhPszdz0wHX86_W25DLXbg2Ht1A,186
27
+ manimpango/renderer/image_renderer.pyx,sha256=RiBacUWEN73jEmCZEHNdsU8o6c_GeVEhxTRohCskvOM,6538
28
+ manimpango/renderer/svg_renderer.pxd,sha256=XzirDbTz9uxxORGgoXNjK5y64ty1A6NWlXILTqMxiJg,539
29
+ manimpango/renderer/image_renderer.c,sha256=PzWrcBzBGgwVNWTrjZpsQbbmZyUv1rNE5T1Z7b-LT-o,521869
30
+ manimpango/renderer/svg_renderer.pyx,sha256=bDttE-VsogOPPDDoyIC7nm3hL1v_23e9V3j73i3Oc7M,5110
31
+ manimpango/renderer/cairo_utils.pxi,sha256=hcVLvQhkvfyMb6lZnx_f55ZudAAHPuDPWM_2vGlcxEo,2531
32
+ manimpango/renderer/image_renderer.pxd,sha256=ijvm4t2D42981OneXhyfzriAMsD1eMF78xc8leo3C_Q,537
33
+ manimpango/renderer/image_renderer.cpython-310-darwin.so,sha256=92aMzqFgbSSIyqInZY0WazhQVEpihlvMAdUp1UfgQnM,144768
34
+ manimpango/renderer/image_renderer.pyi,sha256=CyB1ubpsF5lsK88IPyY9sj5dR0Y4IuhLj4Ys3tkfM5A,500
35
+ manimpango/layout/__init__.py,sha256=NTSgiHqqfNrG3qHUOtmEKxPEASYuQ7htzvoM5FGSbW8,7575
36
+ manimpango/layout/_layout.c,sha256=gSQgGixH4kXUkbufJ1Cmcdtdj1ZtwoNSz84QmdEe27Q,360866
37
+ manimpango/layout/_layout.pyx,sha256=DPdadzx94L2JZQJNrcruDuJOHK3HrHv9_91_vYMDM7A,1724
38
+ manimpango/layout/_layout.cpython-310-darwin.so,sha256=QMjDjx0KPjDGWQqBqpibiO4yPqWg_ixfVBUHEDfuQ18,111088
39
+ manimpango/layout/layout.pxi,sha256=SWUi2za6U7L0Sa78Y1o3e98yjiWd8VuqWN8hoZbxuXQ,1337
40
+ manimpango/include/cairo.pxd,sha256=ejJx_QEQtikfDt0hu3t6Ug-8ZVx3GpZeHvs4zODoNHw,1321
41
+ manimpango/include/pango_attributes.pxd,sha256=m5Jy0H60jBis2iSkTuztqVlQYJJRUTD9oArxId6nYSU,5056
42
+ manimpango/include/pango.pxd,sha256=9rgNLg4S5kxzwF4k7w0gByr6Dfd9EmvPHLs5gJnHBbg,5980
43
+ manimpango/include/glib.pxd,sha256=Ikn7MziB8s8GSzcS3g0YkCJiNTYKUsQiVv-oc6Ugm0Y,871
44
+ manimpango/utils/_utils.cpython-310-darwin.so,sha256=PCEgeIegOCzns8JgPhNBqo4ePbZnEn-ObsPSikceE_Q,61536
45
+ manimpango/utils/__init__.py,sha256=LW3qbiPmn_vd1sMJ8TRRVeAHOFwf_vjxZ6V1Myj9Eps,107
46
+ manimpango/utils/_utils.pyi,sha256=d0WDj5jC2WzdEumcW-OyTjKPfnnXjiWPkEfQoF1EqsY,110
47
+ manimpango/utils/utils.c,sha256=ua4mt2dd2A8KbudWC1BnclTcB9k3evqxwCo9RFLgSSQ,136741
48
+ manimpango/utils/utils.py,sha256=TcKSs2oJkFg_ipWzSpyF48owc1onrJmhNeyyb3Ja4_0,1648
49
+ manimpango/utils/utils.pyx,sha256=oaUw-rPeIeUS3ux_FF9rrJtCU-tZPWr64pPl8ptqVWg,631
50
+ manimpango/.dylibs/libpango-1.0.0.dylib,sha256=mg4Jtk8fMkuXqoxR3yJulksD5w_OPOMCnuEGA10hmpY,445424
51
+ manimpango/.dylibs/libz.dylib,sha256=iUO8HvyLQqyUiAHKn3ZKzTNyPzzwwGqqzvb8sMfBVgo,141632
52
+ manimpango/.dylibs/libpangoft2-1.0.0.dylib,sha256=wn-0D3EjBETeLHzG9tVngY0p4HOAcl7Vt1Y7TM621Ps,139696
53
+ manimpango/.dylibs/libpcre2-8.0.dylib,sha256=aVJ32fhooK9vUMgwDd5_tFmOTl6SA9hk9O5Kf-BZkZw,627968
54
+ manimpango/.dylibs/libcairo.2.dylib,sha256=9mz9aD3qVNZ6Fx7VGm3lbZH8Lb4XIHa362BONFS5AOQ,1195344
55
+ manimpango/.dylibs/libglib-2.0.0.dylib,sha256=IEvZ9c2APkN6mzpoWfunsjiWGSjTie10j8sa3hO3O6E,1280512
56
+ manimpango/.dylibs/libpng16.16.dylib,sha256=KyDJtRwFpWzdcTb57lb2MP34MeWrVe_CejuJmTd9lCc,279056
57
+ manimpango/.dylibs/libpangocairo-1.0.0.dylib,sha256=rU1rlrM2FkygtFfaRzafXTkl4G9_ARQJkA9OBUvqU2g,139280
58
+ manimpango/.dylibs/libgobject-2.0.0.dylib,sha256=w1ch1K3ffQIcctsoGMR-veZhrQEz3bRbWUoYtLi094s,371392
59
+ manimpango/.dylibs/libfreetype.6.dylib,sha256=9fbuul18tC9YC6PJs-4vv7TtR010V1TsZzebqWegOHQ,808288
60
+ manimpango/.dylibs/libharfbuzz.0.dylib,sha256=LfwgW4F1pZIyBF_2G_znsjsDISzuxMXE-oaP6JCP6iM,1230640
61
+ manimpango/.dylibs/libgmodule-2.0.0.dylib,sha256=BGV-7-gGsYkAlsiFWNfOLdBdj0rSPmW99q3zAQXzCak,54896
62
+ manimpango/.dylibs/libintl.8.dylib,sha256=YAeq6Y4sz2UAaiRaEO4ep_egDfWhP3OaFel4Gt_vQYA,52544
63
+ manimpango/.dylibs/libfribidi.0.dylib,sha256=oAcKVBc9j4l18OMMdKmbFE5YJUIuNgDMN3rB9OopvQk,155824
64
+ manimpango/.dylibs/libfontconfig.1.dylib,sha256=o4KsB_j6lp2Ew5wWG8DCgOb4W_T9eNaxlT9GulY1L6M,339136
65
+ manimpango/.dylibs/libffi.7.dylib,sha256=bWEx32zS9IZl-OwHLsh93-NcdBpA8rbLWnGHfcTsem8,73632
66
+ manimpango/.dylibs/libpixman-1.0.dylib,sha256=uKzUTWdcGBbXVnLjAg-yliF4GzaUYpBs0Lv5evA7ljM,816768
67
+ manimpango/.dylibs/libgio-2.0.0.dylib,sha256=UWYbPYIrYECmEQLAJVxuax-tle1O4S4De77T8U5yJHw,1919136
68
+ manimpango/attributes/attributes.pxi,sha256=VWMMCfG4m-ATs4qQLU6sNAYID3rhJF-voMItMZHp8w8,6079
69
+ manimpango/attributes/__init__.py,sha256=E9pDNWijgWUTk8nxKdROthlhMfLt-vIwvIcXoNFxFao,10453
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
74
+ manimpango/fonts/__init__.py,sha256=e9PxTdK86y640cgLp49nxMBtU63RU7JY-DDJGnaWuKo,3989
75
+ manimpango/fonts/enums.pyx,sha256=NY3khxIYTTtoZ9NLUgRI9GFgoFeOGXpkAyTbeTtBct0,2221
76
+ manimpango/fonts/_font_desc.c,sha256=3cYq_3WbLqwT4xS8ydnbisN9oMS0NZndQz7_WwsUai8,306310
77
+ manimpango/fonts/_font_desc.pyi,sha256=u24xzGuJSk5XzBAyJ0qG2yZ_QmqnnTzSGdvmjRZm4HM,645
78
+ manimpango/fonts/_font_desc.pxd,sha256=ahDwjhczn3Ogxb7eYp2uZuhxPyVLg6JyH2tgnOgl5Dg,99
79
+ manimpango/fonts/enums.pyi,sha256=Jt1A9vRmeEUrtKSsyWCm5iP84_e2t9g6i_x8IvKf39o,367
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.38.4)
2
+ Generator: bdist_wheel (0.40.0)
3
3
  Root-Is-Purelib: false
4
4
  Tag: cp310-cp310-macosx_10_9_x86_64
5
5
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
manimpango/__init__.py CHANGED
@@ -1,19 +1,17 @@
1
1
  # -*- coding: utf-8 -*-
2
- import os
3
2
  import sys
4
3
 
4
+ from . import _distributor_init # noqa: F401
5
5
  from ._version import __version__ # noqa: F403,F401
6
6
 
7
- if os.name == "nt": # pragma: no cover
8
- os.environ["PATH"] = (
9
- f"{os.path.abspath(os.path.dirname(__file__))}"
10
- f"{os.pathsep}"
11
- f"{os.environ['PATH']}"
12
- )
13
7
  try:
8
+ from .attributes import * # noqa: F403,F401
14
9
  from .cmanimpango import * # noqa: F403,F401
15
10
  from .enums import * # noqa: F403,F401
11
+ from .fonts import * # noqa: F403,F401
12
+ from .layout import * # noqa: F403,F401
16
13
  from .register_font import * # noqa: F403,F401
14
+ from .renderer import * # noqa: F403,F401
17
15
  except ImportError as ie: # pragma: no cover
18
16
  py_ver = ".".join(map(str, sys.version_info[:3]))
19
17
  msg = f"""
@@ -0,0 +1,17 @@
1
+ """ Distributor init file
2
+
3
+ While in development, this file will contain code to support development
4
+ on windows. This code will be removed before the package is released.
5
+ """
6
+ import os
7
+
8
+ if os.name == "nt": # pragma: no cover
9
+ os.environ["PATH"] = (
10
+ f"{os.path.abspath(os.path.dirname(__file__))}"
11
+ f"{os.pathsep}"
12
+ f"{os.environ['PATH']}"
13
+ )
14
+ if hasattr(os, "add_dll_directory"):
15
+ _path = r"C:\cibw\vendor\bin"
16
+ if os.path.exists(_path):
17
+ os.add_dll_directory(_path)
manimpango/_version.py CHANGED
@@ -1,2 +1,2 @@
1
1
  # -*- coding: utf-8 -*-
2
- __version__ = "0.4.3"
2
+ __version__ = "1.0.0a2"
@@ -0,0 +1,324 @@
1
+ # -*- coding: utf-8 -*-
2
+ from __future__ import annotations
3
+
4
+ import typing as T
5
+
6
+ from ..fonts.enums import Weight
7
+ from ..utils import covert_hex_to_rbg
8
+
9
+ __all__ = ["TextAttribute"]
10
+
11
+
12
+ def _parse_color_output(val: T.Union[str, T.Iterable[int]]):
13
+ color_hex = None
14
+ red, green, blue = None, None, None
15
+ if isinstance(val, str):
16
+ color_hex = val
17
+ else:
18
+ if len(val) != 3:
19
+ raise ValueError("Either a Iterable of 3 items or a string must be passed.")
20
+ red, green, blue = val
21
+ if color_hex:
22
+ red, green, blue = covert_hex_to_rbg(color_hex)
23
+ if not ((0 <= red <= 65535) and (0 <= green <= 65535) and (0 <= blue <= 65535)):
24
+ raise ValueError("red, green, blue should be between 0 and 65535.")
25
+ return (red, green, blue)
26
+
27
+
28
+ class TextAttribute:
29
+ """:class:`TextAttribute` defines the properties/attributes of the
30
+ text within a specific range of the text.
31
+
32
+
33
+ A :class:`TextAttribute` object can define multiple properties at
34
+ the same time, for example, it can change the :attr:`background_color`,
35
+ as well as, :attr:`foreground_color`. Also, a :class:`TextAttribute` can
36
+ be used for multiple times for different texts.
37
+ By default, an attribute has an inclusive range from ``0`` to the
38
+ end of the text ``-1``, ie. ``[0, -1]``.
39
+ """
40
+
41
+ def __init__(
42
+ self,
43
+ start_index: int = 0,
44
+ end_index: int = -1,
45
+ *,
46
+ allow_breaks: bool | None = None,
47
+ background_alpha: float | None = None,
48
+ background_color: T.Union[str, T.Iterable[int]] | None = None,
49
+ foreground_alpha: float | None = None,
50
+ foreground_color: T.Union[str, T.Iterable[int]] | None = None,
51
+ fallback: bool | None = None,
52
+ family: str | None = None,
53
+ weight: Weight | None = None,
54
+ line_height: float | None = None,
55
+ ) -> None:
56
+ """Initialize :class:`TextAttribute`.
57
+
58
+ Parameters
59
+ ----------
60
+ start_index : int, optional
61
+ The start index of the range, by default 0 (start of the string).
62
+ end_index : int, optional
63
+ End index of the range. The character at this index is not included
64
+ in the range, by default -1 (end of the string).
65
+ """
66
+ self.start_index = start_index
67
+ self.end_index = end_index
68
+ if allow_breaks:
69
+ self.allow_breaks = allow_breaks
70
+ if background_alpha:
71
+ self.background_alpha = background_alpha
72
+ if background_color:
73
+ self.background_color = background_color
74
+ if foreground_alpha:
75
+ self.foreground_alpha = foreground_alpha
76
+ if foreground_color:
77
+ self.foreground_color = foreground_color
78
+ if fallback:
79
+ self.fallback = fallback
80
+ if family:
81
+ self.family = family
82
+ if weight:
83
+ self.weight = weight
84
+ if line_height:
85
+ self.line_height = line_height
86
+
87
+ @property
88
+ def start_index(self) -> int:
89
+ """It is the end index of the range.
90
+
91
+ Raises
92
+ ------
93
+ ValueError
94
+ If the value is not an :class:`int`.
95
+ """
96
+ return self._start_index
97
+
98
+ @start_index.setter
99
+ def start_index(self, val: int) -> None:
100
+ if not isinstance(val, int):
101
+ raise ValueError("'start_index' should be an int")
102
+ # check if the value is negative
103
+ if val < 0:
104
+ raise ValueError("'start_index' should be a positive int")
105
+ self._start_index = val
106
+
107
+ @property
108
+ def end_index(self) -> int:
109
+ """It is the start of the range. The character at this index is not
110
+ included in the range.
111
+
112
+ Raises
113
+ ------
114
+ ValueError
115
+ If the value is not an :class:`int`.
116
+ """
117
+ return self._end_index
118
+
119
+ @end_index.setter
120
+ def end_index(self, val: int) -> None:
121
+ if not isinstance(val, int):
122
+ raise ValueError("'end_index' should be an int")
123
+ # check if the value is negative
124
+ if val < 0 and val != -1:
125
+ raise ValueError("'end_index' should be a positive int")
126
+ self._end_index = val
127
+
128
+ @property
129
+ def allow_breaks(self) -> T.Union[bool, None]:
130
+ """Whether to break text or not.
131
+
132
+ If breaks are disabled, the range will be kept in a single run,
133
+ as far as possible.
134
+ """
135
+ if hasattr(self, "_allow_breaks"):
136
+ return self._allow_breaks
137
+ return None
138
+
139
+ @allow_breaks.setter
140
+ def allow_breaks(self, val: bool) -> None:
141
+ self._allow_breaks = bool(val)
142
+
143
+ @property
144
+ def background_alpha(self) -> T.Union[float, None]:
145
+ """The background_alpha of the text.
146
+
147
+ Raises
148
+ ------
149
+ ValueError
150
+ If the value is not between 0 and 1.
151
+ """
152
+ if hasattr(self, "_background_alpha"):
153
+ return self._background_alpha
154
+ return None
155
+
156
+ @background_alpha.setter
157
+ def background_alpha(self, val: float) -> None:
158
+ if not (0 <= val <= 1):
159
+ raise ValueError("'val' should be between 0 and 1")
160
+ self._background_alpha = val
161
+
162
+ @property
163
+ def background_color(self) -> T.Union[T.Tuple[int], None]:
164
+ """The background color of the region.
165
+
166
+ If the input is a :class:`str` the value is considered as
167
+ string representation of color from
168
+ `CSS Specification <https://www.w3.org/TR/css-color-4/#named-colors>`_.
169
+ The color is then parsed and :class:`ValueError` is raised
170
+ if the color is invalid.
171
+
172
+ If the input is a :class:`collections.abc.Iterable` then the items
173
+ in them are parsed in the order of ``red, green, blue`` and checked
174
+ whether they are valid (between 0 and 65535).
175
+
176
+
177
+ Returns either ``None`` or a :class:`tuple` with 3 elements
178
+ representing red, green, blue respectively. The value of each
179
+ items in that tuple ranges from 0 to 65535.
180
+
181
+ Raises
182
+ ------
183
+ ValueError
184
+ If the value passed isn't a :class:`collections.abc.Iterable` of 3
185
+ elements or a string. Another condition when `ValueError` is
186
+ raised is when the color passed is invalid.
187
+
188
+ """
189
+ if hasattr(self, "_background_color"):
190
+ return self._background_color
191
+ return None
192
+
193
+ @background_color.setter
194
+ def background_color(self, val: T.Union[str, T.Iterable[int]]) -> None:
195
+ self._background_color = _parse_color_output(val)
196
+
197
+ @property
198
+ def foreground_alpha(self) -> T.Union[float, None]:
199
+ """The foreground_alpha of the text.
200
+
201
+ Raises
202
+ ------
203
+ ValueError
204
+ If the value is not between 0 and 1.
205
+ """
206
+ if hasattr(self, "_foreground_alpha"):
207
+ return self._foreground_alpha
208
+ return None
209
+
210
+ @foreground_alpha.setter
211
+ def foreground_alpha(self, val: float) -> None:
212
+ if not (0 <= val <= 1):
213
+ raise ValueError("'val' should be between 0 and 1")
214
+ self._foreground_alpha = val
215
+
216
+ @property
217
+ def foreground_color(self) -> T.Union[T.Tuple[int], None]:
218
+ """The foreground color attribute.
219
+
220
+ If the input is a :class:`str` the value is considered as
221
+ string representation of color from
222
+ `CSS Specification <https://www.w3.org/TR/css-color-4/#named-colors>`_.
223
+ The color is then parsed and :class:`ValueError` is raised
224
+ if the color is invalid.
225
+
226
+ If the input is a :class:`collections.abc.Iterable` then the items
227
+ in them are parsed in the order of ``red, green, blue`` and checked
228
+ whether they are valid (between 0 and 65535).
229
+
230
+
231
+ Returns either ``None`` or a :class:`tuple` with 3 elements
232
+ representing red, green, blue respectively. The value of each
233
+ items in that tuple ranges from 0 to 65535.
234
+
235
+ Raises
236
+ ------
237
+ ValueError
238
+ If the value passed isn't a :class:`collections.abc.Iterable` of 3
239
+ elements or a string. Another condition when `ValueError` is
240
+ raised is when the color passed is invalid.
241
+
242
+ """
243
+ if hasattr(self, "_foreground_color"):
244
+ return self._foreground_color
245
+ return None
246
+
247
+ @foreground_color.setter
248
+ def foreground_color(self, val: T.Union[str, T.Iterable[int]]) -> None:
249
+ self._foreground_color = _parse_color_output(val)
250
+
251
+ @property
252
+ def fallback(self) -> bool:
253
+ """Enable or disable fallbacks.
254
+
255
+ If fallback is disabled, characters will only be used from the
256
+ closest matching font on the system. No fallback will be done to
257
+ other fonts on the system that might contain the characters in
258
+ the text.
259
+ """
260
+ if hasattr(self, "_fallback"):
261
+ return self._fallback
262
+ return None
263
+
264
+ @fallback.setter
265
+ def fallback(self, val: bool) -> None:
266
+ self._fallback = bool(val)
267
+
268
+ @property
269
+ def family(self) -> T.Union[str, None]:
270
+ """The font family the text should render. Can be a comma seperated
271
+ list of fonts in a string.
272
+
273
+ Raises
274
+ ------
275
+ ValueError
276
+ If value isn't a str.
277
+ """
278
+ if hasattr(self, "_family"):
279
+ return self._family
280
+ return None
281
+
282
+ @family.setter
283
+ def family(self, val: str) -> None:
284
+ if not isinstance(val, str):
285
+ raise ValueError("'family' must be a string")
286
+ self._family = val
287
+
288
+ @property
289
+ def weight(self) -> T.Union[Weight, None]:
290
+ """The font weight of the text.
291
+
292
+ Raises
293
+ ------
294
+ ValueError
295
+ If value isn't a str.
296
+ """
297
+ if hasattr(self, "_weight"):
298
+ return self._weight
299
+ return None
300
+
301
+ @weight.setter
302
+ def weight(self, val: Weight) -> None:
303
+ if not isinstance(val, Weight):
304
+ raise ValueError("'weight' must be a Weight")
305
+ self._weight = val
306
+
307
+ @property
308
+ def line_height(self) -> T.Union[float, None]:
309
+ """The line height of the text.
310
+
311
+ Raises
312
+ ------
313
+ ValueError
314
+ If value isn't a float.
315
+ """
316
+ if hasattr(self, "_line_height"):
317
+ return self._line_height
318
+ return None
319
+
320
+ @line_height.setter
321
+ def line_height(self, val: float) -> None:
322
+ if not isinstance(val, float):
323
+ raise ValueError("'line_height' must be a float")
324
+ self._line_height = val