mirror of https://github.com/freetype/freetype
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>
|
2006-09-28 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* include/freetype/internal/ftobjs.h, src/truetype/ttobjs.c,
|
Fix a bug in the automatic unpatented hinting support which prevents
|
||||||
src/base/ftobjs.c: fixed a bug in the automatic unpatented
|
normal bytecode hinting to work properly.
|
||||||
hinting support which prevented normal bytecode hinting to
|
|
||||||
work properly
|
|
||||||
|
|
||||||
* src/autofit/aftypes.h: undefining AF_DEBUG to get rid of
|
* include/freetype/internal/ftobjs.h (FT_Face_InternalRec):
|
||||||
traces
|
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>
|
2006-09-27 David Turner <david@freetype.org>
|
||||||
|
|
||||||
* include/freetype/freetype.h: bumping FT_FREETYPE_PATCH to 2
|
* include/freetype/freetype.h (FT_FREETYPE_PATCH): Set to 2.
|
||||||
for an upcoming 2.2.2 release
|
|
||||||
|
|
||||||
* 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
|
Add a new API to support color filtering of subpixel glyph bitmaps.
|
||||||
filtering; simplifying a few function calls
|
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
|
* include/freetype/ftlcdfil.h, src/base/ftlcdfil.c: New files.
|
||||||
macro that points to <freetype/ftlcdfil.h>
|
|
||||||
|
|
||||||
* src/base/Jamfile, src/base/rules.mk, vms_make.com: adding
|
* include/freetype/internal/ftobjs.h (FT_Bitmap_LcdFilterFunc): New
|
||||||
'ftlcdfil.c' to the list of compiled source files
|
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
|
* src/smooth/ftsmooth.c (ft_smooth_render_generic): Remove arguments
|
||||||
extensions
|
`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
|
2006-09-26 David Bustin
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@
|
||||||
/* limited to the infamous 8.3 naming rule required by DOS (and */
|
/* limited to the infamous 8.3 naming rule required by DOS (and */
|
||||||
/* `FT_MULTIPLE_MASTERS_H' is a lot more meaningful than `ftmm.h'). */
|
/* `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. */
|
/* way FreeType 2 is installed on a given system. */
|
||||||
/* */
|
/* */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -222,7 +222,7 @@
|
||||||
* FT_IMAGE_H
|
* FT_IMAGE_H
|
||||||
*
|
*
|
||||||
* @description:
|
* @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,
|
* definitions related to glyph images (i.e., bitmaps, outlines,
|
||||||
* scan-converter parameters).
|
* scan-converter parameters).
|
||||||
*
|
*
|
||||||
|
@ -282,7 +282,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_SIZES_H <freetype/ftsizes.h>
|
||||||
|
@ -334,10 +334,9 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* A macro used in #include statements to name the file containing the
|
||||||
* enumeration values used to identify name strings, languages,
|
* enumeration values which identify name strings, languages, encodings,
|
||||||
* encodings, etc. This file really contains a _large_ set of constant
|
* etc. This file really contains a _large_ set of constant macro
|
||||||
* macro definitions, taken from the TrueType and OpenType
|
* definitions, taken from the TrueType and OpenType specifications.
|
||||||
* specifications.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
|
#define FT_TRUETYPE_IDS_H <freetype/ttnameid.h>
|
||||||
|
@ -363,7 +362,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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).
|
* SFNT-based font formats (i.e., TrueType and OpenType).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -377,7 +376,8 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_BDF_H <freetype/ftbdf.h>
|
||||||
|
@ -390,7 +390,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_GZIP_H <freetype/ftgzip.h>
|
||||||
|
@ -403,7 +403,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_LZW_H <freetype/ftlzw.h>
|
||||||
|
@ -416,7 +416,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_WINFONTS_H <freetype/ftwinfnt.h>
|
||||||
|
@ -484,7 +484,7 @@
|
||||||
* `glyph image' API of the FreeType 2 cache sub-system.
|
* `glyph image' API of the FreeType 2 cache sub-system.
|
||||||
*
|
*
|
||||||
* It is used to define a cache for @FT_Glyph elements. You can also
|
* 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.
|
* store small glyph bitmaps, as it will use less memory.
|
||||||
*
|
*
|
||||||
* This macro is deprecated. Simply include @FT_CACHE_H to have all
|
* This macro is deprecated. Simply include @FT_CACHE_H to have all
|
||||||
|
@ -568,7 +568,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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).
|
* SFNT-based font formats (i.e., TrueType and OpenType).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -582,7 +582,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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).
|
* GPOS, GSUB, JSTF).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -596,7 +596,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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).
|
* mort, morx, bsln, just, kern, opbd, trak, prop).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -610,7 +610,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_PFR_H <freetype/ftpfr.h>
|
||||||
|
@ -623,7 +623,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_STROKER_H <freetype/ftstroke.h>
|
||||||
|
|
||||||
|
@ -635,7 +635,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#define FT_SYNTHESIS_H <freetype/ftsynth.h>
|
||||||
|
|
||||||
|
@ -647,7 +647,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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.
|
* X.Org X11 servers.
|
||||||
*/
|
*/
|
||||||
#define FT_XFREE86_H <freetype/ftxf86.h>
|
#define FT_XFREE86_H <freetype/ftxf86.h>
|
||||||
|
@ -660,11 +660,12 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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).
|
* cosines and arc tangents).
|
||||||
*/
|
*/
|
||||||
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
|
#define FT_TRIGONOMETRY_H <freetype/fttrigon.h>
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
*
|
*
|
||||||
* @macro:
|
* @macro:
|
||||||
|
@ -672,7 +673,7 @@
|
||||||
*
|
*
|
||||||
* @description:
|
* @description:
|
||||||
* A macro used in #include statements to name the file containing the
|
* 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>
|
#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__
|
#ifndef __FT_LCD_FILTER_H__
|
||||||
#define __FT_LCD_FILTER_H__
|
#define __FT_LCD_FILTER_H__
|
||||||
|
|
||||||
#include <ft2build.h>
|
#include <ft2build.h>
|
||||||
#include FT_FREETYPE_H
|
#include FT_FREETYPE_H
|
||||||
|
|
||||||
|
|
||||||
FT_BEGIN_HEADER
|
FT_BEGIN_HEADER
|
||||||
|
|
||||||
/**
|
|
||||||
* @func: FT_Library_SetLcdFilter
|
|
||||||
*
|
/**************************************************************************
|
||||||
* @description:
|
*
|
||||||
* this function is used to apply color filtering to LCD decimated
|
* @func:
|
||||||
* bitmaps, like the ones used when calling @FT_Render_Glyph with
|
* FT_Library_SetLcdFilter
|
||||||
* @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
|
*
|
||||||
*
|
* @description:
|
||||||
* @input:
|
* This function is used to apply color filtering to LCD decimated
|
||||||
* library :: handle to target library instance
|
* bitmaps, like the ones used when calling @FT_Render_Glyph with
|
||||||
*
|
* @FT_RENDER_MODE_LCD or @FT_RENDER_MODE_LCD_V.
|
||||||
* filter_weights :: a pointer to an array of 5 bytes corresponding
|
*
|
||||||
* to the weights of a 5-tap FIR filter. Each
|
* @input:
|
||||||
* weight must be positive, and their sum should
|
* library ::
|
||||||
* be at least 256 to avoid loss of darkness
|
* A handle to the target library instance.
|
||||||
* in the rendered glyphs. The sum can be greater
|
*
|
||||||
* than 256 to darken the glyphs (el-cheapo gamma)
|
* filter_weights ::
|
||||||
*
|
* A pointer to an array of 5 bytes corresponding to the weights of a
|
||||||
* you can use @FT_LCD_FILTER_NONE here to disable
|
* 5-tap FIR filter. Each weight must be positive, and their sum
|
||||||
* this feature, or @FT_LCD_FILTER_DEFAULT to use
|
* should be at least 256 to avoid loss of darkness in the rendered
|
||||||
* a default filter that should work well on most
|
* glyphs. The sum can be greater than 256 to darken the glyphs
|
||||||
* LCD screens.
|
* (`el-cheapo gamma').
|
||||||
*
|
*
|
||||||
* @return:
|
* You can use @FT_LCD_FILTER_NONE here to disable this feature, or
|
||||||
* error code. 0 means success
|
* @FT_LCD_FILTER_DEFAULT to use a default filter that should work
|
||||||
*
|
* well on most LCD screens.
|
||||||
* @note:
|
*
|
||||||
* this feature is always disabled by default. Clients must make an
|
* @return:
|
||||||
* explicit call to this function with a 'filter_weights' value other
|
* FreeType error code. 0 means success.
|
||||||
* than @FT_LCD_FILTER_NONE in order to enable it.
|
*
|
||||||
*
|
* @note:
|
||||||
* due to *PATENTS* covering subpixel rendering, this function will
|
* This feature is always disabled by default. Clients must make an
|
||||||
* not do anything except return @FT_Err_Unimplemented_Feature if the
|
* explicit call to this function with a `filter_weights' value other
|
||||||
* configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
|
* than @FT_LCD_FILTER_NONE in order to enable it.
|
||||||
* defined in your build of the library, which should correspond
|
*
|
||||||
* to all default builds of the library
|
* Due to *PATENTS* covering subpixel rendering, this function doesn't
|
||||||
*
|
* do anything except returning @FT_Err_Unimplemented_Feature if the
|
||||||
* the filter affects glyph bitmaps rendered through
|
* configuration macro FT_CONFIG_OPTION_SUBPIXEL_RENDERING is not
|
||||||
* @FT_Render_Glyph, @FT_Glyph_Get_Bitmap, @FT_Load_Glyph and
|
* defined in your build of the library, which should correspond to all
|
||||||
* @FT_Load_Char.
|
* default builds of the library.
|
||||||
*
|
*
|
||||||
* It does *not* affect the output of @FT_Outline_Render
|
* The filter affects glyph bitmaps rendered through FT_Render_Glyph,
|
||||||
* and @FT_Outline_Get_Bitmap.
|
* @@FT_Glyph_Get_Bitmap, @FT_Load_Glyph, and FT_Load_Char.
|
||||||
*
|
*
|
||||||
* if this feature is activated, the dimensions of LCD glyph bitmaps
|
* It does _not_ affect the output of @FT_Outline_Render and
|
||||||
* will be either larger or taller than the dimensions of the corresponding
|
* @FT_Outline_Get_Bitmap.
|
||||||
* 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.
|
* If this feature is activated, the dimensions of LCD glyph bitmaps are
|
||||||
*
|
* either larger or taller than the dimensions of the corresponding
|
||||||
* the bitmap offset values are adjusted correctly, so clients shouldn't need
|
* outline with regards to the pixel grid. For example, for
|
||||||
* to modify thei layout / glyph positioning code when enabling the filter.
|
* @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_EXPORT( FT_Error )
|
||||||
FT_Library_SetLcdFilter( FT_Library library,
|
FT_Library_SetLcdFilter( FT_Library library,
|
||||||
const FT_Byte* filter_weights );
|
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
|
FT_END_HEADER
|
||||||
|
|
||||||
#endif /* __FT_LCD_FILTER_H__ */
|
#endif /* __FT_LCD_FILTER_H__ */
|
||||||
|
|
||||||
|
|
||||||
|
/* END */
|
||||||
|
|
|
@ -214,8 +214,8 @@ FT_BEGIN_HEADER
|
||||||
/* unpatented_hinting :: */
|
/* unpatented_hinting :: */
|
||||||
/* This boolean flag instructs the glyph loader that this font */
|
/* This boolean flag instructs the glyph loader that this font */
|
||||||
/* can only be loaded through the unpatented bytecode interpreter. */
|
/* can only be loaded through the unpatented bytecode interpreter. */
|
||||||
/* in this case, the auto-hinter will never be called for it. */
|
/* In that case, the auto-hinter is never called for it, except if */
|
||||||
/* except if you use FT_LOAD_FORCE_AUTOHINT */
|
/* you use FT_LOAD_FORCE_AUTOHINT. */
|
||||||
/* */
|
/* */
|
||||||
typedef struct FT_Face_InternalRec_
|
typedef struct FT_Face_InternalRec_
|
||||||
{
|
{
|
||||||
|
@ -639,6 +639,7 @@ FT_BEGIN_HEADER
|
||||||
FT_Render_Mode render_mode,
|
FT_Render_Mode render_mode,
|
||||||
FT_Byte* weights );
|
FT_Byte* weights );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Struct> */
|
/* <Struct> */
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# FreeType 2 src/base Jamfile
|
# 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.
|
# David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||||
#
|
#
|
||||||
# This file is part of the FreeType project, and may only be used, modified,
|
# 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 <ft2build.h>
|
||||||
#include FT_LCD_FILTER_H
|
#include FT_LCD_FILTER_H
|
||||||
#include FT_IMAGE_H
|
#include FT_IMAGE_H
|
||||||
#include FT_INTERNAL_OBJECTS_H
|
#include FT_INTERNAL_OBJECTS_H
|
||||||
|
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||||
|
|
||||||
/* this function will be invoked from within the smooth
|
/* The smooth rasterizer invokes this function. */
|
||||||
* rasterizer
|
|
||||||
*/
|
|
||||||
static void
|
static void
|
||||||
_ft_lcd_filter( FT_Bitmap* bitmap,
|
_ft_lcd_filter( FT_Bitmap* bitmap,
|
||||||
FT_Render_Mode mode,
|
FT_Render_Mode mode,
|
||||||
FT_Byte* weights )
|
FT_Byte* weights )
|
||||||
{
|
{
|
||||||
FT_UInt width = (FT_UInt) bitmap->width;
|
FT_UInt width = (FT_UInt)bitmap->width;
|
||||||
FT_UInt height = (FT_UInt) bitmap->rows;
|
FT_UInt height = (FT_UInt)bitmap->rows;
|
||||||
|
|
||||||
|
|
||||||
/* horizontal in-place FIR filter */
|
/* horizontal in-place FIR filter */
|
||||||
if ( mode == FT_RENDER_MODE_LCD && width >= 4 )
|
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 )
|
for ( ; height > 0; height--, line += bitmap->pitch )
|
||||||
{
|
{
|
||||||
FT_UInt fir[5];
|
FT_UInt fir[5];
|
||||||
FT_UInt val1, xx;
|
FT_UInt val1, xx;
|
||||||
|
|
||||||
|
|
||||||
val1 = line[0];
|
val1 = line[0];
|
||||||
fir[0] = weights[2]*val1;
|
fir[0] = weights[2] * val1;
|
||||||
fir[1] = weights[3]*val1;
|
fir[1] = weights[3] * val1;
|
||||||
fir[2] = weights[4]*val1;
|
fir[2] = weights[4] * val1;
|
||||||
fir[3] = 0;
|
fir[3] = 0;
|
||||||
fir[4] = 0;
|
fir[4] = 0;
|
||||||
|
|
||||||
|
|
||||||
val1 = line[1];
|
val1 = line[1];
|
||||||
fir[0] += weights[1]*val1;
|
fir[0] += weights[1] * val1;
|
||||||
fir[1] += weights[2]*val1;
|
fir[1] += weights[2] * val1;
|
||||||
fir[2] += weights[3]*val1;
|
fir[2] += weights[3] * val1;
|
||||||
fir[3] += weights[4]*val1;
|
fir[3] += weights[4] * val1;
|
||||||
|
|
||||||
for ( xx = 2; xx < width; xx++ )
|
for ( xx = 2; xx < width; xx++ )
|
||||||
{
|
{
|
||||||
FT_UInt val, pix;
|
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;
|
val = line[xx];
|
||||||
pix |= -(pix >> 8);
|
pix = fir[0] + weights[0] * val;
|
||||||
line[xx-2] = (FT_Byte)pix;
|
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;
|
FT_UInt pix;
|
||||||
|
|
||||||
pix = fir[0] >> 8;
|
|
||||||
pix |= -(pix >> 8);
|
|
||||||
line[xx-2] = (FT_Byte)pix;
|
|
||||||
|
|
||||||
pix = fir[1] >> 8;
|
pix = fir[0] >> 8;
|
||||||
pix |= -(pix >> 8);
|
pix |= -( pix >> 8 );
|
||||||
line[xx-1] = (FT_Byte)pix;
|
line[xx - 2] = (FT_Byte)pix;
|
||||||
|
|
||||||
|
pix = fir[1] >> 8;
|
||||||
|
pix |= -( pix >> 8 );
|
||||||
|
line[xx - 1] = (FT_Byte)pix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* vertical in-place FIR filter */
|
/* vertical in-place FIR filter */
|
||||||
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )
|
else if ( mode == FT_RENDER_MODE_LCD_V && height >= 4 )
|
||||||
{
|
{
|
||||||
FT_Byte* column = bitmap->buffer;
|
FT_Byte* column = bitmap->buffer;
|
||||||
FT_Int pitch = bitmap->pitch;
|
FT_Int pitch = bitmap->pitch;
|
||||||
|
|
||||||
|
|
||||||
for ( ; width > 0; width--, column++ )
|
for ( ; width > 0; width--, column++ )
|
||||||
{
|
{
|
||||||
|
@ -81,47 +104,50 @@
|
||||||
FT_UInt fir[5];
|
FT_UInt fir[5];
|
||||||
FT_UInt val1, yy;
|
FT_UInt val1, yy;
|
||||||
|
|
||||||
|
|
||||||
val1 = col[0];
|
val1 = col[0];
|
||||||
fir[0] = weights[2]*val1;
|
fir[0] = weights[2] * val1;
|
||||||
fir[1] = weights[3]*val1;
|
fir[1] = weights[3] * val1;
|
||||||
fir[2] = weights[4]*val1;
|
fir[2] = weights[4] * val1;
|
||||||
fir[3] = 0;
|
fir[3] = 0;
|
||||||
fir[4] = 0;
|
fir[4] = 0;
|
||||||
col += pitch;
|
col += pitch;
|
||||||
|
|
||||||
val1 = col[0];
|
val1 = col[0];
|
||||||
fir[0] += weights[1]*val1;
|
fir[0] += weights[1] * val1;
|
||||||
fir[1] += weights[2]*val1;
|
fir[1] += weights[2] * val1;
|
||||||
fir[2] += weights[3]*val1;
|
fir[2] += weights[3] * val1;
|
||||||
fir[3] += weights[4]*val1;
|
fir[3] += weights[4] * val1;
|
||||||
col += pitch;
|
col += pitch;
|
||||||
|
|
||||||
for ( yy = 2; yy < height; yy++ )
|
for ( yy = 2; yy < height; yy++ )
|
||||||
{
|
{
|
||||||
FT_UInt val, pix;
|
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;
|
val = col[0];
|
||||||
pix |= -(pix >> 8);
|
pix = fir[0] + weights[0] * val;
|
||||||
col[-2*pitch] = (FT_Byte)pix;
|
fir[0] = fir[1] + weights[1] * val;
|
||||||
col += pitch;
|
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;
|
FT_UInt pix;
|
||||||
|
|
||||||
pix = fir[0] >> 8;
|
|
||||||
pix |= -(pix >> 8);
|
pix = fir[0] >> 8;
|
||||||
col[-2*pitch] = (FT_Byte)pix;
|
pix |= -( pix >> 8 );
|
||||||
|
col[-2 * pitch] = (FT_Byte)pix;
|
||||||
|
|
||||||
pix = fir[1] >> 8;
|
pix = fir[1] >> 8;
|
||||||
pix |= -(pix >> 8);
|
pix |= -( pix >> 8 );
|
||||||
col[-pitch] = (FT_Byte)pix;
|
col[-pitch] = (FT_Byte)pix;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -130,11 +156,12 @@
|
||||||
|
|
||||||
|
|
||||||
FT_EXPORT( FT_Error )
|
FT_EXPORT( FT_Error )
|
||||||
FT_Library_SetLcdFilter( FT_Library library,
|
FT_Library_SetLcdFilter( FT_Library library,
|
||||||
const FT_Byte* filter_weights )
|
const FT_Byte* filter_weights )
|
||||||
{
|
{
|
||||||
static const FT_Byte default_filter[5] = { 0x10, 0x40, 0x70, 0x40, 0x10 };
|
static const FT_Byte default_filter[5] = { 0x10, 0x40, 0x70, 0x40, 0x10 };
|
||||||
|
|
||||||
|
|
||||||
if ( library == NULL )
|
if ( library == NULL )
|
||||||
return FT_Err_Invalid_Argument;
|
return FT_Err_Invalid_Argument;
|
||||||
|
|
||||||
|
@ -153,17 +180,19 @@
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else /* !FT_CONFIG_OPTION_SUBPIXEL_RENDERING */
|
||||||
|
|
||||||
FT_EXPORT( FT_Error )
|
FT_EXPORT( FT_Error )
|
||||||
FT_Library_SetLcdFilter( FT_Library library,
|
FT_Library_SetLcdFilter( FT_Library library,
|
||||||
const FT_Byte* filter_weights )
|
const FT_Byte* filter_weights )
|
||||||
{
|
{
|
||||||
FT_UNUSED(library);
|
FT_UNUSED( library );
|
||||||
FT_UNUSED(filter_weights);
|
FT_UNUSED( filter_weights );
|
||||||
|
|
||||||
return FT_Err_Unimplemented_Feature;
|
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_UInt width, height, height_org, width_org, pitch;
|
||||||
FT_Bitmap* bitmap;
|
FT_Bitmap* bitmap;
|
||||||
FT_Memory memory;
|
FT_Memory memory;
|
||||||
FT_Int hmul = (mode == FT_RENDER_MODE_LCD);
|
FT_Int hmul = mode == FT_RENDER_MODE_LCD;
|
||||||
FT_Int vmul = (mode == FT_RENDER_MODE_LCD_V);
|
FT_Int vmul = mode == FT_RENDER_MODE_LCD_V;
|
||||||
FT_Pos x_shift, y_shift, x_left, y_top;
|
FT_Pos x_shift, y_shift, x_left, y_top;
|
||||||
|
|
||||||
FT_Raster_Params params;
|
FT_Raster_Params params;
|
||||||
|
@ -170,6 +170,7 @@
|
||||||
y_top = (FT_Int)( cbox.yMax >> 6 );
|
y_top = (FT_Int)( cbox.yMax >> 6 );
|
||||||
|
|
||||||
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
#ifdef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
|
||||||
|
|
||||||
if ( slot->library->lcd_filter )
|
if ( slot->library->lcd_filter )
|
||||||
{
|
{
|
||||||
if ( hmul )
|
if ( hmul )
|
||||||
|
@ -186,6 +187,7 @@
|
||||||
y_top += 1;
|
y_top += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
|
bitmap->pixel_mode = FT_PIXEL_MODE_GRAY;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
$! make Freetype2 under OpenVMS
|
$! make Freetype2 under OpenVMS
|
||||||
$!
|
$!
|
||||||
$! Copyright 2003, 2004 by
|
$! Copyright 2003, 2004, 2006 by
|
||||||
$! David Turner, Robert Wilhelm, and Werner Lemberg.
|
$! David Turner, Robert Wilhelm, and Werner Lemberg.
|
||||||
$!
|
$!
|
||||||
$! This file is part of the FreeType project, and may only be used, modified,
|
$! This file is part of the FreeType project, and may only be used, modified,
|
||||||
|
|
Loading…
Reference in New Issue