2000-10-31 23:13:54 +01:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* ftcsbits.c */
|
|
|
|
/* */
|
|
|
|
/* FreeType sbits manager (body). */
|
|
|
|
/* */
|
|
|
|
/* Copyright 2000 by */
|
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
|
|
|
|
/* */
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
|
|
|
|
/* this file you indicate that you have read the license and */
|
|
|
|
/* understand and accept it fully. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2000-12-08 17:17:16 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_CACHE_H
|
|
|
|
#include FT_CACHE_SMALL_BITMAPS_H
|
|
|
|
#include FT_INTERNAL_OBJECTS_H
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
|
|
|
#include FT_ERRORS_H
|
2000-10-29 01:34:45 +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
|
|
|
#include "ftcerror.h"
|
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
#include <string.h> /* memcmp() */
|
|
|
|
|
|
|
|
|
2000-12-14 00:44:37 +01:00
|
|
|
#define FTC_SBITSET_ELEMENT_COUNT 16
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
typedef struct FTC_SBitSetRec_
|
2000-10-29 01:34:45 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
FTC_ChunkSetRec root;
|
|
|
|
FTC_Image_Desc desc;
|
2000-10-29 01:34:45 +02:00
|
|
|
|
|
|
|
} FTC_SBitSetRec, *FTC_SBitSet;
|
|
|
|
|
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
typedef struct FTC_SBit_CacheRec_
|
2000-10-29 01:34:45 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
FTC_Chunk_CacheRec root;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
} FTC_SBit_CacheRec;
|
|
|
|
|
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
2000-10-29 01:34:45 +02:00
|
|
|
/***** SBIT CACHE NODES *****/
|
2000-10-28 15:17:11 +02:00
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( void )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_sbit_chunk_node_destroy( FTC_ChunkNode node )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
FTC_ChunkSet cset = node->cset;
|
|
|
|
FT_Memory memory = cset->memory;
|
|
|
|
FT_UInt count = node->num_elements;
|
|
|
|
FTC_SBit sbit = (FTC_SBit)node->elements;
|
|
|
|
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
for ( ; count > 0; sbit++, count-- )
|
|
|
|
FREE( sbit->buffer );
|
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
FREE( node->elements );
|
2000-10-28 15:17:11 +02:00
|
|
|
FREE( node );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_bitmap_copy( FT_Memory memory,
|
|
|
|
FT_Bitmap* source,
|
|
|
|
FTC_SBit target )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
FT_Int pitch = source->pitch;
|
|
|
|
FT_ULong size;
|
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
if ( pitch < 0 )
|
|
|
|
pitch = -pitch;
|
|
|
|
|
|
|
|
size = (FT_ULong)( pitch * source->rows );
|
|
|
|
|
|
|
|
if ( !ALLOC( target->buffer, size ) )
|
|
|
|
MEM_Copy( target->buffer, source->buffer, size );
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_sbit_chunk_node_new( FTC_ChunkSet cset,
|
|
|
|
FT_UInt index,
|
|
|
|
FTC_ChunkNode *anode )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
FT_Error error;
|
|
|
|
FT_Memory memory = cset->memory;
|
|
|
|
FTC_SBitSet sbitset = (FTC_SBitSet)cset;
|
|
|
|
FTC_ChunkNode node = 0;
|
|
|
|
FT_Face face;
|
|
|
|
FT_Size size;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* allocate node */
|
|
|
|
if ( ALLOC( node, sizeof ( *node ) ) )
|
|
|
|
goto Exit;
|
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* initialize its inner fields */
|
2000-10-29 01:34:45 +02:00
|
|
|
error = FTC_ChunkNode_Init( node, cset, index, 1 );
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( error )
|
2000-10-28 15:17:11 +02:00
|
|
|
goto Exit;
|
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/* we will now load all glyph images for this chunk */
|
2000-10-28 15:17:11 +02:00
|
|
|
error = FTC_Manager_Lookup_Size( cset->manager,
|
2000-10-29 01:34:45 +02:00
|
|
|
&sbitset->desc.font,
|
2000-10-28 15:17:11 +02:00
|
|
|
&face, &size );
|
|
|
|
if ( !error )
|
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
FT_UInt glyph_index = index * cset->element_count;
|
|
|
|
FT_UInt load_flags = FT_LOAD_DEFAULT;
|
|
|
|
FT_UInt image_type = sbitset->desc.image_type;
|
|
|
|
FT_UInt count = node->num_elements;
|
|
|
|
FTC_SBit sbit = (FTC_SBit)node->elements;
|
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/* determine load flags, depending on the font description's */
|
2000-10-31 23:13:54 +01:00
|
|
|
/* image type */
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( FTC_IMAGE_FORMAT( image_type ) == ftc_image_format_bitmap )
|
|
|
|
{
|
|
|
|
if ( image_type & ftc_image_flag_monochrome )
|
|
|
|
load_flags |= FT_LOAD_MONOCHROME;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* disable embedded bitmaps loading if necessary */
|
|
|
|
if ( image_type & ftc_image_flag_no_sbits )
|
|
|
|
load_flags |= FT_LOAD_NO_BITMAP;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FT_ERROR(( "FTC_SBit_Cache: cannot load scalable glyphs in an"
|
|
|
|
" sbit cache, please check your arguments!\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 = FTC_Err_Invalid_Argument;
|
2000-10-31 23:13:54 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* always render glyphs to bitmaps */
|
|
|
|
load_flags |= FT_LOAD_RENDER;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( image_type & ftc_image_flag_unhinted )
|
|
|
|
load_flags |= FT_LOAD_NO_HINTING;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( image_type & ftc_image_flag_autohinted )
|
|
|
|
load_flags |= FT_LOAD_FORCE_AUTOHINT;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
/* load a chunk of small bitmaps in a row */
|
2000-10-29 01:34:45 +02:00
|
|
|
for ( ; count > 0; count--, glyph_index++, sbit++ )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
/* by default, indicates a `missing' glyph */
|
2000-10-29 01:34:45 +02:00
|
|
|
sbit->buffer = 0;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
error = FT_Load_Glyph( face, glyph_index, load_flags );
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( !error )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
|
|
|
FT_Int temp;
|
|
|
|
FT_GlyphSlot slot = face->glyph;
|
|
|
|
FT_Bitmap* bitmap = &slot->bitmap;
|
2000-10-29 01:34:45 +02:00
|
|
|
FT_Int xadvance, yadvance;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* check that our values fit into 8-bit containers! */
|
|
|
|
/* If this is not the case, our bitmap is too large */
|
|
|
|
/* and we will leave it as `missing' with sbit.buffer = 0 */
|
|
|
|
|
|
|
|
#define CHECK_CHAR( d ) ( temp = (FT_Char)d, temp == d )
|
|
|
|
#define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d )
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* XXX: FIXME: add support for vertical layouts maybe */
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* horizontal advance in pixels */
|
|
|
|
xadvance = ( slot->metrics.horiAdvance + 32 ) >> 6;
|
|
|
|
yadvance = ( slot->metrics.vertAdvance + 32 ) >> 6;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( CHECK_BYTE( bitmap->rows ) &&
|
|
|
|
CHECK_BYTE( bitmap->width ) &&
|
|
|
|
CHECK_CHAR( bitmap->pitch ) &&
|
|
|
|
CHECK_CHAR( slot->bitmap_left ) &&
|
|
|
|
CHECK_CHAR( slot->bitmap_top ) &&
|
|
|
|
CHECK_CHAR( xadvance ) &&
|
|
|
|
CHECK_CHAR( yadvance ) )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
sbit->width = (FT_Byte)bitmap->width;
|
|
|
|
sbit->height = (FT_Byte)bitmap->rows;
|
|
|
|
sbit->pitch = (FT_Char)bitmap->pitch;
|
|
|
|
sbit->left = (FT_Char)slot->bitmap_left;
|
|
|
|
sbit->top = (FT_Char)slot->bitmap_top;
|
|
|
|
sbit->xadvance = (FT_Char)xadvance;
|
|
|
|
sbit->yadvance = (FT_Char)yadvance;
|
|
|
|
sbit->format = (FT_Byte)bitmap->pixel_mode;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
|
|
|
/* grab the bitmap when possible */
|
|
|
|
if ( slot->flags & ft_glyph_own_bitmap )
|
|
|
|
{
|
|
|
|
slot->flags &= ~ft_glyph_own_bitmap;
|
|
|
|
sbit->buffer = bitmap->buffer;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
/* copy the bitmap into a new buffer -- ignore error */
|
2000-10-28 15:17:11 +02:00
|
|
|
ftc_bitmap_copy( memory, bitmap, sbit );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* ignore the errors that might have occurred -- */
|
|
|
|
/* we recognize unloaded glyphs with `sbit.buffer == 0' */
|
2000-10-28 15:17:11 +02:00
|
|
|
error = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
if ( error && node )
|
|
|
|
{
|
|
|
|
FREE( node->elements );
|
|
|
|
FREE( node );
|
|
|
|
}
|
|
|
|
|
|
|
|
*anode = node;
|
2000-10-31 23:13:54 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* this function is important because it is both part of */
|
2000-10-31 23:13:54 +01:00
|
|
|
/* an FTC_ChunkSet_Class and an FTC_CacheNode_Class */
|
2000-10-28 15:17:11 +02:00
|
|
|
/* */
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_ULong )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_sbit_chunk_node_size( FTC_ChunkNode node )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-29 01:34:45 +02:00
|
|
|
FT_ULong size;
|
|
|
|
FTC_ChunkSet cset = node->cset;
|
|
|
|
FT_UInt count = node->num_elements;
|
|
|
|
FT_Int pitch;
|
|
|
|
FTC_SBit sbit = (FTC_SBit)node->elements;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
|
|
|
|
/* the node itself */
|
|
|
|
size = sizeof ( *node );
|
2000-11-06 20:29:06 +01:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
/* the sbit records */
|
|
|
|
size += cset->element_count * sizeof ( FTC_SBitRec );
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
for ( ; count > 0; count--, sbit++ )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( sbit->buffer )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-29 01:34:45 +02:00
|
|
|
pitch = sbit->pitch;
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( pitch < 0 )
|
2000-10-29 01:34:45 +02:00
|
|
|
pitch = -pitch;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/* add the size of a given glyph image */
|
|
|
|
size += pitch * sbit->height;
|
2000-10-28 15:17:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return size;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
2000-10-29 01:34:45 +02:00
|
|
|
/***** SBIT CHUNK SETS *****/
|
2000-10-28 15:17:11 +02:00
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_sbit_chunk_set_sizes( FTC_ChunkSet cset,
|
|
|
|
FTC_Image_Desc* desc )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-29 01:34:45 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Face face;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
cset->element_count = FTC_SBITSET_ELEMENT_COUNT;
|
2000-10-31 23:13:54 +01:00
|
|
|
cset->element_size = sizeof ( FTC_SBitRec );
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
/* lookup the FT_Face to obtain the number of glyphs */
|
|
|
|
error = FTC_Manager_Lookup_Face( cset->manager,
|
2000-10-31 11:58:23 +01:00
|
|
|
desc->font.face_id, &face );
|
2000-10-31 23:13:54 +01:00
|
|
|
if ( !error )
|
2000-10-29 01:34:45 +02:00
|
|
|
cset->element_max = face->num_glyphs;
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
return error;
|
|
|
|
}
|
2000-10-31 21:42:18 +01:00
|
|
|
|
2000-10-29 01:34:45 +02:00
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Error )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_sbit_chunk_set_init( FTC_SBitSet sset,
|
|
|
|
FTC_Image_Desc* type )
|
2000-10-29 01:34:45 +02:00
|
|
|
{
|
|
|
|
sset->desc = *type;
|
2000-10-31 23:13:54 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_CALLBACK_DEF( FT_Bool )
|
2001-06-27 11:26:46 +02:00
|
|
|
ftc_sbit_chunk_set_compare( FTC_SBitSet sset,
|
|
|
|
FTC_Image_Desc* type )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2001-06-20 01:03:41 +02:00
|
|
|
return FT_BOOL( !memcmp( &sset->desc, type, sizeof ( *type ) ) );
|
2000-10-28 15:17:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-11-04 02:55:49 +01:00
|
|
|
FT_CALLBACK_TABLE_DEF
|
|
|
|
const FTC_ChunkSet_Class ftc_sbit_chunk_set_class =
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
2000-10-31 11:58:23 +01:00
|
|
|
sizeof( FTC_SBitSetRec ),
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
(FTC_ChunkSet_InitFunc) ftc_sbit_chunk_set_init,
|
|
|
|
(FTC_ChunkSet_DoneFunc) 0,
|
|
|
|
(FTC_ChunkSet_CompareFunc) ftc_sbit_chunk_set_compare,
|
|
|
|
(FTC_ChunkSet_SizesFunc) ftc_sbit_chunk_set_sizes,
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
(FTC_ChunkSet_NewNodeFunc) ftc_sbit_chunk_node_new,
|
|
|
|
(FTC_ChunkSet_SizeNodeFunc) ftc_sbit_chunk_node_size,
|
|
|
|
(FTC_ChunkSet_DestroyNodeFunc)ftc_sbit_chunk_node_destroy
|
2000-10-28 15:17:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
2000-10-29 01:34:45 +02:00
|
|
|
/***** SBITS CACHE *****/
|
2000-10-28 15:17:11 +02:00
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
2000-11-04 02:55:49 +01:00
|
|
|
FT_CALLBACK_TABLE_DEF
|
|
|
|
const FTC_Chunk_Cache_Class ftc_sbit_cache_class =
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
|
|
|
{
|
2000-10-29 01:34:45 +02:00
|
|
|
sizeof( FTC_SBit_CacheRec ),
|
2000-10-31 23:13:54 +01:00
|
|
|
(FTC_Cache_InitFunc)FTC_Chunk_Cache_Init,
|
|
|
|
(FTC_Cache_DoneFunc)FTC_Chunk_Cache_Done
|
2000-10-28 15:17:11 +02:00
|
|
|
},
|
2000-10-31 23:13:54 +01:00
|
|
|
(FTC_ChunkSet_Class*)&ftc_sbit_chunk_set_class
|
2000-10-28 15:17:11 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FTC_SBit_Cache_New( FTC_Manager manager,
|
|
|
|
FTC_SBit_Cache *acache )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
|
|
|
return FTC_Manager_Register_Cache(
|
2000-11-10 23:43:37 +01:00
|
|
|
manager,
|
|
|
|
(FTC_Cache_Class*)&ftc_sbit_cache_class,
|
|
|
|
(FTC_Cache*)acache );
|
2000-10-28 15:17:11 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 18:18:10 +02:00
|
|
|
FT_EXPORT_DEF( FT_Error )
|
|
|
|
FTC_SBit_Cache_Lookup( FTC_SBit_Cache cache,
|
|
|
|
FTC_Image_Desc* desc,
|
|
|
|
FT_UInt gindex,
|
|
|
|
FTC_SBit *ansbit )
|
2000-10-28 15:17:11 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
2000-10-29 01:34:45 +02:00
|
|
|
FTC_ChunkNode node;
|
|
|
|
FT_UInt cindex;
|
2000-10-28 15:17:11 +02:00
|
|
|
|
2000-11-10 23:43:37 +01:00
|
|
|
|
2000-11-06 20:29:06 +01:00
|
|
|
/* argument checks delayed to FTC_Chunk_Cache_Lookup */
|
2000-11-10 23:43:37 +01:00
|
|
|
if ( !ansbit )
|
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 FTC_Err_Invalid_Argument;
|
2000-11-06 20:29:06 +01:00
|
|
|
|
2000-11-07 07:30:29 +01:00
|
|
|
*ansbit = 0;
|
|
|
|
error = FTC_Chunk_Cache_Lookup( &cache->root, desc, gindex,
|
|
|
|
&node, &cindex );
|
2000-11-10 23:43:37 +01:00
|
|
|
if ( !error )
|
2000-11-07 07:30:29 +01:00
|
|
|
*ansbit = (FTC_SBit)node->elements + cindex;
|
2000-11-06 20:29:06 +01:00
|
|
|
|
2000-10-28 15:17:11 +02:00
|
|
|
return error;
|
|
|
|
}
|
2000-11-06 20:29:06 +01:00
|
|
|
|
2000-10-31 23:13:54 +01:00
|
|
|
|
|
|
|
/* END */
|