summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xps/ghostxps.h2
-rw-r--r--xps/xpsfont.c9
-rw-r--r--xps/xpsglyphs.c4
3 files changed, 10 insertions, 5 deletions
diff --git a/xps/ghostxps.h b/xps/ghostxps.h
index 623ea5df6..89f43e30a 100644
--- a/xps/ghostxps.h
+++ b/xps/ghostxps.h
@@ -267,7 +267,7 @@ void xps_free_font(xps_context_t *ctx, xps_font_t *font);
267 267
268int xps_count_font_encodings(xps_font_t *font); 268int xps_count_font_encodings(xps_font_t *font);
269void xps_identify_font_encoding(xps_font_t *font, int idx, int *pid, int *eid); 269void xps_identify_font_encoding(xps_font_t *font, int idx, int *pid, int *eid);
270void xps_select_font_encoding(xps_font_t *font, int idx); 270int xps_select_font_encoding(xps_font_t *font, int idx);
271int xps_decode_font_char(xps_font_t *font, int key); 271int xps_decode_font_char(xps_font_t *font, int key);
272int xps_encode_font_char(xps_font_t *font, int key); 272int xps_encode_font_char(xps_font_t *font, int key);
273 273
diff --git a/xps/xpsfont.c b/xps/xpsfont.c
index 36aef4cf0..7ae7d2239 100644
--- a/xps/xpsfont.c
+++ b/xps/xpsfont.c
@@ -331,19 +331,24 @@ xps_identify_font_encoding(xps_font_t *font, int idx, int *pid, int *eid)
331 * Select a cmap subtable for use with encoding functions. 331 * Select a cmap subtable for use with encoding functions.
332 */ 332 */
333 333
334void 334int
335xps_select_font_encoding(xps_font_t *font, int idx) 335xps_select_font_encoding(xps_font_t *font, int idx)
336{ 336{
337 byte *cmapdata, *entry; 337 byte *cmapdata, *entry;
338 int pid, eid; 338 int pid, eid;
339 if (idx < 0 || idx >= font->cmapsubcount) 339 if (idx < 0 || idx >= font->cmapsubcount)
340 return; 340 return 0;
341 cmapdata = font->data + font->cmaptable; 341 cmapdata = font->data + font->cmaptable;
342 entry = cmapdata + 4 + idx * 8; 342 entry = cmapdata + 4 + idx * 8;
343 pid = u16(entry + 0); 343 pid = u16(entry + 0);
344 eid = u16(entry + 2); 344 eid = u16(entry + 2);
345 font->cmapsubtable = font->cmaptable + u32(entry + 4); 345 font->cmapsubtable = font->cmaptable + u32(entry + 4);
346 if (font->cmapsubtable >= font->length) {
347 font->cmapsubtable = 0;
348 return 0;
349 }
346 font->usepua = (pid == 3 && eid == 0); 350 font->usepua = (pid == 3 && eid == 0);
351 return 1;
347} 352}
348 353
349/* 354/*
diff --git a/xps/xpsglyphs.c b/xps/xpsglyphs.c
index 44947028d..061355f2e 100644
--- a/xps/xpsglyphs.c
+++ b/xps/xpsglyphs.c
@@ -144,8 +144,8 @@ xps_select_best_font_encoding(xps_font_t *font)
144 xps_identify_font_encoding(font, i, &pid, &eid); 144 xps_identify_font_encoding(font, i, &pid, &eid);
145 if (pid == xps_cmap_list[k].pid && eid == xps_cmap_list[k].eid) 145 if (pid == xps_cmap_list[k].pid && eid == xps_cmap_list[k].eid)
146 { 146 {
147 xps_select_font_encoding(font, i); 147 if (xps_select_font_encoding(font, i))
148 return; 148 return;
149 } 149 }
150 } 150 }
151 } 151 }