Move code around
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 2 May 2013 22:18:24 +0000 (18:18 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Sat, 4 May 2013 20:04:04 +0000 (16:04 -0400)
src/hb-ot-layout.cc
src/hb-ot-map.cc

index 76a6256..a944a95 100644 (file)
@@ -34,6 +34,8 @@
 #include "hb-ot-layout-gsub-table.hh"
 #include "hb-ot-layout-gpos-table.hh"
 
+#include "hb-ot-map-private.hh"
+
 #include <stdlib.h>
 #include <string.h>
 
@@ -783,3 +785,53 @@ hb_ot_layout_get_size_params (hb_face_t    *face,
 
   return false;
 }
+
+
+/*
+ * Parts of hb-ot-map are implemented here such that they have direct
+ * access to GSUB/GPOS lookups.
+ */
+
+
+inline void hb_ot_map_t::apply (unsigned int table_index,
+                               const hb_ot_shape_plan_t *plan,
+                               hb_font_t *font,
+                               hb_buffer_t *buffer) const
+{
+  unsigned int i = 0;
+
+  for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) {
+    const stage_map_t *stage = &stages[table_index][stage_index];
+    for (; i < stage->last_lookup; i++)
+      switch (table_index)
+      {
+        case 0:
+         hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index,
+                                         lookups[table_index][i].mask,
+                                         lookups[table_index][i].auto_zwj);
+         break;
+
+       case 1:
+         hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index,
+                                       lookups[table_index][i].mask,
+                                       lookups[table_index][i].auto_zwj);
+         break;
+      }
+
+    if (stage->pause_func)
+    {
+      buffer->clear_output ();
+      stage->pause_func (plan, font, buffer);
+    }
+  }
+}
+
+void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
+{
+  apply (0, plan, font, buffer);
+}
+
+void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
+{
+  apply (1, plan, font, buffer);
+}
index dd26afc..43856fa 100644 (file)
@@ -102,49 +102,6 @@ void hb_ot_map_builder_t::add_feature (hb_tag_t tag, unsigned int value,
   info->stage[1] = current_stage[1];
 }
 
-inline void hb_ot_map_t::apply (unsigned int table_index,
-                               const hb_ot_shape_plan_t *plan,
-                               hb_font_t *font,
-                               hb_buffer_t *buffer) const
-{
-  unsigned int i = 0;
-
-  for (unsigned int stage_index = 0; stage_index < stages[table_index].len; stage_index++) {
-    const stage_map_t *stage = &stages[table_index][stage_index];
-    for (; i < stage->last_lookup; i++)
-      switch (table_index)
-      {
-        case 0:
-         hb_ot_layout_substitute_lookup (font, buffer, lookups[table_index][i].index,
-                                         lookups[table_index][i].mask,
-                                         lookups[table_index][i].auto_zwj);
-         break;
-
-       case 1:
-         hb_ot_layout_position_lookup (font, buffer, lookups[table_index][i].index,
-                                       lookups[table_index][i].mask,
-                                       lookups[table_index][i].auto_zwj);
-         break;
-      }
-
-    if (stage->pause_func)
-    {
-      buffer->clear_output ();
-      stage->pause_func (plan, font, buffer);
-    }
-  }
-}
-
-void hb_ot_map_t::substitute (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
-{
-  apply (0, plan, font, buffer);
-}
-
-void hb_ot_map_t::position (const hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const
-{
-  apply (1, plan, font, buffer);
-}
-
 
 void hb_ot_map_t::collect_lookups (unsigned int table_index, hb_set_t *lookups_out) const
 {