From 7c7db0fcba4513e5121f8a6ff74aaec634caa26a Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sun, 25 Jun 2023 19:07:40 -0600 Subject: [PATCH] [subset/cff1] Minor shuffle code around --- src/hb-subset-cff1.cc | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/hb-subset-cff1.cc b/src/hb-subset-cff1.cc index 327777825..eea3afb40 100644 --- a/src/hb-subset-cff1.cc +++ b/src/hb-subset-cff1.cc @@ -53,29 +53,27 @@ struct remap_sid_t unsigned int add (unsigned int sid) { - if ((sid != CFF_UNDEF_SID) && !is_std_std (sid)) + if (is_std_std (sid) || (sid == CFF_UNDEF_SID)) + return sid; + + sid = unoffset_sid (sid); + unsigned v = next; + if (map.set (sid, v, false)) { - sid = unoffset_sid (sid); - unsigned v = next; - if (map.set (sid, v, false)) - { - vector.push (sid); - next++; - } - else - v = map.get (sid); // already exists - return offset_sid (v); + vector.push (sid); + next++; } else - return sid; + v = map.get (sid); // already exists + return offset_sid (v); } unsigned int operator[] (unsigned int sid) const { if (is_std_std (sid) || (sid == CFF_UNDEF_SID)) return sid; - else - return offset_sid (map.get (unoffset_sid (sid))); + + return offset_sid (map.get (unoffset_sid (sid))); } static const unsigned int num_std_strings = 391;