[subset/cff] Micro-optimize CFFIndex for empty strings

This commit is contained in:
Behdad Esfahbod 2023-06-06 16:21:14 -06:00
parent acae5ed25c
commit 35e152b9f4

View file

@ -73,8 +73,11 @@ struct CFFIndex
for (const auto &_ : +it)
{
auto it = hb_iter (_);
if (hb_len (it) == 1)
unsigned len = hb_len (it);
if (len <= 1)
{
if (!len)
continue;
unsigned char *ret = c->allocate_size<unsigned char> (1, false);
if (unlikely (!ret)) return_trace (false);
*ret = *it.arrayZ;