提交 825df6db 编写于 作者: B Behdad Esfahbod

[CFF] Change spaces to tabs

上级 592f39b3
此差异已折叠。
......@@ -51,7 +51,7 @@ struct CallContext
inline void fini (void) {}
SubByteStr substr;
CSType type;
CSType type;
unsigned int subr_num;
};
......@@ -150,7 +150,7 @@ struct CSInterpEnv : InterpEnv<ARG>
unsigned int subr_num;
if (unlikely (!popSubrNum (biasedSubrs, subr_num)
|| callStack.get_count () >= kMaxCallLimit))
|| callStack.get_count () >= kMaxCallLimit))
{
SUPER::set_error ();
return;
......@@ -191,19 +191,19 @@ struct CSInterpEnv : InterpEnv<ARG>
public:
CallContext context;
bool endchar_flag;
bool seen_moveto;
bool seen_hintmask;
bool endchar_flag;
bool seen_moveto;
bool seen_hintmask;
unsigned int hstem_count;
unsigned int vstem_count;
unsigned int hintmask_size;
CallStack callStack;
CallStack callStack;
BiasedSubrs<SUBRS> globalSubrs;
BiasedSubrs<SUBRS> localSubrs;
private:
Point pt;
Point pt;
typedef InterpEnv<ARG> SUPER;
};
......@@ -241,120 +241,120 @@ struct CSOpSet : OpSet<ARG>
switch (op) {
case OpCode_return:
env.returnFromSubr ();
break;
env.returnFromSubr ();
break;
case OpCode_endchar:
OPSET::check_width (op, env, param);
env.set_endchar (true);
OPSET::flush_args_and_op (op, env, param);
break;
OPSET::check_width (op, env, param);
env.set_endchar (true);
OPSET::flush_args_and_op (op, env, param);
break;
case OpCode_fixedcs:
env.argStack.push_fixed_from_substr (env.substr);
break;
env.argStack.push_fixed_from_substr (env.substr);
break;
case OpCode_callsubr:
env.callSubr (env.localSubrs, CSType_LocalSubr);
break;
env.callSubr (env.localSubrs, CSType_LocalSubr);
break;
case OpCode_callgsubr:
env.callSubr (env.globalSubrs, CSType_GlobalSubr);
break;
env.callSubr (env.globalSubrs, CSType_GlobalSubr);
break;
case OpCode_hstem:
case OpCode_hstemhm:
OPSET::check_width (op, env, param);
OPSET::process_hstem (op, env, param);
break;
OPSET::check_width (op, env, param);
OPSET::process_hstem (op, env, param);
break;
case OpCode_vstem:
case OpCode_vstemhm:
OPSET::check_width (op, env, param);
OPSET::process_vstem (op, env, param);
break;
OPSET::check_width (op, env, param);
OPSET::process_vstem (op, env, param);
break;
case OpCode_hintmask:
case OpCode_cntrmask:
OPSET::check_width (op, env, param);
OPSET::process_hintmask (op, env, param);
break;
OPSET::check_width (op, env, param);
OPSET::process_hintmask (op, env, param);
break;
case OpCode_rmoveto:
OPSET::check_width (op, env, param);
PATH::rmoveto (env, param);
OPSET::process_post_move (op, env, param);
break;
OPSET::check_width (op, env, param);
PATH::rmoveto (env, param);
OPSET::process_post_move (op, env, param);
break;
case OpCode_hmoveto:
OPSET::check_width (op, env, param);
PATH::hmoveto (env, param);
OPSET::process_post_move (op, env, param);
break;
OPSET::check_width (op, env, param);
PATH::hmoveto (env, param);
OPSET::process_post_move (op, env, param);
break;
case OpCode_vmoveto:
OPSET::check_width (op, env, param);
PATH::vmoveto (env, param);
OPSET::process_post_move (op, env, param);
break;
OPSET::check_width (op, env, param);
PATH::vmoveto (env, param);
OPSET::process_post_move (op, env, param);
break;
case OpCode_rlineto:
PATH::rlineto (env, param);
process_post_path (op, env, param);
break;
PATH::rlineto (env, param);
process_post_path (op, env, param);
break;
case OpCode_hlineto:
PATH::hlineto (env, param);
process_post_path (op, env, param);
break;
PATH::hlineto (env, param);
process_post_path (op, env, param);
break;
case OpCode_vlineto:
PATH::vlineto (env, param);
process_post_path (op, env, param);
break;
PATH::vlineto (env, param);
process_post_path (op, env, param);
break;
case OpCode_rrcurveto:
PATH::rrcurveto (env, param);
process_post_path (op, env, param);
break;
PATH::rrcurveto (env, param);
process_post_path (op, env, param);
break;
case OpCode_rcurveline:
PATH::rcurveline (env, param);
process_post_path (op, env, param);
break;
PATH::rcurveline (env, param);
process_post_path (op, env, param);
break;
case OpCode_rlinecurve:
PATH::rlinecurve (env, param);
process_post_path (op, env, param);
break;
PATH::rlinecurve (env, param);
process_post_path (op, env, param);
break;
case OpCode_vvcurveto:
PATH::vvcurveto (env, param);
process_post_path (op, env, param);
break;
PATH::vvcurveto (env, param);
process_post_path (op, env, param);
break;
case OpCode_hhcurveto:
PATH::hhcurveto (env, param);
process_post_path (op, env, param);
break;
PATH::hhcurveto (env, param);
process_post_path (op, env, param);
break;
case OpCode_vhcurveto:
PATH::vhcurveto (env, param);
process_post_path (op, env, param);
break;
PATH::vhcurveto (env, param);
process_post_path (op, env, param);
break;
case OpCode_hvcurveto:
PATH::hvcurveto (env, param);
process_post_path (op, env, param);
break;
PATH::hvcurveto (env, param);
process_post_path (op, env, param);
break;
case OpCode_hflex:
PATH::hflex (env, param);
OPSET::process_post_flex (op, env, param);
break;
PATH::hflex (env, param);
OPSET::process_post_flex (op, env, param);
break;
case OpCode_flex:
PATH::flex (env, param);
OPSET::process_post_flex (op, env, param);
break;
PATH::flex (env, param);
OPSET::process_post_flex (op, env, param);
break;
case OpCode_hflex1:
PATH::hflex1 (env, param);
OPSET::process_post_flex (op, env, param);
break;
PATH::hflex1 (env, param);
OPSET::process_post_flex (op, env, param);
break;
case OpCode_flex1:
PATH::flex1 (env, param);
OPSET::process_post_flex (op, env, param);
break;
PATH::flex1 (env, param);
OPSET::process_post_flex (op, env, param);
break;
default:
SUPER::process_op (op, env);
break;
SUPER::process_op (op, env);
break;
}
}
......@@ -433,11 +433,11 @@ struct CSOpSet : OpSet<ARG>
case OpCode_TwoBytePosInt2: case OpCode_TwoBytePosInt3:
case OpCode_TwoByteNegInt0: case OpCode_TwoByteNegInt1:
case OpCode_TwoByteNegInt2: case OpCode_TwoByteNegInt3:
return true;
return true;
default:
/* 1-byte integer */
return (OpCode_OneByteIntFirst <= op) && (op <= OpCode_OneByteIntLast);
/* 1-byte integer */
return (OpCode_OneByteIntFirst <= op) && (op <= OpCode_OneByteIntLast);
}
}
......@@ -630,47 +630,47 @@ struct PathProcs
for (; i + 8 <= env.argStack.get_count (); i += 8)
{
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = env.get_pt ();
pt1.move_x (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_y (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+7));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = env.get_pt ();
pt1.move_x (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_y (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+7));
}
if (i < env.argStack.get_count ())
pt3.move_y (env.eval_arg (i));
pt3.move_y (env.eval_arg (i));
PATH::curve (env, param, pt1, pt2, pt3);
}
else
{
for (; i + 8 <= env.argStack.get_count (); i += 8)
{
pt1 = env.get_pt ();
pt1.move_y (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_x (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+7));
if ((env.argStack.get_count () - i < 16) && ((env.argStack.get_count () & 1) != 0))
pt3.move_x (env.eval_arg (i+8));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = env.get_pt ();
pt1.move_y (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_x (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+7));
if ((env.argStack.get_count () - i < 16) && ((env.argStack.get_count () & 1) != 0))
pt3.move_x (env.eval_arg (i+8));
PATH::curve (env, param, pt1, pt2, pt3);
}
}
}
......@@ -691,47 +691,47 @@ struct PathProcs
for (; i + 8 <= env.argStack.get_count (); i += 8)
{
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = env.get_pt ();
pt1.move_y (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_x (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+7));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = env.get_pt ();
pt1.move_y (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_x (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+7));
}
if (i < env.argStack.get_count ())
pt3.move_x (env.eval_arg (i));
pt3.move_x (env.eval_arg (i));
PATH::curve (env, param, pt1, pt2, pt3);
}
else
{
for (; i + 8 <= env.argStack.get_count (); i += 8)
{
pt1 = env.get_pt ();
pt1.move_x (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_y (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+7));
if ((env.argStack.get_count () - i < 16) && ((env.argStack.get_count () & 1) != 0))
pt3.move_y (env.eval_arg (i+8));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = env.get_pt ();
pt1.move_x (env.eval_arg (i));
pt2 = pt1;
pt2.move (env.eval_arg (i+1), env.eval_arg (i+2));
pt3 = pt2;
pt3.move_y (env.eval_arg (i+3));
PATH::curve (env, param, pt1, pt2, pt3);
pt1 = pt3;
pt1.move_y (env.eval_arg (i+4));
pt2 = pt1;
pt2.move (env.eval_arg (i+5), env.eval_arg (i+6));
pt3 = pt2;
pt3.move_x (env.eval_arg (i+7));
if ((env.argStack.get_count () - i < 16) && ((env.argStack.get_count () & 1) != 0))
pt3.move_y (env.eval_arg (i+8));
PATH::curve (env, param, pt1, pt2, pt3);
}
}
}
......@@ -824,7 +824,7 @@ struct PathProcs
Point d;
d.init ();
for (unsigned int i = 0; i < 10; i += 2)
d.move (env.eval_arg (i), env.eval_arg (i+1));
d.move (env.eval_arg (i), env.eval_arg (i+1));
Point pt1 = env.get_pt ();
pt1.move (env.eval_arg (0), env.eval_arg (1));
......@@ -840,13 +840,13 @@ struct PathProcs
if (fabs (d.x.to_real ()) > fabs (d.y.to_real ()))
{
pt6.move_x (env.eval_arg (10));
pt6.y = env.get_pt ().y;
pt6.move_x (env.eval_arg (10));
pt6.y = env.get_pt ().y;
}
else
{
pt6.x = env.get_pt ().x;
pt6.move_y (env.eval_arg (10));
pt6.x = env.get_pt ().x;
pt6.move_y (env.eval_arg (10));
}
curve2 (env, param, pt1, pt2, pt3, pt4, pt5, pt6);
......@@ -857,8 +857,8 @@ struct PathProcs
protected:
static inline void curve2 (ENV &env, PARAM& param,
const Point &pt1, const Point &pt2, const Point &pt3,
const Point &pt4, const Point &pt5, const Point &pt6)
const Point &pt1, const Point &pt2, const Point &pt3,
const Point &pt4, const Point &pt5, const Point &pt6)
{
PATH::curve (env, param, pt1, pt2, pt3);
PATH::curve (env, param, pt4, pt5, pt6);
......@@ -875,9 +875,9 @@ struct CSInterpreter : Interpreter<ENV>
for (;;) {
OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param);
if (unlikely (SUPER::env.in_error ()))
return false;
return false;
if (SUPER::env.is_endchar ())
break;
break;
}
return true;
......
......@@ -45,7 +45,7 @@ struct DictVal : OpStr
{
}
Number single_val;
Number single_val;
};
typedef DictVal NumDictVal;
......@@ -73,10 +73,10 @@ struct TopDictValues : DictValues<OPSTR>
{
case OpCode_CharStrings:
case OpCode_FDArray:
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op);
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op);
default:
return opstr.str.len;
return opstr.str.len;
}
}
......@@ -90,16 +90,16 @@ struct DictOpSet : OpSet<Number>
{
switch (op) {
case OpCode_longintdict: /* 5-byte integer */
env.argStack.push_longint_from_substr (env.substr);
break;
env.argStack.push_longint_from_substr (env.substr);
break;
case OpCode_BCD: /* real number */
env.argStack.push_real (parse_bcd (env.substr));
break;
env.argStack.push_real (parse_bcd (env.substr));
break;
default:
OpSet<Number>::process_op (op, env);
break;
OpSet<Number>::process_op (op, env);
break;
}
}
......@@ -123,84 +123,84 @@ struct DictOpSet : OpSet<Number>
char d;
if ((i & 1) == 0)
{
if (!substr.avail ())
{
substr.set_error ();
return 0.0f;
}
byte = substr[0];
substr.inc ();
d = byte >> 4;
if (!substr.avail ())
{
substr.set_error ();
return 0.0f;
}
byte = substr[0];
substr.inc ();
d = byte >> 4;
}
else
d = byte & 0x0F;
d = byte & 0x0F;
switch (d)
{
case RESERVED:
substr.set_error ();
return v;
case END:
value = (double)(neg? -int_part: int_part);
if (frac_count > 0)
value += (frac_part / pow (10.0, (double)frac_count));
if (exp_part != 0)
{
if (exp_neg)
value /= pow (10.0, (double)exp_part);
else
value *= pow (10.0, (double)exp_part);
}
return (float)value;
case NEG:
if (i != 0)
{
substr.set_error ();
return 0.0f;
}
neg = true;
break;
case DECIMAL:
if (part != INT_PART)
{
substr.set_error ();
return v;
}
part = FRAC_PART;
break;
case EXP_NEG:
exp_neg = true;
HB_FALLTHROUGH;
case EXP_POS:
if (part == EXP_PART)
{
substr.set_error ();
return v;
}
part = EXP_PART;
break;
default:
switch (part) {
default:
case INT_PART:
int_part = (int_part * 10) + d;
break;
case FRAC_PART:
frac_part = (frac_part * 10) + d;
frac_count++;
break;
case EXP_PART:
exp_part = (exp_part * 10) + d;
break;
}
case RESERVED:
substr.set_error ();
return v;
case END:
value = (double)(neg? -int_part: int_part);
if (frac_count > 0)
value += (frac_part / pow (10.0, (double)frac_count));
if (exp_part != 0)
{
if (exp_neg)
value /= pow (10.0, (double)exp_part);
else
value *= pow (10.0, (double)exp_part);
}
return (float)value;
case NEG:
if (i != 0)
{
substr.set_error ();
return 0.0f;
}
neg = true;
break;
case DECIMAL:
if (part != INT_PART)
{
substr.set_error ();
return v;
}
part = FRAC_PART;
break;
case EXP_NEG:
exp_neg = true;
HB_FALLTHROUGH;
case EXP_POS:
if (part == EXP_PART)
{
substr.set_error ();
return v;
}
part = EXP_PART;
break;
default:
switch (part) {
default:
case INT_PART:
int_part = (int_part * 10) + d;
break;
case FRAC_PART:
frac_part = (frac_part * 10) + d;
frac_count++;
break;
case EXP_PART:
exp_part = (exp_part * 10) + d;
break;
}
}
}
......@@ -225,9 +225,9 @@ struct DictOpSet : OpSet<Number>
case OpCode_ForceBold:
case OpCode_LanguageGroup:
case OpCode_ExpansionFactor:
return true;
return true;
default:
return false;
return false;
}
}
};
......@@ -239,19 +239,19 @@ struct TopDictOpSet : DictOpSet
{
switch (op) {
case OpCode_CharStrings:
dictval.charStringsOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.charStringsOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
case OpCode_FDArray:
dictval.FDArrayOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.FDArrayOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
case OpCode_FontMatrix:
env.clear_args ();
break;
env.clear_args ();
break;
default:
DictOpSet::process_op (op, env);
break;
DictOpSet::process_op (op, env);
break;
}
}
};
......@@ -266,7 +266,7 @@ struct DictInterpreter : Interpreter<ENV>
{
OPSET::process_op (SUPER::env.fetch_op (), SUPER::env, param);
if (unlikely (SUPER::env.in_error ()))
return false;
return false;
}
return true;
......
......@@ -58,9 +58,9 @@ struct CFF1CSInterpEnv : CSInterpEnv<Number, CFF1Subrs>
{
if (has_width_)
{
width = SUPER::argStack[0];
has_width = true;
arg_start = 1;
width = SUPER::argStack[0];
has_width = true;
arg_start = 1;
}
}
processed_width = true;
......@@ -74,11 +74,11 @@ struct CFF1CSInterpEnv : CSInterpEnv<Number, CFF1Subrs>
inline void set_in_seac (bool _in_seac) { in_seac = _in_seac; }
bool processed_width;
bool has_width;
bool processed_width;
bool has_width;
unsigned int arg_start;
Number width;
bool in_seac;
Number width;
bool in_seac;
private:
typedef CSInterpEnv<Number, CFF1Subrs> SUPER;
......@@ -94,21 +94,21 @@ struct CFF1CSOpSet : CSOpSet<Number, OPSET, CFF1CSInterpEnv, PARAM, PATH>
{
switch (op) {
case OpCode_dotsection:
SUPER::flush_args_and_op (op, env, param);
break;
SUPER::flush_args_and_op (op, env, param);
break;
case OpCode_endchar:
OPSET::check_width (op, env, param);
if (env.argStack.get_count () >= 4)
{
OPSET::process_seac (env, param);
}
OPSET::flush_args_and_op (op, env, param);
env.set_endchar (true);
break;
OPSET::check_width (op, env, param);
if (env.argStack.get_count () >= 4)
{
OPSET::process_seac (env, param);
}
OPSET::flush_args_and_op (op, env, param);
env.set_endchar (true);
break;
default:
SUPER::process_op (op, env, param);
SUPER::process_op (op, env, param);
}
}
......@@ -119,24 +119,24 @@ struct CFF1CSOpSet : CSOpSet<Number, OPSET, CFF1CSInterpEnv, PARAM, PATH>
bool has_width = false;
switch (op)
{
case OpCode_endchar:
case OpCode_hstem:
case OpCode_hstemhm:
case OpCode_vstem:
case OpCode_vstemhm:
case OpCode_hintmask:
case OpCode_cntrmask:
has_width = ((env.argStack.get_count () & 1) != 0);
break;
case OpCode_hmoveto:
case OpCode_vmoveto:
has_width = (env.argStack.get_count () > 1);
break;
case OpCode_rmoveto:
has_width = (env.argStack.get_count () > 2);
break;
default:
return;
case OpCode_endchar:
case OpCode_hstem:
case OpCode_hstemhm:
case OpCode_vstem:
case OpCode_vstemhm:
case OpCode_hintmask:
case OpCode_cntrmask:
has_width = ((env.argStack.get_count () & 1) != 0);
break;
case OpCode_hmoveto:
case OpCode_vmoveto:
has_width = (env.argStack.get_count () > 1);
break;
case OpCode_rmoveto:
has_width = (env.argStack.get_count () > 2);
break;
default:
return;
}
env.set_width (has_width);
}
......
......@@ -52,7 +52,7 @@ struct BlendArg : Number
inline void set_real (float v) { reset_blends (); Number::set_real (v); }
inline void set_blends (unsigned int numValues_, unsigned int valueIndex_,
unsigned int numBlends, const BlendArg *blends_)
unsigned int numBlends, const BlendArg *blends_)
{
numValues = numValues_;
valueIndex = valueIndex_;
......@@ -80,7 +80,7 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
{
template <typename ACC>
inline void init (const ByteStr &str, ACC &acc, unsigned int fd,
const int *coords_=nullptr, unsigned int num_coords_=0)
const int *coords_=nullptr, unsigned int num_coords_=0)
{
SUPER::init (str, *acc.globalSubrs, *acc.privateDicts[fd].localSubrs);
......@@ -133,10 +133,10 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
region_count = varStore->varStore.get_region_index_count (get_ivs ());
if (do_blend)
{
scalars.resize (region_count);
varStore->varStore.get_scalars (get_ivs (),
(int *)coords, num_coords,
&scalars[0], region_count);
scalars.resize (region_count);
varStore->varStore.get_scalars (get_ivs (),
(int *)coords, num_coords,
&scalars[0], region_count);
}
seen_blend = true;
}
......@@ -157,10 +157,10 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
}
inline unsigned int get_region_count (void) const { return region_count; }
inline void set_region_count (unsigned int region_count_) { region_count = region_count_; }
inline void set_region_count (unsigned int region_count_) { region_count = region_count_; }
inline unsigned int get_ivs (void) const { return ivs; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
inline bool seen_vsindex (void) const { return seen_vsindex_; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
inline bool seen_vsindex (void) const { return seen_vsindex_; }
protected:
inline void blend_arg (BlendArg &arg)
......@@ -169,13 +169,13 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
{
if (likely (scalars.len == arg.deltas.len))
{
float v = arg.to_real ();
for (unsigned int i = 0; i < scalars.len; i++)
{
v += scalars[i] * arg.deltas[i].to_real ();
}
arg.set_real (v);
arg.deltas.resize (0);
float v = arg.to_real ();
for (unsigned int i = 0; i < scalars.len; i++)
{
v += scalars[i] * arg.deltas[i].to_real ();
}
arg.set_real (v);
arg.deltas.resize (0);
}
}
}
......@@ -183,13 +183,13 @@ struct CFF2CSInterpEnv : CSInterpEnv<BlendArg, CFF2Subrs>
protected:
const int *coords;
unsigned int num_coords;
const CFF2VariationStore *varStore;
const CFF2VariationStore *varStore;
unsigned int region_count;
unsigned int ivs;
hb_vector_t<float> scalars;
bool do_blend;
bool seen_vsindex_;
bool seen_blend;
bool do_blend;
bool seen_vsindex_;
bool seen_blend;
typedef CSInterpEnv<BlendArg, CFF2Subrs> SUPER;
};
......@@ -201,30 +201,30 @@ struct CFF2CSOpSet : CSOpSet<BlendArg, OPSET, CFF2CSInterpEnv, PARAM, PATH>
switch (op) {
case OpCode_callsubr:
case OpCode_callgsubr:
/* a subroutine number shoudln't be a blended value */
if (unlikely (env.argStack.peek ().blending ()))
{
env.set_error ();
break;
}
SUPER::process_op (op, env, param);
break;
/* a subroutine number shoudln't be a blended value */
if (unlikely (env.argStack.peek ().blending ()))
{
env.set_error ();
break;
}
SUPER::process_op (op, env, param);
break;
case OpCode_blendcs:
OPSET::process_blend (env, param);
break;
OPSET::process_blend (env, param);
break;
case OpCode_vsindexcs:
if (unlikely (env.argStack.peek ().blending ()))
{
env.set_error ();
break;
}
OPSET::process_vsindex (env, param);
break;
if (unlikely (env.argStack.peek ().blending ()))
{
env.set_error ();
break;
}
OPSET::process_vsindex (env, param);
break;
default:
SUPER::process_op (op, env, param);
SUPER::process_op (op, env, param);
}
}
......
......@@ -89,9 +89,9 @@ struct CFFIndex
{
TRACE_SANITIZE (this);
return_trace (likely ((count.sanitize (c) && count == 0) || /* empty INDEX */
(c->check_struct (this) && offSize >= 1 && offSize <= 4 &&
c->check_array (offsets, offSize, count + 1) &&
c->check_array ((const HBUINT8*)data_base (), 1, max_offset () - 1))));
(c->check_struct (this) && offSize >= 1 && offSize <= 4 &&
c->check_array (offsets, offSize, count + 1) &&
c->check_array ((const HBUINT8*)data_base (), 1, max_offset () - 1))));
}
inline static unsigned int calculate_offset_array_size (unsigned int offSize, unsigned int count)
......@@ -119,8 +119,8 @@ struct CFFIndex
}
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const ByteStrArray &byteArray)
unsigned int offSize_,
const ByteStrArray &byteArray)
{
TRACE_SERIALIZE (this);
if (byteArray.len == 0)
......@@ -136,33 +136,33 @@ struct CFFIndex
this->count.set (byteArray.len);
this->offSize.set (offSize_);
if (!unlikely (c->allocate_size<HBUINT8> (offSize_ * (byteArray.len + 1))))
return_trace (false);
return_trace (false);
/* serialize indices */
unsigned int offset = 1;
unsigned int i = 0;
for (; i < byteArray.len; i++)
{
set_offset_at (i, offset);
offset += byteArray[i].get_size ();
set_offset_at (i, offset);
offset += byteArray[i].get_size ();
}
set_offset_at (i, offset);
/* serialize data */
for (unsigned int i = 0; i < byteArray.len; i++)
{
ByteStr *dest = c->start_embed<ByteStr> ();
if (unlikely (dest == nullptr ||
!dest->serialize (c, byteArray[i])))
return_trace (false);
ByteStr *dest = c->start_embed<ByteStr> ();
if (unlikely (dest == nullptr ||
!dest->serialize (c, byteArray[i])))
return_trace (false);
}
}
return_trace (true);
}
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const StrBuffArray &buffArray)
unsigned int offSize_,
const StrBuffArray &buffArray)
{
ByteStrArray byteArray;
byteArray.init ();
......@@ -221,9 +221,9 @@ struct CFFIndex
if (this != &Null(CFFIndex))
{
if (count > 0)
return min_size + offset_array_size () + (offset_at (count) - 1);
return min_size + offset_array_size () + (offset_at (count) - 1);
else
return count.static_size; /* empty CFFIndex contains count only */
return count.static_size; /* empty CFFIndex contains count only */
}
else
return 0;
......@@ -242,7 +242,7 @@ struct CFFIndex
}
public:
COUNT count; /* Number of object data. Note there are (count+1) offsets */
COUNT count; /* Number of object data. Note there are (count+1) offsets */
HBUINT8 offSize; /* The byte size of each offset in the offsets array. */
HBUINT8 offsets[VAR]; /* The array of (count + 1) offsets into objects array (1-base). */
/* HBUINT8 data[VAR]; Object data */
......@@ -262,12 +262,12 @@ struct CFFIndexOf : CFFIndex<COUNT>
template <typename DATA, typename PARAM1, typename PARAM2>
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const DATA *dataArray,
unsigned int dataArrayLen,
const hb_vector_t<unsigned int> &dataSizeArray,
const PARAM1 &param1,
const PARAM2 &param2)
unsigned int offSize_,
const DATA *dataArray,
unsigned int dataArrayLen,
const hb_vector_t<unsigned int> &dataSizeArray,
const PARAM1 &param1,
const PARAM2 &param2)
{
TRACE_SERIALIZE (this);
/* serialize CFFIndex header */
......@@ -292,8 +292,8 @@ struct CFFIndexOf : CFFIndex<COUNT>
{
TYPE *dest = c->start_embed<TYPE> ();
if (unlikely (dest == nullptr ||
!dest->serialize (c, dataArray[i], param1, param2)))
return_trace (false);
!dest->serialize (c, dataArray[i], param1, param2)))
return_trace (false);
}
return_trace (true);
}
......@@ -301,10 +301,10 @@ struct CFFIndexOf : CFFIndex<COUNT>
/* in parallel to above */
template <typename DATA, typename PARAM>
inline static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const DATA *dataArray,
unsigned int dataArrayLen,
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
const PARAM &param)
const DATA *dataArray,
unsigned int dataArrayLen,
hb_vector_t<unsigned int> &dataSizeArray, /* OUT */
const PARAM &param)
{
/* determine offset size */
unsigned int totalDataSize = 0;
......@@ -325,15 +325,15 @@ struct Dict : UnsizedByteStr
{
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
inline bool serialize (hb_serialize_context_t *c,
const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
{
TRACE_SERIALIZE (this);
for (unsigned int i = 0; i < dictval.get_count (); i++)
{
if (unlikely (!opszr.serialize (c, dictval[i], param)))
return_trace (false);
return_trace (false);
}
return_trace (true);
}
......@@ -341,8 +341,8 @@ struct Dict : UnsizedByteStr
/* in parallel to above */
template <typename DICTVAL, typename OP_SERIALIZER, typename PARAM>
inline static unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr,
PARAM& param)
OP_SERIALIZER& opszr,
PARAM& param)
{
unsigned int size = 0;
for (unsigned int i = 0; i < dictval.get_count (); i++)
......@@ -352,7 +352,7 @@ struct Dict : UnsizedByteStr
template <typename DICTVAL, typename OP_SERIALIZER>
inline static unsigned int calculate_serialized_size (const DICTVAL &dictval,
OP_SERIALIZER& opszr)
OP_SERIALIZER& opszr)
{
unsigned int size = 0;
for (unsigned int i = 0; i < dictval.get_count (); i++)
......@@ -471,9 +471,9 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* used by CFF1 */
template <typename DICTVAL, typename OP_SERIALIZER>
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
OP_SERIALIZER& opszr)
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
OP_SERIALIZER& opszr)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
......@@ -497,7 +497,7 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
{
FontDict *dict = c->start_embed<FontDict> ();
if (unlikely (!dict->serialize (c, fontDicts[i], opszr, fontDicts[i])))
return_trace (false);
return_trace (false);
}
return_trace (true);
}
......@@ -505,12 +505,12 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* used by CFF2 */
template <typename DICTVAL, typename OP_SERIALIZER>
inline bool serialize (hb_serialize_context_t *c,
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr,
const hb_vector_t<TableInfo> &privateInfos)
unsigned int offSize_,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr,
const hb_vector_t<TableInfo> &privateInfos)
{
TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false);
......@@ -525,8 +525,8 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
for (unsigned i = 0; i < fontDicts.len; i++)
if (fdmap.includes (i))
{
CFFIndexOf<COUNT, FontDict>::set_offset_at (fid++, offset);
offset += FontDict::calculate_serialized_size (fontDicts[i], opszr);
CFFIndexOf<COUNT, FontDict>::set_offset_at (fid++, offset);
offset += FontDict::calculate_serialized_size (fontDicts[i], opszr);
}
CFFIndexOf<COUNT, FontDict>::set_offset_at (fid, offset);
......@@ -534,9 +534,9 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
for (unsigned int i = 0; i < fontDicts.len; i++)
if (fdmap.includes (i))
{
FontDict *dict = c->start_embed<FontDict> ();
if (unlikely (!dict->serialize (c, fontDicts[i], opszr, privateInfos[fdmap[i]])))
return_trace (false);
FontDict *dict = c->start_embed<FontDict> ();
if (unlikely (!dict->serialize (c, fontDicts[i], opszr, privateInfos[fdmap[i]])))
return_trace (false);
}
return_trace (true);
}
......@@ -544,15 +544,15 @@ struct FDArray : CFFIndexOf<COUNT, FontDict>
/* in parallel to above */
template <typename OP_SERIALIZER, typename DICTVAL>
inline static unsigned int calculate_serialized_size (unsigned int &offSize_ /* OUT */,
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr)
const hb_vector_t<DICTVAL> &fontDicts,
unsigned int fdCount,
const Remap &fdmap,
OP_SERIALIZER& opszr)
{
unsigned int dictsSize = 0;
for (unsigned int i = 0; i < fontDicts.len; i++)
if (fdmap.includes (i))
dictsSize += FontDict::calculate_serialized_size (fontDicts[i], opszr);
dictsSize += FontDict::calculate_serialized_size (fontDicts[i], opszr);
offSize_ = calcOffSize (dictsSize);
return CFFIndex<COUNT>::calculate_serialized_size (offSize_, fdCount, dictsSize);
......@@ -568,7 +568,7 @@ struct FDSelect0 {
return_trace (false);
for (unsigned int i = 0; i < c->get_num_glyphs (); i++)
if (unlikely (!fds[i].sanitize (c)))
return_trace (false);
return_trace (false);
return_trace (true);
}
......@@ -614,9 +614,9 @@ struct FDSelect3_4 {
for (unsigned int i = 0; i < nRanges; i++)
{
if (unlikely (!ranges[i].sanitize (c, fdcount)))
return_trace (false);
return_trace (false);
if ((0 < i) && unlikely (ranges[i - 1].first >= ranges[i].first))
return_trace (false);
return_trace (false);
}
if (unlikely (!sentinel().sanitize (c) || (sentinel() != c->get_num_glyphs ())))
return_trace (false);
......@@ -629,7 +629,7 @@ struct FDSelect3_4 {
unsigned int i;
for (i = 1; i < nRanges; i++)
if (glyph < ranges[i].first)
break;
break;
return (hb_codepoint_t)ranges[i - 1].fd;
}
......@@ -637,7 +637,7 @@ struct FDSelect3_4 {
inline GID_TYPE &sentinel (void) { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
inline const GID_TYPE &sentinel (void) const { return StructAfter<GID_TYPE> (ranges[nRanges - 1]); }
GID_TYPE nRanges;
GID_TYPE nRanges;
FDSelect3_4_Range<GID_TYPE, FD_TYPE> ranges[VAR];
/* GID_TYPE sentinel */
......@@ -653,9 +653,9 @@ struct FDSelect {
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) && (format == 0 || format == 3) &&
(format == 0)?
u.format0.sanitize (c, fdcount):
u.format3.sanitize (c, fdcount)));
(format == 0)?
u.format0.sanitize (c, fdcount):
u.format3.sanitize (c, fdcount)));
}
inline bool serialize (hb_serialize_context_t *c, const FDSelect &src, unsigned int num_glyphs)
......
......@@ -276,8 +276,8 @@ struct CFF1CSOpSet_Extents : CFF1CSOpSet<CFF1CSOpSet_Extents, ExtentsParam, CFF1
Bounds base_bounds, accent_bounds;
if (likely (!env.in_seac && base && accent
&& _get_bounds (param.cff, base, base_bounds, true)
&& _get_bounds (param.cff, accent, accent_bounds, true)))
&& _get_bounds (param.cff, base, base_bounds, true)
&& _get_bounds (param.cff, accent, accent_bounds, true)))
{
param.bounds.merge (base_bounds);
accent_bounds.offset (delta);
......
此差异已折叠。
......@@ -96,8 +96,8 @@ struct CFF2PathProcs_Extents : PathProcs<CFF2PathProcs_Extents, CFF2CSInterpEnv,
struct CFF2CSOpSet_Extents : CFF2CSOpSet<CFF2CSOpSet_Extents, ExtentsParam, CFF2PathProcs_Extents> {};
bool OT::cff2::accelerator_t::get_extents (hb_font_t *font,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const
{
if (unlikely (!is_valid () || (glyph >= num_glyphs))) return false;
......
......@@ -56,11 +56,11 @@ struct CFF2FDSelect
TRACE_SANITIZE (this);
return_trace (likely (c->check_struct (this) && (format == 0 || format == 3 || format == 4) &&
(format == 0)?
u.format0.sanitize (c, fdcount):
((format == 3)?
u.format3.sanitize (c, fdcount):
u.format4.sanitize (c, fdcount))));
(format == 0)?
u.format0.sanitize (c, fdcount):
((format == 3)?
u.format3.sanitize (c, fdcount):
u.format4.sanitize (c, fdcount))));
}
inline bool serialize (hb_serialize_context_t *c, const CFF2FDSelect &src, unsigned int num_glyphs)
......@@ -130,7 +130,7 @@ struct CFF2VariationStore
inline unsigned int get_size (void) const { return HBUINT16::static_size + size; }
HBUINT16 size;
HBUINT16 size;
VariationStore varStore;
DEFINE_SIZE_MIN (2 + VariationStore::min_size);
......@@ -158,13 +158,13 @@ struct CFF2TopDictValues : TopDictValues<>
OpCode op = get_value (i).op;
switch (op)
{
case OpCode_vstore:
case OpCode_FDSelect:
size += OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (op);
break;
default:
size += TopDictValues<>::calculate_serialized_op_size (get_value (i));
break;
case OpCode_vstore:
case OpCode_FDSelect:
size += OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (op);
break;
default:
size += TopDictValues<>::calculate_serialized_op_size (get_value (i));
break;
}
}
return size;
......@@ -180,27 +180,27 @@ struct CFF2TopDictOpSet : TopDictOpSet<>
{
switch (op) {
case OpCode_FontMatrix:
{
DictVal val;
val.init ();
dictval.add_op (op, env.substr);
env.clear_args ();
}
break;
{
DictVal val;
val.init ();
dictval.add_op (op, env.substr);
env.clear_args ();
}
break;
case OpCode_vstore:
dictval.vstoreOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.vstoreOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
case OpCode_FDSelect:
dictval.FDSelectOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.FDSelectOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
default:
SUPER::process_op (op, env, dictval);
/* Record this operand below if stack is empty, otherwise done */
if (!env.argStack.is_empty ()) return;
SUPER::process_op (op, env, dictval);
/* Record this operand below if stack is empty, otherwise done */
if (!env.argStack.is_empty ()) return;
}
if (unlikely (env.in_error ())) return;
......@@ -233,15 +233,15 @@ struct CFF2FontDictOpSet : DictOpSet
{
switch (op) {
case OpCode_Private:
dictval.privateDictInfo.offset = env.argStack.pop_uint ();
dictval.privateDictInfo.size = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.privateDictInfo.offset = env.argStack.pop_uint ();
dictval.privateDictInfo.size = env.argStack.pop_uint ();
env.clear_args ();
break;
default:
SUPER::process_op (op, env);
if (!env.argStack.is_empty ())
return;
SUPER::process_op (op, env);
if (!env.argStack.is_empty ())
return;
}
if (unlikely (env.in_error ())) return;
......@@ -274,9 +274,9 @@ struct CFF2PrivateDictValues_Base : DictValues<VAL>
unsigned int size = 0;
for (unsigned int i = 0; i < DictValues<VAL>::get_count; i++)
if (DictValues<VAL>::get_value (i).op == OpCode_Subrs)
size += OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Subrs);
size += OpCode_Size (OpCode_shortint) + 2 + OpCode_Size (OpCode_Subrs);
else
size += DictValues<VAL>::get_value (i).str.len;
size += DictValues<VAL>::get_value (i).str.len;
return size;
}
......@@ -307,11 +307,11 @@ struct CFF2PrivDictInterpEnv : NumInterpEnv
}
inline unsigned int get_ivs (void) const { return ivs; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
inline void set_ivs (unsigned int ivs_) { ivs = ivs_; }
protected:
unsigned int ivs;
bool seen_vsindex;
bool seen_vsindex;
};
struct CFF2PrivateDictOpSet : DictOpSet
......@@ -329,33 +329,33 @@ struct CFF2PrivateDictOpSet : DictOpSet
case OpCode_BlueFuzz:
case OpCode_ExpansionFactor:
case OpCode_LanguageGroup:
val.single_val = env.argStack.pop_num ();
env.clear_args ();
break;
val.single_val = env.argStack.pop_num ();
env.clear_args ();
break;
case OpCode_BlueValues:
case OpCode_OtherBlues:
case OpCode_FamilyBlues:
case OpCode_FamilyOtherBlues:
case OpCode_StemSnapH:
case OpCode_StemSnapV:
env.clear_args ();
break;
env.clear_args ();
break;
case OpCode_Subrs:
dictval.subrsOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.subrsOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
case OpCode_vsindexdict:
env.process_vsindex ();
dictval.ivs = env.get_ivs ();
env.clear_args ();
break;
env.process_vsindex ();
dictval.ivs = env.get_ivs ();
env.clear_args ();
break;
case OpCode_blenddict:
break;
break;
default:
DictOpSet::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
DictOpSet::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
}
if (unlikely (env.in_error ())) return;
......@@ -382,22 +382,22 @@ struct CFF2PrivateDictOpSet_Subset : DictOpSet
case OpCode_StemSnapV:
case OpCode_LanguageGroup:
case OpCode_ExpansionFactor:
env.clear_args ();
break;
env.clear_args ();
break;
case OpCode_blenddict:
env.clear_args ();
return;
env.clear_args ();
return;
case OpCode_Subrs:
dictval.subrsOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
dictval.subrsOffset = env.argStack.pop_uint ();
env.clear_args ();
break;
default:
SUPER::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
SUPER::process_op (op, env);
if (!env.argStack.is_empty ()) return;
break;
}
if (unlikely (env.in_error ())) return;
......@@ -420,13 +420,13 @@ using namespace CFF;
struct cff2
{
static const hb_tag_t tableTag = HB_OT_TAG_cff2;
static const hb_tag_t tableTag = HB_OT_TAG_cff2;
inline bool sanitize (hb_sanitize_context_t *c) const
{
TRACE_SANITIZE (this);
return_trace (c->check_struct (this) &&
likely (version.major == 2));
likely (version.major == 2));
}
template <typename PRIVOPSET, typename PRIVDICTVAL>
......@@ -450,12 +450,12 @@ struct cff2
{ fini (); return; }
{ /* parse top dict */
ByteStr topDictStr (cff2 + cff2->topDict, cff2->topDictSize);
if (unlikely (!topDictStr.sanitize (&sc))) { fini (); return; }
CFF2TopDict_Interpreter top_interp;
top_interp.env.init (topDictStr);
topDict.init ();
if (unlikely (!top_interp.interpret (topDict))) { fini (); return; }
ByteStr topDictStr (cff2 + cff2->topDict, cff2->topDictSize);
if (unlikely (!topDictStr.sanitize (&sc))) { fini (); return; }
CFF2TopDict_Interpreter top_interp;
top_interp.env.init (topDictStr);
topDict.init ();
if (unlikely (!top_interp.interpret (topDict))) { fini (); return; }
}
globalSubrs = &StructAtOffset<CFF2Subrs> (cff2, cff2->topDict + cff2->topDictSize);
......@@ -465,9 +465,9 @@ struct cff2
fdSelect = &StructAtOffsetOrNull<CFF2FDSelect> (cff2, topDict.FDSelectOffset);
if (((varStore != &Null(CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) ||
(charStrings == &Null(CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) ||
(fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
(((fdSelect != &Null(CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count)))))
(charStrings == &Null(CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) ||
(fdArray == &Null(CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
(((fdSelect != &Null(CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count)))))
{ fini (); return; }
num_glyphs = charStrings->count;
......@@ -480,26 +480,26 @@ struct cff2
/* parse font dicts and gather private dicts */
for (unsigned int i = 0; i < fdCount; i++)
{
const ByteStr fontDictStr = (*fdArray)[i];
if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; }
CFF2FontDictValues *font;
CFF2FontDict_Interpreter font_interp;
font_interp.env.init (fontDictStr);
font = fontDicts.push ();
font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
const ByteStr privDictStr (StructAtOffsetOrNull<UnsizedByteStr> (cff2, font->privateDictInfo.offset), font->privateDictInfo.size);
if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; }
DictInterpreter<PRIVOPSET, PRIVDICTVAL, CFF2PrivDictInterpEnv> priv_interp;
priv_interp.env.init(privDictStr);
privateDicts[i].init ();
if (unlikely (!priv_interp.interpret (privateDicts[i]))) { fini (); return; }
privateDicts[i].localSubrs = &StructAtOffsetOrNull<CFF2Subrs> (privDictStr.str, privateDicts[i].subrsOffset);
if (privateDicts[i].localSubrs != &Null(CFF2Subrs) &&
unlikely (!privateDicts[i].localSubrs->sanitize (&sc)))
{ fini (); return; }
const ByteStr fontDictStr = (*fdArray)[i];
if (unlikely (!fontDictStr.sanitize (&sc))) { fini (); return; }
CFF2FontDictValues *font;
CFF2FontDict_Interpreter font_interp;
font_interp.env.init (fontDictStr);
font = fontDicts.push ();
font->init ();
if (unlikely (!font_interp.interpret (*font))) { fini (); return; }
const ByteStr privDictStr (StructAtOffsetOrNull<UnsizedByteStr> (cff2, font->privateDictInfo.offset), font->privateDictInfo.size);
if (unlikely (!privDictStr.sanitize (&sc))) { fini (); return; }
DictInterpreter<PRIVOPSET, PRIVDICTVAL, CFF2PrivDictInterpEnv> priv_interp;
priv_interp.env.init(privDictStr);
privateDicts[i].init ();
if (unlikely (!priv_interp.interpret (privateDicts[i]))) { fini (); return; }
privateDicts[i].localSubrs = &StructAtOffsetOrNull<CFF2Subrs> (privDictStr.str, privateDicts[i].subrsOffset);
if (privateDicts[i].localSubrs != &Null(CFF2Subrs) &&
unlikely (!privateDicts[i].localSubrs->sanitize (&sc)))
{ fini (); return; }
}
}
......@@ -515,29 +515,29 @@ struct cff2
inline bool is_valid (void) const { return blob != nullptr; }
protected:
hb_blob_t *blob;
hb_blob_t *blob;
hb_sanitize_context_t sc;
public:
CFF2TopDictValues topDict;
const CFF2Subrs *globalSubrs;
CFF2TopDictValues topDict;
const CFF2Subrs *globalSubrs;
const CFF2VariationStore *varStore;
const CFF2CharStrings *charStrings;
const CFF2FDArray *fdArray;
const CFF2FDSelect *fdSelect;
unsigned int fdCount;
const CFF2FDArray *fdArray;
const CFF2FDSelect *fdSelect;
unsigned int fdCount;
hb_vector_t<CFF2FontDictValues> fontDicts;
hb_vector_t<PRIVDICTVAL> privateDicts;
unsigned int num_glyphs;
unsigned int num_glyphs;
};
struct accelerator_t : accelerator_templ_t<CFF2PrivateDictOpSet, CFF2PrivateDictValues>
{
HB_INTERNAL bool get_extents (hb_font_t *font,
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const;
hb_codepoint_t glyph,
hb_glyph_extents_t *extents) const;
};
typedef accelerator_templ_t<CFF2PrivateDictOpSet_Subset, CFF2PrivateDictValues_Subset> accelerator_subset_t;
......@@ -561,9 +561,9 @@ struct cff2
}
public:
FixedVersion<HBUINT8> version; /* Version of CFF2 table. set to 0x0200u */
FixedVersion<HBUINT8> version; /* Version of CFF2 table. set to 0x0200u */
OffsetTo<TopDict, HBUINT8, false> topDict; /* headerSize = Offset to Top DICT. */
HBUINT16 topDictSize; /* Top DICT size */
HBUINT16 topDictSize; /* Top DICT size */
public:
DEFINE_SIZE_STATIC (5);
......
......@@ -44,13 +44,13 @@ using namespace CFF;
bool
hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs,
unsigned int fdCount,
const FDSelect &src, /* IN */
unsigned int &subset_fd_count /* OUT */,
unsigned int &subset_fdselect_size /* OUT */,
unsigned int &subset_fdselect_format /* OUT */,
hb_vector_t<code_pair> &fdselect_ranges /* OUT */,
Remap &fdmap /* OUT */)
unsigned int fdCount,
const FDSelect &src, /* IN */
unsigned int &subset_fd_count /* OUT */,
unsigned int &subset_fdselect_size /* OUT */,
unsigned int &subset_fdselect_format /* OUT */,
hb_vector_t<code_pair> &fdselect_ranges /* OUT */,
Remap &fdmap /* OUT */)
{
subset_fd_count = 0;
subset_fdselect_size = 0;
......@@ -74,10 +74,10 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs,
if (fd != prev_fd)
{
num_ranges++;
prev_fd = fd;
code_pair pair = { fd, i };
fdselect_ranges.push (pair);
num_ranges++;
prev_fd = fd;
code_pair pair = { fd, i };
fdselect_ranges.push (pair);
}
}
......@@ -93,13 +93,13 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs,
/* create a fdmap */
if (!fdmap.reset (fdCount))
{
hb_set_destroy (set);
return false;
hb_set_destroy (set);
return false;
}
hb_codepoint_t fd = CFF_UNDEF_CODE;
while (set->next (&fd))
fdmap.add (fd);
fdmap.add (fd);
assert (fdmap.get_count () == subset_fd_count);
hb_set_destroy (set);
}
......@@ -143,10 +143,10 @@ hb_plan_subset_cff_fdselect (const hb_vector_t<hb_codepoint_t> &glyphs,
template <typename FDSELECT3_4>
static inline bool
serialize_fdselect_3_4 (hb_serialize_context_t *c,
const unsigned int num_glyphs,
const FDSelect &src,
unsigned int size,
const hb_vector_t<code_pair> &fdselect_ranges)
const unsigned int num_glyphs,
const FDSelect &src,
unsigned int size,
const hb_vector_t<code_pair> &fdselect_ranges)
{
TRACE_SERIALIZE (this);
FDSELECT3_4 *p = c->allocate_size<FDSELECT3_4> (size);
......@@ -167,12 +167,12 @@ serialize_fdselect_3_4 (hb_serialize_context_t *c,
**/
bool
hb_serialize_cff_fdselect (hb_serialize_context_t *c,
const unsigned int num_glyphs,
const FDSelect &src,
unsigned int fd_count,
unsigned int fdselect_format,
unsigned int size,
const hb_vector_t<code_pair> &fdselect_ranges)
const unsigned int num_glyphs,
const FDSelect &src,
unsigned int fd_count,
unsigned int fdselect_format,
unsigned int size,
const hb_vector_t<code_pair> &fdselect_ranges)
{
TRACE_SERIALIZE (this);
FDSelect *p = c->allocate_min<FDSelect> ();
......@@ -191,12 +191,12 @@ hb_serialize_cff_fdselect (hb_serialize_context_t *c,
unsigned int fd = fdselect_ranges[range_index++].code;
for (unsigned int i = 0; i < num_glyphs; i++)
{
if ((range_index < fdselect_ranges.len) &&
(i >= fdselect_ranges[range_index].glyph))
{
fd = fdselect_ranges[range_index++].code;
}
p->fds[i].set (fd);
if ((range_index < fdselect_ranges.len) &&
(i >= fdselect_ranges[range_index].glyph))
{
fd = fdselect_ranges[range_index++].code;
}
p->fds[i].set (fd);
}
break;
}
......@@ -204,17 +204,17 @@ hb_serialize_cff_fdselect (hb_serialize_context_t *c,
case 3:
return serialize_fdselect_3_4<FDSelect3> (c,
num_glyphs,
src,
size,
fdselect_ranges);
num_glyphs,
src,
size,
fdselect_ranges);
case 4:
return serialize_fdselect_3_4<FDSelect4> (c,
num_glyphs,
src,
size,
fdselect_ranges);
num_glyphs,
src,
size,
fdselect_ranges);
default:
assert(false);
......
此差异已折叠。
此差异已折叠。
......@@ -33,6 +33,6 @@
HB_INTERNAL bool
hb_subset_cff1 (hb_subset_plan_t *plan,
hb_blob_t **cff_prime /* OUT */);
hb_blob_t **cff_prime /* OUT */);
#endif /* HB_SUBSET_CFF1_HH */
......@@ -47,18 +47,18 @@ struct CFF2SubTableOffsets : CFFSubTableOffsets
struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<>
{
inline bool serialize (hb_serialize_context_t *c,
const OpStr &opstr,
const CFF2SubTableOffsets &offsets) const
const OpStr &opstr,
const CFF2SubTableOffsets &offsets) const
{
TRACE_SERIALIZE (this);
switch (opstr.op)
{
case OpCode_vstore:
return_trace (FontDict::serialize_offset4_op(c, opstr.op, offsets.varStoreOffset));
return_trace (FontDict::serialize_offset4_op(c, opstr.op, offsets.varStoreOffset));
default:
return_trace (CFFTopDict_OpSerializer<>::serialize (c, opstr, offsets));
return_trace (CFFTopDict_OpSerializer<>::serialize (c, opstr, offsets));
}
}
......@@ -67,10 +67,10 @@ struct CFF2TopDict_OpSerializer : CFFTopDict_OpSerializer<>
switch (opstr.op)
{
case OpCode_vstore:
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op);
return OpCode_Size (OpCode_longintdict) + 4 + OpCode_Size (opstr.op);
default:
return CFFTopDict_OpSerializer<>::calculate_serialized_size (opstr);
return CFFTopDict_OpSerializer<>::calculate_serialized_size (opstr);
}
}
};
......@@ -83,8 +83,8 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
{
case OpCode_return:
case OpCode_endchar:
/* dummy opcodes in CFF2. ignore */
break;
/* dummy opcodes in CFF2. ignore */
break;
case OpCode_hstem:
case OpCode_hstemhm:
......@@ -92,16 +92,16 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
case OpCode_vstemhm:
case OpCode_hintmask:
case OpCode_cntrmask:
if (param.drop_hints)
{
env.clear_args ();
return;
}
HB_FALLTHROUGH;
if (param.drop_hints)
{
env.clear_args ();
return;
}
HB_FALLTHROUGH;
default:
SUPER::flush_args_and_op (op, env, param);
break;
SUPER::flush_args_and_op (op, env, param);
break;
}
}
......@@ -112,15 +112,15 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
const BlendArg &arg = env.argStack[i];
if (arg.blending ())
{
assert ((arg.numValues > 0) && (env.argStack.get_count () >= arg.numValues));
flatten_blends (arg, i, env, param);
i += arg.numValues;
assert ((arg.numValues > 0) && (env.argStack.get_count () >= arg.numValues));
flatten_blends (arg, i, env, param);
i += arg.numValues;
}
else
{
StrEncoder encoder (param.flatStr);
encoder.encode_num (arg);
i++;
StrEncoder encoder (param.flatStr);
encoder.encode_num (arg);
i++;
}
}
SUPER::flush_args (env, param);
......@@ -134,7 +134,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
{
const BlendArg &arg1 = env.argStack[i + j];
assert (arg1.blending () && (arg.numValues == arg1.numValues) && (arg1.valueIndex == j) &&
(arg1.deltas.len == env.get_region_count ()));
(arg1.deltas.len == env.get_region_count ()));
encoder.encode_num (arg1);
}
/* flatten deltas for each value */
......@@ -142,7 +142,7 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
{
const BlendArg &arg1 = env.argStack[i + j];
for (unsigned int k = 0; k < arg1.deltas.len; k++)
encoder.encode_num (arg1.deltas[k]);
encoder.encode_num (arg1.deltas[k]);
}
/* flatten the number of values followed by blend operator */
encoder.encode_int (arg.numValues);
......@@ -155,10 +155,10 @@ struct CFF2CSOpSet_Flatten : CFF2CSOpSet<CFF2CSOpSet_Flatten, FlattenParam>
{
case OpCode_return:
case OpCode_endchar:
return;
return;
default:
StrEncoder encoder (param.flatStr);
encoder.encode_op (op);
StrEncoder encoder (param.flatStr);
encoder.encode_op (op);
}
}
......@@ -174,35 +174,35 @@ struct CFF2CSOpSet_SubrSubset : CFF2CSOpSet<CFF2CSOpSet_SubrSubset, SubrSubsetPa
switch (op) {
case OpCode_return:
param.current_parsed_str->set_parsed ();
env.returnFromSubr ();
param.set_current_str (env);
break;
param.current_parsed_str->set_parsed ();
env.returnFromSubr ();
param.set_current_str (env);
break;
case OpCode_endchar:
param.current_parsed_str->set_parsed ();
SUPER::process_op (op, env, param);
break;
param.current_parsed_str->set_parsed ();
SUPER::process_op (op, env, param);
break;
case OpCode_callsubr:
process_call_subr (op, CSType_LocalSubr, env, param, env.localSubrs, param.local_closure);
break;
process_call_subr (op, CSType_LocalSubr, env, param, env.localSubrs, param.local_closure);
break;
case OpCode_callgsubr:
process_call_subr (op, CSType_GlobalSubr, env, param, env.globalSubrs, param.global_closure);
break;
process_call_subr (op, CSType_GlobalSubr, env, param, env.globalSubrs, param.global_closure);
break;
default:
SUPER::process_op (op, env, param);
param.current_parsed_str->add_op (op, env.substr);
break;
SUPER::process_op (op, env, param);
param.current_parsed_str->add_op (op, env.substr);
break;
}
}
protected:
static inline void process_call_subr (OpCode op, CSType type,
CFF2CSInterpEnv &env, SubrSubsetParam& param,
CFF2BiasedSubrs& subrs, hb_set_t *closure)
CFF2CSInterpEnv &env, SubrSubsetParam& param,
CFF2BiasedSubrs& subrs, hb_set_t *closure)
{
SubByteStr substr = env.substr;
env.callSubr (subrs, type);
......@@ -257,7 +257,7 @@ struct cff2_subset_plan {
}
inline bool create (const OT::cff2::accelerator_subset_t &acc,
hb_subset_plan_t *plan)
hb_subset_plan_t *plan)
{
final_size = 0;
orig_fdcount = acc.fdArray->count;
......@@ -279,9 +279,9 @@ struct cff2_subset_plan {
{
/* Flatten global & local subrs */
SubrFlattener<const OT::cff2::accelerator_subset_t, CFF2CSInterpEnv, CFF2CSOpSet_Flatten>
flattener(acc, plan->glyphs, plan->drop_hints);
flattener(acc, plan->glyphs, plan->drop_hints);
if (!flattener.flatten (subset_charstrings))
return false;
return false;
/* no global/local subroutines */
offsets.globalSubrsInfo.size = CFF2Subrs::calculate_serialized_size (1, 0, 0);
......@@ -290,14 +290,14 @@ struct cff2_subset_plan {
{
/* Subset subrs: collect used subroutines, leaving all unused ones behind */
if (!subr_subsetter.subset (acc, plan->glyphs, plan->drop_hints))
return false;
return false;
/* encode charstrings, global subrs, local subrs with new subroutine numbers */
if (!subr_subsetter.encode_charstrings (acc, plan->glyphs, subset_charstrings))
return false;
return false;
if (!subr_subsetter.encode_globalsubrs (subset_globalsubrs))
return false;
return false;
/* global subrs */
unsigned int dataSize = subset_globalsubrs.total_size ();
......@@ -306,26 +306,26 @@ struct cff2_subset_plan {
/* local subrs */
if (!offsets.localSubrsInfos.resize (orig_fdcount))
return false;
return false;
if (!subset_localsubrs.resize (orig_fdcount))
return false;
return false;
for (unsigned int fd = 0; fd < orig_fdcount; fd++)
{
subset_localsubrs[fd].init ();
offsets.localSubrsInfos[fd].init ();
if (fdmap.includes (fd))
{
if (!subr_subsetter.encode_localsubrs (fd, subset_localsubrs[fd]))
return false;
unsigned int dataSize = subset_localsubrs[fd].total_size ();
if (dataSize > 0)
{
offsets.localSubrsInfos[fd].offset = final_size;
offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize);
offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].len, dataSize);
}
}
subset_localsubrs[fd].init ();
offsets.localSubrsInfos[fd].init ();
if (fdmap.includes (fd))
{
if (!subr_subsetter.encode_localsubrs (fd, subset_localsubrs[fd]))
return false;
unsigned int dataSize = subset_localsubrs[fd].total_size ();
if (dataSize > 0)
{
offsets.localSubrsInfos[fd].offset = final_size;
offsets.localSubrsInfos[fd].offSize = calcOffSize (dataSize);
offsets.localSubrsInfos[fd].size = CFF2Subrs::calculate_serialized_size (offsets.localSubrsInfos[fd].offSize, subset_localsubrs[fd].len, dataSize);
}
}
}
}
......@@ -345,14 +345,14 @@ struct cff2_subset_plan {
{
offsets.FDSelectInfo.offset = final_size;
if (unlikely (!hb_plan_subset_cff_fdselect (plan->glyphs,
orig_fdcount,
*(const FDSelect *)acc.fdSelect,
subset_fdcount,
offsets.FDSelectInfo.size,
subset_fdselect_format,
subset_fdselect_ranges,
fdmap)))
return false;
orig_fdcount,
*(const FDSelect *)acc.fdSelect,
subset_fdcount,
offsets.FDSelectInfo.size,
subset_fdselect_format,
subset_fdselect_ranges,
fdmap)))
return false;
final_size += offsets.FDSelectInfo.size;
}
......@@ -365,8 +365,8 @@ struct cff2_subset_plan {
CFFFontDict_OpSerializer fontSzr;
unsigned int dictsSize = 0;
for (unsigned int i = 0; i < acc.fontDicts.len; i++)
if (fdmap.includes (i))
dictsSize += FontDict::calculate_serialized_size (acc.fontDicts[i], fontSzr);
if (fdmap.includes (i))
dictsSize += FontDict::calculate_serialized_size (acc.fontDicts[i], fontSzr);
offsets.FDArrayInfo.offSize = calcOffSize (dictsSize);
final_size += CFF2Index::calculate_serialized_size (offsets.FDArrayInfo.offSize, subset_fdcount, dictsSize);
......@@ -386,18 +386,18 @@ struct cff2_subset_plan {
{
if (fdmap.includes (i))
{
bool has_localsubrs = offsets.localSubrsInfos[i].size > 0;
CFFPrivateDict_OpSerializer privSzr (desubroutinize, drop_hints);
unsigned int priv_size = PrivateDict::calculate_serialized_size (acc.privateDicts[i], privSzr, has_localsubrs);
TableInfo privInfo = { final_size, priv_size, 0 };
privateDictInfos.push (privInfo);
final_size += privInfo.size;
if (!plan->desubroutinize && has_localsubrs)
{
offsets.localSubrsInfos[i].offset = final_size;
final_size += offsets.localSubrsInfos[i].size;
}
bool has_localsubrs = offsets.localSubrsInfos[i].size > 0;
CFFPrivateDict_OpSerializer privSzr (desubroutinize, drop_hints);
unsigned int priv_size = PrivateDict::calculate_serialized_size (acc.privateDicts[i], privSzr, has_localsubrs);
TableInfo privInfo = { final_size, priv_size, 0 };
privateDictInfos.push (privInfo);
final_size += privInfo.size;
if (!plan->desubroutinize && has_localsubrs)
{
offsets.localSubrsInfos[i].offset = final_size;
final_size += offsets.localSubrsInfos[i].size;
}
}
}
......@@ -406,7 +406,7 @@ struct cff2_subset_plan {
inline unsigned int get_final_size (void) const { return final_size; }
unsigned int final_size;
unsigned int final_size;
CFF2SubTableOffsets offsets;
unsigned int orig_fdcount;
......@@ -416,21 +416,21 @@ struct cff2_subset_plan {
Remap fdmap;
StrBuffArray subset_charstrings;
StrBuffArray subset_globalsubrs;
StrBuffArray subset_charstrings;
StrBuffArray subset_globalsubrs;
hb_vector_t<StrBuffArray> subset_localsubrs;
hb_vector_t<TableInfo> privateDictInfos;
bool drop_hints;
bool desubroutinize;
bool drop_hints;
bool desubroutinize;
CFF2SubrSubsetter subr_subsetter;
};
static inline bool _write_cff2 (const cff2_subset_plan &plan,
const OT::cff2::accelerator_subset_t &acc,
const hb_vector_t<hb_codepoint_t>& glyphs,
unsigned int dest_sz,
void *dest)
const OT::cff2::accelerator_subset_t &acc,
const hb_vector_t<hb_codepoint_t>& glyphs,
unsigned int dest_sz,
void *dest)
{
hb_serialize_context_t c (dest, dest_sz);
......@@ -486,8 +486,8 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
assert (plan.offsets.FDSelectInfo.offset == c.head - c.start);
if (unlikely (!hb_serialize_cff_fdselect (&c, glyphs.len, *(const FDSelect *)acc.fdSelect, acc.fdArray->count,
plan.subset_fdselect_format, plan.offsets.FDSelectInfo.size,
plan.subset_fdselect_ranges)))
plan.subset_fdselect_format, plan.offsets.FDSelectInfo.size,
plan.subset_fdselect_ranges)))
{
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 subset FDSelect");
return false;
......@@ -501,8 +501,8 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
if (unlikely (fda == nullptr)) return false;
CFFFontDict_OpSerializer fontSzr;
if (unlikely (!fda->serialize (&c, plan.offsets.FDArrayInfo.offSize,
acc.fontDicts, plan.subset_fdcount, plan.fdmap,
fontSzr, plan.privateDictInfos)))
acc.fontDicts, plan.subset_fdcount, plan.fdmap,
fontSzr, plan.privateDictInfos)))
{
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF2 FDArray");
return false;
......@@ -537,18 +537,18 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
result = pd->serialize (&c, acc.privateDicts[i], privSzr, subroffset);
if (unlikely (!result))
{
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF Private Dict[%d]", i);
return false;
DEBUG_MSG (SUBSET, nullptr, "failed to serialize CFF Private Dict[%d]", i);
return false;
}
if (plan.offsets.localSubrsInfos[i].size > 0)
{
CFF2Subrs *dest = c.start_embed <CFF2Subrs> ();
if (unlikely (dest == nullptr)) return false;
if (unlikely (!dest->serialize (&c, plan.offsets.localSubrsInfos[i].offSize, plan.subset_localsubrs[i])))
{
DEBUG_MSG (SUBSET, nullptr, "failed to serialize local subroutines");
return false;
}
CFF2Subrs *dest = c.start_embed <CFF2Subrs> ();
if (unlikely (dest == nullptr)) return false;
if (unlikely (!dest->serialize (&c, plan.offsets.localSubrsInfos[i].offSize, plan.subset_localsubrs[i])))
{
DEBUG_MSG (SUBSET, nullptr, "failed to serialize local subroutines");
return false;
}
}
}
}
......@@ -561,9 +561,9 @@ static inline bool _write_cff2 (const cff2_subset_plan &plan,
static bool
_hb_subset_cff2 (const OT::cff2::accelerator_subset_t &acc,
const char *data,
hb_subset_plan_t *plan,
hb_blob_t **prime /* OUT */)
const char *data,
hb_subset_plan_t *plan,
hb_blob_t **prime /* OUT */)
{
cff2_subset_plan cff2_plan;
......@@ -577,17 +577,17 @@ _hb_subset_cff2 (const OT::cff2::accelerator_subset_t &acc,
char *cff2_prime_data = (char *) calloc (1, cff2_prime_size);
if (unlikely (!_write_cff2 (cff2_plan, acc, plan->glyphs,
cff2_prime_size, cff2_prime_data))) {
cff2_prime_size, cff2_prime_data))) {
DEBUG_MSG(SUBSET, nullptr, "Failed to write a subset cff2.");
free (cff2_prime_data);
return false;
}
*prime = hb_blob_create (cff2_prime_data,
cff2_prime_size,
HB_MEMORY_MODE_READONLY,
cff2_prime_data,
free);
cff2_prime_size,
HB_MEMORY_MODE_READONLY,
cff2_prime_data,
free);
return true;
}
......@@ -599,7 +599,7 @@ _hb_subset_cff2 (const OT::cff2::accelerator_subset_t &acc,
**/
bool
hb_subset_cff2 (hb_subset_plan_t *plan,
hb_blob_t **prime /* OUT */)
hb_blob_t **prime /* OUT */)
{
hb_blob_t *cff2_blob = hb_sanitize_context_t().reference_table<CFF::cff2> (plan->source);
const char *data = hb_blob_get_data(cff2_blob, nullptr);
......@@ -607,7 +607,7 @@ hb_subset_cff2 (hb_subset_plan_t *plan,
OT::cff2::accelerator_subset_t acc;
acc.init(plan->source);
bool result = likely (acc.is_valid ()) &&
_hb_subset_cff2 (acc, data, plan, prime);
_hb_subset_cff2 (acc, data, plan, prime);
hb_blob_destroy (cff2_blob);
acc.fini ();
......
......@@ -33,6 +33,6 @@
HB_INTERNAL bool
hb_subset_cff2 (hb_subset_plan_t *plan,
hb_blob_t **cff2_prime /* OUT */);
hb_blob_t **cff2_prime /* OUT */);
#endif /* HB_SUBSET_CFF2_HH */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册