Bringing apdf from vendor into main branch.
[AROS-Contrib.git] / apdf / freetype2 / cache / ftcglyph.c
blobaa21228a79b9b7ac1387d7aed802600b03aa3988
1 /***************************************************************************/
2 /* */
3 /* ftcglyph.c */
4 /* */
5 /* FreeType Glyph Image (FT_Glyph) cache (body). */
6 /* */
7 /* Copyright 2000-2001 by */
8 /* David Turner, Robert Wilhelm, and Werner Lemberg. */
9 /* */
10 /* This file is part of the FreeType project, and may only be used, */
11 /* modified, and distributed under the terms of the FreeType project */
12 /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
13 /* this file you indicate that you have read the license and */
14 /* understand and accept it fully. */
15 /* */
16 /***************************************************************************/
19 #include <ft2build.h>
20 #include FT_CACHE_H
21 #include FT_CACHE_INTERNAL_GLYPH_H
22 #include FT_ERRORS_H
23 #include FT_LIST_H
24 #include FT_INTERNAL_OBJECTS_H
25 #include FT_INTERNAL_DEBUG_H
27 #include "ftcerror.h"
30 /* create a new chunk node, setting its cache index and ref count */
31 FT_EXPORT_DEF( void )
32 ftc_glyph_node_init( FTC_GlyphNode gnode,
33 FT_UInt gindex,
34 FTC_GlyphFamily gfam )
36 FT_UInt len;
37 FT_UInt start = FTC_GLYPH_FAMILY_START( gfam, gindex );
40 gnode->item_start = (FT_UShort)start;
42 len = gfam->item_total - start;
43 if ( len > gfam->item_count )
44 len = gfam->item_count;
46 gnode->item_count = (FT_UShort)len;
47 gfam->family.num_nodes++;
51 FT_EXPORT_DEF( void )
52 ftc_glyph_node_done( FTC_GlyphNode gnode,
53 FTC_Cache cache )
55 /* finalize the node */
56 gnode->item_count = 0;
57 gnode->item_start = 0;
59 ftc_node_done( FTC_NODE( gnode ), cache );
63 FT_EXPORT_DEF( FT_Bool )
64 ftc_glyph_node_compare( FTC_GlyphNode gnode,
65 FTC_GlyphQuery gquery )
67 FT_UInt start = (FT_UInt)gnode->item_start;
68 FT_UInt count = (FT_UInt)gnode->item_count;
70 return FT_BOOL( (FT_UInt)( gquery->gindex - start ) < count );
74 /*************************************************************************/
75 /*************************************************************************/
76 /***** *****/
77 /***** CHUNK SETS *****/
78 /***** *****/
79 /*************************************************************************/
80 /*************************************************************************/
83 FT_EXPORT_DEF( FT_Error )
84 ftc_glyph_family_init( FTC_GlyphFamily gfam,
85 FT_UInt32 hash,
86 FT_UInt item_count,
87 FT_UInt item_total,
88 FTC_GlyphQuery gquery,
89 FTC_Cache cache )
91 FT_Error error;
94 error = ftc_family_init( FTC_FAMILY( gfam ), FTC_QUERY( gquery ), cache );
95 if ( !error )
97 gfam->hash = hash;
98 gfam->item_total = item_total;
99 gfam->item_count = item_count;
101 FTC_GLYPH_FAMILY_FOUND( gfam, gquery );
104 return error;
108 FT_EXPORT_DEF( void )
109 ftc_glyph_family_done( FTC_GlyphFamily gfam )
111 ftc_family_done( FTC_FAMILY( gfam ) );
115 /* END */