Merge from savannah/emacs-30

8d073823c6 Revert "Remove redundant byte-swapping boundary"
c25687e860 Fix various typos reported by Pip Cet
This commit is contained in:
Po Lu 2024-08-03 17:36:58 +08:00
commit ef8276d424
4 changed files with 34 additions and 15 deletions

View file

@ -174,11 +174,11 @@ get_adstyle_property (FcPattern *p)
USE_SAFE_ALLOCA;
tmp = SAFE_ALLOCA (end - str);
for (i = 0; i < end - str; ++i)
tmp[i] = ((end[i] != '?'
&& end[i] != '*'
&& end[i] != '"'
&& end[i] != '-')
? end[i] : ' ');
tmp[i] = ((str[i] != '?'
&& str[i] != '*'
&& str[i] != '"'
&& str[i] != '-')
? str[i] : ' ');
adstyle = font_intern_prop (tmp, end - str, 1);
SAFE_FREE ();
if (font_style_to_value (FONT_WIDTH_INDEX, adstyle, 0) >= 0)

View file

@ -16606,10 +16606,10 @@ sfnt_read_OS_2_table (int fd, struct sfnt_offset_subtable *subtable)
OS_2 = xmalloc (sizeof *OS_2);
/* Read data into the structure. */
/* Read data up to the end of `panose'. */
wanted = SFNT_ENDOF (struct sfnt_OS_2_table, fs_last_char_index,
uint16_t);
wanted = SFNT_ENDOF (struct sfnt_OS_2_table, panose,
unsigned char[10]);
rc = read (fd, OS_2, wanted);
if (rc == -1 || rc != wanted)
@ -16636,6 +16636,20 @@ sfnt_read_OS_2_table (int fd, struct sfnt_offset_subtable *subtable)
sfnt_swap16 (&OS_2->y_strikeout_size);
sfnt_swap16 (&OS_2->y_strikeout_position);
sfnt_swap16 (&OS_2->s_family_class);
/* Read fields between ul_unicode_range and fs_last_char_index. */
wanted = (SFNT_ENDOF (struct sfnt_OS_2_table, fs_last_char_index,
uint16_t)
- offsetof (struct sfnt_OS_2_table, ul_unicode_range));
rc = read (fd, &OS_2->ul_unicode_range, wanted);
if (rc == -1 || rc != wanted)
{
xfree (OS_2);
return NULL;
}
/* Swap the remainder and return the table. */
sfnt_swap32 (&OS_2->ul_unicode_range[0]);
sfnt_swap32 (&OS_2->ul_unicode_range[1]);
sfnt_swap32 (&OS_2->ul_unicode_range[2]);

View file

@ -1395,6 +1395,8 @@ struct sfnt_OS_2_table
/* Microsoft ``panose'' classification. */
unsigned char panose[10];
/* Alignment boundary! */
/* Unicode range specification. */
uint32_t ul_unicode_range[4];

View file

@ -1643,6 +1643,7 @@ sfntfont_list_1 (struct sfnt_font_desc *desc, Lisp_Object spec,
struct sfnt_cmap_encoding_subtable subtable;
int instance, num_instance;
Lisp_Object item;
bool matching;
/* cmap and subtable are caches for sfntfont_lookup_char. */
@ -1788,19 +1789,21 @@ sfntfont_list_1 (struct sfnt_font_desc *desc, Lisp_Object spec,
/* The vector contains characters, of which one must be
present in the font. */
matching = false;
for (i = 0; i < ASIZE (tem); ++i)
{
if (FIXNUMP (AREF (tem, i)))
{
if (!sfntfont_lookup_char (desc, AREF (tem, i),
&cmap, &subtable))
goto fail;
/* One character is enough to pass a font. Don't
look at too many. */
break;
if (sfntfont_lookup_char (desc, AREF (tem, i),
&cmap, &subtable))
{
matching = true;
break;
}
}
}
if (!matching)
goto fail;
}
else if (CONSP (tem) && CONSP (XCDR (tem)))
{