From 0301e5be286f5080ec34e9f30c75e73f28d0218b Mon Sep 17 00:00:00 2001 From: Rod Sheeter Date: Mon, 12 Feb 2018 10:12:11 -0800 Subject: [PATCH] Build a working cmap format 12 --- src/hb-ot-cmap-table.hh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh index 030b822b0..c338371fd 100644 --- a/src/hb-ot-cmap-table.hh +++ b/src/hb-ot-cmap-table.hh @@ -573,18 +573,29 @@ struct cmap rec.platformID.set (3); // Windows rec.encodingID.set (1); // Unicode BMP - CmapSubtable &subtable = rec.subtable.serialize(&context, &rec.subtable); + /* capture offset to subtable */ + CmapSubtable &subtable = rec.subtable.serialize(&context, cmap); + subtable.u.format.set(12); CmapSubtableFormat12 &format12 = subtable.u.format12; + if (unlikely(!context.extend_min(format12))) + { + return false; + } + format12.format.set(12); format12.reservedZ.set(0); + format12.lengthZ.set(16 + 12 * groups.len); OT::Supplier group_supplier (&groups[0], groups.len, sizeof (CmapSubtableLongGroup)); if (unlikely(!format12.serialize(&context, groups.len, group_supplier))) + { return false; + } context.end_serialize (); + return true; }