foundrytools-cli 2.0.2__py3-none-any.whl → 2.0.3__py3-none-any.whl

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.
@@ -1,3 +1,3 @@
1
- VERSION = __version__ = "2.0.2"
1
+ VERSION = __version__ = "2.0.3"
2
2
 
3
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,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
 
@@ -1,4 +1,4 @@
1
- foundrytools_cli/__init__.py,sha256=rQLFdxwqnWiRNOolWLG4EmGq2YPMOkvlP2aIIsOLJsI,55
1
+ foundrytools_cli/__init__.py,sha256=ZBo1uG8y3irb0Nq0Q7OFC2cqSknmLPX2Fezjc7QFQEQ,55
2
2
  foundrytools_cli/__main__.py,sha256=KbGmBzK1G41I6uLPlw4tOWcN4KBdN3t-9JP7-JdiBa8,1319
3
3
  foundrytools_cli/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
4
  foundrytools_cli/commands/cff.py,sha256=892d4o4s6rE9tUIFDN-UjwLayGwDXvMuiG3MZOdJrGE,3359
@@ -12,27 +12,28 @@ foundrytools_cli/commands/otf.py,sha256=uienJ97SlDZ0iWPsNU5wJdosjDBxrKZPjpYG68lz
12
12
  foundrytools_cli/commands/post.py,sha256=DpKVNuvvyxF14SsA0gYc09-Asw_4_T8wpYC62uiGa7U,2038
13
13
  foundrytools_cli/commands/ttf.py,sha256=0ZJc36MM8m12_reMVD6GS5ZpSt84g_9RpXrKz_zqqfI,2151
14
14
  foundrytools_cli/commands/converter/__init__.py,sha256=4p2HoanTsHRDQBYod4dYIFreH2sSRWo1VpxfYWeX9lA,75
15
- foundrytools_cli/commands/converter/cli.py,sha256=W54AruWhytWL5V1mvWmdwOJTMEa0TkZgtxUmw55fo_g,12918
15
+ foundrytools_cli/commands/converter/cli.py,sha256=tqL4Etfx_6UFOXGU5GbW0P7dpdBP6Eky56xov_DHIZs,13023
16
16
  foundrytools_cli/commands/converter/ttf_to_otf.py,sha256=2FM2bAaof_4aPSbZlJLeJ027j6N9w4Ns1g5jU-iGy2o,7665
17
17
  foundrytools_cli/commands/fix/__init__.py,sha256=1kJOW26OAkCYYvYDG2H9sCSqqQUQEtwzyxAqCrNfKeU,69
18
18
  foundrytools_cli/commands/fix/cli.py,sha256=t1c44mnQg6kLI-7rss_ju-wMVsbjxMaWSqCGbzvDzEc,16507
19
19
  foundrytools_cli/commands/fix/legacy_accents.py,sha256=pUHWxV-a2GZgI8W_K2u-lu2yMQt5YKEpQHUD9FyKl8A,2094
20
20
  foundrytools_cli/commands/fix/vertical_metrics.py,sha256=j563oWfe3znOKuEW333Yx60d_14Nt0cGdXg3mkCTIN8,691
21
21
  foundrytools_cli/commands/print/__init__.py,sha256=B1h44RtXGw3V4X5se75oCvQPWkh0RbQ0luHxK6z4ge8,71
22
- foundrytools_cli/commands/print/cli.py,sha256=hlgm_cSFqXwiP40_CbOxsYJBTTri_Ru3QT0FZsDGzzo,1470
22
+ foundrytools_cli/commands/print/cli.py,sha256=tWVHV8vLChiMFwHMgIomQCAhdQp9kTipb3fnpV3P5Ik,1941
23
23
  foundrytools_cli/commands/print/font_info.py,sha256=PNeqiJJApIJsyj_ycBMCLU_JE56srkTB-gNWEQ9U3Gk,7824
