[HarfBuzz] harfbuzz: Branch 'master' - 3 commits

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Oct 9 04:40:54 UTC 2018


 src/hb-ft.cc            |   19 -------
 src/hb-glib.cc          |   39 ----------------
 src/hb-icu.cc           |   52 ---------------------
 src/hb-ot-font.cc       |   13 -----
 src/hb-ucdn.cc          |   17 -------
 test/api/test-unicode.c |  115 ------------------------------------------------
 6 files changed, 6 insertions(+), 249 deletions(-)

New commits:
commit fc50916589a300e49183b5ee598e64ca28d0bd9a
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 9 00:39:42 2018 -0400

    Remove deprecated decompose_compatibility stuff

diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index 152601f2..fab3cddb 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -328,36 +328,7 @@ hb_glib_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
   return ret;
 }
 
-static unsigned int
-hb_glib_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED,
-					 hb_codepoint_t      u,
-					 hb_codepoint_t     *decomposed,
-					 void               *user_data HB_UNUSED)
-{
-#if GLIB_CHECK_VERSION(2,29,12)
-  return g_unichar_fully_decompose (u, true, decomposed, HB_UNICODE_MAX_DECOMPOSITION_LEN);
-#endif
-
-  /* If the user doesn't have GLib >= 2.29.12 we have to perform
-   * a round trip to UTF-8 and the associated memory management dance. */
-  gchar utf8[6];
-  gchar *utf8_decomposed, *c;
-  gsize utf8_len, utf8_decomposed_len, i;
-
-  /* Convert @u to UTF-8 and normalise it in NFKD mode. This performs the compatibility decomposition. */
-  utf8_len = g_unichar_to_utf8 (u, utf8);
-  utf8_decomposed = g_utf8_normalize (utf8, utf8_len, G_NORMALIZE_NFKD);
-  utf8_decomposed_len = g_utf8_strlen (utf8_decomposed, -1);
-
-  assert (utf8_decomposed_len <= HB_UNICODE_MAX_DECOMPOSITION_LEN);
-
-  for (i = 0, c = utf8_decomposed; i < utf8_decomposed_len; i++, c = g_utf8_next_char (c))
-    *decomposed++ = g_utf8_get_char (c);
-
-  g_free (utf8_decomposed);
-
-  return utf8_decomposed_len;
-}
+#define hb_glib_unicode_decompose_compatibility nullptr
 
 
 #ifdef HB_USE_ATEXIT
diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index 784a25f8..8dbeaddd 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -292,39 +292,8 @@ hb_icu_unicode_decompose (hb_unicode_funcs_t *ufuncs HB_UNUSED,
   return ret;
 }
 
-static unsigned int
-hb_icu_unicode_decompose_compatibility (hb_unicode_funcs_t *ufuncs HB_UNUSED,
-					hb_codepoint_t      u,
-					hb_codepoint_t     *decomposed,
-					void               *user_data HB_UNUSED)
-{
-  UChar utf16[2], normalized[2 * HB_UNICODE_MAX_DECOMPOSITION_LEN + 1];
-  unsigned int len;
-  int32_t utf32_len;
-  hb_bool_t err;
-  UErrorCode icu_err;
-
-  /* Copy @u into a UTF-16 array to be passed to ICU. */
-  len = 0;
-  err = false;
-  U16_APPEND (utf16, len, ARRAY_LENGTH (utf16), u, err);
-  if (err)
-    return 0;
+#define hb_icu_unicode_decompose_compatibility nullptr
 
-  /* Normalise the codepoint using NFKD mode. */
-  icu_err = U_ZERO_ERROR;
-  len = unorm2_normalize (unorm2_getNFKDInstance (&icu_err), utf16, len, normalized, ARRAY_LENGTH (normalized), &icu_err);
-  if (U_FAILURE (icu_err))
-    return 0;
-
-  /* Convert the decomposed form from UTF-16 to UTF-32. */
-  icu_err = U_ZERO_ERROR;
-  u_strToUTF32 ((UChar32*) decomposed, HB_UNICODE_MAX_DECOMPOSITION_LEN, &utf32_len, normalized, len, &icu_err);
-  if (U_FAILURE (icu_err))
-    return 0;
-
-  return utf32_len;
-}
 
 #ifdef HB_USE_ATEXIT
 static void free_static_icu_funcs (void);
diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc
index 2f06a984..3edd17ea 100644
--- a/src/hb-ucdn.cc
+++ b/src/hb-ucdn.cc
@@ -224,13 +224,7 @@ hb_ucdn_decompose(hb_unicode_funcs_t *ufuncs HB_UNUSED,
     return ucdn_decompose(ab, a, b);
 }
 
