Fix two TODOs

This commit is contained in:
Behdad Esfahbod 2019-04-24 10:01:30 -04:00
parent 11ab889a8d
commit 00a00bc1f2
1 changed files with 5 additions and 6 deletions

View File

@ -90,7 +90,7 @@ struct SingleSubstFormat1
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (*this))) return_trace (false); if (unlikely (!c->extend_min (*this))) return_trace (false);
if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs))) return_trace (false); if (unlikely (!coverage.serialize (c, this).serialize (c, glyphs))) return_trace (false);
deltaGlyphID = delta; /* TODO(serialize) overflow? */ c->propagate_error ((deltaGlyphID = delta) == delta);
return_trace (true); return_trace (true);
} }
@ -231,15 +231,14 @@ struct SingleSubst
{ {
TRACE_SERIALIZE (this); TRACE_SERIALIZE (this);
if (unlikely (!c->extend_min (u.format))) return_trace (false); if (unlikely (!c->extend_min (u.format))) return_trace (false);
unsigned int format = 2; unsigned format = 2;
int delta = 0; unsigned delta = 0;
if (glyphs.length) if (glyphs.length)
{ {
format = 1; format = 1;
/* TODO(serialize) check for wrap-around */ delta = (unsigned) (substitutes[0] - glyphs[0]) & 0xFFFF;
delta = substitutes[0] - glyphs[0];
for (unsigned int i = 1; i < glyphs.length; i++) for (unsigned int i = 1; i < glyphs.length; i++)
if (delta != (int) (substitutes[i] - glyphs[i])) { if (delta != ((unsigned) (substitutes[i] - glyphs[i]) & 0xFFFF)) {
format = 2; format = 2;
break; break;
} }