Skip to content

Commit

Permalink
Rename volto to voltLib.voltToFea
Browse files Browse the repository at this point in the history
  • Loading branch information
khaledhosny committed Jun 14, 2023
1 parent de76e71 commit 2f97f1a
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 29 deletions.
6 changes: 2 additions & 4 deletions Doc/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
---------
Expand Down Expand Up @@ -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.

Expand Down Expand Up @@ -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
Expand Down
11 changes: 8 additions & 3 deletions Doc/source/voltLib.rst → Doc/source/voltLib/index.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
#######
voltLib
#######
####################################
voltLib: Read/write MS VOLT projects
####################################

.. toctree::
:maxdepth: 2

voltToFea

.. automodule:: fontTools.voltLib

Expand Down
8 changes: 8 additions & 0 deletions Doc/source/voltLib/voltToFea.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#################################################
voltToFea: Convert MS VOLT to AFDKO feature files
#################################################

.. automodule:: fontTools.voltLib.voltToFea
:inherited-members:
:members:
:undoc-members:
8 changes: 0 additions & 8 deletions Doc/source/volto.rst

This file was deleted.

10 changes: 6 additions & 4 deletions Lib/fontTools/volto.py → Lib/fontTools/voltLib/voltToFea.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
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.
Expand Down Expand Up @@ -48,7 +48,7 @@
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"]

Expand Down Expand Up @@ -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"
)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 12 additions & 10 deletions Tests/volto/volto_test.py → Tests/voltLib/volttofea_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import unittest
from io import StringIO

from fontTools.volto import VoltToFea
from fontTools.voltLib.voltToFea import VoltToFea

DATADIR = pathlib.Path(__file__).parent / "data"

Expand Down Expand Up @@ -1168,7 +1168,9 @@ def test_unsupported_compiler_flags(self):
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):
Expand Down Expand Up @@ -1211,30 +1213,30 @@ def test_sanitize_group_name(self):
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:
Expand Down

0 comments on commit 2f97f1a

Please sign in to comment.