diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2021-08-19 16:48:59 -0700 |
commit | 07fcbb558d797272b9f43547da60beda485873a3 (patch) | |
tree | 77d5da14e9f9d9d8b1d877c70c01296fd3893796 /src/ftfont.c | |
parent | c9bdeff3e45a7ac84a74a81bb048046f82dddc91 (diff) | |
parent | fb81c8c3adf8633f2f617c82f6019aef630860c7 (diff) | |
download | emacs-07fcbb558d797272b9f43547da60beda485873a3.tar.gz |
Merge remote-tracking branch 'origin/master' into athena/unstable
Diffstat (limited to 'src/ftfont.c')
-rw-r--r-- | src/ftfont.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ftfont.c b/src/ftfont.c index 0603dd9ce68..12d0d72d276 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -2798,10 +2798,31 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, if (gstring.used > LGSTRING_GLYPH_LEN (lgstring)) return Qnil; + + /* mflt_run may fail to set g->g.to (which must be a valid index + into lgstring) correctly if the font has an OTF table that is + different from what the m17n library expects. */ for (i = 0; i < gstring.used; i++) { MFLTGlyphFT *g = (MFLTGlyphFT *) (gstring.glyphs) + i; + if (g->g.to >= len) + { + /* Invalid g->g.to. */ + g->g.to = len - 1; + int from = g->g.from; + /* Fix remaining glyphs. */ + for (++i; i < gstring.used; i++) + { + g = (MFLTGlyphFT *) (gstring.glyphs) + i; + g->g.from = from; + g->g.to = len - 1; + } + } + } + for (i = 0; i < gstring.used; i++) + { + MFLTGlyphFT *g = (MFLTGlyphFT *) (gstring.glyphs) + i; g->g.from = LGLYPH_FROM (LGSTRING_GLYPH (lgstring, g->g.from)); g->g.to = LGLYPH_TO (LGSTRING_GLYPH (lgstring, g->g.to)); } |