2000-07-07 21:46:01 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* winfnt.c */
|
|
|
|
/* */
|
|
|
|
/* FreeType font driver for Windows FNT/FON files */
|
|
|
|
/* */
|
2003-04-23 17:50:27 +02:00
|
|
|
/* Copyright 1996-2001, 2002, 2003 by */
|
2000-07-07 21:46:01 +02:00
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
2000-07-09 00:52:21 +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 */
|
2000-07-07 21:46:01 +02: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-07-09 00:52:21 +02:00
|
|
|
|
2000-12-09 01:45:38 +01:00
|
|
|
#include <ft2build.h>
|
2003-01-15 23:48:27 +01:00
|
|
|
#include FT_WINFONTS_H
|
2000-12-09 01:45:38 +01:00
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_INTERNAL_STREAM_H
|
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "winfnt.h"
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "fnterrs.h"
|
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
2003-09-21 19:15:55 +02:00
|
|
|
#include FT_SERVICE_WINFNT_H
|
|
|
|
#include FT_SERVICE_XFREE86_NAME_H
|
2000-07-09 00:52:21 +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. */
|
|
|
|
/* */
|
2000-07-07 21:46:01 +02:00
|
|
|
#undef FT_COMPONENT
|
2000-07-09 00:52:21 +02:00
|
|
|
#define FT_COMPONENT trace_winfnt
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
|
* src/autohint/ahglobal.c (blue_chars), src/winfonts/winfnt.c
(fnt_cmap_class_rec, fnt_cmap_class), src/bdf/bdflib.c (empty,
_num_bdf_properties), src/gzip/infutil.c (inflate_mask),
src/gzip/inffixed.h (fixed_bl, fixed_bd, fixed_tl, fixed_td),
src/gzip/inftrees.h (inflate_trees_fixed), srf/gzip/inftrees.c
(inflate_trees_fixed): Decorate with more `const' to avoid
writable global variables which are disallowed on ARM.
2003-10-16 00:20:56 +02:00
|
|
|
static const FT_Frame_Field winmz_header_fields[] =
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
2002-03-14 10:01:32 +01:00
|
|
|
#define FT_STRUCTURE WinMZ_HeaderRec
|
2000-07-31 20:59:02 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_FRAME_START( 64 ),
|
2000-09-29 08:41:56 +02:00
|
|
|
FT_FRAME_USHORT_LE ( magic ),
|
|
|
|
FT_FRAME_SKIP_BYTES( 29 * 2 ),
|
|
|
|
FT_FRAME_ULONG_LE ( lfanew ),
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
* src/autohint/ahglobal.c (blue_chars), src/winfonts/winfnt.c
(fnt_cmap_class_rec, fnt_cmap_class), src/bdf/bdflib.c (empty,
_num_bdf_properties), src/gzip/infutil.c (inflate_mask),
src/gzip/inffixed.h (fixed_bl, fixed_bd, fixed_tl, fixed_td),
src/gzip/inftrees.h (inflate_trees_fixed), srf/gzip/inftrees.c
(inflate_trees_fixed): Decorate with more `const' to avoid
writable global variables which are disallowed on ARM.
2003-10-16 00:20:56 +02:00
|
|
|
static const FT_Frame_Field winne_header_fields[] =
|
2000-07-09 00:52:21 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
2002-03-14 10:01:32 +01:00
|
|
|
#define FT_STRUCTURE WinNE_HeaderRec
|
2000-07-31 20:59:02 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_FRAME_START( 40 ),
|
2000-09-29 08:41:56 +02:00
|
|
|
FT_FRAME_USHORT_LE ( magic ),
|
|
|
|
FT_FRAME_SKIP_BYTES( 34 ),
|
|
|
|
FT_FRAME_USHORT_LE ( resource_tab_offset ),
|
|
|
|
FT_FRAME_USHORT_LE ( rname_tab_offset ),
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
* src/autohint/ahglobal.c (blue_chars), src/winfonts/winfnt.c
(fnt_cmap_class_rec, fnt_cmap_class), src/bdf/bdflib.c (empty,
_num_bdf_properties), src/gzip/infutil.c (inflate_mask),
src/gzip/inffixed.h (fixed_bl, fixed_bd, fixed_tl, fixed_td),
src/gzip/inftrees.h (inflate_trees_fixed), srf/gzip/inftrees.c
(inflate_trees_fixed): Decorate with more `const' to avoid
writable global variables which are disallowed on ARM.
2003-10-16 00:20:56 +02:00
|
|
|
static const FT_Frame_Field winfnt_header_fields[] =
|
2000-07-09 00:52:21 +02:00
|
|
|
{
|
2000-07-31 20:59:02 +02:00
|
|
|
#undef FT_STRUCTURE
|
2003-01-15 23:48:27 +01:00
|
|
|
#define FT_STRUCTURE FT_WinFNT_HeaderRec
|
2000-07-31 20:59:02 +02:00
|
|
|
|
2003-10-02 23:36:18 +02:00
|
|
|
FT_FRAME_START( 148 ),
|
2000-09-29 08:41:56 +02:00
|
|
|
FT_FRAME_USHORT_LE( version ),
|
|
|
|
FT_FRAME_ULONG_LE ( file_size ),
|
|
|
|
FT_FRAME_BYTES ( copyright, 60 ),
|
|
|
|
FT_FRAME_USHORT_LE( file_type ),
|
|
|
|
FT_FRAME_USHORT_LE( nominal_point_size ),
|
|
|
|
FT_FRAME_USHORT_LE( vertical_resolution ),
|
|
|
|
FT_FRAME_USHORT_LE( horizontal_resolution ),
|
|
|
|
FT_FRAME_USHORT_LE( ascent ),
|
|
|
|
FT_FRAME_USHORT_LE( internal_leading ),
|
|
|
|
FT_FRAME_USHORT_LE( external_leading ),
|
|
|
|
FT_FRAME_BYTE ( italic ),
|
|
|
|
FT_FRAME_BYTE ( underline ),
|
|
|
|
FT_FRAME_BYTE ( strike_out ),
|
|
|
|
FT_FRAME_USHORT_LE( weight ),
|
|
|
|
FT_FRAME_BYTE ( charset ),
|
|
|
|
FT_FRAME_USHORT_LE( pixel_width ),
|
|
|
|
FT_FRAME_USHORT_LE( pixel_height ),
|
|
|
|
FT_FRAME_BYTE ( pitch_and_family ),
|
|
|
|
FT_FRAME_USHORT_LE( avg_width ),
|
|
|
|
FT_FRAME_USHORT_LE( max_width ),
|
|
|
|
FT_FRAME_BYTE ( first_char ),
|
|
|
|
FT_FRAME_BYTE ( last_char ),
|
|
|
|
FT_FRAME_BYTE ( default_char ),
|
|
|
|
FT_FRAME_BYTE ( break_char ),
|
|
|
|
FT_FRAME_USHORT_LE( bytes_per_row ),
|
|
|
|
FT_FRAME_ULONG_LE ( device_offset ),
|
|
|
|
FT_FRAME_ULONG_LE ( face_name_offset ),
|
|
|
|
FT_FRAME_ULONG_LE ( bits_pointer ),
|
|
|
|
FT_FRAME_ULONG_LE ( bits_offset ),
|
|
|
|
FT_FRAME_BYTE ( reserved ),
|
|
|
|
FT_FRAME_ULONG_LE ( flags ),
|
|
|
|
FT_FRAME_USHORT_LE( A_space ),
|
|
|
|
FT_FRAME_USHORT_LE( B_space ),
|
|
|
|
FT_FRAME_USHORT_LE( C_space ),
|
2003-10-02 23:36:18 +02:00
|
|
|
FT_FRAME_ULONG_LE ( color_table_offset ),
|
2003-01-15 23:48:27 +01:00
|
|
|
FT_FRAME_BYTES ( reserved1, 16 ),
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_FRAME_END
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static void
|
2003-07-01 09:28:55 +02:00
|
|
|
fnt_font_done( FNT_Face face )
|
2000-07-09 00:52:21 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
FT_Memory memory = FT_FACE( face )->memory;
|
|
|
|
FT_Stream stream = FT_FACE( face )->stream;
|
|
|
|
FNT_Font font = face->font;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !font )
|
|
|
|
return;
|
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( font->fnt_frame )
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_RELEASE( font->fnt_frame );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
FT_FREE( font );
|
|
|
|
face->font = 0;
|
2000-07-09 21:15:30 +02:00
|
|
|
}
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static FT_Error
|
2002-04-02 16:50:31 +02:00
|
|
|
fnt_font_load( FNT_Font font,
|
2001-04-25 20:11:16 +02:00
|
|
|
FT_Stream stream )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-01-15 23:48:27 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_WinFNT_Header header = &font->header;
|
2003-10-02 23:36:18 +02:00
|
|
|
FT_Bool new_format;
|
|
|
|
FT_UInt size;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
/* first of all, read the FNT header */
|
2003-06-20 09:33:20 +02:00
|
|
|
if ( FT_STREAM_SEEK( font->offset ) ||
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_STREAM_READ_FIELDS( winfnt_header_fields, header ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* check header */
|
|
|
|
if ( header->version != 0x200 &&
|
|
|
|
header->version != 0x300 )
|
|
|
|
{
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_TRACE2(( "[not a valid FNT 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 = FNT_Err_Unknown_File_Format;
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2003-10-02 23:36:18 +02:00
|
|
|
new_format = FT_BOOL( font->header.version == 0x300 );
|
|
|
|
size = new_format ? 148 : 118;
|
|
|
|
|
|
|
|
if ( header->file_size < size )
|
|
|
|
{
|
|
|
|
FT_TRACE2(( "[not a valid FNT file]\n" ));
|
|
|
|
error = FNT_Err_Unknown_File_Format;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2002-12-18 23:53:12 +01:00
|
|
|
/* Version 2 doesn't have these fields */
|
|
|
|
if ( header->version == 0x200 )
|
|
|
|
{
|
|
|
|
header->flags = 0;
|
|
|
|
header->A_space = 0;
|
|
|
|
header->B_space = 0;
|
|
|
|
header->C_space = 0;
|
|
|
|
|
|
|
|
header->color_table_offset = 0;
|
|
|
|
}
|
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
if ( header->file_type & 1 )
|
|
|
|
{
|
2000-09-29 08:41:56 +02:00
|
|
|
FT_TRACE2(( "[can't handle vector FNT fonts]\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 = FNT_Err_Unknown_File_Format;
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
/* this is a FNT file/table; extract its frame */
|
2002-03-22 16:55:55 +01:00
|
|
|
if ( FT_STREAM_SEEK( font->offset ) ||
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXTRACT( header->file_size, font->fnt_frame ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
2000-07-09 21:15:30 +02:00
|
|
|
}
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static FT_Error
|
2003-07-01 09:28:55 +02:00
|
|
|
fnt_face_get_dll_font( FNT_Face face,
|
|
|
|
FT_Int face_index )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2002-04-02 16:50:31 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Stream stream = FT_FACE( face )->stream;
|
|
|
|
FT_Memory memory = FT_FACE( face )->memory;
|
2002-03-14 10:01:32 +01:00
|
|
|
WinMZ_HeaderRec mz_header;
|
2000-07-07 21:46:01 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
face->font = 0;
|
2000-07-07 21:46:01 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
/* does it begin with an MZ header? */
|
2003-06-20 09:33:20 +02:00
|
|
|
if ( FT_STREAM_SEEK( 0 ) ||
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_STREAM_READ_FIELDS( winmz_header_fields, &mz_header ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
|
|
|
|
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 = FNT_Err_Unknown_File_Format;
|
2000-07-07 21:46:01 +02:00
|
|
|
if ( mz_header.magic == WINFNT_MZ_MAGIC )
|
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
/* yes, now look for an NE header in the file */
|
2002-03-14 10:01:32 +01:00
|
|
|
WinNE_HeaderRec ne_header;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-06-20 09:33:20 +02:00
|
|
|
if ( FT_STREAM_SEEK( mz_header.lfanew ) ||
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_STREAM_READ_FIELDS( winne_header_fields, &ne_header ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
2000-07-09 21:15:30 +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
|
|
|
error = FNT_Err_Unknown_File_Format;
|
2000-07-07 21:46:01 +02:00
|
|
|
if ( ne_header.magic == WINFNT_NE_MAGIC )
|
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
/* good, now look into the resource table for each FNT resource */
|
|
|
|
FT_ULong res_offset = mz_header.lfanew +
|
|
|
|
ne_header.resource_tab_offset;
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_UShort size_shift;
|
|
|
|
FT_UShort font_count = 0;
|
|
|
|
FT_ULong font_offset = 0;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( FT_STREAM_SEEK( res_offset ) ||
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_ENTER( ne_header.rname_tab_offset -
|
2002-03-22 16:55:55 +01:00
|
|
|
ne_header.resource_tab_offset ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
* 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
|
|
|
size_shift = FT_GET_USHORT_LE();
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
FT_UShort type_id, count;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
* 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
|
|
|
type_id = FT_GET_USHORT_LE();
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( !type_id )
|
2000-07-07 21:46:01 +02:00
|
|
|
break;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
* 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
|
|
|
count = FT_GET_USHORT_LE();
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( type_id == 0x8008U )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
|
|
|
font_count = count;
|
2002-03-20 11:49:31 +01:00
|
|
|
font_offset = (FT_ULong)( FT_STREAM_POS() + 4 +
|
2001-03-10 18:07:42 +01:00
|
|
|
( stream->cursor - stream->limit ) );
|
2000-07-07 21:46:01 +02:00
|
|
|
break;
|
|
|
|
}
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
stream->cursor += 4 + count * 12;
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
2003-07-01 09:28:55 +02:00
|
|
|
|
2002-03-20 11:49:31 +01:00
|
|
|
FT_FRAME_EXIT();
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
if ( !font_count || !font_offset )
|
|
|
|
{
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_TRACE2(( "this file doesn't contain any FNT resources!\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 = FNT_Err_Unknown_File_Format;
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
2000-07-09 21:15:30 +02:00
|
|
|
}
|
2000-07-07 21:46:01 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
face->root.num_faces = font_count;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( face_index >= font_count )
|
|
|
|
{
|
|
|
|
error = FNT_Err_Bad_Argument;
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
2003-07-01 09:28:55 +02:00
|
|
|
}
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( FT_NEW( face->font ) )
|
|
|
|
goto Exit;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( FT_STREAM_SEEK( font_offset + face_index * 12 ) ||
|
|
|
|
FT_FRAME_ENTER( 12 ) )
|
|
|
|
goto Fail;
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
face->font->offset = (FT_ULong)FT_GET_USHORT_LE() << size_shift;
|
|
|
|
face->font->fnt_size = (FT_ULong)FT_GET_USHORT_LE() << size_shift;
|
|
|
|
face->font->size_shift = size_shift;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
stream->cursor += 8;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
FT_FRAME_EXIT();
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
error = fnt_font_load( face->font, stream );
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Fail:
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( error )
|
2003-07-01 09:28:55 +02:00
|
|
|
fnt_font_done( face );
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
typedef struct FNT_CMapRec_
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
|
|
|
FT_CMapRec cmap;
|
|
|
|
FT_UInt32 first;
|
|
|
|
FT_UInt32 count;
|
|
|
|
|
|
|
|
} FNT_CMapRec, *FNT_CMap;
|
|
|
|
|
|
|
|
|
|
|
|
static FT_Error
|
2002-03-22 18:09:52 +01:00
|
|
|
fnt_cmap_init( FNT_CMap cmap )
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
2002-04-02 16:50:31 +02:00
|
|
|
FNT_Face face = (FNT_Face)FT_CMAP_FACE( cmap );
|
2003-07-01 09:28:55 +02:00
|
|
|
FNT_Font font = face->font;
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
|
|
|
|
cmap->first = (FT_UInt32) font->header.first_char;
|
|
|
|
cmap->count = (FT_UInt32)( font->header.last_char - cmap->first + 1 );
|
2002-03-01 03:26:22 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static FT_UInt
|
2002-03-22 18:09:52 +01:00
|
|
|
fnt_cmap_char_index( FNT_CMap cmap,
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_UInt32 char_code )
|
|
|
|
{
|
2002-03-20 10:42:31 +01:00
|
|
|
FT_UInt gindex = 0;
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
char_code -= cmap->first;
|
|
|
|
if ( char_code < cmap->count )
|
2003-07-01 09:28:55 +02:00
|
|
|
gindex = char_code + 1; /* we artificially increase the glyph index; */
|
|
|
|
/* FNT_Load_Glyph reverts to the right one */
|
2002-03-01 03:26:22 +01:00
|
|
|
return gindex;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-22 16:55:55 +01:00
|
|
|
static FT_UInt
|
2002-04-02 16:50:31 +02:00
|
|
|
fnt_cmap_char_next( FNT_CMap cmap,
|
|
|
|
FT_UInt32 *pchar_code )
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
|
|
|
FT_UInt gindex = 0;
|
|
|
|
FT_UInt32 result = 0;
|
2002-03-22 16:55:55 +01:00
|
|
|
FT_UInt32 char_code = *pchar_code + 1;
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
if ( char_code <= cmap->first )
|
|
|
|
{
|
|
|
|
result = cmap->first;
|
|
|
|
gindex = 1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
char_code -= cmap->first;
|
|
|
|
if ( char_code < cmap->count )
|
|
|
|
{
|
|
|
|
result = cmap->first + char_code;
|
|
|
|
gindex = char_code + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-03-22 16:55:55 +01:00
|
|
|
*pchar_code = result;
|
|
|
|
return gindex;
|
2002-03-01 03:26:22 +01:00
|
|
|
}
|
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
|
* src/autohint/ahglobal.c (blue_chars), src/winfonts/winfnt.c
(fnt_cmap_class_rec, fnt_cmap_class), src/bdf/bdflib.c (empty,
_num_bdf_properties), src/gzip/infutil.c (inflate_mask),
src/gzip/inffixed.h (fixed_bl, fixed_bd, fixed_tl, fixed_td),
src/gzip/inftrees.h (inflate_trees_fixed), srf/gzip/inftrees.c
(inflate_trees_fixed): Decorate with more `const' to avoid
writable global variables which are disallowed on ARM.
2003-10-16 00:20:56 +02:00
|
|
|
static const FT_CMap_ClassRec fnt_cmap_class_rec =
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
2002-04-02 16:50:31 +02:00
|
|
|
sizeof ( FNT_CMapRec ),
|
|
|
|
|
|
|
|
(FT_CMap_InitFunc) fnt_cmap_init,
|
|
|
|
(FT_CMap_DoneFunc) NULL,
|
|
|
|
(FT_CMap_CharIndexFunc)fnt_cmap_char_index,
|
|
|
|
(FT_CMap_CharNextFunc) fnt_cmap_char_next
|
2002-03-01 03:26:22 +01:00
|
|
|
};
|
|
|
|
|
2003-10-21 08:53:19 +02:00
|
|
|
static FT_CMap_Class const fnt_cmap_class = &fnt_cmap_class_rec;
|
2002-04-02 16:50:31 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static void
|
|
|
|
FNT_Face_Done( FNT_Face face )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_Memory memory = FT_FACE_MEMORY( face );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
fnt_font_done( face );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( face->root.available_sizes );
|
2000-07-07 21:46:01 +02:00
|
|
|
face->root.num_fixed_sizes = 0;
|
|
|
|
}
|
|
|
|
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static FT_Error
|
|
|
|
FNT_Face_Init( FT_Stream stream,
|
|
|
|
FNT_Face face,
|
|
|
|
FT_Int face_index,
|
|
|
|
FT_Int num_params,
|
|
|
|
FT_Parameter* params )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_Memory memory = FT_FACE_MEMORY( face );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_UNUSED( num_params );
|
|
|
|
FT_UNUSED( params );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
/* try to load font from a DLL */
|
|
|
|
error = fnt_face_get_dll_font( face, face_index );
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( error )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
/* this didn't work; try to load a single FNT font */
|
2002-03-14 10:01:32 +01:00
|
|
|
FNT_Font font;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( FT_NEW( face->font ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
face->root.num_faces = 1;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
font = face->font;
|
2000-07-07 21:46:01 +02:00
|
|
|
font->offset = 0;
|
|
|
|
font->fnt_size = stream->size;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
error = fnt_font_load( font, stream );
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( error )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
/* we now need to fill the root FT_Face fields */
|
|
|
|
/* with relevant information */
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
FT_Face root = FT_FACE( face );
|
|
|
|
FNT_Font font = face->font;
|
2000-07-09 00:52:21 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
root->face_flags = FT_FACE_FLAG_FIXED_SIZES |
|
|
|
|
FT_FACE_FLAG_HORIZONTAL;
|
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( font->header.avg_width == font->header.max_width )
|
2000-07-07 21:46:01 +02:00
|
|
|
root->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( font->header.italic )
|
2000-07-07 21:46:01 +02:00
|
|
|
root->style_flags |= FT_STYLE_FLAG_ITALIC;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( font->header.weight >= 800 )
|
2000-07-07 21:46:01 +02:00
|
|
|
root->style_flags |= FT_STYLE_FLAG_BOLD;
|
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
/* set up the `fixed_sizes' array */
|
|
|
|
if ( FT_NEW_ARRAY( root->available_sizes, 1 ) )
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Fail;
|
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
root->num_fixed_sizes = 1;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
FT_Bitmap_Size* bsize = root->available_sizes;
|
|
|
|
|
|
|
|
|
|
|
|
bsize->width = font->header.avg_width;
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
bsize->height = (FT_Short)(
|
|
|
|
font->header.pixel_height + font->header.external_leading );
|
2003-07-01 09:28:55 +02:00
|
|
|
bsize->size = font->header.nominal_point_size << 6;
|
* include/freetype/internal/ftserv.h,
include/freetype/internal/service/svpfr.h,
include/freetype/internal/pfr.h,
src/base/ftpfr.c:
migrating the functions of "ftpfr.h" to the new
service-base internal API
* src/cff/cffobjs.c, src/cid/cidobjs.c, src/pfr/pfrsbit.c,
src/psaux/psobjs.c, src/sfnt/sfdriver.c, src/sfnt/sfobjs.c,
src/truetype/ttobjs.c, src/type1/t1driver.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c:
removing various compiler warnings
2003-09-21 18:04:05 +02:00
|
|
|
bsize->x_ppem =
|
2003-07-01 09:28:55 +02:00
|
|
|
(FT_Pos)( ( font->header.horizontal_resolution * bsize->size + 36 )
|
|
|
|
/ 72 );
|
|
|
|
bsize->y_ppem =
|
|
|
|
(FT_Pos)( ( font->header.vertical_resolution* bsize->size + 36 )
|
|
|
|
/ 72 );
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
{
|
|
|
|
FT_CharMapRec charmap;
|
|
|
|
|
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.
* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.
Synchronize computation of height and width for bitmap strikes. The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes. The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.
* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.
* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
|
|
|
|
2003-12-23 00:01:20 +01:00
|
|
|
charmap.encoding = FT_ENCODING_NONE;
|
|
|
|
charmap.platform_id = 0;
|
|
|
|
charmap.encoding_id = 0;
|
2002-03-01 03:26:22 +01:00
|
|
|
charmap.face = root;
|
|
|
|
|
2003-12-23 00:01:20 +01:00
|
|
|
if ( font->header.charset == FT_WinFNT_ID_MAC )
|
|
|
|
{
|
|
|
|
charmap.encoding = FT_ENCODING_APPLE_ROMAN;
|
|
|
|
charmap.platform_id = 1;
|
|
|
|
/* charmap.encoding_id = 0; */
|
|
|
|
}
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
error = FT_CMap_New( fnt_cmap_class,
|
|
|
|
NULL,
|
|
|
|
&charmap,
|
|
|
|
NULL );
|
2002-06-19 17:57:55 +02:00
|
|
|
if ( error )
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
/* Select default charmap */
|
|
|
|
if ( root->num_charmaps )
|
|
|
|
root->charmap = root->charmaps[0];
|
2002-03-01 03:26:22 +01:00
|
|
|
}
|
|
|
|
|
2000-07-09 21:15:30 +02:00
|
|
|
/* setup remaining flags */
|
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
/* reserve one slot for the .notdef glyph at index 0 */
|
|
|
|
root->num_glyphs = font->header.last_char -
|
|
|
|
font->header.first_char + 1 + 1;
|
|
|
|
|
|
|
|
root->family_name = (FT_String*)font->fnt_frame +
|
|
|
|
font->header.face_name_offset;
|
2000-08-01 00:51:00 +02:00
|
|
|
root->style_name = (char *)"Regular";
|
2000-07-09 00:52:21 +02:00
|
|
|
|
|
|
|
if ( root->style_flags & FT_STYLE_FLAG_BOLD )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
2000-08-01 00:51:00 +02:00
|
|
|
root->style_name = (char *)"Bold Italic";
|
2000-07-07 21:46:01 +02:00
|
|
|
else
|
2000-08-01 00:51:00 +02:00
|
|
|
root->style_name = (char *)"Bold";
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
2000-07-09 00:52:21 +02:00
|
|
|
else if ( root->style_flags & FT_STYLE_FLAG_ITALIC )
|
2000-08-01 00:51:00 +02:00
|
|
|
root->style_name = (char *)"Italic";
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
Fail:
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( error )
|
2001-04-25 20:11:16 +02:00
|
|
|
FNT_Face_Done( face );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
2000-07-09 21:15:30 +02:00
|
|
|
}
|
2000-07-07 21:46:01 +02:00
|
|
|
|
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static FT_Error
|
2003-07-01 09:28:55 +02:00
|
|
|
FNT_Size_Set_Pixels( FT_Size size )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
|
|
|
|
FT_Face root = FT_FACE( face );
|
2000-07-09 00:52:21 +02:00
|
|
|
|
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.
* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.
Synchronize computation of height and width for bitmap strikes. The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes. The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.
* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.
* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( size->metrics.y_ppem == root->available_sizes->height )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
FNT_Font font = face->font;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
size->metrics.ascender = font->header.ascent * 64;
|
|
|
|
size->metrics.descender = ( font->header.pixel_height -
|
|
|
|
font->header.ascent ) * 64;
|
|
|
|
size->metrics.height = font->header.pixel_height * 64;
|
|
|
|
size->metrics.max_advance = font->header.max_width * 64;
|
* src/winfonts/winfnt.c (FNT_Load_Glyph): Use first_char in
computation of glyph_index.
(FNT_Size_Set_Pixels): To find a strike, first check pixel_height
only, then try to find a better hit by comparing pixel_width also.
Without this fix it isn't possible to access all strikes.
Also compute metrics.max_advance to be in sync with other bitmap
drivers.
* src/base/ftobjs.c (FT_Set_Char_Size): Remove redundant code.
(FT_Set_Pixel_Size): Assign value to `metrics' after validation of
arguments.
Synchronize computation of height and width for bitmap strikes. The
`width' field in the FT_Bitmap_Size structure is now only useful to
enumerate different strikes. The `max_advance' field of the
FT_Size_Metrics structure should be used to get the (maximum) width
of a strike.
* src/bdf/bdfdrivr.c (BDF_Face_Init): Don't use AVERAGE_WIDTH for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/pcf/pcfread.c (pcf_load_font): Don't use RESOLUTION_X for
computing `available_sizes->width' but make it always equal to
`available_sizes->height'.
* src/truetype/ttdriver.c (Set_Pixel_Sizes): Pass only single
argument to function.
* src/psnames/psmodule.c (ps_unicode_value): Handle `.' after
`uniXXXX' and `uXXXX[X[X]]'.
* src/bdf/bdfdrivr.c: s/FT_Err_/BDF_Err/.
* src/cache/ftccache.c, src/cache/ftcsbits.c, src/cache/ftlru.c:
s/FT_Err_/FTC_Err_/.
* src/cff/cffcmap.c: s/FT_Err_/CFF_Err_/.
* src/pcf/pcfdrivr.c: s/FT_Err_/PCF_Err_/.
* src/psaux/t1cmap.c: Include psauxerr.h.
s/FT_Err_/PSaux_Err_/.
* src/pshinter/pshnterr.h: New file.
* src/pshinter/rules.mk: Updated.
* src/pshinter/pshalgo.c, src/pshinter/pshrec.c: Include pshnterr.h.
s/FT_Err_/PSH_Err_/.
* src/pfr/pfrdrivr.c, src/pfr/pfrobjs.c, src/pfr/pfrsbit.c:
s/FT_Err_/PFR_Err_/.
* src/sfnt/sfdriver.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttload.c: s/FT_Err_/SFNT_Err_/.
* src/truetype/ttgload.c: s/FT_Err_/TT_Err_/.
* src/gzip/ftgzip.c: Load FT_MODULE_ERRORS_H and define
FT_ERR_PREFIX and FT_ERR_BASE.
s/FT_Err_/Gzip_Err_/.
2003-06-22 17:33:53 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
return FNT_Err_Ok;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return FNT_Err_Invalid_Pixel_Size;
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-04-25 20:11:16 +02:00
|
|
|
static FT_Error
|
|
|
|
FNT_Load_Glyph( FT_GlyphSlot slot,
|
2003-07-01 09:28:55 +02:00
|
|
|
FT_Size size,
|
2001-04-25 20:11:16 +02:00
|
|
|
FT_UInt glyph_index,
|
* src/sfnt/ttpost.c (load_post_names, tt_face_free_ps_names,
tt_face_get_ps_name): Replace switch statement with if clauses to
make it more portable.
* src/cff/cffobjs.c (cff_face_init): Ditto.
* include/freetype/ftmodule.h (FT_Module_Class): Use `FT_Long' for
`module_size'.
* include/freetype/ftrender.h (FT_Glyph_Class_): Use `FT_Long' for
`glyph_size'.
* src/base/ftobjs.c (FT_Render_Glyph): Change second parameter to
`FT_Render_Mode'.
(FT_Render_Glyph_Internal): Change third parameter to
`FT_Render_Mode'.
* src/base/ftglyph.c (FT_Glyph_To_Bitmap): Change second parameter
to `FT_Render_Mode'.
* src/raster/ftrend1.c (ft_raster1_render): Change third parameter
to `FT_Render_Mode'.
* src/smooth/ftsmooth.c (ft_smooth_render, ft_smooth_render_lcd,
ft_smooth_render_lcd_v): Ditto.
(ft_smooth_render_generic): Change third and fifth parameter to
`FT_Render_Mode'.
* include/freetype/freetype.h, include/freetype/internal/ftobjs.h,
include/freetype/ftglyph.h: Updated.
* src/cff/cffdrivr.c (Load_Glyph), src/pcf/pcfdriver.c
(PCF_Glyph_Load), src/pfr/pfrobjs.c (pfr_slot_load),
src/winfonts/winfnt.c (FNT_Load_Glyph), src/t42/t42objs.c
(T42_GlyphSlot_Load), src/bdf/bdfdrivr.c (BDF_Glyph_Load): Change
fourth parameter to `FT_Int32'.
* src/pfr/pfrobjs.c (pfr_face_init): Add two missing parameters
and declare them as unused.
* src/cid/cidparse.h (CID_Parser): Use FT_Long for `postscript_len'.
* src/psnames/psnames.h (PS_Unicode_Value_Func): Change return
value to FT_UInt32.
* src/psnames/psmodule.c (ps_unicode_value, ps_build_unicode_table):
Updated accordingly.
* src/cff/cffdrivr.c (Get_Kerning): Use FT_Long for `middle'.
(cff_get_glyph_name): Use cast for result of ft_strlen.
* src/cff/cffparse.c (cff_parse_real): User cast for assigning
`exp'.
* src/cff/cffload.c (cff_index_get_pointers): Use FT_ULong for
some local variables.
(cff_charset_load, cff_encoding_load): Use casts to FT_UInt for some
switch statements.
(cff_font_load): Use cast in call to CFF_Load_FD_Select.
* src/cff/cffobjs.c (cff_size_init): Use more casts.
(cff_face_init): Use FT_Int32 for `flags'.
* src/cff/cffgload.c (cff_operator_seac): Use cast for assigning
`adx' and `ady'.
(cff_decoder_parse_charstrings): Use FT_ULong for third parameter.
Use more casts.
* src/cff/cffcmap.c (cff_cmap_unicode_init): Use cast for `count'.
* src/cid/cidload.c (cid_read_subrs): Use FT_ULong for `len'.
* src/cid/cidgload.c (cid_load_glyph): Add missing cast for
`cid_get_offset'.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings) <18>: Use
cast for `num_points'.
(t1_decoder_init): Use cast for assigning `decoder->num_glyphs'.
* src/base/ftdebug.c (ft_debug_init): Use FT_Int.
* include/freetype/internal/ftdriver.h (FT_Slot_LoadFunc): Use
`FT_Int32' for fourth parameter.
* src/base/ftobjs.c (open_face): Use cast for calling
clazz->init_face.
* src/raster/ftraster.c (Set_High_Precision): Use `1' instead of
`1L'.
(Finalize_Profile_Table, Line_Up, ft_black_init): Use casts.
* src/raster/ftrend1.c (ft_raster1_render): Ditto.
* src/sfnt/sfnt_dir_check: Compare `magic' with unsigned long
constant.
* builds/amiga/include/freetype/config/ftmodule.h: Updated.
2002-09-27 13:09:23 +02:00
|
|
|
FT_Int32 load_flags )
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-07-01 09:28:55 +02:00
|
|
|
FNT_Face face = (FNT_Face)FT_SIZE_FACE( size );
|
|
|
|
FNT_Font font = face->font;
|
|
|
|
FT_Error error = FNT_Err_Ok;
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_Int len;
|
|
|
|
FT_Bitmap* bitmap = &slot->bitmap;
|
|
|
|
FT_ULong offset;
|
|
|
|
FT_Bool new_format;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
FT_UNUSED( load_flags );
|
|
|
|
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-07-01 09:28:55 +02:00
|
|
|
if ( !face || !font )
|
2000-07-07 21:46:01 +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
|
|
|
error = FNT_Err_Invalid_Argument;
|
2000-07-07 21:46:01 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2000-07-20 08:57:41 +02:00
|
|
|
if ( glyph_index > 0 )
|
2003-07-01 09:28:55 +02:00
|
|
|
glyph_index--; /* revert to real index */
|
2000-07-19 22:17:37 +02:00
|
|
|
else
|
2003-07-01 09:28:55 +02:00
|
|
|
glyph_index = font->header.default_char; /* the .notdef glyph */
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2001-06-19 10:28:24 +02:00
|
|
|
new_format = FT_BOOL( font->header.version == 0x300 );
|
2000-07-07 21:46:01 +02:00
|
|
|
len = new_format ? 6 : 4;
|
|
|
|
|
2000-07-09 21:15:30 +02:00
|
|
|
/* jump to glyph entry */
|
2003-10-02 23:36:18 +02:00
|
|
|
p = font->fnt_frame + ( new_format ? 148 : 118 ) + len * glyph_index;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
bitmap->width = FT_NEXT_SHORT_LE( p );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
if ( new_format )
|
2002-04-02 16:50:31 +02:00
|
|
|
offset = FT_NEXT_ULONG_LE( p );
|
2000-07-07 21:46:01 +02:00
|
|
|
else
|
2002-04-02 16:50:31 +02:00
|
|
|
offset = FT_NEXT_USHORT_LE( p );
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-10-02 23:36:18 +02:00
|
|
|
if ( offset >= font->header.file_size )
|
|
|
|
{
|
|
|
|
FT_TRACE2(( "invalid FNT offset!\n" ));
|
|
|
|
error = FNT_Err_Invalid_File_Format;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
/* jump to glyph data */
|
2000-07-07 21:46:01 +02:00
|
|
|
p = font->fnt_frame + /* font->header.bits_offset */ + offset;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
/* allocate and build bitmap */
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
2003-06-02 09:24:33 +02:00
|
|
|
FT_Memory memory = FT_FACE_MEMORY( slot->face );
|
|
|
|
FT_Int pitch = ( bitmap->width + 7 ) >> 3;
|
|
|
|
FT_Byte* column;
|
|
|
|
FT_Byte* write;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
|
|
|
bitmap->pitch = pitch;
|
|
|
|
bitmap->rows = font->header.pixel_height;
|
* 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
|
|
|
bitmap->pixel_mode = FT_PIXEL_MODE_MONO;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-06-02 09:24:33 +02:00
|
|
|
/* note: since glyphs are stored in columns and not in rows we */
|
|
|
|
/* can't use ft_glyphslot_set_bitmap */
|
|
|
|
if ( FT_ALLOC( bitmap->buffer, pitch * bitmap->rows ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
column = (FT_Byte*)bitmap->buffer;
|
|
|
|
|
|
|
|
for ( ; pitch > 0; pitch--, column++ )
|
|
|
|
{
|
|
|
|
FT_Byte* limit = p + bitmap->rows;
|
|
|
|
|
|
|
|
|
|
|
|
for ( write = column; p < limit; p++, write += bitmap->pitch )
|
|
|
|
*write = *p;
|
|
|
|
}
|
2000-07-07 21:46:01 +02:00
|
|
|
}
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2003-06-18 08:59:57 +02:00
|
|
|
slot->internal->flags = FT_GLYPH_OWN_BITMAP;
|
|
|
|
slot->bitmap_left = 0;
|
|
|
|
slot->bitmap_top = font->header.ascent;
|
|
|
|
slot->format = FT_GLYPH_FORMAT_BITMAP;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
/* now set up metrics */
|
|
|
|
slot->metrics.horiAdvance = bitmap->width << 6;
|
|
|
|
slot->metrics.horiBearingX = 0;
|
|
|
|
slot->metrics.horiBearingY = slot->bitmap_top << 6;
|
|
|
|
|
|
|
|
slot->linearHoriAdvance = (FT_Fixed)bitmap->width << 16;
|
* 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
|
|
|
slot->format = FT_GLYPH_FORMAT_BITMAP;
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
2000-07-09 21:15:30 +02:00
|
|
|
}
|
2000-07-07 21:46:01 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
2003-09-21 19:15:55 +02:00
|
|
|
static FT_Error
|
|
|
|
winfnt_get_header( FT_Face face,
|
|
|
|
FT_WinFNT_HeaderRec *aheader )
|
|
|
|
{
|
|
|
|
FNT_Font font = ((FNT_Face)face)->font;
|
|
|
|
|
2003-09-22 11:53:56 +02:00
|
|
|
|
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
2003-09-21 19:15:55 +02:00
|
|
|
*aheader = font->header;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-09-22 11:53:56 +02:00
|
|
|
|
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
2003-09-21 19:15:55 +02:00
|
|
|
static const FT_Service_WinFntRec winfnt_service_rec =
|
|
|
|
{
|
|
|
|
winfnt_get_header
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* SERVICE LIST
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
static const FT_ServiceDescRec winfnt_services[] =
|
|
|
|
{
|
2003-10-23 06:54:14 +02:00
|
|
|
{ FT_SERVICE_ID_XF86_NAME, FT_XF86_FORMAT_WINFNT },
|
|
|
|
{ FT_SERVICE_ID_WINFNT, &winfnt_service_rec },
|
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
2003-09-21 19:15:55 +02:00
|
|
|
{ NULL, NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static FT_Module_Interface
|
|
|
|
winfnt_get_service( FT_Driver driver,
|
|
|
|
const FT_String* service_id )
|
|
|
|
{
|
|
|
|
FT_UNUSED( driver );
|
|
|
|
|
|
|
|
return ft_service_list_lookup( winfnt_services, service_id );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2000-11-04 02:55:49 +01:00
|
|
|
FT_CALLBACK_TABLE_DEF
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
src/base/ftapi.c, src/base/ftobjs.c,
src/cff/cffdrivr.c, src/cff/cffdrivr.h,
src/cid/cidriver.c, src/cid/cidriver.h,
src/pcf/pcfdriver.c, src/pcf/pcfdriver.h,
src/truetype/ttdriver.c, src/truetype/ttdriver.h,
src/type1/t1driver.c, src/type1/t1driver.h,
src/winfonts/winfnt.c, src/winfonts/winfnt.h:
updating the type definitions for font font drivers
2002-03-14 10:22:48 +01:00
|
|
|
const FT_Driver_ClassRec winfnt_driver_class =
|
2000-07-07 21:46:01 +02:00
|
|
|
{
|
|
|
|
{
|
* include/freetype/ftglyph.h (ft_glyph_bbox_unscaled,
ft_glyph_bbox_subpixels, ft_glyph_bbox_gridfit,
ft_glyph_bbox_truncate, ft_glyph_bbox_pixels): Replaced with
FT_GLYPH_BBOX_UNSCALED, FT_GLYPH_BBOX_SUBPIXELS,
FT_GLYPH_BBIX_GRIDFIT, FT_GLYPH_BBOX_TRUNCATE, FT_GLYPH_BBOX_PIXELS.
The lowercase variants are now (deprecated aliases) to the uppercase
versions.
Updated all other files.
* include/freetype/ftmodule.h (ft_module_font_driver,
ft_module_renderer, ft_module_hinter, ft_module_styler,
ft_module_driver_scalable, ft_module_driver_no_outlines,
ft_module_driver_has_hinter): Replaced with FT_MODULE_FONT_DRIVER,
FT_MODULE_RENDERER, FT_MODULE_HINTER, FT_MODULE_STYLER,
FT_MODULE_DRIVER_SCALABLE, FT_MODULE_DRIVER_NO_OUTLINES,
FT_MODULE_DRIVER_HAS_HINTER.
The lowercase variants are now (deprecated aliases) to the uppercase
versions.
Updated all other files.
* src/base/ftglyph.c (FT_Glyph_Get_CBox): Handle bbox_mode better
as enumeration.
* src/pcf/pcfdrivr.c (pcf_driver_class), src/winfonts/winfnt.c
(winfnt_driver_class), src/bdf/bdfdrivr.c (bdf_driver_class): Add
the FT_MODULE_DRIVER_NO_OUTLINES flag.
2003-06-17 12:42:27 +02:00
|
|
|
FT_MODULE_FONT_DRIVER |
|
|
|
|
FT_MODULE_DRIVER_NO_OUTLINES,
|
2000-07-09 00:52:21 +02:00
|
|
|
sizeof ( FT_DriverRec ),
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
"winfonts",
|
2000-07-09 00:52:21 +02:00
|
|
|
0x10000L,
|
|
|
|
0x20000L,
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
0,
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
(FT_Module_Constructor)0,
|
|
|
|
(FT_Module_Destructor) 0,
|
* include/freetype/internal/fnttypes.h,
include/freetype/internal/ftserv.h, src/base/ftbdf.c, src/base/ftmm.c,
src/base/ftobjs.c, src/base/ftpfr.c, src/base/ftwinfnt.c,
src/base/ftxf86.c, src/pfr/pfrdrivr.c, src/winfonts/winfnt.c,
src/winfonts/winfnt.h, include/freetype/internal/service/svwinfnt.h,:
simplification of service lookup macros, updating the PFR and
WINFNT font drivers to new services
2003-09-21 19:15:55 +02:00
|
|
|
(FT_Module_Requester) winfnt_get_service
|
2000-07-07 21:46:01 +02:00
|
|
|
},
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2000-07-07 21:46:01 +02:00
|
|
|
sizeof( FNT_FaceRec ),
|
2003-07-01 09:28:55 +02:00
|
|
|
sizeof( FT_SizeRec ),
|
2000-07-07 21:46:01 +02:00
|
|
|
sizeof( FT_GlyphSlotRec ),
|
2000-07-09 21:15:30 +02:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
(FT_Face_InitFunc) FNT_Face_Init,
|
|
|
|
(FT_Face_DoneFunc) FNT_Face_Done,
|
|
|
|
(FT_Size_InitFunc) 0,
|
|
|
|
(FT_Size_DoneFunc) 0,
|
|
|
|
(FT_Slot_InitFunc) 0,
|
|
|
|
(FT_Slot_DoneFunc) 0,
|
2000-07-07 21:46:01 +02:00
|
|
|
|
* include/freetype/internal/ftdriver.h,
include/freetype/internal/ftobjs.h,
src/base/ftapi.c, src/base/ftobjs.c,
src/cff/cffdrivr.c, src/cff/cffdrivr.h,
src/cid/cidriver.c, src/cid/cidriver.h,
src/pcf/pcfdriver.c, src/pcf/pcfdriver.h,
src/truetype/ttdriver.c, src/truetype/ttdriver.h,
src/type1/t1driver.c, src/type1/t1driver.h,
src/winfonts/winfnt.c, src/winfonts/winfnt.h:
updating the type definitions for font font drivers
2002-03-14 10:22:48 +01:00
|
|
|
(FT_Size_ResetPointsFunc) FNT_Size_Set_Pixels,
|
2002-04-02 16:50:31 +02:00
|
|
|
(FT_Size_ResetPixelsFunc) FNT_Size_Set_Pixels,
|
|
|
|
(FT_Slot_LoadFunc) FNT_Load_Glyph,
|
2002-03-22 18:09:52 +01:00
|
|
|
|
2002-04-02 16:50:31 +02:00
|
|
|
(FT_Face_GetKerningFunc) 0,
|
|
|
|
(FT_Face_AttachFunc) 0,
|
* include/freetype/config/ftoption.h, include/freetype/internal/tttypes.h,
src/base/ftobjs.c, src/bdf/bdfdrivr.c, src/cff/cffobjs.c,
src/pcf/pcfdrivr.c, src/sfnt/sfobjs.c, src/sfnt/ttcmap0.c,
src/sfnt/ttcmap0.h, src/sfnt/ttload.c, src/type1/t1objs.c,
src/type42/t42objs.c, src/winfonts/winfnt.c: code cleanup,
FT_CONFIG_OPTION_USE_CMAPS is now the default
2002-07-17 23:52:20 +02:00
|
|
|
(FT_Face_GetAdvancesFunc) 0
|
2000-07-07 21:46:01 +02:00
|
|
|
};
|
|
|
|
|
2000-07-09 00:52:21 +02:00
|
|
|
|
|
|
|
/* END */
|