Merge branch 'main' into ttf2otf

This commit is contained in:
ftCLI 2024-09-28 11:09:50 +02:00 committed by GitHub
commit fd2f34285f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
39 changed files with 259 additions and 150 deletions

View File

@ -1,6 +1,6 @@
########################################### ###############################################
afmLib: Read/write Adobe Font Metrics files afmLib: Read and write Adobe Font Metrics files
########################################### ###############################################
.. automodule:: fontTools.afmLib .. automodule:: fontTools.afmLib

View File

@ -0,0 +1,10 @@
##############################
CFF2ToCFF: convert CFF2 to CFF
##############################
.. automodule:: fontTools.cffLib.CFF2ToCFF
:inherited-members:
:members:
:undoc-members:

View File

@ -0,0 +1,8 @@
##############################
CFFToCFF2: convert CFF to CFF2
##############################
.. automodule:: fontTools.cffLib.CFFToCFF2
:inherited-members:
:members:
:undoc-members:

View File

@ -1,13 +1,38 @@
################################## ######################################
cffLib: read/write Adobe CFF fonts cffLib: Read and write Adobe CFF fonts
################################## ######################################
.. rubric:: Overview:
:heading-level: 3
.. automodule:: fontTools.cffLib .. automodule:: fontTools.cffLib
:inherited-members:
:members:
:undoc-members:
:member-order: bysource
This package also contains two modules for manipulating CFF format glyphs: .. rubric:: Submodules:
:heading-level: 3
cffLib contains submodules for converting between CCF and CFF2.
Each can be used within other Python scripts or run as a
subcommand of the ``fonttools`` command-line tool:
.. toctree::
:maxdepth: 1
CFFToCFF2
CFF2ToCFF
It also contains submodules for manipulating CFF-formatted glyphs:
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
specializer specializer
width width
.. rubric:: Module members:
:heading-level: 3

View File

@ -2,7 +2,15 @@
specializer: T2CharString operator specializer and generalizer specializer: T2CharString operator specializer and generalizer
############################################################## ##############################################################
.. rubric:: Overview:
:heading-level: 3
.. automodule:: fontTools.cffLib.specializer .. automodule:: fontTools.cffLib.specializer
:inherited-members: :inherited-members:
:members: :members:
:undoc-members: :undoc-members:
.. rubric:: Module members:
:heading-level: 3

View File

@ -44,6 +44,7 @@ autodoc_default_options = {
"members": True, "members": True,
"inherited-members": True, "inherited-members": True,
"show-inheritance": True, "show-inheritance": True,
"member-order": "bysource",
} }
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
@ -89,6 +90,9 @@ language = "en"
# This patterns also effect to html_static_path and html_extra_path # This patterns also effect to html_static_path and html_extra_path
exclude_patterns = [] exclude_patterns = []
# The programming language to be used by default in syntax highlighting.
highlight_language = "python"
# The name of the Pygments (syntax highlighting) style to use. # The name of the Pygments (syntax highlighting) style to use.
# pygments_style = "sphinx" (the default sphinx docs style on RTD) # pygments_style = "sphinx" (the default sphinx docs style on RTD)
pygments_style = "default" pygments_style = "default"

View File

@ -1,5 +1,5 @@
########################### ###########################
config: configure fontTools config: Configure fontTools
########################### ###########################
.. automodule:: fontTools.config .. automodule:: fontTools.config

View File

@ -1,6 +1,6 @@
########################################## ########################################
cu2qu: Cubic to quadratic curve conversion cu2qu: Convert cubic curves to quadratic
########################################## ########################################
Routines for converting cubic curves to quadratic splines, suitable for use Routines for converting cubic curves to quadratic splines, suitable for use
in OpenType to TrueType outline conversion. in OpenType to TrueType outline conversion.

View File

