summaryrefslogtreecommitdiff
path: root/src/sfnt.c
diff options
context:
space:
mode:
authorPip Cet <pipcet@protonmail.com>2024-08-11 10:07:12 +0000
committerPip Cet <pipcet@protonmail.com>2024-08-11 10:22:46 +0000
commit5c3d340e001187ad027bc0328f738938a2bc32c5 (patch)
treecdadcc9d33987121d060952492ff9b17d222e42b /src/sfnt.c
parent8e925d582adba5619ab6f8d2bc7cd6a3a522a28b (diff)
downloademacs-5c3d340e001187ad027bc0328f738938a2bc32c5.tar.gz
emacs-5c3d340e001187ad027bc0328f738938a2bc32c5.tar.bz2
emacs-5c3d340e001187ad027bc0328f738938a2bc32c5.zip
Fix format 2 cmap handling in sfnt.c
This code is untested as no font with a format 2 cmap could be found. * src/sfnt.c (sfnt_lookup_glyph_2): Fix typos. Assume single-byte encodings use character codes 0, 1, ..., 255 rather than 0, 256, ..., 65280.
Diffstat (limited to 'src/sfnt.c')
-rw-r--r--src/sfnt.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sfnt.c b/src/sfnt.c
index b235c795ef7..1ed492b7506 100644
--- a/src/sfnt.c
+++ b/src/sfnt.c
@@ -1093,10 +1093,10 @@ sfnt_lookup_glyph_2 (sfnt_char character,
unsigned char *slice;
uint16_t glyph;
- if (character > 65335)
+ if (character > 65535)
return 0;
- i = character >> 16;
+ i = character >> 8;
j = character & 0xff;
k = format2->sub_header_keys[i] / 8;
@@ -1129,9 +1129,9 @@ sfnt_lookup_glyph_2 (sfnt_char character,
return 0;
}
- /* k is 0, so glyph_index_array[i] is the glyph. */
- return (i < format2->num_glyphs
- ? format2->glyph_index_array[i]
+ /* k is 0, so glyph_index_array[j] is the glyph. */
+ return (j < format2->num_glyphs
+ ? format2->glyph_index_array[j]
: 0);
}