Rename volto to voltLib.voltToFea

This commit is contained in:
Khaled Hosny 2023-06-14 20:35:20 +03:00
parent de76e71b7b
commit 2f97f1abe9
12 changed files with 36 additions and 29 deletions

View File

@ -56,7 +56,7 @@ This last utility takes a subcommand, which could be one of:
- ``varLib.models``: Normalize locations on a given designspace
- ``varLib.mutator``: Instantiate a variation font
- ``varLib.varStore``: Optimize a font's GDEF variation store
- ``volto``: Convert MS VOLT to AFDKO feature files.
- ``voltLib.voltToFea``: Convert MS VOLT to AFDKO feature files.
Libraries
---------
@ -88,7 +88,6 @@ libraries in the fontTools suite:
- :py:mod:`fontTools.unicodedata`: Convert between Unicode and OpenType script information
- :py:mod:`fontTools.varLib`: Module for dealing with 'gvar'-style font variations
- :py:mod:`fontTools.voltLib`: Module for dealing with Visual OpenType Layout Tool (VOLT) files
- :py:mod:`fontTools.volto`: Convert MS VOLT to AFDKO feature files.
A selection of sample Python programs using these libaries can be found in the `Snippets directory <https://github.com/fonttools/fonttools/blob/main/Snippets/>`_ of the fontTools repository.
@ -143,8 +142,7 @@ Table of Contents
unicode
unicodedata/index
varLib/index
voltLib
volto
voltLib/index
.. |Travis Build Status| image:: https://travis-ci.org/fonttools/fonttools.svg

View File

@ -1,6 +1,11 @@
#######
voltLib
#######
####################################
voltLib: Read/write MS VOLT projects
####################################
.. toctree::
:maxdepth: 2
voltToFea
.. automodule:: fontTools.voltLib

View File

@ -0,0 +1,8 @@
#################################################
voltToFea: Convert MS VOLT to AFDKO feature files
#################################################
.. automodule:: fontTools.voltLib.voltToFea
:inherited-members:
:members:
:undoc-members:

View File

@ -1,8 +0,0 @@
#############################################
volto: Convert MS VOLT to AFDKO feature files
#############################################
.. automodule:: fontTools.volto
:inherited-members:
:members:
:undoc-members:

View File

@ -7,13 +7,13 @@ Usage
To convert a VTP project file:
$ fonttools volto input.vtp output.fea
$ fonttools voltLib.voltToFea input.vtp output.fea
It is also possible convert font files with `TSIV` table (as saved from Volt),
in this case the glyph names used in the Volt project will be mapped to the
actual glyph names in the font files when written to the feature file:
$ fonttools volto input.ttf output.fea
$ fonttools voltLib.voltToFea input.ttf output.fea
The ``--quiet`` option can be used to suppress warnings.
@ -48,7 +48,7 @@ from fontTools.ttLib import TTFont, TTLibError
from fontTools.voltLib import ast as VAst
from fontTools.voltLib.parser import Parser as VoltParser
log = logging.getLogger("fontTools.volto")
log = logging.getLogger("fontTools.voltLib.voltToFea")
TABLES = ["GDEF", "GSUB", "GPOS"]
@ -662,7 +662,9 @@ def main(args=None):
from fontTools import configLogger
parser = argparse.ArgumentParser("fonttools volto", description=main.__doc__)
parser = argparse.ArgumentParser(
"fonttools voltLib.voltToFea", description=main.__doc__
)
parser.add_argument(
"input", metavar="INPUT", type=Path, help="input font/VTP file to process"
)

View File

@ -4,7 +4,7 @@ import tempfile
import unittest
from io import StringIO
from fontTools.volto import VoltToFea
from fontTools.voltLib.voltToFea import VoltToFea
DATADIR = pathlib.Path(__file__).parent / "data"
@ -1168,7 +1168,9 @@ class ToFeaTest(unittest.TestCase):
self.assertEqual(fea, "")
self.assertEqual(
logs.output,
["WARNING:fontTools.volto:Unsupported setting ignored: CMAP_FORMAT"],
[
"WARNING:fontTools.voltLib.voltToFea:Unsupported setting ignored: CMAP_FORMAT"
],
)
def test_sanitize_lookup_name(self):
@ -1211,30 +1213,30 @@ class ToFeaTest(unittest.TestCase):
def test_cli_vtp(self):
vtp = DATADIR / "Nutso.vtp"
fea = DATADIR / "Nutso.fea"
self.volto(vtp, fea)
self.cli(vtp, fea)
def test_group_order(self):
vtp = DATADIR / "NamdhinggoSIL1006.vtp"
fea = DATADIR / "NamdhinggoSIL1006.fea"
self.volto(vtp, fea)
self.cli(vtp, fea)
def test_cli_ttf(self):
ttf = DATADIR / "Nutso.ttf"
fea = DATADIR / "Nutso.fea"
self.volto(ttf, fea)
self.cli(ttf, fea)
def test_cli_ttf_no_TSIV(self):
from fontTools.volto import main as volto
from fontTools.voltLib.voltToFea import main as cli
ttf = DATADIR / "Empty.ttf"
temp = self.temp_path()
self.assertEqual(1, volto([str(ttf), str(temp)]))
self.assertEqual(1, cli([str(ttf), str(temp)]))
def volto(self, source, fea):
from fontTools.volto import main as volto
def cli(self, source, fea):
from fontTools.voltLib.voltToFea import main as cli
temp = self.temp_path()
volto([str(source), str(temp)])
cli([str(source), str(temp)])
with temp.open() as f:
res = f.read()
with fea.open() as f: