1999-12-17 00:11:37 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ttload.c */
|
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* Load the basic TrueType tables, i.e., tables that can be either in */
|
|
|
|
/* TTF or OTF fonts (body). */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2005-03-01 03:13:50 +01:00
|
|
|
/* Copyright 1996-2001, 2002, 2003, 2004, 2005 by */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* 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_TRUETYPE_TAGS_H
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "ttload.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 "sferrors.h"
|
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
2000-06-05 07:26:15 +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. */
|
|
|
|
/* */
|
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_ttload
|
2000-02-13 14:41:56 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_lookup_table */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Looks for a TrueType table by name. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A face object handle. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* tag :: The searched tag. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* A pointer to the table directory entry. 0 if not found. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-14 12:26:29 +01:00
|
|
|
FT_LOCAL_DEF( TT_Table )
|
* 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
|
|
|
tt_face_lookup_table( TT_Face face,
|
|
|
|
FT_ULong tag )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
TT_Table entry;
|
|
|
|
TT_Table limit;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-05 07:26:15 +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_TRACE3(( "tt_face_lookup_table: %08p, `%c%c%c%c' -- ",
|
2000-11-13 17:58:01 +01:00
|
|
|
face,
|
|
|
|
(FT_Char)( tag >> 24 ),
|
|
|
|
(FT_Char)( tag >> 16 ),
|
|
|
|
(FT_Char)( tag >> 8 ),
|
|
|
|
(FT_Char)( tag ) ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
entry = face->dir_tables;
|
|
|
|
limit = entry + face->num_tables;
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
for ( ; entry < limit; entry++ )
|
|
|
|
{
|
2002-05-12 21:59:17 +02:00
|
|
|
/* For compatibility with Windows, we consider 0-length */
|
|
|
|
/* tables the same as missing tables. */
|
|
|
|
if ( entry->Tag == tag && entry->Length != 0 )
|
2000-11-13 08:31:21 +01:00
|
|
|
{
|
2000-11-13 17:58:01 +01:00
|
|
|
FT_TRACE3(( "found table.\n" ));
|
1999-12-17 00:11:37 +01:00
|
|
|
return entry;
|
2000-11-13 08:31:21 +01:00
|
|
|
}
|
2000-05-17 01:44:38 +02:00
|
|
|
}
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2000-11-13 08:31:21 +01:00
|
|
|
FT_TRACE3(( "could not find table!\n" ));
|
1999-12-17 00:11:37 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_goto_table */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Looks for a TrueType table by name, then seek a stream to it. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* face :: A face object handle. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* tag :: The searched tag. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* stream :: The stream to seek when the table is found. */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* length :: The length of the table if found, undefined otherwise. */
|
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
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_goto_table( TT_Face face,
|
|
|
|
FT_ULong tag,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_ULong* length )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
TT_Table table;
|
|
|
|
FT_Error error;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-06-05 07:26:15 +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
|
|
|
table = tt_face_lookup_table( face, tag );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( table )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( length )
|
1999-12-17 00:11:37 +01:00
|
|
|
*length = table->Length;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_SEEK( table->Offset ) )
|
2000-07-31 20:59:02 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
else
|
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
|
|
|
error = SFNT_Err_Table_Missing;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2000-07-31 20:59:02 +02:00
|
|
|
Exit:
|
1999-12-17 00:11:37 +01:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
/* Here, we */
|
2005-05-10 00:11:36 +02:00
|
|
|
/* */
|
|
|
|
/* - check that `num_tables' is valid */
|
2005-11-21 13:36:42 +01:00
|
|
|
/* - look for a `head' table, check its size, and parse it to check */
|
|
|
|
/* whether its `magic' field is correctly set */
|
2005-05-10 00:11:36 +02:00
|
|
|
/* */
|
|
|
|
/* When checking directory entries, ignore the tables `glyx' and `locx' */
|
|
|
|
/* which are hacked-out versions of `glyf' and `loca' in some PostScript */
|
2005-11-21 13:36:42 +01:00
|
|
|
/* Type 42 fonts, and which are generally invalid. */
|
2005-05-10 00:11:36 +02:00
|
|
|
/* */
|
2002-07-26 11:09:10 +02:00
|
|
|
static FT_Error
|
2005-11-20 09:24:24 +01:00
|
|
|
sfnt_dir_check( SFNT_Header sfnt,
|
|
|
|
FT_Stream stream )
|
|
|
|
{
|
2002-07-26 11:09:10 +02:00
|
|
|
FT_Error error;
|
* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.
`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font). A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.
Further information on the SING Glyphlet format can be found at:
http://www.adobe.com/products/indesign/sing_gaiji.html
* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'. These two tables
are used in SING Glyphlet Format fonts.
2005-09-19 09:07:11 +02:00
|
|
|
FT_UInt nn;
|
|
|
|
FT_UInt has_head = 0, has_sing = 0, has_meta = 0;
|
2005-11-20 09:24:24 +01:00
|
|
|
FT_ULong offset = sfnt->offset + 12;
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-08-18 09:15:52 +02:00
|
|
|
const FT_ULong glyx_tag = FT_MAKE_TAG( 'g', 'l', 'y', 'x' );
|
|
|
|
const FT_ULong locx_tag = FT_MAKE_TAG( 'l', 'o', 'c', 'x' );
|
2002-07-12 01:41:14 +02:00
|
|
|
|
|
|
|
static const FT_Frame_Field sfnt_dir_entry_fields[] =
|
|
|
|
{
|
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_TableRec
|
|
|
|
|
|
|
|
FT_FRAME_START( 16 ),
|
|
|
|
FT_FRAME_ULONG( Tag ),
|
|
|
|
FT_FRAME_ULONG( CheckSum ),
|
|
|
|
FT_FRAME_ULONG( Offset ),
|
|
|
|
FT_FRAME_ULONG( Length ),
|
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
if ( sfnt->num_tables == 0 ||
|
2005-11-20 09:24:24 +01:00
|
|
|
offset + sfnt->num_tables * 16 > stream->size )
|
|
|
|
return SFNT_Err_Unknown_File_Format;
|
|
|
|
|
|
|
|
if ( FT_STREAM_SEEK( offset ) )
|
|
|
|
return error;
|
2002-07-12 01:41:14 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
for ( nn = 0; nn < sfnt->num_tables; nn++ )
|
2002-07-12 01:41:14 +02:00
|
|
|
{
|
|
|
|
TT_TableRec table;
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2002-07-12 01:41:14 +02:00
|
|
|
if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) )
|
2005-11-20 09:24:24 +01:00
|
|
|
return error;
|
2002-07-12 01:41:14 +02:00
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
if ( table.Offset + table.Length > stream->size &&
|
|
|
|
table.Tag != glyx_tag &&
|
|
|
|
table.Tag != locx_tag )
|
2005-11-20 09:24:24 +01:00
|
|
|
return SFNT_Err_Unknown_File_Format;
|
2002-07-12 01:41:14 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( table.Tag == TTAG_head || table.Tag == TTAG_bhed )
|
2002-07-12 01:41:14 +02:00
|
|
|
{
|
|
|
|
FT_UInt32 magic;
|
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
#ifndef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
|
|
|
if ( table.Tag == TTAG_head )
|
|
|
|
#endif
|
|
|
|
has_head = 1;
|
2002-07-12 01:55:18 +02:00
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
/*
|
|
|
|
* The table length should be 0x36, but certain font tools make it
|
|
|
|
* 0x38, so we will just check that it is greater.
|
|
|
|
*
|
|
|
|
* Note that according to the specification, the table must be
|
|
|
|
* padded to 32-bit lengths, but this doesn't apply to the value of
|
|
|
|
* its `Length' field!
|
2003-04-23 17:50:27 +02:00
|
|
|
*
|
|
|
|
*/
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( table.Length < 0x36 )
|
|
|
|
return SFNT_Err_Unknown_File_Format;
|
* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.
`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font). A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.
Further information on the SING Glyphlet format can be found at:
http://www.adobe.com/products/indesign/sing_gaiji.html
* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'. These two tables
are used in SING Glyphlet Format fonts.
2005-09-19 09:07:11 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( FT_STREAM_SEEK( table.Offset + 12 ) ||
|
2005-11-21 13:36:42 +01:00
|
|
|
FT_READ_ULONG( magic ) )
|
2005-11-20 09:24:24 +01:00
|
|
|
return error;
|
* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.
`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font). A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.
Further information on the SING Glyphlet format can be found at:
http://www.adobe.com/products/indesign/sing_gaiji.html
* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'. These two tables
are used in SING Glyphlet Format fonts.
2005-09-19 09:07:11 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( magic != 0x5F0F3CF5UL )
|
|
|
|
return SFNT_Err_Unknown_File_Format;
|
|
|
|
|
|
|
|
if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) )
|
|
|
|
return error;
|
|
|
|
}
|
* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.
`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font). A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.
Further information on the SING Glyphlet format can be found at:
http://www.adobe.com/products/indesign/sing_gaiji.html
* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'. These two tables
are used in SING Glyphlet Format fonts.
2005-09-19 09:07:11 +02:00
|
|
|
else if ( table.Tag == TTAG_SING )
|
|
|
|
has_sing = 1;
|
|
|
|
else if ( table.Tag == TTAG_META )
|
|
|
|
has_meta = 1;
|
2002-07-12 01:41:14 +02:00
|
|
|
}
|
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
/* if `sing' and `meta' tables are present, there is no `head' table */
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( has_head || ( has_sing && has_meta ) )
|
|
|
|
return SFNT_Err_Ok;
|
|
|
|
else
|
|
|
|
return SFNT_Err_Unknown_File_Format;
|
|
|
|
}
|
* freetype2/src/sfnt/ttload.c (sfnt_dir_check): Modified to allow a
font to have no `head' table if tables `SING' and `META' are
present; this is to support `SING Glyphlet'.
`SING Glyphlet' is an extension to OpenType developed by Adobe
primarily to facilitate adding supplemental glyphs to an OpenType
font (with emphasis on, but not necessariy limited to, gaiji to a
CJK font). A SING Glyphlet Font is an OpenType font that contains
the outline(s), either in a `glyf' or `CFF' table, for a glyph;
`cmap', `BASE', and `GSUB' tables are present with the same format
and functionaliy as a regular OpenType font; there are no `name',
`head', `OS/2', and `post' tables; there are two new tables, `SING'
which contains details about the glyphlet, and `META' which contains
metadata.
Further information on the SING Glyphlet format can be found at:
http://www.adobe.com/products/indesign/sing_gaiji.html
* freetype2/include/freetype/ttags.h (TTAG_SING, TTAG_META): New
macros for the OpenType tables `SING' and `META'. These two tables
are used in SING Glyphlet Format fonts.
2005-09-19 09:07:11 +02:00
|
|
|
|
2002-07-12 01:55:18 +02:00
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
/* Fill in face->ttc_header. If the font is not a TTC, it is */
|
|
|
|
/* synthesized into a TTC with one offset table. */
|
2005-11-20 09:24:24 +01:00
|
|
|
static FT_Error
|
|
|
|
sfnt_init( FT_Stream stream,
|
|
|
|
TT_Face face )
|
|
|
|
{
|
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
FT_Error error;
|
|
|
|
FT_ULong tag, offset;
|
|
|
|
|
|
|
|
static const FT_Frame_Field ttc_header_fields[] =
|
|
|
|
{
|
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TTC_HeaderRec
|
|
|
|
|
|
|
|
FT_FRAME_START( 8 ),
|
|
|
|
FT_FRAME_LONG( version ),
|
|
|
|
FT_FRAME_LONG( count ),
|
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
2005-11-21 13:36:42 +01:00
|
|
|
|
|
|
|
face->ttc_header.tag = 0;
|
2005-11-20 09:24:24 +01:00
|
|
|
face->ttc_header.version = 0;
|
2005-11-21 13:36:42 +01:00
|
|
|
face->ttc_header.count = 0;
|
2005-11-20 09:24:24 +01:00
|
|
|
|
|
|
|
offset = FT_STREAM_POS();
|
|
|
|
|
|
|
|
if ( FT_READ_ULONG( tag ) )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
face->ttc_header.tag = TTAG_ttcf;
|
|
|
|
|
|
|
|
if ( tag == TTAG_ttcf )
|
|
|
|
{
|
|
|
|
FT_Int n;
|
|
|
|
|
|
|
|
|
|
|
|
FT_TRACE3(( "sfnt_init: file is a collection\n" ));
|
|
|
|
|
|
|
|
if ( FT_STREAM_READ_FIELDS( ttc_header_fields, &face->ttc_header ) )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
/* now read the offsets of each font in the file */
|
|
|
|
if ( FT_NEW_ARRAY( face->ttc_header.offsets, face->ttc_header.count ) )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
if ( FT_FRAME_ENTER( face->ttc_header.count * 4L ) )
|
|
|
|
return error;
|
|
|
|
|
|
|
|
for ( n = 0; n < face->ttc_header.count; n++ )
|
|
|
|
face->ttc_header.offsets[n] = FT_GET_ULONG();
|
|
|
|
|
|
|
|
FT_FRAME_EXIT();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-11-21 13:36:42 +01:00
|
|
|
FT_TRACE3(( "sfnt_init: synthesize TTC\n" ));
|
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
face->ttc_header.version = 1 << 16;
|
2005-11-21 13:36:42 +01:00
|
|
|
face->ttc_header.count = 1;
|
2005-11-20 09:24:24 +01:00
|
|
|
|
|
|
|
if ( FT_NEW( face->ttc_header.offsets) )
|
|
|
|
return error;
|
2002-07-12 01:41:14 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
face->ttc_header.offsets[0] = offset;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
2002-07-12 01:41:14 +02:00
|
|
|
}
|
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_sfnt_header */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* Loads the header of a SFNT font file. Supports collections. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* stream :: The input stream. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* face_index :: If the font is a collection, the number of the font */
|
2004-03-20 15:26:38 +01:00
|
|
|
/* in the collection. Must be zero otherwise. */
|
2000-05-29 22:37:41 +02:00
|
|
|
/* */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* <Output> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* sfnt :: The SFNT header. */
|
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
|
|
|
/* */
|
|
|
|
/* <Note> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* The stream cursor must be at the font file's origin. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* This function recognizes fonts embedded in a `TrueType collection' */
|
|
|
|
/* */
|
|
|
|
/* The header will be checked whether it is valid by looking at the */
|
|
|
|
/* values of `search_range', `entry_selector', and `range_shift'. */
|
2000-05-29 22:37:41 +02:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_sfnt_header( TT_Face face,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_Long face_index,
|
|
|
|
SFNT_Header sfnt )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-11-20 09:24:24 +01:00
|
|
|
FT_Error error;
|
2000-06-05 16:32:32 +02:00
|
|
|
|
2002-07-12 01:41:14 +02:00
|
|
|
static const FT_Frame_Field sfnt_header_fields[] =
|
2000-06-05 07:26:15 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
2002-03-14 12:26:29 +01:00
|
|
|
#define FT_STRUCTURE SFNT_HeaderRec
|
2000-07-31 20:59:02 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_START( 8 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_USHORT( num_tables ),
|
|
|
|
FT_FRAME_USHORT( search_range ),
|
|
|
|
FT_FRAME_USHORT( entry_selector ),
|
|
|
|
FT_FRAME_USHORT( range_shift ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
2000-06-05 16:32:32 +02:00
|
|
|
|
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
|
|
|
FT_TRACE2(( "tt_face_load_sfnt_header: %08p, %ld\n",
|
2000-06-01 05:26:58 +02:00
|
|
|
face, face_index ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
error = sfnt_init( stream, face );
|
|
|
|
if ( error )
|
|
|
|
return error;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( face_index < 0 )
|
|
|
|
face_index = 0;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( face_index >= face->ttc_header.count )
|
|
|
|
return SFNT_Err_Bad_Argument;
|
2002-07-12 01:41:14 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
sfnt->offset = face->ttc_header.offsets[face_index];
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
if ( FT_STREAM_SEEK( sfnt->offset ) )
|
|
|
|
return error;
|
2002-07-12 01:41:14 +02:00
|
|
|
|
2005-11-20 09:24:24 +01:00
|
|
|
/* read offset table */
|
2005-11-21 13:36:42 +01:00
|
|
|
if ( FT_READ_ULONG( sfnt->format_tag ) ||
|
2005-11-20 09:24:24 +01:00
|
|
|
FT_STREAM_READ_FIELDS( sfnt_header_fields, sfnt ) )
|
|
|
|
return error;
|
2000-06-05 16:32:32 +02:00
|
|
|
|
2005-11-21 04:04:03 +01:00
|
|
|
/* many fonts don't have these fields set correctly */
|
|
|
|
#if 0
|
2005-11-21 13:36:42 +01:00
|
|
|
if ( sfnt->search_range != 1 << ( sfnt->entry_selector + 4 ) ||
|
2005-11-21 04:04:03 +01:00
|
|
|
sfnt->search_range + sfnt->range_shift != sfnt->num_tables << 4 )
|
|
|
|
return SFNT_Err_Unknown_File_Format;
|
|
|
|
#endif
|
2004-04-01 22:35:57 +02:00
|
|
|
|
2000-01-27 14:56:02 +01:00
|
|
|
return error;
|
2000-06-05 16:32:32 +02:00
|
|
|
}
|
2000-05-29 22:37:41 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-01-27 14:56:02 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_directory */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the table directory into a face object. */
|
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* <InOut> */
|
|
|
|
/* face :: A handle to the target face object. */
|
|
|
|
/* */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* <Input> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* stream :: The input stream. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* sfnt :: The SFNT directory header. */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* */
|
|
|
|
/* <Note> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* The stream cursor must be at the font file's origin. */
|
2000-01-27 14:56:02 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_directory( TT_Face face,
|
|
|
|
FT_Stream stream,
|
|
|
|
SFNT_Header sfnt )
|
2000-01-27 14:56:02 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = stream->memory;
|
2000-01-27 14:56:02 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
TT_TableRec *entry, *limit;
|
2000-01-27 14:56:02 +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
|
|
|
FT_TRACE2(( "tt_face_load_directory: %08p\n", face ));
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
FT_TRACE2(( "-- Tables count: %12u\n", sfnt->num_tables ));
|
|
|
|
FT_TRACE2(( "-- Format version: %08lx\n", sfnt->format_tag ));
|
2000-01-27 14:56:02 +01:00
|
|
|
|
2005-11-21 04:04:03 +01:00
|
|
|
/* check first */
|
|
|
|
error = sfnt_dir_check( sfnt, stream );
|
2005-11-21 13:36:42 +01:00
|
|
|
if ( error )
|
|
|
|
{
|
2005-11-21 04:04:03 +01:00
|
|
|
FT_TRACE2(( "tt_face_load_directory: directory checking failed!\n" ));
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2000-05-29 22:37:41 +02:00
|
|
|
face->num_tables = sfnt->num_tables;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-06-23 17:44:03 +02:00
|
|
|
if ( FT_QNEW_ARRAY( face->dir_tables, face->num_tables ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
2002-07-12 01:41:14 +02:00
|
|
|
if ( FT_STREAM_SEEK( sfnt->offset + 12 ) ||
|
|
|
|
FT_FRAME_ENTER( face->num_tables * 16L ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
entry = face->dir_tables;
|
|
|
|
limit = entry + face->num_tables;
|
|
|
|
|
|
|
|
for ( ; entry < limit; entry++ )
|
2000-01-27 14:56:02 +01:00
|
|
|
{ /* loop through the tables and get all entries */
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
entry->Tag = FT_GET_TAG4();
|
|
|
|
entry->CheckSum = FT_GET_ULONG();
|
|
|
|
entry->Offset = FT_GET_LONG();
|
|
|
|
entry->Length = FT_GET_LONG();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( " %c%c%c%c - %08lx - %08lx\n",
|
2000-06-16 21:34:52 +02:00
|
|
|
(FT_Char)( entry->Tag >> 24 ),
|
|
|
|
(FT_Char)( entry->Tag >> 16 ),
|
|
|
|
(FT_Char)( entry->Tag >> 8 ),
|
|
|
|
(FT_Char)( entry->Tag ),
|
2000-06-05 07:26:15 +02:00
|
|
|
entry->Offset,
|
|
|
|
entry->Length ));
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( "Directory loaded\n\n" ));
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_any */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-07-19 04:59:31 +02:00
|
|
|
/* Loads any font table into client memory. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: The face object to look for. */
|
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* tag :: The tag of table to load. Use the value 0 if you want */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* to access the whole font file, else set this parameter */
|
|
|
|
/* to a valid TrueType table tag that you can forge with */
|
|
|
|
/* the MAKE_TT_TAG macro. */
|
|
|
|
/* */
|
|
|
|
/* offset :: The starting offset in the table (or the file if */
|
|
|
|
/* tag == 0). */
|
|
|
|
/* */
|
|
|
|
/* length :: The address of the decision variable: */
|
|
|
|
/* */
|
|
|
|
/* If length == NULL: */
|
|
|
|
/* Loads the whole table. Returns an error if */
|
|
|
|
/* `offset' == 0! */
|
|
|
|
/* */
|
|
|
|
/* If *length == 0: */
|
|
|
|
/* Exits immediately; returning the length of the given */
|
|
|
|
/* table or of the font file, depending on the value of */
|
|
|
|
/* `tag'. */
|
|
|
|
/* */
|
|
|
|
/* If *length != 0: */
|
|
|
|
/* Loads the next `length' bytes of table or font, */
|
|
|
|
/* starting at offset `offset' (in table or font too). */
|
|
|
|
/* */
|
|
|
|
/* <Output> */
|
|
|
|
/* buffer :: The address of target buffer. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_any( TT_Face face,
|
|
|
|
FT_ULong tag,
|
|
|
|
FT_Long offset,
|
|
|
|
FT_Byte* buffer,
|
|
|
|
FT_ULong* length )
|
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
|
|
|
FT_Stream stream;
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_Table table;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_ULong size;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( tag != 0 )
|
|
|
|
{
|
|
|
|
/* look for tag in font directory */
|
* 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
|
|
|
table = tt_face_lookup_table( face, tag );
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( !table )
|
|
|
|
{
|
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
|
|
|
error = SFNT_Err_Table_Missing;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
offset += table->Offset;
|
|
|
|
size = table->Length;
|
|
|
|
}
|
|
|
|
else
|
2000-06-05 07:26:15 +02:00
|
|
|
/* tag == 0 -- the user wants to access the font file directly */
|
1999-12-17 00:11:37 +01:00
|
|
|
size = face->root.stream->size;
|
|
|
|
|
|
|
|
if ( length && *length == 0 )
|
|
|
|
{
|
|
|
|
*length = size;
|
2000-06-05 07:26:15 +02: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
|
|
|
return SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( length )
|
|
|
|
size = *length;
|
|
|
|
|
|
|
|
stream = face->root.stream;
|
2000-08-01 00:51:00 +02:00
|
|
|
/* the `if' is syntactic sugar for picky compilers */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_AT( offset, buffer, size ) )
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_generic_header */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-11-13 08:31:21 +01:00
|
|
|
/* Loads the TrueType table `head' or `bhed'. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: The input stream. */
|
|
|
|
/* */
|
|
|
|
/* <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 01:25:46 +02:00
|
|
|
static FT_Error
|
* 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
|
|
|
tt_face_load_generic_header( TT_Face face,
|
2002-09-05 17:10:54 +02:00
|
|
|
FT_Stream stream,
|
|
|
|
FT_ULong tag )
|
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
|
|
|
TT_Header* header;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
static const FT_Frame_Field header_fields[] =
|
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_Header
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_START( 54 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_ULONG ( Table_Version ),
|
|
|
|
FT_FRAME_ULONG ( Font_Revision ),
|
|
|
|
FT_FRAME_LONG ( CheckSum_Adjust ),
|
|
|
|
FT_FRAME_LONG ( Magic_Number ),
|
|
|
|
FT_FRAME_USHORT( Flags ),
|
|
|
|
FT_FRAME_USHORT( Units_Per_EM ),
|
|
|
|
FT_FRAME_LONG ( Created[0] ),
|
|
|
|
FT_FRAME_LONG ( Created[1] ),
|
|
|
|
FT_FRAME_LONG ( Modified[0] ),
|
|
|
|
FT_FRAME_LONG ( Modified[1] ),
|
|
|
|
FT_FRAME_SHORT ( xMin ),
|
|
|
|
FT_FRAME_SHORT ( yMin ),
|
|
|
|
FT_FRAME_SHORT ( xMax ),
|
|
|
|
FT_FRAME_SHORT ( yMax ),
|
|
|
|
FT_FRAME_USHORT( Mac_Style ),
|
|
|
|
FT_FRAME_USHORT( Lowest_Rec_PPEM ),
|
|
|
|
FT_FRAME_SHORT ( Font_Direction ),
|
|
|
|
FT_FRAME_SHORT ( Index_To_Loc_Format ),
|
|
|
|
FT_FRAME_SHORT ( Glyph_Data_Format ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
|
* 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_TRACE2(( "tt_face_load_generic_header: "
|
2000-11-13 17:58:01 +01:00
|
|
|
"%08p, looking up font table `%c%c%c%c'.\n",
|
|
|
|
face,
|
|
|
|
(FT_Char)( tag >> 24 ),
|
|
|
|
(FT_Char)( tag >> 16 ),
|
|
|
|
(FT_Char)( tag >> 8 ),
|
|
|
|
(FT_Char)( tag ) ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-11-07 00:07:51 +01:00
|
|
|
error = face->goto_table( face, tag, stream, 0 );
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( error )
|
|
|
|
{
|
* 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_TRACE2(( "tt_face_load_generic_header: Font table is missing!\n" ));
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2000-02-13 14:41:56 +01:00
|
|
|
header = &face->header;
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( header_fields, header ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_TRACE2(( " Units per EM: %8u\n", header->Units_Per_EM ));
|
|
|
|
FT_TRACE2(( " IndexToLoc: %8d\n", header->Index_To_Loc_Format ));
|
* 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_TRACE2(( "tt_face_load_generic_header: Font table loaded.\n" ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_header( TT_Face face,
|
|
|
|
FT_Stream stream )
|
2000-11-07 00:07:51 +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_face_load_generic_header( face, stream, TTAG_head );
|
2000-11-07 00:07:51 +01:00
|
|
|
}
|
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
|
2000-11-07 00:07:51 +01:00
|
|
|
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
|
2000-11-07 07:30:29 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_bitmap_header( TT_Face face,
|
|
|
|
FT_Stream stream )
|
2000-11-07 00:07:51 +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_face_load_generic_header( face, stream, TTAG_bhed );
|
2000-11-07 00:07:51 +01:00
|
|
|
}
|
2000-11-07 07:30:29 +01:00
|
|
|
|
|
|
|
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_max_profile */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the maximum profile into a face object. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: The input stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_max_profile( TT_Face face,
|
|
|
|
FT_Stream stream )
|
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
|
|
|
TT_MaxProfile* maxProfile = &face->max_profile;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
const FT_Frame_Field maxp_fields[] =
|
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_MaxProfile
|
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
FT_FRAME_START( 6 ),
|
|
|
|
FT_FRAME_LONG ( version ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_USHORT( numGlyphs ),
|
2001-07-17 14:37:54 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
const FT_Frame_Field maxp_fields_extra[] =
|
|
|
|
{
|
|
|
|
FT_FRAME_START( 26 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_USHORT( maxPoints ),
|
|
|
|
FT_FRAME_USHORT( maxContours ),
|
|
|
|
FT_FRAME_USHORT( maxCompositePoints ),
|
|
|
|
FT_FRAME_USHORT( maxCompositeContours ),
|
|
|
|
FT_FRAME_USHORT( maxZones ),
|
|
|
|
FT_FRAME_USHORT( maxTwilightPoints ),
|
|
|
|
FT_FRAME_USHORT( maxStorage ),
|
|
|
|
FT_FRAME_USHORT( maxFunctionDefs ),
|
|
|
|
FT_FRAME_USHORT( maxInstructionDefs ),
|
|
|
|
FT_FRAME_USHORT( maxStackElements ),
|
|
|
|
FT_FRAME_USHORT( maxSizeOfInstructions ),
|
|
|
|
FT_FRAME_USHORT( maxComponentElements ),
|
|
|
|
FT_FRAME_USHORT( maxComponentDepth ),
|
2001-07-17 14:37:54 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
2000-06-05 07:26:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
FT_TRACE2(( "Load_TT_MaxProfile: %08p\n", face ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
error = face->goto_table( face, TTAG_maxp, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( maxp_fields, maxProfile ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-05-17 14:38:52 +02:00
|
|
|
face->root.num_glyphs = maxProfile->numGlyphs;
|
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
maxProfile->maxPoints = 0;
|
|
|
|
maxProfile->maxContours = 0;
|
|
|
|
maxProfile->maxCompositePoints = 0;
|
|
|
|
maxProfile->maxCompositeContours = 0;
|
|
|
|
maxProfile->maxZones = 0;
|
|
|
|
maxProfile->maxTwilightPoints = 0;
|
|
|
|
maxProfile->maxStorage = 0;
|
|
|
|
maxProfile->maxFunctionDefs = 0;
|
|
|
|
maxProfile->maxInstructionDefs = 0;
|
|
|
|
maxProfile->maxStackElements = 0;
|
|
|
|
maxProfile->maxSizeOfInstructions = 0;
|
|
|
|
maxProfile->maxComponentElements = 0;
|
|
|
|
maxProfile->maxComponentDepth = 0;
|
|
|
|
|
|
|
|
if ( maxProfile->version >= 0x10000L )
|
|
|
|
{
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( maxp_fields_extra, maxProfile ) )
|
2001-07-17 14:37:54 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
/* XXX: an adjustment that is necessary to load certain */
|
|
|
|
/* broken fonts like `Keystrokes MT' :-( */
|
|
|
|
/* */
|
|
|
|
/* We allocate 64 function entries by default when */
|
|
|
|
/* the maxFunctionDefs field is null. */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
if ( maxProfile->maxFunctionDefs == 0 )
|
|
|
|
maxProfile->maxFunctionDefs = 64;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
face->root.internal->max_points =
|
2004-03-05 10:26:24 +01:00
|
|
|
(FT_UShort)FT_MAX( maxProfile->maxCompositePoints,
|
|
|
|
maxProfile->maxPoints );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
face->root.internal->max_contours =
|
2004-03-05 10:26:24 +01:00
|
|
|
(FT_Short)FT_MAX( maxProfile->maxCompositeContours,
|
|
|
|
maxProfile->maxContours );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
face->max_components = (FT_ULong)maxProfile->maxComponentElements +
|
|
|
|
maxProfile->maxComponentDepth;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
/* XXX: some fonts have maxComponents set to 0; we will */
|
|
|
|
/* then use 16 of them by default. */
|
|
|
|
if ( face->max_components == 0 )
|
|
|
|
face->max_components = 16;
|
|
|
|
|
|
|
|
/* We also increase maxPoints and maxContours in order to support */
|
|
|
|
/* some broken fonts. */
|
2002-01-09 22:01:18 +01:00
|
|
|
face->root.internal->max_points += (FT_UShort)8;
|
|
|
|
face->root.internal->max_contours += (FT_Short) 4;
|
2001-07-17 14:37:54 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( "MAXP loaded.\n" ));
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_metrics */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the horizontal or vertical metrics table into a face object. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: The input stream. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* vertical :: A boolean flag. If set, load vertical metrics. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2005-02-26 01:12:04 +01:00
|
|
|
#ifdef FT_OPTIMIZE_MEMORY
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
static FT_Error
|
|
|
|
tt_face_load_metrics( TT_Face face,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_Bool vertical )
|
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_ULong table_size;
|
|
|
|
FT_Byte** ptable;
|
|
|
|
FT_ULong* ptable_size;
|
|
|
|
|
|
|
|
|
|
|
|
FT_TRACE2(( "TT_Load_%s_Metrics: %08p\n", vertical ? "Vertical"
|
|
|
|
: "Horizontal",
|
|
|
|
face ));
|
|
|
|
|
|
|
|
if ( vertical )
|
|
|
|
{
|
|
|
|
ptable = &face->vert_metrics;
|
|
|
|
ptable_size = &face->vert_metrics_size;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
/* The table is optional, quit silently if it wasn't found. */
|
2005-02-26 01:12:04 +01:00
|
|
|
/* */
|
|
|
|
/* XXX: Some fonts have a valid vertical header with a non-null */
|
|
|
|
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
|
|
|
/* table to get the metrics from (e.g. mingliu). */
|
|
|
|
/* */
|
|
|
|
/* For safety, we set the field to 0! */
|
|
|
|
/* */
|
|
|
|
error = face->goto_table( face, TTAG_vmtx, stream, &table_size );
|
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
/* Set number_Of_VMetrics to 0! */
|
|
|
|
FT_TRACE2(( " no vertical header in file.\n" ));
|
|
|
|
error = SFNT_Err_Ok;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ptable = &face->horz_metrics;
|
|
|
|
ptable_size = &face->horz_metrics_size;
|
|
|
|
|
|
|
|
error = face->goto_table( face, TTAG_hmtx, stream, &table_size );
|
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
|
|
|
/* If this is an incrementally loaded font and there are */
|
2005-03-01 03:13:50 +01:00
|
|
|
/* overriding metrics, tolerate a missing `hmtx' table. */
|
|
|
|
if ( face->root.internal->incremental_interface &&
|
2005-02-26 01:12:04 +01:00
|
|
|
face->root.internal->incremental_interface->funcs->
|
2005-03-01 03:13:50 +01:00
|
|
|
get_glyph_metrics )
|
2005-02-26 01:12:04 +01:00
|
|
|
{
|
|
|
|
face->horizontal.number_Of_HMetrics = 0;
|
|
|
|
error = SFNT_Err_Ok;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
FT_ERROR(( " no horizontal metrics in file!\n" ));
|
|
|
|
error = SFNT_Err_Hmtx_Table_Missing;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( FT_FRAME_EXTRACT( table_size, *ptable ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
*ptable_size = table_size;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
#else /* !OPTIMIZE_MEMORY */
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2001-06-28 01:25:46 +02:00
|
|
|
static FT_Error
|
* 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
|
|
|
tt_face_load_metrics( TT_Face face,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_Bool vertical )
|
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
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_ULong table_len;
|
|
|
|
FT_Long num_shorts, num_longs, num_shorts_checked;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_LongMetrics * longs;
|
1999-12-17 00:11:37 +01:00
|
|
|
TT_ShortMetrics** shorts;
|
|
|
|
|
2000-07-02 02:27:53 +02:00
|
|
|
|
|
|
|
FT_TRACE2(( "TT_Load_%s_Metrics: %08p\n", vertical ? "Vertical"
|
|
|
|
: "Horizontal",
|
|
|
|
face ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
if ( vertical )
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
/* The table is optional, quit silently if it wasn't found. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* XXX: Some fonts have a valid vertical header with a non-null */
|
|
|
|
/* `number_of_VMetrics' fields, but no corresponding `vmtx' */
|
|
|
|
/* table to get the metrics from (e.g. mingliu). */
|
|
|
|
/* */
|
|
|
|
/* For safety, we set the field to 0! */
|
|
|
|
/* */
|
|
|
|
error = face->goto_table( face, TTAG_vmtx, stream, &table_len );
|
|
|
|
if ( error )
|
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
/* Set number_Of_VMetrics to 0! */
|
1999-12-17 00:11:37 +01:00
|
|
|
FT_TRACE2(( " no vertical header in file.\n" ));
|
|
|
|
face->vertical.number_Of_VMetrics = 0;
|
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
|
|
|
error = SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
num_longs = face->vertical.number_Of_VMetrics;
|
2002-03-14 12:26:29 +01:00
|
|
|
longs = (TT_LongMetrics *)&face->vertical.long_metrics;
|
1999-12-17 00:11:37 +01:00
|
|
|
shorts = (TT_ShortMetrics**)&face->vertical.short_metrics;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
error = face->goto_table( face, TTAG_hmtx, stream, &table_len );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2003-01-13 11:20:08 +01:00
|
|
|
|
|
|
|
#ifdef FT_CONFIG_OPTION_INCREMENTAL
|
2003-04-23 17:50:27 +02:00
|
|
|
/* If this is an incrementally loaded font and there are */
|
2005-03-01 03:13:50 +01:00
|
|
|
/* overriding metrics, tolerate a missing `hmtx' table. */
|
|
|
|
if ( face->root.internal->incremental_interface &&
|
2003-01-13 11:20:08 +01:00
|
|
|
face->root.internal->incremental_interface->funcs->
|
2005-03-01 03:13:50 +01:00
|
|
|
get_glyph_metrics )
|
2003-01-13 11:20:08 +01:00
|
|
|
{
|
|
|
|
face->horizontal.number_Of_HMetrics = 0;
|
|
|
|
error = SFNT_Err_Ok;
|
|
|
|
goto Exit;
|
2003-04-23 17:50:27 +02:00
|
|
|
}
|
2003-01-13 11:20:08 +01:00
|
|
|
#endif
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
FT_ERROR(( " no horizontal metrics in file!\n" ));
|
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
|
|
|
error = SFNT_Err_Hmtx_Table_Missing;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
num_longs = face->horizontal.number_Of_HMetrics;
|
2002-03-14 12:26:29 +01:00
|
|
|
longs = (TT_LongMetrics *)&face->horizontal.long_metrics;
|
1999-12-17 00:11:37 +01:00
|
|
|
shorts = (TT_ShortMetrics**)&face->horizontal.short_metrics;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* never trust derived values */
|
|
|
|
|
|
|
|
num_shorts = face->max_profile.numGlyphs - num_longs;
|
2000-06-05 07:26:15 +02:00
|
|
|
num_shorts_checked = ( table_len - num_longs * 4L ) / 2;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
if ( num_shorts < 0 )
|
|
|
|
{
|
2000-07-02 02:27:53 +02:00
|
|
|
FT_ERROR(( "TT_Load_%s_Metrics: more metrics than glyphs!\n",
|
|
|
|
vertical ? "Vertical"
|
|
|
|
: "Horizontal" ));
|
2000-06-05 07:26:15 +02:00
|
|
|
|
2005-11-18 09:23:06 +01:00
|
|
|
/* Adobe simply ignores this problem. So we shall do the same. */
|
|
|
|
#if 0
|
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
|
|
|
error = vertical ? SFNT_Err_Invalid_Vert_Metrics
|
|
|
|
: SFNT_Err_Invalid_Horiz_Metrics;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
2005-11-18 09:23:06 +01:00
|
|
|
#else
|
|
|
|
num_shorts = 0;
|
|
|
|
#endif
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2004-06-23 17:44:03 +02:00
|
|
|
if ( FT_QNEW_ARRAY( *longs, num_longs ) ||
|
|
|
|
FT_QNEW_ARRAY( *shorts, num_shorts ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_FRAME_ENTER( table_len ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
TT_LongMetrics cur = *longs;
|
|
|
|
TT_LongMetrics limit = cur + num_longs;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
for ( ; cur < limit; cur++ )
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
cur->advance = FT_GET_USHORT();
|
|
|
|
cur->bearing = FT_GET_SHORT();
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* do we have an inconsistent number of metric values? */
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
TT_ShortMetrics* cur = *shorts;
|
2004-03-05 10:26:24 +01:00
|
|
|
TT_ShortMetrics* limit = cur +
|
|
|
|
FT_MIN( num_shorts, num_shorts_checked );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
for ( ; cur < limit; cur++ )
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
*cur = FT_GET_SHORT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
/* We fill up the missing left side bearings with the */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* last valid value. Since this will occur for buggy CJK */
|
2005-03-01 03:13:50 +01:00
|
|
|
/* fonts usually only, nothing serious will happen. */
|
1999-12-17 00:11:37 +01:00
|
|
|
if ( num_shorts > num_shorts_checked && num_shorts_checked > 0 )
|
|
|
|
{
|
2001-04-02 19:47:16 +02:00
|
|
|
FT_Short val = (*shorts)[num_shorts_checked - 1];
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
limit = *shorts + num_shorts;
|
|
|
|
for ( ; cur < limit; cur++ )
|
|
|
|
*cur = val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( "loaded\n" ));
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
#endif /* !FT_OPTIMIZE_METRICS */
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_metrics_header */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the horizontal or vertical header in a face object. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: The input stream. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* vertical :: A boolean flag. If set, load vertical metrics. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_metrics_header( TT_Face face,
|
|
|
|
FT_Stream stream,
|
|
|
|
FT_Bool vertical )
|
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
|
|
|
TT_HoriHeader* header;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
const FT_Frame_Field metrics_header_fields[] =
|
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_HoriHeader
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_START( 36 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_ULONG ( Version ),
|
|
|
|
FT_FRAME_SHORT ( Ascender ),
|
|
|
|
FT_FRAME_SHORT ( Descender ),
|
|
|
|
FT_FRAME_SHORT ( Line_Gap ),
|
|
|
|
FT_FRAME_USHORT( advance_Width_Max ),
|
|
|
|
FT_FRAME_SHORT ( min_Left_Side_Bearing ),
|
|
|
|
FT_FRAME_SHORT ( min_Right_Side_Bearing ),
|
|
|
|
FT_FRAME_SHORT ( xMax_Extent ),
|
|
|
|
FT_FRAME_SHORT ( caret_Slope_Rise ),
|
|
|
|
FT_FRAME_SHORT ( caret_Slope_Run ),
|
Updating to OpenType 1.3.
* include/freetype/internal/tttypes.h (TT_CMap0, TT_CMap2, TT_CMap4,
TT_CMap6): Adding field `language'.
(TT_CMapTable): Removing field `language'.
Type of `length' field changed to FT_ULong.
Adding fields for cmaps format 8, 10, and 12.
(TT_CMapGroup): New auxiliary structure.
(TT_CMap8_12, TT_CMap10): New structures.
* include/freetype/tttables.h (TT_HoriHeader, TT_VertHeader):
Removed last element of `Reserved' array.
* include/freetype/ttnameid.h (TT_PLATFORM_CUSTOM, TT_MS_ID_UCS_4,
TT_NAME_ID_CID_FINDFONT_NAME): New macros.
* src/sfnt/ttcmap.c (TT_CharMap_Load): Updated loading of `language'
field to the new structures.
Fixed freeing of arrays in case of unsuccessful loads.
Added support for loading format 8, 10, and 12 cmaps.
(TT_CharMap_Free): Added support for freeing format 8, 10, and 12
cmaps.
(code_to_index4): Small improvement.
(code_to_index6): Ditto.
(code_to_index8_12, code_to_index10): New functions.
* src/sfnt/ttload.c (TT_Load_Metrics_Header): Updated to new
structure.
(TT_Load_CMap): Ditto.
* src/sfnt/sfobjs.c (tt_encodings): Add MS UCS4 table (before MS
Unicode).
* src/type1/t1driver.c (t1_get_name_index): Fix compiler warning.
2001-08-13 13:44:29 +02:00
|
|
|
FT_FRAME_SHORT ( caret_Offset ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_SHORT ( Reserved[0] ),
|
|
|
|
FT_FRAME_SHORT ( Reserved[1] ),
|
|
|
|
FT_FRAME_SHORT ( Reserved[2] ),
|
|
|
|
FT_FRAME_SHORT ( Reserved[3] ),
|
|
|
|
FT_FRAME_SHORT ( metric_Data_Format ),
|
|
|
|
FT_FRAME_USHORT( number_Of_HMetrics ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
2000-05-29 22:37:41 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
FT_TRACE2(( vertical ? "Vertical header " : "Horizontal header " ));
|
|
|
|
|
|
|
|
if ( vertical )
|
|
|
|
{
|
|
|
|
face->vertical_info = 0;
|
|
|
|
|
|
|
|
/* The vertical header table is optional, so return quietly if */
|
|
|
|
/* we don't find it. */
|
|
|
|
error = face->goto_table( face, TTAG_vhea, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
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
|
|
|
error = SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
face->vertical_info = 1;
|
|
|
|
header = (TT_HoriHeader*)&face->vertical;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-20 07:45:42 +02:00
|
|
|
/* The horizontal header is mandatory for most fonts; return */
|
|
|
|
/* an error if we don't find it. */
|
1999-12-17 00:11:37 +01:00
|
|
|
error = face->goto_table( face, TTAG_hhea, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
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
|
|
|
error = SFNT_Err_Horiz_Header_Missing;
|
2005-08-20 07:45:42 +02:00
|
|
|
|
|
|
|
/* No `hhea' table necessary for SFNT Mac fonts. */
|
|
|
|
if ( face->format_tag == TTAG_true )
|
|
|
|
{
|
|
|
|
FT_TRACE2(( "missing. This is an SFNT Mac font.\n"));
|
|
|
|
error = SFNT_Err_Ok;
|
|
|
|
}
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
header = &face->horizontal;
|
|
|
|
}
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( metrics_header_fields, header ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
header->long_metrics = NULL;
|
|
|
|
header->short_metrics = NULL;
|
|
|
|
|
|
|
|
FT_TRACE2(( "loaded\n" ));
|
|
|
|
|
|
|
|
/* Now try to load the corresponding metrics */
|
|
|
|
|
* 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
|
|
|
error = tt_face_load_metrics( face, stream, vertical );
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_names */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the name records. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: The input stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_names( TT_Face face,
|
|
|
|
FT_Stream stream )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
FT_ULong table_pos, table_len;
|
2002-05-28 01:52:01 +02:00
|
|
|
FT_ULong storage_start, storage_limit;
|
|
|
|
FT_UInt count;
|
|
|
|
TT_NameTable table;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
static const FT_Frame_Field name_table_fields[] =
|
2000-06-05 07:26:15 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
2002-03-14 12:26:29 +01:00
|
|
|
#define FT_STRUCTURE TT_NameTableRec
|
2000-07-31 20:59:02 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_START( 6 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_USHORT( format ),
|
|
|
|
FT_FRAME_USHORT( numNameRecords ),
|
|
|
|
FT_FRAME_USHORT( storageOffset ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
static const FT_Frame_Field name_record_fields[] =
|
2000-06-05 07:26:15 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
2002-03-14 12:26:29 +01:00
|
|
|
#define FT_STRUCTURE TT_NameEntryRec
|
2000-07-31 20:59:02 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* no FT_FRAME_START */
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_USHORT( platformID ),
|
|
|
|
FT_FRAME_USHORT( encodingID ),
|
|
|
|
FT_FRAME_USHORT( languageID ),
|
|
|
|
FT_FRAME_USHORT( nameID ),
|
|
|
|
FT_FRAME_USHORT( stringLength ),
|
|
|
|
FT_FRAME_USHORT( stringOffset ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2002-05-28 08:03:10 +02:00
|
|
|
table = &face->name_table;
|
2002-05-28 01:52:01 +02:00
|
|
|
table->stream = stream;
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
FT_TRACE2(( "Names " ));
|
|
|
|
|
|
|
|
error = face->goto_table( face, TTAG_name, stream, &table_len );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
/* The name table is required so indicate failure. */
|
|
|
|
FT_TRACE2(( "is missing!\n" ));
|
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
|
|
|
error = SFNT_Err_Name_Table_Missing;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
table_pos = FT_STREAM_POS();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-02-13 14:41:56 +01:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
if ( FT_STREAM_READ_FIELDS( name_table_fields, table ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2003-02-25 21:37:50 +01:00
|
|
|
/* Some popular Asian fonts have an invalid `storageOffset' value */
|
2002-05-28 08:03:10 +02:00
|
|
|
/* (it should be at least "6 + 12*num_names"). However, the string */
|
|
|
|
/* offsets, computed as "storageOffset + entry->stringOffset", are */
|
|
|
|
/* valid pointers within the name table... */
|
|
|
|
/* */
|
|
|
|
/* We thus can't check `storageOffset' right now. */
|
|
|
|
/* */
|
2002-05-28 01:52:01 +02:00
|
|
|
storage_start = table_pos + 6 + 12*table->numNameRecords;
|
|
|
|
storage_limit = table_pos + table_len;
|
|
|
|
|
|
|
|
if ( storage_start > storage_limit )
|
2002-02-28 00:10:19 +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
|
|
|
FT_ERROR(( "tt_face_load_names: invalid `name' table\n" ));
|
2002-02-28 00:10:19 +01:00
|
|
|
error = SFNT_Err_Name_Table_Missing;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* Allocate the array of name records. */
|
2002-05-28 01:52:01 +02:00
|
|
|
count = table->numNameRecords;
|
|
|
|
table->numNameRecords = 0;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
if ( FT_NEW_ARRAY( table->names, count ) ||
|
|
|
|
FT_FRAME_ENTER( count * 12 ) )
|
|
|
|
goto Exit;
|
2002-02-28 00:10:19 +01:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* Load the name records and determine how much storage is needed */
|
|
|
|
/* to hold the strings themselves. */
|
|
|
|
{
|
2002-05-28 01:52:01 +02:00
|
|
|
TT_NameEntryRec* entry = table->names;
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
for ( ; count > 0; count-- )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-05-28 01:52:01 +02:00
|
|
|
if ( FT_STREAM_READ_FIELDS( name_record_fields, entry ) )
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* check that the name is not empty */
|
|
|
|
if ( entry->stringLength == 0 )
|
|
|
|
continue;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
/* check that the name string is within the table */
|
|
|
|
entry->stringOffset += table_pos + table->storageOffset;
|
|
|
|
if ( entry->stringOffset < storage_start ||
|
|
|
|
entry->stringOffset + entry->stringLength > storage_limit )
|
2002-03-05 17:12:57 +01:00
|
|
|
{
|
2002-05-28 01:52:01 +02:00
|
|
|
/* invalid entry - ignore it */
|
|
|
|
entry->stringOffset = 0;
|
|
|
|
entry->stringLength = 0;
|
|
|
|
continue;
|
2002-03-05 17:12:57 +01:00
|
|
|
}
|
2002-05-28 01:52:01 +02:00
|
|
|
|
|
|
|
entry++;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2002-09-28 18:40:57 +02:00
|
|
|
table->numNameRecords = (FT_UInt)( entry - table->names );
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( "loaded\n" ));
|
|
|
|
|
2000-07-12 18:57:37 +02:00
|
|
|
/* everything went well, update face->num_names */
|
2002-06-11 22:35:58 +02:00
|
|
|
face->num_names = (FT_UShort) table->numNameRecords;
|
2000-07-12 18:57:37 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_free_names */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Frees the name records. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* 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
|
|
|
tt_face_free_names( TT_Face face )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Memory memory = face->root.driver->root.memory;
|
2002-05-28 01:52:01 +02:00
|
|
|
TT_NameTable table = &face->name_table;
|
|
|
|
TT_NameEntry entry = table->names;
|
|
|
|
FT_UInt count = table->numNameRecords;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
|
2004-05-03 23:31:43 +02:00
|
|
|
if ( table->names )
|
2002-05-28 01:52:01 +02:00
|
|
|
{
|
2004-05-03 23:31:43 +02:00
|
|
|
for ( ; count > 0; count--, entry++ )
|
|
|
|
{
|
|
|
|
FT_FREE( entry->string );
|
|
|
|
entry->stringLength = 0;
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-05-03 23:31:43 +02:00
|
|
|
/* free strings table */
|
|
|
|
FT_FREE( table->names );
|
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-05-28 01:52:01 +02:00
|
|
|
table->numNameRecords = 0;
|
|
|
|
table->format = 0;
|
|
|
|
table->storageOffset = 0;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_cmap */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the cmap directory in a face object. The cmaps itselves are */
|
|
|
|
/* loaded on demand in the `ttcmap.c' module. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-06-05 07:26:15 +02:00
|
|
|
/* stream :: A handle to the input stream. */
|
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
|
|
|
/* */
|
2002-03-22 16:02:38 +01:00
|
|
|
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_cmap( TT_Face face,
|
|
|
|
FT_Stream stream )
|
2002-03-22 16:02:38 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Error error;
|
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
|
|
|
|
error = face->goto_table( face, TTAG_cmap, stream, &face->cmap_size );
|
|
|
|
if ( error )
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_TRACE2(( "No `cmap' table in font !\n" ));
|
2002-03-22 16:02:38 +01:00
|
|
|
error = SFNT_Err_CMap_Table_Missing;
|
|
|
|
goto Exit;
|
|
|
|
}
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
if ( !FT_FRAME_EXTRACT( face->cmap_size, face->cmap_table ) )
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_TRACE2(( "`cmap' table loaded\n" ));
|
2002-03-22 16:02:38 +01:00
|
|
|
else
|
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_ERROR(( "`cmap' table is too short!\n" ));
|
2002-03-22 16:02:38 +01:00
|
|
|
face->cmap_size = 0;
|
|
|
|
}
|
2002-05-28 01:52:01 +02:00
|
|
|
|
2002-03-22 16:02:38 +01:00
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_os2 */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the OS2 table. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: A handle to the input stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_os2( TT_Face face,
|
|
|
|
FT_Stream stream )
|
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
|
|
|
TT_OS2* os2;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2001-07-17 14:37:54 +02:00
|
|
|
const FT_Frame_Field os2_fields[] =
|
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_OS2
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_START( 78 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_USHORT( version ),
|
|
|
|
FT_FRAME_SHORT ( xAvgCharWidth ),
|
|
|
|
FT_FRAME_USHORT( usWeightClass ),
|
|
|
|
FT_FRAME_USHORT( usWidthClass ),
|
|
|
|
FT_FRAME_SHORT ( fsType ),
|
|
|
|
FT_FRAME_SHORT ( ySubscriptXSize ),
|
|
|
|
FT_FRAME_SHORT ( ySubscriptYSize ),
|
|
|
|
FT_FRAME_SHORT ( ySubscriptXOffset ),
|
|
|
|
FT_FRAME_SHORT ( ySubscriptYOffset ),
|
|
|
|
FT_FRAME_SHORT ( ySuperscriptXSize ),
|
|
|
|
FT_FRAME_SHORT ( ySuperscriptYSize ),
|
|
|
|
FT_FRAME_SHORT ( ySuperscriptXOffset ),
|
|
|
|
FT_FRAME_SHORT ( ySuperscriptYOffset ),
|
|
|
|
FT_FRAME_SHORT ( yStrikeoutSize ),
|
|
|
|
FT_FRAME_SHORT ( yStrikeoutPosition ),
|
|
|
|
FT_FRAME_SHORT ( sFamilyClass ),
|
|
|
|
FT_FRAME_BYTE ( panose[0] ),
|
|
|
|
FT_FRAME_BYTE ( panose[1] ),
|
|
|
|
FT_FRAME_BYTE ( panose[2] ),
|
|
|
|
FT_FRAME_BYTE ( panose[3] ),
|
|
|
|
FT_FRAME_BYTE ( panose[4] ),
|
|
|
|
FT_FRAME_BYTE ( panose[5] ),
|
|
|
|
FT_FRAME_BYTE ( panose[6] ),
|
|
|
|
FT_FRAME_BYTE ( panose[7] ),
|
|
|
|
FT_FRAME_BYTE ( panose[8] ),
|
|
|
|
FT_FRAME_BYTE ( panose[9] ),
|
|
|
|
FT_FRAME_ULONG ( ulUnicodeRange1 ),
|
|
|
|
FT_FRAME_ULONG ( ulUnicodeRange2 ),
|
|
|
|
FT_FRAME_ULONG ( ulUnicodeRange3 ),
|
|
|
|
FT_FRAME_ULONG ( ulUnicodeRange4 ),
|
|
|
|
FT_FRAME_BYTE ( achVendID[0] ),
|
|
|
|
FT_FRAME_BYTE ( achVendID[1] ),
|
|
|
|
FT_FRAME_BYTE ( achVendID[2] ),
|
|
|
|
FT_FRAME_BYTE ( achVendID[3] ),
|
|
|
|
|
|
|
|
FT_FRAME_USHORT( fsSelection ),
|
|
|
|
FT_FRAME_USHORT( usFirstCharIndex ),
|
|
|
|
FT_FRAME_USHORT( usLastCharIndex ),
|
|
|
|
FT_FRAME_SHORT ( sTypoAscender ),
|
|
|
|
FT_FRAME_SHORT ( sTypoDescender ),
|
|
|
|
FT_FRAME_SHORT ( sTypoLineGap ),
|
|
|
|
FT_FRAME_USHORT( usWinAscent ),
|
|
|
|
FT_FRAME_USHORT( usWinDescent ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
const FT_Frame_Field os2_fields_extra[] =
|
|
|
|
{
|
|
|
|
FT_FRAME_START( 8 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_ULONG( ulCodePageRange1 ),
|
|
|
|
FT_FRAME_ULONG( ulCodePageRange2 ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
const FT_Frame_Field os2_fields_extra2[] =
|
|
|
|
{
|
|
|
|
FT_FRAME_START( 10 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_SHORT ( sxHeight ),
|
|
|
|
FT_FRAME_SHORT ( sCapHeight ),
|
|
|
|
FT_FRAME_USHORT( usDefaultChar ),
|
|
|
|
FT_FRAME_USHORT( usBreakChar ),
|
|
|
|
FT_FRAME_USHORT( usMaxContext ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( "OS/2 Table " ));
|
|
|
|
|
|
|
|
/* We now support old Mac fonts where the OS/2 table doesn't */
|
|
|
|
/* exist. Simply put, we set the `version' field to 0xFFFF */
|
|
|
|
/* and test this value each time we need to access the table. */
|
|
|
|
error = face->goto_table( face, TTAG_OS2, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2000-07-02 02:27:53 +02:00
|
|
|
FT_TRACE2(( "is missing!\n" ));
|
2002-03-31 20:48:24 +02:00
|
|
|
face->os2.version = 0xFFFFU;
|
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
|
|
|
error = SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2000-02-13 14:41:56 +01:00
|
|
|
os2 = &face->os2;
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( os2_fields, os2 ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
os2->ulCodePageRange1 = 0;
|
|
|
|
os2->ulCodePageRange2 = 0;
|
2001-07-17 14:37:54 +02:00
|
|
|
os2->sxHeight = 0;
|
|
|
|
os2->sCapHeight = 0;
|
|
|
|
os2->usDefaultChar = 0;
|
|
|
|
os2->usBreakChar = 0;
|
|
|
|
os2->usMaxContext = 0;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
if ( os2->version >= 0x0001 )
|
|
|
|
{
|
|
|
|
/* only version 1 tables */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( os2_fields_extra, os2 ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
2000-05-02 13:01:49 +02:00
|
|
|
|
|
|
|
if ( os2->version >= 0x0002 )
|
|
|
|
{
|
|
|
|
/* only version 2 tables */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( os2_fields_extra2, os2 ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
2000-05-02 13:01:49 +02:00
|
|
|
}
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
FT_TRACE2(( "loaded\n" ));
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_postscript */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the Postscript table. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: A handle to the input stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_postscript( TT_Face face,
|
|
|
|
FT_Stream stream )
|
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
|
|
|
TT_Postscript* post = &face->postscript;
|
2000-05-29 22:37:41 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
static const FT_Frame_Field post_fields[] =
|
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_Postscript
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_START( 32 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_ULONG( FormatType ),
|
|
|
|
FT_FRAME_ULONG( italicAngle ),
|
|
|
|
FT_FRAME_SHORT( underlinePosition ),
|
|
|
|
FT_FRAME_SHORT( underlineThickness ),
|
|
|
|
FT_FRAME_ULONG( isFixedPitch ),
|
|
|
|
FT_FRAME_ULONG( minMemType42 ),
|
|
|
|
FT_FRAME_ULONG( maxMemType42 ),
|
|
|
|
FT_FRAME_ULONG( minMemType1 ),
|
|
|
|
FT_FRAME_ULONG( maxMemType1 ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE2(( "PostScript " ));
|
|
|
|
|
|
|
|
error = face->goto_table( face, TTAG_post, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
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 SFNT_Err_Post_Table_Missing;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( post_fields, post ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
return error;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* we don't load the glyph names, we do that in another */
|
|
|
|
/* module (ttpost). */
|
|
|
|
FT_TRACE2(( "loaded\n" ));
|
|
|
|
|
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 SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-18 18:18:05 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_pclt */
|
2000-05-18 18:18:05 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Loads the PCL 5 Table. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2000-05-18 18:18:05 +02:00
|
|
|
/* stream :: A handle to the input stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-05-18 18:18:05 +02:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_pclt( TT_Face face,
|
|
|
|
FT_Stream stream )
|
2000-05-18 18:18:05 +02:00
|
|
|
{
|
2000-06-05 07:26:15 +02:00
|
|
|
static const FT_Frame_Field pclt_fields[] =
|
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
|
|
|
#define FT_STRUCTURE TT_PCLT
|
|
|
|
|
2000-07-03 17:00:49 +02:00
|
|
|
FT_FRAME_START( 54 ),
|
2000-07-31 20:59:02 +02:00
|
|
|
FT_FRAME_ULONG ( Version ),
|
|
|
|
FT_FRAME_ULONG ( FontNumber ),
|
|
|
|
FT_FRAME_USHORT( Pitch ),
|
|
|
|
FT_FRAME_USHORT( xHeight ),
|
|
|
|
FT_FRAME_USHORT( Style ),
|
|
|
|
FT_FRAME_USHORT( TypeFamily ),
|
|
|
|
FT_FRAME_USHORT( CapHeight ),
|
|
|
|
FT_FRAME_BYTES ( TypeFace, 16 ),
|
|
|
|
FT_FRAME_BYTES ( CharacterComplement, 8 ),
|
|
|
|
FT_FRAME_BYTES ( FileName, 6 ),
|
|
|
|
FT_FRAME_CHAR ( StrokeWeight ),
|
|
|
|
FT_FRAME_CHAR ( WidthType ),
|
|
|
|
FT_FRAME_BYTE ( SerifStyle ),
|
|
|
|
FT_FRAME_BYTE ( Reserved ),
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
2000-06-05 16:32:32 +02:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-06-05 07:26:15 +02:00
|
|
|
TT_PCLT* pclt = &face->pclt;
|
|
|
|
|
2000-06-05 16:32:32 +02:00
|
|
|
|
2000-05-18 18:18:05 +02:00
|
|
|
FT_TRACE2(( "PCLT " ));
|
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
/* optional table */
|
|
|
|
error = face->goto_table( face, TTAG_PCLT, stream, 0 );
|
|
|
|
if ( error )
|
|
|
|
{
|
|
|
|
FT_TRACE2(( "missing (optional)\n" ));
|
|
|
|
pclt->Version = 0;
|
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 SFNT_Err_Ok;
|
2000-06-05 07:26:15 +02:00
|
|
|
}
|
2000-06-05 16:32:32 +02:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_STREAM_READ_FIELDS( pclt_fields, pclt ) )
|
2000-05-18 18:18:05 +02:00
|
|
|
goto Exit;
|
2000-06-05 16:32:32 +02:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
FT_TRACE2(( "loaded\n" ));
|
|
|
|
|
2000-06-05 16:32:32 +02:00
|
|
|
Exit:
|
2000-06-05 07:26:15 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2000-05-18 18:18:05 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* 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
|
|
|
/* tt_face_load_gasp */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-07-02 02:27:53 +02:00
|
|
|
/* Loads the `gasp' table into a face object. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* stream :: The input stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_gasp( TT_Face face,
|
|
|
|
FT_Stream stream )
|
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
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UInt j,num_ranges;
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_GaspRange gaspranges;
|
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
|
|
|
FT_TRACE2(( "tt_face_load_gasp: %08p\n", face ));
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* the gasp table is optional */
|
|
|
|
error = face->goto_table( face, TTAG_gasp, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
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 SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_FRAME_ENTER( 4L ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
face->gasp.version = FT_GET_USHORT();
|
|
|
|
face->gasp.numRanges = FT_GET_USHORT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
num_ranges = face->gasp.numRanges;
|
|
|
|
FT_TRACE3(( "number of ranges = %d\n", num_ranges ));
|
|
|
|
|
2004-06-23 17:44:03 +02:00
|
|
|
if ( FT_QNEW_ARRAY( gaspranges, num_ranges ) ||
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FRAME_ENTER( num_ranges * 4L ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
face->gasp.gaspRanges = gaspranges;
|
|
|
|
|
|
|
|
for ( j = 0; j < num_ranges; j++ )
|
|
|
|
{
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
gaspranges[j].maxPPEM = FT_GET_USHORT();
|
|
|
|
gaspranges[j].gaspFlag = FT_GET_USHORT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
FT_TRACE3(( " [max:%d flag:%d]",
|
2000-06-05 07:26:15 +02:00
|
|
|
gaspranges[j].maxPPEM,
|
|
|
|
gaspranges[j].gaspFlag ));
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
FT_TRACE3(( "\n" ));
|
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
1999-12-17 00:11:37 +01:00
|
|
|
FT_TRACE2(( "GASP loaded\n" ));
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
2005-02-26 01:12:04 +01:00
|
|
|
/* tt_face_load_hdmx */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2005-02-26 01:12:04 +01:00
|
|
|
/* Loads the horizontal device metrics table. */
|
1999-12-17 00:11:37 +01:00
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: A handle to the target face object. */
|
2002-03-31 20:48:24 +02:00
|
|
|
/* */
|
2005-02-26 01:12:04 +01:00
|
|
|
/* stream :: A handle to the input stream. */
|
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
|
|
|
/* */
|
2005-02-26 01:12:04 +01:00
|
|
|
#ifdef FT_OPTIMIZE_MEMORY
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2005-02-26 01:12:04 +01:00
|
|
|
tt_face_load_hdmx( TT_Face face,
|
* 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_Stream stream )
|
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
|
|
|
FT_Memory memory = stream->memory;
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_UInt version, nn, num_records;
|
|
|
|
FT_ULong table_size, record_size;
|
|
|
|
FT_Byte* p;
|
|
|
|
FT_Byte* limit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
/* this table is optional */
|
|
|
|
error = face->goto_table( face, TTAG_hdmx, stream, &table_size );
|
|
|
|
if ( error || table_size < 8 )
|
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 SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
if ( FT_FRAME_EXTRACT( table_size, face->hdmx_table ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
p = face->hdmx_table;
|
|
|
|
limit = p + table_size;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
version = FT_NEXT_USHORT( p );
|
|
|
|
num_records = FT_NEXT_USHORT( p );
|
|
|
|
record_size = FT_NEXT_ULONG( p );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
if ( version != 0 || num_records > 255 || record_size > 0x40000 )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
error = SFNT_Err_Invalid_File_Format;
|
|
|
|
goto Fail;
|
|
|
|
}
|
2004-06-24 08:56:06 +02:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
if ( FT_NEW_ARRAY( face->hdmx_record_sizes, num_records ) )
|
|
|
|
goto Fail;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
for ( nn = 0; nn < num_records; nn++ )
|
|
|
|
{
|
2005-03-01 03:13:50 +01:00
|
|
|
if ( p + record_size > limit )
|
2005-02-26 01:12:04 +01:00
|
|
|
break;
|
|
|
|
|
|
|
|
face->hdmx_record_sizes[nn] = p[0];
|
|
|
|
p += record_size;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
2005-02-26 01:12:04 +01:00
|
|
|
|
|
|
|
face->hdmx_record_count = nn;
|
|
|
|
face->hdmx_table_size = table_size;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
2005-02-26 01:12:04 +01:00
|
|
|
|
|
|
|
Fail:
|
|
|
|
FT_FRAME_RELEASE( face->hdmx_table );
|
|
|
|
face->hdmx_table_size = 0;
|
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
tt_face_free_hdmx( TT_Face face )
|
2001-06-27 14:40:46 +02:00
|
|
|
{
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_Stream stream = face->root.stream;
|
|
|
|
FT_Memory memory = stream->memory;
|
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
FT_FREE( face->hdmx_record_sizes );
|
|
|
|
FT_FRAME_RELEASE( face->hdmx_table );
|
2001-06-27 14:40:46 +02:00
|
|
|
}
|
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
#else /* !FT_OPTIMIZE_MEMORY */
|
2005-03-01 03:13:50 +01:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* 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
|
|
|
tt_face_load_hdmx( TT_Face face,
|
|
|
|
FT_Stream stream )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = stream->memory;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-31 20:48:24 +02:00
|
|
|
TT_Hdmx hdmx = &face->hdmx;
|
2003-06-30 15:08:58 +02:00
|
|
|
FT_Short num_records;
|
2002-03-31 20:48:24 +02:00
|
|
|
FT_Long num_glyphs;
|
|
|
|
FT_Long record_size;
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
hdmx->version = 0;
|
|
|
|
hdmx->num_records = 0;
|
|
|
|
hdmx->records = 0;
|
|
|
|
|
|
|
|
/* this table is optional */
|
|
|
|
error = face->goto_table( face, TTAG_hdmx, stream, 0 );
|
2000-06-05 07:26:15 +02:00
|
|
|
if ( error )
|
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 SFNT_Err_Ok;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( FT_FRAME_ENTER( 8L ) )
|
2000-06-05 07:26:15 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
hdmx->version = FT_GET_USHORT();
|
|
|
|
num_records = FT_GET_SHORT();
|
|
|
|
record_size = FT_GET_LONG();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2004-10-13 07:15:44 +02:00
|
|
|
if ( record_size < 0 || num_records < 0 )
|
|
|
|
return SFNT_Err_Invalid_File_Format;
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* Only recognize format 0 */
|
|
|
|
if ( hdmx->version != 0 )
|
|
|
|
goto Exit;
|
|
|
|
|
2004-10-13 07:15:44 +02:00
|
|
|
/* we can't use FT_QNEW_ARRAY here; otherwise tt_face_free_hdmx */
|
|
|
|
/* could fail during deallocation */
|
|
|
|
if ( FT_NEW_ARRAY( hdmx->records, num_records ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
|
|
|
|
2003-06-30 15:08:58 +02:00
|
|
|
hdmx->num_records = num_records;
|
2004-10-13 07:15:44 +02:00
|
|
|
num_glyphs = face->root.num_glyphs;
|
|
|
|
record_size -= num_glyphs + 2;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
{
|
2002-03-14 12:26:29 +01:00
|
|
|
TT_HdmxEntry cur = hdmx->records;
|
|
|
|
TT_HdmxEntry limit = cur + hdmx->num_records;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
for ( ; cur < limit; cur++ )
|
|
|
|
{
|
|
|
|
/* read record */
|
* include/freetype/internal/ftstream.h,
src/base/ftstream.c, src/cff/cffload.c, src/pcf/pcfread.c,
src/sfnt/ttcmap.c, src/sfnt/ttcmap0.c, src/sfnt/ttload.c,
src/sfnt/ttpost.c, src/sfnt/ttsbit.c,
src/truetype/ttgload.c, src/truetype/ttpload.c,
src/winfonts/winfnt.c:
changed the definitions of stream macros. Examples:
NEXT_Byte => FT_NEXT_BYTE
NEXT_Short => FT_NEXT_SHORT
NEXT_UShortLE => FT_NEXT_USHORT_LE
READ_Short => FT_READ_SHORT
GET_Long => FT_GET_LONG
etc..
also introduced the FT_PEEK_XXXX functions..
2002-03-22 13:55:23 +01:00
|
|
|
if ( FT_READ_BYTE( cur->ppem ) ||
|
|
|
|
FT_READ_BYTE( cur->max_width ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
2005-03-01 03:13:50 +01:00
|
|
|
if ( FT_QALLOC( cur->widths, num_glyphs ) ||
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_STREAM_READ( cur->widths, num_glyphs ) )
|
1999-12-17 00:11:37 +01:00
|
|
|
goto Exit;
|
2000-05-17 01:44:38 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
/* skip padding bytes */
|
2002-03-20 11:49:31 +01:00
|
|
|
if ( record_size > 0 && FT_STREAM_SKIP( record_size ) )
|
2004-10-13 07:15:44 +02:00
|
|
|
goto Exit;
|
1999-12-17 00:11:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* 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
|
|
|
tt_face_free_hdmx( TT_Face face )
|
1999-12-17 00:11:37 +01:00
|
|
|
{
|
|
|
|
if ( face )
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int n;
|
- 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
|
|
|
FT_Memory memory = face->root.driver->root.memory;
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2000-06-05 07:26:15 +02:00
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
for ( n = 0; n < face->hdmx.num_records; n++ )
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->hdmx.records[n].widths );
|
1999-12-17 00:11:37 +01:00
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->hdmx.records );
|
1999-12-17 00:11:37 +01:00
|
|
|
face->hdmx.num_records = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-26 01:12:04 +01:00
|
|
|
#endif /* !OPTIMIZE_MEMORY */
|
|
|
|
|
1999-12-17 00:11:37 +01:00
|
|
|
|
|
|
|
/* END */
|