diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh index 05b8c72d7..b43bd40a1 100644 --- a/src/hb-open-type.hh +++ b/src/hb-open-type.hh @@ -173,6 +173,9 @@ typedef Index NameID; template struct Offset : Type { + HB_DELETE_COPY_ASSIGN (Offset); + Offset () = default; + Offset& operator = (typename Type::type i) { Type::operator= (i); return *this; } typedef Type type; diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 08f186e8c..0a7d1ef67 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -904,7 +904,7 @@ struct cmap // Write out format 4 sub table { CmapSubtable &subtable = format4_plat0_rec.subtable.serialize (&c, table); - format4_plat3_rec.subtable = format4_plat0_rec.subtable; + format4_plat3_rec.subtable = (unsigned int) format4_plat0_rec.subtable; subtable.u.format = 4; CmapSubtableFormat4 &format4 = subtable.u.format4; diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index 8882efd68..b85d1226e 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -583,25 +583,25 @@ struct Feature * Adobe tools, only the 'size' feature had FeatureParams defined. */ - OffsetTo orig_offset = featureParams; + if (likely (featureParams.is_null ())) + return_trace (true); + + unsigned int orig_offset = featureParams; if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE))) return_trace (false); - if (likely (orig_offset.is_null ())) - return_trace (true); - if (featureParams == 0 && closure && closure->tag == HB_TAG ('s','i','z','e') && closure->list_base && closure->list_base < this) { - unsigned int new_offset_int = (unsigned int) orig_offset - + unsigned int new_offset_int = orig_offset - (((char *) this) - ((char *) closure->list_base)); OffsetTo new_offset; - /* Check that it did not overflow. */ + /* Check that it would not overflow. */ new_offset = new_offset_int; if (new_offset == new_offset_int && - c->try_set (&featureParams, new_offset) && + c->try_set (&featureParams, new_offset_int) && !featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)) return_trace (false); }