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

[designspace] Add avar2 mapping support #3123

Merged
merged 30 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
50fc821
[designspace/varLib] Hack to read avar2 mapping and build avar2 table
behdad May 24, 2023
b9e03b1
[avar2] Rewrite loop
behdad May 25, 2023
5785fde
[avar2] Emit the difference of input vs output
behdad May 26, 2023
be9daca
[designspaceLib/avar2] Rename mapping to axisMappings
behdad May 26, 2023
0b57567
[designspaceLib/avar2] Add AxisMappingDescriptor
behdad May 26, 2023
f27e843
[designspaceLib/avar2] Flesh out AxisMapping API
behdad May 26, 2023
50b1fb3
[designspaceLib/avar2] Rename elements to <mappings><mapping>
behdad May 27, 2023
3a809db
[designspaceLib/avar2] Write out <mappings> element
behdad May 28, 2023
ae23051
[designspaceLib/avar2] Store axis name, not tag, in <dimension>
behdad May 28, 2023
90e8595
[designspaceLib/avar2] Document
behdad May 28, 2023
e587942
[designspaceLib/avar2] Add tests
behdad May 28, 2023
588cbc9
[designspaceLib/avar2] Rename variables
behdad May 30, 2023
246d539
[designspaceLib/avar2] Warn if input location missing for an output axis
behdad May 30, 2023
aabb26e
[designspaceLib/avar2] Add roundtrip test
behdad May 30, 2023
ff7f49a
[varLib/avar2] Add compile test
behdad May 30, 2023
d915f08
[varLib/avar2] Don't require base master to be specified explicitly
behdad May 30, 2023
a08acf4
[varLib/avar2] Omit identity VarIdx map
behdad May 30, 2023
a99a75e
[varLib/avar2] Use buildDeltaSetIndexMap()
behdad May 30, 2023
0184c91
[designspaceLib/test] Fix Windows bot failure
behdad May 30, 2023
d513e56
[designspaceLib/avar2] Add XML docs
behdad May 31, 2023
1b7c0bf
[designspaceLib/avar2] Adjust version to 5.1 when writing mappings
behdad May 31, 2023
2740f98
[designspaceLib/avar2] More docs
behdad May 31, 2023
a8f9fa9
[designspaceLib/docs] varLib spelling
behdad May 31, 2023
ce0a32d
[varLib.builder] Fixup
behdad May 31, 2023
ca642e8
[designspaceLib/avar2] First stab at splitting mappings
behdad May 31, 2023
77c0071
[designspaceLib/avar2] Add split test
behdad May 31, 2023
ddf16c9
[designspaceLib/avar2] Apply review comments
behdad Jun 1, 2023
65bc6b7
[designspaceLib/avar2] Remove Windows hack in tests
behdad Jun 1, 2023
54cfb5f
[designspaceLib/avar2] Err if mappings axes ranges are being subset
behdad Jun 1, 2023
d601646
[varLib/avar2] Remove warning
behdad Jun 2, 2023
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
22 changes: 15 additions & 7 deletions Doc/source/designspaceLib/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,20 @@ Implementation and differences
The designspace format has gone through considerable development.

- the format was originally written for MutatorMath.
- the format is now also used in fontTools.varlib.
- the format is now also used in fontTools.varLib.
- not all values are be required by all implementations.

Varlib vs. MutatorMath
varLib vs. MutatorMath
----------------------

There are some differences between the way MutatorMath and fontTools.varlib handle designspaces.
There are some differences between the way MutatorMath and fontTools.varLib handle designspaces.

- Varlib does not support anisotropic interpolations.
- varLib does not support anisotropic interpolations.
- MutatorMath will extrapolate over the boundaries of
the axes. Varlib can not (at the moment).
- Varlib requires much less data to define an instance than
the axes. varLib can not (at the moment).
- varLib requires much less data to define an instance than
MutatorMath.
- The goals of Varlib and MutatorMath are different, so not all
- The goals of varLib and MutatorMath are different, so not all
attributes are always needed.


Expand Down Expand Up @@ -174,6 +174,14 @@ it can become complex very quickly. So proceed with caution.
Version history
===============

Version 5.1
-----------

The format was extended to support arbitrary mapping between input and output
designspace locations. The ``<axes>`` elements now can have a ``<mappings>``
element that specifies such mappings, which when present carries data that is
used to compile to an ``avar`` version 2 table.

Version 5.0
-----------

Expand Down
2 changes: 1 addition & 1 deletion Doc/source/designspaceLib/scripting.rst
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ You can generate the UFOs with MutatorMath:

- Assuming the outline data in the masters is compatible.

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


.. _working_with_v5:
Expand Down
71 changes: 67 additions & 4 deletions Doc/source/designspaceLib/xml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,15 @@ Overview
.. code:: xml

<?xml version='1.0' encoding='utf-8'?>
<designspace format="5.0">
<designspace format="5.1">
<axes>
<!-- define axes here -->
<axis... />
<mappings>
<!-- define axis mappings here -->
<!-- New in version 5.1 -->
<mapping... />
</mappings>
</axes>
<labels>
<!-- define STAT format 4 labels here -->
Expand Down Expand Up @@ -255,6 +260,64 @@ Example of all axis elements together
</axes>


``<mappings>`` element
======================

- Define axis mappings.
- Child element of ``axes``


.. versionadded:: 5.1


``<mapping>`` element
---------------------

- Defines an axis mapping.
- Child element of ``<mappings>``


.. versionadded:: 5.1


``<input>`` element
...................

- Defines the input location of an axis mapping.
- Child element of ``<mapping>``
- Contains one or more ``<dimension>`` elements with designspace locations.

.. versionadded:: 5.1


``<output>`` element
...................

- Defines the output location of an axis mapping.
- Child element of ``<mapping>``
- Contains one or more ``<dimension>`` elements with designspace locations.

.. versionadded:: 5.1


Example of all mappings elements together
=========================================

.. code:: xml

<mappings>
<mapping>
<input>
<dimension name="weight" xvalue="900"/>
<dimension name="width" xvalue="150"/>
</input>
<output>
<dimension name="weight" xvalue="870"/>
</output>
</mapping>
</mappings>


================================
``<labels>`` element (top-level)
================================
Expand Down Expand Up @@ -304,7 +367,7 @@ See: `OTSpec STAT Axis value table, format 4 <https://docs.microsoft.com/en-us/t
``<dimension>`` element
.......................

- Child element of ``<location>``
- Child element of ``<location>``, ``input``, or ``output`` elements

.. rubric:: Attributes

Expand Down Expand Up @@ -804,7 +867,7 @@ The ``<instances>`` element contains one or more ``<instance>`` elements.

- Defines a single font that can be calculated with the designspace.
- Child element of ``<instances>``
- For use in Varlib the instance element really only needs the names
- 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
Expand Down Expand Up @@ -879,7 +942,7 @@ with an ``xml:lang`` attribute:
<stylemapfamilyname xml:lang="ja">モンセラート SemiBold</stylemapfamilyname>


Example for varlib
Example for varLib
------------------

.. code:: xml
Expand Down