ufo2ft


Nameufo2ft JSON
Version 3.2.3 PyPI version JSON
download
home_pagehttps://github.com/googlefonts/ufo2ft
SummaryA bridge between UFOs and FontTools.
upload_time2024-05-17 10:30:27
maintainerCosimo Lupo
docs_urlNone
authorTal Leming, James Godfrey-Kittle
requires_python>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            |GitHub Actions status| |PyPI Version| |Codecov| |Gitter Chat|

ufo2ft
======

ufo2ft ("UFO to FontTools") is a fork of
`ufo2fdk <https://github.com/typesupply/ufo2fdk>`__ whose goal is to
generate OpenType font binaries from UFOs without the FDK dependency.

The library provides two functions, ``compileOTF`` and ``compileTTF``,
which work exactly the same way:

.. code:: python

    from defcon import Font
    from ufo2ft import compileOTF
    ufo = Font('MyFont-Regular.ufo')
    otf = compileOTF(ufo)
    otf.save('MyFont-Regular.otf')

In most cases, the behavior of ufo2ft should match that of ufo2fdk,
whose documentation is retained below (and hopefully is still accurate).

Naming Data
~~~~~~~~~~~

As with any OpenType compiler, you have to set the font naming data to a
particular standard for your naming to be set correctly. In ufo2fdk, you
can get away with setting *two* naming attributes in your font.info
object for simple fonts:

-  familyName: The name for your family. For example, "My Garamond".
-  styleName: The style name for this particular font. For example,
   "Display Light Italic"

ufo2fdk will create all of the other naming data based on thse two
fields. If you want to use the fully automatic naming system, all of the
other name attributes should be set to ``None`` in your font. However,
if you want to override the automated system at any level, you can
specify particular naming attributes and ufo2fdk will honor your
settings. You don't have to set *all* of the attributes, just the ones
you don't want to be automated. For example, in the family "My Garamond"
you have eight weights. It would be nice to style map the italics to the
romans for each weight. To do this, in the individual romans and
italics, you need to set the style mapping data. This is done through
the ``styleMapFamilyName`` and ``styleMapStyleName`` attributes. In each
of your roman and italic pairs you would do this:

**My Garamond-Light.ufo**

-  familyName = "My Garamond"
-  styleName = "Light"
-  styleMapFamilyName = "My Garamond Display Light"
-  styleMapStyleName = "regular"

**My Garamond-Light Italic.ufo**

-  familyName = "My Garamond"
-  styleName = "Display Light Italic"
-  styleMapFamilyName = "My Garamond Display Light"
-  styleMapStyleName = "italic"

**My Garamond-Book.ufo**

-  familyName = "My Garamond"
-  styleName = "Book"
-  styleMapFamilyName = "My Garamond Display Book"
-  styleMapStyleName = "regular"

**My Garamond-Book Italic.ufo**

-  familyName = "My Garamond"
-  styleName = "Display Book Italic"
-  styleMapFamilyName = "My Garamond Display Book"
-  styleMapStyleName = "italic"

**etc.**

Additionally, if you have defined any naming data, or any data for that
matter, in table definitions within your font's features that data will
be honored.


Feature generation
~~~~~~~~~~~~~~~~~~

If your font's features do not contain kerning/mark/mkmk features,
ufo2ft will create them based on your font's kerning/anchor data.

In addition to
`Adobe OpenType feature files <http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html>`__,
ufo2ft also supports the
`MTI/Monotype format <http://monotype.github.io/OpenType_Table_Source/otl_source.html>`__.
For example, a GPOS table in this format would be stored within the UFO at
``data/com.github.googlei18n.ufo2ft.mtiFeatures/GPOS.mti``.


Fallbacks
~~~~~~~~~

Most of the fallbacks have static values. To see what is set for these,
look at ``fontInfoData.py`` in the source code.

In some cases, the fallback values are dynamically generated from other
data in the info object. These are handled internally with functions.

Merging TTX
~~~~~~~~~~~

If the UFO data directory has a ``com.github.fonttools.ttx`` folder with TTX
files ending with ``.ttx``, these will be merged in the generated font.
The index TTX (generated when using using ``ttx -s``) is not required.

.. |GitHub Actions status| image:: https://github.com/googlefonts/ufo2ft/workflows/Test%20+%20Deploy/badge.svg
.. |PyPI Version| image:: https://img.shields.io/pypi/v/ufo2ft.svg
   :target: https://pypi.org/project/ufo2ft/
