Move code around
[framework/uifw/harfbuzz.git] / src / hb-ot-head-private.hh
index a3e87a9..436666f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010  Red Hat, Inc.
+ * Copyright © 2010  Red Hat, Inc.
  *
  *  This is part of HarfBuzz, a text shaping library.
  *
@@ -42,12 +42,18 @@ struct head
 {
   static const hb_tag_t Tag    = HB_OT_TAG_head;
 
+  inline unsigned int get_upem (void) const {
+    unsigned int upem = unitsPerEm;
+    /* If no valid head table found, assume 1000, which matches typicaly Type1 usage. */
+    return 16 <= upem && upem <= 16384 ? upem : 1000;
+  }
+
   inline bool sanitize (hb_sanitize_context_t *c) {
     TRACE_SANITIZE ();
-    /* Shall we check for magicNumber here?  Who cares? */
     return c->check_struct (this) && likely (version.major == 1);
   }
 
+  private:
   FixedVersion version;                /* Version of the head table--currently
                                         * 0x00010000 for version 1.0. */
   FixedVersion fontRevision;           /* Set by font manufacturer. */
@@ -93,7 +99,13 @@ struct head
                                         *   for rendering should not be considered optimized
                                         *   for ClearType, and therefore should keep this bit
                                         *   cleared.
-                                        * Bit 14: Reserved, set to 0
+                                        * Bit 14: Last Resort font. If set, indicates that
+                                        * the glyphs encoded in the cmap subtables are simply
+                                        * generic symbolic representations of code point
+                                        * ranges and don’t truly represent support for those
+                                        * code points. If unset, indicates that the glyphs
+                                        * encoded in the cmap subtables represent proper
+                                        * support for those code points.
                                         * Bit 15: Reserved, set to 0. */
   USHORT       unitsPerEm;             /* Valid range is from 16 to 16384. This value
                                         * should be a power of 2 for fonts that have