[varlib] use VarLibCFFHintTypeMergeError for hint merging
This commit is contained in:
parent
aafc814088
commit
50fb04fd57
@ -20,7 +20,9 @@ from fontTools.varLib.models import allEqual
|
|||||||
from fontTools.misc.psCharStrings import T2CharString, T2OutlineExtractor
|
from fontTools.misc.psCharStrings import T2CharString, T2OutlineExtractor
|
||||||
from fontTools.pens.t2CharStringPen import T2CharStringPen, t2c_round
|
from fontTools.pens.t2CharStringPen import T2CharStringPen, t2c_round
|
||||||
|
|
||||||
from .errors import VarLibCFFDictMergeError, VarLibCFFPointTypeMergeError, VarLibMergeError
|
from .errors import (
|
||||||
|
VarLibCFFDictMergeError, VarLibCFFPointTypeMergeError,
|
||||||
|
VarLibCFFHintTypeMergeError,VarLibMergeError)
|
||||||
|
|
||||||
|
|
||||||
# Backwards compatibility
|
# Backwards compatibility
|
||||||
@ -539,7 +541,7 @@ class CFF2CharStringMergePen(T2CharStringPen):
|
|||||||
else:
|
else:
|
||||||
cmd = self._commands[self.pt_index]
|
cmd = self._commands[self.pt_index]
|
||||||
if cmd[0] != hint_type:
|
if cmd[0] != hint_type:
|
||||||
raise VarLibCFFPointTypeMergeError(hint_type, self.pt_index, len(cmd[1]),
|
raise VarLibCFFHintTypeMergeError(hint_type, self.pt_index, len(cmd[1]),
|
||||||
cmd[0], self.glyphName)
|
cmd[0], self.glyphName)
|
||||||
cmd[1].append(args)
|
cmd[1].append(args)
|
||||||
self.pt_index += 1
|
self.pt_index += 1
|
||||||
@ -548,14 +550,14 @@ class CFF2CharStringMergePen(T2CharStringPen):
|
|||||||
# For hintmask, fonttools.cffLib.specializer.py expects
|
# For hintmask, fonttools.cffLib.specializer.py expects
|
||||||
# each of these to be represented by two sequential commands:
|
# each of these to be represented by two sequential commands:
|
||||||
# first holding only the operator name, with an empty arg list,
|
# first holding only the operator name, with an empty arg list,
|
||||||
# second with an empty string as the op name, and the mask arg list.
|
# second with an empty string as the op name, and the mask arg list.
|
||||||
if self.m_index == 0:
|
if self.m_index == 0:
|
||||||
self._commands.append([hint_type, []])
|
self._commands.append([hint_type, []])
|
||||||
self._commands.append(["", [abs_args]])
|
self._commands.append(["", [abs_args]])
|
||||||
else:
|
else:
|
||||||
cmd = self._commands[self.pt_index]
|
cmd = self._commands[self.pt_index]
|
||||||
if cmd[0] != hint_type:
|
if cmd[0] != hint_type:
|
||||||
raise VarLibCFFPointTypeMergeError(hint_type, self.pt_index, len(cmd[1]),
|
raise VarLibCFFHintTypeMergeError(hint_type, self.pt_index, len(cmd[1]),
|
||||||
cmd[0], self.glyphName)
|
cmd[0], self.glyphName)
|
||||||
self.pt_index += 1
|
self.pt_index += 1
|
||||||
cmd = self._commands[self.pt_index]
|
cmd = self._commands[self.pt_index]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user