afdko icon indicating copy to clipboard operation
afdko copied to clipboard

[buildcff2vf] should clarify reason when raising VarLibCFFPointTypeMergeError

Open punchcutter opened this issue 4 years ago • 1 comments

When fontTools fails to merge and raises VarLibCFFPointTypeMergeError it can happen in fontTools.varLib.cff add_point, add_hint, or add_hintmask, but buildcff2vf reports the same error:

The input set requires compatibilization. Please try again with the -c (--check-compat) option.

Even when buildcff2vf is already being run with -c we get this same error which is not quite correct. Running the underlying code shows the real error which comes from the hinting. For example

fontTools.varLib.errors.VarLibCFFPointTypeMergeError: Glyph '.notdef': 'rmoveto' at point index 0 in master index 1 differs from the default font point type 'hstemhm' or fontTools.varLib.errors.VarLibCFFPointTypeMergeError: Glyph 'cid00005': 'hintmask' at point index 5 in master index 1 differs from the default font point type 'rrcurveto'

punchcutter avatar Feb 23 '21 12:02 punchcutter

I think originally the VarLibCFFPointTypeMergeError was only used for points, as the name implies. But it seems fontTools is using the same error to indicate merging issues for both Points and Hints.

Easy fix here is to just logger.error() the exception message, maybe retain the blurb about trying again with --check-compat (if not already in that mode?).

josh-hadley avatar Feb 24 '21 18:02 josh-hadley