diff options
-rw-r--r-- | src/glyphs.c | 13 | ||||
-rw-r--r-- | src/glyphs.h | 2 |
2 files changed, 9 insertions, 6 deletions
diff --git a/src/glyphs.c b/src/glyphs.c index b66675b..26c7308 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -76,13 +76,16 @@ ttf2f_result glyph_load_list(void) return TTF2F_RESULT_OK; } -const char *glyph_name(unsigned short code) +const char *glyph_name(unsigned int code) { - struct glyph_entry *g; + struct glyph_entry *g = NULL; - for (g = &glyphs[code / 256]; g; g = g->next) - if (g->code == code) - break; + /* The glyph list only covers the BMP */ + if (code < 65536) { + for (g = &glyphs[code / 256]; g; g = g->next) + if (g->code == code) + break; + } return g != NULL ? g->name : NULL; } diff --git a/src/glyphs.h b/src/glyphs.h index 5125f9e..a3cd435 100644 --- a/src/glyphs.h +++ b/src/glyphs.h @@ -5,6 +5,6 @@ ttf2f_result glyph_load_list(void); void glyph_destroy_list(void); -const char *glyph_name(unsigned short code); +const char *glyph_name(unsigned int code); #endif |