Move code around, in prep for Thai/Lao shaper
authorBehdad Esfahbod <behdad@behdad.org>
Sun, 8 Apr 2012 01:52:28 +0000 (21:52 -0400)
committerBehdad Esfahbod <behdad@behdad.org>
Sun, 8 Apr 2012 01:52:28 +0000 (21:52 -0400)
src/hb-buffer-private.hh
src/hb-buffer.cc
src/hb-ot-shape-complex-indic-machine.rl

index 4292222..06d4912 100644 (file)
@@ -131,6 +131,11 @@ struct _hb_buffer_t {
                              unsigned int cluster_start,
                              unsigned int cluster_end);
 
+  HB_INTERNAL void merge_clusters (unsigned int start,
+                                  unsigned int end);
+  HB_INTERNAL void merge_out_clusters (unsigned int start,
+                                      unsigned int end);
+
   /* Internal methods */
   HB_INTERNAL bool enlarge (unsigned int size);
 
index e8bdfb1..6b562aa 100644 (file)
@@ -431,6 +431,29 @@ hb_buffer_t::reverse_clusters (void)
 }
 
 void
+hb_buffer_t::merge_clusters (unsigned int start,
+                            unsigned int end)
+{
+  unsigned int cluster = this->info[start].cluster;
+
+  for (unsigned int i = start + 1; i < end; i++)
+    cluster = MIN (cluster, this->info[i].cluster);
+  for (unsigned int i = start; i < end; i++)
+    this->info[i].cluster = cluster;
+}
+void
+hb_buffer_t::merge_out_clusters (unsigned int start,
+                                unsigned int end)
+{
+  unsigned int cluster = this->out_info[start].cluster;
+
+  for (unsigned int i = start + 1; i < end; i++)
+    cluster = MIN (cluster, this->out_info[i].cluster);
+  for (unsigned int i = start; i < end; i++)
+    this->out_info[i].cluster = cluster;
+}
+
+void
 hb_buffer_t::guess_properties (void)
 {
   /* If script is set to INVALID, guess from buffer contents */
index bcca6da..7af23c1 100644 (file)
@@ -64,7 +64,7 @@ action found_vowel_syllable { found_vowel_syllable (map, buffer, mask_array, las
 action found_standalone_cluster { found_standalone_cluster (map, buffer, mask_array, last, p); }
 action found_non_indic { found_non_indic (map, buffer, mask_array, last, p); }
 
-action next_syllable { set_cluster (buffer, last, p); last = p; }
+action next_syllable { buffer->merge_clusters (last, p); last = p; }
 
 consonant_syllable =   (c.N? (z.H|H.z?))* c.N? A? (H.z? | matra_group*)? syllable_tail %(found_consonant_syllable);
 vowel_syllable =       (Ra H)? V N? (z.H.c | ZWJ.c)? matra_group* syllable_tail %(found_vowel_syllable);
@@ -84,18 +84,6 @@ main := (syllable %(next_syllable))**;
 
 
 static void
-set_cluster (hb_buffer_t *buffer,
-            unsigned int start, unsigned int end)
-{
-  unsigned int cluster = buffer->info[start].cluster;
-
-  for (unsigned int i = start + 1; i < end; i++)
-    cluster = MIN (cluster, buffer->info[i].cluster);
-  for (unsigned int i = start; i < end; i++)
-    buffer->info[i].cluster = cluster;
-}
-
-static void
 find_syllables (const hb_ot_map_t *map, hb_buffer_t *buffer, hb_mask_t *mask_array)
 {
   unsigned int p, pe, eof;