fonttools 4.58.0__cp311-cp311-win_amd64.whl → 4.58.2__cp311-cp311-win_amd64.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/cffLib/specializer.py +4 -1
- fontTools/cu2qu/cu2qu.c +36 -24
- fontTools/cu2qu/cu2qu.cp311-win_amd64.pyd +0 -0
- fontTools/feaLib/ast.py +1 -72
- fontTools/feaLib/builder.py +55 -45
- fontTools/feaLib/lexer.c +60 -43
- fontTools/feaLib/lexer.cp311-win_amd64.pyd +0 -0
- fontTools/merge/cmap.py +33 -1
- fontTools/merge/tables.py +12 -1
- fontTools/misc/bezierTools.c +137 -125
- fontTools/misc/bezierTools.cp311-win_amd64.pyd +0 -0
- fontTools/misc/loggingTools.py +1 -1
- fontTools/misc/symfont.py +6 -8
- fontTools/mtiLib/__init__.py +1 -1
- fontTools/otlLib/builder.py +164 -0
- fontTools/pens/momentsPen.c +42 -25
- fontTools/pens/momentsPen.cp311-win_amd64.pyd +0 -0
- fontTools/pens/t2CharStringPen.py +31 -11
- fontTools/qu2cu/qu2cu.c +47 -35
- fontTools/qu2cu/qu2cu.cp311-win_amd64.pyd +0 -0
- fontTools/subset/__init__.py +82 -2
- fontTools/ttLib/reorderGlyphs.py +8 -7
- fontTools/ufoLib/__init__.py +1 -1
- fontTools/varLib/__init__.py +18 -6
- fontTools/varLib/featureVars.py +13 -7
- fontTools/varLib/hvar.py +1 -1
- fontTools/varLib/instancer/__init__.py +14 -5
- fontTools/varLib/iup.c +52 -40
- fontTools/varLib/iup.cp311-win_amd64.pyd +0 -0
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/METADATA +26 -1
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/RECORD +38 -38
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/WHEEL +1 -1
- {fonttools-4.58.0.data → fonttools-4.58.2.data}/data/share/man/man1/ttx.1 +0 -0
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/entry_points.txt +0 -0
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/licenses/LICENSE +0 -0
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/licenses/LICENSE.external +0 -0
- {fonttools-4.58.0.dist-info → fonttools-4.58.2.dist-info}/top_level.txt +0 -0
fontTools/qu2cu/qu2cu.c
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* Generated by Cython 3.1.
|
|
1
|
+
/* Generated by Cython 3.1.1 */
|
|
2
2
|
|
|
3
3
|
/* BEGIN: Cython Metadata
|
|
4
4
|
{
|
|
@@ -32,8 +32,8 @@ END: Cython Metadata */
|
|
|
32
32
|
#elif PY_VERSION_HEX < 0x03080000
|
|
33
33
|
#error Cython requires Python 3.8+.
|
|
34
34
|
#else
|
|
35
|
-
#define __PYX_ABI_VERSION "
|
|
36
|
-
#define CYTHON_HEX_VERSION
|
|
35
|
+
#define __PYX_ABI_VERSION "3_1_1"
|
|
36
|
+
#define CYTHON_HEX_VERSION 0x030101F0
|
|
37
37
|
#define CYTHON_FUTURE_DIVISION 1
|
|
38
38
|
/* CModulePreamble */
|
|
39
39
|
#include <stddef.h>
|
|
@@ -4323,7 +4323,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
|
4323
4323
|
* ) -> List[Tuple[Point, ...]]:
|
|
4324
4324
|
* """Converts a connecting list of quadratic splines to a list of quadratic
|
|
4325
4325
|
*/
|
|
4326
|
-
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject
|
|
4326
|
+
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
|
|
4327
4327
|
for (Py_ssize_t i = __pyx_nargs; i < 1; i++) {
|
|
4328
4328
|
if (unlikely(!values[i])) { __Pyx_RaiseArgtupleInvalid("quadratic_to_curves", 0, 1, 3, i); __PYX_ERR(0, 178, __pyx_L3_error) }
|
|
4329
4329
|
}
|
|
@@ -4343,7 +4343,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds
|
|
|
4343
4343
|
break;
|
|
4344
4344
|
default: goto __pyx_L5_argtuple_error;
|
|
4345
4345
|
}
|
|
4346
|
-
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject
|
|
4346
|
+
if (!values[2]) values[2] = __Pyx_NewRef(((PyObject *)((PyObject*)Py_False)));
|
|
4347
4347
|
}
|
|
4348
4348
|
__pyx_v_quads = ((PyObject*)values[0]);
|
|
4349
4349
|
if (values[1]) {
|
|
@@ -8595,7 +8595,7 @@ __Pyx_RefNannySetupContext("PyInit_qu2cu", 0);
|
|
|
8595
8595
|
* cost=cython.int,
|
|
8596
8596
|
* is_complex=cython.int,
|
|
8597
8597
|
*/
|
|
8598
|
-
__pyx_t_6 = PyTuple_Pack(2, __pyx_t_7, ((PyObject
|
|
8598
|
+
__pyx_t_6 = PyTuple_Pack(2, __pyx_t_7, ((PyObject*)Py_False)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
8599
8599
|
__Pyx_GOTREF(__pyx_t_6);
|
|
8600
8600
|
__Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
|
|
8601
8601
|
__pyx_t_7 = __Pyx_PyDict_NewPresized(4); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 178, __pyx_L1_error)
|
|
@@ -9007,8 +9007,8 @@ static int __Pyx_InitConstants(__pyx_mstatetype *__pyx_mstate) {
|
|
|
9007
9007
|
} __Pyx_PyCode_New_function_description;
|
|
9008
9008
|
/* NewCodeObj.proto */
|
|
9009
9009
|
static PyObject* __Pyx_PyCode_New(
|
|
9010
|
-
__Pyx_PyCode_New_function_description descr,
|
|
9011
|
-
PyObject
|
|
9010
|
+
const __Pyx_PyCode_New_function_description descr,
|
|
9011
|
+
PyObject * const *varnames,
|
|
9012
9012
|
PyObject *filename,
|
|
9013
9013
|
PyObject *funcname,
|
|
9014
9014
|
const char *line_table,
|
|
@@ -9020,38 +9020,38 @@ static int __Pyx_CreateCodeObjects(__pyx_mstatetype *__pyx_mstate) {
|
|
|
9020
9020
|
PyObject* tuple_dedup_map = PyDict_New();
|
|
9021
9021
|
if (unlikely(!tuple_dedup_map)) return -1;
|
|
9022
9022
|
{
|
|
9023
|
-
__Pyx_PyCode_New_function_description descr = {0, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 235, 2};
|
|
9024
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_cost, __pyx_mstate->__pyx_n_u_is_complex, __pyx_mstate->__pyx_n_u_c};
|
|
9023
|
+
const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 3, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 235, 2};
|
|
9024
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_cost, __pyx_mstate->__pyx_n_u_is_complex, __pyx_mstate->__pyx_n_u_c};
|
|
9025
9025
|
__pyx_mstate_global->__pyx_codeobj_tab[0] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__3, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[0])) goto bad;
|
|
9026
9026
|
}
|
|
9027
9027
|
{
|
|
9028
|
-
__Pyx_PyCode_New_function_description descr = {0, 0, 0, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 340, 2};
|
|
9029
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_i_sol_count, __pyx_mstate->__pyx_n_u_j_sol_count, __pyx_mstate->__pyx_n_u_this_sol_count, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_error, __pyx_mstate->__pyx_n_u_i_sol_error, __pyx_mstate->__pyx_n_u_j_sol_error, __pyx_mstate->__pyx_n_u_all_cubic, __pyx_mstate->__pyx_n_u_is_cubic, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p3, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_u};
|
|
9028
|
+
const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 21, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS|CO_GENERATOR), 340, 2};
|
|
9029
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_i_sol_count, __pyx_mstate->__pyx_n_u_j_sol_count, __pyx_mstate->__pyx_n_u_this_sol_count, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_error, __pyx_mstate->__pyx_n_u_i_sol_error, __pyx_mstate->__pyx_n_u_j_sol_error, __pyx_mstate->__pyx_n_u_all_cubic, __pyx_mstate->__pyx_n_u_is_cubic, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p3, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_u};
|
|
9030
9030
|
__pyx_mstate_global->__pyx_codeobj_tab[1] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_genexpr, __pyx_k__4, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[1])) goto bad;
|
|
9031
9031
|
}
|
|
9032
9032
|
{
|
|
9033
|
-
__Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 82, 56};
|
|
9034
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p1_2_3};
|
|
9033
|
+
const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 4, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 82, 56};
|
|
9034
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p1_2_3};
|
|
9035
9035
|
__pyx_mstate_global->__pyx_codeobj_tab[2] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_elevate_quadratic, __pyx_k_S_2Rq_Cr_3b_Cr_3b, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[2])) goto bad;
|
|
9036
9036
|
}
|
|
9037
9037
|
{
|
|
9038
|
-
__Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 154, 112};
|
|
9039
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_num_offcurves, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_off1, __pyx_mstate->__pyx_n_u_off2, __pyx_mstate->__pyx_n_u_on, __pyx_mstate->__pyx_n_u_q};
|
|
9038
|
+
const __Pyx_PyCode_New_function_description descr = {1, 0, 0, 8, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 154, 112};
|
|
9039
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_num_offcurves, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_off1, __pyx_mstate->__pyx_n_u_off2, __pyx_mstate->__pyx_n_u_on, __pyx_mstate->__pyx_n_u_q};
|
|
9040
9040
|
__pyx_mstate_global->__pyx_codeobj_tab[3] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_add_implicit_on_curves, __pyx_k_AQ_A_Cq_2Q_U_3a_q_q_2Q_U_U_F_A, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[3])) goto bad;
|
|
9041
9041
|
}
|
|
9042
9042
|
{
|
|
9043
|
-
__Pyx_PyCode_New_function_description descr = {3, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 178, 262};
|
|
9044
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_quads, __pyx_mstate->__pyx_n_u_max_err, __pyx_mstate->__pyx_n_u_all_cubic, __pyx_mstate->__pyx_n_u_cost, __pyx_mstate->__pyx_n_u_is_complex, __pyx_mstate->__pyx_n_u_q, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_qq, __pyx_mstate->__pyx_n_u_curves, __pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y, __pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
|
|
9043
|
+
const __Pyx_PyCode_New_function_description descr = {3, 0, 0, 17, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 178, 262};
|
|
9044
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_quads, __pyx_mstate->__pyx_n_u_max_err, __pyx_mstate->__pyx_n_u_all_cubic, __pyx_mstate->__pyx_n_u_cost, __pyx_mstate->__pyx_n_u_is_complex, __pyx_mstate->__pyx_n_u_q, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_qq, __pyx_mstate->__pyx_n_u_curves, __pyx_mstate->__pyx_n_u_p, __pyx_mstate->__pyx_n_u_x, __pyx_mstate->__pyx_n_u_y, __pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
|
|
9045
9045
|
__pyx_mstate_global->__pyx_codeobj_tab[4] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_quadratic_to_curves, __pyx_k_Q_q_6_Qe1Bat3a_t1_S_S_c_U_ar_AQ, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[4])) goto bad;
|
|
9046
9046
|
}
|
|
9047
9047
|
{
|
|
9048
|
-
__Pyx_PyCode_New_function_description descr = {4, 0, 0, 42, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 242, 914};
|
|
9049
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_q, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_all_cubic, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_i_sol_count, __pyx_mstate->__pyx_n_u_j_sol_count, __pyx_mstate->__pyx_n_u_this_sol_count, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_error, __pyx_mstate->__pyx_n_u_i_sol_error, __pyx_mstate->__pyx_n_u_j_sol_error, __pyx_mstate->__pyx_n_u_is_cubic, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p3, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_elevated_quadratics, __pyx_mstate->__pyx_n_u_forced, __pyx_mstate->__pyx_n_u_sols, __pyx_mstate->__pyx_n_u_impossible, __pyx_mstate->__pyx_n_u_best_sol, __pyx_mstate->__pyx_n_u_this_count, __pyx_mstate->__pyx_n_u_i_sol, __pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_reconstructed_iter, __pyx_mstate->__pyx_n_u_reconstructed, __pyx_mstate->__pyx_n_u_reconst, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_splits, __pyx_mstate->__pyx_n_u_cubic, __pyx_mstate->__pyx_n_u_curves, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
|
|
9048
|
+
const __Pyx_PyCode_New_function_description descr = {4, 0, 0, 42, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 242, 914};
|
|
9049
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_q, __pyx_mstate->__pyx_n_u_costs, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_all_cubic, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_j, __pyx_mstate->__pyx_n_u_k, __pyx_mstate->__pyx_n_u_start, __pyx_mstate->__pyx_n_u_i_sol_count, __pyx_mstate->__pyx_n_u_j_sol_count, __pyx_mstate->__pyx_n_u_this_sol_count, __pyx_mstate->__pyx_n_u_err, __pyx_mstate->__pyx_n_u_error, __pyx_mstate->__pyx_n_u_i_sol_error, __pyx_mstate->__pyx_n_u_j_sol_error, __pyx_mstate->__pyx_n_u_is_cubic, __pyx_mstate->__pyx_n_u_count, __pyx_mstate->__pyx_n_u_p0, __pyx_mstate->__pyx_n_u_p1, __pyx_mstate->__pyx_n_u_p2, __pyx_mstate->__pyx_n_u_p3, __pyx_mstate->__pyx_n_u_v, __pyx_mstate->__pyx_n_u_u, __pyx_mstate->__pyx_n_u_elevated_quadratics, __pyx_mstate->__pyx_n_u_forced, __pyx_mstate->__pyx_n_u_sols, __pyx_mstate->__pyx_n_u_impossible, __pyx_mstate->__pyx_n_u_best_sol, __pyx_mstate->__pyx_n_u_this_count, __pyx_mstate->__pyx_n_u_i_sol, __pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_ts, __pyx_mstate->__pyx_n_u_reconstructed_iter, __pyx_mstate->__pyx_n_u_reconstructed, __pyx_mstate->__pyx_n_u_reconst, __pyx_mstate->__pyx_n_u_orig, __pyx_mstate->__pyx_n_u_splits, __pyx_mstate->__pyx_n_u_cubic, __pyx_mstate->__pyx_n_u_curves, __pyx_mstate->__pyx_n_u_i, __pyx_mstate->__pyx_n_u_genexpr, __pyx_mstate->__pyx_n_u_genexpr};
|
|
9050
9050
|
__pyx_mstate_global->__pyx_codeobj_tab[5] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_spline_to_curves, __pyx_k_a_3as_S_1AT_2T_U_q_3as_Cq_U_3c, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[5])) goto bad;
|
|
9051
9051
|
}
|
|
9052
9052
|
{
|
|
9053
|
-
__Pyx_PyCode_New_function_description descr = {0, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 386, 131};
|
|
9054
|
-
PyObject* varnames[] = {__pyx_mstate->__pyx_n_u_generate_curve, __pyx_mstate->__pyx_n_u_curve_to_quadratic, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_reconstruct_tolerance, __pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_quadratics, __pyx_mstate->__pyx_n_u_curves};
|
|
9053
|
+
const __Pyx_PyCode_New_function_description descr = {0, 0, 0, 7, (unsigned int)(CO_OPTIMIZED|CO_NEWLOCALS), 386, 131};
|
|
9054
|
+
PyObject* const varnames[] = {__pyx_mstate->__pyx_n_u_generate_curve, __pyx_mstate->__pyx_n_u_curve_to_quadratic, __pyx_mstate->__pyx_n_u_tolerance, __pyx_mstate->__pyx_n_u_reconstruct_tolerance, __pyx_mstate->__pyx_n_u_curve, __pyx_mstate->__pyx_n_u_quadratics, __pyx_mstate->__pyx_n_u_curves};
|
|
9055
9055
|
__pyx_mstate_global->__pyx_codeobj_tab[6] = __Pyx_PyCode_New(descr, varnames, __pyx_mstate->__pyx_kp_u_Lib_fontTools_qu2cu_qu2cu_py, __pyx_mstate->__pyx_n_u_main_2, __pyx_k_Jb_N_1G1_2_8_Qa_q_Cq_Q_Q, tuple_dedup_map); if (unlikely(!__pyx_mstate_global->__pyx_codeobj_tab[6])) goto bad;
|
|
9056
9056
|
}
|
|
9057
9057
|
Py_DECREF(tuple_dedup_map);
|
|
@@ -9776,6 +9776,11 @@ static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *args, PyObject *
|
|
|
9776
9776
|
Py_DECREF(selfless_args);
|
|
9777
9777
|
return result;
|
|
9778
9778
|
}
|
|
9779
|
+
#elif CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x03090000
|
|
9780
|
+
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) {
|
|
9781
|
+
return _PyObject_Vectorcall
|
|
9782
|
+
(method, args ? args+1 : NULL, nargs ? nargs-1 : 0, kwnames);
|
|
9783
|
+
}
|
|
9779
9784
|
#else
|
|
9780
9785
|
static PyObject *__Pyx_SelflessCall(PyObject *method, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames) {
|
|
9781
9786
|
return
|
|
@@ -10099,7 +10104,9 @@ static int __Pyx_ParseKeywordDict(
|
|
|
10099
10104
|
PyObject** const *name;
|
|
10100
10105
|
PyObject** const *first_kw_arg = argnames + num_pos_args;
|
|
10101
10106
|
Py_ssize_t extracted = 0;
|
|
10107
|
+
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
|
|
10102
10108
|
if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
|
|
10109
|
+
#endif
|
|
10103
10110
|
name = first_kw_arg;
|
|
10104
10111
|
while (*name && num_kwargs > extracted) {
|
|
10105
10112
|
PyObject * key = **name;
|
|
@@ -10147,7 +10154,9 @@ static int __Pyx_ParseKeywordDictToDict(
|
|
|
10147
10154
|
PyObject** const *name;
|
|
10148
10155
|
PyObject** const *first_kw_arg = argnames + num_pos_args;
|
|
10149
10156
|
Py_ssize_t len;
|
|
10157
|
+
#if !CYTHON_COMPILING_IN_PYPY || defined(PyArg_ValidateKeywordArguments)
|
|
10150
10158
|
if (unlikely(!PyArg_ValidateKeywordArguments(kwds))) return -1;
|
|
10159
|
+
#endif
|
|
10151
10160
|
if (PyDict_Update(kwds2, kwds) < 0) goto bad;
|
|
10152
10161
|
name = first_kw_arg;
|
|
10153
10162
|
while (*name) {
|
|
@@ -11519,7 +11528,8 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
|
|
|
11519
11528
|
if (unlikely(!empty_dict))
|
|
11520
11529
|
goto bad;
|
|
11521
11530
|
if (level == -1) {
|
|
11522
|
-
|
|
11531
|
+
const char* package_sep = strchr(__Pyx_MODULE_NAME, '.');
|
|
11532
|
+
if (package_sep != (0)) {
|
|
11523
11533
|
module = PyImport_ImportModuleLevelObject(
|
|
11524
11534
|
name, __pyx_mstate_global->__pyx_d, empty_dict, from_list, 1);
|
|
11525
11535
|
if (unlikely(!module)) {
|
|
@@ -14070,7 +14080,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_int(int value) {
|
|
|
14070
14080
|
return PyLong_FromLong((long) value);
|
|
14071
14081
|
} else if (sizeof(int) <= sizeof(unsigned long)) {
|
|
14072
14082
|
return PyLong_FromUnsignedLong((unsigned long) value);
|
|
14073
|
-
#
|
|
14083
|
+
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
|
|
14074
14084
|
} else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
14075
14085
|
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
|
|
14076
14086
|
#endif
|
|
@@ -14141,7 +14151,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyLong_From_long(long value) {
|
|
|
14141
14151
|
return PyLong_FromLong((long) value);
|
|
14142
14152
|
} else if (sizeof(long) <= sizeof(unsigned long)) {
|
|
14143
14153
|
return PyLong_FromUnsignedLong((unsigned long) value);
|
|
14144
|
-
#
|
|
14154
|
+
#if defined(HAVE_LONG_LONG) && !CYTHON_COMPILING_IN_PYPY
|
|
14145
14155
|
} else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
|
|
14146
14156
|
return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
|
|
14147
14157
|
#endif
|
|
@@ -14704,8 +14714,8 @@ static void __Pyx__ReturnWithStopIteration(PyObject* value, int async) {
|
|
|
14704
14714
|
PyObject *exc;
|
|
14705
14715
|
PyObject *exc_type = async ? PyExc_StopAsyncIteration : PyExc_StopIteration;
|
|
14706
14716
|
#if CYTHON_COMPILING_IN_CPYTHON
|
|
14707
|
-
if ((PY_VERSION_HEX >= 0x030C00A6) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
|
|
14708
|
-
if (
|
|
14717
|
+
if ((PY_VERSION_HEX >= (0x030C00A6)) || unlikely(PyTuple_Check(value) || PyExceptionInstance_Check(value))) {
|
|
14718
|
+
if (PY_VERSION_HEX >= (0x030e00A1)) {
|
|
14709
14719
|
exc = __Pyx_PyObject_CallOneArg(exc_type, value);
|
|
14710
14720
|
} else {
|
|
14711
14721
|
PyObject *args_tuple = PyTuple_New(1);
|
|
@@ -15070,17 +15080,19 @@ __Pyx_Coroutine_FinishDelegation(__pyx_CoroutineObject *gen, PyObject** retval)
|
|
|
15070
15080
|
static __Pyx_PySendResult
|
|
15071
15081
|
__Pyx_Coroutine_SendToDelegate(__pyx_CoroutineObject *gen, __Pyx_pyiter_sendfunc gen_am_send, PyObject *value, PyObject **retval) {
|
|
15072
15082
|
PyObject *ret = NULL;
|
|
15073
|
-
__Pyx_PySendResult result;
|
|
15083
|
+
__Pyx_PySendResult delegate_result, result;
|
|
15074
15084
|
assert(__Pyx_Coroutine_get_is_running(gen));
|
|
15075
|
-
|
|
15076
|
-
if (
|
|
15085
|
+
delegate_result = gen_am_send(gen->yieldfrom, value, &ret);
|
|
15086
|
+
if (delegate_result == PYGEN_NEXT) {
|
|
15077
15087
|
assert (ret != NULL);
|
|
15078
15088
|
*retval = ret;
|
|
15079
15089
|
return PYGEN_NEXT;
|
|
15080
15090
|
}
|
|
15081
|
-
assert (
|
|
15091
|
+
assert (delegate_result != PYGEN_ERROR || ret == NULL);
|
|
15082
15092
|
__Pyx_Coroutine_Undelegate(gen);
|
|
15083
|
-
|
|
15093
|
+
result = __Pyx_Coroutine_SendEx(gen, ret, retval, 0);
|
|
15094
|
+
Py_XDECREF(ret);
|
|
15095
|
+
return result;
|
|
15084
15096
|
}
|
|
15085
15097
|
#endif
|
|
15086
15098
|
static PyObject *__Pyx_Coroutine_Send(PyObject *self, PyObject *value) {
|
|
@@ -15893,9 +15905,9 @@ static int __Pyx_check_binary_version(unsigned long ct_version, unsigned long rt
|
|
|
15893
15905
|
PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
|
|
15894
15906
|
#endif
|
|
15895
15907
|
static PyObject* __Pyx_PyCode_New(
|
|
15896
|
-
__Pyx_PyCode_New_function_description descr,
|
|
15897
|
-
PyObject
|
|
15898
|
-
PyObject*
|
|
15908
|
+
const __Pyx_PyCode_New_function_description descr,
|
|
15909
|
+
PyObject * const *varnames,
|
|
15910
|
+
PyObject *filename,
|
|
15899
15911
|
PyObject *funcname,
|
|
15900
15912
|
const char *line_table,
|
|
15901
15913
|
PyObject *tuple_dedup_map
|
|
Binary file
|
fontTools/subset/__init__.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
#
|
|
3
3
|
# Google Author(s): Behdad Esfahbod
|
|
4
4
|
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
5
7
|
from fontTools import config
|
|
6
8
|
from fontTools.misc.roundTools import otRound
|
|
7
9
|
from fontTools import ttLib
|
|
@@ -15,7 +17,7 @@ from fontTools.subset.util import _add_method, _uniq_sort
|
|
|
15
17
|
from fontTools.subset.cff import *
|
|
16
18
|
from fontTools.subset.svg import *
|
|
17
19
|
from fontTools.varLib import varStore, multiVarStore # For monkey-patching
|
|
18
|
-
from fontTools.ttLib.tables._n_a_m_e import NameRecordVisitor
|
|
20
|
+
from fontTools.ttLib.tables._n_a_m_e import NameRecordVisitor, makeName
|
|
19
21
|
from fontTools.unicodedata import mirrored
|
|
20
22
|
import sys
|
|
21
23
|
import struct
|
|
@@ -3004,6 +3006,9 @@ def prune_pre_subset(self, font, options):
|
|
|
3004
3006
|
return True
|
|
3005
3007
|
|
|
3006
3008
|
|
|
3009
|
+
NAME_IDS_TO_OBFUSCATE = {1, 2, 3, 4, 6, 16, 17, 18}
|
|
3010
|
+
|
|
3011
|
+
|
|
3007
3012
|
@_add_method(ttLib.getTableClass("name"))
|
|
3008
3013
|
def prune_post_subset(self, font, options):
|
|
3009
3014
|
visitor = NameRecordVisitor()
|
|
@@ -3022,6 +3027,11 @@ def prune_post_subset(self, font, options):
|
|
|
3022
3027
|
self.names = [n for n in self.names if n.langID in options.name_languages]
|
|
3023
3028
|
if options.obfuscate_names:
|
|
3024
3029
|
namerecs = []
|
|
3030
|
+
# Preserve names to be scrambled or dropped elsewhere so that other
|
|
3031
|
+
# parts of the font don't break.
|
|
3032
|
+
needRemapping = visitor.seen.intersection(NAME_IDS_TO_OBFUSCATE)
|
|
3033
|
+
if needRemapping:
|
|
3034
|
+
_remap_select_name_ids(font, needRemapping)
|
|
3025
3035
|
for n in self.names:
|
|
3026
3036
|
if n.nameID in [1, 4]:
|
|
3027
3037
|
n.string = ".\x7f".encode("utf_16_be") if n.isUnicode() else ".\x7f"
|
|
@@ -3036,6 +3046,76 @@ def prune_post_subset(self, font, options):
|
|
|
3036
3046
|
return True # Required table
|
|
3037
3047
|
|
|
3038
3048
|
|
|
3049
|
+
def _remap_select_name_ids(font: ttLib.TTFont, needRemapping: set[int]) -> None:
|
|
3050
|
+
"""Remap a set of IDs so that the originals can be safely scrambled or
|
|
3051
|
+
dropped.
|
|
3052
|
+
|
|
3053
|
+
For each name record whose name id is in the `needRemapping` set, make a copy
|
|
3054
|
+
and allocate a new unused name id in the font-specific range (> 255).
|
|
3055
|
+
|
|
3056
|
+
Finally update references to these in the `fvar` and `STAT` tables.
|
|
3057
|
+
"""
|
|
3058
|
+
|
|
3059
|
+
if "fvar" not in font and "STAT" not in font:
|
|
3060
|
+
return
|
|
3061
|
+
|
|
3062
|
+
name = font["name"]
|
|
3063
|
+
|
|
3064
|
+
# 1. Assign new IDs for names to be preserved.
|
|
3065
|
+
existingIds = {record.nameID for record in name.names}
|
|
3066
|
+
remapping = {}
|
|
3067
|
+
nextId = name._findUnusedNameID() - 1 # Should skip gaps in name IDs.
|
|
3068
|
+
for nameId in needRemapping:
|
|
3069
|
+
nextId += 1 # We should have complete freedom until 32767.
|
|
3070
|
+
assert nextId not in existingIds, "_findUnusedNameID did not skip gaps"
|
|
3071
|
+
if nextId > 32767:
|
|
3072
|
+
raise ValueError("Ran out of name IDs while trying to remap existing ones.")
|
|
3073
|
+
remapping[nameId] = nextId
|
|
3074
|
+
|
|
3075
|
+
# 2. Copy records to use the new ID. We can't rewrite them in place, because
|
|
3076
|
+
# that could make IDs 1 to 6 "disappear" from code that follows. Some
|
|
3077
|
+
# tools that produce EOT fonts expect them to exist, even when they're
|
|
3078
|
+
# scrambled. See https://github.com/fonttools/fonttools/issues/165.
|
|
3079
|
+
copiedRecords = []
|
|
3080
|
+
for record in name.names:
|
|
3081
|
+
if record.nameID not in needRemapping:
|
|
3082
|
+
continue
|
|
3083
|
+
recordCopy = makeName(
|
|
3084
|
+
record.string,
|
|
3085
|
+
remapping[record.nameID],
|
|
3086
|
+
record.platformID,
|
|
3087
|
+
record.platEncID,
|
|
3088
|
+
record.langID,
|
|
3089
|
+
)
|
|
3090
|
+
copiedRecords.append(recordCopy)
|
|
3091
|
+
name.names.extend(copiedRecords)
|
|
3092
|
+
|
|
3093
|
+
# 3. Rewrite the corresponding IDs in other tables. For now, care only about
|
|
3094
|
+
# STAT and fvar. If more tables need to be changed, consider adapting
|
|
3095
|
+
# NameRecordVisitor to rewrite IDs wherever it finds them.
|
|
3096
|
+
fvar = font.get("fvar")
|
|
3097
|
+
if fvar is not None:
|
|
3098
|
+
for axis in fvar.axes:
|
|
3099
|
+
axis.axisNameID = remapping.get(axis.axisNameID, axis.axisNameID)
|
|
3100
|
+
for instance in fvar.instances:
|
|
3101
|
+
nameID = instance.subfamilyNameID
|
|
3102
|
+
instance.subfamilyNameID = remapping.get(nameID, nameID)
|
|
3103
|
+
nameID = instance.postscriptNameID
|
|
3104
|
+
instance.postscriptNameID = remapping.get(nameID, nameID)
|
|
3105
|
+
|
|
3106
|
+
stat = font.get("STAT")
|
|
3107
|
+
if stat is None:
|
|
3108
|
+
return
|
|
3109
|
+
elidedNameID = stat.table.ElidedFallbackNameID
|
|
3110
|
+
stat.table.ElidedFallbackNameID = remapping.get(elidedNameID, elidedNameID)
|
|
3111
|
+
if stat.table.DesignAxisRecord:
|
|
3112
|
+
for axis in stat.table.DesignAxisRecord.Axis:
|
|
3113
|
+
axis.AxisNameID = remapping.get(axis.AxisNameID, axis.AxisNameID)
|
|
3114
|
+
if stat.table.AxisValueArray:
|
|
3115
|
+
for value in stat.table.AxisValueArray.AxisValue:
|
|
3116
|
+
value.ValueNameID = remapping.get(value.ValueNameID, value.ValueNameID)
|
|
3117
|
+
|
|
3118
|
+
|
|
3039
3119
|
@_add_method(ttLib.getTableClass("head"))
|
|
3040
3120
|
def prune_post_subset(self, font, options):
|
|
3041
3121
|
# Force re-compiling head table, to update any recalculated values.
|
|
@@ -3757,7 +3837,7 @@ def main(args=None):
|
|
|
3757
3837
|
text += g[7:]
|
|
3758
3838
|
continue
|
|
3759
3839
|
if g.startswith("--text-file="):
|
|
3760
|
-
with open(g[12:], encoding="utf-8") as f:
|
|
3840
|
+
with open(g[12:], encoding="utf-8-sig") as f:
|
|
3761
3841
|
text += f.read().replace("\n", "")
|
|
3762
3842
|
continue
|
|
3763
3843
|
if g.startswith("--unicodes="):
|
fontTools/ttLib/reorderGlyphs.py
CHANGED
|
@@ -275,10 +275,11 @@ def reorderGlyphs(font: ttLib.TTFont, new_glyph_order: List[str]):
|
|
|
275
275
|
for reorder in _REORDER_RULES.get(reorder_key, []):
|
|
276
276
|
reorder.apply(font, value)
|
|
277
277
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
for tag in ["CFF ", "CFF2"]:
|
|
279
|
+
if tag in font:
|
|
280
|
+
cff_table = font[tag]
|
|
281
|
+
charstrings = cff_table.cff.topDictIndex[0].CharStrings.charStrings
|
|
282
|
+
cff_table.cff.topDictIndex[0].charset = new_glyph_order
|
|
283
|
+
cff_table.cff.topDictIndex[0].CharStrings.charStrings = {
|
|
284
|
+
k: charstrings.get(k) for k in new_glyph_order
|
|
285
|
+
}
|
fontTools/ufoLib/__init__.py
CHANGED
|
@@ -654,7 +654,7 @@ class UFOReader(_UFOBaseIO):
|
|
|
654
654
|
The returned string is empty if the file is missing.
|
|
655
655
|
"""
|
|
656
656
|
try:
|
|
657
|
-
with self.fs.open(FEATURES_FILENAME, "r", encoding="utf-8") as f:
|
|
657
|
+
with self.fs.open(FEATURES_FILENAME, "r", encoding="utf-8-sig") as f:
|
|
658
658
|
return f.read()
|
|
659
659
|
except fs.errors.ResourceNotFound:
|
|
660
660
|
return ""
|
fontTools/varLib/__init__.py
CHANGED
|
@@ -109,6 +109,8 @@ def _add_fvar(font, axes, instances: List[InstanceDescriptor]):
|
|
|
109
109
|
axis.flags = int(a.hidden)
|
|
110
110
|
fvar.axes.append(axis)
|
|
111
111
|
|
|
112
|
+
default_coordinates = {axis.axisTag: axis.defaultValue for axis in fvar.axes}
|
|
113
|
+
|
|
112
114
|
for instance in instances:
|
|
113
115
|
# Filter out discrete axis locations
|
|
114
116
|
coordinates = {
|
|
@@ -130,16 +132,26 @@ def _add_fvar(font, axes, instances: List[InstanceDescriptor]):
|
|
|
130
132
|
psname = instance.postScriptFontName
|
|
131
133
|
|
|
132
134
|
inst = NamedInstance()
|
|
133
|
-
inst.
|
|
134
|
-
|
|
135
|
+
inst.coordinates = {
|
|
136
|
+
axes[k].tag: axes[k].map_backward(v) for k, v in coordinates.items()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
subfamilyNameID = nameTable.findMultilingualName(
|
|
140
|
+
localisedStyleName, windows=True, mac=macNames
|
|
135
141
|
)
|
|
142
|
+
if subfamilyNameID in {2, 17} and inst.coordinates == default_coordinates:
|
|
143
|
+
# Instances can only reuse an existing name ID 2 or 17 if they are at the
|
|
144
|
+
# default location across all axes, see:
|
|
145
|
+
# https://github.com/fonttools/fonttools/issues/3825.
|
|
146
|
+
inst.subfamilyNameID = subfamilyNameID
|
|
147
|
+
else:
|
|
148
|
+
inst.subfamilyNameID = nameTable.addMultilingualName(
|
|
149
|
+
localisedStyleName, windows=True, mac=macNames, minNameID=256
|
|
150
|
+
)
|
|
151
|
+
|
|
136
152
|
if psname is not None:
|
|
137
153
|
psname = tostr(psname)
|
|
138
154
|
inst.postscriptNameID = nameTable.addName(psname, platforms=platforms)
|
|
139
|
-
inst.coordinates = {
|
|
140
|
-
axes[k].tag: axes[k].map_backward(v) for k, v in coordinates.items()
|
|
141
|
-
}
|
|
142
|
-
# inst.coordinates = {axes[k].tag:v for k,v in coordinates.items()}
|
|
143
155
|
fvar.instances.append(inst)
|
|
144
156
|
|
|
145
157
|
assert "fvar" not in font
|
fontTools/varLib/featureVars.py
CHANGED
|
@@ -392,10 +392,13 @@ def addFeatureVariationsRaw(font, table, conditionalSubstitutions, featureTag="r
|
|
|
392
392
|
|
|
393
393
|
for scriptRecord in table.ScriptList.ScriptRecord:
|
|
394
394
|
if scriptRecord.Script.DefaultLangSys is None:
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
# We need to have a default LangSys to attach variations to.
|
|
396
|
+
langSys = ot.LangSys()
|
|
397
|
+
langSys.LookupOrder = None
|
|
398
|
+
langSys.ReqFeatureIndex = 0xFFFF
|
|
399
|
+
langSys.FeatureIndex = []
|
|
400
|
+
langSys.FeatureCount = 0
|
|
401
|
+
scriptRecord.Script.DefaultLangSys = langSys
|
|
399
402
|
langSystems = [lsr.LangSys for lsr in scriptRecord.Script.LangSysRecord]
|
|
400
403
|
for langSys in [scriptRecord.Script.DefaultLangSys] + langSystems:
|
|
401
404
|
langSys.FeatureIndex.append(varFeatureIndex)
|
|
@@ -597,9 +600,12 @@ def buildFeatureRecord(featureTag, lookupListIndices):
|
|
|
597
600
|
def buildFeatureVariationRecord(conditionTable, substitutionRecords):
|
|
598
601
|
"""Build a FeatureVariationRecord."""
|
|
599
602
|
fvr = ot.FeatureVariationRecord()
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
+
if len(conditionTable) != 0:
|
|
604
|
+
fvr.ConditionSet = ot.ConditionSet()
|
|
605
|
+
fvr.ConditionSet.ConditionTable = conditionTable
|
|
606
|
+
fvr.ConditionSet.ConditionCount = len(conditionTable)
|
|
607
|
+
else:
|
|
608
|
+
fvr.ConditionSet = None
|
|
603
609
|
fvr.FeatureTableSubstitution = ot.FeatureTableSubstitution()
|
|
604
610
|
fvr.FeatureTableSubstitution.Version = 0x00010000
|
|
605
611
|
fvr.FeatureTableSubstitution.SubstitutionRecord = substitutionRecords
|
fontTools/varLib/hvar.py
CHANGED
|
@@ -18,7 +18,7 @@ def _get_advance_metrics(font, axisTags, tableFields):
|
|
|
18
18
|
# advance width at that peak. Then pass these all to a VariationModel
|
|
19
19
|
# builder to compute back the deltas.
|
|
20
20
|
# 2. For each master peak, pull out the deltas of the advance width directly,
|
|
21
|
-
# and feed these to the VarStoreBuilder, forgoing the
|
|
21
|
+
# and feed these to the VarStoreBuilder, forgoing the remodeling step.
|
|
22
22
|
# We'll go with the second option, as it's simpler, faster, and more direct.
|
|
23
23
|
gvar = font["gvar"]
|
|
24
24
|
vhAdvanceDeltasAndSupports = {}
|
|
@@ -675,6 +675,7 @@ def instantiateCFF2(
|
|
|
675
675
|
privateDicts.append(fd.Private)
|
|
676
676
|
|
|
677
677
|
allCommands = []
|
|
678
|
+
allCommandPrivates = []
|
|
678
679
|
for cs in charStrings:
|
|
679
680
|
assert cs.private.vstore.otVarStore is varStore # Or in many places!!
|
|
680
681
|
commands = programToCommands(cs.program, getNumRegions=getNumRegions)
|
|
@@ -683,6 +684,7 @@ def instantiateCFF2(
|
|
|
683
684
|
if specialize:
|
|
684
685
|
commands = specializeCommands(commands, generalizeFirst=not generalize)
|
|
685
686
|
allCommands.append(commands)
|
|
687
|
+
allCommandPrivates.append(cs.private)
|
|
686
688
|
|
|
687
689
|
def storeBlendsToVarStore(arg):
|
|
688
690
|
if not isinstance(arg, list):
|
|
@@ -742,8 +744,8 @@ def instantiateCFF2(
|
|
|
742
744
|
assert varData.ItemCount == 0
|
|
743
745
|
|
|
744
746
|
# Add charstring blend lists to VarStore so we can instantiate them
|
|
745
|
-
for commands in allCommands:
|
|
746
|
-
vsindex = 0
|
|
747
|
+
for commands, private in zip(allCommands, allCommandPrivates):
|
|
748
|
+
vsindex = getattr(private, "vsindex", 0)
|
|
747
749
|
for command in commands:
|
|
748
750
|
if command[0] == "vsindex":
|
|
749
751
|
vsindex = command[1][0]
|
|
@@ -752,7 +754,6 @@ def instantiateCFF2(
|
|
|
752
754
|
storeBlendsToVarStore(arg)
|
|
753
755
|
|
|
754
756
|
# Add private blend lists to VarStore so we can instantiate values
|
|
755
|
-
vsindex = 0
|
|
756
757
|
for opcode, name, arg_type, default, converter in privateDictOperators2:
|
|
757
758
|
if arg_type not in ("number", "delta", "array"):
|
|
758
759
|
continue
|
|
@@ -763,6 +764,7 @@ def instantiateCFF2(
|
|
|
763
764
|
continue
|
|
764
765
|
values = getattr(private, name)
|
|
765
766
|
|
|
767
|
+
# This is safe here since "vsindex" is the first in the privateDictOperators2
|
|
766
768
|
if name == "vsindex":
|
|
767
769
|
vsindex = values[0]
|
|
768
770
|
continue
|
|
@@ -783,8 +785,8 @@ def instantiateCFF2(
|
|
|
783
785
|
|
|
784
786
|
# Read back new charstring blends from the instantiated VarStore
|
|
785
787
|
varDataCursor = [0] * len(varStore.VarData)
|
|
786
|
-
for commands in allCommands:
|
|
787
|
-
vsindex = 0
|
|
788
|
+
for commands, private in zip(allCommands, allCommandPrivates):
|
|
789
|
+
vsindex = getattr(private, "vsindex", 0)
|
|
788
790
|
for command in commands:
|
|
789
791
|
if command[0] == "vsindex":
|
|
790
792
|
vsindex = command[1][0]
|
|
@@ -799,9 +801,16 @@ def instantiateCFF2(
|
|
|
799
801
|
if arg_type not in ("number", "delta", "array"):
|
|
800
802
|
continue
|
|
801
803
|
|
|
804
|
+
vsindex = 0
|
|
802
805
|
for private in privateDicts:
|
|
803
806
|
if not hasattr(private, name):
|
|
804
807
|
continue
|
|
808
|
+
|
|
809
|
+
# This is safe here since "vsindex" is the first in the privateDictOperators2
|
|
810
|
+
if name == "vsindex":
|
|
811
|
+
vsindex = values[0]
|
|
812
|
+
continue
|
|
813
|
+
|
|
805
814
|
values = getattr(private, name)
|
|
806
815
|
if arg_type == "number":
|
|
807
816
|
values = [values]
|