python-fontbro 0.22.0__tar.gz → 0.23.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.22.0/python_fontbro.egg-info → python_fontbro-0.23.1}/PKG-INFO +39 -1
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/README.md +38 -0
- python_fontbro-0.23.1/fontbro/data/family-classifications.json +825 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/font.py +193 -3
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/metadata.py +1 -1
- python_fontbro-0.23.1/fontbro/utils.py +50 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1/python_fontbro.egg-info}/PKG-INFO +39 -1
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/python_fontbro.egg-info/SOURCES.txt +2 -0
- python_fontbro-0.23.1/tests/test_family_classification.py +111 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_sanitize.py +3 -2
- python_fontbro-0.22.0/fontbro/utils.py +0 -30
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/LICENSE.txt +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/MANIFEST.in +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/__init__.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/data/features.json +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/data/unicode-blocks.json +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/data/unicode-scripts.json +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/exceptions.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/flags.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/math.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/py.typed +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/fontbro/subset.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/pyproject.toml +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/python_fontbro.egg-info/dependency_links.txt +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/python_fontbro.egg-info/requires.txt +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/python_fontbro.egg-info/top_level.txt +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/setup.cfg +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/setup.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_characters.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_clone.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_close.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_collection.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_context_manager.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_family_name.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_features.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_filename.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_fingerprint.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_format.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_glyphs.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_image.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_init.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_instantiation.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_issues.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_italic_angle.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_monospace.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_names.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_rename.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_save.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_str.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_style_flags.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_style_name.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_subset.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_unicode_blocks_and_scripts.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_update_unicode_data.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_variable.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_version.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_vertical_metrics.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_weight.py +0 -0
- {python_fontbro-0.22.0 → python_fontbro-0.23.1}/tests/test_width.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: python-fontbro
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.23.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>
|
|
@@ -101,6 +101,7 @@ with open("fonts/MyFont.ttf") as fh:
|
|
|
101
101
|
- [`from_collection`](#from_collection)
|
|
102
102
|
- [`get_characters`](#get_characters)
|
|
103
103
|
- [`get_characters_count`](#get_characters_count)
|
|
104
|
+
- [`get_family_classification`](#get_family_classification)
|
|
104
105
|
- [`get_family_name`](#get_family_name)
|
|
105
106
|
- [`get_features`](#get_features)
|
|
106
107
|
- [`get_features_tags`](#get_features_tags)
|
|
@@ -142,6 +143,7 @@ with open("fonts/MyFont.ttf") as fh:
|
|
|
142
143
|
- [`save_as_woff2`](#save_as_woff2)
|
|
143
144
|
- [`save_to_file_object`](#save_to_file_object)
|
|
144
145
|
- [`save_variable_instances`](#save_variable_instances)
|
|
146
|
+
- [`set_family_classification`](#set_family_classification)
|
|
145
147
|
- [`set_family_name`](#set_family_name)
|
|
146
148
|
- [`set_name`](#set_name)
|
|
147
149
|
- [`set_names`](#set_names)
|
|
@@ -214,6 +216,26 @@ Gets the font characters count.
|
|
|
214
216
|
chars_count = font.get_characters_count(ignore_blank=False)
|
|
215
217
|
```
|
|
216
218
|
|
|
219
|
+
#### `get_family_classification`
|
|
220
|
+
```python
|
|
221
|
+
"""
|
|
222
|
+
Gets the font family classification info reading
|
|
223
|
+
the sFamilyClass field from the OS/2 table.
|
|
224
|
+
If the OS/2 table is not available None is returned.
|
|
225
|
+
|
|
226
|
+
:returns: A dictionary containing the font family classification info, e.g.
|
|
227
|
+
{
|
|
228
|
+
"full_name": "Sans Serif / Neo-grotesque Gothic",
|
|
229
|
+
"class_id": 8,
|
|
230
|
+
"class_name": "Sans Serif",
|
|
231
|
+
"subclass_id": 5,
|
|
232
|
+
"subclass_name": "Neo-grotesque Gothic",
|
|
233
|
+
}
|
|
234
|
+
:rtype: dict
|
|
235
|
+
"""
|
|
236
|
+
family_classification = font.get_family_classification()
|
|
237
|
+
```
|
|
238
|
+
|
|
217
239
|
#### `get_family_name`
|
|
218
240
|
```python
|
|
219
241
|
"""
|
|
@@ -786,6 +808,22 @@ Save all instances of a variable font to specified directory in one or more form
|
|
|
786
808
|
saved_fonts = font.save_variable_instances(dirpath, woff2=True, woff=True, overwrite=True, **options)
|
|
787
809
|
```
|
|
788
810
|
|
|
811
|
+
#### `set_family_classification`
|
|
812
|
+
```python
|
|
813
|
+
"""
|
|
814
|
+
Sets font family classification (sFamilyClass in the OS/2 table)
|
|
815
|
+
based on provided class_id and subclass_id.
|
|
816
|
+
|
|
817
|
+
:param class_id: Numeric identifier of the font family class.
|
|
818
|
+
:param subclass_id: Optional numeric identifier of the font family subclass (default is 0).
|
|
819
|
+
:raises OperationError: If the OS/2 table is not available in the font.
|
|
820
|
+
:raises ArgumentError: If class_id is invalid or subclass_id is specified but invalid.
|
|
821
|
+
"""
|
|
822
|
+
font.set_family_classification(**font.FAMILY_CLASSIFICATION_SCRIPTS_CALLIGRAPHIC)
|
|
823
|
+
# alternatively:
|
|
824
|
+
font.set_family_classification(class_id=10, subclass_id=5)
|
|
825
|
+
```
|
|
826
|
+
|
|
789
827
|
#### `set_family_name`
|
|
790
828
|
```python
|
|
791
829
|
"""
|
|
@@ -39,6 +39,7 @@ with open("fonts/MyFont.ttf") as fh:
|
|
|
39
39
|
- [`from_collection`](#from_collection)
|
|
40
40
|
- [`get_characters`](#get_characters)
|
|
41
41
|
- [`get_characters_count`](#get_characters_count)
|
|
42
|
+
- [`get_family_classification`](#get_family_classification)
|
|
42
43
|
- [`get_family_name`](#get_family_name)
|
|
43
44
|
- [`get_features`](#get_features)
|
|
44
45
|
- [`get_features_tags`](#get_features_tags)
|
|
@@ -80,6 +81,7 @@ with open("fonts/MyFont.ttf") as fh:
|
|
|
80
81
|
- [`save_as_woff2`](#save_as_woff2)
|
|
81
82
|
- [`save_to_file_object`](#save_to_file_object)
|
|
82
83
|
- [`save_variable_instances`](#save_variable_instances)
|
|
84
|
+
- [`set_family_classification`](#set_family_classification)
|
|
83
85
|
- [`set_family_name`](#set_family_name)
|
|
84
86
|
- [`set_name`](#set_name)
|
|
85
87
|
- [`set_names`](#set_names)
|
|
@@ -152,6 +154,26 @@ Gets the font characters count.
|
|
|
152
154
|
chars_count = font.get_characters_count(ignore_blank=False)
|
|
153
155
|
```
|
|
154
156
|
|
|
157
|
+
#### `get_family_classification`
|
|
158
|
+
```python
|
|
159
|
+
"""
|
|
160
|
+
Gets the font family classification info reading
|
|
161
|
+
the sFamilyClass field from the OS/2 table.
|
|
162
|
+
If the OS/2 table is not available None is returned.
|
|
163
|
+
|
|
164
|
+
:returns: A dictionary containing the font family classification info, e.g.
|
|
165
|
+
{
|
|
166
|
+
"full_name": "Sans Serif / Neo-grotesque Gothic",
|
|
167
|
+
"class_id": 8,
|
|
168
|
+
"class_name": "Sans Serif",
|
|
169
|
+
"subclass_id": 5,
|
|
170
|
+
"subclass_name": "Neo-grotesque Gothic",
|
|
171
|
+
}
|
|
172
|
+
:rtype: dict
|
|
173
|
+
"""
|
|
174
|
+
family_classification = font.get_family_classification()
|
|
175
|
+
```
|
|
176
|
+
|
|
155
177
|
#### `get_family_name`
|
|
156
178
|
```python
|
|
157
179
|
"""
|
|
@@ -724,6 +746,22 @@ Save all instances of a variable font to specified directory in one or more form
|
|
|
724
746
|
saved_fonts = font.save_variable_instances(dirpath, woff2=True, woff=True, overwrite=True, **options)
|
|
725
747
|
```
|
|
726
748
|
|
|
749
|
+
#### `set_family_classification`
|
|
750
|
+
```python
|
|
751
|
+
"""
|
|
752
|
+
Sets font family classification (sFamilyClass in the OS/2 table)
|
|
753
|
+
based on provided class_id and subclass_id.
|
|
754
|
+
|
|
755
|
+
:param class_id: Numeric identifier of the font family class.
|
|
756
|
+
:param subclass_id: Optional numeric identifier of the font family subclass (default is 0).
|
|
757
|
+
:raises OperationError: If the OS/2 table is not available in the font.
|
|
758
|
+
:raises ArgumentError: If class_id is invalid or subclass_id is specified but invalid.
|
|
759
|
+
"""
|
|
760
|
+
font.set_family_classification(**font.FAMILY_CLASSIFICATION_SCRIPTS_CALLIGRAPHIC)
|
|
761
|
+
# alternatively:
|
|
762
|
+
font.set_family_classification(class_id=10, subclass_id=5)
|
|
763
|
+
```
|
|
764
|
+
|
|
727
765
|
#### `set_family_name`
|
|
728
766
|
```python
|
|
729
767
|
"""
|