[pango/harfbuzz-ng] [HB] Remove last dependence on the old code base!



commit 5687dd7511fbf8503dcb6d7c215455e1f999cf03
Author: Behdad Esfahbod <behdad behdad org>
Date:   Wed May 20 06:01:16 2009 -0400

    [HB] Remove last dependence on the old code base!
---
 pango/opentype/hb-buffer-private.h         |   88 ++++++++++++++--------------
 pango/opentype/hb-buffer.c                 |   47 +++++++--------
 pango/opentype/hb-ot-layout-gpos-private.h |   11 +--
 pango/opentype/hb-ot-layout-gsub-private.h |   12 ++--
 pango/opentype/hb-ot-layout.cc             |   16 +++---
 5 files changed, 85 insertions(+), 89 deletions(-)

diff --git a/pango/opentype/hb-buffer-private.h b/pango/opentype/hb-buffer-private.h
index dec3130..5268c04 100644
--- a/pango/opentype/hb-buffer-private.h
+++ b/pango/opentype/hb-buffer-private.h
@@ -28,79 +28,79 @@
 #ifndef HB_BUFFER_PRIVATE_H
 #define HB_BUFFER_PRIVATE_H
 
-#include "harfbuzz-impl.h"
+#include "hb-private.h"
 #include "hb-buffer.h"
 
-HB_BEGIN_HEADER
+HB_BEGIN_DECLS();
 
 #define HB_GLYPH_PROPERTY_UNKNOWN 0xFFFF
 
 HB_INTERNAL void
-_hb_buffer_swap( HB_Buffer buffer );
+_hb_buffer_swap (hb_buffer_t *buffer);
 
 HB_INTERNAL void
-_hb_buffer_clear_output( HB_Buffer buffer );
+_hb_buffer_clear_output (hb_buffer_t *buffer);
 
 HB_INTERNAL HB_Error
-_hb_buffer_clear_positions( HB_Buffer buffer );
+_hb_buffer_clear_positions (hb_buffer_t *buffer);
 
 HB_INTERNAL HB_Error
-_hb_buffer_add_output_glyphs( HB_Buffer  buffer,
-			      HB_UShort  num_in,
-			      HB_UShort  num_out,
-			      HB_UShort *glyph_data,
-			      HB_UShort  component,
-			      HB_UShort  ligID );
+_hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
+			      unsigned int num_in,
+			      unsigned int num_out,
+			      unsigned short *glyph_data,
+			      unsigned short component,
+			      unsigned short ligID);
 
 HB_INTERNAL HB_Error
-_hb_buffer_add_output_glyph ( HB_Buffer buffer,
-			      HB_UInt   glyph_index,
-			      HB_UShort component,
-			      HB_UShort ligID );
+_hb_buffer_add_output_glyph (hb_buffer_t *buffer,
+			     hb_codepoint_t glyph_index,
+			     unsigned short component,
+			     unsigned short ligID);
 
 HB_INTERNAL HB_Error
-_hb_buffer_next_glyph ( HB_Buffer buffer );
+_hb_buffer_next_glyph (hb_buffer_t *buffer);
 
 HB_INTERNAL HB_Error
-_hb_buffer_replace_glyph ( HB_Buffer buffer,
-			   HB_UInt   glyph_index );
+_hb_buffer_replace_glyph (hb_buffer_t *buffer,
+			  hb_codepoint_t glyph_index);
 
-HB_INTERNAL HB_UShort
-_hb_buffer_allocate_ligid( HB_Buffer buffer );
+HB_INTERNAL unsigned short
+_hb_buffer_allocate_ligid (hb_buffer_t *buffer);
 
 
 /* convenience macros */
 
