1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ttdriver.c */
|
|
|
|
/* */
|
|
|
|
/* TrueType font driver implementation (body). */
|
|
|
|
/* */
|
2002-04-01 16:25:28 +02:00
|
|
|
/* Copyright 1996-2001, 2002 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
2000-12-08 03:42:29 +01:00
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_INTERNAL_STREAM_H
|
|
|
|
#include FT_INTERNAL_SFNT_H
|
2001-03-20 15:50:04 +01:00
|
|
|
#include FT_TRUETYPE_IDS_H
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttdriver.h"
|
|
|
|
#include "ttgload.h"
|
1999-12-17 00:11:37 +01:00
|
|
|
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "tterrors.h"
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_ttdriver
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/**** ****/
|
|
|
|
/**** ****/
|
|
|
|
/**** F A C E S ****/
|
|
|
|
/**** ****/
|
|
|
|
/**** ****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
#undef PAIR_TAG
|
2000-06-16 21:34:52 +02:00
|
|
|
#define PAIR_TAG( left, right ) ( ( (FT_ULong)left << 16 ) | \
|
|
|
|
(FT_ULong)right )
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* Get_Kerning */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A driver method used to return the kerning vector between two */
|
|
|
|
/* glyphs of the same face. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the source face object. */
|
|
|
|
/* */
|
|
|
|
/* left_glyph :: The index of the left glyph in the kern pair. */
|
|
|
|
/* */
|
|
|
|
/* right_glyph :: The index of the right glyph in the kern pair. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* kerning :: The kerning vector. This is in font units for */
|
|
|
|
/* scalable formats, and in pixels for fixed-sizes */
|
|
|
|
/* formats. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* Only horizontal layouts (left-to-right & right-to-left) are */
|
|
|
|
/* supported by this function. Other layouts, or more sophisticated */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* kernings, are out of scope of this method (the basic driver */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* interface is meant to be simple). */
|
|
|
|
/* */
|
|
|
|
/* They can be implemented by format-specific interfaces. */
|
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
|
|
|
Get_Kerning( TT_Face face,
|
|
|
|
FT_UInt left_glyph,
|
|
|
|
FT_UInt right_glyph,
|
|
|
|
FT_Vector* kerning )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_Kern0_Pair pair;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( !face )
|
|
|
|
return TT_Err_Invalid_Face_Handle;
|
|
|
|
|
|
|
|
kerning->x = 0;
|
|
|
|
kerning->y = 0;
|
|
|
|
|
|
|
|
if ( face->kern_pairs )
|
|
|
|
{
|
|
|
|
/* there are some kerning pairs in this font file! */
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_ULong search_tag = PAIR_TAG( left_glyph, right_glyph );
|
|
|
|
FT_Long left, right;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
left = 0;
|
|
|
|
right = face->num_kern_pairs - 1;
|
|
|
|
|
2000-02-10 17:08:59 +01:00
|
|
|
while ( left <= right )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int middle = left + ( ( right - left ) >> 1 );
|
|
|
|
FT_ULong cur_pair;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
pair = face->kern_pairs + middle;
|
|
|
|
cur_pair = PAIR_TAG( pair->left, pair->right );
|
|
|
|
|
|
|
|
if ( cur_pair == search_tag )
|
|
|
|
goto Found;
|
|
|
|
|
|
|
|
if ( cur_pair < search_tag )
|
2000-06-12 21:36:41 +02:00
|
|
|
left = middle + 1;
|
1999-12-17 00:11:37 +01:00
|
|
|
else
|
2000-06-12 21:36:41 +02:00
|
|
|
right = middle - 1;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return TT_Err_Ok;
|
|
|
|
|
|
|
|
Found:
|
|
|
|
kerning->x = pair->value;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#undef PAIR_TAG
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/**** ****/
|
|
|
|
/**** ****/
|
|
|
|
/**** S I Z E S ****/
|
|
|
|
/**** ****/
|
|
|
|
/**** ****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* Set_Char_Sizes */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A driver method used to reset a size's character sizes (horizontal */
|
|
|
|
/* and vertical) expressed in fractional points. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* char_width :: The character width expressed in 26.6 */
|
|
|
|
/* fractional points. */
|
|
|
|
/* */
|
|
|
|
/* char_height :: The character height expressed in 26.6 */
|
|
|
|
/* fractional points. */
|
|
|
|
/* */
|
|
|
|
/* horz_resolution :: The horizontal resolution of the output device. */
|
|
|
|
/* */
|
|
|
|
/* vert_resolution :: The vertical resolution of the output device. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* size :: A handle to the target size object. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
|
|
|
Set_Char_Sizes( TT_Size size,
|
|
|
|
FT_F26Dot6 char_width,
|
|
|
|
FT_F26Dot6 char_height,
|
|
|
|
FT_UInt horz_resolution,
|
|
|
|
FT_UInt vert_resolution )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-02-18 23:25:22 +01:00
|
|
|
FT_Size_Metrics* metrics = &size->root.metrics;
|
|
|
|
FT_Size_Metrics* metrics2 = &size->metrics;
|
|
|
|
TT_Face face = (TT_Face)size->root.face;
|
2003-03-14 08:31:35 +01:00
|
|
|
FT_Long dim_x, dim_y;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2003-02-18 23:25:22 +01:00
|
|
|
*metrics2 = *metrics;
|
|
|
|
|
2000-01-27 14:56:02 +01:00
|
|
|
/* This bit flag, when set, indicates that the pixel size must be */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* truncated to an integer. Nearly all TrueType fonts have this */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* bit set, as hinting won't work really well otherwise. */
|
|
|
|
/* */
|
2003-02-18 23:25:22 +01:00
|
|
|
if ( ( face->header.Flags & 8 ) != 0 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-02-18 23:25:22 +01:00
|
|
|
/* we need to use rounding in the following computations. Otherwise,
|
|
|
|
* the resulting hinted outlines will be very slightly distorted
|
|
|
|
*/
|
2003-03-15 14:29:49 +01:00
|
|
|
dim_x = ( ( char_width * horz_resolution + (36+32*72) ) / 72 ) & -64;
|
|
|
|
dim_y = ( ( char_height * vert_resolution + (36+32*72) ) / 72 ) & -64;
|
2000-01-27 14:56:02 +01:00
|
|
|
}
|
2003-03-14 08:31:35 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
dim_x = ( ( char_width * horz_resolution + 36 ) / 72 );
|
|
|
|
dim_y = ( ( char_height * vert_resolution + 36 ) / 72 );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* we only modify "metrics2", not "metrics", so these changes have */
|
|
|
|
/* no effect on the result of the auto-hinter when it is used */
|
|
|
|
/* */
|
|
|
|
metrics2->x_ppem = (FT_UShort)( dim_x >> 6 );
|
|
|
|
metrics2->y_ppem = (FT_UShort)( dim_y >> 6 );
|
|
|
|
metrics2->x_scale = FT_DivFix( dim_x, face->root.units_per_EM );
|
|
|
|
metrics2->y_scale = FT_DivFix( dim_y, face->root.units_per_EM );
|
2000-05-17 01:44:38 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
size->ttmetrics.valid = FALSE;
|
2000-11-29 16:18:54 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-11-07 00:07:51 +01:00
|
|
|
size->strike_index = 0xFFFF;
|
2000-11-29 16:18:54 +01:00
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
return tt_size_reset( size );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* Set_Pixel_Sizes */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A driver method used to reset a size's character sizes (horizontal */
|
|
|
|
/* and vertical) expressed in integer pixels. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* pixel_width :: The character width expressed in integer pixels. */
|
|
|
|
/* */
|
|
|
|
/* pixel_height :: The character height expressed in integer pixels. */
|
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* size :: A handle to the target size object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
|
|
|
Set_Pixel_Sizes( TT_Size size,
|
|
|
|
FT_UInt pixel_width,
|
|
|
|
FT_UInt pixel_height )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-07-04 20:12:13 +02:00
|
|
|
FT_UNUSED( pixel_width );
|
|
|
|
FT_UNUSED( pixel_height );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* many things have been pre-computed by the base layer */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-02-18 23:25:22 +01:00
|
|
|
size->metrics = size->root.metrics;
|
1999-12-17 00:11:37 +01:00
|
|
|
size->ttmetrics.valid = FALSE;
|
2000-11-29 16:18:54 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-11-07 00:07:51 +01:00
|
|
|
size->strike_index = 0xFFFF;
|
2000-11-29 16:18:54 +01:00
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
return tt_size_reset( size );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* Load_Glyph */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* A driver method used to load a glyph within a given glyph slot. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* slot :: A handle to the target slot object where the glyph */
|
|
|
|
/* will be loaded. */
|
|
|
|
/* */
|
|
|
|
/* size :: A handle to the source face size at which the glyph */
|
2000-06-12 21:36:41 +02:00
|
|
|
/* must be scaled, loaded, etc. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* glyph_index :: The index of the glyph in the font file. */
|
|
|
|
/* */
|
|
|
|
/* load_flags :: A flag indicating what to load for this glyph. The */
|
|
|
|
/* FTLOAD_??? constants can be used to control the */
|
|
|
|
/* glyph loading process (e.g., whether the outline */
|
|
|
|
/* should be scaled, whether to load bitmaps or not, */
|
|
|
|
/* whether to hint the outline, etc). */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Error
|
|
|
|
Load_Glyph( TT_GlyphSlot slot,
|
|
|
|
TT_Size size,
|
|
|
|
FT_UShort glyph_index,
|
2002-09-21 20:43:10 +02:00
|
|
|
FT_Int32 load_flags )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
|
|
|
if ( !slot )
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
return TT_Err_Invalid_Slot_Handle;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/* check whether we want a scaled outline or bitmap */
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( !size )
|
|
|
|
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
|
|
|
|
|
|
|
|
if ( load_flags & FT_LOAD_NO_SCALE )
|
|
|
|
size = NULL;
|
|
|
|
|
|
|
|
/* reset the size object if necessary */
|
|
|
|
if ( size )
|
|
|
|
{
|
|
|
|
/* these two object must have the same parent */
|
|
|
|
if ( size->root.face != slot->face )
|
|
|
|
return TT_Err_Invalid_Face_Handle;
|
|
|
|
|
|
|
|
if ( !size->ttmetrics.valid )
|
|
|
|
{
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
if ( FT_SET_ERROR( tt_size_reset( size ) ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now load the glyph outline if necessary */
|
|
|
|
error = TT_Load_Glyph( size, slot, glyph_index, load_flags );
|
|
|
|
|
2000-03-06 14:23:32 +01:00
|
|
|
/* force drop-out mode to 2 - irrelevant now */
|
|
|
|
/* slot->outline.dropout_mode = 2; */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-12 21:36:41 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/**** ****/
|
|
|
|
/**** ****/
|
|
|
|
/**** D R I V E R I N T E R F A C E ****/
|
|
|
|
/**** ****/
|
|
|
|
/**** ****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2000-06-14 01:21:00 +02:00
|
|
|
|
2001-06-28 09:17:51 +02:00
|
|
|
static FT_Module_Interface
|
|
|
|
tt_get_interface( TT_Driver driver,
|
2002-04-30 08:37:52 +02:00
|
|
|
const char* tt_interface )
|
2000-04-25 18:11:12 +02:00
|
|
|
{
|
2002-04-01 16:25:28 +02:00
|
|
|
FT_Module sfntd = FT_Get_Module( driver->root.root.library,
|
|
|
|
"sfnt" );
|
2002-02-28 17:10:29 +01:00
|
|
|
SFNT_Service sfnt;
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-05-27 00:13:17 +02:00
|
|
|
/* only return the default interface from the SFNT module */
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( sfntd )
|
2000-04-25 18:11:12 +02:00
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
sfnt = (SFNT_Service)( sfntd->clazz->module_interface );
|
2000-06-12 21:36:41 +02:00
|
|
|
if ( sfnt )
|
2002-04-30 08:37:52 +02:00
|
|
|
return sfnt->get_interface( FT_MODULE( driver ), tt_interface );
|
2000-04-25 18:11:12 +02:00
|
|
|
}
|
2000-06-12 21:36:41 +02:00
|
|
|
|
2000-04-25 18:11:12 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* The FT_DriverInterface structure is defined in ftdriver.h. */
|
|
|
|
|
2000-11-04 02:55:49 +01:00
|
|
|
FT_CALLBACK_TABLE_DEF
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
src/base/ftapi.c, src/base/ftobjs.c,
src/cff/cffdrivr.c, src/cff/cffdrivr.h,
src/cid/cidriver.c, src/cid/cidriver.h,
src/pcf/pcfdriver.c, src/pcf/pcfdriver.h,
src/truetype/ttdriver.c, src/truetype/ttdriver.h,
src/type1/t1driver.c, src/type1/t1driver.h,
src/winfonts/winfnt.c, src/winfonts/winfnt.h:
updating the type definitions for font font drivers
2002-03-14 10:22:48 +01:00
|
|
|
const FT_Driver_ClassRec tt_driver_class =
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
{
|
2000-06-30 03:31:22 +02:00
|
|
|
ft_module_font_driver |
|
|
|
|
ft_module_driver_scalable |
|
2000-07-26 21:04:08 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_BYTECODE_INTERPRETER
|
2000-06-30 03:31:22 +02:00
|
|
|
ft_module_driver_has_hinter,
|
2000-07-26 21:04:08 +02:00
|
|
|
#else
|
|
|
|
0,
|
2000-10-31 21:42:18 +01:00
|
|
|
#endif
|
2000-07-09 21:15:30 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
sizeof ( TT_DriverRec ),
|
2000-07-09 21:15:30 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
"truetype", /* driver name */
|
2000-06-25 08:47:11 +02:00
|
|
|
0x10000L, /* driver version == 1.0 */
|
|
|
|
0x20000L, /* driver requires FreeType 2.0 or above */
|
2000-07-09 21:15:30 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
(void*)0, /* driver specific interface */
|
2000-07-09 21:15:30 +02:00
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
(FT_Module_Constructor)tt_driver_init,
|
|
|
|
(FT_Module_Destructor) tt_driver_done,
|
2000-06-25 08:47:11 +02:00
|
|
|
(FT_Module_Requester) tt_get_interface,
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
},
|
2000-07-09 21:15:30 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
sizeof ( TT_FaceRec ),
|
|
|
|
sizeof ( TT_SizeRec ),
|
|
|
|
sizeof ( FT_GlyphSlotRec ),
|
|
|
|
|
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
(FT_Face_InitFunc) tt_face_init,
|
|
|
|
(FT_Face_DoneFunc) tt_face_done,
|
|
|
|
(FT_Size_InitFunc) tt_size_init,
|
|
|
|
(FT_Size_DoneFunc) tt_size_done,
|
2002-04-01 16:25:28 +02:00
|
|
|
(FT_Slot_InitFunc) 0,
|
|
|
|
(FT_Slot_DoneFunc) 0,
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
src/base/ftapi.c, src/base/ftobjs.c,
src/cff/cffdrivr.c, src/cff/cffdrivr.h,
src/cid/cidriver.c, src/cid/cidriver.h,
src/pcf/pcfdriver.c, src/pcf/pcfdriver.h,
src/truetype/ttdriver.c, src/truetype/ttdriver.h,
src/type1/t1driver.c, src/type1/t1driver.h,
src/winfonts/winfnt.c, src/winfonts/winfnt.h:
updating the type definitions for font font drivers
2002-03-14 10:22:48 +01:00
|
|
|
(FT_Size_ResetPointsFunc) Set_Char_Sizes,
|
2002-04-01 16:25:28 +02:00
|
|
|
(FT_Size_ResetPixelsFunc) Set_Pixel_Sizes,
|
|
|
|
(FT_Slot_LoadFunc) Load_Glyph,
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2002-04-01 16:25:28 +02:00
|
|
|
(FT_Face_GetKerningFunc) Get_Kerning,
|
|
|
|
(FT_Face_AttachFunc) 0,
|
* include/freetype/config/ftoption.h, include/freetype/internal/tttypes.h,
src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/cff/cffobjs.c,
src/pcf/pcfdrivr.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttcmap0.h, src/sfnt/ttload.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c: code cleanup,
FT_CONFIG_OPTION_USE_CMAPS is now the default
2002-07-17 23:52:20 +02:00
|
|
|
(FT_Face_GetAdvancesFunc) 0
|
1999-12-17 00:11:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* END */
|