freetype2/src/sfnt/sfdriver.c

610 lines
14 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* sfdriver.c */
/* */
/* High-level SFNT driver interface (body). */
/* */
/* Copyright 1996-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, 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
#include <ft2build.h>
#include FT_INTERNAL_SFNT_H
#include FT_INTERNAL_OBJECTS_H
#include "sfdriver.h"
#include "ttload.h"
#include "sfobjs.h"
#include "sferrors.h"
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
#include "ttsbit.h"
#endif
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
#include "ttpost.h"
#endif
#ifdef TT_CONFIG_OPTION_BDF
#include "ttbdf.h"
#include FT_SERVICE_BDF_H
#endif
#include "ttcmap.h"
#include "ttkern.h"
#include "ttmtx.h"
#include FT_SERVICE_GLYPH_DICT_H
#include FT_SERVICE_POSTSCRIPT_NAME_H
#include FT_SERVICE_SFNT_H
#include FT_SERVICE_TT_CMAP_H
/*
* SFNT TABLE SERVICE
*
*/
2000-06-25 08:47:11 +02:00
2001-06-28 01:25:46 +02:00
static void*
get_sfnt_table( TT_Face face,
FT_Sfnt_Tag tag )
{
void* table;
switch ( tag )
{
case ft_sfnt_head:
table = &face->header;
break;
case ft_sfnt_hhea:
table = &face->horizontal;
break;
case ft_sfnt_vhea:
table = face->vertical_info ? &face->vertical : 0;
break;
case ft_sfnt_os2:
table = face->os2.version == 0xFFFFU ? 0 : &face->os2;
break;
case ft_sfnt_post:
table = &face->postscript;
break;
case ft_sfnt_maxp:
table = &face->max_profile;
break;
case ft_sfnt_pclt:
table = face->pclt.Version ? &face->pclt : 0;
break;
default:
table = 0;
}
return table;
}
static FT_Error
sfnt_table_info( TT_Face face,
FT_UInt idx,
FT_ULong *tag,
FT_ULong *length )
{
if ( !tag || !length )
return SFNT_Err_Invalid_Argument;
if ( idx >= face->num_tables )
return SFNT_Err_Table_Missing;
*tag = face->dir_tables[idx].Tag;
*length = face->dir_tables[idx].Length;
return SFNT_Err_Ok;
}
static const FT_Service_SFNT_TableRec sfnt_service_sfnt_table =
{
(FT_SFNT_TableLoadFunc)tt_face_load_any,
(FT_SFNT_TableGetFunc) get_sfnt_table,
(FT_SFNT_TableInfoFunc)sfnt_table_info
};
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
/*
* GLYPH DICT SERVICE
*
*/
2001-06-28 01:25:46 +02:00
static FT_Error
sfnt_get_glyph_name( TT_Face face,
2001-06-28 01:25:46 +02:00
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
{
FT_String* gname;
FT_Error error;
2000-10-31 21:42:18 +01:00
error = tt_face_get_ps_name( face, glyph_index, &gname );
if ( !error && buffer_max > 0 )
{
FT_UInt len = (FT_UInt)( ft_strlen( gname ) );
2000-10-31 21:42:18 +01:00
if ( len >= buffer_max )
len = buffer_max - 1;
2000-10-31 21:42:18 +01:00
FT_MEM_COPY( buffer, gname, len );
((FT_Byte*)buffer)[len] = 0;
}
2000-10-31 21:42:18 +01:00
return error;
2000-10-31 21:42:18 +01:00
}
static const FT_Service_GlyphDictRec sfnt_service_glyph_dict =
{
2003-09-17 07:26:33 +02:00
(FT_GlyphDict_GetNameFunc) sfnt_get_glyph_name,
(FT_GlyphDict_NameIndexFunc)NULL
};
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
2003-09-17 07:26:33 +02:00
/*
* POSTSCRIPT NAME SERVICE
*
*/
static const char*
sfnt_get_ps_name( TT_Face face )
{
FT_Int n, found_win, found_apple;
const char* result = NULL;
/* shouldn't happen, but just in case to avoid memory leaks */
if ( face->postscript_name )
return face->postscript_name;
/* scan the name table to see whether we have a Postscript name here, */
/* either in Macintosh or Windows platform encodings */
found_win = -1;
found_apple = -1;
for ( n = 0; n < face->num_names; n++ )
{
TT_NameEntryRec* name = face->name_table.names + n;
if ( name->nameID == 6 && name->stringLength > 0 )
{
if ( name->platformID == 3 &&
name->encodingID == 1 &&
name->languageID == 0x409 )
found_win = n;
if ( name->platformID == 1 &&
name->encodingID == 0 &&
name->languageID == 0 )
found_apple = n;
}
}
if ( found_win != -1 )
{
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_win;
FT_UInt len = name->stringLength / 2;
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in computation of glyph_index. (FNT_Size_Set_Pixels): To find a strike, first check pixel_height only, then try to find a better hit by comparing pixel_width also. Without this fix it isn't possible to access all strikes. Also compute metrics.max_advance to be in sync with other bitmap drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. (FT_Set_Pixel_Size): Assign value to `metrics' after validation of arguments. Synchronize computation of height and width for bitmap strikes. The `width' field in the FT_Bitmap_Size structure is now only useful to enumerate different strikes. The `max_advance' field of the FT_Size_Metrics structure should be used to get the (maximum) width of a strike. * src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single argument to function. * src/psnames/psmodule.c (ps_unicode_value): Handle `.' after `uniXXXX' and `uXXXX[X[X]]'. * src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/. * src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c: s/FT_Err_/FTC_Err_/. * src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/. * src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/. * src/psaux/t1cmap.c: Include psauxerr.h. s/FT_Err_/PSaux_Err_/. * src/pshinter/pshnterr.h: New file. * src/pshinter/rules.mk: Updated. * src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h. s/FT_Err_/PSH_Err_/. * src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c: s/FT_Err_/PFR_Err_/. * src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/. * src/truetype/ttgload.c: s/FT_Err_/TT_Err_/. * src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define FT_ERR_PREFIX and FT_ERR_BASE. s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
FT_Error error = SFNT_Err_Ok;
FT_UNUSED( error );
if ( !FT_ALLOC( result, name->stringLength + 1 ) )
{
FT_Stream stream = face->name_table.stream;
FT_String* r = (FT_String*)result;
FT_Byte* p = (FT_Byte*)name->string;
if ( FT_STREAM_SEEK( name->stringOffset ) ||
FT_FRAME_ENTER( name->stringLength ) )
{
FT_FREE( result );
name->stringLength = 0;
name->stringOffset = 0;
FT_FREE( name->string );
goto Exit;
}
p = (FT_Byte*)stream->cursor;
for ( ; len > 0; len--, p += 2 )
{
if ( p[0] == 0 && p[1] >= 32 && p[1] < 128 )
*r++ = p[1];
}
*r = '\0';
FT_FRAME_EXIT();
}
goto Exit;
}
if ( found_apple != -1 )
{
FT_Memory memory = face->root.memory;
TT_NameEntryRec* name = face->name_table.names + found_apple;
FT_UInt len = name->stringLength;
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in computation of glyph_index. (FNT_Size_Set_Pixels): To find a strike, first check pixel_height only, then try to find a better hit by comparing pixel_width also. Without this fix it isn't possible to access all strikes. Also compute metrics.max_advance to be in sync with other bitmap drivers. * src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code. (FT_Set_Pixel_Size): Assign value to `metrics' after validation of arguments. Synchronize computation of height and width for bitmap strikes. The `width' field in the FT_Bitmap_Size structure is now only useful to enumerate different strikes. The `max_advance' field of the FT_Size_Metrics structure should be used to get the (maximum) width of a strike. * src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for computing `available_sizes->width' but make it always equal to `available_sizes->height'. * src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single argument to function. * src/psnames/psmodule.c (ps_unicode_value): Handle `.' after `uniXXXX' and `uXXXX[X[X]]'. * src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/. * src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c: s/FT_Err_/FTC_Err_/. * src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/. * src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/. * src/psaux/t1cmap.c: Include psauxerr.h. s/FT_Err_/PSaux_Err_/. * src/pshinter/pshnterr.h: New file. * src/pshinter/rules.mk: Updated. * src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h. s/FT_Err_/PSH_Err_/. * src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c: s/FT_Err_/PFR_Err_/. * src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/. * src/truetype/ttgload.c: s/FT_Err_/TT_Err_/. * src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define FT_ERR_PREFIX and FT_ERR_BASE. s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
FT_Error error = SFNT_Err_Ok;
FT_UNUSED( error );
2002-03-26 03:38:39 +01:00
if ( !FT_ALLOC( result, len + 1 ) )
{
FT_Stream stream = face->name_table.stream;
if ( FT_STREAM_SEEK( name->stringOffset ) ||
FT_STREAM_READ( result, len ) )
{
name->stringOffset = 0;
name->stringLength = 0;
FT_FREE( name->string );
FT_FREE( result );
goto Exit;
}
2002-03-26 03:38:39 +01:00
((char*)result)[len] = '\0';
}
}
Exit:
face->postscript_name = result;
return result;
}
static const FT_Service_PsFontNameRec sfnt_service_ps_name =
{
2003-10-23 06:54:14 +02:00
(FT_PsName_GetFunc)sfnt_get_ps_name
};
2005-12-20 13:01:58 +01:00
/*
* TT CMAP INFO
*/
static const FT_Service_TTCMapsRec tt_service_get_cmap_info =
{
(TT_CMap_Info_GetFunc)tt_get_cmap_info
};
2005-12-20 13:01:58 +01:00
#ifdef TT_CONFIG_OPTION_BDF
static FT_Error
sfnt_get_charset_id( TT_Face face,
const char* *acharset_encoding,
const char* *acharset_registry )
{
2005-12-20 13:01:58 +01:00
BDF_PropertyRec encoding, registry;
FT_Error error;
/* XXX: I don't know whether this is correct, since
* tt_face_find_bdf_prop only returns something correct if we have
* previously selected a size that is listed in the BDF table.
2005-12-20 13:01:58 +01:00
* Should we change the BDF table format to include single offsets
* for `CHARSET_REGISTRY' and `CHARSET_ENCODING'?
*/
error = tt_face_find_bdf_prop( face, "CHARSET_REGISTRY", &registry );
if ( !error )
{
error = tt_face_find_bdf_prop( face, "CHARSET_ENCODING", &encoding );
if ( !error )
{
if ( registry.type == BDF_PROPERTY_TYPE_ATOM &&
encoding.type == BDF_PROPERTY_TYPE_ATOM )
{
*acharset_encoding = encoding.u.atom;
*acharset_registry = registry.u.atom;
}
else
error = FT_Err_Invalid_Argument;
}
}
return error;
}
static const FT_Service_BDFRec sfnt_service_bdf =
{
(FT_BDF_GetCharsetIdFunc) sfnt_get_charset_id,
(FT_BDF_GetPropertyFunc) tt_face_find_bdf_prop,
};
#endif /* TT_CONFIG_OPTION_BDF */
2005-12-20 13:01:58 +01:00
/*
* SERVICE LIST
*/
static const FT_ServiceDescRec sfnt_services[] =
{
{ FT_SERVICE_ID_SFNT_TABLE, &sfnt_service_sfnt_table },
{ FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &sfnt_service_ps_name },
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
{ FT_SERVICE_ID_GLYPH_DICT, &sfnt_service_glyph_dict },
#endif
#ifdef TT_CONFIG_OPTION_BDF
{ FT_SERVICE_ID_BDF, &sfnt_service_bdf },
#endif
{ FT_SERVICE_ID_TT_CMAP, &tt_service_get_cmap_info },
{ NULL, NULL }
};
2001-06-28 01:25:46 +02:00
FT_CALLBACK_DEF( FT_Module_Interface )
sfnt_get_interface( FT_Module module,
const char* module_interface )
{
FT_UNUSED( module );
return ft_service_list_lookup( sfnt_services, module_interface );
}
1999-12-17 00:11:37 +01:00
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
FT_CALLBACK_DEF( FT_Error )
tt_face_load_sfnt_header_stub( TT_Face face,
FT_Stream stream,
FT_Long face_index,
SFNT_Header header )
{
FT_UNUSED( face );
FT_UNUSED( stream );
FT_UNUSED( face_index );
FT_UNUSED( header );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_directory_stub( TT_Face face,
FT_Stream stream,
SFNT_Header header )
{
FT_UNUSED( face );
FT_UNUSED( stream );
FT_UNUSED( header );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_hdmx_stub( TT_Face face,
FT_Stream stream )
{
FT_UNUSED( face );
FT_UNUSED( stream );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( void )
tt_face_free_hdmx_stub( TT_Face face )
{
FT_UNUSED( face );
}
FT_CALLBACK_DEF( FT_Error )
tt_face_set_sbit_strike_stub( TT_Face face,
FT_UInt x_ppem,
FT_UInt y_ppem,
FT_ULong* astrike_index )
{
FT_UNUSED( face );
FT_UNUSED( x_ppem );
FT_UNUSED( y_ppem );
*astrike_index = 0x7FFFFFFFUL;
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_sbit_stub( TT_Face face,
FT_Stream stream )
{
FT_UNUSED( face );
FT_UNUSED( stream );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( void )
tt_face_free_sbit_stub( TT_Face face )
{
FT_UNUSED( face );
}
FT_CALLBACK_DEF( FT_Error )
tt_face_load_charmap_stub( TT_Face face,
void* cmap,
FT_Stream input )
{
FT_UNUSED( face );
FT_UNUSED( cmap );
FT_UNUSED( input );
return FT_Err_Unimplemented_Feature;
}
FT_CALLBACK_DEF( FT_Error )
tt_face_free_charmap_stub( TT_Face face,
void* cmap )
{
FT_UNUSED( face );
FT_UNUSED( cmap );
return 0;
}
#endif /* FT_CONFIG_OPTION_OLD_INTERNALS */
static
const SFNT_Interface sfnt_interface =
1999-12-17 00:11:37 +01:00
{
tt_face_goto_table,
2000-05-17 01:44:38 +02:00
sfnt_init_face,
sfnt_load_face,
sfnt_done_face,
sfnt_get_interface,
tt_face_load_any,
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_load_sfnt_header_stub,
tt_face_load_directory_stub,
#endif
1999-12-17 00:11:37 +01:00
tt_face_load_head,
tt_face_load_hhea,
tt_face_load_cmap,
tt_face_load_maxp,
tt_face_load_os2,
tt_face_load_post,
1999-12-17 00:11:37 +01:00
tt_face_load_name,
tt_face_free_name,
1999-12-17 00:11:37 +01:00
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_load_hdmx_stub,
tt_face_free_hdmx_stub,
#endif
tt_face_load_kern,
tt_face_load_gasp,
tt_face_load_pclt,
1999-12-17 00:11:37 +01:00
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* see `ttload.h' */
tt_face_load_bhed,
#else
0,
#endif
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_set_sbit_strike_stub,
tt_face_load_sbit_stub,
#endif
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
tt_face_load_sbit_image,
#else /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
1999-12-17 00:11:37 +01:00
0,
#endif /* !TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_free_sbit_stub,
#endif
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
/* see `ttpost.h' */
tt_face_get_ps_name,
tt_face_free_ps_names,
#else /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
0,
0,
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
tt_face_load_charmap_stub,
tt_face_free_charmap_stub,
#endif
/* since FT 2.1.8 */
tt_face_get_kerning,
# ifndef FT_OPTIMIZE_MEMORY
tt_find_sbit_image,
tt_load_sbit_metrics,
# else
1999-12-17 00:11:37 +01:00
0,
0,
# endif
/* since FT 2.2 */
tt_face_load_font_dir,
tt_face_load_hmtx,
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* see `ttsbit.h' and `sfnt.h' */
tt_face_load_eblc,
tt_face_free_eblc,
tt_face_set_sbit_strike,
tt_face_load_strike_metrics,
#else
0,
0,
0,
0,
#endif
1999-12-17 00:11:37 +01:00
tt_face_get_metrics
1999-12-17 00:11:37 +01:00
};
2000-05-17 01:44:38 +02:00
1999-12-17 00:11:37 +01:00
FT_CALLBACK_TABLE_DEF
const FT_Module_Class sfnt_module_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
0, /* not a font driver or renderer */
sizeof( FT_ModuleRec ),
- 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
"sfnt", /* driver name */
2000-06-25 08:47:11 +02:00
0x10000L, /* driver version 1.0 */
0x20000L, /* driver requires FreeType 2.0 or higher */
- 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
(const void*)&sfnt_interface, /* module specific interface */
2000-06-25 08:47:11 +02:00
(FT_Module_Constructor)0,
(FT_Module_Destructor) 0,
(FT_Module_Requester) sfnt_get_interface
1999-12-17 00:11:37 +01:00
};
1999-12-17 00:11:37 +01:00
/* END */