[cmap] Rewrite set_for() slightly
This commit is contained in:
parent
9552955e08
commit
5dc12d7d8d
|
@ -1484,10 +1484,18 @@ struct SubtableUnicodesCache {
|
|||
|
||||
hb_set_t* set_for (const EncodingRecord* record)
|
||||
{
|
||||
if (!cached_unicodes.has ((intptr_t) record)) {
|
||||
if (unlikely (!cached_unicodes.set ((intptr_t) record, hb::unique_ptr<hb_set_t> {hb_set_create ()})))
|
||||
if (!cached_unicodes.has ((intptr_t) record))
|
||||
{
|
||||
hb_set_t *s = hb_set_create ();
|
||||
if (unlikely (s->in_error ()))
|
||||
return hb_set_get_empty ();
|
||||
(base+record->subtable).collect_unicodes (cached_unicodes.get ((intptr_t) record));
|
||||
|
||||
(base+record->subtable).collect_unicodes (s);
|
||||
|
||||
if (unlikely (!cached_unicodes.set ((intptr_t) record, hb::unique_ptr<hb_set_t> {s})))
|
||||
return hb_set_get_empty ();
|
||||
|
||||
return s;
|
||||
}
|
||||
return cached_unicodes.get ((intptr_t) record);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue