foundrytools-cli 1.0.1__tar.gz → 1.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 (62) hide show
  1. {foundrytools-cli-1.0.1/foundrytools_cli.egg-info → foundrytools-cli-1.0.3}/PKG-INFO +6 -2
  2. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/README.md +5 -1
  3. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_utils.py +1 -3
  4. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/Font.py +1 -4
  5. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/otf_to_ttf.py +1 -2
  6. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/sfnt_to_web.py +3 -3
  7. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/ttf_to_otf.py +20 -21
  8. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/web_to_sfnt.py +3 -3
  9. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/click_tools.py +1 -2
  10. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3/foundrytools_cli.egg-info}/PKG-INFO +6 -2
  11. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/setup.py +1 -1
  12. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/LICENSE +0 -0
  13. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/MANIFEST.in +0 -0
  14. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/__init__.py +0 -0
  15. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_assistant.py +0 -0
  16. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_cff.py +0 -0
  17. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_converter.py +0 -0
  18. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_fix.py +0 -0
  19. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_hhea.py +0 -0
  20. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_metrics.py +0 -0
  21. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_name.py +0 -0
  22. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_os2.py +0 -0
  23. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_otf.py +0 -0
  24. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_post.py +0 -0
  25. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_print.py +0 -0
  26. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/CLI/ftcli_ttf.py +0 -0
  27. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/VFont.py +0 -0
  28. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/__init__.py +0 -0
  29. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/assistant/UI.py +0 -0
  30. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/assistant/__init__.py +0 -0
  31. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/assistant/fonts_data.py +0 -0
  32. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/assistant/styles_mapping.py +0 -0
  33. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/constants.py +0 -0
  34. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/__init__.py +0 -0
  35. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/options.py +0 -0
  36. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/ttc_to_sfnt.py +0 -0
  37. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/converters/variable_to_static.py +0 -0
  38. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/printer/UI.py +0 -0
  39. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/printer/__init__.py +0 -0
  40. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/CFF_.py +0 -0
  41. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/OS_2.py +0 -0
  42. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/__init__.py +0 -0
  43. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/head.py +0 -0
  44. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/hhea.py +0 -0
  45. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/name.py +0 -0
  46. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/tables/post.py +0 -0
  47. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/__init__.py +0 -0
  48. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/bits_tools.py +0 -0
  49. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/cli_tools.py +0 -0
  50. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/otf_tools.py +0 -0
  51. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/skia_tools.py +0 -0
  52. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/text_tools.py +0 -0
  53. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/Lib/utils/ttf_tools.py +0 -0
  54. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/__init__.py +0 -0
  55. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundryToolsCLI/__main__.py +0 -0
  56. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundrytools_cli.egg-info/SOURCES.txt +0 -0
  57. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundrytools_cli.egg-info/dependency_links.txt +0 -0
  58. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundrytools_cli.egg-info/entry_points.txt +0 -0
  59. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundrytools_cli.egg-info/not-zip-safe +0 -0
  60. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundrytools_cli.egg-info/requires.txt +0 -0
  61. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/foundrytools_cli.egg-info/top_level.txt +0 -0
  62. {foundrytools-cli-1.0.1 → foundrytools-cli-1.0.3}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foundrytools-cli
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: A set of command line tools to inspect, manipulate and convert font files
5
5
  Home-page: https://github.com/ftCLI/FoundryTools-CLI
6
6
  Author: ftCLI
