ref: 565d9ca09e9867e4b6fb45f0a529950193906340
parent: 5483f826fdc83194fbc3ccf8ab6bd007c44c4c9d
author: Ali Gholami Rudi <ali@rudi.ir>
date: Tue Jun 5 22:03:08 EDT 2018
otf: extract font name from CFF name index
--- a/otf.c
+++ b/otf.c
@@ -1072,10 +1072,17 @@
glyph_n = cffidx_cnt(chridx);
badcff = cffidx_cnt(chridx) - 391 > cffidx_cnt(stridx);
strcpy(glyph_name[0], ".notdef");
- /* read font full name */
+ /* read font name from name index */
+ if (cffidx_cnt(nameidx) > 0) {
+ char name[256] = "";
+ memcpy(name, cffidx_get(nameidx, 0), cffidx_len(nameidx, 0));
+ if (name[0])
+ trfn_psfont(name);
+ }
+ /* read font full name from top dict */
fullname = cffdict_get(cffidx_get(topidx, 0),
cffidx_len(topidx, 0), 2, NULL);
- if (fullname - 391 < cffidx_cnt(chridx)) {
+ if (fullname && fullname - 391 < cffidx_cnt(stridx)) {
char name[256];
char name_nospace[256];
cff_char(stridx, fullname, name);