Add 8bpp support.

* src/bdf/bdflib.c (_bdf_parse_start): Handle 8bpp.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Ditto.
* src/bdf/README: Updated.
This commit is contained in:
Werner Lemberg 2002-06-03 20:01:23 +00:00
parent 153ba3f903
commit 48426ab477
4 changed files with 35 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2002-06-03 Werner Lemberg <wl@gnu.org>
Add 8bpp support.
* src/bdf/bdflib.c (_bdf_parse_start): Handle 8bpp.
* src/bdf/bdfdrivr.c (BDF_Glyph_Load): Ditto.
* src/bdf/README: Updated.
2002-06-02 Detlef Würkner <TetiSoft@apg.lahn.de>
* src/pfr/pfrload.c (pfr_phy_font_done): Free `blue_values' array.

View File

@ -62,9 +62,9 @@ xmbdfed bitmap font editor. Microsoft's SBIT tool expects bitmap fonts in
that format for adding anti-aliased them to TrueType fonts. It introduces a
fourth field to the `SIZE' keyword which gives the bpp value (bits per
pixel) of the glyph data in the font. Possible values are 1 (the default),
2 (four gray levels), and 4 (16 gray levels). The driver returns either a
bitmap with 1 bit per pixel or a pixmap with 8bits per pixel (using 4 and 16
gray levels, respectively).
2 (four gray levels), 4 (16 gray levels), and 8 (256 gray levels). The
driver returns either a bitmap with 1 bit per pixel or a pixmap with 8bits
per pixel (using 4, 16, and 256 gray levels, respectively).
Known problems

View File

@ -432,6 +432,13 @@ THE SOFTWARE.
p += glyph.bpr;
}
break;
case 8:
bitmap->num_grays = 256;
FT_MEM_COPY( bitmap->buffer, glyph.bitmap,
bitmap->rows * bitmap->pitch );
break;
}
}

View File

@ -2150,20 +2150,28 @@
/* Check for the bits per pixel field. */
if ( p->list.used == 5 )
{
p->font->bpp = _bdf_atos( p->list.field[4], 0, 10 );
if ( p->font->bpp > 1 && ( p->font->bpp & 1 ) )
unsigned short bitcount, i, shift;
p->font->bpp = (unsigned short)_bdf_atos( p->list.field[4], 0, 10 );
/* Only values 1, 2, 4, 8 are allowed. */
shift = p->font->bpp;
bitcount = 0;
for ( i = 0; shift > 0; i++ )
{
/* Move up to the next bits per pixel value if an odd number */
/* is encountered. */
p->font->bpp++;
if ( p->font->bpp <= 4 )
FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp ));
if ( shift & 1 )
bitcount = i;
shift >>= 1;
}
if ( p->font->bpp > 4 )
shift = ( bitcount > 3 ) ? 8 : ( 1 << bitcount );
if ( p->font->bpp > shift || p->font->bpp != shift )
{
/* select next higher value */
p->font->bpp = shift << 1;
FT_TRACE2(( "_bdf_parse_start: " ACMSG11, p->font->bpp ));
p->font->bpp = 4;
}
}
else