bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25945: Emacs aborts while calling FT_Load_Glyph


From: Eli Zaretskii
Subject: bug#25945: Emacs aborts while calling FT_Load_Glyph
Date: Fri, 03 Mar 2017 10:08:42 +0200

> Date: Fri, 03 Mar 2017 08:04:29 +0100 (CET)
> From: Werner LEMBERG <address@hidden>
> 
> For me, Emacs aborts at ftfont.c:1550 while `mew' tries to display an
> e-mail.
> 
>   1549  if (FT_Load_Glyph (ft_face, g->g.code, FT_LOAD_DEFAULT) != 0)
>   1550    emacs_abort ();
> 
> Examining `ft_face' and `g->g.code' I see that the font in question is
> `Padauk Book Bold' (PadaukBook-Bold.ttf), glyph 376.  Examining this
> font further with `ftview' I see that bytecode of this font is broken,
> and that the font can only be displayed successfully without bytecode.
> [This is version 3.002 of the font, taken from the current TeXLive
> repository.]
> 
> I think there is no reason that Emacs aborts for such broken fonts.
> Instead I suggest that (a) Emacs tries to load the glyph again without
> hinting, and (b) if that fails, it should display a missing glyph,
> using the standard rectangle with hex digits in it.
> 
> New code for (a) is quite simple:
> 
>   if (FT_Load_Glyph (ft_face, g->g.code, FT_LOAD_DEFAULT) != 0)
>     if (FT_Load_Glyph (ft_face, g->g.code, FT_LOAD_NO_HINTING) != 0)
>       ...

This should probably be accompanied by a suitable FONT_ADD_LOG call,
to mention that this fallback was taken.

> [The code might be further improved by implementing a per-font glyph
>  load mode, to be initialized with `FT_LOAD_DEFAULT'.  If, say, 100
>  calls using `FT_LOAD_DEFAULT' for a given font fails, and
>  `FT_LOAD_NO_HINTING' is successful, the default loading behaviour for
>  this font could be switched to `FT_LOAD_NO_HINTING'.  Given that such
>  broken fonts are rare my suggestion is probably overkill, however.]
> 
> My knowledge of Emacs internals is too small to provide an
> implementation for (b).

I think it's too late for (b) when we discover this problem in
ftfont_get_metrics.  To do (b) we should have discovered this in
ftfont_has_char, or thereabouts.

I'm CC'ing Handa-san in the hope that he will have insights and
comments on this.

Thanks.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]