.. |Codecov| image:: https://codecov.io/gh/googlefonts/ufo2ft/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/googlefonts/ufo2ft
.. |Gitter Chat| image:: https://badges.gitter.im/fonttools-dev/ufo2ft.svg
   :alt: Join the chat at https://gitter.im/fonttools-dev/ufo2ft
   :target: https://gitter.im/fonttools-dev/ufo2ft?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge


Color fonts
~~~~~~~~~~~

ufo2ft supports building ``COLR`` and ``CPAL`` tables.

If there is ``com.github.googlei18n.ufo2ft.colorPalettes`` key in font lib, and
``com.github.googlei18n.ufo2ft.colorLayerMapping`` key in the font or
in any of the glyphs lib, then ufo2ft will build ``CPAL`` table from the color
palettes, and ``COLR`` table from the color layers.

``colorPalettes`` is a array of palettes, each palette is a array of colors and
each color is a array of floats representing RGBA colors. For example:

.. code:: xml

    <key>com.github.googlei18n.ufo2ft.colorPalettes</key>
    <array>
      <array>
        <array>
          <real>0.26</real>
          <real>0.0</real>
          <real>0.23</real>
          <real>1.0</real>
        </array>
        <array>
          <real>0.86</real>
          <real>0.73</real>
          <real>0.28</real>
          <real>1.0</real>
        </array>
      </array>
    </array>


``colorLayerMapping`` is a array of color layers, each color layer is a array of
layer name and palette color index. It is a per-glyph key, but if present in
the font lib then it will be used for all glyphs that lack it. For example:

.. code:: xml

      <key>com.github.googlei18n.ufo2ft.colorLayerMapping</key>
      <array>
        <array>
          <string>color.1</string>
          <integer>1</integer>
        </array>
        <array>
          <string>color.2</string>
          <integer>0</integer>
        </array>
      </array>

With these this key present, ufo2ft will copy the color layers into individual
glyphs and setup ``COLR`` table.

Alternatively, if the color layers are already separate UFO glyphs, the
``com.github.googlei18n.ufo2ft.colorLayers`` font lib key can be used. It uses
a table keyed by base glyph, and the value is an array of color layers, each
color layer is an array of glyph name and palette color index. For example:

.. code:: xml

    <key>com.github.googlei18n.ufo2ft.colorLayers</key>
    <dict>
      <key>alef-ar</key>
      <array>
        <array>
          <string>alef-ar.color0</string>
          <integer>2</integer>
        </array>
      </array>
      <key>alefHamzaabove-ar</key>
      <array>
        <array>
          <string>alefHamzaabove-ar.color0</string>
          <integer>1</integer>
        </array>
        <array>
          <string>alefHamzaabove-ar.color1</string>
          <integer>2</integer>
        </array>
      </array>
    <dict>

Setup Notes
~~~~~~~~~~~