@ -4,7 +4,7 @@ designspaceLib: Read, write, and edit designspace files
Implements support for reading and manipulating ``designspace`` files. Implements support for reading and manipulating ``designspace`` files.
Allows the users to define axes, rules, sources, variable fonts and instances, Allows the users to define axes, rules, sources, variable fonts and instances,
and their STAT information. and their ``STAT`` information.
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -1,6 +1,6 @@
################################################## ############################################################
encodings: Support for OpenType-specific encodings encodings: Support for OpenType-specific character encodings
################################################## ############################################################
fontTools includes support for some character encodings found in legacy Mac fontTools includes support for some character encodings found in legacy Mac
TrueType fonts. Many of these legacy encodings have found their way into the TrueType fonts. Many of these legacy encodings have found their way into the

View File

@ -1,6 +1,6 @@
######################################### #############################################
feaLib: Read/write OpenType feature files feaLib: Read and write OpenType feature files
######################################### #############################################
fontTools' ``feaLib`` allows for the creation and parsing of Adobe fontTools' ``feaLib`` allows for the creation and parsing of Adobe
Font Development Kit for OpenType feature (``.fea``) files. The syntax Font Development Kit for OpenType feature (``.fea``) files. The syntax

View File

@ -1,6 +1,26 @@
#### ###########################################
pens pens: Inspect and manipulate glyph outlines
#### ###########################################
.. rubric:: Overview:
:heading-level: 3
The fontTools **pens** are a collection of classes that can operate
on a font glyph via the points and the contours of the glyph's outlines.
Some pens trace through the outlines and generate graphical output,
such as a new glyph outline or a formatted image, but other
pens analyze the outlines and return information about the glyph.
Pens that alter or produce a pen-compatible :class:`.ttGlyph` object can
be chained together.
New pens can be written by sub-classing the :class:`.AbstractPen` or,
somewhat more practically, :class:`.BasePen` classes. The Pen Protocol is
documented on the :ref:`basePen` page.
.. rubric:: Pen modules:
:heading-level: 3
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -1,6 +1,6 @@
###### ########################################################
subset subset: Generate subsets of fonts or optimize file sizes
###### ########################################################
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -1,6 +1,6 @@
###### ############################################
svgLib svgLib: Read and write SVG-in-OpenType fonts
###### ############################################
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

View File

@ -1,6 +1,6 @@
##### #############################################
t1Lib t1Lib: Read and write PostScript Type 1 fonts
##### #############################################
.. automodule:: fontTools.t1Lib .. automodule:: fontTools.t1Lib
:inherited-members: :inherited-members:

View File