-#define IN_GLYPH( pos )        (buffer->in_string[(pos)].gindex)
-#define IN_ITEM( pos )         (&buffer->in_string[(pos)])
-#define IN_CURGLYPH()          (buffer->in_string[buffer->in_pos].gindex)
-#define IN_CURITEM()           (&buffer->in_string[buffer->in_pos])
-#define IN_PROPERTIES( pos )   (buffer->in_string[(pos)].properties)
-#define IN_LIGID( pos )        (buffer->in_string[(pos)].ligID)
-#define IN_COMPONENT( pos )    (buffer->in_string[(pos)].component)
-#define POSITION( pos )        (&buffer->positions[(pos)])
-#define CURPOSITION()          (&buffer->positions[buffer->in_pos])
-#define OUT_GLYPH( pos )       (buffer->out_string[(pos)].gindex)
-#define OUT_ITEM( pos )        (&buffer->out_string[(pos)])
-
-#define CHECK_Property( layout, index, flags, properties )					\
+#define IN_GLYPH(pos)		(buffer->in_string[(pos)].gindex)
+#define IN_ITEM(pos)		(&buffer->in_string[(pos)])
+#define IN_CURGLYPH()		(buffer->in_string[buffer->in_pos].gindex)
+#define IN_CURITEM()		(&buffer->in_string[buffer->in_pos])
+#define IN_PROPERTIES(pos)	(buffer->in_string[(pos)].properties)
+#define IN_LIGID(pos)		(buffer->in_string[(pos)].ligID)
+#define IN_COMPONENT(pos)	(buffer->in_string[(pos)].component)
+#define POSITION(pos)		(&buffer->positions[(pos)])
+#define CURPOSITION()		(&buffer->positions[buffer->in_pos])
+#define OUT_GLYPH(pos)		(buffer->out_string[(pos)].gindex)
+#define OUT_ITEM(pos)		(&buffer->out_string[(pos)])
+
+#define CHECK_Property (layout, index, flags, properties)					\
           ({unsigned int _p; error = _hb_ot_layout_check_glyph_property((layout), (index), (flags), (&_p)) \
 	         ? HB_Err_Ok : HB_Err_Not_Covered, *(properties) = _p; error;})
 
-#define ADD_String( buffer, num_in, num_out, glyph_data, component, ligID )             \
-          ( ( error = _hb_buffer_add_output_glyphs( (buffer),                            \
+#define ADD_String (buffer, num_in, num_out, glyph_data, component, ligID)             \
+            ((error = _hb_buffer_add_output_glyphs ((buffer),                            \
 						    (num_in), (num_out),                \
                                                     (glyph_data), (component), (ligID)  \
-                                                  ) ) != HB_Err_Ok )
-#define ADD_Glyph( buffer, glyph_index, component, ligID )				\
-          ( ( error = _hb_buffer_add_output_glyph( (buffer),                             \
+                                                 )) != HB_Err_Ok)
+#define ADD_Glyph (buffer, glyph_index, component, ligID)				\
+            ((error = _hb_buffer_add_output_glyph ((buffer),                             \
                                                     (glyph_index), (component), (ligID) \
-                                                  ) ) != HB_Err_Ok )
-#define REPLACE_Glyph( buffer, glyph_index )				\
-          ( ( error = _hb_buffer_replace_glyph( (buffer), (glyph_index) ) ) != HB_Err_Ok )
-#define COPY_Glyph( buffer )								\
-	  ( (error = _hb_buffer_next_glyph ( buffer ) ) != HB_Err_Ok )
+                                                 )) != HB_Err_Ok)
+#define REPLACE_Glyph (buffer, glyph_index)				\
+            ((error = _hb_buffer_replace_glyph ((buffer), (glyph_index))) != HB_Err_Ok)
+#define COPY_Glyph (buffer)								\
+	   ((error = _hb_buffer_next_glyph  (buffer)) != HB_Err_Ok)
 
-HB_END_HEADER
+HB_END_DECLS();
 
 #endif /* HB_BUFFER_PRIVATE_H */
diff --git a/pango/opentype/hb-buffer.c b/pango/opentype/hb-buffer.c
index e29e7f0..ec66e48 100644
--- a/pango/opentype/hb-buffer.c
+++ b/pango/opentype/hb-buffer.c
@@ -25,7 +25,6 @@
  * Red Hat Author(s): Owen Taylor, Behdad Esfahbod
  */
 
