[instancer] update head table flagbit: allXMinIsLsb
diff --git a/src/OT/glyf/Glyph.hh b/src/OT/glyf/Glyph.hh
index 826cc1c..9c2ce9a 100644
--- a/src/OT/glyf/Glyph.hh
+++ b/src/OT/glyf/Glyph.hh
@@ -104,6 +104,9 @@
     if (hori_aw < 0) hori_aw = 0;
     int lsb = roundf (xMin - leftSideX);
     plan->hmtx_map.set (new_gid, hb_pair ((unsigned) hori_aw, lsb));
+    //flag value should be computed using non-empty glyphs
+    if (type != EMPTY && lsb != xMin)
+      plan->head_maxp_info.allXMinIsLsb = false;
 
     signed vert_aw = roundf (topSideY - bottomSideY);
     if (vert_aw < 0) vert_aw = 0;
diff --git a/src/OT/glyf/glyf-helpers.hh b/src/OT/glyf/glyf-helpers.hh
index 7b4ba27..30106b2 100644
--- a/src/OT/glyf/glyf-helpers.hh
+++ b/src/OT/glyf/glyf-helpers.hh
@@ -50,6 +50,13 @@
     head_prime->xMax = plan->head_maxp_info.xMax;
     head_prime->yMin = plan->head_maxp_info.yMin;
     head_prime->yMax = plan->head_maxp_info.yMax;
+
+    unsigned orig_flag = head_prime->flags;
+    if (plan->head_maxp_info.allXMinIsLsb)
+      orig_flag |= 1 << 1;
+    else
+      orig_flag &= ~(1 << 1);
+    head_prime->flags = orig_flag;
   }
   bool success = plan->add_table (HB_OT_TAG_head, head_prime_blob);
 
diff --git a/src/hb-ot-head-table.hh b/src/hb-ot-head-table.hh
index c2dceb2..798e82d 100644
--- a/src/hb-ot-head-table.hh
+++ b/src/hb-ot-head-table.hh
@@ -97,6 +97,7 @@
 					 * entire font as HBUINT32, then store
 					 * 0xB1B0AFBAu - sum. */
   HBUINT32	magicNumber;		/* Set to 0x5F0F3CF5u. */
+  public:
   HBUINT16	flags;			/* Bit 0: Baseline for font at y=0;
 					 * Bit 1: Left sidebearing point at x=0;
 					 * Bit 2: Instructions may depend on point size;
@@ -141,6 +142,7 @@
 					 * encoded in the cmap subtables represent proper
 					 * support for those code points.
 					 * Bit 15: Reserved, set to 0. */
+  protected:
   HBUINT16	unitsPerEm;		/* Valid range is from 16 to 16384. This value
 					 * should be a power of 2 for fonts that have
 					 * TrueType outlines. */
diff --git a/src/hb-subset-plan.hh b/src/hb-subset-plan.hh
index c5db27c..c0a85e1 100644
--- a/src/hb-subset-plan.hh
+++ b/src/hb-subset-plan.hh
@@ -49,7 +49,8 @@
       maxCompositePoints (0),
       maxCompositeContours (0),
       maxComponentElements (0),
-      maxComponentDepth (0) {}
+      maxComponentDepth (0),
+      allXMinIsLsb (true) {}
 
   int xMin;
   int xMax;
@@ -61,6 +62,7 @@
   unsigned maxCompositeContours;
   unsigned maxComponentElements;
   unsigned maxComponentDepth;
+  bool allXMinIsLsb;
 };
 
 typedef struct head_maxp_info_t head_maxp_info_t;