2000-06-05 07:26:15 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* sfdriver.c */
|
|
|
|
/* */
|
|
|
|
/* High-level SFNT driver interface (body). */
|
|
|
|
/* */
|
2001-06-28 19:49:10 +02:00
|
|
|
/* Copyright 1996-2001 by */
|
2000-06-05 07:26:15 +02: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_SFNT_H
|
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "sfdriver.h"
|
|
|
|
#include "ttload.h"
|
|
|
|
#include "ttcmap.h"
|
|
|
|
#include "sfobjs.h"
|
2000-07-08 21:51:42 +02:00
|
|
|
|
2000-11-29 16:18:54 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttsbit.h"
|
2000-11-29 16:18:54 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttpost.h"
|
2000-11-29 16:18:54 +01:00
|
|
|
#endif
|
|
|
|
|
2000-07-01 16:06:46 +02:00
|
|
|
#include <string.h> /* for strcmp() */
|
|
|
|
|
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 )
|
2000-05-27 00:13:17 +02:00
|
|
|
{
|
|
|
|
void* table;
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
switch ( tag )
|
2000-05-27 00:13:17 +02:00
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
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 == 0xFFFF ? 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;
|
2000-05-27 00:13:17 +02:00
|
|
|
}
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-05-27 00:13:17 +02:00
|
|
|
return table;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
|
|
|
get_sfnt_glyph_name( TT_Face face,
|
|
|
|
FT_UInt glyph_index,
|
|
|
|
FT_Pointer buffer,
|
|
|
|
FT_UInt buffer_max )
|
2000-07-19 19:13:03 +02:00
|
|
|
{
|
|
|
|
FT_String* gname;
|
|
|
|
FT_Error error;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
error = TT_Get_PS_Name( face, glyph_index, &gname );
|
2000-07-20 08:57:41 +02:00
|
|
|
if ( !error && buffer_max > 0 )
|
2000-07-19 19:13:03 +02:00
|
|
|
{
|
2001-03-10 18:07:42 +01:00
|
|
|
FT_UInt len = (FT_UInt)( strlen( gname ) );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
if ( len >= buffer_max )
|
|
|
|
len = buffer_max - 1;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
MEM_Copy( buffer, gname, len );
|
|
|
|
((FT_Byte*)buffer)[len] = 0;
|
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
return error;
|
2000-10-31 21:42:18 +01:00
|
|
|
}
|
2000-07-20 08:57:41 +02:00
|
|
|
|
|
|
|
|
2001-10-17 15:48:10 +02:00
|
|
|
static const char*
|
|
|
|
get_sfnt_postscript_name( TT_Face face )
|
|
|
|
{
|
2002-03-05 17:12:57 +01:00
|
|
|
FT_Int n, found_win, found_apple;
|
2001-10-17 15:48:10 +02:00
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
|
|
|
|
/* shouldn't happen, but just in case to avoid memory leaks */
|
2001-10-17 15:48:10 +02:00
|
|
|
if ( face->root.internal->postscript_name )
|
|
|
|
return face->root.internal->postscript_name;
|
|
|
|
|
2002-01-25 17:05:39 +01:00
|
|
|
/* scan the name table to see whether we have a Postscript name here, */
|
|
|
|
/* either in Macintosh or Windows platform encodings */
|
2002-03-05 17:12:57 +01:00
|
|
|
found_win = -1;
|
|
|
|
found_apple = -1;
|
|
|
|
|
2001-10-17 15:48:10 +02:00
|
|
|
for ( n = 0; n < face->num_names; n++ )
|
|
|
|
{
|
|
|
|
TT_NameRec* name = face->name_table.names + n;
|
2001-12-05 02:22:05 +01:00
|
|
|
|
|
|
|
|
2002-03-05 17:12:57 +01:00
|
|
|
if ( name->nameID == 6 && name->string != NULL )
|
2001-10-17 15:48:10 +02:00
|
|
|
{
|
2002-03-05 17:12:57 +01:00
|
|
|
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 )
|
|
|
|
{
|
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
TT_NameRec* name = face->name_table.names + found_win;
|
|
|
|
FT_UInt len = name->stringLength/2;
|
|
|
|
FT_Error error;
|
|
|
|
FT_String* result;
|
|
|
|
|
|
|
|
if ( !ALLOC( result, len+1 ) )
|
|
|
|
{
|
|
|
|
FT_String* r = result;
|
|
|
|
FT_Byte* p = (FT_Byte*) name->string;
|
|
|
|
|
|
|
|
for ( ; len > 0; len--, p += 2 )
|
2001-10-17 15:48:10 +02:00
|
|
|
{
|
2002-03-05 17:12:57 +01:00
|
|
|
if ( p[0] == 0 && p[1] >= 32 && p[1] < 128 )
|
|
|
|
*r++ = p[1];
|
2001-10-17 15:48:10 +02:00
|
|
|
}
|
2002-03-05 17:12:57 +01:00
|
|
|
*r = '\0';
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( found_apple )
|
|
|
|
{
|
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
TT_NameRec* name = face->name_table.names + found_win;
|
|
|
|
FT_UInt len = name->stringLength;
|
|
|
|
FT_Error error;
|
|
|
|
FT_String* result;
|
|
|
|
|
|
|
|
if ( !ALLOC( result, len+1 ) )
|
|
|
|
{
|
|
|
|
MEM_Copy( result, name->string, len );
|
|
|
|
result[len] = '\0';
|
2001-10-17 15:48:10 +02:00
|
|
|
}
|
2002-03-05 17:12:57 +01:00
|
|
|
return result;
|
2001-10-17 15:48:10 +02:00
|
|
|
}
|
2001-12-05 02:22:05 +01:00
|
|
|
|
2001-10-17 15:48:10 +02:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Module_Interface )
|
2001-06-27 11:26:46 +02:00
|
|
|
SFNT_Get_Interface( FT_Module module,
|
|
|
|
const char* interface )
|
2000-05-27 00:13:17 +02:00
|
|
|
{
|
2000-07-04 20:12:13 +02:00
|
|
|
FT_UNUSED( module );
|
2000-05-27 00:13:17 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( strcmp( interface, "get_sfnt" ) == 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
|
|
|
return (FT_Module_Interface)get_sfnt_table;
|
2000-05-27 00:13:17 +02:00
|
|
|
|
2000-07-19 19:13:03 +02:00
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
|
|
|
if ( strcmp( interface, "glyph_name" ) == 0 )
|
|
|
|
return (FT_Module_Interface)get_sfnt_glyph_name;
|
|
|
|
#endif
|
2001-10-17 15:48:10 +02:00
|
|
|
|
|
|
|
if ( strcmp( interface, "postscript_name" ) == 0 )
|
|
|
|
return (FT_Module_Interface)get_sfnt_postscript_name;
|
|
|
|
|
2000-05-27 00:13:17 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-07-01 16:06:46 +02:00
|
|
|
static
|
|
|
|
const SFNT_Interface sfnt_interface =
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
TT_Goto_Table,
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-05-27 00:13:17 +02:00
|
|
|
SFNT_Init_Face,
|
|
|
|
SFNT_Load_Face,
|
|
|
|
SFNT_Done_Face,
|
|
|
|
SFNT_Get_Interface,
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
TT_Load_Any,
|
2000-05-29 22:37:41 +02:00
|
|
|
TT_Load_SFNT_Header,
|
1999-12-17 00:11:37 +01:00
|
|
|
TT_Load_Directory,
|
|
|
|
|
|
|
|
TT_Load_Header,
|
|
|
|
TT_Load_Metrics_Header,
|
|
|
|
TT_Load_CMap,
|
|
|
|
TT_Load_MaxProfile,
|
|
|
|
TT_Load_OS2,
|
|
|
|
TT_Load_PostScript,
|
|
|
|
|
|
|
|
TT_Load_Names,
|
|
|
|
TT_Free_Names,
|
|
|
|
|
|
|
|
TT_Load_Hdmx,
|
|
|
|
TT_Free_Hdmx,
|
|
|
|
|
|
|
|
TT_Load_Kern,
|
|
|
|
TT_Load_Gasp,
|
2000-06-05 07:26:15 +02:00
|
|
|
TT_Load_PCLT,
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
/* see `ttload.h' */
|
2000-11-07 00:07:51 +01:00
|
|
|
TT_Load_Bitmap_Header,
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* see `ttsbit.h' */
|
2000-11-07 00:07:51 +01:00
|
|
|
TT_Set_SBit_Strike,
|
1999-12-17 00:11:37 +01:00
|
|
|
TT_Load_SBit_Strikes,
|
|
|
|
TT_Load_SBit_Image,
|
|
|
|
TT_Free_SBit_Strikes,
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
#else /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
2000-07-01 16:06:46 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
0,
|
|
|
|
0,
|
|
|
|
0,
|
2000-11-07 00:07:51 +01:00
|
|
|
0,
|
|
|
|
0,
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
2000-05-17 01:44:38 +02:00
|
|
|
|
|
|
|
#ifdef TT_CONFIG_OPTION_POSTSCRIPT_NAMES
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* see `ttpost.h' */
|
1999-12-17 00:11:37 +01:00
|
|
|
TT_Get_PS_Name,
|
2000-05-17 01:44:38 +02:00
|
|
|
TT_Free_Post_Names,
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
#else /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
2000-07-01 16:06:46 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
0,
|
|
|
|
0,
|
2000-07-01 16:06:46 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
#endif /* TT_CONFIG_OPTION_POSTSCRIPT_NAMES */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* see `ttcmap.h' */
|
|
|
|
TT_CharMap_Load,
|
|
|
|
TT_CharMap_Free,
|
|
|
|
};
|
2000-05-17 01:44:38 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-11-04 02:55:49 +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 ),
|
2000-07-02 02:27:53 +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
|
|
|
"sfnt", /* driver name */
|
2000-06-25 08:47:11 +02:00
|
|
|
0x10000L, /* driver version 1.0 */
|
|
|
|
0x20000L, /* driver requires FreeType 2.0 or higher */
|
2000-07-02 02:27:53 +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
|
|
|
(const void*)&sfnt_interface, /* module specific interface */
|
2000-07-02 02:27:53 +02:00
|
|
|
|
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
|
|
|
};
|
2000-07-02 02:27:53 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* END */
|