ufoProcessor


NameufoProcessor JSON
Version 1.13.2 PyPI version JSON
download
home_pagehttps://github.com/LettError/ufoProcessor
SummaryRead, write and generate UFOs with designspace data.
upload_time2024-11-15 09:09:38
maintainerNone
docs_urlNone
authorErik van Blokland
requires_python>=2.7
licenseMIT
keywords font development tools
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![PyPI](https://img.shields.io/pypi/v/ufoprocessor.svg)](https://pypi.org/project/ufoprocessor)

# ufoProcessor
Python package based on the **designSpaceDocument** from [fontTools.designspaceLib](https://github.com/fonttools/fonttools/tree/master/Lib/fontTools/designspaceLib)) specifically to _process_ and _generate_ instances for UFO files, glyphs and other data.

## UFOOperator takes over from UfoProcessor

Some deep changes were necessary to support designspace format 5 files. Rather than try to work it into unwilling old code, UFOOperator is rewritten from the bottom up. The new object *wraps* the FontTools DesignSpaceDocument object, rather than *subclassing* it. The goals for UFOOperator remain largely the same. Though the emphasis is now on providing objects that provide live interpolation, rather than generate stand alone UFOs.

* Support designspace format 5, with layers. *Not all elements of designspace 5 are supported.*
* Collect source materials
* Provide mutators for specific glyphs, font info, kerning so that other tools can generate partial instances. Either from `MutatorMath` or `fonttools varlib.model`.
* Support anisotropic locations in both math models, even if Variable Fonts won't. These are super useful during design, so I need them to work.
* Support extrapolation in both math models, even if Variable Fonts won't. Note that MutatorMath and VarLib approach extrapolation differently. Useful for design-explorations.
* Support discrete axes. This is a bit complex, but it is nice when it works.
* Apply avar-like designspace bending
* Generate actual UFO instances in formats 3.
* Round geometry as requested
* Try to stay up to date with fontTools
* Baseclass for tools that need access to designspace data.
* Some caching of MutatorMath and Varlib flavored mutators.

## No more rules
UFOProcessor could execute *some* of the feature-variation rules when it generated UFOs. But these variations has become much more complex than can be faked with simple glyph-swapping. So I did not port that to UFOOperator. UFOs generated with UFOOperator will have all the glyphs in the same places as their sources.

## Discrete axes
A *discrete axis* is a way to fit different interpolating systems into a single designspace. For instance a *roman* could be on ```italic=0``` and the *italic* on ```italic=1```. The roman and italic are in the same file, but to UFOOperator they are separate systems that interpolate along the normal axes. If is are more than one discrete axis in a designspace, each combination of the axis values, each *discrete location* can be an interpolating system. So some of the methods of UFOOperator require a `discrete location` to know which interpolating system is needed. 


## Examples UFOProcessor (old)

Generate all the instances (using the varlib model, no rounding):

```python
import ufoProcessor
myPath = "myDesignspace.designspace"
ufoProcessor.build(myPath)
```

Generate all the instances (using the varlib model, but round all the geometry to integers):

```python
import ufoProcessor
myPath = "myDesignspace.designspace"
ufoProcessor.build(myPath, roundGeometry=True)
```

Generate all the instances (using the mutatormath model, no rounding):

```python
import ufoProcessor
myPath = "myDesignspace.designspace"
ufoProcessor.build(myPath, useVarlib=False)
```

Generate an instance for one glyph, `"A"` at `width=100, weight=200`. (assuming the designspace has those axes and the masters have that glyph)

```python
import ufoProcessor
myPath = "myDesignspace.designspace"
doc = ufoProcessor.DesignSpaceProcessor()
doc.read(myPath)
doc.loadFonts()
glyphMutator = doc.getGlyphMutator("A")
instance = glyphMutator.makeInstance(Location(width=100, weight=200)
```

Depending on the setting for `usevarlib`, the `glyphMutator` object returned by `getGlyphMutator` in the example above can either be a `MutatorMath.Mutator`, or a `VariationModelMutator` object. That uses the `fontTools.varLib.models.VariationModel` but it is wrapped and can be called as a Mutator object to generate instances. This way `DesignSpaceProcessor` does not need to know much about which math model it is using.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LettError/ufoProcessor",
    "name": "ufoProcessor",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=2.7",
    "maintainer_email": null,
    "keywords": "font development tools",
    "author": "Erik van Blokland",
    "author_email": "erik@letterror.com",
    "download_url": "https://files.pythonhosted.org/packages/26/84/ffaced5b5350e4220540a2c3b5075eebf74a8332105845237ce742437650/ufoprocessor-1.13.2.tar.gz",
    "platform": null,
    "description": "[![PyPI](https://img.shields.io/pypi/v/ufoprocessor.svg)](https://pypi.org/project/ufoprocessor)\n\n# ufoProcessor\nPython package based on the **designSpaceDocument** from [fontTools.designspaceLib](https://github.com/fonttools/fonttools/tree/master/Lib/fontTools/designspaceLib)) specifically to _process_ and _generate_ instances for UFO files, glyphs and other data.\n\n## UFOOperator takes over from UfoProcessor\n\nSome deep changes were necessary to support designspace format 5 files. Rather than try to work it into unwilling old code, UFOOperator is rewritten from the bottom up. The new object *wraps* the FontTools DesignSpaceDocument object, rather than *subclassing* it. The goals for UFOOperator remain largely the same. Though the emphasis is now on providing objects that provide live interpolation, rather than generate stand alone UFOs.\n\n* Support designspace format 5, with layers. *Not all elements of designspace 5 are supported.*\n* Collect source materials\n* Provide mutators for specific glyphs, font info, kerning so that other tools can generate partial instances. Either from `MutatorMath` or `fonttools varlib.model`.\n* Support anisotropic locations in both math models, even if Variable Fonts won't. These are super useful during design, so I need them to work.\n* Support extrapolation in both math models, even if Variable Fonts won't. Note that MutatorMath and VarLib approach extrapolation differently. Useful for design-explorations.\n* Support discrete axes. This is a bit complex, but it is nice when it works.\n* Apply avar-like designspace bending\n* Generate actual UFO instances in formats 3.\n* Round geometry as requested\n* Try to stay up to date with fontTools\n* Baseclass for tools that need access to designspace data.\n* Some caching of MutatorMath and Varlib flavored mutators.\n\n## No more rules\nUFOProcessor could execute *some* of the feature-variation rules when it generated UFOs. But these variations has become much more complex than can be faked with simple glyph-swapping. So I did not port that to UFOOperator. UFOs generated with UFOOperator will have all the glyphs in the same places as their sources.\n\n## Discrete axes\nA *discrete axis* is a way to fit different interpolating systems into a single designspace. For instance a *roman* could be on ```italic=0``` and the *italic* on ```italic=1```. The roman and italic are in the same file, but to UFOOperator they are separate systems that interpolate along the normal axes. If is are more than one discrete axis in a designspace, each combination of the axis values, each *discrete location* can be an interpolating system. So some of the methods of UFOOperator require a `discrete location` to know which interpolating system is needed. \n\n\n## Examples UFOProcessor (old)\n\nGenerate all the instances (using the varlib model, no rounding):\n\n```python\nimport ufoProcessor\nmyPath = \"myDesignspace.designspace\"\nufoProcessor.build(myPath)\n```\n\nGenerate all the instances (using the varlib model, but round all the geometry to integers):\n\n```python\nimport ufoProcessor\nmyPath = \"myDesignspace.designspace\"\nufoProcessor.build(myPath, roundGeometry=True)\n```\n\nGenerate all the instances (using the mutatormath model, no rounding):\n\n```python\nimport ufoProcessor\nmyPath = \"myDesignspace.designspace\"\nufoProcessor.build(myPath, useVarlib=False)\n```\n\nGenerate an instance for one glyph, `\"A\"` at `width=100, weight=200`. (assuming the designspace has those axes and the masters have that glyph)\n\n```python\nimport ufoProcessor\nmyPath = \"myDesignspace.designspace\"\ndoc = ufoProcessor.DesignSpaceProcessor()\ndoc.read(myPath)\ndoc.loadFonts()\nglyphMutator = doc.getGlyphMutator(\"A\")\ninstance = glyphMutator.makeInstance(Location(width=100, weight=200)\n```\n\nDepending on the setting for `usevarlib`, the `glyphMutator` object returned by `getGlyphMutator` in the example above can either be a `MutatorMath.Mutator`, or a `VariationModelMutator` object. That uses the `fontTools.varLib.models.VariationModel` but it is wrapped and can be called as a Mutator object to generate instances. This way `DesignSpaceProcessor` does not need to know much about which math model it is using.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Read, write and generate UFOs with designspace data.",
    "version": "1.13.2",
    "project_urls": {
        "Homepage": "https://github.com/LettError/ufoProcessor"
    },
    "split_keywords": [
        "font",
        "development",
        "tools"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c32be430383599b228a42cf13d66faf14213b40140359a6dd74c24592f79d1d5",
                "md5": "5f724cf6eebdef448d88379986b948e6",
                "sha256": "7ca7ab309cc5b767c29e9bc5f9547e68d065484fc01d3fe2513a9e790697390e"
            },
            "downloads": -1,
            "filename": "ufoProcessor-1.13.2-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "5f724cf6eebdef448d88379986b948e6",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=2.7",
            "size": 36057,
            "upload_time": "2024-11-15T09:09:36",
            "upload_time_iso_8601": "2024-11-15T09:09:36.999871Z",
            "url": "https://files.pythonhosted.org/packages/c3/2b/e430383599b228a42cf13d66faf14213b40140359a6dd74c24592f79d1d5/ufoProcessor-1.13.2-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2684ffaced5b5350e4220540a2c3b5075eebf74a8332105845237ce742437650",
                "md5": "91be018142a07a17d97ad26f6451478f",
                "sha256": "4327d6f8382a9092fd75fce7edfe42dae3b47965758999ee0899711a9062d2c6"
            },
            "downloads": -1,
            "filename": "ufoprocessor-1.13.2.tar.gz",
            "has_sig": false,
            "md5_digest": "91be018142a07a17d97ad26f6451478f",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=2.7",
            "size": 121088,
            "upload_time": "2024-11-15T09:09:38",
            "upload_time_iso_8601": "2024-11-15T09:09:38.518556Z",
            "url": "https://files.pythonhosted.org/packages/26/84/ffaced5b5350e4220540a2c3b5075eebf74a8332105845237ce742437650/ufoprocessor-1.13.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-15 09:09:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LettError",
    "github_project": "ufoProcessor",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ufoprocessor"
}
        
Elapsed time: 0.90146s