[instancer] match fonttools'r order when calculating chars

Also fix a bug, make sure map set is happening before std::move
This commit is contained in:
Qunxin Liu 2023-09-27 09:36:52 -07:00
parent f39e9bf1ed
commit f9b04b2145
2 changed files with 6 additions and 4 deletions

View file

@ -2323,8 +2323,9 @@ struct delta_row_encoding_t
bool long_words = false;
/* 0/1/2 byte encoding */
for (int v: row)
for (int i = row.length - 1; i >= 0; i--)
{
int v = row.arrayZ[i];
if (v == 0)
ret.push (0);
else if (v > 32767 || v < -32768)
@ -2343,8 +2344,9 @@ struct delta_row_encoding_t
/* redo, 0/2/4 bytes encoding */
ret.reset ();
for (int v: row)
for (int i = row.length - 1; i >= 0; i--)
{
int v = row.arrayZ[i];
if (v == 0)
ret.push (0);
else if (v > 32767 || v < -32768)

View file

@ -2039,10 +2039,10 @@ struct item_variations_t
}
else
{
if (!chars_idx_map.set (chars, encoding_objs.length))
return false;
delta_row_encoding_t obj (std::move (chars), &row);
encoding_objs.push (std::move (obj));
if (!chars_idx_map.set (chars, encoding_objs.length - 1))
return false;
}
}