24
24
  foundrytools_cli/commands/print/font_names.py,sha256=4HL3APW4hjfAg__e2w3fohsxOkn67PFrfAoZ-C4mDsY,4845
25
+ foundrytools_cli/commands/print/vf_instances.py,sha256=vpp3sMyCcNh9f6CBbOn5lnWr4nzNaIX_ANvyw6R2zWY,1398
25
26
  foundrytools_cli/commands/utils/__init__.py,sha256=bF8Ue4I4QAaDplSpDSMvtb4AZMWjcYsTNIL5ZBp6-t8,71
26
- foundrytools_cli/commands/utils/cli.py,sha256=UM190Rc6Ne04OkNVUOeHWrW8Cwc_V_ZrI8axEdlWa1s,3626
27
+ foundrytools_cli/commands/utils/cli.py,sha256=6OfMrOxsxfNiCc8UaWCVHZgosRiVFUAWzlNYy_8zTrw,3840
27
28
  foundrytools_cli/commands/utils/font_organizer.py,sha256=9biz8Cxg81qNGtK53zp4xhgncbItE5xRXBL1Y1ZWHqg,4096
28
- foundrytools_cli/commands/utils/font_renamer.py,sha256=udjYOQ7UsqvC-dGRrF3BHbF9vP7OLbK7_2cwpiyOAHM,3255
29
+ foundrytools_cli/commands/utils/font_renamer.py,sha256=I-g5txxjGlHv7wTMkz9VKmYJ0-d04Z18iJPX0v30MRc,3285
29
30
  foundrytools_cli/commands/utils/sync_timestamps.py,sha256=mgmuX6-X07c1mw0pyBqG694_mQiBZjpPolBEjxa8Wvc,4127
30
31
  foundrytools_cli/utils/__init__.py,sha256=OHiBHGK9qmQ8UQKwOfRQi3bFZUm-LmcfB94AKI0PFSk,8002
31
32
  foundrytools_cli/utils/logger.py,sha256=ZjVgZ1AmzwwH1GEnBU1HP-pFvZv0BKkVV93P2gYvnLc,525
32
33
  foundrytools_cli/utils/task_runner.py,sha256=DZMTt_yByOD7wvAAxkiOLYj-Z0kiNOaeOdimcx0_jwE,7114
33
34
  foundrytools_cli/utils/timer.py,sha256=if4mLjDhTIhoAd_ZxydtHp8Ng9y7lG3VjqxOix4M0so,1862
34
- foundrytools_cli-2.0.2.dist-info/METADATA,sha256=j6toAw5IFbXkLXEDAKj6U8AFGDix9MLRaR0caoZsCCk,3936
35
- foundrytools_cli-2.0.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
36
- foundrytools_cli-2.0.2.dist-info/entry_points.txt,sha256=XX4k3N-0V31ud8NYeP3OmJOYAw0TvQRVoI-4EjAqUeA,56
37
- foundrytools_cli-2.0.2.dist-info/licenses/LICENSE,sha256=HC65UCqmXvm2I_reaA8aNfdbLcZrslY5loz0JDmRYAE,1062
38
- foundrytools_cli-2.0.2.dist-info/RECORD,,
35
+ foundrytools_cli-2.0.3.dist-info/METADATA,sha256=0H1_1Vmg0cdb1yqTUGVv0IJ2yy9LfH52Kt8b2OQrb6g,3936
36
+ foundrytools_cli-2.0.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
37
+ foundrytools_cli-2.0.3.dist-info/entry_points.txt,sha256=XX4k3N-0V31ud8NYeP3OmJOYAw0TvQRVoI-4EjAqUeA,56
38
+ foundrytools_cli-2.0.3.dist-info/licenses/LICENSE,sha256=HC65UCqmXvm2I_reaA8aNfdbLcZrslY5loz0JDmRYAE,1062
39
+ foundrytools_cli-2.0.3.dist-info/RECORD,,