-static unsigned int
-hb_ucdn_decompose_compatibility(hb_unicode_funcs_t *ufuncs HB_UNUSED,
-				hb_codepoint_t u, hb_codepoint_t *decomposed,
-				void *user_data HB_UNUSED)
-{
-    return ucdn_compat_decompose(u, decomposed);
-}
+#define hb_ucdn_decompose_compatibility nullptr
 
 
 #ifdef HB_USE_ATEXIT
diff --git a/test/api/test-unicode.c b/test/api/test-unicode.c
index 85546bcf..6195bb28 100644
--- a/test/api/test-unicode.c
+++ b/test/api/test-unicode.c
@@ -722,7 +722,6 @@ test_unicode_normalization (gconstpointer user_data)
 {
   hb_unicode_funcs_t *uf = (hb_unicode_funcs_t *) user_data;
   gunichar a, b, ab;
-  hb_codepoint_t decomposed[HB_UNICODE_MAX_DECOMPOSITION_LEN];
 
 
   /* Test compose() */
@@ -785,56 +784,6 @@ test_unicode_normalization (gconstpointer user_data)
   g_assert (hb_unicode_decompose (uf, 0xD4CC, &a, &b) && a == 0x1111 && b == 0x1171);
   g_assert (hb_unicode_decompose (uf, 0xCE31, &a, &b) && a == 0xCE20 && b == 0x11B8);
   g_assert (hb_unicode_decompose (uf, 0xCE20, &a, &b) && a == 0x110E && b == 0x1173);
-
-
-  /* Test decompose_compatibility() */
-
-  /* Not decomposable */
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x0041, decomposed) == 0);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x1F632, decomposed) == 0);
-
-  /* Singletons */
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x00B5, decomposed) == 1 && decomposed[0] == 0x03BC);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x03D6, decomposed) == 1 && decomposed[0] == 0x03C0);
-
-  /* Arabic compatibility */
-  g_assert (hb_unicode_decompose_compatibility (uf, 0xFB54, decomposed) == 1 && decomposed[0] == 0x067B);
-
-  /* Longest decomposition ever */
-  g_assert (18 <= HB_UNICODE_MAX_DECOMPOSITION_LEN);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0xFDFA, decomposed) == 18 && decomposed[17] == 0x0645);
-
-  /* Note: we deliberately don't test characters that have canonical decompositions but no
-   * compatibility decomposition against the decompose_compatibility() function as that we
-   * leave up to implementations (for now). */
-
-  /* Spaces */
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2002, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2003, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2004, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2005, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2006, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2008, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2009, decomposed) == 1 && decomposed[0] == 0x0020);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x200A, decomposed) == 1 && decomposed[0] == 0x0020);
-
-  /* Pairs */
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x0587, decomposed) == 2 &&
-            decomposed[0] == 0x0565 && decomposed[1] == 0x0582);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2017, decomposed) == 2 &&
-            decomposed[0] == 0x0020 && decomposed[1] == 0x0333);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2025, decomposed) == 2 &&
-            decomposed[0] == 0x002E && decomposed[1] == 0x002E);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2033, decomposed) == 2 &&
-            decomposed[0] == 0x2032 && decomposed[1] == 0x2032);
-
-  /* Triples */
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2026, decomposed) == 3 &&
-            decomposed[0] == 0x002E && decomposed[1] == 0x002E && decomposed[2] == 0x002E);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x2034, decomposed) == 3 &&
-            decomposed[0] == 0x2032 && decomposed[1] == 0x2032 && decomposed[2] == 0x2032);
-  g_assert (hb_unicode_decompose_compatibility (uf, 0x213B, decomposed) == 3 &&
-            decomposed[0] == 0x0046 && decomposed[1] == 0x0041 && decomposed[2] == 0x0058);
 }
 
 
commit eed737f6726d3408191a4e64592805b70d8bb247
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 9 00:33:30 2018 -0400

    Remove deprecated eastasian_width

diff --git a/src/hb-glib.cc b/src/hb-glib.cc
index 18f3a81d..152601f2 100644
--- a/src/hb-glib.cc
+++ b/src/hb-glib.cc
@@ -202,13 +202,7 @@ hb_glib_unicode_combining_class (hb_unicode_funcs_t *ufuncs HB_UNUSED,
   return (hb_unicode_combining_class_t) g_unichar_combining_class (unicode);
 }
 
-static unsigned int
-hb_glib_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs HB_UNUSED,
-				 hb_codepoint_t      unicode,
-				 void               *user_data HB_UNUSED)
-{
-  return g_unichar_iswide (unicode) ? 2 : 1;
-}
+#define hb_glib_unicode_eastasian_width nullptr
 
 static hb_unicode_general_category_t
 hb_glib_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED,
