fixed subroutinized CFF2 flattening

and some code cleanup
This commit is contained in:
Michiharu Ariza 2018-09-21 12:16:36 -07:00
parent 321e592333
commit 76e54d2bd8
3 changed files with 5 additions and 17 deletions

View File

@ -494,7 +494,7 @@ struct Stack
inline const ELEM& peek (void)
{
if (likely (count > 0))
return elements[count];
return elements[count-1];
else
return Null(ELEM);
}

View File

@ -372,19 +372,6 @@ struct CSOpSet : OpSet<ARG>
OPSET::flush_args_and_op (op, env, param);
}
static inline bool is_subr_op (OpCode op)
{
switch (op)
{
case OpCode_callsubr:
case OpCode_callgsubr:
case OpCode_return:
return true;
default:
return false;
}
}
protected:
typedef OpSet<ARG> SUPER;
};

View File

@ -90,7 +90,7 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
inline bool fetch_op (OpCode &op)
{
if (unlikely (this->substr.avail ()))
if (this->substr.avail ())
return SUPER::fetch_op (op);
/* make up return or endchar op */
@ -129,8 +129,9 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH>
case OpCode_callsubr:
case OpCode_callgsubr:
/* a subroutine number shoudln't be a blended value */
return (!env.argStack.peek ().blended () &&
SUPER::process_op (op, env, param));
if (unlikely (env.argStack.peek ().blended ()))
return false;
return SUPER::process_op (op, env, param);
case OpCode_blendcs:
return OPSET::process_blend (env, param);