printf(": glyph %u, size %dx%d\n", n, bmp->width, bmp->rows);
}
- if(bmp->pixel_mode!=FT_PIXEL_MODE_GRAY)
+ if(bmp->pixel_mode!=FT_PIXEL_MODE_GRAY && bmp->pixel_mode!=FT_PIXEL_MODE_MONO)
{
- fprintf(stderr, "Warning: Glyph %u skipped, not grayscale\n", n);
+ fprintf(stderr, "Warning: Glyph %u skipped, incompatible pixel mode\n", n);
continue;
}
for(y=0; y<bmp->rows; ++y)
{
- for(x=0; x<bmp->width; ++x)
- dst[x] = src[x];
+ if(bmp->pixel_mode==FT_PIXEL_MODE_MONO)
+ {
+ for(x=0; x<bmp->width; ++x)
+ dst[x] = ((src[x/8]&(0x80>>(x%8))) ? 0xFF : 0x00);
+ }
+ else
+ {
+ for(x=0; x<bmp->width; ++x)
+ dst[x] = src[x];
+ }
src += bmp->pitch;
dst += image->w;