python-fontbro 0.32.0__tar.gz → 0.32.1__tar.gz
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.
- {python_fontbro-0.32.0/python_fontbro.egg-info → python_fontbro-0.32.1}/PKG-INFO +2 -1
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/metadata.py +1 -1
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/variable.py +6 -2
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/pyproject.toml +2 -1
- {python_fontbro-0.32.0 → python_fontbro-0.32.1/python_fontbro.egg-info}/PKG-INFO +2 -1
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_instantiation.py +9 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_variable.py +41 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/LICENSE.txt +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/MANIFEST.in +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/README.md +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/__init__.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/bitmap.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/color.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/data/family-classifications.json +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/data/features.json +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/data/unicode-blocks.json +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/data/unicode-scripts.json +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/embedding_permissions.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/exceptions.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/family_classification.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/features.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/files.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/fingerprint.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/flags.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/font.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/glyphs.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/math.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/metrics.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/monospace.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/names.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/pixel.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/py.typed +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/render.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/sanitize.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/style_flags.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/subset.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/support.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/tables.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/unicode.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/utils.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/fontbro/version.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/python_fontbro.egg-info/SOURCES.txt +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/python_fontbro.egg-info/dependency_links.txt +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/python_fontbro.egg-info/requires.txt +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/python_fontbro.egg-info/top_level.txt +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/setup.cfg +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/setup.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_bitmap.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_characters.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_clone.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_close.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_collection.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_color.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_context_manager.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_embedding_permissions.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_exceptions.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_family_classification.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_family_name.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_features.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_filename.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_fingerprint.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_format.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_glyphs.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_image.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_init.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_issues.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_italic_angle.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_monospace.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_names.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_pixel.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_rename.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_sanitize.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_save.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_str.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_style_flags.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_style_name.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_subset.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_support.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_svg.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_tables.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_unicode.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_unicode_blocks_and_scripts.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_update_unicode_data.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_version.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_vertical_metrics.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_weight.py +0 -0
- {python_fontbro-0.32.0 → python_fontbro-0.32.1}/tests/test_width.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-fontbro
|
|
3
|
-
Version: 0.32.
|
|
3
|
+
Version: 0.32.1
|
|
4
4
|
Summary: friendly font operations on top of fontTools.
|
|
5
5
|
Author-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
6
6
|
Maintainer-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
@@ -47,6 +47,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
47
47
|
Classifier: Programming Language :: Python :: 3.12
|
|
48
48
|
Classifier: Programming Language :: Python :: 3.13
|
|
49
49
|
Classifier: Programming Language :: Python :: 3.14
|
|
50
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
50
51
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
51
52
|
Classifier: Topic :: Text Processing :: Fonts
|
|
52
53
|
Classifier: Topic :: Multimedia :: Graphics
|
|
@@ -175,11 +175,15 @@ def get_variable_instance_by_style_name(
|
|
|
175
175
|
style_name: str,
|
|
176
176
|
) -> dict[str, Any] | None:
|
|
177
177
|
"""
|
|
178
|
-
Gets the variable instance of the given font by style name
|
|
178
|
+
Gets the variable instance of the given font by style name,
|
|
179
|
+
the instances without a name record (style name None) are skipped.
|
|
179
180
|
"""
|
|
181
|
+
if not style_name:
|
|
182
|
+
return None
|
|
180
183
|
instances = get_variable_instances(ttfont) or []
|
|
181
184
|
for instance in instances:
|
|
182
|
-
|
|
185
|
+
instance_style_name = instance["style_name"]
|
|
186
|
+
if instance_style_name and slugify(instance_style_name) == slugify(style_name):
|
|
183
187
|
return instance
|
|
184
188
|
return None
|
|
185
189
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools"]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
@@ -44,6 +44,7 @@ classifiers = [
|
|
|
44
44
|
"Programming Language :: Python :: 3.12",
|
|
45
45
|
"Programming Language :: Python :: 3.13",
|
|
46
46
|
"Programming Language :: Python :: 3.14",
|
|
47
|
+
"Programming Language :: Python :: 3.15",
|
|
47
48
|
"Programming Language :: Python :: Implementation :: PyPy",
|
|
48
49
|
"Topic :: Text Processing :: Fonts",
|
|
49
50
|
"Topic :: Multimedia :: Graphics",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-fontbro
|
|
3
|
-
Version: 0.32.
|
|
3
|
+
Version: 0.32.1
|
|
4
4
|
Summary: friendly font operations on top of fontTools.
|
|
5
5
|
Author-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
6
6
|
Maintainer-email: Fabio Caccamo <fabio.caccamo@gmail.com>
|
|
@@ -47,6 +47,7 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
47
47
|
Classifier: Programming Language :: Python :: 3.12
|
|
48
48
|
Classifier: Programming Language :: Python :: 3.13
|
|
49
49
|
Classifier: Programming Language :: Python :: 3.14
|
|
50
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
50
51
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
51
52
|
Classifier: Topic :: Text Processing :: Fonts
|
|
52
53
|
Classifier: Topic :: Multimedia :: Graphics
|
|
@@ -85,6 +85,15 @@ class InstantiationTestCase(AbstractTestCase):
|
|
|
85
85
|
self.assertNotIn("STAT", ttfont)
|
|
86
86
|
self.assertEqual(font.get_name(Font.NAME_POSTSCRIPT_NAME), "Tourney-Black")
|
|
87
87
|
|
|
88
|
+
def test_to_static_with_style_name_and_unnamed_instance(self):
|
|
89
|
+
font = self._get_variable_font()
|
|
90
|
+
ttfont = font.get_ttfont()
|
|
91
|
+
thin_instance = ttfont["fvar"].instances[0]
|
|
92
|
+
ttfont["name"].removeNames(nameID=thin_instance.subfamilyNameID)
|
|
93
|
+
font.to_static(style_name="Black")
|
|
94
|
+
self.assertTrue(font.is_static())
|
|
95
|
+
self.assertEqual(font.get_weight()["value"], 900)
|
|
96
|
+
|
|
88
97
|
def test_to_static_with_style_name_invalid(self):
|
|
89
98
|
font = self._get_variable_font()
|
|
90
99
|
with self.assertRaises(ValueError):
|
|
@@ -85,6 +85,47 @@ class VariableTestCase(AbstractTestCase):
|
|
|
85
85
|
instances = font.get_variable_instances()
|
|
86
86
|
self.assertEqual(instances, None)
|
|
87
87
|
|
|
88
|
+
def test_get_variable_instance_by_style_name(self):
|
|
89
|
+
font = self._get_font("/Roboto_Mono/RobotoMono-VariableFont_wght.ttf")
|
|
90
|
+
instance = font.get_variable_instance_by_style_name("Bold")
|
|
91
|
+
self.assertEqual(
|
|
92
|
+
instance,
|
|
93
|
+
{
|
|
94
|
+
"coordinates": {"wght": 700.0},
|
|
95
|
+
"style_name": "Bold",
|
|
96
|
+
},
|
|
97
|
+
)
|
|
98
|
+
instance = font.get_variable_instance_by_style_name("Black")
|
|
99
|
+
self.assertEqual(instance, None)
|
|
100
|
+
|
|
101
|
+
def test_get_variable_instance_by_style_name_with_unnamed_instance(self):
|
|
102
|
+
font = self._get_font("/Roboto_Mono/RobotoMono-VariableFont_wght.ttf")
|
|
103
|
+
ttfont = font.get_ttfont()
|
|
104
|
+
thin_instance = ttfont["fvar"].instances[0]
|
|
105
|
+
ttfont["name"].removeNames(nameID=thin_instance.subfamilyNameID)
|
|
106
|
+
self.assertEqual(font.get_variable_instances()[0]["style_name"], None)
|
|
107
|
+
instance = font.get_variable_instance_by_style_name("Bold")
|
|
108
|
+
self.assertEqual(
|
|
109
|
+
instance,
|
|
110
|
+
{
|
|
111
|
+
"coordinates": {"wght": 700.0},
|
|
112
|
+
"style_name": "Bold",
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
instance = font.get_variable_instance_by_style_name("Thin")
|
|
116
|
+
self.assertEqual(instance, None)
|
|
117
|
+
|
|
118
|
+
def test_get_variable_instance_by_style_name_without_style_name(self):
|
|
119
|
+
font = self._get_font("/Roboto_Mono/RobotoMono-VariableFont_wght.ttf")
|
|
120
|
+
ttfont = font.get_ttfont()
|
|
121
|
+
# a style name without ascii characters has an empty slug
|
|
122
|
+
thin_instance = ttfont["fvar"].instances[0]
|
|
123
|
+
ttfont["name"].setName("太字", thin_instance.subfamilyNameID, 3, 1, 0x409)
|
|
124
|
+
instance = font.get_variable_instance_by_style_name("")
|
|
125
|
+
self.assertEqual(instance, None)
|
|
126
|
+
instance = font.get_variable_instance_by_style_name(None)
|
|
127
|
+
self.assertEqual(instance, None)
|
|
128
|
+
|
|
88
129
|
def test_get_variable_instance_closest_to_coordinates(self):
|
|
89
130
|
font = self._get_font("/Roboto_Mono/RobotoMono-VariableFont_wght.ttf")
|
|
90
131
|
closest_instance = font.get_variable_instance_closest_to_coordinates(
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{python_fontbro-0.32.0 → python_fontbro-0.32.1}/python_fontbro.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|