If you are installing ufo2ft from source, note that the strict dependency versions in `requirements.txt` are
for testing, see `setup.py`'s install_requires and extras_requires for more relaxed dependency requirements.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/googlefonts/ufo2ft",
    "name": "ufo2ft",
    "maintainer": "Cosimo Lupo",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "cosimo@anthrotype.com",
    "keywords": null,
    "author": "Tal Leming, James Godfrey-Kittle",
    "author_email": "tal@typesupply.com",
    "download_url": "https://files.pythonhosted.org/packages/e7/f4/e047dd640a795d3b4ad3153c2753c8c338af4bcbed555cd154920eaa91c6/ufo2ft-3.2.3.tar.gz",
    "platform": null,
    "description": "|GitHub Actions status| |PyPI Version| |Codecov| |Gitter Chat|\n\nufo2ft\n======\n\nufo2ft (\"UFO to FontTools\") is a fork of\n`ufo2fdk <https://github.com/typesupply/ufo2fdk>`__ whose goal is to\ngenerate OpenType font binaries from UFOs without the FDK dependency.\n\nThe library provides two functions, ``compileOTF`` and ``compileTTF``,\nwhich work exactly the same way:\n\n.. code:: python\n\n    from defcon import Font\n    from ufo2ft import compileOTF\n    ufo = Font('MyFont-Regular.ufo')\n    otf = compileOTF(ufo)\n    otf.save('MyFont-Regular.otf')\n\nIn most cases, the behavior of ufo2ft should match that of ufo2fdk,\nwhose documentation is retained below (and hopefully is still accurate).\n\nNaming Data\n~~~~~~~~~~~\n\nAs with any OpenType compiler, you have to set the font naming data to a\nparticular standard for your naming to be set correctly. In ufo2fdk, you\ncan get away with setting *two* naming attributes in your font.info\nobject for simple fonts:\n\n-  familyName: The name for your family. For example, \"My Garamond\".\n-  styleName: The style name for this particular font. For example,\n   \"Display Light Italic\"\n\nufo2fdk will create all of the other naming data based on thse two\nfields. If you want to use the fully automatic naming system, all of the\nother name attributes should be set to ``None`` in your font. However,\nif you want to override the automated system at any level, you can\nspecify particular naming attributes and ufo2fdk will honor your\nsettings. You don't have to set *all* of the attributes, just the ones\nyou don't want to be automated. For example, in the family \"My Garamond\"\nyou have eight weights. It would be nice to style map the italics to the\nromans for each weight. To do this, in the individual romans and\nitalics, you need to set the style mapping data. This is done through\nthe ``styleMapFamilyName`` and ``styleMapStyleName`` attributes. In each\nof your roman and italic pairs you would do this:\n\n**My Garamond-Light.ufo**\n\n-  familyName = \"My Garamond\"\n-  styleName = \"Light\"\n-  styleMapFamilyName = \"My Garamond Display Light\"\n-  styleMapStyleName = \"regular\"\n\n**My Garamond-Light Italic.ufo**\n\n-  familyName = \"My Garamond\"\n-  styleName = \"Display Light Italic\"\n-  styleMapFamilyName = \"My Garamond Display Light\"\n-  styleMapStyleName = \"italic\"\n\n**My Garamond-Book.ufo**\n\n-  familyName = \"My Garamond\"\n-  styleName = \"Book\"\n-  styleMapFamilyName = \"My Garamond Display Book\"\n-  styleMapStyleName = \"regular\"\n\n**My Garamond-Book Italic.ufo**\n\n-  familyName = \"My Garamond\"\n-  styleName = \"Display Book Italic\"\n-  styleMapFamilyName = \"My Garamond Display Book\"\n-  styleMapStyleName = \"italic\"\n\n**etc.**\n\nAdditionally, if you have defined any naming data, or any data for that\nmatter, in table definitions within your font's features that data will\nbe honored.\n\n\nFeature generation\n~~~~~~~~~~~~~~~~~~\n\nIf your font's features do not contain kerning/mark/mkmk features,\nufo2ft will create them based on your font's kerning/anchor data.\n\nIn addition to\n`Adobe OpenType feature files <http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html>`__,\nufo2ft also supports the\n`MTI/Monotype format <http://monotype.github.io/OpenType_Table_Source/otl_source.html>`__.\nFor example, a GPOS table in this format would be stored within the UFO at\n``data/com.github.googlei18n.ufo2ft.mtiFeatures/GPOS.mti``.\n\n\nFallbacks\n~~~~~~~~~\n\nMost of the fallbacks have static values. To see what is set for these,\nlook at ``fontInfoData.py`` in the source code.\n\nIn some cases, the fallback values are dynamically generated from other\ndata in the info object. These are handled internally with functions.\n\nMerging TTX\n~~~~~~~~~~~\n\nIf the UFO data directory has a ``com.github.fonttools.ttx`` folder with TTX\nfiles ending with ``.ttx``, these will be merged in the generated font.\nThe index TTX (generated when using using ``ttx -s``) is not required.\n\n.. |GitHub Actions status| image:: https://github.com/googlefonts/ufo2ft/workflows/Test%20+%20Deploy/badge.svg\n.. |PyPI Version| image:: https://img.shields.io/pypi/v/ufo2ft.svg\n   :target: https://pypi.org/project/ufo2ft/\n.. |Codecov| image:: https://codecov.io/gh/googlefonts/ufo2ft/branch/master/graph/badge.svg\n   :target: https://codecov.io/gh/googlefonts/ufo2ft\n.. |Gitter Chat| image:: https://badges.gitter.im/fonttools-dev/ufo2ft.svg\n   :alt: Join the chat at https://gitter.im/fonttools-dev/ufo2ft\n   :target: https://gitter.im/fonttools-dev/ufo2ft?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge\n\n\nColor fonts\n~~~~~~~~~~~\n\nufo2ft supports building ``COLR`` and ``CPAL`` tables.\n\nIf there is ``com.github.googlei18n.ufo2ft.colorPalettes`` key in font lib, and\n``com.github.googlei18n.ufo2ft.colorLayerMapping`` key in the font or\nin any of the glyphs lib, then ufo2ft will build ``CPAL`` table from the color\npalettes, and ``COLR`` table from the color layers.\n\n``colorPalettes`` is a array of palettes, each palette is a array of colors and\neach color is a array of floats representing RGBA colors. For example:\n\n.. code:: xml\n\n    <key>com.github.googlei18n.ufo2ft.colorPalettes</key>\n    <array>\n      <array>\n        <array>\n          <real>0.26</real>\n          <real>0.0</real>\n          <real>0.23</real>\n          <real>1.0</real>\n        </array>\n        <array>\n          <real>0.86</real>\n          <real>0.73</real>\n          <real>0.28</real>\n          <real>1.0</real>\n        </array>\n      </array>\n    </array>\n\n\n``colorLayerMapping`` is a array of color layers, each color layer is a array of\nlayer name and palette color index. It is a per-glyph key, but if present in\nthe font lib then it will be used for all glyphs that lack it. For example:\n\n.. code:: xml\n\n      <key>com.github.googlei18n.ufo2ft.colorLayerMapping</key>\n      <array>\n        <array>\n          <string>color.1</string>\n          <integer>1</integer>\n        </array>\n        <array>\n          <string>color.2</string>\n          <integer>0</integer>\n        </array>\n      </array>\n\nWith these this key present, ufo2ft will copy the color layers into individual\nglyphs and setup ``COLR`` table.\n\nAlternatively, if the color layers are already separate UFO glyphs, the\n``com.github.googlei18n.ufo2ft.colorLayers`` font lib key can be used. It uses\na table keyed by base glyph, and the value is an array of color layers, each\ncolor layer is an array of glyph name and palette color index. For example:\n\n.. code:: xml\n\n    <key>com.github.googlei18n.ufo2ft.colorLayers</key>\n    <dict>\n      <key>alef-ar</key>\n      <array>\n        <array>\n          <string>alef-ar.color0</string>\n          <integer>2</integer>\n        </array>\n      </array>\n      <key>alefHamzaabove-ar</key>\n      <array>\n        <array>\n          <string>alefHamzaabove-ar.color0</string>\n          <integer>1</integer>\n        </array>\n        <array>\n          <string>alefHamzaabove-ar.color1</string>\n          <integer>2</integer>\n        </array>\n      </array>\n    <dict>\n\nSetup Notes\n~~~~~~~~~~~\n\nIf you are installing ufo2ft from source, note that the strict dependency versions in `requirements.txt` are\nfor testing, see `setup.py`'s install_requires and extras_requires for more relaxed dependency requirements.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A bridge between UFOs and FontTools.",
    "version": "3.2.3",
    "project_urls": {
        "Homepage": "https://github.com/googlefonts/ufo2ft"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb6b696e82e802cc1c08c10b75a9126b0bcd7e93178667fca2f35295e892c3e5",
                "md5": "2c5998bffe1021a9496e9c3c3eeaae9b",
                "sha256": "80399929d0850c535bf370982969143f0e30ff18e85978a70d223ee17b8baf6c"
            },
            "downloads": -1,
            "filename": "ufo2ft-3.2.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2c5998bffe1021a9496e9c3c3eeaae9b",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.8",
            "size": 151546,
            "upload_time": "2024-05-17T10:30:24",
            "upload_time_iso_8601": "2024-05-17T10:30:24.651214Z",
            "url": "https://files.pythonhosted.org/packages/cb/6b/696e82e802cc1c08c10b75a9126b0bcd7e93178667fca2f35295e892c3e5/ufo2ft-3.2.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e7f4e047dd640a795d3b4ad3153c2753c8c338af4bcbed555cd154920eaa91c6",
                "md5": "3a2986e6eb987d3af7252640e95ecd9e",
                "sha256": "ef84db141783efa53f6ecc14a344de1f4ae74b27f12c7614f960605f3351bacb"
            },
            "downloads": -1,
            "filename": "ufo2ft-3.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "3a2986e6eb987d3af7252640e95ecd9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 406432,
            "upload_time": "2024-05-17T10:30:27",
            "upload_time_iso_8601": "2024-05-17T10:30:27.143079Z",
            "url": "https://files.pythonhosted.org/packages/e7/f4/e047dd640a795d3b4ad3153c2753c8c338af4bcbed555cd154920eaa91c6/ufo2ft-3.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-17 10:30:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "googlefonts",
    "github_project": "ufo2ft",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "tox": true,
    "lcname": "ufo2ft"
}
        
Elapsed time: 0.26139s