formatting, improving documentation
This commit is contained in:
parent
9b15ea341c
commit
2c002e13a7
55
ChangeLog
55
ChangeLog
@ -5,37 +5,48 @@
|
||||
|
||||
2006-09-28 David Turner <david@freetype.org>
|
||||
|
||||
* include/freetype/internal/ftobjs.h, src/truetype/ttobjs.c,
|
||||
src/base/ftobjs.c: fixed a bug in the automatic unpatented
|
||||
hinting support which prevented normal bytecode hinting to
|
||||
work properly
|
||||
Fix a bug in the automatic unpatented hinting support which prevents
|
||||
normal bytecode hinting to work properly.
|
||||
|
||||
* src/autofit/aftypes.h: undefining AF_DEBUG to get rid of
|
||||
traces
|
||||
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec):
|
||||
s/force_autohint/unpatented_hinting/. Update all callers.
|
||||
|
||||
* src/base/ftobjs.c (FT_Load_Glyph): Updated code.
|
||||
|
||||
* src/autofit/aftypes.h (AF_DEBUG): Undefine to get rid of traces.
|
||||
|
||||
2006-09-27 David Turner <david@freetype.org>
|
||||
|
||||
* include/freetype/freetype.h: bumping FT_FREETYPE_PATCH to 2
|
||||
for an upcoming 2.2.2 release
|
||||
* include/freetype/freetype.h (FT_FREETYPE_PATCH): Set to 2.
|
||||
|
||||
* include/freetype/ftlcdfil.h, src/freetype/ftlcdfil.c:
|
||||
added a new API to support color filtering of subpixel glyph
|
||||
bitmaps. In default build, the function FT_Library_SetLcdFilter
|
||||
returns FT_Err_Unimplemented_Feature; you need to #define
|
||||
FT_CONFIG_OPTION_SUBPIXEL_RENDERING in ftoption.h to compile
|
||||
the real implementation
|
||||
|
||||
* src/smooth/ftsmooth.c: adding support for sub-pixel color
|
||||
filtering; simplifying a few function calls
|
||||
Add a new API to support color filtering of subpixel glyph bitmaps.
|
||||
In a default build, the function `FT_Library_SetLcdFilter' returns
|
||||
`FT_Err_Unimplemented_Feature'; you need to #define
|
||||
FT_CONFIG_OPTION_SUBPIXEL_RENDERING in ftoption.h to compile the
|
||||
real implementation.
|
||||
|
||||
* include/freetype/config/ftheader.h: adding FT_LCD_FILTER_H
|
||||
macro that points to <freetype/ftlcdfil.h>
|
||||
* include/freetype/ftlcdfil.h, src/base/ftlcdfil.c: New files.
|
||||
|
||||
* src/base/Jamfile, src/base/rules.mk, vms_make.com: adding
|
||||
'ftlcdfil.c' to the list of compiled source files
|
||||
* include/freetype/internal/ftobjs.h (FT_Bitmap_LcdFilterFunc): New
|
||||
typedef.
|
||||
(FT_LibraryRec) [FT_CONFIG_OPTION_SUBPIXEL_RENDERING]: New members
|
||||
`lcd_filter_weights' and `lcd_filter'.
|
||||
|
||||
* modules.cfg: adding ftlcdfil.c to the list of default base
|
||||
extensions
|
||||
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Remove arguments
|
||||
`hmul' and `vmul'.
|
||||
Handle subpixel rendering.
|
||||
Simplify function.
|
||||
(ft_smooth_render_lcd): Use `FT_RENDER_MODE_LCD'.
|
||||
(ft_smooth_render_lcd_v): Use `FT_RENDER_MODE_LCD_V'.
|
||||
|
||||
* include/freetype/config/ftheader.h (FT_LCD_FILTER_H): New macro,
|
||||
pointing to <freetype/ftlcdfil.h>.
|
||||
|
||||
* src/base/Jamfile (_sources), src/base/rules.mk (BASE_SRC),
|
||||
vms_make.com: Add `ftlcdfil.c' to the list of compiled source files.
|
||||
|
||||
* modules.cfg (BASE_EXTENSIONS): Add ftlcdfil.c.
|
||||
|
||||
2006-09-26 David Bustin
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
/* limited to the infamous 8.3 naming rule required by DOS (and */
|
||||
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
|
||||
/* */
|
||||
/* The second reason is that is allows for more flexibility in the */
|
||||
/* The second reason is that it allows for more flexibility in the */
|
||||
/* way FreeType 2 is installed on a given system. */
|
||||
/* */
|
||||
/*************************************************************************/
|
||||
@ -222,7 +222,7 @@
|
||||
* FT_IMAGE_H
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing types
|
||||
* A macro used in #include statements to name the file containing type
|
||||
* definitions related to glyph images (i.e., bitmaps, outlines,
|
||||
* scan-converter parameters).
|
||||
*
|
||||
@ -282,7 +282,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* API used to manage multiple @FT_Size objects per face.
|
||||
* API which manages multiple @FT_Size objects per face.
|
||||
*
|
||||
*/
|
||||
#define FT_SIZES_H <freetype/ftsizes.h>
|
||||
@ -334,10 +334,9 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* enumeration values used to identify name strings, languages,
|
||||
* encodings, etc. This file really contains a _large_ set of constant
|
||||
* macro definitions, taken from the TrueType and OpenType
|
||||
* specifications.
|
||||
* enumeration values which identify name strings, languages, encodings,
|
||||
* etc. This file really contains a _large_ set of constant macro
|
||||
* definitions, taken from the TrueType and OpenType specifications.
|
||||
*
|
||||
*/
|
||||
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
|
||||
@ -363,7 +362,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* definitions of TrueType four-byte `tags' used to identify blocks in
|
||||
* definitions of TrueType four-byte `tags' which identify blocks in
|
||||
* SFNT-based font formats (i.e., TrueType and OpenType).
|
||||
*
|
||||
*/
|
||||
@ -377,7 +376,8 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* definitions of an API to access BDF-specific strings from a face.
|
||||
* definitions of an API which accesses BDF-specific strings from a
|
||||
* face.
|
||||
*
|
||||
*/
|
||||
#define FT_BDF_H <freetype/ftbdf.h>
|
||||
@ -390,7 +390,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* definitions of an API to support for gzip-compressed files.
|
||||
* definitions of an API which supports gzip-compressed files.
|
||||
*
|
||||
*/
|
||||
#define FT_GZIP_H <freetype/ftgzip.h>
|
||||
@ -403,7 +403,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* definitions of an API to support for LZW-compressed files.
|
||||
* definitions of an API which supports LZW-compressed files.
|
||||
*
|
||||
*/
|
||||
#define FT_LZW_H <freetype/ftlzw.h>
|
||||
@ -416,7 +416,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* definitions of an API to support Windows FNT files.
|
||||
* definitions of an API which supports Windows FNT files.
|
||||
*
|
||||
*/
|
||||
#define FT_WINFONTS_H <freetype/ftwinfnt.h>
|
||||
@ -484,7 +484,7 @@
|
||||
* `glyph image' API of the FreeType 2 cache sub-system.
|
||||
*
|
||||
* It is used to define a cache for @FT_Glyph elements. You can also
|
||||
* see the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
|
||||
* use the API defined in @FT_CACHE_SMALL_BITMAPS_H if you only need to
|
||||
* store small glyph bitmaps, as it will use less memory.
|
||||
*
|
||||
* This macro is deprecated. Simply include @FT_CACHE_H to have all
|
||||
@ -568,7 +568,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* optional FreeType 2 API used to access embedded `name' strings in
|
||||
* optional FreeType 2 API which accesses embedded `name' strings in
|
||||
* SFNT-based font formats (i.e., TrueType and OpenType).
|
||||
*
|
||||
*/
|
||||
@ -582,7 +582,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* optional FreeType 2 API used to validate OpenType tables (BASE, GDEF,
|
||||
* optional FreeType 2 API which validates OpenType tables (BASE, GDEF,
|
||||
* GPOS, GSUB, JSTF).
|
||||
*
|
||||
*/
|
||||
@ -596,7 +596,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* optional FreeType 2 API used to validate TrueTypeGX/AAT tables (feat,
|
||||
* optional FreeType 2 API which validates TrueTypeGX/AAT tables (feat,
|
||||
* mort, morx, bsln, just, kern, opbd, trak, prop).
|
||||
*
|
||||
*/
|
||||
@ -610,7 +610,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* FreeType 2 API used to access PFR-specific data.
|
||||
* FreeType 2 API which accesses PFR-specific data.
|
||||
*
|
||||
*/
|
||||
#define FT_PFR_H <freetype/ftpfr.h>
|
||||
@ -623,7 +623,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* FreeType 2 API used to stroke outline path.
|
||||
* FreeType 2 API which provides functions to stroke outline paths.
|
||||
*/
|
||||
#define FT_STROKER_H <freetype/ftstroke.h>
|
||||
|
||||
@ -635,7 +635,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* FreeType 2 API used to perform artificial obliquing and emboldening.
|
||||
* FreeType 2 API which performs artificial obliquing and emboldening.
|
||||
*/
|
||||
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
|
||||
|
||||
@ -647,7 +647,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* FreeType 2 API used to provide functions specific to the XFree86 and
|
||||
* FreeType 2 API which provides functions specific to the XFree86 and
|
||||
* X.Org X11 servers.
|
||||
*/
|
||||
#define FT_XFREE86_H <freetype/ftxf86.h>
|
||||
@ -660,11 +660,12 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* FreeType 2 API used to perform trigonometric computations (e.g.,
|
||||
* FreeType 2 API which performs trigonometric computations (e.g.,
|
||||
* cosines and arc tangents).
|
||||
*/
|
||||
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
*
|
||||
* @macro:
|
||||
@ -672,7 +673,7 @@
|
||||
*
|
||||
* @description:
|
||||
* A macro used in #include statements to name the file containing the
|
||||
* FreeType 2 API used to perform color filtering for subpixel rendering
|
||||
* FreeType 2 API which performs color filtering for subpixel rendering.
|
||||
*/
|
||||
#define FT_LCD_FILTER_H <freetype/ftlcdfil.h>
|
||||
|
||||
|
@ -1,89 +1,125 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftlcdfil.h */
|
||||
/* */
|
||||
/* FreeType API for color filtering of subpixel bitmap glyphs */
|
||||
/* (specification). */
|
||||
/* */
|
||||
/* Copyright 2006 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#ifndef __FT_LCD_FILTER_H__
|
||||
#define __FT_LCD_FILTER_H__
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_FREETYPE_H
|
||||
|
||||
|
||||
FT_BEGIN_HEADER
|
||||
|
||||
/**
|
||||
* @func: FT_Library_SetLcdFilter
|
||||
*
|
||||
* @description:
|
||||
* this function is used to apply color filtering to LCD decimated
|
||||
* bitmaps, like the ones used when calling @FT_Render_Glyph with
|
||||
* @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
|
||||
*
|
||||
* @input:
|
||||
* library :: handle to target library instance
|
||||
*
|
||||
* filter_weights :: a pointer to an array of 5 bytes corresponding
|
||||
* to the weights of a 5-tap FIR filter. Each
|
||||
* weight must be positive, and their sum should
|
||||
* be at least 256 to avoid loss of darkness
|
||||
* in the rendered glyphs. The sum can be greater
|
||||
* than 256 to darken the glyphs (el-cheapo gamma)
|
||||
*
|
||||
* you can use @FT_LCD_FILTER_NONE here to disable
|
||||
* this feature, or @FT_LCD_FILTER_DEFAULT to use
|
||||
* a default filter that should work well on most
|
||||
* LCD screens.
|
||||
*
|
||||
* @return:
|
||||
* error code. 0 means success
|
||||
*
|
||||
* @note:
|
||||
* this feature is always disabled by default. Clients must make an
|
||||
* explicit call to this function with a 'filter_weights' value other
|
||||
* than @FT_LCD_FILTER_NONE in order to enable it.
|
||||
*
|
||||
* due to *PATENTS* covering subpixel rendering, this function will
|
||||
* not do anything except return @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 the library
|
||||
*
|
||||
* the filter affects glyph bitmaps rendered through
|
||||
* @FT_Render_Glyph, @FT_Glyph_Get_Bitmap, @FT_Load_Glyph and
|
||||
* @FT_Load_Char.
|
||||
*
|
||||
* It does *not* affect the output of @FT_Outline_Render
|
||||
* and @FT_Outline_Get_Bitmap.
|
||||
*
|
||||
* if this feature is activated, the dimensions of LCD glyph bitmaps
|
||||
* will be either larger or taller than the dimensions of the corresponding
|
||||
* outline with regards to the pixel grid. For example, for @FT_RENDER_MODE_LCD,
|
||||
* the filter adds up to 3 pixels to the left, and up to 3 pixels to the right.
|
||||
*
|
||||
* the bitmap offset values are adjusted correctly, so clients shouldn't need
|
||||
* to modify thei layout / glyph positioning code when enabling the filter.
|
||||
*/
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
*
|
||||
* @func:
|
||||
* FT_Library_SetLcdFilter
|
||||
*
|
||||
* @description:
|
||||
* This function is used to apply color filtering to LCD decimated
|
||||
* bitmaps, like the ones used when calling @FT_Render_Glyph with
|
||||
* @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
|
||||
*
|
||||
* @input:
|
||||
* library ::
|
||||
* A handle to the target library instance.
|
||||
*
|
||||
* filter_weights ::
|
||||
* A pointer to an array of 5 bytes corresponding to the weights of a
|
||||
* 5-tap FIR filter. Each weight must be positive, and their sum
|
||||
* should be at least 256 to avoid loss of darkness in the rendered
|
||||
* glyphs. The sum can be greater than 256 to darken the glyphs
|
||||
* (`el-cheapo gamma').
|
||||
*
|
||||
* You can use @FT_LCD_FILTER_NONE here to disable this feature, or
|
||||
* @FT_LCD_FILTER_DEFAULT to use a default filter that should work
|
||||
* well on most LCD screens.
|
||||
*
|
||||
* @return:
|
||||
* FreeType error code. 0 means success.
|
||||
*
|
||||
* @note:
|
||||
* This feature is always disabled by default. Clients must make an
|
||||
* explicit call to this function with a `filter_weights' value other
|
||||
* than @FT_LCD_FILTER_NONE in order to enable it.
|
||||
*
|
||||
* 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 the library.
|
||||
*
|
||||
* The filter affects glyph bitmaps rendered through FT_Render_Glyph,
|
||||
* @@FT_Glyph_Get_Bitmap, @FT_Load_Glyph, and FT_Load_Char.
|
||||
*
|
||||
* It does _not_ affect the output of @FT_Outline_Render and
|
||||
* @FT_Outline_Get_Bitmap.
|
||||
*
|
||||
* If this feature is activated, the dimensions of LCD glyph bitmaps are
|
||||
* either larger or taller than the dimensions of the corresponding
|
||||
* outline with regards to the pixel grid. For example, for
|
||||
* @FT_RENDER_MODE_LCD, the filter adds up to 3 pixels to the left, and
|
||||
* up to 3 pixels to the right.
|
||||
*
|
||||
* The bitmap offset values are adjusted correctly, so clients shouldn't
|
||||
* need to modify their layout and glyph positioning code when enabling
|
||||
* the filter.
|
||||
*
|
||||
*/
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
const FT_Byte* filter_weights );
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
const FT_Byte* filter_weights );
|
||||
|
||||
|
||||
/**
|
||||
* @enum: FT_LCD_FILTER_XXX
|
||||
*
|
||||
* @desc: a list of constants correspond to useful lcd filter settings to
|
||||
* be used when calling @FT_Library_SetLcdFilter
|
||||
*
|
||||
* @values:
|
||||
* FT_LCD_FILTER_NONE :: the value NULL is reserved to indicate that
|
||||
* LCD color filtering should be disabled.
|
||||
*
|
||||
* FT_LCD_FILTER_DEFAULT ::
|
||||
* this value is reserved to indicate a default FIR filter that
|
||||
* should work well on most LCD screen. For the really curious,
|
||||
* it corresponds to the array 0x10, 0x40, 0x70, 0x40, 0x10
|
||||
*/
|
||||
#define FT_LCD_FILTER_NONE ((const FT_Byte*)NULL )
|
||||
|
||||
#define FT_LCD_FILTER_DEFAULT ((const FT_Byte*)(void*)(ft_ptrdiff_t)1)
|
||||
/**************************************************************************
|
||||
*
|
||||
* @enum:
|
||||
* FT_LCD_FILTER_XXX
|
||||
*
|
||||
* @description:
|
||||
* A list of constants which correspond to useful lcd filter settings
|
||||
* for the @FT_Library_SetLcdFilter function.
|
||||
*
|
||||
* @values:
|
||||
* FT_LCD_FILTER_NONE ::
|
||||
* The value NULL is reserved to indicate that LCD color filtering
|
||||
* should be disabled.
|
||||
*
|
||||
* FT_LCD_FILTER_DEFAULT ::
|
||||
* This value is reserved to indicate a default FIR filter that should
|
||||
* work well on most LCD screen. It corresponds to the array 0x10,
|
||||
* 0x40, 0x70, 0x40, 0x10.
|
||||
*
|
||||
*/
|
||||
#define FT_LCD_FILTER_NONE ( (const FT_Byte*)NULL )
|
||||
|
||||
#define FT_LCD_FILTER_DEFAULT ( (const FT_Byte*)(void*)(ft_ptrdiff_t)1 )
|
||||
|
||||
/* */
|
||||
|
||||
/* */
|
||||
|
||||
FT_END_HEADER
|
||||
|
||||
#endif /* __FT_LCD_FILTER_H__ */
|
||||
|
||||
|
||||
/* END */
|
||||
|
@ -214,8 +214,8 @@ FT_BEGIN_HEADER
|
||||
/* unpatented_hinting :: */
|
||||
/* This boolean flag instructs the glyph loader that this font */
|
||||
/* can only be loaded through the unpatented bytecode interpreter. */
|
||||
/* in this case, the auto-hinter will never be called for it. */
|
||||
/* except if you use FT_LOAD_FORCE_AUTOHINT */
|
||||
/* In that case, the auto-hinter is never called for it, except if */
|
||||
/* you use FT_LOAD_FORCE_AUTOHINT. */
|
||||
/* */
|
||||
typedef struct FT_Face_InternalRec_
|
||||
{
|
||||
@ -639,6 +639,7 @@ FT_BEGIN_HEADER
|
||||
FT_Render_Mode render_mode,
|
||||
FT_Byte* weights );
|
||||
|
||||
|
||||
/*************************************************************************/
|
||||
/* */
|
||||
/* <Struct> */
|
||||
|
@ -1,6 +1,6 @@
|
||||
# FreeType 2 src/base Jamfile
|
||||
#
|
||||
# Copyright 2001, 2002, 2003, 2004, 2005 by
|
||||
# Copyright 2001, 2002, 2003, 2004, 2005, 2006 by
|
||||
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
#
|
||||
# This file is part of the FreeType project, and may only be used, modified,
|
||||
|
@ -1,79 +1,102 @@
|
||||
/***************************************************************************/
|
||||
/* */
|
||||
/* ftlcdfil.c */
|
||||
/* */
|
||||
/* FreeType API for color filtering of subpixel bitmap glyphs (body). */
|
||||
/* */
|
||||
/* Copyright 2006 by */
|
||||
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
||||
/* */
|
||||
/* This file is part of the FreeType project, and may only be used, */
|
||||
/* modified, and distributed under the terms of the FreeType project */
|
||||
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
||||
/* this file you indicate that you have read the license and */
|
||||
/* understand and accept it fully. */
|
||||
/* */
|
||||
/***************************************************************************/
|
||||
|
||||
|
||||
#include <ft2build.h>
|
||||
#include FT_LCD_FILTER_H
|
||||
#include FT_IMAGE_H
|
||||
#include FT_INTERNAL_OBJECTS_H
|
||||
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
|
||||
/* this function will be invoked from within the smooth
|
||||
* rasterizer
|
||||
*/
|
||||
/* The smooth rasterizer invokes this function. */
|
||||
static void
|
||||
_ft_lcd_filter( FT_Bitmap* bitmap,
|
||||
FT_Render_Mode mode,
|
||||
FT_Byte* weights )
|
||||
{
|
||||
FT_UInt width = (FT_UInt) bitmap->width;
|
||||
FT_UInt height = (FT_UInt) bitmap->rows;
|
||||
FT_UInt width = (FT_UInt)bitmap->width;
|
||||
FT_UInt height = (FT_UInt)bitmap->rows;
|
||||
|
||||
|
||||
/* horizontal in-place FIR filter */
|
||||
if ( mode == FT_RENDER_MODE_LCD && width >= 4 )
|
||||
{
|
||||
FT_Byte* line = bitmap->buffer;
|
||||
FT_Byte* line = bitmap->buffer;
|
||||
|
||||
|
||||
for ( ; height > 0; height--, line += bitmap->pitch )
|
||||
{
|
||||
FT_UInt fir[5];
|
||||
FT_UInt val1, xx;
|
||||
FT_UInt fir[5];
|
||||
FT_UInt val1, xx;
|
||||
|
||||
|
||||
val1 = line[0];
|
||||
fir[0] = weights[2]*val1;
|
||||
fir[1] = weights[3]*val1;
|
||||
fir[2] = weights[4]*val1;
|
||||
fir[0] = weights[2] * val1;
|
||||
fir[1] = weights[3] * val1;
|
||||
fir[2] = weights[4] * val1;
|
||||
fir[3] = 0;
|
||||
fir[4] = 0;
|
||||
|
||||
|
||||
val1 = line[1];
|
||||
fir[0] += weights[1]*val1;
|
||||
fir[1] += weights[2]*val1;
|
||||
fir[2] += weights[3]*val1;
|
||||
fir[3] += weights[4]*val1;
|
||||
fir[0] += weights[1] * val1;
|
||||
fir[1] += weights[2] * val1;
|
||||
fir[2] += weights[3] * val1;
|
||||
fir[3] += weights[4] * val1;
|
||||
|
||||
for ( xx = 2; xx < width; xx++ )
|
||||
{
|
||||
FT_UInt val, pix;
|
||||
|
||||
val = line[xx];
|
||||
pix = fir[0] + weights[0]*val;
|
||||
fir[0] = fir[1] + weights[1]*val;
|
||||
fir[1] = fir[2] + weights[2]*val;
|
||||
fir[2] = fir[3] + weights[3]*val;
|
||||
fir[3] = weights[4]*val;
|
||||
|
||||
pix >>= 8;
|
||||
pix |= -(pix >> 8);
|
||||
line[xx-2] = (FT_Byte)pix;
|
||||
val = line[xx];
|
||||
pix = fir[0] + weights[0] * val;
|
||||
fir[0] = fir[1] + weights[1] * val;
|
||||
fir[1] = fir[2] + weights[2] * val;
|
||||
fir[2] = fir[3] + weights[3] * val;
|
||||
fir[3] = weights[4] * val;
|
||||
|
||||
pix >>= 8;
|
||||
pix |= -( pix >> 8 );
|
||||
line[xx - 2] = (FT_Byte)pix;
|
||||
}
|
||||
|
||||
{
|
||||
FT_UInt pix;
|
||||
|
||||
pix = fir[0] >> 8;
|
||||
pix |= -(pix >> 8);
|
||||
line[xx-2] = (FT_Byte)pix;
|
||||
|
||||
pix = fir[1] >> 8;
|
||||
pix |= -(pix >> 8);
|
||||
line[xx-1] = (FT_Byte)pix;
|
||||
pix = fir[0] >> 8;
|
||||
pix |= -( pix >> 8 );
|
||||
line[xx - 2] = (FT_Byte)pix;
|
||||
|
||||
pix = fir[1] >> 8;
|
||||
pix |= -( pix >> 8 );
|
||||
line[xx - 1] = (FT_Byte)pix;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* vertical in-place FIR filter */
|
||||
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )
|
||||
{
|
||||
FT_Byte* column = bitmap->buffer;
|
||||
FT_Int pitch = bitmap->pitch;
|
||||
FT_Byte* column = bitmap->buffer;
|
||||
FT_Int pitch = bitmap->pitch;
|
||||
|
||||
|
||||
for ( ; width > 0; width--, column++ )
|
||||
{
|
||||
@ -81,47 +104,50 @@
|
||||
FT_UInt fir[5];
|
||||
FT_UInt val1, yy;
|
||||
|
||||
|
||||
val1 = col[0];
|
||||
fir[0] = weights[2]*val1;
|
||||
fir[1] = weights[3]*val1;
|
||||
fir[2] = weights[4]*val1;
|
||||
fir[0] = weights[2] * val1;
|
||||
fir[1] = weights[3] * val1;
|
||||
fir[2] = weights[4] * val1;
|
||||
fir[3] = 0;
|
||||
fir[4] = 0;
|
||||
col += pitch;
|
||||
|
||||
val1 = col[0];
|
||||
fir[0] += weights[1]*val1;
|
||||
fir[1] += weights[2]*val1;
|
||||
fir[2] += weights[3]*val1;
|
||||
fir[3] += weights[4]*val1;
|
||||
fir[0] += weights[1] * val1;
|
||||
fir[1] += weights[2] * val1;
|
||||
fir[2] += weights[3] * val1;
|
||||
fir[3] += weights[4] * val1;
|
||||
col += pitch;
|
||||
|
||||
for ( yy = 2; yy < height; yy++ )
|
||||
{
|
||||
FT_UInt val, pix;
|
||||
|
||||
val = col[0];
|
||||
pix = fir[0] + weights[0]*val;
|
||||
fir[0] = fir[1] + weights[1]*val;
|
||||
fir[1] = fir[2] + weights[2]*val;
|
||||
fir[2] = fir[3] + weights[3]*val;
|
||||
fir[3] = weights[4]*val;
|
||||
|
||||
pix >>= 8;
|
||||
pix |= -(pix >> 8);
|
||||
col[-2*pitch] = (FT_Byte)pix;
|
||||
col += pitch;
|
||||
val = col[0];
|
||||
pix = fir[0] + weights[0] * val;
|
||||
fir[0] = fir[1] + weights[1] * val;
|
||||
fir[1] = fir[2] + weights[2] * val;
|
||||
fir[2] = fir[3] + weights[3] * val;
|
||||
fir[3] = weights[4] * val;
|
||||
|
||||
pix >>= 8;
|
||||
pix |= -( pix >> 8 );
|
||||
col[-2 * pitch] = (FT_Byte)pix;
|
||||
col += pitch;
|
||||
}
|
||||
|
||||
{
|
||||
FT_UInt pix;
|
||||
|
||||
pix = fir[0] >> 8;
|
||||
pix |= -(pix >> 8);
|
||||
col[-2*pitch] = (FT_Byte)pix;
|
||||
|
||||
pix = fir[0] >> 8;
|
||||
pix |= -( pix >> 8 );
|
||||
col[-2 * pitch] = (FT_Byte)pix;
|
||||
|
||||
pix = fir[1] >> 8;
|
||||
pix |= -(pix >> 8);
|
||||
pix |= -( pix >> 8 );
|
||||
col[-pitch] = (FT_Byte)pix;
|
||||
}
|
||||
}
|
||||
@ -130,11 +156,12 @@
|
||||
|
||||
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
const FT_Byte* filter_weights )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
const FT_Byte* filter_weights )
|
||||
{
|
||||
static const FT_Byte default_filter[5] = { 0x10, 0x40, 0x70, 0x40, 0x10 };
|
||||
|
||||
|
||||
if ( library == NULL )
|
||||
return FT_Err_Invalid_Argument;
|
||||
|
||||
@ -153,17 +180,19 @@
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
|
||||
|
||||
FT_EXPORT( FT_Error )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
const FT_Byte* filter_weights )
|
||||
FT_Library_SetLcdFilter( FT_Library library,
|
||||
const FT_Byte* filter_weights )
|
||||
{
|
||||
FT_UNUSED(library);
|
||||
FT_UNUSED(filter_weights);
|
||||
FT_UNUSED( library );
|
||||
FT_UNUSED( filter_weights );
|
||||
|
||||
return FT_Err_Unimplemented_Feature;
|
||||
}
|
||||
|
||||
#endif /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
|
||||
|
||||
#endif
|
||||
|
||||
/* END */
|
||||
|
@ -106,8 +106,8 @@
|
||||
FT_UInt width, height, height_org, width_org, pitch;
|
||||
FT_Bitmap* bitmap;
|
||||
FT_Memory memory;
|
||||
FT_Int hmul = (mode == FT_RENDER_MODE_LCD);
|
||||
FT_Int vmul = (mode == FT_RENDER_MODE_LCD_V);
|
||||
FT_Int hmul = mode == FT_RENDER_MODE_LCD;
|
||||
FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
|
||||
FT_Pos x_shift, y_shift, x_left, y_top;
|
||||
|
||||
FT_Raster_Params params;
|
||||
@ -170,6 +170,7 @@
|
||||
y_top = (FT_Int)( cbox.yMax >> 6 );
|
||||
|
||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||
|
||||
if ( slot->library->lcd_filter )
|
||||
{
|
||||
if ( hmul )
|
||||
@ -186,6 +187,7 @@
|
||||
y_top += 1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
|
||||
|
@ -1,6 +1,6 @@
|
||||
$! make Freetype2 under OpenVMS
|
||||
$!
|
||||
$! Copyright 2003, 2004 by
|
||||
$! Copyright 2003, 2004, 2006 by
|
||||
$! David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||
$!
|
||||
$! This file is part of the FreeType project, and may only be used, modified,
|
||||
|
Loading…
Reference in New Issue
Block a user