@@ -28,7 +28,7 @@ The command line interface is built with [click](https://github.com/pallets/clic
28
28
  [rich](https://github.com/Textualize/rich).
29
29
 
30
30
  Even if not directly imported to keep the footprint as small as possible, portions of code have been copied from
31
- [fontbakery](https://github.com/googlefonts/fontbakery).
31
+ [fontbakery](https://github.com/googlefonts/fontbakery) and [font-line](https://github.com/source-foundry/font-line).
32
32
 
33
33
  ## Installation
34
34
  FoundryTools-CLI requires Python 3.9 or later.
@@ -47,6 +47,9 @@ FoundryTools-CLI releases are available on the Python Package Index (PyPI), so i
47
47
  If you would like to contribute to the development, you can clone the repository from GitHub, install the package in
48
48
  'editable' mode and modify the source code in place. We strongly recommend using a virtual environment.
49
49
 
50
+ **IMPORTANT**: If you have Python 2.x installed in your system, you may have to use `python3` (instead of `python`) in
51
+ the commands below.
52
+
50
53
  # clone the repository:
51
54
  git clone https://github.com/ftCLI/foundrytools-cli.git
52
55
  cd foundrytools-cli
@@ -63,6 +66,7 @@ If you would like to contribute to the development, you can clone the repository
63
66
  # install in 'editable' mode
64
67
  python -m pip install -e .
65
68
 
69
+
66
70
  ## Documentation
67
71
  FoundryTools-CLI is a Terminal app where commands are logically organized into subcommands.
68
72
 
@@ -15,7 +15,7 @@ The command line interface is built with [click](https://github.com/pallets/clic
15
15
  [rich](https://github.com/Textualize/rich).
16
16
 
17
17
  Even if not directly imported to keep the footprint as small as possible, portions of code have been copied from
18
- [fontbakery](https://github.com/googlefonts/fontbakery).
18
+ [fontbakery](https://github.com/googlefonts/fontbakery) and [font-line](https://github.com/source-foundry/font-line).
19
19
 
20
20
  ## Installation
21
21
  FoundryTools-CLI requires Python 3.9 or later.
@@ -34,6 +34,9 @@ FoundryTools-CLI releases are available on the Python Package Index (PyPI), so i
34
34
  If you would like to contribute to the development, you can clone the repository from GitHub, install the package in
35
35
  'editable' mode and modify the source code in place. We strongly recommend using a virtual environment.
36
36
 
37
+ **IMPORTANT**: If you have Python 2.x installed in your system, you may have to use `python3` (instead of `python`) in
38
+ the commands below.
39
+
37
40
  # clone the repository:
38
41
  git clone https://github.com/ftCLI/foundrytools-cli.git
39
42
  cd foundrytools-cli
@@ -50,6 +53,7 @@ If you would like to contribute to the development, you can clone the repository
50
53
  # install in 'editable' mode
51
54
  python -m pip install -e .
52
55
 
56
+
53
57
  ## Documentation
54
58
  FoundryTools-CLI is a Terminal app where commands are logically organized into subcommands.
55
59
 
@@ -226,9 +226,7 @@ def font_renamer(input_path: Path, source: str):
226
226
  )
227
227
  )
228
228
  file.rename(output_file)
229
- generic_success_message(
230
- f"{file.name} {click.style('-->', fg='bright_magenta')} {output_file.name}"
231
- )
229
+ generic_success_message(f"{file.name} {click.style('-->', fg='bright_magenta')} {output_file.name}")
232
230
  except Exception as e:
233
231
  generic_error_message(e)
234
232
  else:
@@ -6,6 +6,7 @@ from pathlib import Path
6
6
  from beziers.line import Line
7
7
  from beziers.path import BezierPath
8
8
  from beziers.point import Point
9
+ from cffsubr import subroutinize, desubroutinize
9
10
  from fontTools.misc.psCharStrings import T2CharString
10
11
  from fontTools.misc.timeTools import timestampToString
11
12
  from fontTools.pens.boundsPen import BoundsPen
@@ -456,8 +457,6 @@ class Font(TTFont):
456
457
  if not self.is_otf:
457
458
  return
458
459
 
459
- from cffsubr import desubroutinize
460
-
461
460
  flavor = self.flavor
462
461
  self.flavor = None
463
462
  desubroutinize(otf=self)
@@ -470,8 +469,6 @@ class Font(TTFont):
470
469
  if not self.is_otf:
471
470
  return
472
471
 
473
- from cffsubr import subroutinize
474
-
475
472
  flavor = self.flavor
476
473
  self.flavor = None
477
474
  subroutinize(otf=self)
@@ -25,9 +25,8 @@ class OTF2TTFRunner(object):
25
25
 
26
26
  try:
27
27
  print()
28
- generic_info_message(f"Converting file {count} of {len(source_fonts)}")
29
-
30
28
  file = Path(source_font.reader.file.name)
29
+ generic_info_message(f"Converting file {count} of {len(source_fonts)}: {file.name}")
31
30
 
32
31
  # If the source font is a WOFF or WOFF2, we add a suffix to avoid unwanted overwriting
33
32
  if source_font.flavor is None:
@@ -19,14 +19,14 @@ class FT2WFRunner(object):
19
19
 
20
20
  for count, font in enumerate(fonts, start=1):
21
21
  t = time.time()
22
- print()
23
- generic_info_message(f"Converting file {count} of {len(fonts)}")
24
22
 
25
23
  try:
26
24
  if font.flavor is not None:
27
25
  continue
28
26
 
29
- file = font.reader.file.name
27
+ file = Path(font.reader.file.name)
28
+ print()
29
+ generic_info_message(f"Converting file {count} of {len(fonts)}: {file.name}")
30
30
 
31
31
  if self.options.woff:
32
32
  converter = SFNTToWeb(font=font, flavor="woff")
@@ -31,11 +31,11 @@ class TTF2OTFRunner(object):
31
31
 
32
32
  for count, source_font in enumerate(source_fonts, start=1):
33
33
  t = time.time()
34
- print()
35
- generic_info_message(f"Converting file {count} of {len(source_fonts)}")
36
34
 
37
35
  try:
38
36
  file = Path(source_font.reader.file.name)
37
+ print()
38
+ generic_info_message(f"Converting file {count} of {len(source_fonts)}: {file.name}")
39
39
 
40
40
  # If the source font is a WOFF or WOFF2, we add a suffix to avoid unwanted overwriting
41
41
  flavor = source_font.flavor
@@ -57,11 +57,8 @@ class TTF2OTFRunner(object):
57
57
  )
58
58
  )
59
59
 
60
- temp_source_fd, temp_source_file = tempfile.mkstemp(suffix=".ttf")
61
60
  if self.options.scale_upm:
62
61
  source_font.ttf_scale_upem(units_per_em=self.options.scale_upm)
63
- source_font.save(temp_source_file)
64
- source_font = Font(temp_source_file, recalcTimestamp=self.options.recalc_timestamp)
65
62
 
66
63
  # Decomponentize the source font
67
64
  source_font.ttf_decomponentize()
@@ -70,36 +67,28 @@ class TTF2OTFRunner(object):
70
67
  failed, charstrings = get_qu2cu_charstrings(font=source_font, tolerance=tolerance)
71
68
 
72
69
  if len(failed) > 0:
73
- generic_info_message(f"Getting {len(failed)} charstrings with makeotf...")
74
- t2_ttf2otf_converter = TrueTypeToCFF(font=source_font)
75
- t2_charstrings = get_t2_charstrings(font=source_font)
76
- t2_otf_font: Font = t2_ttf2otf_converter.run(charstrings=t2_charstrings)
77
- t2_otf_2_ttf_converter = CFFToTrueType(font=t2_otf_font)
78
- t2_otf_2_ttf_font = t2_otf_2_ttf_converter.run()
79
- _, fallback_charstrings = get_qu2cu_charstrings(t2_otf_2_ttf_font)
70
+ generic_info_message(f"Retrying to get {len(failed)} charstrings...")
71
+ fallback_charstrings = get_fallback_charstrings(font=source_font)
80
72
 
81
73
  for c in failed:
82
74
  try:
83
- generic_info_message(f"Retrying to get charstring: {c}", nl=False)
75
+ generic_info_message(f"{c}", nl=False)
84
76
  charstrings[c] = fallback_charstrings[c]
85
- click.secho(f" -> OK", fg="green")
77
+ click.secho(f" -> {click.style('OK', fg='green')}")
86
78
  except Exception as e:
87
- generic_error_message(f"Failed to get charstring: {c}")
79
+ click.secho(f" -> {click.style('FAIL', fg='red')} ({e})")
88
80
  generic_error_message(e)
89
81
 
90
82
  ttf2otf_converter = TrueTypeToCFF(font=source_font)
91
83
  cff_font: Font = ttf2otf_converter.run(charstrings=charstrings)
92
84
 
85
+ cff_font.save(output_file)
86
+ cff_font = Font(output_file, recalcTimestamp=False)
93
87
  cff_font.otf_fix_contours(min_area=25, verbose=False)
94
-
95
88
  if self.options.subroutinize:
96
89
  cff_font.otf_subroutinize()
97
-
98
- cff_font.flavor = flavor
99
90
  cff_font.save(output_file)
100
- if os.path.exists(temp_source_file):
101
- os.close(temp_source_fd)
102
- os.remove(temp_source_file)
91
+ cff_font.close()
103
92
 
104
93
  generic_info_message(f"Elapsed time: {round(time.time() - t, 3)} seconds")
105
94
  file_saved_message(output_file)
@@ -226,3 +215,13 @@ def get_t2_charstrings(font: Font) -> dict:
226
215
  t2_charstrings[k] = charstring
227
216
 
228
217
  return t2_charstrings
218
+
219
+
220
+ def get_fallback_charstrings(font: Font) -> dict:
221
+ ttf2otf_converter = TrueTypeToCFF(font=font)
222
+ t2_charstrings = get_t2_charstrings(font=font)
223
+ otf_font: Font = ttf2otf_converter.run(charstrings=t2_charstrings)
224
+ otf_2_ttf_converter = CFFToTrueType(font=otf_font)
225
+ otf_font = otf_2_ttf_converter.run()
226
+ _, fallback_charstrings = get_qu2cu_charstrings(otf_font)
227
+ return fallback_charstrings
@@ -19,11 +19,11 @@ class WF2FTRunner(object):
19
19
 
20
20
  for count, font in enumerate(fonts, start=1):
21
21
  t = time.time()
22
- print()
23
- generic_info_message(f"Converting file {count} of {len(fonts)}")
24
22
 
25
23
  try:
26
- file = font.reader.file.name
24
+ file = Path(font.reader.file.name)
25
+ print()
26
+ generic_info_message(f"Converting file {count} of {len(fonts)}: {file.name}")
27
27
 
28
28
  if not font.flavor:
29
29
  continue
@@ -70,8 +70,7 @@ def add_common_options():
70
70
 
71
71
  def file_overwrite_prompt(input_file: Path) -> bool:
72
72
  return click.confirm(
73
- f"{click.style(input_file, fg='yellow', bold=True)} already exists. "
74
- f"Do you want to overwrite it?"
73
+ f"{click.style(input_file, fg='yellow', bold=True)} already exists. " f"Do you want to overwrite it?"
75
74
  )
76
75
 
77
76
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: foundrytools-cli
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: A set of command line tools to inspect, manipulate and convert font files
5
5
  Home-page: https://github.com/ftCLI/FoundryTools-CLI
6
6
  Author: ftCLI
@@ -28,7 +28,7 @@ The command line interface is built with [click](https://github.com/pallets/clic
28
28
  [rich](https://github.com/Textualize/rich).
29
29
 
30
30
  Even if not directly imported to keep the footprint as small as possible, portions of code have been copied from
31
- [fontbakery](https://github.com/googlefonts/fontbakery).
31
+ [fontbakery](https://github.com/googlefonts/fontbakery) and [font-line](https://github.com/source-foundry/font-line).
32
32
 
33
33
  ## Installation
34
34
  FoundryTools-CLI requires Python 3.9 or later.
@@ -47,6 +47,9 @@ FoundryTools-CLI releases are available on the Python Package Index (PyPI), so i
47
47
  If you would like to contribute to the development, you can clone the repository from GitHub, install the package in
48
48
  'editable' mode and modify the source code in place. We strongly recommend using a virtual environment.
49
49
 
50
+ **IMPORTANT**: If you have Python 2.x installed in your system, you may have to use `python3` (instead of `python`) in
51
+ the commands below.
52
+
50
53
  # clone the repository:
51
54
  git clone https://github.com/ftCLI/foundrytools-cli.git
52
55
  cd foundrytools-cli
@@ -63,6 +66,7 @@ If you would like to contribute to the development, you can clone the repository
63
66
  # install in 'editable' mode
64
67
  python -m pip install -e .
65
68
 
69
+
66
70
  ## Documentation
67
71
  FoundryTools-CLI is a Terminal app where commands are logically organized into subcommands.
68
72
 
@@ -7,7 +7,7 @@ long_description = this_directory.joinpath("README.md").read_text()
7
7
 
8
8
  setuptools.setup(
9
9
  name="foundrytools-cli",
10
- version="1.0.1",
10
+ version="1.0.3",
11
11
  description="A set of command line tools to inspect, manipulate and convert font files",
12
12
  long_description=long_description,
13
13
  long_description_content_type="text/markdown",