foundrytools-cli 2.0.2__tar.gz → 2.0.4__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.
Files changed (40) hide show
  1. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/PKG-INFO +9 -8
  2. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/pyproject.toml +19 -6
  3. foundrytools_cli-2.0.4/src/foundrytools_cli/__init__.py +3 -0
  4. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/converter/cli.py +3 -1
  5. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/print/cli.py +14 -0
  6. foundrytools_cli-2.0.4/src/foundrytools_cli/commands/print/vf_instances.py +47 -0
  7. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/utils/cli.py +10 -0
  8. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/utils/font_renamer.py +2 -2
  9. foundrytools_cli-2.0.2/.gitignore +0 -161
  10. foundrytools_cli-2.0.2/LICENSE +0 -21
  11. foundrytools_cli-2.0.2/src/foundrytools_cli/__init__.py +0 -3
  12. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/README.md +0 -0
  13. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/__main__.py +0 -0
  14. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/__init__.py +0 -0
  15. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/cff.py +0 -0
  16. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/cmap.py +0 -0
  17. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/converter/__init__.py +0 -0
  18. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/converter/ttf_to_otf.py +0 -0
  19. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/fix/__init__.py +0 -0
  20. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/fix/cli.py +0 -0
  21. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/fix/legacy_accents.py +0 -0
  22. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/fix/vertical_metrics.py +0 -0
  23. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/font.py +0 -0
  24. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/gsub.py +0 -0
  25. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/hhea.py +0 -0
  26. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/name.py +0 -0
  27. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/os_2.py +0 -0
  28. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/otf.py +0 -0
  29. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/post.py +0 -0
  30. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/print/__init__.py +0 -0
  31. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/print/font_info.py +0 -0
  32. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/print/font_names.py +0 -0
  33. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/ttf.py +0 -0
  34. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/utils/__init__.py +0 -0
  35. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/utils/font_organizer.py +0 -0
  36. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/commands/utils/sync_timestamps.py +0 -0
  37. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/utils/__init__.py +0 -0
  38. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/utils/logger.py +0 -0
  39. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/utils/task_runner.py +0 -0
  40. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.4}/src/foundrytools_cli/utils/timer.py +0 -0
@@ -1,15 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: foundrytools-cli
3
- Version: 2.0.2
3
+ Version: 2.0.4
4
4
  Summary: A set of command line tools to inspect, manipulate and convert font files
5
- Project-URL: Homepage, https://github.com/ftCLI/FoundryTools-CLI
5
+ Author: Cesare Gilento
6
6
  Author-email: Cesare Gilento <ftcli@proton.me>
7
7
  License-Expression: MIT
8
- License-File: LICENSE
9
8
  Classifier: Development Status :: 5 - Production/Stable
10
9
  Classifier: Intended Audience :: Developers
11
10
  Classifier: Intended Audience :: End Users/Desktop
12
- Classifier: License :: OSI Approved :: MIT License
13
11
  Classifier: Natural Language :: English
14
12
  Classifier: Operating System :: OS Independent
15
13
  Classifier: Programming Language :: Python :: 3
@@ -18,15 +16,18 @@ Classifier: Programming Language :: Python :: 3.10
18
16
  Classifier: Programming Language :: Python :: 3.11
19
17
  Classifier: Programming Language :: Python :: 3.12
20
18
  Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: License :: OSI Approved :: MIT License
21
20
  Classifier: Topic :: Text Processing :: Fonts
22
- Requires-Python: >=3.9
23
21
  Requires-Dist: afdko>=4.0.2
24
22
  Requires-Dist: click>=8.1.8
25
23
  Requires-Dist: foundrytools>=0.1.4
26
24
  Requires-Dist: loguru>=0.7.3
