freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Possible implementation error: FT_Bitmap_Convert() does not h


From: Chi Nguyen
Subject: [ft-devel] Possible implementation error: FT_Bitmap_Convert() does not handle pixel modes FT_PIXEL_MODE_LCD and FT_PIXEL_MODE_LCD_V
Date: Mon, 5 Jan 2009 10:32:56 +0700

To freetype maintainers,

In developing the test for the freetype function FT_Bitmap_Convert(), we
have encountered the following possible implementation error.

The specification for FT_Bitmap_Convert() stated that:

"FT_Bitmap_Convert
 FT_EXPORT( FT_Error ) FT_Bitmap_Convert( 
        FT_Library library,
        const FT_Bitmap *source, 
        FT_Bitmap *target, 
        FT_Int alignment ); 

This function converts a bitmap object with depth 1bpp, 2bpp, 4bpp, or 8bpp
to a bitmap object with depth 8bpp., making the number of used bytes per
line (a.k.a. the `pitch') a multiple of `alignment'."

AND

"return 
FreeType error code. 0 means success."


Where as part of the source FT_Bitmap*, the different pixel-modes are
defined as follows:

  typedef enum  FT_Pixel_Mode_
  {
    FT_PIXEL_MODE_NONE = 0,
    FT_PIXEL_MODE_MONO,
    FT_PIXEL_MODE_GRAY,
    FT_PIXEL_MODE_GRAY2,
    FT_PIXEL_MODE_GRAY4,
    FT_PIXEL_MODE_LCD,
    FT_PIXEL_MODE_LCD_V,

    FT_PIXEL_MODE_MAX      /* do not remove */

  } FT_Pixel_Mode;

However, when we called this function to convert a bitmap with pixel-mode of
the type FT_PIXEL_MODE_LCD or FT_PIXEL_MODE_LCD_V, the error code 6
(FT_Err_Invalid_Argument) is returned.

There is an inconsistency between the spec and the implementation: It looks
like FT_Bitmap_Convert() does not handle pixel modes FT_PIXEL_MODE_LCD and
FT_PIXEL_MODE_LCD_V.
 
We have tested this on 32-bit and 64-bit x86 based test systems running
under the following distros OpenSuSE 11 (32 bit), Ubuntu 8.04 (ia32), RHEL52
x86-64, SLES 10.1 (32bit), Fedora 9 (32bit) with freetype 2.1.10 and
freetype 2.3.7.

To help demonstrate the alleged-bug, we have included with this email:
        a) a c program bitmap_convert.c and 
        b) a snippet of the free type function FT_Bitmap_Convert() that we
found on the web.

To reproduce use
        bitmap_convert FreeMono.ttf M FT_RENDER_MODE_LCD 4
or
        bitmap_convert FreeMono.ttf M FT_RENDER_MODE_LCD_V 4

Where the specified font file (FreeMono.ttf) should be available in the
local directory ./fonts 

Thank you very much for your time and please let us know any ruling/finding
that you may have.


Sincerely yours,


Nguyen Trung Chi

NEC Solutions VietNam

Attachment: FT_Bitmap_Convert.rar
Description: Binary data


reply via email to

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