[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master ef8276d4247: Merge from savannah/emacs-30
From: |
Po Lu |
Subject: |
master ef8276d4247: Merge from savannah/emacs-30 |
Date: |
Sat, 3 Aug 2024 05:38:37 -0400 (EDT) |
branch: master
commit ef8276d4247fdf0b1ee19a2c70328710490dd2d6
Merge: 5bd30117304 8d073823c61
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge from savannah/emacs-30
8d073823c61 Revert "Remove redundant byte-swapping boundary"
c25687e860f Fix various typos reported by Pip Cet
---
src/ftfont.c | 10 +++++-----
src/sfnt.c | 20 +++++++++++++++++---
src/sfnt.h | 2 ++
src/sfntfont.c | 17 ++++++++++-------
4 files changed, 34 insertions(+), 15 deletions(-)
diff --git a/src/ftfont.c b/src/ftfont.c
index c89feea1d46..882d3eec256 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -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)
diff --git a/src/sfnt.c b/src/sfnt.c
index 11670f1dd5c..34ff6964c31 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -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]);
diff --git a/src/sfnt.h b/src/sfnt.h
index ecc3876b394..444b1dfe427 100644
--- a/src/sfnt.h
+++ b/src/sfnt.h
@@ -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];
diff --git a/src/sfntfont.c b/src/sfntfont.c
index d1376939a3c..8c02c05e7a6 100644
--- a/src/sfntfont.c
+++ b/src/sfntfont.c
@@ -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)))
{