27
- Requires-Dist: pathvalidate>=3.2.3
28
- Requires-Dist: rich>=14.0.0
29
- Requires-Dist: win32-setctime>=1.2.0; sys_platform >= 'win32'
25
+ Requires-Dist: pathvalidate>=3.3.1
26
+ Requires-Dist: rich>=14.1.0
27
+ Requires-Dist: ufolib2>=0.18.1
28
+ Requires-Dist: win32-setctime>=1.2.0 ; sys_platform >= 'win32'
29
+ Requires-Python: >=3.9
30
+ Project-URL: Homepage, https://github.com/ftCLI/FoundryTools-CLI
30
31
  Description-Content-Type: text/markdown
31
32
 
32
33
  # FoundryTools-CLI
@@ -1,10 +1,10 @@
1
1
  [build-system]
2
- requires = ["hatchling"]
3
- build-backend = "hatchling.build"
2
+ requires = ["uv_build>=0.8.13"]
3
+ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "foundrytools-cli"
7
- dynamic = ["version"]
7
+ version = "2.0.4"
8
8
  description = "A set of command line tools to inspect, manipulate and convert font files"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -34,11 +34,24 @@ dependencies = [
34
34
  "click>=8.1.8",
35
35
  "foundrytools>=0.1.4",
36
36
  "loguru>=0.7.3",
37
- "pathvalidate>=3.2.3",
38
- "rich>=14.0.0",
37
+ "pathvalidate>=3.3.1",
38
+ "rich>=14.1.0",
39
+ "ufolib2>=0.18.1",
39
40
  "win32-setctime>=1.2.0; sys_platform >= 'win32'",
40
41
  ]
41
42
 
43
+ [dependencies-groups]
44
+ dev = [
45
+ "bump-my-version>=1.2.1",
46
+ "mypy>=1.17.1",
47
+ "pre-commit>=4.2.0",
48
+ "pylint>=3.3.8",
49
+ ]
50
+ docs = [
51
+ "sphinx-click>=6.0.0",
52
+ "sphinx-rtd-theme>=3.0.2",
53
+ ]
54
+
42
55
  [project.scripts]
43
56
  ftcli = "foundrytools_cli.__main__:cli"
44
57
 
@@ -58,7 +71,7 @@ exclude = [
58
71
  ]
59
72
 
60
73
  [tool.bumpversion]
61
- current_version = "2.0.2"
74
+ current_version = "2.0.4"
62
75
  commit = true
63
76
  tag = true
64
77
 
@@ -0,0 +1,3 @@
1
+ VERSION = __version__ = "2.0.4"
2
+
3
+ __all__ = ["VERSION"]
@@ -358,6 +358,7 @@ def ttc_to_sfnt(input_path: Path, **options: dict[str, Any]) -> None:
358
358
  recursive = bool(options.get("recursive", False))
359
359
  overwrite = bool(options.get("overwrite", True))
360
360
  recalc_bboxes = bool(options.get("recalc_bboxes", True))
361
+ recalc_timestamp = bool(options.get("recalc_timestamp", False))
361
362
  reorder_tables = bool(options.get("reorder_tables", False))
362
363
 
363
364
  finder = FontFinder(input_path)
@@ -383,8 +384,9 @@ def ttc_to_sfnt(input_path: Path, **options: dict[str, Any]) -> None:
383
384
  logger.info(f"Converting {collection_file} ({num_fonts} fonts in collection)")
384
385
 
385
386
  for font in collection.fonts:
387
+ font.recalcBBoxes = recalc_bboxes
388
+ font.recalcTimestamp = recalc_timestamp
386
389
  font_wrapper = Font(font)
387
- font_wrapper.ttfont.recalcBBoxes = recalc_bboxes
388
390
  file_stem = font_wrapper.t_name.get_debug_name(6)
389
391
  file_ext = font_wrapper.get_file_ext()
390
392
 
@@ -6,10 +6,24 @@ from foundrytools import FontFinder
6
6
 
7
7
  from foundrytools_cli.commands.print.font_info import main as print_font_info
8
8
  from foundrytools_cli.commands.print.font_names import main as print_names
9
+ from foundrytools_cli.commands.print.vf_instances import main as print_vf_instances
9
10
 
