foundrytools-cli 2.0.2__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.2 → foundrytools_cli-2.0.3}/PKG-INFO +3 -3
  2. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/pyproject.toml +3 -3
  3. foundrytools_cli-2.0.3/src/foundrytools_cli/__init__.py +3 -0
  4. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/converter/cli.py +3 -1
  5. {foundrytools_cli-2.0.2 → 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.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/cli.py +10 -0
  8. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/font_renamer.py +2 -2
  9. foundrytools_cli-2.0.2/src/foundrytools_cli/__init__.py +0 -3
  10. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/.gitignore +0 -0
  11. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/LICENSE +0 -0
  12. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/README.md +0 -0
  13. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/__main__.py +0 -0
  14. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/__init__.py +0 -0
  15. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/cff.py +0 -0
  16. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/cmap.py +0 -0
  17. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/converter/__init__.py +0 -0
  18. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/converter/ttf_to_otf.py +0 -0
  19. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/__init__.py +0 -0
  20. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/cli.py +0 -0
  21. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/legacy_accents.py +0 -0
  22. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/fix/vertical_metrics.py +0 -0
  23. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/font.py +0 -0
  24. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/gsub.py +0 -0
  25. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/hhea.py +0 -0
  26. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/name.py +0 -0
  27. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/os_2.py +0 -0
  28. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/otf.py +0 -0
  29. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/post.py +0 -0
  30. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/__init__.py +0 -0
  31. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/font_info.py +0 -0
  32. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/print/font_names.py +0 -0
  33. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/ttf.py +0 -0
  34. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/__init__.py +0 -0
  35. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/font_organizer.py +0 -0
  36. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/commands/utils/sync_timestamps.py +0 -0
  37. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/__init__.py +0 -0
  38. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/logger.py +0 -0
  39. {foundrytools_cli-2.0.2 → foundrytools_cli-2.0.3}/src/foundrytools_cli/utils/task_runner.py +0 -0
  40. {foundrytools_cli-2.0.2 → 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.2
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,8 +24,8 @@ 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
30
  Description-Content-Type: text/markdown
31
31
 
@@ -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
 
@@ -58,7 +58,7 @@ exclude = [
58
58
  ]
59
59
 
60
60
  [tool.bumpversion]
61
- current_version = "2.0.2"
61
+ current_version = "2.0.3"
62
62
  commit = true
63
63
  tag = true
64
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
@@ -1,3 +0,0 @@
1
- VERSION = __version__ = "2.0.2"
2
-
3
- __all__ = ["VERSION"]