@ -1,6 +1,6 @@
############################################# #################################################
ttLib: Read/write OpenType and TrueType fonts ttLib: Read and write OpenType and TrueType fonts
############################################# #################################################
Most users of the fontTools library will be using it to generate or manipulate Most users of the fontTools library will be using it to generate or manipulate
OpenType and TrueType fonts. (FontTools initially only supported TrueType fonts, OpenType and TrueType fonts. (FontTools initially only supported TrueType fonts,

View File

@ -1,6 +1,6 @@
### ##################################
ttx ttx: Convert fonts to XML and back
### ##################################
TTX From OpenType and TrueType to XML and Back TTX From OpenType and TrueType to XML and Back

View File

@ -1,7 +1,6 @@
#######################################################
########## converters: Conversion functions for kerning and groups
converters #######################################################
##########
.. automodule:: fontTools.ufoLib.converters .. automodule:: fontTools.ufoLib.converters
:inherited-members: :inherited-members:

View File

@ -1,7 +1,6 @@
###################################################
###### errors: Exceptions for handling UFO-specific errors
errors ###################################################
######
.. automodule:: fontTools.ufoLib.errors .. automodule:: fontTools.ufoLib.errors
:inherited-members: :inherited-members:

View File

@ -1,7 +1,6 @@
##########################################################################
######### filenames: Functions to convert between file names and user-facing strings
filenames ##########################################################################
#########
.. automodule:: fontTools.ufoLib.filenames .. automodule:: fontTools.ufoLib.filenames
:inherited-members: :inherited-members:

View File

@ -1,7 +1,6 @@
#######################################
####### glifLib: Read and write UFO .glif files
glifLib #######################################
#######
.. automodule:: fontTools.ufoLib.glifLib .. automodule:: fontTools.ufoLib.glifLib
:inherited-members: :inherited-members:

View File

@ -1,22 +1,45 @@
################################################
ufoLib: Read and write Unified Font Object files
################################################
###### .. rubric:: Overview:
ufoLib :heading-level: 3
######
.. automodule:: fontTools.ufoLib
:inherited-members:
:members:
:undoc-members:
:member-order: bysource
.. rubric:: Submodules:
:heading-level: 3
ufoLib provides the following submodules:
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
:titlesonly:
converters converters
errors errors
filenames filenames
glifLib glifLib
kerning kerning
plistlib
pointpen
utils utils
validators validators
.. automodule:: fontTools.ufoLib Two deprecated submodules are also currently included:
:inherited-members:
:members: .. toctree::
:undoc-members: :maxdepth: 1
plistlib
pointpen
.. rubric:: Module members:
:heading-level: 3
.. autodata:: fontInfoAttributesVersion1
.. autodata:: fontInfoAttributesVersion2
.. autodata:: fontInfoAttributesVersion3
.. autodata:: deprecatedFontInfoAttributesVersion2

View File

@ -1,7 +1,6 @@
###########################################
####### kerning: Support for accessing kerning data
kerning ###########################################
#######
.. automodule:: fontTools.ufoLib.kerning .. automodule:: fontTools.ufoLib.kerning
:inherited-members: :inherited-members:

View File

@ -1,7 +1,8 @@
#####################################################################
plistlib: Support for reading and writing .plist files *[deprecated]*
#####################################################################
######## .. important::
plistlib
########
.. automodule:: fontTools.ufoLib.plistlib .. automodule:: fontTools.ufoLib.plistlib
:inherited-members: :inherited-members:

View File

@ -1,7 +1,8 @@
######################################################################
pointPen: A pen for accessing points in a glyph contour *[deprecated]*
######################################################################
######## .. important::
pointPen
########
.. automodule:: fontTools.ufoLib.pointPen .. automodule:: fontTools.ufoLib.pointPen
:inherited-members: :inherited-members:

View File

@ -1,7 +1,6 @@
#####################################
##### utils: Miscellaneous helper functions
utils #####################################
#####
.. automodule:: fontTools.ufoLib.utils .. automodule:: fontTools.ufoLib.utils
:inherited-members: :inherited-members:

View File

@ -1,7 +1,6 @@
#####################################
########## validators: Data-validation functions
validators #####################################
##########
.. automodule:: fontTools.ufoLib.validators .. automodule:: fontTools.ufoLib.validators
:inherited-members: :inherited-members:

View File

@ -1,7 +1,6 @@
################################## #######################################
varLib: OpenType Variation Support varLib: Support for OpenType Variations
################################## #######################################
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2

View File

@ -1,6 +1,6 @@
#################################### ########################################
voltLib: Read/write MS VOLT projects voltLib: Read and write MS VOLT projects
#################################### ########################################
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2

View File

@ -3,6 +3,6 @@ from fontTools.misc.loggingTools import configLogger
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
version = __version__ = "4.54.1.dev0" version = __version__ = "4.54.2.dev0"
__all__ = ["version", "log", "configLogger"] __all__ = ["version", "log", "configLogger"]

View File

@ -1,7 +1,7 @@
"""cffLib: read/write Adobe CFF fonts """cffLib: read/write Adobe CFF fonts
OpenType fonts with PostScript outlines contain a completely independent OpenType fonts with PostScript outlines embed a completely independent
font file, Adobe's *Compact Font Format*. So dealing with OpenType fonts font file in Adobe's *Compact Font Format*. So dealing with OpenType fonts
requires also dealing with CFF. This module allows you to read and write requires also dealing with CFF. This module allows you to read and write
fonts written in the CFF format. fonts written in the CFF format.

View File

@ -1,35 +1,35 @@
""" """
A library for importing .ufo files and their descendants. A library for importing .ufo files and their descendants.
Refer to http://unifiedfontobject.com for the UFO specification. Refer to http://unifiedfontobject.org for the UFO specification.
The UFOReader and UFOWriter classes support versions 1, 2 and 3 The main interfaces are the :class:`.UFOReader` and :class:`.UFOWriter`
of the specification. classes, which support versions 1, 2, and 3 of the UFO specification.
Sets that list the font info attribute names for the fontinfo.plist Set variables are available for external use that list the font
formats are available for external use. These are: info attribute names for the `fontinfo.plist` formats. These are:
- fontInfoAttributesVersion1 - :obj:`.fontInfoAttributesVersion1`
- fontInfoAttributesVersion2 - :obj:`.fontInfoAttributesVersion2`
- fontInfoAttributesVersion3 - :obj:`.fontInfoAttributesVersion3`
A set listing the fontinfo.plist attributes that were deprecated A set listing the `fontinfo.plist` attributes that were deprecated
in version 2 is available for external use: in version 2 is available for external use:
- deprecatedFontInfoAttributesVersion2 - :obj:`.deprecatedFontInfoAttributesVersion2`
Functions that do basic validation on values for fontinfo.plist Functions that do basic validation on values for `fontinfo.plist`
are available for external use. These are are available for external use. These are
- validateFontInfoVersion2ValueForAttribute - :func:`.validateFontInfoVersion2ValueForAttribute`
- validateFontInfoVersion3ValueForAttribute - :func:`.validateFontInfoVersion3ValueForAttribute`
Value conversion functions are available for converting Value conversion functions are available for converting
fontinfo.plist values between the possible format versions. `fontinfo.plist` values between the possible format versions.
- convertFontInfoValueForAttributeFromVersion1ToVersion2 - :func:`.convertFontInfoValueForAttributeFromVersion1ToVersion2`
- convertFontInfoValueForAttributeFromVersion2ToVersion1 - :func:`.convertFontInfoValueForAttributeFromVersion2ToVersion1`
- convertFontInfoValueForAttributeFromVersion2ToVersion3 - :func:`.convertFontInfoValueForAttributeFromVersion2ToVersion3`
- convertFontInfoValueForAttributeFromVersion3ToVersion2 - :func:`.convertFontInfoValueForAttributeFromVersion3ToVersion2`
""" """
import os import os
@ -201,8 +201,12 @@ class _UFOBaseIO:
class UFOReader(_UFOBaseIO): class UFOReader(_UFOBaseIO):
""" """Read the various components of a .ufo.
Read the various components of the .ufo.
Attributes:
path: An `os.PathLike` object pointing to the .ufo.
validate: A boolean indicating if the data read should be
validated. Defaults to `True`.
By default read data is validated. Set ``validate`` to By default read data is validated. Set ``validate`` to
``False`` to not validate the data. ``False`` to not validate the data.
@ -884,20 +888,27 @@ class UFOReader(_UFOBaseIO):
class UFOWriter(UFOReader): class UFOWriter(UFOReader):
""" """Write the various components of a .ufo.
Write the various components of the .ufo.
Attributes:
path: An `os.PathLike` object pointing to the .ufo.
formatVersion: the UFO format version as a tuple of integers (major, minor),
or as a single integer for the major digit only (minor is implied to be 0).
By default, the latest formatVersion will be used; currently it is 3.0,
which is equivalent to formatVersion=(3, 0).
fileCreator: The creator of the .ufo file. Defaults to
`com.github.fonttools.ufoLib`.
structure: The internal structure of the .ufo file: either `ZIP` or `PACKAGE`.
validate: A boolean indicating if the data read should be validated. Defaults
to `True`.
By default, the written data will be validated before writing. Set ``validate`` to By default, the written data will be validated before writing. Set ``validate`` to
``False`` if you do not want to validate the data. Validation can also be overriden ``False`` if you do not want to validate the data. Validation can also be overriden
on a per method level if desired. on a per-method level if desired.
The ``formatVersion`` argument allows to specify the UFO format version as a tuple Raises:
of integers (major, minor), or as a single integer for the major digit only (minor UnsupportedUFOFormat: An exception indicating that the requested UFO
is implied as 0). By default the latest formatVersion will be used; currently it's formatVersion is not supported.
3.0, which is equivalent to formatVersion=(3, 0).
An UnsupportedUFOFormat exception is raised if the requested UFO formatVersion is
not supported.
""" """
def __init__( def __init__(

View File

@ -1,5 +1,5 @@
"""DEPRECATED - This module is kept here only as a backward compatibility shim """DEPRECATED - This module is kept here only as a backward compatibility shim
for the old ufoLib.plistlib module, which was moved to fontTools.misc.plistlib. for the old `ufoLib.plistlib` module, which was moved to :class:`fontTools.misc.plistlib`.
Please use the latter instead. Please use the latter instead.
""" """

View File

@ -1,5 +1,5 @@
"""DEPRECATED - This module is kept here only as a backward compatibility shim """DEPRECATED - This module is kept here only as a backward compatibility shim
for the old ufoLib.pointPen module, which was moved to fontTools.pens.pointPen. for the old `ufoLib.pointPen` module, which was moved to :class:`fontTools.pens.pointPen`.
Please use the latter instead. Please use the latter instead.
""" """

View File

@ -55,10 +55,10 @@ def test_contour_order(glyph0, glyph1):
m1GreenReversed = [(-m[0],) + m[1:] for m in m1Green] m1GreenReversed = [(-m[0],) + m[1:] for m in m1Green]
( (
matching_control_reversed, matching_control_reversed,
matching_cost_control_reversed, matching_cost_green_reversed,
identity_cost_control_reversed, identity_cost_green_reversed,
) = matching_for_vectors(m0Control, m1ControlReversed) ) = matching_for_vectors(m0Green, m1GreenReversed)
done = matching_cost_control_reversed == identity_cost_control_reversed done = matching_cost_green_reversed == identity_cost_green_reversed
if not done: if not done:
# Otherwise, use the worst of the two matchings. # Otherwise, use the worst of the two matchings.

View File

@ -50,7 +50,7 @@ class OnlineMultiVarStoreBuilder(object):
self._cache = None self._cache = None
self._data = None self._data = None
def finish(self, optimize=True): def finish(self):
self._regionList.RegionCount = len(self._regionList.Region) self._regionList.RegionCount = len(self._regionList.Region)
self._store.MultiVarDataCount = len(self._store.MultiVarData) self._store.MultiVarDataCount = len(self._store.MultiVarData)
return self._store return self._store

View File

@ -1,3 +1,9 @@
4.54.1 (released 2024-09-24)
----------------------------
- [unicodedata] Update to Unicode 16
- [subset] Escape ``\\`` in doc string
4.54.0 (released 2024-09-23) 4.54.0 (released 2024-09-23)
---------------------------- ----------------------------

View File

@ -1,5 +1,5 @@
[bumpversion] [bumpversion]
current_version = 4.54.1.dev0 current_version = 4.54.2.dev0
commit = True commit = True
tag = False tag = False
tag_name = {new_version} tag_name = {new_version}

View File

@ -481,7 +481,7 @@ if ext_modules:
setup_params = dict( setup_params = dict(
name="fonttools", name="fonttools",
version="4.54.1.dev0", version="4.54.2.dev0",
description="Tools to manipulate font files", description="Tools to manipulate font files",
author="Just van Rossum", author="Just van Rossum",
author_email="just@letterror.com", author_email="just@letterror.com",