Add new function `FT_Library_SetLcdFilterWeights'.
This is based on code written by Lifter <http://unixforum.org/index.php?showuser=11691>. It fixes FreeDesktop bug #27386. * src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): New function. * include/freetype/ftlcdfil.h: Updated. * docs/CHANGES: Updated.
This commit is contained in:
parent
8c4cce5259
commit
460d23f168
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2010-04-05 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
Add new function `FT_Library_SetLcdFilterWeights'.
|
||||
|
||||
This is based on code written by Lifter
|
||||
<http://unixforum.org/index.php?showuser=11691>. It fixes
|
||||
FreeDesktop bug #27386.
|
||||
|
||||
* src/base/ftlcdfil.c (FT_Library_SetLcdFilterWeights): New
|
||||
function.
|
||||
|
||||
* include/freetype/ftlcdfil.h: Updated.
|
||||
|
||||
* docs/CHANGES: Updated.
|
||||
|
||||
2010-04-01 John Tytgat <John.Tytgat@esko.com>
|
||||
|
||||
Fix Savannah bug #29404.
|
||||
|
13
docs/CHANGES
13
docs/CHANGES
@ -1,3 +1,13 @@
|
||||
CHANGES BETWEEN 2.3.12 and 2.3.13
|
||||
|
||||
I. IMPORTANT CHANGES
|
||||
|
||||
- A new function `FT_Library_SetLcdFilterWeights' is available to
|
||||
adjust the filter weights set by `FT_Library_SetLcdFilter'.
|
||||
|
||||
|
||||
======================================================================
|
||||
|
||||
CHANGES BETWEEN 2.3.11 and 2.3.12
|
||||
|
||||
I. IMPORTANT CHANGES
|
||||
@ -3378,7 +3388,8 @@ Extensions support:
|
||||
|
||||
------------------------------------------------------------------------
|
||||
|
||||
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by
|
||||
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||
2010 by
|
||||
David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
|
||||
This file is part of the FreeType project, and may only be used,
|
||||
|
@ -5,7 +5,7 @@
|
||||
/* FreeType API for color filtering of subpixel bitmap glyphs */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 2006, 2007, 2008 by */
|
||||
/* Copyright 2006, 2007, 2008, 2010 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -161,6 +161,47 @@ FT_BEGIN_HEADER
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter );
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @func:
|
||||
* FT_Library_SetLcdFilterWeights
|
||||
*
|
||||
* @description:
|
||||
* Use this function to override the filter weights selected by
|
||||
* @FT_Library_SetLcdFilter. By default, FreeType uses the quintuple
|
||||
* (0x00, 0x55, 0x56, 0x55, 0x00) for FT_LCD_FILTER_LIGHT, and (0x10,
|
||||
* 0x40, 0x70, 0x40, 0x10) for FT_LCD_FILTER_DEFAULT and
|
||||
* FT_LCD_FILTER_LEGACY.
|
||||
*
|
||||
* @input:
|
||||
* library ::
|
||||
* A handle to the target library instance.
|
||||
*
|
||||
* weights ::
|
||||
* A pointer to an array; the function copies the first five bytes and
|
||||
* uses them to specify the filter weights.
|
||||
*
|
||||
* @return:
|
||||
* FreeType error code. 0~means success.
|
||||
*
|
||||
* @note:
|
||||
* Due to *PATENTS* covering subpixel rendering, this function doesn't
|
||||
* do anything except returning `FT_Err_Unimplemented_Feature' if the
|
||||
* configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
|
||||
* defined in your build of the library, which should correspond to all
|
||||
* default builds of FreeType.
|
||||
*
|
||||
* This function must be called after @FT_Library_SetLcdFilter to have
|
||||
* any effect.
|
||||
*
|
||||
* @since:
|
||||
* 2.3.13
|
||||
*/
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_Library_SetLcdFilterWeights( FT_Library library,
|
||||
unsigned char *weights );
|
||||
|
||||
/* */
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
/* */
|
||||
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
|
||||
/* */
|
||||
/* Copyright 2006, 2008, 2009 by */
|
||||
/* Copyright 2006, 2008, 2009, 2010 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
@ -267,18 +267,31 @@
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter )
|
||||
FT_Library_SetLcdFilterWeights( FT_Library library,
|
||||
unsigned char *weights )
|
||||
{
|
||||
if ( !library || !weights )
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
ft_memcpy( library->lcd_weights, weights, 5 );
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter )
|
||||
{
|
||||
static const FT_Byte light_filter[5] =
|
||||
{ 0, 85, 86, 85, 0 };
|
||||
{ 0x00, 0x55, 0x56, 0x55, 0x00 };
|
||||
/* the values here sum up to a value larger than 256, */
|
||||
/* providing a cheap gamma correction */
|
||||
static const FT_Byte default_filter[5] =
|
||||
{ 0x10, 0x40, 0x70, 0x40, 0x10 };
|
||||
|
||||
|
||||
if ( library == NULL )
|
||||
if ( !library )
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
switch ( filter )
|
||||
@ -330,11 +343,23 @@
|
||||
}
|
||||
|
||||
library->lcd_filter = filter;
|
||||
return 0;
|
||||
|
||||
return FT_Err_Ok;
|
||||
}
|
||||
|
||||
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilterWeights( FT_Library library,
|
||||
unsigned char *weights )
|
||||
{
|
||||
FT_UNUSED( library );
|
||||
FT_UNUSED( weights );
|
||||
|
||||
return FT_Err_Unimplemented_Feature;
|
||||
}
|
||||
|
||||
|
||||
FT_EXPORT_DEF( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
FT_LcdFilter filter )
|
||||
|
Loading…
Reference in New Issue
Block a user