README.rst
1|Travis CI Status| |Appveyor CI Status| |PyPI Version| |Codecov|
2|Gitter Chat|
3
4ufo2ft
5======
6
7ufo2ft ("UFO to FontTools") is a fork of
8`ufo2fdk <https://github.com/typesupply/ufo2fdk>`__ whose goal is to
9generate OpenType font binaries from UFOs without the FDK dependency.
10
11The library provides two functions, ``compileOTF`` and ``compileTTF``,
12which work exactly the same way:
13
14.. code:: python
15
16 from defcon import Font
17 from ufo2ft import compileOTF
18 ufo = Font('MyFont-Regular.ufo')
19 otf = compileOTF(ufo)
20 otf.save('MyFont-Regular.otf')
21
22In most cases, the behavior of ufo2ft should match that of ufo2fdk,
23whose documentation is retained below (and hopefully is still accurate).
24
25Naming Data
26~~~~~~~~~~~
27
28As with any OpenType compiler, you have to set the font naming data to a
29particular standard for your naming to be set correctly. In ufo2fdk, you
30can get away with setting *two* naming attributes in your font.info
31object for simple fonts:
32
33- familyName: The name for your family. For example, "My Garamond".
34- styleName: The style name for this particular font. For example,
35 "Display Light Italic"
36
37ufo2fdk will create all of the other naming data based on thse two
38fields. If you want to use the fully automatic naming system, all of the
39other name attributes should be set to ``None`` in your font. However,
40if you want to override the automated system at any level, you can
41specify particular naming attributes and ufo2fdk will honor your
42settings. You don't have to set *all* of the attributes, just the ones
43you don't want to be automated. For example, in the family "My Garamond"
44you have eight weights. It would be nice to style map the italics to the
45romans for each weight. To do this, in the individual romans and
46italics, you need to set the style mapping data. This is done through
47the ``styleMapFamilyName`` and ``styleMapStyleName`` attributes. In each
48of your roman and italic pairs you would do this:
49
50**My Garamond-Light.ufo**
51
52- familyName = "My Garamond"
53- styleName = "Light"
54- styleMapFamilyName = "My Garamond Display Light"
55- styleMapStyleName = "regular"
56
57**My Garamond-Light Italic.ufo**
58
59- familyName = "My Garamond"
60- styleName = "Display Light Italic"
61- styleMapFamilyName = "My Garamond Display Light"
62- styleMapStyleName = "italic"
63
64**My Garamond-Book.ufo**
65
66- familyName = "My Garamond"
67- styleName = "Book"
68- styleMapFamilyName = "My Garamond Display Book"
69- styleMapStyleName = "regular"
70
71**My Garamond-Book Italic.ufo**
72
73- familyName = "My Garamond"
74- styleName = "Display Book Italic"
75- styleMapFamilyName = "My Garamond Display Book"
76- styleMapStyleName = "italic"
77
78**etc.**
79
80Additionally, if you have defined any naming data, or any data for that
81matter, in table definitions within your font's features that data will
82be honored.
83
84
85Feature generation
86~~~~~~~~~~~~~~~~~~
87
88If your font's features do not contain kerning/mark/mkmk features,
89ufo2ft will create them based on your font's kerning/anchor data.
90
91In addition to
92`Adobe OpenType feature files <http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html>`__,
93ufo2ft also supports the
94`MTI/Monotype format <http://monotype.github.io/OpenType_Table_Source/otl_source.html>`__.
95For example, a GPOS table in this format would be stored within the UFO at
96``data/com.github.googlei18n.ufo2ft.mtiFeatures/GPOS.mti``.
97
98
99Fallbacks
100~~~~~~~~~
101
102Most of the fallbacks have static values. To see what is set for these,
103look at ``fontInfoData.py`` in the source code.
104
105In some cases, the fallback values are dynamically generated from other
106data in the info object. These are handled internally with functions.
107
108Merging TTX
109~~~~~~~~~~~
110
111If the UFO data directory has a ``com.github.fonttools.ttx`` folder with TTX
112files ending with ``.ttx``, these will be merged in the generated font.
113The index TTX (generated when using using ``ttx -s``) is not required.
114
115.. |Travis CI Status| image:: https://travis-ci.org/googlei18n/ufo2ft.svg
116 :target: https://travis-ci.org/googlei18n/ufo2ft
117.. |Appveyor CI status| image:: https://ci.appveyor.com/api/projects/status/jaw9bi221plmjlny/branch/master?svg=true
118 :target: https://ci.appveyor.com/project/fonttools/ufo2ft/branch/master
119.. |PyPI Version| image:: https://img.shields.io/pypi/v/ufo2ft.svg
120 :target: https://pypi.org/project/ufo2ft/
121.. |Codecov| image:: https://codecov.io/gh/googlei18n/ufo2ft/branch/master/graph/badge.svg
122 :target: https://codecov.io/gh/googlei18n/ufo2ft
123.. |Gitter Chat| image:: https://badges.gitter.im/fonttools-dev/ufo2ft.svg
124 :alt: Join the chat at https://gitter.im/fonttools-dev/ufo2ft
125 :target: https://gitter.im/fonttools-dev/ufo2ft?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
126