MutatorMath


NameMutatorMath JSON
Version 3.0.1 PyPI version JSON
download
home_pagehttps://github.com/LettError/MutatorMath
SummaryPython for piecewise linear interpolation in multiple dimensions with multiple, arbitrarily placed, masters.
upload_time2020-04-24 09:23:32
maintainer
docs_urlNone
authorErik van Blokland
requires_python
licenseBSD 3 Clause
keywords
VCS
bugtrack_url
requirements defcon fontMath
Travis-CI
coveralls test coverage
            |Build Status| |Coverage Status| |PyPI Version|

MutatorMath
===========

.. figure:: https://raw.githubusercontent.com/LettError/MutatorMath/master/Docs/mutatorMath_colorField.jpg
   :alt: A MutatorMath Colorfield

   A MutatorMath Colorfield

MutatorMath is a Python library for the calculation of piecewise linear
interpolations in n-dimensions with any number of masters. It was
developed for interpolating data related to fonts, but if can handle any
arithmetic object.

-  The **objects/** subpackage contains the general calculation tools.
-  The **ufo/** subpackage contains tools to specifically process UFO
   data.
-  MutatorMath has no user interface, just the math.

License
-------

The MutatorMath package is published under the `BSD-3
license <http://opensource.org/licenses/BSD-3-Clause>`__.

Dependencies
------------

The basic Mutator and Location objects will run on any standard Python
2.7 or higher distribution, and is been tested on Python 3.5 or higher.

The UFO processing tools in MutatorMath need some additional libraries.

+-----------+-----------------------+-----------------------------------------------+
| Library   | Author                | URL                                           |
+===========+=======================+===============================================+
| FontTools | FontTools             | https://github.com/fonttools/fonttools        |
+-----------+-----------------------+-----------------------------------------------+
| Defcon    | TypeSupply.com        | https://github.com/typesupply/defcon          |
+-----------+-----------------------+-----------------------------------------------+
| FontMath  | TypeSupply.com        | https://github.com/typesupply/fontMath        |
+-----------+-----------------------+-----------------------------------------------+

MutatorMath terminology
-----------------------

-  **designspace**: abstract Euclidian space with any number of
   dimensions.
-  **axis**: A dimension in the designspace. Dimension names can be
   descriptive, for instance ``x``, ``y``, ``width``, ``weight``,
   ``pop``, ``snap``.
-  **location**: Coordinates of a point in the designspace stored as a
   dictionary of named dimensions. For instance ``Location(x=0)`` and
   ``Location(x=10)`` are in the same dimension, whereas
   ``Location(snap=10)`` is not. There will be implementation limits on
   the number of dimensions, but theoretically there is no limit.
-  **split location** or **ambivalent location**: A location in which
   one or more dimensions have a 2-tuple rather than a single value.
   This is used to describe anisotropic locations. For instance
   ``Location(weight=(50, 60))`` means the horizontal value is 50, the
   vertical value is 60. Support for anisotropic coordinates is only 2
   dimensional.
-  **origin**: A special location at which all dimension values are 0.
   Unnamed dimensions are assumed to be zero. ``Location()`` is at the
   *origin*.
-  **on-axis**: A location with a single non-zero axis value.
   ``Location(width=1000)`` is considered to be on-axis.
-  **off-axis**: A location with more than one non-zero axis value.
   ``Location(width=1000, weight=1000)`` is considered to be off-axis.
-  **bias**: A design space vector that translates all masters and
   instances.
-  arithmetic support

   -  objects that offer arithmetic behavior
   -  objects that respond to ``+``, ``-``, ``*`` and ``/``
   -  objects with ``__add__``, ``__sub__``, ``__mul__``, ``__rmul__``,
      ``__div__`` and ``__rdiv__`` methods

-  **master**: an arithmetic object that provides the input data.
-  **neutral**: a master inserted at the origin
-  **instance**: an object calculated at a specific location, same class
   as the master.

`An explanation with colorful graphs of how the MutatorMath calculates
the factors. <Docs/designSpaceFactors.md>`__

Building a Mutator
------------------

A convenient Mutator builder function ``buildMutator()`` accepts a list
of ``(location, object)`` pairs. Internally it sorts the neutral / on /
off axis masters and calculates the bias.

-  Master locations must not overlap.
-  For a more in-depth examples of building Mutator objects, read the
   doctests.

UFO
===

A UFO stores data related to the design and production of fonts
(specification at
`UnifiedFontObject.org <http://unifiedfontobject.org>`__. The ufo/
subpackage contains some tools to make the building and processing of
UFO mutators easier.

Designspace document
--------------------

The requirements for a UFO designspace will differ from project to
project. The location of the masters and instances, special wishes for
kerning and specific glyphs etc. This package provides tools to read and
write a description of a designspace to XML. Such a file stores all
information necessary: which source UFOs, where to insert them, which
glyphs to generate, which instances etc.

-  A designspace document can be processed by a simple python build
   script. (See ``buildExample.py``). That makes it possible to build
   instances on remote computers, as part of cron jobs etc.
-  Examples and tests of the reader and writer can be found in the
   ``test/ufo/`` directory.
-  MutatorMath proposes the ``.designspace`` extension.

Designspace XML structure
-------------------------

A ``.designspace`` file contains all data needed for setting up
interpolations between a number of master UFOs. A detailed description
of the designspace format here: `designspace file
format <Docs/designSpaceFileFormat.md>`__

Writing a designspace
~~~~~~~~~~~~~~~~~~~~~

**DesignSpaceDocumentWriter** object writes an XML representation of a
designspace.

-  **addSource**\ (path, name, location, copyLib, copyGroups, copyInfo,
   muteKerning, muteInfo)

   -  **path**: absolute path to the source UFO. Note: in the output the
      source path will relative to the documentPath.
   -  **name**: reference name for this source
   -  **location**: name of the location for this UFO
   -  **copyLib**: copy the contents of this source to instances
   -  **copyGroups**: copy the groups of this source to instances
   -  **copyInfo**: copy the non-numerical fields from this source.info
      to instances.
   -  **muteKerning**: mute the kerning data from this source
   -  **muteInfo**: mute the font info data from this source
   -  **familyName**: the family name for this source. Optional. Can be
      used for processing or building names of instances.
   -  **styleName**: the style name for this source. Optional. Can be
      used for processing or building names of instances.

-  **startInstance**\ (name, familyName, styleName, fileName,
   postScriptFontName, styleMapFamilyName, styleMapStyleName) This
   starts a new current instance object.

   -  **name**: the name of this instance
   -  **familyName**: name for the font.info.familyName field. Required.
   -  **styleName**: name fot the font.info.styleName field. Required.
   -  **fileName**: absolute path for the instance UFO. Note: in the
      output the instance path will relative to the documentPath.
   -  **postScriptFontName**: name for the font.info.postScriptFontName
      field. Optional.
   -  **styleMapFamilyName**: name for the font.info.styleMapFamilyName
      field. Optional.
   -  **styleMapStyleName**: name for the font.info.styleMapStyleName
      field. Optional.

-  **endInstance**\ () Finishes the current instance.
-  **writeGlyph**\ (name, unicodes, location, masters) Add a new
   glyph to the current instance.

   -  **name**: the glyph name. Required.
   -  **unicodes**: unicode values for this glyph if it needs to be
      different from the unicode values associated with this glyph name
      in the masters.
   -  **location**: a design space location for this glyph if it needs
      to be different from the instance location.
   -  **masters**: a list of masters and locations for this glyph if
      they need to be different from the masters specified for this
      instance.

-  **writeInfo()**: Indicate the info data should be generated for the
   current instance.
-  **writeKerning()**: Indicate the kerning data should be generated for
   the current instance.

Reading a designspace
~~~~~~~~~~~~~~~~~~~~~

**DesignSpaceDocumentReader** reads a DesignSpaceDocument. First it will
look for all UFO masters and then it will build all instances.

-  **DesignSpaceDocumentReader**\ (documentPath, ufoVersion,
   roundGeometry)

   -  **documentPath**: path of the designspace document to read.
   -  **ufoVersion**: target UFO version. Should be 2 or 3.
   -  **roundGeometry**: apply rounding to all geometry

DesignSpaceDocumentReader assumes all paths for sources and instances
are relative to the documentPath.

Legal
-----

-  **Superpolator** is a registered trademark of `LettError Type &
   Typography <http://letterror.com>`__, More on
   `Superpolator.com <http://superpolator.com>`__

Thanks
------

-  MutatorMath was made possible with kind support from the Adobe Type
   Team.
-  Thanks to `TypeSupply <http://typesupply.com>`__ for writing
   FontMath.
-  Thanks to `TypeMyType <http://robofont.com>`__ for writing RoboFont.

.. |Build Status| image:: https://travis-ci.org/LettError/MutatorMath.svg?branch=master
   :target: https://travis-ci.org/LettError/MutatorMath
.. |Coverage Status| image:: https://coveralls.io/repos/github/LettError/MutatorMath/badge.svg?branch=master
   :target: https://coveralls.io/github/LettError/MutatorMath?branch=master
.. |PyPI Version| image:: https://img.shields.io/pypi/v/MutatorMath.svg
   :target: https://pypi.org/project/MutatorMath/



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LettError/MutatorMath",
    "name": "MutatorMath",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Erik van Blokland",
    "author_email": "erik@letterror.com",
    "download_url": "https://files.pythonhosted.org/packages/44/02/d1ddbbc5698db8ad2a0d1f8a23d52305e66166b6fea5ada5e146dd3a709a/MutatorMath-3.0.1.zip",
    "platform": "",
    "description": "|Build Status| |Coverage Status| |PyPI Version|\n\nMutatorMath\n===========\n\n.. figure:: https://raw.githubusercontent.com/LettError/MutatorMath/master/Docs/mutatorMath_colorField.jpg\n   :alt: A MutatorMath Colorfield\n\n   A MutatorMath Colorfield\n\nMutatorMath is a Python library for the calculation of piecewise linear\ninterpolations in n-dimensions with any number of masters. It was\ndeveloped for interpolating data related to fonts, but if can handle any\narithmetic object.\n\n-  The **objects/** subpackage contains the general calculation tools.\n-  The **ufo/** subpackage contains tools to specifically process UFO\n   data.\n-  MutatorMath has no user interface, just the math.\n\nLicense\n-------\n\nThe MutatorMath package is published under the `BSD-3\nlicense <http://opensource.org/licenses/BSD-3-Clause>`__.\n\nDependencies\n------------\n\nThe basic Mutator and Location objects will run on any standard Python\n2.7 or higher distribution, and is been tested on Python 3.5 or higher.\n\nThe UFO processing tools in MutatorMath need some additional libraries.\n\n+-----------+-----------------------+-----------------------------------------------+\n| Library   | Author                | URL                                           |\n+===========+=======================+===============================================+\n| FontTools | FontTools             | https://github.com/fonttools/fonttools        |\n+-----------+-----------------------+-----------------------------------------------+\n| Defcon    | TypeSupply.com        | https://github.com/typesupply/defcon          |\n+-----------+-----------------------+-----------------------------------------------+\n| FontMath  | TypeSupply.com        | https://github.com/typesupply/fontMath        |\n+-----------+-----------------------+-----------------------------------------------+\n\nMutatorMath terminology\n-----------------------\n\n-  **designspace**: abstract Euclidian space with any number of\n   dimensions.\n-  **axis**: A dimension in the designspace. Dimension names can be\n   descriptive, for instance ``x``, ``y``, ``width``, ``weight``,\n   ``pop``, ``snap``.\n-  **location**: Coordinates of a point in the designspace stored as a\n   dictionary of named dimensions. For instance ``Location(x=0)`` and\n   ``Location(x=10)`` are in the same dimension, whereas\n   ``Location(snap=10)`` is not. There will be implementation limits on\n   the number of dimensions, but theoretically there is no limit.\n-  **split location** or **ambivalent location**: A location in which\n   one or more dimensions have a 2-tuple rather than a single value.\n   This is used to describe anisotropic locations. For instance\n   ``Location(weight=(50, 60))`` means the horizontal value is 50, the\n   vertical value is 60. Support for anisotropic coordinates is only 2\n   dimensional.\n-  **origin**: A special location at which all dimension values are 0.\n   Unnamed dimensions are assumed to be zero. ``Location()`` is at the\n   *origin*.\n-  **on-axis**: A location with a single non-zero axis value.\n   ``Location(width=1000)`` is considered to be on-axis.\n-  **off-axis**: A location with more than one non-zero axis value.\n   ``Location(width=1000, weight=1000)`` is considered to be off-axis.\n-  **bias**: A design space vector that translates all masters and\n   instances.\n-  arithmetic support\n\n   -  objects that offer arithmetic behavior\n   -  objects that respond to ``+``, ``-``, ``*`` and ``/``\n   -  objects with ``__add__``, ``__sub__``, ``__mul__``, ``__rmul__``,\n      ``__div__`` and ``__rdiv__`` methods\n\n-  **master**: an arithmetic object that provides the input data.\n-  **neutral**: a master inserted at the origin\n-  **instance**: an object calculated at a specific location, same class\n   as the master.\n\n`An explanation with colorful graphs of how the MutatorMath calculates\nthe factors. <Docs/designSpaceFactors.md>`__\n\nBuilding a Mutator\n------------------\n\nA convenient Mutator builder function ``buildMutator()`` accepts a list\nof ``(location, object)`` pairs. Internally it sorts the neutral / on /\noff axis masters and calculates the bias.\n\n-  Master locations must not overlap.\n-  For a more in-depth examples of building Mutator objects, read the\n   doctests.\n\nUFO\n===\n\nA UFO stores data related to the design and production of fonts\n(specification at\n`UnifiedFontObject.org <http://unifiedfontobject.org>`__. The ufo/\nsubpackage contains some tools to make the building and processing of\nUFO mutators easier.\n\nDesignspace document\n--------------------\n\nThe requirements for a UFO designspace will differ from project to\nproject. The location of the masters and instances, special wishes for\nkerning and specific glyphs etc. This package provides tools to read and\nwrite a description of a designspace to XML. Such a file stores all\ninformation necessary: which source UFOs, where to insert them, which\nglyphs to generate, which instances etc.\n\n-  A designspace document can be processed by a simple python build\n   script. (See ``buildExample.py``). That makes it possible to build\n   instances on remote computers, as part of cron jobs etc.\n-  Examples and tests of the reader and writer can be found in the\n   ``test/ufo/`` directory.\n-  MutatorMath proposes the ``.designspace`` extension.\n\nDesignspace XML structure\n-------------------------\n\nA ``.designspace`` file contains all data needed for setting up\ninterpolations between a number of master UFOs. A detailed description\nof the designspace format here: `designspace file\nformat <Docs/designSpaceFileFormat.md>`__\n\nWriting a designspace\n~~~~~~~~~~~~~~~~~~~~~\n\n**DesignSpaceDocumentWriter** object writes an XML representation of a\ndesignspace.\n\n-  **addSource**\\ (path, name, location, copyLib, copyGroups, copyInfo,\n   muteKerning, muteInfo)\n\n   -  **path**: absolute path to the source UFO. Note: in the output the\n      source path will relative to the documentPath.\n   -  **name**: reference name for this source\n   -  **location**: name of the location for this UFO\n   -  **copyLib**: copy the contents of this source to instances\n   -  **copyGroups**: copy the groups of this source to instances\n   -  **copyInfo**: copy the non-numerical fields from this source.info\n      to instances.\n   -  **muteKerning**: mute the kerning data from this source\n   -  **muteInfo**: mute the font info data from this source\n   -  **familyName**: the family name for this source. Optional. Can be\n      used for processing or building names of instances.\n   -  **styleName**: the style name for this source. Optional. Can be\n      used for processing or building names of instances.\n\n-  **startInstance**\\ (name, familyName, styleName, fileName,\n   postScriptFontName, styleMapFamilyName, styleMapStyleName) This\n   starts a new current instance object.\n\n   -  **name**: the name of this instance\n   -  **familyName**: name for the font.info.familyName field. Required.\n   -  **styleName**: name fot the font.info.styleName field. Required.\n   -  **fileName**: absolute path for the instance UFO. Note: in the\n      output the instance path will relative to the documentPath.\n   -  **postScriptFontName**: name for the font.info.postScriptFontName\n      field. Optional.\n   -  **styleMapFamilyName**: name for the font.info.styleMapFamilyName\n      field. Optional.\n   -  **styleMapStyleName**: name for the font.info.styleMapStyleName\n      field. Optional.\n\n-  **endInstance**\\ () Finishes the current instance.\n-  **writeGlyph**\\ (name, unicodes, location, masters) Add a new\n   glyph to the current instance.\n\n   -  **name**: the glyph name. Required.\n   -  **unicodes**: unicode values for this glyph if it needs to be\n      different from the unicode values associated with this glyph name\n      in the masters.\n   -  **location**: a design space location for this glyph if it needs\n      to be different from the instance location.\n   -  **masters**: a list of masters and locations for this glyph if\n      they need to be different from the masters specified for this\n      instance.\n\n-  **writeInfo()**: Indicate the info data should be generated for the\n   current instance.\n-  **writeKerning()**: Indicate the kerning data should be generated for\n   the current instance.\n\nReading a designspace\n~~~~~~~~~~~~~~~~~~~~~\n\n**DesignSpaceDocumentReader** reads a DesignSpaceDocument. First it will\nlook for all UFO masters and then it will build all instances.\n\n-  **DesignSpaceDocumentReader**\\ (documentPath, ufoVersion,\n   roundGeometry)\n\n   -  **documentPath**: path of the designspace document to read.\n   -  **ufoVersion**: target UFO version. Should be 2 or 3.\n   -  **roundGeometry**: apply rounding to all geometry\n\nDesignSpaceDocumentReader assumes all paths for sources and instances\nare relative to the documentPath.\n\nLegal\n-----\n\n-  **Superpolator** is a registered trademark of `LettError Type &\n   Typography <http://letterror.com>`__, More on\n   `Superpolator.com <http://superpolator.com>`__\n\nThanks\n------\n\n-  MutatorMath was made possible with kind support from the Adobe Type\n   Team.\n-  Thanks to `TypeSupply <http://typesupply.com>`__ for writing\n   FontMath.\n-  Thanks to `TypeMyType <http://robofont.com>`__ for writing RoboFont.\n\n.. |Build Status| image:: https://travis-ci.org/LettError/MutatorMath.svg?branch=master\n   :target: https://travis-ci.org/LettError/MutatorMath\n.. |Coverage Status| image:: https://coveralls.io/repos/github/LettError/MutatorMath/badge.svg?branch=master\n   :target: https://coveralls.io/github/LettError/MutatorMath?branch=master\n.. |PyPI Version| image:: https://img.shields.io/pypi/v/MutatorMath.svg\n   :target: https://pypi.org/project/MutatorMath/\n\n\n",
    "bugtrack_url": null,
    "license": "BSD 3 Clause",
    "summary": "Python for piecewise linear interpolation in multiple dimensions with multiple, arbitrarily placed, masters.",
    "version": "3.0.1",
    "project_urls": {
        "Homepage": "https://github.com/LettError/MutatorMath"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0261e3e6190a8d94c6a99d9605c721e1e38ebae19dc194059477affa57f6e111",
                "md5": "36a1766d4e9ec763bc643c8410125246",
                "sha256": "949dc3c1ea71c3b8a88cdeec6b3224b039d9da3888af133eb7e09ce1d5b19821"
            },
            "downloads": -1,
            "filename": "MutatorMath-3.0.1-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "36a1766d4e9ec763bc643c8410125246",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 31986,
            "upload_time": "2020-04-24T09:23:31",
            "upload_time_iso_8601": "2020-04-24T09:23:31.333192Z",
            "url": "https://files.pythonhosted.org/packages/02/61/e3e6190a8d94c6a99d9605c721e1e38ebae19dc194059477affa57f6e111/MutatorMath-3.0.1-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4402d1ddbbc5698db8ad2a0d1f8a23d52305e66166b6fea5ada5e146dd3a709a",
                "md5": "47f9053cf0d9275e0e840dbf446269e2",
                "sha256": "8127c1ffad1646f11a953752296c43f5d88cbd5293fff03f093d916b0bc13864"
            },
            "downloads": -1,
            "filename": "MutatorMath-3.0.1.zip",
            "has_sig": false,
            "md5_digest": "47f9053cf0d9275e0e840dbf446269e2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 421722,
            "upload_time": "2020-04-24T09:23:32",
            "upload_time_iso_8601": "2020-04-24T09:23:32.876471Z",
            "url": "https://files.pythonhosted.org/packages/44/02/d1ddbbc5698db8ad2a0d1f8a23d52305e66166b6fea5ada5e146dd3a709a/MutatorMath-3.0.1.zip",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2020-04-24 09:23:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LettError",
    "github_project": "MutatorMath",
    "travis_ci": true,
    "coveralls": true,
    "github_actions": false,
    "requirements": [
        {
            "name": "defcon",
            "specs": [
                [
                    "==",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "fontMath",
            "specs": [
                [
                    "==",
                    "0.4.8"
                ]
            ]
        }
    ],
    "tox": true,
    "lcname": "mutatormath"
}
        
Elapsed time: 0.42503s