foundrytools-cli 2.0.1__tar.gz → 2.0.3__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.1 → foundrytools_cli-2.0.3}/PKG-INFO +3 -12
  2. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/pyproject.toml +3 -16
  3. foundrytools_cli-2.0.3/src/foundrytools_cli/__init__.py +3 -0
  4. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/converter/cli.py +3 -1
  5. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/cli.py +14 -0
  6. foundrytools_cli-2.0.3/src/foundrytools_cli/commands/print/vf_instances.py +47 -0
  7. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/cli.py +10 -0
  8. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/font_renamer.py +2 -2
  9. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/__init__.py +5 -7
  10. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/task_runner.py +2 -2
  11. foundrytools_cli-2.0.1/src/foundrytools_cli/__init__.py +0 -3
  12. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/.gitignore +0 -0
  13. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/LICENSE +0 -0
  14. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/README.md +0 -0
  15. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/__main__.py +0 -0
  16. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/__init__.py +0 -0
  17. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/cff.py +0 -0
  18. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/cmap.py +0 -0
  19. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/converter/__init__.py +0 -0
  20. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/converter/ttf_to_otf.py +0 -0
  21. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/__init__.py +0 -0
  22. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/cli.py +0 -0
  23. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/legacy_accents.py +0 -0
  24. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/vertical_metrics.py +0 -0
  25. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/font.py +0 -0
  26. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/gsub.py +0 -0
  27. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/hhea.py +0 -0
  28. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/name.py +0 -0
  29. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/os_2.py +0 -0
  30. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/otf.py +0 -0
  31. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/post.py +0 -0
  32. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/__init__.py +0 -0
  33. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/font_info.py +0 -0
  34. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/font_names.py +0 -0
  35. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/ttf.py +0 -0
  36. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/__init__.py +0 -0
  37. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/font_organizer.py +0 -0
  38. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/sync_timestamps.py +0 -0
  39. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/logger.py +0 -0
  40. {foundrytools_cli-2.0.1 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/timer.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: foundrytools-cli
3
- Version: 2.0.1
3
+ Version: 2.0.3
4
4
  Summary: A set of command line tools to inspect, manipulate and convert font files
5
5
  Project-URL: Homepage, https://github.com/ftCLI/FoundryTools-CLI
6
6
  Author-email: Cesare Gilento <ftcli@proton.me>
@@ -24,18 +24,9 @@ Requires-Dist: afdko>=4.0.2
24
24
  Requires-Dist: click>=8.1.8
25
25
  Requires-Dist: foundrytools>=0.1.4
26
26
  Requires-Dist: loguru>=0.7.3
27
- Requires-Dist: pathvalidate>=3.2.3
28
- Requires-Dist: rich>=14.0.0
27
+ Requires-Dist: pathvalidate>=3.3.1
28
+ Requires-Dist: rich>=14.1.0
29
29
  Requires-Dist: win32-setctime>=1.2.0; sys_platform >= 'win32'
30
- Provides-Extra: dev
31
- Requires-Dist: bump-my-version>=1.1.2; extra == 'dev'
32
- Requires-Dist: hatch>=1.14.1; extra == 'dev'
33
- Requires-Dist: mypy>=1.15.0; extra == 'dev'
34
- Requires-Dist: pre-commit>=4.2.0; extra == 'dev'
35
- Requires-Dist: pylint>=3.3.6; extra == 'dev'
36
- Provides-Extra: docs
37
- Requires-Dist: sphinx-click>=6.0.0; extra == 'docs'
38
- Requires-Dist: sphinx-rtd-theme>=3.0.2; extra == 'docs'
39
30
  Description-Content-Type: text/markdown
40
31
 
41
32
  # FoundryTools-CLI
@@ -34,8 +34,8 @@ 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
39
  "win32-setctime>=1.2.0; sys_platform >= 'win32'",
40
40
  ]
41
41
 
@@ -45,19 +45,6 @@ ftcli = "foundrytools_cli.__main__:cli"
45
45
  [project.urls]
46
46
  Homepage = "https://github.com/ftCLI/FoundryTools-CLI"
47
47
 
48
- [project.optional-dependencies]
49
- dev = [
50
- "bump-my-version>=1.1.2",
51
- "hatch>=1.14.1",
52
- "mypy>=1.15.0",
53
- "pre-commit>=4.2.0",
54
- "pylint>=3.3.6",
55
- ]
56
- docs = [
57
- "sphinx-click>=6.0.0",
58
- "sphinx-rtd-theme>=3.0.2",
59
- ]
60
-
61
48
  [tool.hatch.version]
62
49
  path = "src/foundrytools_cli/__init__.py"
63
50
  pattern = 'VERSION = __version__ = "(?P<version>[^"]+)"'
@@ -71,7 +58,7 @@ exclude = [
71
58
  ]
72
59
 
73
60
  [tool.bumpversion]
74
- current_version = "2.0.1"
61
+ current_version = "2.0.3"
75
62
  commit = true
76
63
  tag = true
77
64
 
@@ -0,0 +1,3 @@
1
+ VERSION = __version__ = "2.0.3"
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
@@ -54,17 +54,15 @@ class BaseCommand(click.Command):
54
54
  """,
55
55
  ),
56
56
  click.Option(
57
- ["-rbb", "--recalc-bboxes", "recalc_bboxes"],
57
+ ["-no-rbb", "--no-recalc-bboxes", "recalc_bboxes"],
58
58
  is_flag=True,
59
- default=False,
59
+ default=True,
60
60
  help="""
61
- Recalculate the font's bounding boxes on save.
61
+ Do not recalculate the font's bounding boxes on save.
62
62
 
63
63
  By default, ``glyf``, ``CFF ``, ``head`` bounding box values and ``hhea``/``vhea``
64
- min/max values are not recalculated on save.
65
-
66
- When this option is active, the glyphs are compiled on importing, which saves memory
67
- consumption and time.
64
+ min/max values are recalculated on save. Also, the glyphs are compiled on importing,
65
+ which saves memory consumption and time.
68
66
  """,
69
67
  ),
70
68
  click.Option(
@@ -194,6 +194,6 @@ class TaskRunner: # pylint: disable=too-few-public-methods
194
194
  @staticmethod
195
195
  def _log_error(e: Exception) -> None:
196
196
  if hasattr(e, "__module__"):
197
- logger.opt(colors=True).error(f"<lr>{e.__module__}.{type(e).__name__}</lr>: {e}")
197
+ logger.opt(colors=True).exception(f"<lr>{e.__module__}.{type(e).__name__}</lr>: {e}")
198
198
  else:
199
- logger.opt(colors=True).error(f"<lr>{type(e).__name__}</lr>: {e}")
199
+ logger.opt(colors=True).exception(f"<lr>{type(e).__name__}</lr>: {e}")
@@ -1,3 +0,0 @@
1
- VERSION = __version__ = "2.0.1"
2
-
3
- __all__ = ["VERSION"]