diff --git a/src/hb-icu.cc b/src/hb-icu.cc
index 564f71fe..784a25f8 100644
--- a/src/hb-icu.cc
+++ b/src/hb-icu.cc
@@ -73,24 +73,7 @@ hb_icu_unicode_combining_class (hb_unicode_funcs_t *ufuncs HB_UNUSED,
   return (hb_unicode_combining_class_t) u_getCombiningClass (unicode);
 }
 
-static unsigned int
-hb_icu_unicode_eastasian_width (hb_unicode_funcs_t *ufuncs HB_UNUSED,
-				hb_codepoint_t      unicode,
-				void               *user_data HB_UNUSED)
-{
-  switch (u_getIntPropertyValue(unicode, UCHAR_EAST_ASIAN_WIDTH))
-  {
-  case U_EA_WIDE:
-  case U_EA_FULLWIDTH:
-    return 2;
-  case U_EA_NEUTRAL:
-  case U_EA_AMBIGUOUS:
-  case U_EA_HALFWIDTH:
-  case U_EA_NARROW:
-    return 1;
-  }
-  return 1;
-}
+#define hb_icu_unicode_eastasian_width nullptr
 
 static hb_unicode_general_category_t
 hb_icu_unicode_general_category (hb_unicode_funcs_t *ufuncs HB_UNUSED,
diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc
index 41be586c..2f06a984 100644
--- a/src/hb-ucdn.cc
+++ b/src/hb-ucdn.cc
@@ -182,14 +182,7 @@ hb_ucdn_combining_class(hb_unicode_funcs_t *ufuncs HB_UNUSED,
     return (hb_unicode_combining_class_t) ucdn_get_combining_class(unicode);
 }
 
-static unsigned int
-hb_ucdn_eastasian_width(hb_unicode_funcs_t *ufuncs HB_UNUSED,
-			hb_codepoint_t unicode,
-			void *user_data HB_UNUSED)
-{
-    int w = ucdn_get_east_asian_width(unicode);
-    return (w == UCDN_EAST_ASIAN_F || w == UCDN_EAST_ASIAN_W) ? 2 : 1;
-}
+#define hb_ucdn_eastasian_width nullptr
 
 static hb_unicode_general_category_t
 hb_ucdn_general_category(hb_unicode_funcs_t *ufuncs HB_UNUSED,
diff --git a/test/api/test-unicode.c b/test/api/test-unicode.c
index 4238ca99..85546bcf 100644
--- a/test/api/test-unicode.c
+++ b/test/api/test-unicode.c
@@ -160,69 +160,6 @@ static const test_pair_t combining_class_tests_more[] =
   { 0x111111, 0 }
 };
 
-static const test_pair_t eastasian_width_tests[] =
-{
-  /* Neutral */
-  {   0x0000, 1 },
-  {   0x0483, 1 },
-  {   0x0641, 1 },
-  {   0xFFFC, 1 },
-  {  0x10000, 1 },
-  {  0xE0001, 1 },
-
-  /* Narrow */
-  {   0x0020, 1 },
-  {   0x0041, 1 },
-  {   0x27E6, 1 },
-
-  /* Halfwidth */
-  {   0x20A9, 1 },
-  {   0xFF61, 1 },
-  {   0xFF69, 1 },
-  {   0xFFEE, 1 },
-
-  /* Ambiguous */
-  {   0x00A1, 1 },
-  {   0x00D8, 1 },
-  {   0x02DD, 1 },
-  {  0xE0100, 1 },
-  { 0x100000, 1 },
-
-  /* Fullwidth */
-  {   0x3000, 2 },
-  {   0xFF60, 2 },
-
-  /* Wide */
-  {   0x2329, 2 },
-  {   0x3001, 2 },
-  {   0xFE69, 2 },
-  {  0x30000, 2 },
-  {  0x3FFFD, 2 },
-
-  { 0x111111, 1 }
-};
-static const test_pair_t eastasian_width_tests_more[] =
-{
-  /* Default Wide blocks */
-  {   0x4DBF, 2 },
-  {   0x9FFF, 2 },
-  {   0xFAFF, 2 },
-  {  0x2A6DF, 2 },
-  {  0x2B73F, 2 },
-  {  0x2B81F, 2 },
-  {  0x2FA1F, 2 },
-
-  /* Uniode-5.2 character additions */
-  /* Wide */
-  {   0x115F, 2 },
-
-  /* Uniode-6.0 character additions */
-  /* Wide */
-  {  0x2B740, 2 },
-  {  0x1B000, 2 },
-
-  { 0x111111, 1 }
-};
 
 static const test_pair_t general_category_tests[] =
 {
@@ -469,7 +406,6 @@ typedef struct {
 static const property_t properties[] =
 {
   PROPERTY (combining_class, 0),
-  PROPERTY (eastasian_width, 1),
   PROPERTY (general_category, (unsigned int) HB_UNICODE_GENERAL_CATEGORY_OTHER_LETTER),
   PROPERTY (mirroring, RETURNS_UNICODE_ITSELF),
   PROPERTY (script, (unsigned int) HB_SCRIPT_UNKNOWN)
commit 47030b1855f04c0d75899ffb6f5021fea3c19b90
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Oct 9 00:30:45 2018 -0400

    [ft/ot] Remove implementation of deprecated kerning funcs

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 6da31fc2..fcd87a07 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -305,23 +305,6 @@ hb_ft_get_glyph_v_origin (hb_font_t *font,
   return true;
 }
 
-static hb_position_t
-hb_ft_get_glyph_h_kerning (hb_font_t *font,
-			   void *font_data,
-			   hb_codepoint_t left_glyph,
-			   hb_codepoint_t right_glyph,
-			   void *user_data HB_UNUSED)
-{
-  const hb_ft_font_t *ft_font = (const hb_ft_font_t *) font_data;
-  FT_Vector kerningv;
-
-  FT_Kerning_Mode mode = font->x_ppem ? FT_KERNING_DEFAULT : FT_KERNING_UNFITTED;
-  if (FT_Get_Kerning (ft_font->ft_face, left_glyph, right_glyph, mode, &kerningv))
-    return 0;
-
-  return kerningv.x;
-}
-
 static hb_bool_t
 hb_ft_get_glyph_extents (hb_font_t *font,
 			 void *font_data,
@@ -466,8 +449,6 @@ static struct hb_ft_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ft
     hb_font_funcs_set_glyph_v_advance_func (funcs, hb_ft_get_glyph_v_advance, nullptr, nullptr);
     //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ft_get_glyph_h_origin, nullptr, nullptr);
     hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ft_get_glyph_v_origin, nullptr, nullptr);
-    hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ft_get_glyph_h_kerning, nullptr, nullptr);
-    //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ft_get_glyph_v_kerning, nullptr, nullptr);
     hb_font_funcs_set_glyph_extents_func (funcs, hb_ft_get_glyph_extents, nullptr, nullptr);
     hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ft_get_glyph_contour_point, nullptr, nullptr);
     hb_font_funcs_set_glyph_name_func (funcs, hb_ft_get_glyph_name, nullptr, nullptr);
diff --git a/src/hb-ot-font.cc b/src/hb-ot-font.cc
index fa8d5a3c..58208397 100644
--- a/src/hb-ot-font.cc
+++ b/src/hb-ot-font.cc
@@ -103,17 +103,6 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
   }
 }
 
