[HarfBuzz] harfbuzz-ng: Branch 'master' - 5 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Thu Apr 29 01:42:17 PDT 2010


 src/hb-font.cc                   |    1 +
 src/hb-ot-layout-gdef-private.hh |   13 +++++++++----
 src/hb-ot-layout-gpos-private.hh |   13 +++++++++----
 src/hb-ot-tag.c                  |    6 ++++--
 4 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit fde6f5bd682f5ad0cc5e2ec69fc831b0192bf90b
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 04:41:41 2010 -0400

    Convert to uppercase in hb_ot_tag_from_language()

diff --git a/src/hb-ot-tag.c b/src/hb-ot-tag.c
index 40356b0..8b88eb3 100644
--- a/src/hb-ot-tag.c
+++ b/src/hb-ot-tag.c
@@ -599,8 +599,10 @@ hb_ot_tag_from_language (hb_language_t language)
     int i;
     lang_str += 6;
     i = 0;
-    while (i < 4 && lang_str[i]) {
-      tag[i] = lang_str[i];
+#define IS_LETTER(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && (c) <= 'Z'))
+#define TO_UPPER(c) (((c) >= 'a' && (c) <= 'z') ? (c) + 'A' - 'a' : (c))
+    while (i < 4 && IS_LETTER (lang_str[i])) {
+      tag[i] = TO_UPPER (lang_str[i]);
     }
     while (i < 4)
       tag[i] = ' ';
commit 6f729b45b04243c42ad7201b67cda9d5e5c363f1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 03:59:06 2010 -0400

    More contour point use

diff --git a/src/hb-font.cc b/src/hb-font.cc
index 3b1b6ca..d0d58f1 100644
--- a/src/hb-font.cc
+++ b/src/hb-font.cc
@@ -196,6 +196,7 @@ hb_font_get_contour_point (hb_font_t *font, hb_face_t *face,
 			   unsigned int point_index,
 			   hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y)
 {
+  *x = 0; *y = 0;
   return font->klass->get_contour_point (font, face, font->user_data,
 					 point_index,
 					 glyph, x, y);
diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index cc037a4..e85b578 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -116,9 +116,11 @@ struct CaretValueFormat2
   inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
   {
     /* TODO vertical */
-    hb_position_t x = 0, y = 0;
-    hb_font_get_contour_point (context->font, context->face, caretValuePoint, glyph_id, &x, &y);
-    return x;
+    hb_position_t x, y;
+    if (hb_font_get_contour_point (context->font, context->face, caretValuePoint, glyph_id, &x, &y))
+      return x;
+    else
+      return 0;
   }
 
   inline bool sanitize (SANITIZE_ARG_DEF) {
diff --git a/src/hb-ot-layout-gpos-private.hh b/src/hb-ot-layout-gpos-private.hh
index f3fb265..07c4117 100644
--- a/src/hb-ot-layout-gpos-private.hh
+++ b/src/hb-ot-layout-gpos-private.hh
@@ -221,10 +221,15 @@ struct AnchorFormat2
   inline void get_anchor (hb_ot_layout_context_t *layout_context, hb_codepoint_t glyph_id,
 			  hb_position_t *x, hb_position_t *y) const
   {
-      /* TODO Contour
-       * NOTE only adjust directions with nonzero ppem */
-      *x = _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
-      *y = _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
+      unsigned int x_ppem = layout_context->font->x_ppem;
+      unsigned int y_ppem = layout_context->font->y_ppem;
+      hb_position_t cx, cy;
+      hb_bool_t ret;
+
+      if (x_ppem || y_ppem)
+	ret = hb_font_get_contour_point (layout_context->font, layout_context->face, anchorPoint, glyph_id, &cx, &cy);
+      *x = x_ppem && ret ? cx : _hb_16dot16_mul_round (layout_context->font->x_scale, xCoordinate);
+      *y = y_ppem && ret ? cy : _hb_16dot16_mul_round (layout_context->font->y_scale, yCoordinate);
   }
 
   inline bool sanitize (SANITIZE_ARG_DEF) {
commit 3840b6b50503ba2c9a99f774284e0077baffa8a0
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 03:48:27 2010 -0400

    [gdef] Fix delta scale

diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index 5e7c47e..cc037a4 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -140,7 +140,7 @@ struct CaretValueFormat3
   {
     /* TODO vertical */
     return _hb_16dot16_mul_round (context->font->x_scale, coordinate) +
-	   ((this+deviceTable).get_delta (context->font->x_ppem) << 6);
+	   ((this+deviceTable).get_delta (context->font->x_ppem) << 16);
   }
 
   inline bool sanitize (SANITIZE_ARG_DEF) {
commit 4ac6cc284b2c1eb670c2a3659ec385ed729acac4
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 03:48:11 2010 -0400

    [gdef] Fix rounding

diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index 46d40ba..5e7c47e 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -94,7 +94,7 @@ struct CaretValueFormat1
   inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_GNUC_UNUSED) const
   {
     /* TODO vertical */
-    return context->font->x_scale * coordinate / 0x10000;
+    return _hb_16dot16_mul_round (context->font->x_scale, coordinate);
   }
 
   inline bool sanitize (SANITIZE_ARG_DEF) {
@@ -139,7 +139,7 @@ struct CaretValueFormat3
   inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id HB_GNUC_UNUSED) const
   {
     /* TODO vertical */
-    return context->font->x_scale * coordinate / 0x10000 +
+    return _hb_16dot16_mul_round (context->font->x_scale, coordinate) +
 	   ((this+deviceTable).get_delta (context->font->x_ppem) << 6);
   }
 
commit b52fbb1bab608bda76efb936f08344afaec600a1
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Thu Apr 29 03:47:00 2010 -0400

    [gdef] Implement getting contour point

diff --git a/src/hb-ot-layout-gdef-private.hh b/src/hb-ot-layout-gdef-private.hh
index 14bef8c..46d40ba 100644
--- a/src/hb-ot-layout-gdef-private.hh
+++ b/src/hb-ot-layout-gdef-private.hh
@@ -115,7 +115,10 @@ struct CaretValueFormat2
   private:
   inline int get_caret_value (hb_ot_layout_context_t *context, hb_codepoint_t glyph_id) const
   {
-    return /* TODO contour point */ 0;
+    /* TODO vertical */
+    hb_position_t x = 0, y = 0;
+    hb_font_get_contour_point (context->font, context->face, caretValuePoint, glyph_id, &x, &y);
+    return x;
   }
 
   inline bool sanitize (SANITIZE_ARG_DEF) {



More information about the HarfBuzz mailing list