fonttools 4.55.8__cp39-cp39-musllinux_1_2_aarch64.whl → 4.57.0__cp39-cp39-musllinux_1_2_aarch64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fonttools might be problematic. Click here for more details.
- fontTools/__init__.py +1 -1
- fontTools/config/__init__.py +15 -0
- fontTools/cu2qu/cu2qu.c +6 -6
- fontTools/cu2qu/cu2qu.cpython-39-aarch64-linux-gnu.so +0 -0
- fontTools/feaLib/ast.py +8 -3
- fontTools/feaLib/builder.py +32 -9
- fontTools/feaLib/error.py +1 -1
- fontTools/feaLib/lexer.c +5 -5
- fontTools/feaLib/lexer.cpython-39-aarch64-linux-gnu.so +0 -0
- fontTools/feaLib/parser.py +58 -0
- fontTools/misc/bezierTools.c +6 -6
- fontTools/misc/bezierTools.cpython-39-aarch64-linux-gnu.so +0 -0
- fontTools/misc/testTools.py +5 -1
- fontTools/otlLib/optimize/gpos.py +7 -1
- fontTools/pens/momentsPen.c +5 -5
- fontTools/pens/momentsPen.cpython-39-aarch64-linux-gnu.so +0 -0
- fontTools/qu2cu/qu2cu.c +6 -6
- fontTools/qu2cu/qu2cu.cpython-39-aarch64-linux-gnu.so +0 -0
- fontTools/ttLib/__init__.py +4 -0
- fontTools/ttLib/__main__.py +47 -8
- fontTools/ttLib/tables/D__e_b_g.py +20 -2
- fontTools/ttLib/tables/_c_m_a_p.py +19 -6
- fontTools/ttLib/tables/_g_l_y_f.py +9 -4
- fontTools/ttLib/tables/_g_v_a_r.py +4 -2
- fontTools/ttLib/tables/otConverters.py +5 -2
- fontTools/ttLib/tables/otData.py +1 -1
- fontTools/ttLib/tables/otTables.py +26 -18
- fontTools/ttLib/tables/otTraverse.py +2 -1
- fontTools/ttLib/ttFont.py +9 -7
- fontTools/ttLib/ttGlyphSet.py +0 -10
- fontTools/ttx.py +13 -1
- fontTools/varLib/__init__.py +93 -101
- fontTools/varLib/hvar.py +113 -0
- fontTools/varLib/iup.c +6 -6
- fontTools/varLib/iup.cpython-39-aarch64-linux-gnu.so +0 -0
- fontTools/varLib/varStore.py +10 -38
- {fonttools-4.55.8.dist-info → fonttools-4.57.0.dist-info}/METADATA +25 -2
- {fonttools-4.55.8.dist-info → fonttools-4.57.0.dist-info}/RECORD +270 -269
- {fonttools-4.55.8.dist-info → fonttools-4.57.0.dist-info}/WHEEL +1 -1
- {fonttools-4.55.8.data → fonttools-4.57.0.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.55.8.dist-info → fonttools-4.57.0.dist-info}/entry_points.txt +0 -0
- {fonttools-4.55.8.dist-info → fonttools-4.57.0.dist-info/licenses}/LICENSE +0 -0
- {fonttools-4.55.8.dist-info → fonttools-4.57.0.dist-info}/top_level.txt +0 -0
fontTools/varLib/hvar.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from fontTools.misc.roundTools import noRound
|
|
2
|
+
from fontTools.ttLib import TTFont, newTable
|
|
3
|
+
from fontTools.ttLib.tables import otTables as ot
|
|
4
|
+
from fontTools.ttLib.tables.otBase import OTTableWriter
|
|
5
|
+
from fontTools.varLib import HVAR_FIELDS, VVAR_FIELDS, _add_VHVAR
|
|
6
|
+
from fontTools.varLib import builder, models, varStore
|
|
7
|
+
from fontTools.misc.fixedTools import fixedToFloat as fi2fl
|
|
8
|
+
from fontTools.misc.cliTools import makeOutputFileName
|
|
9
|
+
from functools import partial
|
|
10
|
+
import logging
|
|
11
|
+
|
|
12
|
+
log = logging.getLogger("fontTools.varLib.avar")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def _get_advance_metrics(font, axisTags, tableFields):
|
|
16
|
+
# There's two ways we can go from here:
|
|
17
|
+
# 1. For each glyph, at each master peak, compute the value of the
|
|
18
|
+
# advance width at that peak. Then pass these all to a VariationModel
|
|
19
|
+
# builder to compute back the deltas.
|
|
20
|
+
# 2. For each master peak, pull out the deltas of the advance width directly,
|
|
21
|
+
# and feed these to the VarStoreBuilder, forgoing the remoding step.
|
|
22
|
+
# We'll go with the second option, as it's simpler, faster, and more direct.
|
|
23
|
+
gvar = font["gvar"]
|
|
24
|
+
vhAdvanceDeltasAndSupports = {}
|
|
25
|
+
glyphOrder = font.getGlyphOrder()
|
|
26
|
+
phantomIndex = tableFields.phantomIndex
|
|
27
|
+
for glyphName in glyphOrder:
|
|
28
|
+
supports = []
|
|
29
|
+
deltas = []
|
|
30
|
+
variations = gvar.variations.get(glyphName, [])
|
|
31
|
+
|
|
32
|
+
for tv in variations:
|
|
33
|
+
supports.append(tv.axes)
|
|
34
|
+
phantoms = tv.coordinates[-4:]
|
|
35
|
+
phantoms = phantoms[phantomIndex * 2 : phantomIndex * 2 + 2]
|
|
36
|
+
assert len(phantoms) == 2
|
|
37
|
+
phantoms[0] = phantoms[0][phantomIndex] if phantoms[0] is not None else 0
|
|
38
|
+
phantoms[1] = phantoms[1][phantomIndex] if phantoms[1] is not None else 0
|
|
39
|
+
deltas.append(phantoms[1] - phantoms[0])
|
|
40
|
+
|
|
41
|
+
vhAdvanceDeltasAndSupports[glyphName] = (deltas, supports)
|
|
42
|
+
|
|
43
|
+
vOrigDeltasAndSupports = None # TODO
|
|
44
|
+
|
|
45
|
+
return vhAdvanceDeltasAndSupports, vOrigDeltasAndSupports
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def add_HVAR(font):
|
|
49
|
+
if "HVAR" in font:
|
|
50
|
+
del font["HVAR"]
|
|
51
|
+
axisTags = [axis.axisTag for axis in font["fvar"].axes]
|
|
52
|
+
getAdvanceMetrics = partial(_get_advance_metrics, font, axisTags, HVAR_FIELDS)
|
|
53
|
+
_add_VHVAR(font, axisTags, HVAR_FIELDS, getAdvanceMetrics)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def add_VVAR(font):
|
|
57
|
+
if "VVAR" in font:
|
|
58
|
+
del font["VVAR"]
|
|
59
|
+
getAdvanceMetrics = partial(_get_advance_metrics, font, axisTags, HVAR_FIELDS)
|
|
60
|
+
axisTags = [axis.axisTag for axis in font["fvar"].axes]
|
|
61
|
+
_add_VHVAR(font, axisTags, VVAR_FIELDS, getAdvanceMetrics)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def main(args=None):
|
|
65
|
+
"""Add `HVAR` table to variable font."""
|
|
66
|
+
|
|
67
|
+
if args is None:
|
|
68
|
+
import sys
|
|
69
|
+
|
|
70
|
+
args = sys.argv[1:]
|
|
71
|
+
|
|
72
|
+
from fontTools import configLogger
|
|
73
|
+
from fontTools.designspaceLib import DesignSpaceDocument
|
|
74
|
+
import argparse
|
|
75
|
+
|
|
76
|
+
parser = argparse.ArgumentParser(
|
|
77
|
+
"fonttools varLib.hvar",
|
|
78
|
+
description="Add `HVAR` table from to variable font.",
|
|
79
|
+
)
|
|
80
|
+
parser.add_argument("font", metavar="varfont.ttf", help="Variable-font file.")
|
|
81
|
+
parser.add_argument(
|
|
82
|
+
"-o",
|
|
83
|
+
"--output-file",
|
|
84
|
+
type=str,
|
|
85
|
+
help="Output font file name.",
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
options = parser.parse_args(args)
|
|
89
|
+
|
|
90
|
+
configLogger(level="WARNING")
|
|
91
|
+
|
|
92
|
+
font = TTFont(options.font)
|
|
93
|
+
if not "fvar" in font:
|
|
94
|
+
log.error("Not a variable font.")
|
|
95
|
+
return 1
|
|
96
|
+
|
|
97
|
+
add_HVAR(font)
|
|
98
|
+
if "vmtx" in font:
|
|
99
|
+
add_VVAR(font)
|
|
100
|
+
|
|
101
|
+
if options.output_file is None:
|
|
102
|
+
outfile = makeOutputFileName(options.font, overWrite=True, suffix=".hvar")
|
|
103
|
+
else:
|
|
104
|
+
outfile = options.output_file
|
|
105
|
+
if outfile:
|
|
106
|
+
log.info("Saving %s", outfile)
|
|
107
|
+
font.save(outfile)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
if __name__ == "__main__":
|
|
111
|
+
import sys
|
|
112
|
+
|
|
113
|
+
sys.exit(main())
|
fontTools/varLib/iup.c
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by Cython 3.0.
|
|
1
|
+
/* Generated by Cython 3.0.12 */
|
|
2
2
|
|
|
3
3
|
/* BEGIN: Cython Metadata
|
|
4
4
|
{
|
|
@@ -36,10 +36,10 @@ END: Cython Metadata */
|
|
|
36
36
|
#else
|
|
37
37
|
#define __PYX_EXTRA_ABI_MODULE_NAME ""
|
|
38
38
|
#endif
|
|
39
|
-
#define CYTHON_ABI "
|
|
39
|
+
#define CYTHON_ABI "3_0_12" __PYX_EXTRA_ABI_MODULE_NAME
|
|
40
40
|
#define __PYX_ABI_MODULE_NAME "_cython_" CYTHON_ABI
|
|
41
41
|
#define __PYX_TYPE_MODULE_PREFIX __PYX_ABI_MODULE_NAME "."
|
|
42
|
-
#define CYTHON_HEX_VERSION
|
|
42
|
+
#define CYTHON_HEX_VERSION 0x03000CF0
|
|
43
43
|
#define CYTHON_FUTURE_DIVISION 1
|
|
44
44
|
#include <stddef.h>
|
|
45
45
|
#ifndef offsetof
|
|
@@ -1972,7 +1972,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args,
|
|
|
1972
1972
|
#if !CYTHON_VECTORCALL
|
|
1973
1973
|
#if PY_VERSION_HEX >= 0x03080000
|
|
1974
1974
|
#include "frameobject.h"
|
|
1975
|
-
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
|
|
1975
|
+
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
|
|
1976
1976
|
#ifndef Py_BUILD_CORE
|
|
1977
1977
|
#define Py_BUILD_CORE 1
|
|
1978
1978
|
#endif
|
|
@@ -16524,7 +16524,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
|
|
|
16524
16524
|
#include "compile.h"
|
|
16525
16525
|
#include "frameobject.h"
|
|
16526
16526
|
#include "traceback.h"
|
|
16527
|
-
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API
|
|
16527
|
+
#if PY_VERSION_HEX >= 0x030b00a6 && !CYTHON_COMPILING_IN_LIMITED_API && !defined(PYPY_VERSION)
|
|
16528
16528
|
#ifndef Py_BUILD_CORE
|
|
16529
16529
|
#define Py_BUILD_CORE 1
|
|
16530
16530
|
#endif
|
|
@@ -17714,7 +17714,7 @@ static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name
|
|
|
17714
17714
|
|
|
17715
17715
|
/* CoroutineBase */
|
|
17716
17716
|
#include <frameobject.h>
|
|
17717
|
-
#if PY_VERSION_HEX >= 0x030b00a6
|
|
17717
|
+
#if PY_VERSION_HEX >= 0x030b00a6 && !defined(PYPY_VERSION)
|
|
17718
17718
|
#ifndef Py_BUILD_CORE
|
|
17719
17719
|
#define Py_BUILD_CORE 1
|
|
17720
17720
|
#endif
|
|
Binary file
|
fontTools/varLib/varStore.py
CHANGED
|
@@ -41,7 +41,7 @@ class OnlineVarStoreBuilder(object):
|
|
|
41
41
|
def setSupports(self, supports):
|
|
42
42
|
self._model = None
|
|
43
43
|
self._supports = list(supports)
|
|
44
|
-
if not self._supports[0]:
|
|
44
|
+
if self._supports and not self._supports[0]:
|
|
45
45
|
del self._supports[0] # Drop base master support
|
|
46
46
|
self._cache = None
|
|
47
47
|
self._data = None
|
|
@@ -412,25 +412,6 @@ class _Encoding(object):
|
|
|
412
412
|
def extend(self, lst):
|
|
413
413
|
self.items.update(lst)
|
|
414
414
|
|
|
415
|
-
def get_room(self):
|
|
416
|
-
"""Maximum number of bytes that can be added to characteristic
|
|
417
|
-
while still being beneficial to merge it into another one."""
|
|
418
|
-
count = len(self.items)
|
|
419
|
-
return max(0, (self.overhead - 1) // count - self.width)
|
|
420
|
-
|
|
421
|
-
room = property(get_room)
|
|
422
|
-
|
|
423
|
-
def get_gain(self):
|
|
424
|
-
"""Maximum possible byte gain from merging this into another
|
|
425
|
-
characteristic."""
|
|
426
|
-
count = len(self.items)
|
|
427
|
-
return max(0, self.overhead - count)
|
|
428
|
-
|
|
429
|
-
gain = property(get_gain)
|
|
430
|
-
|
|
431
|
-
def gain_sort_key(self):
|
|
432
|
-
return self.gain, self.chars
|
|
433
|
-
|
|
434
415
|
def width_sort_key(self):
|
|
435
416
|
return self.width, self.chars
|
|
436
417
|
|
|
@@ -534,13 +515,9 @@ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True, quantization=1):
|
|
|
534
515
|
# of the old encoding is completely eliminated. However, each row
|
|
535
516
|
# now would require more bytes to encode, to the tune of one byte
|
|
536
517
|
# per characteristic bit that is active in the new encoding but not
|
|
537
|
-
# in the old one.
|
|
538
|
-
# while still beneficial to merge it into another encoding is called
|
|
539
|
-
# the "room" for that encoding.
|
|
518
|
+
# in the old one.
|
|
540
519
|
#
|
|
541
|
-
# The "gain" of
|
|
542
|
-
# save by merging it into another encoding. The "gain" of merging
|
|
543
|
-
# two encodings is how many bytes we save by doing so.
|
|
520
|
+
# The "gain" of merging two encodings is how many bytes we save by doing so.
|
|
544
521
|
#
|
|
545
522
|
# High-level algorithm:
|
|
546
523
|
#
|
|
@@ -554,7 +531,11 @@ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True, quantization=1):
|
|
|
554
531
|
#
|
|
555
532
|
# - Put all encodings into a "todo" list.
|
|
556
533
|
#
|
|
557
|
-
# - Sort todo list
|
|
534
|
+
# - Sort todo list (for stability) by width_sort_key(), which is a tuple
|
|
535
|
+
# of the following items:
|
|
536
|
+
# * The "width" of the encoding.
|
|
537
|
+
# * The characteristic bitmap of the encoding, with higher-numbered
|
|
538
|
+
# columns compared first.
|
|
558
539
|
#
|
|
559
540
|
# - Make a priority-queue of the gain from combining each two
|
|
560
541
|
# encodings in the todo list. The priority queue is sorted by
|
|
@@ -575,16 +556,7 @@ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True, quantization=1):
|
|
|
575
556
|
#
|
|
576
557
|
# The output is then sorted for stability, in the following way:
|
|
577
558
|
# - The VarRegionList of the input is kept intact.
|
|
578
|
-
# -
|
|
579
|
-
# gain_key_sort(), which is a tuple of the following items:
|
|
580
|
-
# * The gain of the encoding.
|
|
581
|
-
# * The characteristic bitmap of the encoding, with higher-numbered
|
|
582
|
-
# columns compared first.
|
|
583
|
-
# - The VarData is sorted by width_sort_key(), which is a tuple
|
|
584
|
-
# of the following items:
|
|
585
|
-
# * The "width" of the encoding.
|
|
586
|
-
# * The characteristic bitmap of the encoding, with higher-numbered
|
|
587
|
-
# columns compared first.
|
|
559
|
+
# - The VarData is sorted by the same width_sort_key() used at the beginning.
|
|
588
560
|
# - Within each VarData, the items are sorted as vectors of numbers.
|
|
589
561
|
#
|
|
590
562
|
# Finally, each VarData is optimized to remove the empty columns and
|
|
@@ -626,7 +598,7 @@ def VarStore_optimize(self, use_NO_VARIATION_INDEX=True, quantization=1):
|
|
|
626
598
|
front_mapping[(major << 16) + minor] = row
|
|
627
599
|
|
|
628
600
|
# Prepare for the main algorithm.
|
|
629
|
-
todo = sorted(encodings.values(), key=_Encoding.
|
|
601
|
+
todo = sorted(encodings.values(), key=_Encoding.width_sort_key)
|
|
630
602
|
del encodings
|
|
631
603
|
|
|
632
604
|
# Repeatedly pick two best encodings to combine, and combine them.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: fonttools
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.57.0
|
|
4
4
|
Summary: Tools to manipulate font files
|
|
5
5
|
Home-page: http://github.com/fonttools/fonttools
|
|
6
6
|
Author: Just van Rossum
|
|
@@ -80,6 +80,7 @@ Dynamic: description
|
|
|
80
80
|
Dynamic: description-content-type
|
|
81
81
|
Dynamic: home-page
|
|
82
82
|
Dynamic: license
|
|
83
|
+
Dynamic: license-file
|
|
83
84
|
Dynamic: maintainer
|
|
84
85
|
Dynamic: maintainer-email
|
|
85
86
|
Dynamic: platform
|
|
@@ -391,6 +392,28 @@ Have fun!
|
|
|
391
392
|
Changelog
|
|
392
393
|
~~~~~~~~~
|
|
393
394
|
|
|
395
|
+
4.57.0 (released 2025-04-03)
|
|
396
|
+
----------------------------
|
|
397
|
+
|
|
398
|
+
- [ttLib.__main__] Add `--no-recalc-timestamp` flag (#3771)
|
|
399
|
+
- [ttLib.__main__] Add `-b` (recalcBBoxes=False) flag (#3772)
|
|
400
|
+
- [cmap] Speed up glyphOrder loading from cmap (#3774)
|
|
401
|
+
- [ttLib.__main__] Improvements around the `-t` flag (#3776)
|
|
402
|
+
- [Debg] Fix parsing from XML; add roundtrip tests (#3781)
|
|
403
|
+
- [fealib] Support \*Base.MinMax tables (#3783, #3786)
|
|
404
|
+
- [config] Add OPTIMIZE_FONT_SPEED (#3784)
|
|
405
|
+
- [varLib.hvar] New module to add HVAR table to the font (#3780)
|
|
406
|
+
- [otlLib.optimize] Fix crash when the provided TTF does not contain a `GPOS` (#3794)
|
|
407
|
+
|
|
408
|
+
4.56.0 (released 2025-02-07)
|
|
409
|
+
----------------------------
|
|
410
|
+
|
|
411
|
+
- [varStore] Sort the input todo list with the same sorting key used for the opimizer's output (#3767).
|
|
412
|
+
- [otData] Fix DeviceTable's ``DeltaValue`` repeat value which caused a crash after importing from XML and then compiling a GPOS containing Device tables (#3758).
|
|
413
|
+
- [feaLib] Make ``FeatureLibError`` pickleable, so client can e.g. use feaLib to can compile features in parallel with multiprocessing (#3762).
|
|
414
|
+
- [varLib/gvar] Removed workaround for old, long-fixed macOS bug about composite glyphs with all zero deltas (#1381, #1788).
|
|
415
|
+
- [Docs] Updated ttLib documentation, beefed up TTFont and TTGlyphSet explanations (#3720).
|
|
416
|
+
|
|
394
417
|
4.55.8 (released 2025-01-29)
|
|
395
418
|
----------------------------
|
|
396
419
|
|