From: Jan Djärv Date: Tue, 3 Sep 2013 06:56:25 +0000 (+0200) Subject: * nsfont.m (INVALID_GLYPH): New define. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~11 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=0ce9f6de648119922179ac9faaecc9445a5eade6;p=emacs.git * nsfont.m (INVALID_GLYPH): New define. (nsfont_encode_char): Use INVALID_GLYPH. (ns_uni_to_glyphs): Ditto, check for NSNullGlyph. Fixes: debbugs:15138 --- diff --git a/src/ChangeLog b/src/ChangeLog index d2e80ace3e4..caba3eb96d4 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2013-09-03 Jan Djärv + + * nsfont.m (INVALID_GLYPH): New define. + (nsfont_encode_char): Use INVALID_GLYPH. + (ns_uni_to_glyphs): Ditto, check for NSNullGlyph (Bug#15138). + 2013-09-02 Dmitry Antipov * xterm.c (x_last_mouse_movement_time): Revert last change. diff --git a/src/nsfont.m b/src/nsfont.m index 235150e3aef..e1c7d32dde0 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -61,6 +61,7 @@ static void ns_uni_to_glyphs (struct nsfont_info *font_info, static void ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block); +#define INVALID_GLYPH 0xFFFF /* ========================================================================== @@ -981,7 +982,7 @@ nsfont_encode_char (struct font *font, int c) ns_uni_to_glyphs (font_info, high); g = font_info->glyphs[high][low]; - return g == 0xFFFF ? FONT_INVALID_CODE : g; + return g == INVALID_GLYPH ? FONT_INVALID_CODE : g; } @@ -1354,8 +1355,8 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) #else g = glyphStorage->cglyphs[i]; /* TODO: is this a good check? maybe need to use coveredChars.. */ - if (g > numGlyphs) - g = 0xFFFF; /* hopefully unused... */ + if (g > numGlyphs || g == NSNullGlyph) + g = INVALID_GLYPH; /* hopefully unused... */ #endif *glyphs = g; } @@ -1483,7 +1484,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) characterIndex: (NSUInteger)charIndex { len = glyphIndex+length; - for (i =glyphIndex; i maxGlyph) maxGlyph = len;