-static hb_position_t
-hb_ot_get_glyph_h_kerning (hb_font_t *font,
-			   void *font_data,
-			   hb_codepoint_t left_glyph,
-			   hb_codepoint_t right_glyph,
-			   void *user_data HB_UNUSED)
-{
-  const hb_ot_face_data_t *ot_face = (const hb_ot_face_data_t *) font_data;
-  return font->em_scale_x (ot_face->kern->get_h_kerning (left_glyph, right_glyph));
-}
-
 static hb_bool_t
 hb_ot_get_glyph_extents (hb_font_t *font,
 			 void *font_data,
@@ -203,8 +192,6 @@ static struct hb_ot_font_funcs_lazy_loader_t : hb_font_funcs_lazy_loader_t<hb_ot
     hb_font_funcs_set_glyph_v_advances_func (funcs, hb_ot_get_glyph_v_advances, nullptr, nullptr);
     //hb_font_funcs_set_glyph_h_origin_func (funcs, hb_ot_get_glyph_h_origin, nullptr, nullptr);
     //hb_font_funcs_set_glyph_v_origin_func (funcs, hb_ot_get_glyph_v_origin, nullptr, nullptr);
-    hb_font_funcs_set_glyph_h_kerning_func (funcs, hb_ot_get_glyph_h_kerning, nullptr, nullptr);
-    //hb_font_funcs_set_glyph_v_kerning_func (funcs, hb_ot_get_glyph_v_kerning, nullptr, nullptr);
     hb_font_funcs_set_glyph_extents_func (funcs, hb_ot_get_glyph_extents, nullptr, nullptr);
     //hb_font_funcs_set_glyph_contour_point_func (funcs, hb_ot_get_glyph_contour_point, nullptr, nullptr);
     hb_font_funcs_set_glyph_name_func (funcs, hb_ot_get_glyph_name, nullptr, nullptr);


More information about the HarfBuzz mailing list