10
11
  cli = click.Group(help="Prints various font's information.")
11
12
 
12
13
 
14
+ @cli.command("instances")
15
+ @click.argument("input_path", type=click.Path(exists=True, resolve_path=True, path_type=Path))
16
+ def instances(input_path: Path) -> None:
17
+ """
18
+ Prints a table with the variable font instances.
19
+ """
20
+
21
+ finder = FontFinder(input_path)
22
+ finder.filter.filter_out_static = True
23
+ for font in finder.generate_fonts():
24
+ print_vf_instances(font)
25
+
26
+
13
27
  @cli.command("font-info")
14
28
  @click.argument("input_path", type=click.Path(exists=True, resolve_path=True, path_type=Path))
15
29
  def font_info(input_path: Path) -> None:
@@ -0,0 +1,47 @@
1
+ from fontTools.ttLib.tables._f_v_a_r import Axis, NamedInstance
2
+ from foundrytools import Font
3
+ from rich.console import Console
4
+ from rich.table import Table
5
+
6
+ __all__ = ["main"]
7
+
8
+
9
+ def main(font: Font) -> None:
10
+ """
11
+ Prints the variable font instances in a table format.
12
+ """
13
+ console = Console()
14
+
15
+ table = Table(
16
+ title="\nftCLI - Variable Font Instances Viewer",
17
+ show_header=True,
18
+ header_style="bold cyan",
19
+ title_style="bold green",
20
+ )
21
+
22
+ axes: list[Axis] = font.t_fvar.table.axes
23
+ instances: list[NamedInstance] = font.t_fvar.table.instances
24
+
25
+ table.add_section()
26
+ table.add_column("#")
27
+ for axis in axes:
28
+ table.add_column(axis.axisTag)
29
+ table.add_column("postscriptNameID")
30
+ table.add_column("subfamilyNameID")
31
+
32
+ for count, instance in enumerate(instances, start=1):
33
+ subfamily_name = (
34
+ f"{instance.subfamilyNameID}: "
35
+ f"{font.t_name.table.getDebugName(instance.subfamilyNameID)}"
36
+ )
37
+ postscript_name = (
38
+ f"{instance.postscriptNameID}: "
39
+ f"{font.t_name.table.getDebugName(instance.postscriptNameID)}"
40
+ )
41
+ table.add_row(
42
+ str(count),
43
+ *[str(v) for k, v in instance.coordinates.items() if k in [a.axisTag for a in axes]],
44
+ postscript_name,
45
+ subfamily_name,
46
+ )
47
+ console.print(table)
@@ -54,6 +54,16 @@ cli = click.Group(help="Miscellaneous utilities.")
54
54
  5: CFF TopDict FullName (CFF fonts only)
55
55
  """,
56
56
  )
57
+ @click.option(
58
+ "-o",
59
+ "--overwrite",
60
+ "overwrite",
61
+ is_flag=True,
62
+ help="""
63
+ Allow overwriting output files. THIS MIGHT POTENTIALLY RESULT IN LOSS OF FILES.
64
+ USE WITH CARE.
65
+ """,
66
+ )
57
67
  @recursive_flag()
58
68
  def font_renamer(input_path: Path, **options: dict[str, Any]) -> None:
59
69
  """
@@ -54,7 +54,7 @@ def _get_file_stem(font: Font, source: int = 1) -> str:
54
54
  return sanitize_filename(file_name, platform="auto")
55
55
 
56
56
 
57
- def main(font: Font, source: int = 1) -> None:
57
+ def main(font: Font, source: int = 1, overwrite: bool = False) -> None:
58
58
  """
59
59
  Renames the given font files.
60
60
  """
@@ -71,7 +71,7 @@ def main(font: Font, source: int = 1) -> None:
71
71
  file=Path(new_file_name),
72
72
  extension=font.get_file_ext(),
73
73
  output_dir=old_file.parent,
74
- overwrite=True,
74
+ overwrite=overwrite,
75
75
  )
76
76
  if new_file == old_file:
