drawlib 0.1.1__py3-none-any.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.
Potentially problematic release.
This version of drawlib might be problematic. Click here for more details.
- drawlib/.pylintrc +2 -0
- drawlib/__init__.py +33 -0
- drawlib/__main__.py +21 -0
- drawlib/apis.py +22 -0
- drawlib/assets/__init__.py +8 -0
- drawlib/assets/v0_1/__init__.py +8 -0
- drawlib/assets/v0_1/fonticons/__init__.py +8 -0
- drawlib/assets/v0_1/fonts/__init__.py +8 -0
- drawlib/v0_1/__init__.py +31 -0
- drawlib/v0_1/__main__.py +20 -0
- drawlib/v0_1/apis.py +127 -0
- drawlib/v0_1/private/__init__.py +20 -0
- drawlib/v0_1/private/arg_validator.py +163 -0
- drawlib/v0_1/private/command.py +204 -0
- drawlib/v0_1/private/core/__init__.py +15 -0
- drawlib/v0_1/private/core/colors.py +285 -0
- drawlib/v0_1/private/core/dimage.py +510 -0
- drawlib/v0_1/private/core/fonts.py +324 -0
- drawlib/v0_1/private/core/model.py +1082 -0
- drawlib/v0_1/private/core/model_validator.py +175 -0
- drawlib/v0_1/private/core/theme.py +1042 -0
- drawlib/v0_1/private/core/util.py +809 -0
- drawlib/v0_1/private/core_canvas/__init__.py +15 -0
- drawlib/v0_1/private/core_canvas/base.py +653 -0
- drawlib/v0_1/private/core_canvas/canvas.py +88 -0
- drawlib/v0_1/private/core_canvas/image.py +154 -0
- drawlib/v0_1/private/core_canvas/line.py +263 -0
- drawlib/v0_1/private/core_canvas/original_arrow.py +139 -0
- drawlib/v0_1/private/core_canvas/original_polygon.py +584 -0
- drawlib/v0_1/private/core_canvas/patches.py +547 -0
- drawlib/v0_1/private/core_canvas/text.py +136 -0
- drawlib/v0_1/private/download.py +58 -0
- drawlib/v0_1/private/dutil.py +28 -0
- drawlib/v0_1/private/icons/__init__.py +15 -0
- drawlib/v0_1/private/icons/phosphor.py +35275 -0
- drawlib/v0_1/private/icons/util.py +82 -0
- drawlib/v0_1/private/logging.py +38 -0
- drawlib/v0_1/private/settings.py +233 -0
- drawlib/v0_1/private/smartarts/__init__.py +15 -0
- drawlib/v0_1/private/smartarts/cycle.py +11 -0
- drawlib/v0_1/private/smartarts/dsart.py +17 -0
- drawlib/v0_1/private/smartarts/groups.py +20 -0
- drawlib/v0_1/private/smartarts/pyramid.py +18 -0
- drawlib/v0_1/private/smartarts/sourcecode.py +216 -0
- drawlib/v0_1/private/smartarts/table.py +11 -0
- drawlib/v0_1/private/smartarts/tree.py +18 -0
- drawlib/v0_1/private/tools.py +161 -0
- drawlib/v0_1/private/util.py +353 -0
- drawlib-0.1.1.dist-info/LICENSE.txt +202 -0
- drawlib-0.1.1.dist-info/METADATA +36 -0
- drawlib-0.1.1.dist-info/RECORD +52 -0
- drawlib-0.1.1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
# Copyright (c) 2024 Yuichi Ito (yuichi@yuichi.com)
|
|
2
|
+
#
|
|
3
|
+
# This software is licensed under the Apache License, Version 2.0.
|
|
4
|
+
# For more information, please visit: https://github.com/yuichi110/drawlib
|
|
5
|
+
#
|
|
6
|
+
# This software is provided "as is", without warranty of any kind,
|
|
7
|
+
# express or implied, including but not limited to the warranties of
|
|
8
|
+
# merchantability, fitness for a particular purpose and noninfringement.
|
|
9
|
+
|
|
10
|
+
"""Font define module
|
|
11
|
+
|
|
12
|
+
Support font defines here.
|
|
13
|
+
Class ``Font`` and ``FontSourceCode`` are provided to uses.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from enum import Enum
|
|
18
|
+
import os
|
|
19
|
+
import drawlib.assets.v0_1.fonts
|
|
20
|
+
import dataclasses
|
|
21
|
+
from urllib.parse import urljoin
|
|
22
|
+
from typing import Optional, List, Tuple
|
|
23
|
+
from drawlib.v0_1.private.util import get_script_relative_path
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_fontfile_tuple(path: str, md5_hash: str) -> Tuple[str, str, str]:
|
|
27
|
+
paths = [p for p in path.split("/") if p]
|
|
28
|
+
|
|
29
|
+
# font path
|
|
30
|
+
dir_path = os.path.dirname(drawlib.assets.v0_1.fonts.__file__)
|
|
31
|
+
font_path = os.path.join(dir_path, *paths)
|
|
32
|
+
|
|
33
|
+
# url
|
|
34
|
+
url = urljoin(
|
|
35
|
+
"https://raw.githubusercontent.com/yuichi110/drawlib_assets/main/assets/v0_1/fonts/",
|
|
36
|
+
"/".join(paths),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
return (font_path, url, md5_hash)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class FontBase(Enum): ...
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class Font(FontBase):
|
|
46
|
+
"""Drawlib Fonts.
|
|
47
|
+
|
|
48
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
49
|
+
Using only internal font files and user provided font file.
|
|
50
|
+
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
# sansserif
|
|
54
|
+
SANSSERIF_LIGHT = get_fontfile_tuple("noto_sansserif_cjk/light.otf", "88ce9ab7e76fed605c822b52605ac2fd")
|
|
55
|
+
SANSSERIF_REGULAR = get_fontfile_tuple("noto_sansserif_cjk/regular.otf", "6d57a40c6695bd46457315e2a9dc757a")
|
|
56
|
+
SANSSERIF_BOLD = get_fontfile_tuple("noto_sansserif_cjk/bold.otf", "64d01f4e75814352cc9dea68074f4067")
|
|
57
|
+
|
|
58
|
+
# serif
|
|
59
|
+
SERIF_LIGHT = get_fontfile_tuple("noto_serif_cjk/light.otf", "0def63d37c63f0945d1046dae5ab4d83")
|
|
60
|
+
SERIF_REGULAR = get_fontfile_tuple("noto_serif_cjk/regular.otf", "069123ca4dcbdee5cef81ef2f1d2ba8d")
|
|
61
|
+
SERIF_BOLD = get_fontfile_tuple("noto_serif_cjk/bold.otf", "ea7175c0325777d126622340f9c94a66")
|
|
62
|
+
|
|
63
|
+
# roboto
|
|
64
|
+
ROBOTO_LIGHT = get_fontfile_tuple("roboto/light.ttf", "881e150ab929e26d1f812c4342c15a7c")
|
|
65
|
+
ROBOTO_REGULAR = get_fontfile_tuple("roboto/regular.ttf", "8a36205bd9b83e03af0591a004bc97f4")
|
|
66
|
+
ROBOTO_BOLD = get_fontfile_tuple("roboto/bold.ttf", "b8e42971dec8d49207a8c8e2b919a6ac")
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class FontRoboto(FontBase):
|
|
70
|
+
"""Drawlib Fonts.
|
|
71
|
+
|
|
72
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
73
|
+
Using only internal font files and user provided font file.
|
|
74
|
+
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
# roboto
|
|
78
|
+
ROBOTO_LIGHT = get_fontfile_tuple("roboto/light.ttf", "881e150ab929e26d1f812c4342c15a7c")
|
|
79
|
+
ROBOTO_REGULAR = get_fontfile_tuple("roboto/regular.ttf", "8a36205bd9b83e03af0591a004bc97f4")
|
|
80
|
+
ROBOTO_BOLD = get_fontfile_tuple("roboto/bold.ttf", "b8e42971dec8d49207a8c8e2b919a6ac")
|
|
81
|
+
|
|
82
|
+
# robotoserif
|
|
83
|
+
ROBOTO_SERIF_LIGHT = get_fontfile_tuple("roboto_serif/light.ttf", "4781a153250a8caf652b4f5b129c30ed")
|
|
84
|
+
ROBOTO_SERIF_REGULAR = get_fontfile_tuple("roboto_serif/regular.ttf", "2fde5a4a0cef2c19b4b6a30763322847")
|
|
85
|
+
ROBOTO_SERIF_BOLD = get_fontfile_tuple("roboto_serif/bold.ttf", "8ec6ab43edac2144cfd2494d522de733")
|
|
86
|
+
|
|
87
|
+
# robotomono
|
|
88
|
+
ROBOTO_MONO_LIGHT = get_fontfile_tuple("roboto_mono/light.ttf", "c9166464b1db95fc3cdf9b50fc7f98e2")
|
|
89
|
+
ROBOTO_MONO_REGULAR = get_fontfile_tuple("roboto_mono/regular.ttf", "5b04fdfec4c8c36e8ca574e40b7148bb")
|
|
90
|
+
ROBOTO_MONO_BOLD = get_fontfile_tuple("roboto_mono/bold.ttf", "90190d91283189e340b2a44fe560f2cd")
|
|
91
|
+
|
|
92
|
+
# condensed
|
|
93
|
+
ROBOTO_CONDENSED_LIGHT = get_fontfile_tuple("roboto_condensed/light.ttf", "68680c984f72eef7b2e2cf269382f2a6")
|
|
94
|
+
ROBOTO_CONDENSED_REGULAR = get_fontfile_tuple("roboto_condensed/regular.ttf", "f1123f4b3d926ac4f72cc8091a4b5d19")
|
|
95
|
+
ROBOTO_CONDENSED_BOLD = get_fontfile_tuple("roboto_condensed/bold.ttf", "0233b881b26ce6cc3884c6944940d11b")
|
|
96
|
+
|
|
97
|
+
# slab
|
|
98
|
+
ROBOTO_SLAB_LIGHT = get_fontfile_tuple("roboto_slab/light.ttf", "4c63608980b784c679bbadeb18d9acf4")
|
|
99
|
+
ROBOTO_SLAB_REGULAR = get_fontfile_tuple("roboto_slab/regular.ttf", "2100b4a02ebb94c0aa18cabd642ee507")
|
|
100
|
+
ROBOTO_SLAB_BOLD = get_fontfile_tuple("roboto_slab/bold.ttf", "2c44adc1ebd36820fd75012412e6f550")
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
class FontSanSerif(FontBase):
|
|
104
|
+
"""Drawlib Fonts.
|
|
105
|
+
|
|
106
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
107
|
+
Using only internal font files and user provided font file.
|
|
108
|
+
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
# nontserrat
|
|
112
|
+
MONTSERRAT_LIGHT = get_fontfile_tuple("monstserrat/light.ttf", "94fbe93542f684134cad1d775947ca92")
|
|
113
|
+
MONTSERRAT_REGULAR = get_fontfile_tuple("monstserrat/regular.ttf", "5e077c15f6e1d334dd4e9be62b28ac75")
|
|
114
|
+
MONTSERRAT_BOLD = get_fontfile_tuple("monstserrat/bold.ttf", "ed86af2ed5bbaf879e9f2ec2e2eac929")
|
|
115
|
+
|
|
116
|
+
# lato
|
|
117
|
+
LATO_LIGHT = get_fontfile_tuple("lato/light.ttf", "2bcc211c05fc425a57b2767a4cdcf174")
|
|
118
|
+
LATO_REGULAR = get_fontfile_tuple("lato/regular.ttf", "122dd68d69fe9587e062d20d9ff5de2a")
|
|
119
|
+
LATO_BOLD = get_fontfile_tuple("lato/bold.ttf", "24b516c266d7341c954cb2918f1c8f38")
|
|
120
|
+
|
|
121
|
+
# raleways
|
|
122
|
+
RALEWAYS_LIGHT = get_fontfile_tuple("raleways/light.ttf", "a36750fa9f5530b0c2760267df04ae37")
|
|
123
|
+
RALEWAYS_REGULAR = get_fontfile_tuple("raleways/regular.ttf", "d95649da7dfb965a289ac29105ce8771")
|
|
124
|
+
RALEWAYS_BOLD = get_fontfile_tuple("raleways/bold.ttf", "21c82294041b1504a5cbe4f566c8acd6")
|
|
125
|
+
|
|
126
|
+
# oswald
|
|
127
|
+
OSWALD_LIGHT = get_fontfile_tuple("oswald/light.ttf", "fb3af9a7ffb259726bb3cb30b74ab7dc")
|
|
128
|
+
OSWALD_REGULAR = get_fontfile_tuple("oswald/regular.ttf", "b299a657c45aa257f1458b327f491bfb")
|
|
129
|
+
OSWALD_BOLD = get_fontfile_tuple("oswald/bold.ttf", "c95751378db3c5c8bfd993b164e13422")
|
|
130
|
+
|
|
131
|
+
# poppins
|
|
132
|
+
POPPINS_LIGHT = get_fontfile_tuple("poppins/light.ttf", "fcc40ae9a542d001971e53eaed948410")
|
|
133
|
+
POPPINS_REGULAR = get_fontfile_tuple("poppins/regular.ttf", "093ee89be9ede30383f39a899c485a82")
|
|
134
|
+
POPPINS_BOLD = get_fontfile_tuple("poppins/bold.ttf", "08c20a487911694291bd8c5de41315ad")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class FontSerif(FontBase):
|
|
138
|
+
"""Drawlib Fonts.
|
|
139
|
+
|
|
140
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
141
|
+
Using only internal font files and user provided font file.
|
|
142
|
+
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
# courier
|
|
146
|
+
COURIER_REGULAR = get_fontfile_tuple("courier/regular.ttf", "fba4686ed1d1b4ef05ab14db78805dbe")
|
|
147
|
+
COURIER_BOLD = get_fontfile_tuple("courier/bold.ttf", "4acfa45d29d240044e0075a8e58f0862")
|
|
148
|
+
|
|
149
|
+
# merriweather
|
|
150
|
+
MERRIWEATHER_LIGHT = get_fontfile_tuple("merriweather/light.ttf", "eccb6c6a243a3d44219648b6cdbc58ce")
|
|
151
|
+
MERRIWEATHER_REGULAR = get_fontfile_tuple("merriweather/regular.ttf", "e2f219e63a575a41e10f991e9c95819a")
|
|
152
|
+
MERRIWEATHER_BOLD = get_fontfile_tuple("merriweather/bold.ttf", "79ea53fed59f391498dfc6f2fbea97c2")
|
|
153
|
+
|
|
154
|
+
# playfairdisplay
|
|
155
|
+
PLAYFAIRDISPLAY_REGULAR = get_fontfile_tuple("playfairdisplay/regular.ttf", "1a28efdbd2876d90e554a67faabad24b")
|
|
156
|
+
PLAYFAIRDISPLAY_BOLD = get_fontfile_tuple("playfairdisplay/bold.ttf", "9b38798112efb7cf6eca1de031cec4ca")
|
|
157
|
+
|
|
158
|
+
# platypi
|
|
159
|
+
PLATYPI_LIGHT = get_fontfile_tuple("platypi/light.ttf", "113ff25ffa6c98594583200398ab5c71")
|
|
160
|
+
PLATYPI_REGULAR = get_fontfile_tuple("platypi/regular.ttf", "a7f199dd97ff6567df8978b579213e3d")
|
|
161
|
+
PLATYPI_BOLD = get_fontfile_tuple("platypi/bold.ttf", "344e0525c3f473c8959c66e1df44e2e1")
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class FontJapanese(FontBase):
|
|
165
|
+
"""Drawlib Fonts.
|
|
166
|
+
|
|
167
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
168
|
+
Using only internal font files and user provided font file.
|
|
169
|
+
|
|
170
|
+
"""
|
|
171
|
+
|
|
172
|
+
# sansserif
|
|
173
|
+
SANSSERIF_LIGHT = get_fontfile_tuple("noto_sansserif_cjk/light.otf", "88ce9ab7e76fed605c822b52605ac2fd")
|
|
174
|
+
SANSSERIF_REGULAR = get_fontfile_tuple("noto_sansserif_cjk/regular.otf", "6d57a40c6695bd46457315e2a9dc757a")
|
|
175
|
+
SANSSERIF_BOLD = get_fontfile_tuple("noto_sansserif_cjk/bold.otf", "64d01f4e75814352cc9dea68074f4067")
|
|
176
|
+
|
|
177
|
+
# serif
|
|
178
|
+
SERIF_LIGHT = get_fontfile_tuple("noto_serif_cjk/light.otf", "0def63d37c63f0945d1046dae5ab4d83")
|
|
179
|
+
SERIF_REGULAR = get_fontfile_tuple("noto_serif_cjk/regular.otf", "069123ca4dcbdee5cef81ef2f1d2ba8d")
|
|
180
|
+
SERIF_BOLD = get_fontfile_tuple("noto_serif_cjk/bold.otf", "ea7175c0325777d126622340f9c94a66")
|
|
181
|
+
|
|
182
|
+
# mplus1p
|
|
183
|
+
MPLUS1P_LIGHT = get_fontfile_tuple("mplus_1p/light.ttf", "01fea1cae2979588652514d83e9c0423")
|
|
184
|
+
MPLUS1P_REGULAR = get_fontfile_tuple("mplus_1p/regular.ttf", "bfab3ff358a7fa14c5703ad49063cb16")
|
|
185
|
+
MPLUS1P_BOLD = get_fontfile_tuple("mplus_1p/bold.ttf", "aa140061f44d0dda19ab2573a0ad93d3")
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class FontKorean(FontBase):
|
|
189
|
+
"""Drawlib Fonts.
|
|
190
|
+
|
|
191
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
192
|
+
Using only internal font files and user provided font file.
|
|
193
|
+
|
|
194
|
+
"""
|
|
195
|
+
|
|
196
|
+
# sansserif
|
|
197
|
+
SANSSERIF_LIGHT = get_fontfile_tuple("noto_sansserif_cjk/light.otf", "88ce9ab7e76fed605c822b52605ac2fd")
|
|
198
|
+
SANSSERIF_REGULAR = get_fontfile_tuple("noto_sansserif_cjk/regular.otf", "6d57a40c6695bd46457315e2a9dc757a")
|
|
199
|
+
SANSSERIF_BOLD = get_fontfile_tuple("noto_sansserif_cjk/bold.otf", "64d01f4e75814352cc9dea68074f4067")
|
|
200
|
+
|
|
201
|
+
# serif
|
|
202
|
+
SERIF_LIGHT = get_fontfile_tuple("noto_serif_cjk/light.otf", "0def63d37c63f0945d1046dae5ab4d83")
|
|
203
|
+
SERIF_REGULAR = get_fontfile_tuple("noto_serif_cjk/regular.otf", "069123ca4dcbdee5cef81ef2f1d2ba8d")
|
|
204
|
+
SERIF_BOLD = get_fontfile_tuple("noto_serif_cjk/bold.otf", "ea7175c0325777d126622340f9c94a66")
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class FontChinese(FontBase):
|
|
208
|
+
"""Drawlib Fonts.
|
|
209
|
+
|
|
210
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
211
|
+
Using only internal font files and user provided font file.
|
|
212
|
+
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
# sansserif
|
|
216
|
+
SANSSERIF_LIGHT = get_fontfile_tuple("noto_sansserif_cjk/light.otf", "88ce9ab7e76fed605c822b52605ac2fd")
|
|
217
|
+
SANSSERIF_REGULAR = get_fontfile_tuple("noto_sansserif_cjk/regular.otf", "6d57a40c6695bd46457315e2a9dc757a")
|
|
218
|
+
SANSSERIF_BOLD = get_fontfile_tuple("noto_sansserif_cjk/bold.otf", "64d01f4e75814352cc9dea68074f4067")
|
|
219
|
+
|
|
220
|
+
# serif
|
|
221
|
+
SERIF_LIGHT = get_fontfile_tuple("noto_serif_cjk/light.otf", "0def63d37c63f0945d1046dae5ab4d83")
|
|
222
|
+
SERIF_REGULAR = get_fontfile_tuple("noto_serif_cjk/regular.otf", "069123ca4dcbdee5cef81ef2f1d2ba8d")
|
|
223
|
+
SERIF_BOLD = get_fontfile_tuple("noto_serif_cjk/bold.otf", "ea7175c0325777d126622340f9c94a66")
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
class FontThai(FontBase):
|
|
227
|
+
"""Drawlib Fonts.
|
|
228
|
+
|
|
229
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
230
|
+
Using only internal font files and user provided font file.
|
|
231
|
+
|
|
232
|
+
"""
|
|
233
|
+
|
|
234
|
+
# sansserif
|
|
235
|
+
SANSSERIF_LIGHT = get_fontfile_tuple("noto_thai_sans/light.ttf", "fa192df61c8ef9a6a204c6323fdae9dc")
|
|
236
|
+
SANSSERIF_REGULAR = get_fontfile_tuple("noto_thai_sans/regular.ttf", "a84996ee5e940db8c7c2e1375728ca68")
|
|
237
|
+
SANSSERIF_BOLD = get_fontfile_tuple("noto_thai_sans/bold.ttf", "1296256d14a6c704f87967dc06583a64")
|
|
238
|
+
|
|
239
|
+
# serif
|
|
240
|
+
SERIF_LIGHT = get_fontfile_tuple("noto_thai_serif/light.ttf", "70c158b4144d83cba0f7266952ddad2f")
|
|
241
|
+
SERIF_REGULAR = get_fontfile_tuple("noto_thai_serif/regular.ttf", "fe28175fbf4e79f1562d30f60933cab7")
|
|
242
|
+
SERIF_BOLD = get_fontfile_tuple("noto_thai_serif/bold.ttf", "dc10158f174b8141c810880b98ba5a5a")
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class FontArabic(FontBase):
|
|
246
|
+
"""Drawlib Fonts.
|
|
247
|
+
|
|
248
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
249
|
+
Using only internal font files and user provided font file.
|
|
250
|
+
|
|
251
|
+
"""
|
|
252
|
+
|
|
253
|
+
# sans
|
|
254
|
+
SANSSERIF_LIGHT = get_fontfile_tuple("noto_arabic_sans/light.ttf", "ffcfcc231a05032bca6e0819aa60eacb")
|
|
255
|
+
SANSSERIF_REGULAR = get_fontfile_tuple("noto_arabic_sans/regular.ttf", "75527903c6a793772b02807c5343f4c8")
|
|
256
|
+
SANSSERIF_BOLD = get_fontfile_tuple("noto_arabic_sans/bold.ttf", "cda675687ed1576b7bda072838c0ed5f")
|
|
257
|
+
|
|
258
|
+
# naskh
|
|
259
|
+
NASKH_REGULAR = get_fontfile_tuple("noto_arabic_naskh/regular.ttf", "08f2d6bfe92d3e78721a0e1746397344")
|
|
260
|
+
NASKH_BOLD = get_fontfile_tuple("noto_arabic_naskh/bold.ttf", "3e8ac1d70691caf5ddfd36fee8acce3d")
|
|
261
|
+
|
|
262
|
+
# kufi
|
|
263
|
+
KUFI_LIGHT = get_fontfile_tuple("noto_arabic_kufi/light.ttf", "23517c64b528b3c744bfb3be94e58836")
|
|
264
|
+
KUFI_REGULAR = get_fontfile_tuple("noto_arabic_kufi/regular.ttf", "600b529eb4849a54dde020e3ea389de2")
|
|
265
|
+
KUFI_BOLD = get_fontfile_tuple("noto_arabic_kufi/bold.ttf", "34886bd59d48cf9113e1e9386bee615e")
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
class FontMonoSpace(FontBase):
|
|
269
|
+
"""Drawlib Fonts.
|
|
270
|
+
|
|
271
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
272
|
+
Using only internal font files and user provided font file.
|
|
273
|
+
|
|
274
|
+
"""
|
|
275
|
+
|
|
276
|
+
# robotomono
|
|
277
|
+
ROBOTO_MONO_LIGHT = get_fontfile_tuple("roboto_mono/light.ttf", "c9166464b1db95fc3cdf9b50fc7f98e2")
|
|
278
|
+
ROBOTO_MONO_REGULAR = get_fontfile_tuple("roboto_mono/regular.ttf", "5b04fdfec4c8c36e8ca574e40b7148bb")
|
|
279
|
+
ROBOTO_MONO_BOLD = get_fontfile_tuple("roboto_mono/bold.ttf", "90190d91283189e340b2a44fe560f2cd")
|
|
280
|
+
|
|
281
|
+
# courier
|
|
282
|
+
COURIER_REGULAR = get_fontfile_tuple("courier/regular.ttf", "fba4686ed1d1b4ef05ab14db78805dbe")
|
|
283
|
+
COURIER_BOLD = get_fontfile_tuple("courier/bold.ttf", "4acfa45d29d240044e0075a8e58f0862")
|
|
284
|
+
|
|
285
|
+
# source code pro
|
|
286
|
+
SOURCECODEPRO_LIGHT = get_fontfile_tuple("source_han_code_jp/light.otf", "ef1eb2fa9ff7c02e8a3336a70826ad47")
|
|
287
|
+
SOURCECODEPRO_REGULAR = get_fontfile_tuple("source_han_code_jp/regular.otf", "abcdbd5449ad6a30d540221a12f4a0b5")
|
|
288
|
+
SOURCECODEPRO_BOLD = get_fontfile_tuple("source_han_code_jp/bold.otf", "dff5826247909bb8e04b8bf3be893386")
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
class FontSourceCode(FontBase):
|
|
292
|
+
"""Drawlib Fonts which good for source code.
|
|
293
|
+
|
|
294
|
+
Drawlib avoid using system font since it depends on host OS.
|
|
295
|
+
Using only internal font files and user provided font file.
|
|
296
|
+
|
|
297
|
+
"""
|
|
298
|
+
|
|
299
|
+
ROBOTO_MONO = get_fontfile_tuple("roboto_mono/regular.ttf", "5b04fdfec4c8c36e8ca574e40b7148bb")
|
|
300
|
+
COURIER = get_fontfile_tuple("courier/regular.ttf", "fba4686ed1d1b4ef05ab14db78805dbe")
|
|
301
|
+
SOURCECODEPRO = get_fontfile_tuple("source_han_code_jp/regular.otf", "abcdbd5449ad6a30d540221a12f4a0b5")
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
@dataclasses.dataclass
|
|
305
|
+
class FontFile:
|
|
306
|
+
file: str
|
|
307
|
+
|
|
308
|
+
@property # type: ignore[no-redef]
|
|
309
|
+
def file(self) -> Optional[str]:
|
|
310
|
+
"""getter of font_file"""
|
|
311
|
+
|
|
312
|
+
return self._file
|
|
313
|
+
|
|
314
|
+
@file.setter
|
|
315
|
+
def file(self, value: str) -> None:
|
|
316
|
+
"""setter of font_file"""
|
|
317
|
+
|
|
318
|
+
if isinstance(value, property):
|
|
319
|
+
raise ValueError("font file not specified at class FontFile.")
|
|
320
|
+
|
|
321
|
+
path = get_script_relative_path(value)
|
|
322
|
+
if not os.path.exists(path):
|
|
323
|
+
raise FileNotFoundError(f'font file "{path}" does not exist.')
|
|
324
|
+
self._file = path
|