]> git.eshelyaron.com Git - emacs.git/commitdiff
Update Android port
authorPo Lu <luangruo@yahoo.com>
Tue, 28 Mar 2023 11:21:06 +0000 (19:21 +0800)
committerPo Lu <luangruo@yahoo.com>
Tue, 28 Mar 2023 11:21:06 +0000 (19:21 +0800)
* src/sfnt.c (sfnt_vary_compound_glyph):
* src/sfntfont.c (sfntfont_get_glyph)
(sfntfont_get_glyph_outline): Avoid clobbering offset size flag
when varying compound glyph.

src/sfnt.c
src/sfntfont.c

index d2d3500a18daf25a397e45a3e11e839a884402f2..d2c726367cb65d4d7e636d13c96b005971c233e5 100644 (file)
@@ -14549,8 +14549,6 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
   uint16_t *local_points, n_local_points;
   sfnt_fixed scale;
   ptrdiff_t data_offset;
-  bool *touched;
-  sfnt_fword *restrict original_x, *restrict original_y;
   struct sfnt_compound_glyph_component *component;
 
   gvar = blend->gvar;
@@ -14628,12 +14626,6 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
   intermediate_start = coords + gvar->axis_count;
   intermediate_end = coords + gvar->axis_count;
 
-  /* Allocate arrays of booleans and fwords to keep track of which
-     points have been touched.  */
-  touched = NULL;
-  original_x = NULL;
-  original_y = NULL;
-
   while (ntuples--)
     {
       data = gvar->glyph_variation_data + offset + data_offset;
@@ -14775,7 +14767,6 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
                word = component->argument1.d;
 
              fword = sfnt_mul_fixed_round (dx[i], scale);
-             component->flags |= 01;
              component->argument1.d = word + fword;
 
              /* Vary the Y offset.  */
@@ -14786,6 +14777,8 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
                word = component->argument2.d;
 
              fword = sfnt_mul_fixed_round (dy[i], scale);
+
+             /* Set the flag that says offsets are words.  */
              component->flags |= 01;
              component->argument2.d = word + fword;
            }
@@ -14804,36 +14797,6 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
 
          /* Deltas are only applied for each point number read.  */
 
-         if (!original_x)
-           {
-             if ((glyph->compound->num_components
-                  * sizeof *touched) >= 1024 * 16)
-               touched = xmalloc (sizeof *touched
-                                  * glyph->compound->num_components);
-             else
-               touched = alloca (sizeof *touched
-                                 * glyph->compound->num_components);
-
-             if ((sizeof *original_x * 2
-                  * glyph->compound->num_components) >= 1024 * 16)
-               original_x = xmalloc (sizeof *original_x * 2
-                                     * glyph->compound->num_components);
-             else
-               original_x = alloca (sizeof *original_x * 2
-                                    * glyph->compound->num_components);
-
-             original_y = original_x + glyph->compound->num_components;
-             memcpy (original_x, glyph->simple->x_coordinates,
-                     (sizeof *original_x
-                      * glyph->compound->num_components));
-             memcpy (original_y, glyph->simple->y_coordinates,
-                     (sizeof *original_y
-                      * glyph->compound->num_components));
-           }
-
-         memset (touched, 0, (sizeof *touched
-                              * glyph->compound->num_components));
-
          for (i = 0; i < point_count; ++i)
            {
              /* Apply deltas to phantom points.  */
@@ -14868,7 +14831,6 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
                word = component->argument1.d;
 
              fword = sfnt_mul_fixed_round (dx[i], scale);
-             component->flags |= 01;
              component->argument1.d = word + fword;
 
              /* Vary the Y offset.  */
@@ -14879,6 +14841,8 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
                word = component->argument2.d;
 
              fword = sfnt_mul_fixed_round (dy[i], scale);
+
+             /* Set the flag that says offsets are words.  */
              component->flags |= 01;
              component->argument2.d = word + fword;
            }
@@ -14895,17 +14859,9 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
 
   /* Return success.  */
 
-  if ((glyph->compound->num_components
-       * sizeof *touched) >= 1024 * 16)
-    xfree (touched);
-
   if (gvar->axis_count * sizeof *coords * 3 >= 1024 * 16)
     xfree (coords);
 
-  if ((sizeof *original_x * 2
-       * glyph->compound->num_components) >= 1024 * 16)
-    xfree (original_x);
-
   if (points != (uint16_t *) -1)
     xfree (points);
 
@@ -14921,17 +14877,9 @@ sfnt_vary_compound_glyph (struct sfnt_blend *blend, sfnt_glyph id,
   xfree (local_points);
  fail1:
 
-  if ((glyph->compound->num_components
-       * sizeof *touched) >= 1024 * 16)
-    xfree (touched);
-
   if (gvar->axis_count * sizeof *coords * 3 >= 1024 * 16)
     xfree (coords);
 
-  if ((sizeof *original_x * 2
-       * glyph->compound->num_components) >= 1024 * 16)
-    xfree (original_x);
-
   if (points != (uint16_t *) -1)
     xfree (points);
 
index daf8f54c03c459e39d8065f798b686cd07c442fc..3476da6734e9e48580cdbfc1b77787ecabca57ed 100644 (file)
@@ -1886,18 +1886,14 @@ sfntfont_get_glyph (sfnt_glyph glyph_id, void *dcontext,
                           tables->loca_short,
                           tables->loca_long);
 
-  if (!tables->blend || !glyph)
-    return glyph;
-
-  if ((glyph->simple
-       && sfnt_vary_simple_glyph (tables->blend, glyph_id,
-                                 glyph, &distortion))
-      || (!glyph->simple
-         && sfnt_vary_compound_glyph (tables->blend, glyph_id,
-                                      glyph, &distortion)))
+  if (tables->blend && glyph)
     {
-      sfnt_free_glyph (glyph);
-      return NULL;
+      if (glyph->simple)
+       sfnt_vary_simple_glyph (tables->blend, glyph_id, glyph,
+                               &distortion);
+      else
+       sfnt_vary_compound_glyph (tables->blend, glyph_id, glyph,
+                                 &distortion);
     }
 
   /* Note that the distortion is not relevant for compound glyphs.  */
@@ -2022,14 +2018,11 @@ sfntfont_get_glyph_outline (sfnt_glyph glyph_code,
              return NULL;
            }
        }
-      else if (!glyph->simple)
+      else if (sfnt_vary_compound_glyph (blend, glyph_code,
+                                        glyph, &distortion))
        {
-         if (sfnt_vary_compound_glyph (blend, glyph_code,
-                                       glyph, &distortion))
-           {
-             sfnt_free_glyph (glyph);
-             return NULL;
-           }
+         sfnt_free_glyph (glyph);
+         return NULL;
        }
     }