[cairo] Handling invalid glyphs

Behdad Esfahbod behdad at behdad.org
Tue Sep 11 19:59:14 PDT 2007


On Wed, 2007-09-12 at 00:52 +0100, Baz wrote:
> On 11/09/2007, Behdad Esfahbod <behdad at behdad.org> wrote:
> > Objections?  Brian, do you want to fix the Quartz backend?  No idea
> > what's the status of win32.
> 
> I tried the patch with ft+quartz, works for me (test case is
> test/text-glyph-range.c with one of the glyph ids changed to 0xcFFF,
> this reproduces the OOM error)
> 
> The atsui side of things doesn't need a similar fix, it silently
> renders 'missing' glyphs as if they had glyph id 0 - a box - and
> measures them that way too. Not ideal behaviour maybe, but not
> crashing.
> 
> Reviewing the patch...if the value in 'glyph = face->glyph;' is being
> left somewhat random because of the error, you could always do what
> apple are doing, and do a second call to load in glyph id 0 there.

I tried that already.  The subsetted font didn't have glyph id 0 either.
(Only TrueType fonts guarantee to have that IIRC)  Using some default
size (based on font_extents) and drawing a box is the way to go.

> Baz
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759





More information about the cairo mailing list