@ -31,6 +31,22 @@
static FT_Error
ft_smooth_init ( FT_Renderer render )
{
# ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
FT_Vector * sub = render - > root . library - > lcd_geometry ;
/* set up default subpixel geometry for striped RGB panels. */
sub [ 0 ] . x = - 21 ;
sub [ 0 ] . y = 0 ;
sub [ 1 ] . x = 0 ;
sub [ 1 ] . y = 0 ;
sub [ 2 ] . x = 21 ;
sub [ 2 ] . y = 0 ;
# endif
render - > clazz - > raster_class - > raster_reset ( render - > raster , NULL , 0 ) ;
return 0 ;
@ -235,33 +251,33 @@
unsigned int width = bitmap - > width ;
int pitch = bitmap - > pitch ;
FT_Vector * sub = slot - > library - > lcd_geometry ;
/* Render 3 separate monochrome bitmaps, shifting the outline */
/* by 1/3 pixel. */
width / = 3 ;
bitmap - > buffer + = width ;
/* Render 3 separate monochrome bitmaps, shifting the outline. */
width / = 3 ;
FT_Outline_Translate ( outline , - sub [ 0 ] . x , - sub [ 0 ] . y ) ;
error = render - > raster_render ( render - > raster , & params ) ;
if ( error )
goto Exit ;
FT_Outline_Translate ( outline , - 21 , 0 ) ;
x_shift - = 21 ;
bitmap - > buffer + = width ;
FT_Outline_Translate ( outline , sub [ 0 ] . x - sub [ 1 ] . x , sub [ 0 ] . y - sub [ 1 ] . y ) ;
error = render - > raster_render ( render - > raster , & params ) ;
if ( error )
goto Exit ;
FT_Outline_Translate ( outline , 42 , 0 ) ;
x_shift + = 42 ;
bitmap - > buffer - = 2 * width ;
bitmap - > buffer + = width ;
FT_Outline_Translate ( outline , sub [ 1 ] . x - sub [ 2 ] . x , sub [ 1 ] . y - sub [ 2 ] . y ) ;
error = render - > raster_render ( render - > raster , & params ) ;
if ( error )
goto Exit ;
x_shift - = sub [ 2 ] . x ;
y_shift - = sub [ 2 ] . y ;
bitmap - > buffer - = 2 * width ;
/* XXX: Rearrange the bytes according to FT_PIXEL_MODE_LCD. */
/* XXX: It is more efficient to render every third byte above. */
@ -286,34 +302,36 @@
{
int pitch = bitmap - > pitch ;
FT_Vector * sub = slot - > library - > lcd_geometry ;
/* Render 3 separate monochrome bitmaps, shifting the outline */
/* by 1/3 pixel. Triple the pitch to render on each third row. */
/* Render 3 separate monochrome bitmaps, shifting the outline. */
/* Notice that the subpixel geometry vectors are rotated. */
/* Triple the pitch to render on each third row. */
bitmap - > pitch * = 3 ;
bitmap - > rows / = 3 ;
bitmap - > buffer + = pitch ;
FT_Outline_Translate ( outline , - sub [ 0 ] . y , sub [ 0 ] . x ) ;
error = render - > raster_render ( render - > raster , & params ) ;
if ( error )
goto Exit ;
FT_Outline_Translate ( outline , 0 , 21 ) ;
y_shift + = 21 ;
bitmap - > buffer + = pitch ;
FT_Outline_Translate ( outline , sub [ 0 ] . y - sub [ 1 ] . y , sub [ 1 ] . x - sub [ 0 ] . x ) ;
error = render - > raster_render ( render - > raster , & params ) ;
if ( error )
goto Exit ;
FT_Outline_Translate ( outline , 0 , - 42 ) ;
y_shift - = 42 ;
bitmap - > buffer - = 2 * pitch ;
bitmap - > buffer + = pitch ;
FT_Outline_Translate ( outline , sub [ 1 ] . y - sub [ 2 ] . y , sub [ 2 ] . x - sub [ 1 ] . x ) ;
error = render - > raster_render ( render - > raster , & params ) ;
if ( error )
goto Exit ;
x_shift - = sub [ 2 ] . y ;
y_shift + = sub [ 2 ] . x ;
bitmap - > buffer - = 2 * pitch ;
bitmap - > pitch / = 3 ;
bitmap - > rows * = 3 ;
}