[array] Add .copy()
diff --git a/src/hb-open-type.hh b/src/hb-open-type.hh
index 9d388ff..cacb1a7 100644
--- a/src/hb-open-type.hh
+++ b/src/hb-open-type.hh
@@ -436,9 +436,7 @@
   {
     TRACE_SERIALIZE (this);
     auto *out = c->start_embed (this);
-    if (unlikely (!out->serialize (c, count))) return_trace (nullptr);
-    for (unsigned i = 0; i < count; i++)
-      out->arrayZ[i] = arrayZ[i]; /* TODO: add version that calls c->copy() */
+    if (unlikely (!as_array (count).copy (c))) return_trace (nullptr);
     return_trace (out);
   }
 
@@ -618,9 +616,9 @@
     TRACE_SERIALIZE (this);
     auto *out = c->start_embed (this);
     unsigned count = len;
-    if (unlikely (!out->serialize (c, count))) return_trace (nullptr);
-    for (unsigned i = 0; i < count; i++)
-      out->arrayZ[i] = arrayZ[i]; /* TODO: add version that calls c->copy() */
+    if (unlikely (!c->extend_min (out))) return_trace (nullptr);
+    c->check_assign (out->len, len);
+    if (unlikely (!as_array ().copy (c))) return_trace (nullptr);
     return_trace (out);
   }