Details

[Home]

Issue of the Implementation # V0020

Brief

FT_Bitmap_Convert does not handle pixel modes FT_PIXEL_MODE_LCD and FT_PIXEL_MODE_LCD_V

Detailed Description

The description of FT_Bitmap_Convert states the following:

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'.

The return value of this function is described as follows:
return
FreeType error code. 0 means success.


Allowed pixel modes are listed in the following enum:
  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 this function is called 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.

It looks like FT_Bitmap_Convert() does not handle pixel modes FT_PIXEL_MODE_LCD and FT_PIXEL_MODE_LCD_V.

Problem location(s) in the standard

Linux Standard Base Desktop Specification 3.2, Chapter 12. Libraries, 12.1 Interfaces for libfreetype that refers FreeType-2.1.10 API Reference, section "Bitmap Handling"

Reproducing

  1. Unpack the attached archive
  2. Build the sample C program contained in it
  3. Run the program as follows:
    ./bitmap_convert fonts/FreeMono.ttf M FT_RENDER_MODE_LCD 4
    ./bitmap_convert fonts/FreeMono.ttf M FT_RENDER_MODE_LCD_V 4

Component

freetype 2.1.10 or later

Accepted

freetype-devel mailing list, #2, 2009.01

Status

Fixed in freetype 2.3.8

[Home]