Rename [xy]_pos to [xy]_offset since we don't accumulate positions
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 5 Nov 2009 17:20:11 +0000 (12:20 -0500)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 5 Nov 2009 17:20:11 +0000 (12:20 -0500)
src/hb-buffer-private.h
src/hb-buffer.h
src/hb-font.h
src/hb-ft.c
src/hb-ot-layout-gpos-private.hh
src/hb-shape.c
src/hb-shape.h

index f40b1c5..f98f768 100644 (file)
@@ -47,10 +47,10 @@ typedef struct _hb_internal_glyph_info_t {
 } hb_internal_glyph_info_t;
 
 typedef struct _hb_internal_glyph_position_t {
-  hb_position_t  x_pos;
-  hb_position_t  y_pos;
   hb_position_t  x_advance;
   hb_position_t  y_advance;
+  hb_position_t  x_offset;
+  hb_position_t  y_offset;
   uint32_t       new_advance :1;       /* if set, the advance width values are
                                           absolute, i.e., they won't be
                                           added to the original glyph's value
index 7bb7a5a..5c9d408 100644 (file)
@@ -52,10 +52,10 @@ typedef struct _hb_glyph_info_t {
 } hb_glyph_info_t;
 
 typedef struct _hb_glyph_position_t {
-  hb_position_t  x_pos;
-  hb_position_t  y_pos;
   hb_position_t  x_advance;
   hb_position_t  y_advance;
+  hb_position_t  x_offset;
+  hb_position_t  y_offset;
   /* XXX these should all be replaced by "uint32_t internal" */
   uint32_t       new_advance :1;       /* if set, the advance width values are
                                           absolute, i.e., they won't be
index 9a8e5ad..a47b601 100644 (file)
@@ -94,10 +94,10 @@ hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
 
 typedef struct _hb_glyph_metrics_t
 {
-    hb_position_t x_pos;
-    hb_position_t y_pos;
     hb_position_t x_advance;
     hb_position_t y_advance;
+    hb_position_t x_offset;
+    hb_position_t y_offset;
     hb_position_t width;
     hb_position_t height;
 } hb_glyph_metrics_t;
index fa212e6..146fd3c 100644 (file)
@@ -82,18 +82,18 @@ hb_ft_get_glyph_metrics (hb_font_t *font, hb_face_t *face, const void *user_data
 
   /* TODO: load_flags, embolden, etc */
 
-  metrics->x_pos = metrics->y_pos = 0;
   metrics->x_advance = metrics->y_advance = 0;
+  metrics->x_offset = metrics->y_offset = 0;
   metrics->width = metrics->height = 0;
   if (HB_LIKELY (!FT_Load_Glyph (ft_face, glyph, load_flags)))
   {
     /* TODO: A few negations should be in order here, not sure. */
-    metrics->x_pos = ft_face->glyph->metrics.horiBearingX;
-    metrics->y_pos = ft_face->glyph->metrics.horiBearingY;
-    metrics->width = ft_face->glyph->metrics.width;
-    metrics->height = ft_face->glyph->metrics.height;
     metrics->x_advance = ft_face->glyph->advance.x;
     metrics->y_advance = ft_face->glyph->advance.y;
+    metrics->x_offset = ft_face->glyph->metrics.horiBearingX;
+    metrics->y_offset = ft_face->glyph->metrics.horiBearingY;
+    metrics->width = ft_face->glyph->metrics.width;
+    metrics->height = ft_face->glyph->metrics.height;
   }
 }
 
