freetype
[Top][All Lists]
Advanced

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

[ft] BDF chars with ENCODING > 65536


From: Joshua Hadley
Subject: [ft] BDF chars with ENCODING > 65536
Date: Thu, 29 Nov 2007 14:36:44 -0800

In freetype/src/bdf/bdflib.c I see:

/* Check that the encoding is in the range [0,65536] because */ /* otherwise p->have (a bitmap with static size) overflows. */
      if ( (size_t)p->glyph_enc >= sizeof ( p->have ) * 8 )
      {
        error = BDF_Err_Invalid_File_Format;
        goto Exit;
      }

Which seems to prevent a BDF containing chars with ENCODING values > 65536 from being opened. I have some BDF data which includes such characters, and would like to enable FreeType to use them.

Seeing as how the comment above indicates a relationship with p- >have, it seems unwise to simply increase the cutoff for the test (i.e. change "* 8" to something larger). So I'm wondering, if one were desirous of modifying bdflib.c (and whatever other dependencies necessary), what is the best approach?

My perhaps naïve idea is to change the above to:
      if ( (size_t)p->glyph_enc >= sizeof ( p->have ) * 136 )

And as well modify 'have' of the _bdf_parse_t structure as:
        unsigned long   have[34816];   /* was: have[2048] */


But I don't know what the larger implications of doing this are, or if there's a more clever and/or sensible way to accomplish the goal of having FreeType successfully read a BDF containing chars with ENCODING > 65536.





reply via email to

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