From 48ae9cbf1cbec6914afbbb1bb9033a1604a51d8a Mon Sep 17 00:00:00 2001 From: Cosimo Lupo Date: Wed, 2 Aug 2023 15:12:26 +0100 Subject: [PATCH] use 0 for sidebearing sparse metrics sentinel font sources only allow to specify advances, the sidebearings are computed. Makes more sense for the sparse metrics to have 0 for the sidebearings as the glyph that's meant to be 'sparse' is most likely empty with no outlines --- Lib/fontTools/varLib/__init__.py | 6 +++--- .../data/master_sparse_cff2_empty/SparseCFF-Medium.ttx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lib/fontTools/varLib/__init__.py b/Lib/fontTools/varLib/__init__.py index d5a8daccc..22e244112 100644 --- a/Lib/fontTools/varLib/__init__.py +++ b/Lib/fontTools/varLib/__init__.py @@ -563,11 +563,11 @@ def _get_advance_metrics( ): vhAdvanceDeltasAndSupports = {} vOrigDeltasAndSupports = {} - # HACK: we treat width 65535 and lsb -32768 as sentinel values to signal that a - # glyph from a non-default master should not participate in computing {H,V}VAR, + # HACK: we treat width 65535 and lsb 0 as sentinel values to signal that a glyph + # from a non-default master should not participate in computing {H,V}VAR, # as if it were missing. Allows to variate other glyph-related data independently # from glyph metrics - sparse_metrics = (0xFFFF, -0x8000) + sparse_metrics = (0xFFFF, 0) for glyph in glyphOrder: vhAdvances = [ metrics[glyph][0] diff --git a/Tests/varLib/data/master_sparse_cff2_empty/SparseCFF-Medium.ttx b/Tests/varLib/data/master_sparse_cff2_empty/SparseCFF-Medium.ttx index 41cf6ce07..1b583bd33 100644 --- a/Tests/varLib/data/master_sparse_cff2_empty/SparseCFF-Medium.ttx +++ b/Tests/varLib/data/master_sparse_cff2_empty/SparseCFF-Medium.ttx @@ -93,7 +93,7 @@ - +