index deea9b9..2c88f53 100644 (file)
@@ -103,41 +103,25 @@ struct ValueRecord {
     x_scale = context->font->x_scale;
     y_scale = context->font->y_scale;
     /* design units -> fractional pixel */
-    if (format & xPlacement)
-      glyph_pos->x_pos += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++);
-    if (format & yPlacement)
-      glyph_pos->y_pos += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++);
-    if (format & xAdvance)
-      glyph_pos->x_advance += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++);
-    if (format & yAdvance)
-      glyph_pos->y_advance += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++);
+    if (format & xPlacement) glyph_pos->x_offset  += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++);
+    if (format & yPlacement) glyph_pos->y_offset  += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++);
+    if (format & xAdvance)   glyph_pos->x_advance += _hb_16dot16_mul_trunc (x_scale, *(SHORT*)values++);
+    if (format & yAdvance)   glyph_pos->y_advance += _hb_16dot16_mul_trunc (y_scale, *(SHORT*)values++);
 
     x_ppem = context->font->x_ppem;
     y_ppem = context->font->y_ppem;
     /* pixel -> fractional pixel */
     if (format & xPlaDevice) {
-      if (x_ppem)
-       glyph_pos->x_pos += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 6;
-      else
-        values++;
+      if (x_ppem) glyph_pos->x_offset  += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 6; else values++;
     }
     if (format & yPlaDevice) {
-      if (y_ppem)
-       glyph_pos->y_pos += (base+*(OffsetTo<Device>*)values++).get_delta (y_ppem) << 6;
-      else
-        values++;
+      if (y_ppem) glyph_pos->y_offset  += (base+*(OffsetTo<Device>*)values++).get_delta (y_ppem) << 6; else values++;
     }
     if (format & xAdvDevice) {
-      if (x_ppem)
-       glyph_pos->x_advance += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 6;
-      else
-        values++;
+      if (x_ppem) glyph_pos->x_advance += (base+*(OffsetTo<Device>*)values++).get_delta (x_ppem) << 6; else values++;
     }
     if (format & yAdvDevice) {
-      if (y_ppem)
-       glyph_pos->y_advance += (base+*(OffsetTo<Device>*)values++).get_delta (y_ppem) << 6;
-      else
-        values++;
+      if (y_ppem) glyph_pos->y_advance += (base+*(OffsetTo<Device>*)values++).get_delta (y_ppem) << 6; else values++;
     }
   }
 };
@@ -330,10 +314,10 @@ struct MarkArray
     glyph_anchor.get_anchor (context, IN_GLYPH (glyph_pos), &base_x, &base_y);
 
     hb_internal_glyph_position_t *o = POSITION (buffer->in_pos);
-    o->x_pos     = base_x - mark_x;
-    o->y_pos     = base_y - mark_y;
     o->x_advance = 0;
     o->y_advance = 0;
+    o->x_offset  = base_x - mark_x;
+    o->y_offset  = base_y - mark_y;
     o->back      = buffer->in_pos - glyph_pos;
 
     buffer->in_pos++;
@@ -868,12 +852,12 @@ struct CursivePosFormat1
     if  (lookup_flag & LookupFlag::RightToLeft)
     {
       POSITION (last_pos)->cursive_chain = last_pos - buffer->in_pos;
-      POSITION (last_pos)->y_pos = entry_y - gpi->anchor_y;
+      POSITION (last_pos)->y_offset = entry_y - gpi->anchor_y;
     }
     else
     {
       POSITION (buffer->in_pos)->cursive_chain = buffer->in_pos - last_pos;
-      POSITION (buffer->in_pos)->y_pos = gpi->anchor_y - entry_y;
+      POSITION (buffer->in_pos)->y_offset = gpi->anchor_y - entry_y;
     }
 
   end:
index 9043f98..23391f9 100644 (file)
@@ -38,8 +38,8 @@ is_variation_selector (hb_codepoint_t unicode)
 }
 
 static void
-map_glyphs (hb_face_t    *face,
-           hb_font_t    *font,
+map_glyphs (hb_font_t    *font,
+           hb_face_t    *face,
            hb_buffer_t  *buffer)
 {
   unsigned int count;
@@ -48,19 +48,19 @@ map_glyphs (hb_face_t    *face,
 
   for (buffer->in_pos = 0; buffer->in_pos < count; buffer->in_pos++) {
     if (HB_UNLIKELY (is_variation_selector (IN_NEXTGLYPH()))) {
-      IN_CURGLYPH() = hb_font_get_glyph (face, font, IN_CURGLYPH(), IN_NEXTGLYPH());
+      IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), IN_NEXTGLYPH());
       buffer->in_pos++;
     } else {
-      IN_CURGLYPH() = hb_font_get_glyph (face, font, IN_CURGLYPH(), 0);
+      IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
     }
   }
-  IN_CURGLYPH() = hb_font_get_glyph (face, font, IN_CURGLYPH(), 0);
+  IN_CURGLYPH() = hb_font_get_glyph (font, face, IN_CURGLYPH(), 0);
 }
 
 
 void
-hb_shape (hb_face_t    *face,
-         hb_font_t    *font,
+hb_shape (hb_font_t    *font,
+         hb_face_t    *face,
          hb_buffer_t  *buffer,
          hb_feature_t *features,
          unsigned int  num_features)
index be20592..714fe97 100644 (file)
@@ -41,8 +41,8 @@ typedef struct _hb_feature_t {
 } hb_feature_t;
 
 void
-hb_shape (hb_face_t    *face,
-         hb_font_t    *font,
+hb_shape (hb_font_t    *font,
+         hb_face_t    *face,
          hb_buffer_t  *buffer,
          hb_feature_t *features,
          unsigned int  num_features);