77
77
  logger.skip(f"{old_file.name} is already named correctly") # type: ignore
@@ -1,161 +0,0 @@
1
- # Byte-compiled / optimized / DLL files
2
- __pycache__/
3
- *.py[cod]
4
- *$py.class
5
-
6
- # C extensions
7
- *.so
8
-
9
- # Distribution / packaging
10
- .Python
11
- build/
12
- develop-eggs/
13
- dist/
14
- downloads/
15
- eggs/
16
- .eggs/
17
- foundryToolsCLI_2/lib/
18
- lib64/
19
- parts/
20
- sdist/
21
- var/
22
- wheels/
23
- share/python-wheels/
24
- *.egg-info/
25
- .installed.cfg
26
- *.egg
27
- MANIFEST
28
-
29
- # PyInstaller
30
- # Usually these files are written by a python script from a template
31
- # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
- *.manifest
33
- *.spec
34
-
35
- # Installer logs
36
- pip-log.txt
37
- pip-delete-this-directory.txt
38
-
39
- # Unit test / coverage reports
40
- htmlcov/
41
- .tox/
42
- .nox/
43
- .coverage
44
- .coverage.*
45
- .cache
46
- nosetests.xml
47
- coverage.xml
48
- *.cover
49
- *.py,cover
50
- .hypothesis/
51
- .pytest_cache/
52
- cover/
53
-
54
- # Translations
55
- *.mo
56
- *.pot
57
-
58
- # Django stuff:
59
- *.log
60
- local_settings.py
61
- db.sqlite3
62
- db.sqlite3-journal
63
-
64
- # Flask stuff:
65
- instance/
66
- .webassets-cache
67
-
68
- # Scrapy stuff:
69
- .scrapy
70
-
71
- # Sphinx documentation
72
- docs/_build/
73
-
74
- # PyBuilder
75
- .pybuilder/
76
- target/
77
-
78
- # Jupyter Notebook
79
- .ipynb_checkpoints
80
-
81
- # IPython
82
- profile_default/
83
- ipython_config.py
84
-
85
- # pyenv
86
- # For a library or package, you might want to ignore these files since the code is
87
- # intended to run in multiple environments; otherwise, check them in:
88
- # .python-version
89
-
90
- # pipenv
91
- # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
- # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
- # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
- # install all needed dependencies.
95
- #Pipfile.lock
96
-
97
- # poetry
98
- # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
- # This is especially recommended for binary packages to ensure reproducibility, and is more
100
- # commonly ignored for libraries.
101
- # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
- #poetry.lock
103
-
104
- # pdm
105
- # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
- #pdm.lock
107
- # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
- # in version control.
109
- # https://pdm.fming.dev/#use-with-ide
110
- .pdm.toml
111
-
112
- # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
- __pypackages__/
114
-
115
- # Celery stuff
116
- celerybeat-schedule
117
- celerybeat.pid
118
-
119
- # SageMath parsed files
120
- *.sage.py
121
-
122
- # Environments
123
- .env
124
- .venv
125
- env/
126
- venv/
127
- ENV/
128
- env.bak/
129
- venv.bak/
130
-
131
- # Spyder project settings
132
- .spyderproject
133
- .spyproject
134
-
135
- # Rope project settings
136
- .ropeproject
137
-
138
- # mkdocs documentation
139
- /site
140
-
141
- # mypy
142
- .mypy_cache/
143
- .dmypy.json
144
- dmypy.json
145
-
146
- # Pyre type checker
147
- .pyre/
148
-
149
- # pytype static type analyzer
150
- .pytype/
151
-
152
- # Cython debug symbols
153
- cython_debug/
154
-
155
- # PyCharm
156
- # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
- # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
- # and can be added to the global gitignore or merged into this file. For a more nuclear
159
- # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
- #.idea/
161
- .qodo
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 ftCLI
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
@@ -1,3 +0,0 @@
1
- VERSION = __version__ = "2.0.2"
2
-
3
- __all__ = ["VERSION"]