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
This commit is contained in:
Cosimo Lupo 2023-08-02 15:12:26 +01:00
parent ecfc5eeeb7
commit 48ae9cbf1c
No known key found for this signature in database
GPG Key ID: DF65A8A5A119C9A8
2 changed files with 4 additions and 4 deletions

View File

@ -563,11 +563,11 @@ def _get_advance_metrics(
): ):
vhAdvanceDeltasAndSupports = {} vhAdvanceDeltasAndSupports = {}
vOrigDeltasAndSupports = {} vOrigDeltasAndSupports = {}
# HACK: we treat width 65535 and lsb -32768 as sentinel values to signal that a # HACK: we treat width 65535 and lsb 0 as sentinel values to signal that a glyph
# glyph from a non-default master should not participate in computing {H,V}VAR, # 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 # as if it were missing. Allows to variate other glyph-related data independently
# from glyph metrics # from glyph metrics
sparse_metrics = (0xFFFF, -0x8000) sparse_metrics = (0xFFFF, 0)
for glyph in glyphOrder: for glyph in glyphOrder:
vhAdvances = [ vhAdvances = [
metrics[glyph][0] metrics[glyph][0]

View File

@ -93,7 +93,7 @@
</CFF> </CFF>
<hmtx> <hmtx>
<mtx name=".notdef" width="65535" lsb="-32768"/> <mtx name=".notdef" width="65535" lsb="0"/>
<mtx name="e" width="600" lsb="40"/> <mtx name="e" width="600" lsb="40"/>
</hmtx> </hmtx>