Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace master word in designspace document files #2904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Doc/source/conf.py
Expand Up @@ -48,8 +48,8 @@
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"

# The master toctree document.
master_doc = "index"
# The root toctree document.
root_doc = "index"

# General information about the project.
project = u"fontTools"
Expand Down Expand Up @@ -140,7 +140,7 @@
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(
master_doc,
root_doc,
"fontTools.tex",
u"fontTools Documentation",
u"Just van Rossum, Behdad Esfahbod et al.",
Expand All @@ -153,7 +153,7 @@

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "fonttools", u"fontTools Documentation", [author], 1)]
man_pages = [(root_doc, "fonttools", u"fontTools Documentation", [author], 1)]


# -- Options for Texinfo output -------------------------------------------
Expand All @@ -163,7 +163,7 @@
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
root_doc,
"fontTools",
u"fontTools Documentation",
author,
Expand Down
24 changes: 12 additions & 12 deletions Doc/source/designspaceLib/scripting.rst
Expand Up @@ -59,7 +59,7 @@ Make a descriptor object and add it to the document.
- The ``tag`` attribute is the one of the registered `OpenType
Variation Axis
Tags <https://www.microsoft.com/typography/otspec/fvar.htm#VAT>`__
- The default master is expected at the intersection of all
- The default source is expected at the intersection of all
default values of all axes.

Option: add label names
Expand Down Expand Up @@ -101,28 +101,28 @@ outline geometry, kerning and font.info that we want to work with.

s0 = SourceDescriptor()
s0.path = "my/path/to/thin.ufo"
s0.name = "master.thin"
s0.name = "source.thin"
s0.location = dict(weight=0)
doc.addSource(s0)

- You'll need to have at least 2 sources in your document, so go ahead
and add another one.
- The **location** attribute is a dictionary with the designspace
location for this master.
location for this source.
- The axis names in the location have to match one of the ``axis.name``
values you defined before.
- The **path** attribute is the absolute path to an existing UFO.
- The **name** attribute is a unique name for this source used to keep
track it.
- The **layerName** attribute is the name of the UFO3 layer. Default None for ``foreground``.

So go ahead and add another master:
So go ahead and add another source:

.. code:: python

s1 = SourceDescriptor()
s1.path = "my/path/to/bold.ufo"
s1.name = "master.bold"
s1.name = "source.bold"
s1.location = dict(weight=1000)
doc.addSource(s1)

Expand Down Expand Up @@ -177,7 +177,7 @@ and a stylemap styleName.
i0.styleMapFamilyName = "MyVarProtoMedium"
i0.styleMapStyleName = "regular"

Option: add glyph specific masters
Option: add glyph specific sources
----------------------------------

This bit is not supported by OpenType variable fonts, but it is needed
Expand All @@ -195,16 +195,16 @@ this into something clever.
# you can specify a different location for a glyph
glyphData['instanceLocation'] = dict(weight=500)

# You can specify different masters
# You can specify different sources
# for this specific glyph.
# You can also give those masters new
# You can also give those sources new
# locations. It's a miniature designspace.
# Remember the "name" attribute we assigned to the sources?
glyphData['masters'] = [
dict(font="master.thin",
glyphData['sources'] = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here you may need to change the matching code that expects this dictionary key

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you suggesting to change the occurrences of glyphData['masters'] with glyphData['sources'] in Lib/fontTools/designspaceLib/* source files?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes basically, however I'm not familiar with that part of the designspace spec, maybe @LettError and others can advise. I think maybe font editors who rely on the format would need updating as well if the key changes from "masters" to "sources", that is, code outside this repository would need to adapt. But I'm not sure 100%.

dict(font="source.thin",
glyphName="dollar.nostroke",
location=dict(weight=0)),
dict(font="master.bold",
dict(font="source.bold",
glyphName="dollar.nostroke",
location=dict(weight=1000)),
]
Expand Down Expand Up @@ -232,7 +232,7 @@ You can generate the UFOs with MutatorMath:
from mutatorMath.ufo import build
build("whatevs/myprototype.designspace")

- Assuming the outline data in the masters is compatible.
- Assuming the outline data in the sources is compatible.

Or you can use the file in making a **variable font** with varlib.

Expand Down
16 changes: 8 additions & 8 deletions Doc/source/designspaceLib/xml.rst
Expand Up @@ -31,7 +31,7 @@ Overview
<label... />
</labels>
<sources>
<!-- define masters here -->
<!-- define sources here -->
<source... />
</sources>
<variable-fonts>
Expand Down Expand Up @@ -603,7 +603,7 @@ Defines the coordinates of this source in the design space.
.. rubric:: Attributes

- ``mute``: optional attribute, number 1 or 0. Indicate if this glyph
should be ignored as a master.
should be ignored as a source.

.. note::

Expand Down Expand Up @@ -633,7 +633,7 @@ Defines the coordinates of this source in the design space.

.. code:: xml

<source familyname="MasterFamilyName" filename="masters/masterTest1.ufo" name="master.ufo1" stylename="MasterStyleNameOne">
<source familyname="SourceFamilyName" filename="sources/sourceTest1.ufo" name="source.ufo1" stylename="SourceStyleNameOne">
<location>
<dimension name="width" xvalue="0.000000" />
<dimension name="weight" xvalue="0.000000" />
Expand Down Expand Up @@ -807,7 +807,7 @@ The ``<instances>`` element contains one or more ``<instance>`` elements.
- For use in Varlib the instance element really only needs the names
and the location. The ``<glyphs>`` element is not required.
- MutatorMath uses the ``<glyphs>`` element to describe how certain
glyphs need different masters, mainly to describe the effects of
glyphs need different sources, mainly to describe the effects of
conditional rules in Superpolator.
- Location in designspace coordinates.

Expand Down Expand Up @@ -937,7 +937,7 @@ Example for varlib
,,,,,,,,,,,,,,,,,,,,,

- Container for ``<master>`` elements
- These ``<master>`` elements define an alternative set of glyph masters
- These ``<master>`` elements define an alternative set of glyph sources
for this glyph.

.. deprecated:: 5.0
Expand All @@ -946,13 +946,13 @@ Example for varlib
``<master>`` element
++++++++++++++++++++

- Defines a single alternative master for this glyph.
- Defines a single alternative source for this glyph.

.. deprecated:: 5.0

.. rubric:: Attributes

- ``glyphname``: the name of the alternate master glyph.
- ``glyphname``: the name of the alternate source glyph.
- ``source``: the identifier name of the source this master glyph needs
to be loaded from

Expand All @@ -976,7 +976,7 @@ Example for MutatorMath
</location>
<note>A note about this glyph</note>
<masters>
<master glyphname="BB" source="master.ufo1">
<master glyphname="BB" source="source.ufo1">
<location>
<dimension name="width" xvalue="20" />
<dimension name="weight" xvalue="20" />
Expand Down