* src/character.c (char_width): Support glyphs with faces. (Bug#32276)

This commit is contained in:
Eli Zaretskii 2018-07-27 12:33:29 +03:00
parent 0feb6733d4
commit 71a915153a

View file

@ -34,6 +34,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#include "lisp.h" #include "lisp.h"
#include "character.h" #include "character.h"
#include "buffer.h" #include "buffer.h"
#include "dispextern.h"
#include "composite.h" #include "composite.h"
#include "disptab.h" #include "disptab.h"
@ -288,15 +289,17 @@ char_width (int c, struct Lisp_Char_Table *dp)
if (VECTORP (disp)) if (VECTORP (disp))
for (i = 0, width = 0; i < ASIZE (disp); i++) for (i = 0, width = 0; i < ASIZE (disp); i++)
{ {
int c;
ch = AREF (disp, i); ch = AREF (disp, i);
if (CHARACTERP (ch)) if (GLYPH_CODE_P (ch))
{ c = GLYPH_CODE_CHAR (ch);
int w = CHARACTER_WIDTH (XFASTINT (ch)); else if (CHARACTERP (ch))
c = XFASTINT (ch);
int w = CHARACTER_WIDTH (c);
if (INT_ADD_WRAPV (width, w, &width)) if (INT_ADD_WRAPV (width, w, &width))
string_overflow (); string_overflow ();
} }
} }
}
return width; return width;
} }