src/hb-open-type-private.hh |    3 ++-
 src/hb-ot-cmap-table.hh     |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 1 deletion(-)

New commits:
commit c95587618c88d187be64f923033dae151cf820be
Author: Behdad Esfahbod <[email protected]>
Date:   Wed May 14 00:42:18 2014 -0400

    [ot] Minor note re cmap subtable format 2 and 8

diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 73734a6..b0f01e1 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -272,6 +272,8 @@ struct CmapSubtableFormat13 : 
CmapSubtableLongSegmented<CmapSubtableFormat13>
 
 struct CmapSubtable
 {
+  /* Note: We intentionally do NOT implement subtable formats 2 and 8. */
+
   inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
   {
     switch (u.format) {
commit b7878cd58ea9a67236e1e0228c35b5b03ec4ff9c
Author: Behdad Esfahbod <[email protected]>
Date:   Tue May 13 21:47:51 2014 -0400

    [ot] Implement cmap subtable format 0

diff --git a/src/hb-open-type-private.hh b/src/hb-open-type-private.hh
index d9be744..965d4d7 100644
--- a/src/hb-open-type-private.hh
+++ b/src/hb-open-type-private.hh
@@ -132,7 +132,7 @@ static inline Type& StructAfter(TObject &X)
 
 /* Global nul-content Null pool.  Enlarge as necessary. */
 /* TODO This really should be a extern HB_INTERNAL and defined somewhere... */
-static const void *_NullPool[64 / sizeof (void *)];
+static const void *_NullPool[(256+8) / sizeof (void *)];
 
 /* Generic nul-content Null objects. */
 template <typename Type>
@@ -572,6 +572,7 @@ struct IntType
   DEFINE_SIZE_STATIC (Size);
 };
 
+typedef                uint8_t      BYTE;      /* 8-bit unsigned integer. */
 typedef IntType<uint16_t, 2> USHORT;   /* 16-bit unsigned integer. */
 typedef IntType<int16_t,  2> SHORT;    /* 16-bit signed integer. */
 typedef IntType<uint32_t, 4> ULONG;    /* 32-bit unsigned integer. */
diff --git a/src/hb-ot-cmap-table.hh b/src/hb-ot-cmap-table.hh
index 0141116..73734a6 100644
--- a/src/hb-ot-cmap-table.hh
+++ b/src/hb-ot-cmap-table.hh
@@ -40,6 +40,35 @@ namespace OT {
 #define HB_OT_TAG_cmap HB_TAG('c','m','a','p')
 
 
+struct CmapSubtableFormat0
+{
+  friend struct CmapSubtable;
+
+  private:
+  inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
+  {
+    hb_codepoint_t gid = codepoint < 256 ? glyphIdArray[codepoint] : 0;
+    if (!gid)
+      return false;
+    *glyph = gid;
+    return true;
+  }
+
+  inline bool sanitize (hb_sanitize_context_t *c) {
+    TRACE_SANITIZE (this);
+    return TRACE_RETURN (c->check_struct (this));
+  }
+
+  protected:
+  USHORT       format;         /* Format number is set to 0. */
+  USHORT       length;         /* Byte length of this subtable. */
+  USHORT       language;       /* Ignore. */
+  BYTE         glyphIdArray[256];/* An array that maps character
+                                * code to glyph index values. */
+  public:
+  DEFINE_SIZE_STATIC (6 + 256);
+};
+
 struct CmapSubtableFormat4
 {
   friend struct CmapSubtable;
@@ -246,6 +275,7 @@ struct CmapSubtable
   inline bool get_glyph (hb_codepoint_t codepoint, hb_codepoint_t *glyph) const
   {
     switch (u.format) {
+    case  0: return u.format0 .get_glyph(codepoint, glyph);
     case  4: return u.format4 .get_glyph(codepoint, glyph);
     case  6: return u.format6 .get_glyph(codepoint, glyph);
     case 10: return u.format10.get_glyph(codepoint, glyph);
@@ -259,6 +289,7 @@ struct CmapSubtable
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return TRACE_RETURN (false);
     switch (u.format) {
+    case  0: return TRACE_RETURN (u.format0 .sanitize (c));
     case  4: return TRACE_RETURN (u.format4 .sanitize (c));
     case  6: return TRACE_RETURN (u.format6 .sanitize (c));
     case 10: return TRACE_RETURN (u.format10.sanitize (c));
@@ -271,6 +302,7 @@ struct CmapSubtable
   protected:
   union {
   USHORT               format;         /* Format identifier */
+  CmapSubtableFormat0  format0;
   CmapSubtableFormat4  format4;
   CmapSubtableFormat6  format6;
   CmapSubtableFormat10 format10;
_______________________________________________
HarfBuzz mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/harfbuzz

Reply via email to