-#include "harfbuzz-impl.h"
 #include "hb-buffer-private.h"
 
 /* Here is how the buffer works internally:
@@ -61,7 +60,7 @@
 hb_buffer_ensure (hb_buffer_t  *buffer,
 		  unsigned int  size)
 {
-  HB_UInt new_allocated = buffer->allocated;
+  unsigned int new_allocated = buffer->allocated;
   /* XXX err handling */
 
   if (size > new_allocated)
@@ -152,10 +151,10 @@ hb_buffer_clear (HB_Buffer buffer)
 }
 
 void
-hb_buffer_add_glyph (HB_Buffer buffer,
-		      HB_UInt   glyph_index,
-		      HB_UInt   properties,
-		      HB_UInt   cluster)
+hb_buffer_add_glyph (hb_buffer_t    *buffer,
+		     hb_codepoint_t  glyph_index,
+		     unsigned int    properties,
+		     unsigned int    cluster)
 {
   HB_Error error;
   HB_GlyphItem glyph;
@@ -241,17 +240,17 @@ _hb_buffer_swap (HB_Buffer buffer)
    The cluster value for the glyph at position buffer->in_pos is used
    for all replacement glyphs */
 HB_INTERNAL HB_Error
-_hb_buffer_add_output_glyphs (HB_Buffer  buffer,
-			      HB_UShort  num_in,
-			      HB_UShort  num_out,
-			      HB_UShort *glyph_data,
-			      HB_UShort  component,
-			      HB_UShort  ligID)
+_hb_buffer_add_output_glyphs (hb_buffer_t *buffer,
+			      unsigned int num_in,
+			      unsigned int num_out,
+			      unsigned short *glyph_data,
+			      unsigned short component,
+			      unsigned short ligID)
 {
   HB_Error  error;
-  HB_UShort i;
-  HB_UInt properties;
-  HB_UInt cluster;
+  unsigned int i;
+  unsigned int properties;
+  unsigned int cluster;
 
   hb_buffer_ensure (buffer, buffer->out_pos + num_out);
 
@@ -290,12 +289,12 @@ _hb_buffer_add_output_glyphs (HB_Buffer  buffer,
 }
 
 HB_INTERNAL HB_Error
-_hb_buffer_add_output_glyph (HB_Buffer buffer,
-			     HB_UInt   glyph_index,
-			     HB_UShort component,
-			     HB_UShort ligID)
+_hb_buffer_add_output_glyph (hb_buffer_t *buffer,
+			     hb_codepoint_t glyph_index,
+			     unsigned short component,
+			     unsigned short ligID)
 {
-  HB_UShort glyph_data =  glyph_index;
+  unsigned short glyph_data =  glyph_index;
 
   return _hb_buffer_add_output_glyphs (buffer, 1, 1,
 					&glyph_data, component, ligID);
@@ -321,8 +320,8 @@ _hb_buffer_next_glyph (HB_Buffer buffer)
 }
 
 HB_INTERNAL HB_Error
-_hb_buffer_replace_glyph (HB_Buffer buffer,
-			  HB_UInt   glyph_index)
+_hb_buffer_replace_glyph (hb_buffer_t *buffer,
+			  hb_codepoint_t glyph_index)
 {
   if (!buffer->separate_out)
     {
@@ -340,8 +339,8 @@ _hb_buffer_replace_glyph (HB_Buffer buffer,
   return HB_Err_Ok;
 }
 
-HB_INTERNAL HB_UShort
-_hb_buffer_allocate_ligid (HB_Buffer buffer)
+HB_INTERNAL unsigned short
+_hb_buffer_allocate_ligid (hb_buffer_t *buffer)
 {
   return ++buffer->max_ligID;
 }
diff --git a/pango/opentype/hb-ot-layout-gpos-private.h b/pango/opentype/hb-ot-layout-gpos-private.h
index 600ef96..f78a84c 100644
--- a/pango/opentype/hb-ot-layout-gpos-private.h
+++ b/pango/opentype/hb-ot-layout-gpos-private.h
@@ -29,9 +29,6 @@
 
 #include "hb-ot-layout-gsubgpos-private.h"
 
-/* XXX */
-#include "harfbuzz-impl.h"
-
 
 /* Shared Tables: ValueRecord, Anchor Table, and MarkArray */
 
@@ -670,7 +667,7 @@ struct CursivePosFormat1
 
     struct hb_ot_layout_t::gpos_info_t *gpi = &layout->gpos_info;
     hb_codepoint_t last_pos = gpi->last;
-    gpi->last = 0xFFFF;
+    gpi->last = HB_OT_GPOS_NO_LAST;
 
     /* We don't handle mark glyphs here. */
     if (property == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
@@ -684,7 +681,7 @@ struct CursivePosFormat1
 
     hb_position_t entry_x, entry_y, exit_x, exit_y;
 
-    if (last_pos == 0xFFFF || !record.entryAnchor)
+    if (last_pos == HB_OT_GPOS_NO_LAST || !record.entryAnchor)
       goto end;
 
     (this+record.entryAnchor).get_anchor (layout, IN_CURGLYPH (), &entry_x, &entry_y);
@@ -1180,7 +1177,7 @@ struct PosLookup : Lookup
     if (HB_UNLIKELY (!buffer->in_length))
       return false;
 
-    layout->gpos_info.last = 0xFFFF; /* no last valid glyph for cursive pos. */
+    layout->gpos_info.last = HB_OT_GPOS_NO_LAST; /* no last valid glyph for cursive pos. */
 
     buffer->in_pos = 0;
     while (buffer->in_pos < buffer->in_length)
@@ -1196,7 +1193,7 @@ struct PosLookup : Lookup
           done = false;
 	  /* Contrary to properties defined in GDEF, user-defined properties
 	     will always stop a possible cursive positioning.                */
-	  layout->gpos_info.last = 0xFFFF;
+	  layout->gpos_info.last = HB_OT_GPOS_NO_LAST;
       }
 
       if (!done)
diff --git a/pango/opentype/hb-ot-layout-gsub-private.h b/pango/opentype/hb-ot-layout-gsub-private.h
index 82d7d5f..d66d353 100644
--- a/pango/opentype/hb-ot-layout-gsub-private.h
+++ b/pango/opentype/hb-ot-layout-gsub-private.h
@@ -30,14 +30,14 @@
 #include "hb-ot-layout-gsubgpos-private.h"
 
 /* XXX */
-#include "harfbuzz-impl.h"
+#include "hb-buffer-private.h"
 HB_INTERNAL HB_Error
-_hb_buffer_add_output_glyph_ids( HB_Buffer  buffer,
-			      HB_UShort  num_in,
-			      HB_UShort  num_out,
+_hb_buffer_add_output_glyph_ids (hb_buffer_t *buffer,
+			      unsigned int num_in,
+			      unsigned int num_out,
 			      const GlyphID *glyph_data,
-			      HB_UShort  component,
-			      HB_UShort  ligID );
+			      unsigned short component,
+			      unsigned short ligID);
 
 
 struct SingleSubstFormat1
diff --git a/pango/opentype/hb-ot-layout.cc b/pango/opentype/hb-ot-layout.cc
index a98a34d..e79662a 100644
--- a/pango/opentype/hb-ot-layout.cc
+++ b/pango/opentype/hb-ot-layout.cc
@@ -597,17 +597,17 @@ hb_buffer_duplicate_out_buffer( HB_Buffer buffer )
 
 /* XXX */
 HB_INTERNAL HB_Error
-_hb_buffer_add_output_glyph_ids( HB_Buffer  buffer,
-			      HB_UShort  num_in,
-			      HB_UShort  num_out,
+_hb_buffer_add_output_glyph_ids (hb_buffer_t *buffer,
+			      unsigned int num_in,
+			      unsigned int num_out,
 			      const GlyphID *glyph_data,
-			      HB_UShort  component,
-			      HB_UShort  ligID )
+			      unsigned short component,
+			      unsigned short ligID)
 {
   HB_Error  error;
-  HB_UShort i;
-  HB_UInt properties;
-  HB_UInt cluster;
+  unsigned int i;
+  unsigned int properties;
+  unsigned int cluster;
 
   hb_buffer_ensure( buffer, buffer->out_pos + num_out );
   /* XXX */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]