freetype/src/cache/ftcglyph.c

116 lines
3.8 KiB
C
Raw Normal View History

/***************************************************************************/
/* */
/* ftcglyph.c */
/* */
2000-10-12 07:05:40 +02:00
/* FreeType Glyph Image (FT_Glyph) cache (body). */
/* */
/* Copyright 2000-2001 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_INTERNAL_GLYPH_H
#include FT_ERRORS_H
#include FT_LIST_H
#include FT_INTERNAL_OBJECTS_H
#include FT_INTERNAL_DEBUG_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 "ftcerror.h"
2000-10-12 07:05:40 +02:00
/* create a new chunk node, setting its cache index and ref count */
FT_EXPORT_DEF( void )
ftc_glyph_node_init( FTC_GlyphNode gnode,
FT_UInt gindex,
FTC_GlyphFamily gfam )
{
FT_UInt len;
FT_UInt start = FTC_GLYPH_FAMILY_START( gfam, gindex );
2000-10-12 07:05:40 +02:00
gnode->item_start = (FT_UShort)start;
len = gfam->item_total - start;
if ( len > gfam->item_count )
len = gfam->item_count;
gnode->item_count = (FT_UShort)len;
gfam->family.num_nodes++;
}
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( void )
ftc_glyph_node_done( FTC_GlyphNode gnode,
FTC_Cache cache )
{
/* finalize the node */
gnode->item_count = 0;
gnode->item_start = 0;
ftc_node_done( FTC_NODE( gnode ), cache );
}
FT_EXPORT_DEF( FT_Bool )
ftc_glyph_node_compare( FTC_GlyphNode gnode,
FTC_GlyphQuery gquery )
{
FT_UInt start = (FT_UInt)gnode->item_start;
FT_UInt count = (FT_UInt)gnode->item_count;
return FT_BOOL( (FT_UInt)( gquery->gindex - start ) < count );
}
2000-10-12 07:05:40 +02:00
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CHUNK SETS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
2000-10-12 07:05:40 +02:00
FT_EXPORT_DEF( FT_Error )
ftc_glyph_family_init( FTC_GlyphFamily gfam,
FT_UInt32 hash,
FT_UInt item_count,
FT_UInt item_total,
FTC_GlyphQuery gquery,
FTC_Cache cache )
{
FT_Error error;
error = ftc_family_init( FTC_FAMILY( gfam ), FTC_QUERY( gquery ), cache );
if ( !error )
{
gfam->hash = hash;
gfam->item_total = item_total;
gfam->item_count = item_count;
FTC_GLYPH_FAMILY_FOUND( gfam, gquery );
}
return error;
}
FT_EXPORT_DEF( void )
ftc_glyph_family_done( FTC_GlyphFamily gfam )
{
ftc_family_done( FTC_FAMILY( gfam ) );
}
2000-11-10 23:43:37 +01:00
/* END */