* src/otlayout/*: Removed. Obsolete.

This commit is contained in:
Werner Lemberg 2005-02-04 00:02:31 +00:00
parent cc7cab815c
commit 4c1867bfab
20 changed files with 4 additions and 5118 deletions

View File

@ -1,3 +1,7 @@
2005-02-04 Werner Lemberg <wl@gnu.org>
* src/otlayout/*: Removed. Obsolete.
2004-12-28 Werner Lemberg <wl@gnu.org>
* builds/unix/ltmain.sh: Regenerated with `libtoolize --force

View File

@ -1,236 +0,0 @@
/***************************************************************************/
/* */
/* otlayout.h */
/* */
/* OpenType layout support (specification only). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OT_LAYOUT_H__
#define __OT_LAYOUT_H__
#include "otlconf.h"
OTL_BEGIN_HEADER
/************************************************************************/
/************************************************************************/
/***** *****/
/***** BASE DATA TYPES *****/
/***** *****/
/************************************************************************/
/************************************************************************/
typedef unsigned char OTL_Byte;
typedef const OTL_Byte* OTL_Bytes;
typedef int OTL_Error;
typedef void* OTL_Pointer;
typedef unsigned char OTL_Bool;
typedef signed int OTL_Int;
typedef unsigned int OTL_UInt;
typedef signed long OTL_Long;
typedef unsigned long OTL_ULong;
typedef signed short OTL_Int16;
typedef unsigned short OTL_UInt16;
#if OTL_SIZEOF_INT == 4
typedef signed int OTL_Int32;
typedef unsigned int OTL_UInt32;
#elif OTL_SIZEOF_LONG == 4
typedef signed long OTL_Int32;
typedef unsigned long OTL_UInt32;
#else
# error "no 32-bits type found"
#endif
typedef OTL_UInt32 OTL_Tag;
/************************************************************************/
/************************************************************************/
/***** *****/
/***** ERROR CODES *****/
/***** *****/
/************************************************************************/
/************************************************************************/
enum
{
OTL_Err_Ok = 0,
OTL_Err_InvalidFormat,
OTL_Err_InvalidSize,
OTL_Err_InvalidData,
OTL_Err_InvalidOffset,
OTL_Err_Max
};
/************************************************************************/
/************************************************************************/
/***** *****/
/***** MEMORY MANAGEMENT *****/
/***** *****/
/************************************************************************/
/************************************************************************/
typedef OTL_Pointer (*OTL_AllocFunc)( OTL_ULong size,
OTL_Pointer data );
typedef OTL_Pointer (*OTL_ReallocFunc)( OTL_Pointer block,
OTL_ULong size,
OTL_Pointer data );
typedef void (*OTL_FreeFunc)( OTL_Pointer block,
OTL_Pointer data );
typedef struct OTL_MemoryRec_
{
OTL_Pointer mem_data;
OTL_AllocFunc mem_alloc;
OTL_ReallocFunc mem_realloc;
OTL_FreeFunc mem_free;
} OTL_MemoryRec, *OTL_Memory;
/************************************************************************/
/************************************************************************/
/***** *****/
/***** ENUMERATIONS *****/
/***** *****/
/************************************************************************/
/************************************************************************/
/* re-define OTL_MAKE_TAG to something different if you're not */
/* using an ASCII-based character set (Vaxes anyone ?) */
#ifndef OTL_MAKE_TAG
#define OTL_MAKE_TAG(c1,c2,c3,c4) \
( ( (OTL_UInt32)(c1) << 24 ) | \
( (OTL_UInt32)(c2) << 16 ) | \
( (OTL_UInt32)(c3) << 8 ) | \
( (OTL_UInt32)(c4) ) )
#endif
typedef enum OTL_ScriptTag_
{
OTL_SCRIPT_NONE = 0,
#define OTL_SCRIPT_TAG(c1,c2,c3,c4,s,n) OTL_SCRIPT_TAG_ ## n = OTL_MAKE_TAG(c1,c2,c3,c4),
#include "otltags.h"
OTL_SCRIPT_MAX
} OTL_ScriptTag;
typedef enum OTL_LangTag_
{
OTL_LANG_DEFAULT = 0,
#define OTL_LANG_TAG(c1,c2,c3,c4,s,n) OTL_LANG_TAG_ ## n = OTL_MAKE_TAG(c1,c2,c3,c4),
#include "otltags.h"
OTL_LANG_MAX
} OTL_LangTag;
/************************************************************************/
/************************************************************************/
/***** *****/
/***** MEMORY READS *****/
/***** *****/
/************************************************************************/
/************************************************************************/
#define OTL_PEEK_USHORT(p) ( ((OTL_UInt)((p)[0]) << 8) | \
((OTL_UInt)((p)[1]) ) )
#define OTL_PEEK_ULONG(p) ( ((OTL_UInt32)((p)[0]) << 24) | \
((OTL_UInt32)((p)[1]) << 16) | \
((OTL_UInt32)((p)[2]) << 8) | \
((OTL_UInt32)((p)[3]) ) )
#define OTL_PEEK_SHORT(p) ((OTL_Int16)OTL_PEEK_USHORT(p))
#define OTL_PEEK_LONG(p) ((OTL_Int32)OTL_PEEK_ULONG(p))
#define OTL_NEXT_USHORT(p) ( (p) += 2, OTL_PEEK_USHORT((p)-2) )
#define OTL_NEXT_ULONG(p) ( (p) += 4, OTL_PEEK_ULONG((p)-4) )
#define OTL_NEXT_SHORT(p) ((OTL_Int16)OTL_NEXT_USHORT(p))
#define OTL_NEXT_LONG(p) ((OTL_Int32)OTL_NEXT_ULONG(p))
/************************************************************************/
/************************************************************************/
/***** *****/
/***** VALIDATION *****/
/***** *****/
/************************************************************************/
/************************************************************************/
typedef struct OTL_ValidatorRec_* OTL_Validator;
typedef struct OTL_ValidatorRec_
{
OTL_Bytes limit;
OTL_Bytes base;
OTL_Error error;
OTL_jmp_buf jump_buffer;
} OTL_ValidatorRec;
typedef void (*OTL_ValidateFunc)( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid );
OTL_API( void )
otl_validator_error( OTL_Validator validator,
OTL_Error error );
#define OTL_INVALID(e) otl_validator_error( valid, e )
#define OTL_INVALID_TOO_SHORT OTL_INVALID( OTL_Err_InvalidSize )
#define OTL_INVALID_DATA OTL_INVALID( OTL_Err_InvalidData )
#define OTL_INVALID_FORMAT OTL_INVALID( OTL_Err_InvalidFormat )
#define OTL_CHECK(_count) OTL_BEGIN_STMNT \
if ( p + (_count) > valid->limit ) \
OTL_INVALID_TOO_SHORT; \
OTL_END_STMNT
/* */
OTL_END_HEADER
#endif /* __OT_LAYOUT_H__ */
/* END */

View File

@ -1,231 +0,0 @@
/***************************************************************************/
/* */
/* otlbase.c */
/* */
/* OpenType layout support, BASE table (body). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#include "otlbase.h"
#include "otlcommn.h"
static void
otl_base_coord_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt format;
OTL_CHECK( 4 );
format = OTL_NEXT_USHORT( p );
p += 2; /* skip coordinate */
switch ( format )
{
case 1:
break;
case 2:
OTL_CHECK( 4 );
break;
case 3:
OTL_CHECK( 2 );
otl_device_table_validate( table + OTL_PEEK_USHORT( p ), valid );
break;
default:
OTL_INVALID_DATA;
}
}
static void
otl_base_tag_list_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt count;
OTL_CHECK( 2 );
count = OTL_NEXT_USHORT( p );
OTL_CHECK( count * 4 );
}
static void
otl_base_values_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_coord;
OTL_CHECK( 4 );
p += 2; /* skip default index */
num_coord = OTL_NEXT_USHORT( p );
OTL_CHECK( num_coord * 2 );
/* scan base coordinate records */
for ( ; num_coord > 0; num_coord-- )
otl_base_coord_validate( table + OTL_NEXT_USHORT( p ), valid );
}
static void
otl_base_minmax_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt min_coord, max_coord, num_minmax;
OTL_CHECK( 6 );
min_coord = OTL_NEXT_USHORT( p );
max_coord = OTL_NEXT_USHORT( p );
num_minmax = OTL_NEXT_USHORT( p );
if ( min_coord )
otl_base_coord_validate( table + min_coord, valid );
if ( max_coord )
otl_base_coord_validate( table + max_coord, valid );
OTL_CHECK( num_minmax * 8 );
/* scan feature minmax records */
for ( ; num_minmax > 0; num_minmax-- )
{
p += 4; /* skip tag */
min_coord = OTL_NEXT_USHORT( p );
max_coord = OTL_NEXT_USHORT( p );
if ( min_coord )
otl_base_coord_validate( table + min_coord, valid );
if ( max_coord )
otl_base_coord_validate( table + max_coord, valid );
}
}
static void
otl_base_script_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt values, default_minmax, num_langsys;
OTL_CHECK( 6 );
values = OTL_NEXT_USHORT( p );
default_minmax = OTL_NEXT_USHORT( p );
num_langsys = OTL_NEXT_USHORT( p );
if ( values )
otl_base_values_validate( table + values, valid );
if ( default_minmax )
otl_base_minmax_validate( table + default_minmax, valid );
OTL_CHECK( num_langsys * 6 );
/* scan base langsys records */
for ( ; num_langsys > 0; num_langsys-- )
{
p += 4; /* skip tag */
otl_base_minmax_validate( table + OTL_NEXT_USHORT( p ), valid );
}
}
static void
otl_base_script_list_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_scripts;
OTL_CHECK( 2 );
num_scripts = OTL_NEXT_USHORT( p );
OTL_CHECK( num_scripts * 6 );
/* scan base script records */
for ( ; num_scripts > 0; num_scripts-- )
{
p += 4; /* skip tag */
otl_base_script_validate( table + OTL_NEXT_USHORT( p ), valid );
}
}
static void
otl_axis_table_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt tags;
OTL_CHECK( 4 );
tags = OTL_NEXT_USHORT( p );
if ( tags )
otl_base_tag_list_validate( table + tags, valid );
otl_base_script_list_validate( table + OTL_NEXT_USHORT( p ), valid );
}
OTL_LOCALDEF( void )
otl_base_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt val;
OTL_CHECK( 6 );
if ( OTL_NEXT_ULONG( p ) != 0x10000UL )
OTL_INVALID_DATA;
/* validate horizontal axis table */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_axis_table_validate( table + val, valid );
/* validate vertical axis table */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_axis_table_validate( table + val, valid );
}
/* END */

View File

@ -1,37 +0,0 @@
/***************************************************************************/
/* */
/* otlbase.h */
/* */
/* OpenType layout support, BASE table (specification). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OTLBASE_H__
#define __OTLBASE_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
OTL_LOCAL( void )
otl_base_validate( OTL_Bytes table,
OTL_Validator valid );
OTL_END_HEADER
#endif /* __OTLBASE_H__ */
/* END */

View File

@ -1,967 +0,0 @@
/***************************************************************************/
/* */
/* otlcommn.c */
/* */
/* OpenType layout support, common tables (body). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#include "otlayout.h"
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** COVERAGE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_coverage_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt format;
OTL_CHECK( 4 );
format = OTL_NEXT_USHORT( p );
switch ( format )
{
case 1:
{
OTL_UInt num_glyphs = OTL_NEXT_USHORT( p );
OTL_CHECK( num_glyphs * 2 );
}
break;
case 2:
{
OTL_UInt n, num_ranges = OTL_NEXT_USHORT( p );
OTL_UInt start, end, start_coverage, total = 0, last = 0;
OTL_CHECK( num_ranges * 6 );
/* scan range records */
for ( n = 0; n < num_ranges; n++ )
{
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
start_coverage = OTL_NEXT_USHORT( p );
if ( start > end || start_coverage != total )
OTL_INVALID_DATA;
if ( n > 0 && start <= last )
OTL_INVALID_DATA;
total += end - start + 1;
last = end;
}
}
break;
default:
OTL_INVALID_FORMAT;
}
/* no need to check glyph indices used as input to coverage tables */
/* since even invalid glyph indices return a meaningful result */
}
OTL_LOCALDEF( OTL_UInt )
otl_coverage_get_first( OTL_Bytes table )
{
OTL_Bytes p = table;
p += 4; /* skip format and count */
return OTL_NEXT_USHORT( p );
}
OTL_LOCALDEF( OTL_UInt )
otl_coverage_get_last( OTL_Bytes table )
{
OTL_Bytes p = table;
OTL_UInt format = OTL_NEXT_USHORT( p );
OTL_UInt count = OTL_NEXT_USHORT( p );
OTL_UInt result;
switch ( format )
{
case 1:
p += ( count - 1 ) * 2;
result = OTL_NEXT_USHORT( p );
break;
case 2:
p += ( count - 1 ) * 6 + 2;
result = OTL_NEXT_USHORT( p );
break;
default:
;
}
return result;
}
OTL_LOCALDEF( OTL_UInt )
otl_coverage_get_count( OTL_Bytes table )
{
OTL_Bytes p = table;
OTL_UInt format = OTL_NEXT_USHORT( p );
OTL_UInt count = OTL_NEXT_USHORT( p );
OTL_UInt result = 0;
switch ( format )
{
case 1:
return count;
case 2:
{
OTL_UInt start, end;
for ( ; count > 0; count-- )
{
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
p += 2; /* skip start_index */
result += end - start + 1;
}
}
break;
default:
;
}
return result;
}
#if 0
OTL_LOCALDEF( OTL_Long )
otl_coverage_get_index( OTL_Bytes table,
OTL_UInt glyph_index )
{
OTL_Bytes p = table;
OTL_UInt format = OTL_NEXT_USHORT( p );
OTL_UInt count = OTL_NEXT_USHORT( p );
switch ( format )
{
case 1:
{
OTL_UInt min = 0, max = count, mid, gindex;
table += 4;
while ( min < max )
{
mid = ( min + max ) >> 1;
p = table + 2 * mid;
gindex = OTL_PEEK_USHORT( p );
if ( glyph_index == gindex )
return (OTL_Long)mid;
if ( glyph_index < gindex )
max = mid;
else
min = mid + 1;
}
}
break;
case 2:
{
OTL_UInt min = 0, max = count, mid;
OTL_UInt start, end;
table += 4;
while ( min < max )
{
mid = ( min + max ) >> 1;
p = table + 6 * mid;
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
if ( glyph_index < start )
max = mid;
else if ( glyph_index > end )
min = mid + 1;
else
return (OTL_Long)( glyph_index + OTL_NEXT_USHORT( p ) - start );
}
}
break;
default:
;
}
return -1;
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CLASS DEFINITION TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_class_definition_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt format;
OTL_CHECK( 4 );
format = OTL_NEXT_USHORT( p );
switch ( format )
{
case 1:
{
OTL_UInt num_glyphs;
p += 2; /* skip start_glyph */
OTL_CHECK( 2 );
num_glyphs = OTL_NEXT_USHORT( p );
OTL_CHECK( num_glyphs * 2 );
}
break;
case 2:
{
OTL_UInt n, num_ranges = OTL_NEXT_USHORT( p );
OTL_UInt start, end, last = 0;
OTL_CHECK( num_ranges * 6 );
/* scan class range records */
for ( n = 0; n < num_ranges; n++ )
{
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
p += 2; /* ignored */
if ( start > end || ( n > 0 && start <= last ) )
OTL_INVALID_DATA;
last = end;
}
}
break;
default:
OTL_INVALID_FORMAT;
}
/* no need to check glyph indices used as input to class definition */
/* tables since even invalid glyph indices return a meaningful result */
}
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_class_definition_get_value( OTL_Bytes table,
OTL_UInt glyph_index )
{
OTL_Bytes p = table;
OTL_UInt format = OTL_NEXT_USHORT( p );
switch ( format )
{
case 1:
{
OTL_UInt start = OTL_NEXT_USHORT( p );
OTL_UInt count = OTL_NEXT_USHORT( p );
OTL_UInt idx = (OTL_UInt)( glyph_index - start );
if ( idx < count )
{
p += 2 * idx;
return OTL_PEEK_USHORT( p );
}
}
break;
case 2:
{
OTL_UInt count = OTL_NEXT_USHORT( p );
OTL_UInt min = 0, max = count, mid, gindex, start, end;
table += 4;
while ( min < max )
{
mid = ( min + max ) >> 1;
p = table + 6 * mid;
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
if ( glyph_index < start )
max = mid;
else if ( glyph_index > end )
min = mid + 1;
else
return OTL_PEEK_USHORT( p );
}
}
break;
default:
;
}
return 0;
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** DEVICE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_device_table_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt start, end, count, format;
OTL_CHECK( 8 );
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
format = OTL_NEXT_USHORT( p );
if ( format < 1 || format > 3 || end < start )
OTL_INVALID_DATA;
count = end - start + 1;
OTL_CHECK( ( 1 << format ) * count / 8 );
}
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_device_table_get_start( OTL_Bytes table )
{
OTL_Bytes p = table;
return OTL_PEEK_USHORT( p );
}
#endif
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_device_table_get_end( OTL_Bytes table )
{
OTL_Bytes p = table + 2;
return OTL_PEEK_USHORT( p );
}
#endif
#if 0
OTL_LOCALDEF( OTL_Int )
otl_device_table_get_delta( OTL_Bytes table,
OTL_UInt size )
{
OTL_Bytes p = table;
OTL_Int result = 0;
OTL_UInt start, end, format, idx, value, shift;
start = OTL_NEXT_USHORT( p );
end = OTL_NEXT_USHORT( p );
format = OTL_NEXT_USHORT( p );
if ( size >= start && size <= end )
{
/* we could do that with clever bit operations, but a switch is */
/* much simpler to understand and maintain */
/* */
switch ( format )
{
case 1:
idx = (OTL_UInt)( ( size - start ) * 2 );
p += idx / 16;
value = OTL_PEEK_USHORT( p );
shift = idx & 15;
result = (OTL_Int16)( value << shift ) >> ( 14 - shift );
break;
case 2:
idx = (OTL_UInt)( ( size - start ) * 4 );
p += idx / 16;
value = OTL_PEEK_USHORT( p );
shift = idx & 15;
result = (OTL_Int16)( value << shift ) >> ( 12 - shift );
break;
case 3:
idx = (OTL_UInt)( ( size - start ) * 8 );
p += idx / 16;
value = OTL_PEEK_USHORT( p );
shift = idx & 15;
result = (OTL_Int16)( value << shift ) >> ( 8 - shift );
break;
default:
;
}
}
return result;
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_lookup_validate( OTL_Bytes table,
OTL_UInt type_count,
OTL_ValidateFunc* type_funcs,
OTL_UInt lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt lookup_type, lookup_flag, num_subtables;
OTL_ValidateFunc validate;
OTL_CHECK( 6 );
lookup_type = OTL_NEXT_USHORT( p );
lookup_flag = OTL_NEXT_USHORT( p );
num_subtables = OTL_NEXT_USHORT( p );
if ( lookup_type == 0 || lookup_type >= type_count )
OTL_INVALID_DATA;
validate = type_funcs[lookup_type - 1];
OTL_CHECK( 2 * num_subtables );
/* scan subtables */
for ( ; num_subtables > 0; num_subtables-- )
validate( table + OTL_NEXT_USHORT( p ), lookup_count, glyph_count,
valid );
}
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_lookup_get_count( OTL_Bytes table )
{
OTL_Bytes p = table + 4;
return OTL_PEEK_USHORT( p );
}
#endif
#if 0
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_get_table( OTL_Bytes table,
OTL_UInt idx )
{
OTL_Bytes p, result = 0;
OTL_UInt count;
p = table + 4;
count = OTL_NEXT_USHORT( p );
if ( idx < count )
{
p += idx * 2;
result = table + OTL_PEEK_USHORT( p );
}
return result;
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUP LISTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_lookup_list_validate( OTL_Bytes table,
OTL_UInt type_count,
OTL_ValidateFunc* type_funcs,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_lookups, count;
OTL_CHECK( 2 );
num_lookups = OTL_NEXT_USHORT( p );
OTL_CHECK( 2 * num_lookups );
/* scan lookup records */
for ( count = num_lookups; count > 0; count-- )
otl_lookup_validate( table + OTL_NEXT_USHORT( p ),
type_count, type_funcs,
num_lookups, glyph_count, valid );
}
OTL_LOCALDEF( OTL_UInt )
otl_lookup_list_get_count( OTL_Bytes table )
{
OTL_Bytes p = table;
return OTL_PEEK_USHORT( p );
}
#if 0
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_lookup( OTL_Bytes table,
OTL_UInt idx )
{
OTL_Bytes p, result = 0;
OTL_UInt count;
p = table;
count = OTL_NEXT_USHORT( p );
if ( idx < count )
{
p += idx * 2;
result = table + OTL_PEEK_USHORT( p );
}
return result;
}
#endif
#if 0
OTL_LOCALDEF( OTL_Bytes )
otl_lookup_list_get_table( OTL_Bytes table,
OTL_UInt lookup_index,
OTL_UInt table_index )
{
OTL_Bytes result = 0;
result = otl_lookup_list_get_lookup( table, lookup_index );
if ( result )
result = otl_lookup_get_table( result, table_index );
return result;
}
#endif
#if 0
OTL_LOCALDEF( void )
otl_lookup_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
OTL_Pointer func_data )
{
OTL_Bytes p = table;
OTL_UInt count = OTL_NEXT_USHORT( p );
for ( ; count > 0; count-- )
func( table + OTL_NEXT_USHORT( p ), func_data );
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURES *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_feature_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_lookups;
OTL_CHECK( 4 );
p += 2; /* unused */
num_lookups = OTL_NEXT_USHORT( p );
OTL_CHECK( 2 * num_lookups );
for ( ; num_lookups > 0; num_lookups-- )
if ( OTL_NEXT_USHORT( p ) >= lookup_count )
OTL_INVALID_DATA;
}
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_feature_get_count( OTL_Bytes table )
{
OTL_Bytes p = table + 4;
return OTL_PEEK_USHORT( p );
}
#endif
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_feature_get_lookups( OTL_Bytes table,
OTL_UInt start,
OTL_UInt count,
OTL_UInt *lookups )
{
OTL_Bytes p;
OTL_UInt num_features, result = 0;
p = table + 4;
num_features = OTL_NEXT_USHORT( p );
p += start * 2;
for ( ; count > 0 && start < num_features; count--, start++ )
{
lookups[0] = OTL_NEXT_USHORT(p);
lookups++;
result++;
}
return result;
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURE LIST *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_feature_list_validate( OTL_Bytes table,
OTL_Bytes lookups,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_features, lookup_count;
OTL_CHECK( 2 );
num_features = OTL_NEXT_USHORT( p );
OTL_CHECK( 2 * num_features );
lookup_count = otl_lookup_list_get_count( lookups );
/* scan feature records */
for ( ; num_features > 0; num_features-- )
{
p += 4; /* skip tag */
otl_feature_validate( table + OTL_NEXT_USHORT( p ), lookup_count,
valid );
}
}
OTL_LOCALDEF( OTL_UInt )
otl_feature_list_get_count( OTL_Bytes table )
{
OTL_Bytes p = table;
return OTL_PEEK_USHORT( p );
}
#if 0
OTL_LOCALDEF( OTL_Bytes )
otl_feature_list_get_feature( OTL_Bytes table,
OTL_UInt idx )
{
OTL_Bytes p, result = 0;
OTL_UInt count;
p = table;
count = OTL_NEXT_USHORT( p );
if ( idx < count )
{
p += idx * 2;
result = table + OTL_PEEK_USHORT( p );
}
return result;
}
#endif
#if 0
OTL_LOCALDEF( void )
otl_feature_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
OTL_Pointer func_data )
{
OTL_Bytes p;
OTL_UInt count;
p = table;
count = OTL_NEXT_USHORT( p );
for ( ; count > 0; count-- )
func( table + OTL_NEXT_USHORT( p ), func_data );
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LANGUAGE SYSTEM *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_lang_validate( OTL_Bytes table,
OTL_UInt feature_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt req_feature;
OTL_UInt num_features;
OTL_CHECK( 6 );
p += 2; /* unused */
req_feature = OTL_NEXT_USHORT( p );
num_features = OTL_NEXT_USHORT( p );
if ( req_feature != 0xFFFFU && req_feature >= feature_count )
OTL_INVALID_DATA;
OTL_CHECK( 2 * num_features );
for ( ; num_features > 0; num_features-- )
if ( OTL_NEXT_USHORT( p ) >= feature_count )
OTL_INVALID_DATA;
}
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_lang_get_count( OTL_Bytes table )
{
OTL_Bytes p = table + 4;
return OTL_PEEK_USHORT( p );
}
#endif
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_lang_get_req_feature( OTL_Bytes table )
{
OTL_Bytes p = table + 2;
return OTL_PEEK_USHORT( p );
}
#endif
#if 0
OTL_LOCALDEF( OTL_UInt )
otl_lang_get_features( OTL_Bytes table,
OTL_UInt start,
OTL_UInt count,
OTL_UInt *features )
{
OTL_Bytes p = table + 4;
OTL_UInt num_features = OTL_NEXT_USHORT( p );
OTL_UInt result = 0;
p += start * 2;
for ( ; count > 0 && start < num_features; start++, count-- )
{
features[0] = OTL_NEXT_USHORT( p );
features++;
result++;
}
return result;
}
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** SCRIPTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( void )
otl_script_validate( OTL_Bytes table,
OTL_UInt feature_count,
OTL_Validator valid )
{
OTL_UInt default_lang, num_langs;
OTL_Bytes p = table;
OTL_CHECK( 4 );
default_lang = OTL_NEXT_USHORT( p );
num_langs = OTL_NEXT_USHORT( p );
if ( default_lang != 0 )
otl_lang_validate( table + default_lang, feature_count, valid );
OTL_CHECK( num_langs * 6 );
/* scan langsys records */
for ( ; num_langs > 0; num_langs-- )
{
p += 4; /* skip tag */
otl_lang_validate( table + OTL_NEXT_USHORT( p ), feature_count, valid );
}
}
OTL_LOCALDEF( void )
otl_script_list_validate( OTL_Bytes table,
OTL_Bytes features,
OTL_Validator valid )
{
OTL_UInt num_scripts, feature_count;
OTL_Bytes p = table;
OTL_CHECK( 2 );
num_scripts = OTL_NEXT_USHORT( p );
OTL_CHECK( num_scripts * 6 );
feature_count = otl_feature_list_get_count( features );
/* scan script records */
for ( ; num_scripts > 0; num_scripts-- )
{
p += 4; /* skip tag */
otl_script_validate( table + OTL_NEXT_USHORT( p ), feature_count,
valid );
}
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** UTILITY FUNCTIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCALDEF( OTL_UInt )
otl_gsubgpos_get_lookup_count( OTL_Bytes table )
{
OTL_Bytes p = table + 8;
return otl_lookup_list_get_count( table + OTL_PEEK_USHORT( p ) );
}
/* END */

View File

@ -1,326 +0,0 @@
/***************************************************************************/
/* */
/* otlcommn.h */
/* */
/* OpenType layout support, common tables (specification). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OTLCOMMN_H__
#define __OTLCOMMN_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** COVERAGE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate coverage table */
OTL_LOCAL( void )
otl_coverage_validate( OTL_Bytes table,
OTL_Validator valid );
/* return first covered glyph */
OTL_LOCAL( OTL_UInt )
otl_coverage_get_first( OTL_Bytes table );
/* return last covered glyph */
OTL_LOCAL( OTL_UInt )
otl_coverage_get_last( OTL_Bytes table );
/* return number of covered glyphs */
OTL_LOCAL( OTL_UInt )
otl_coverage_get_count( OTL_Bytes table );
#if 0
/* Return the coverage index corresponding to a glyph glyph index. */
/* Return -1 if the glyph isn't covered. */
OTL_LOCAL( OTL_Long )
otl_coverage_get_index( OTL_Bytes table,
OTL_UInt glyph_index );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** CLASS DEFINITION TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate class definition table */
OTL_LOCAL( void )
otl_class_definition_validate( OTL_Bytes table,
OTL_Validator valid );
#if 0
/* return class value for a given glyph index */
OTL_LOCAL( OTL_UInt )
otl_class_definition_get_value( OTL_Bytes table,
OTL_UInt glyph_index );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** DEVICE TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate a device table */
OTL_LOCAL( void )
otl_device_table_validate( OTL_Bytes table,
OTL_Validator valid );
#if 0
/* return a device table's first size */
OTL_LOCAL( OTL_UInt )
otl_device_table_get_start( OTL_Bytes table );
#endif
#if 0
/* return a device table's last size */
OTL_LOCAL( OTL_UInt )
otl_device_table_get_end( OTL_Bytes table );
#endif
#if 0
/* return pixel adjustment for a given size */
OTL_LOCAL( OTL_Int )
otl_device_table_get_delta( OTL_Bytes table,
OTL_UInt size );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUPS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCAL( void )
otl_lookup_validate( OTL_Bytes table,
OTL_UInt type_count,
OTL_ValidateFunc* type_funcs,
OTL_UInt lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid );
#if 0
/* return number of sub-tables in a lookup */
OTL_LOCAL( OTL_UInt )
otl_lookup_get_count( OTL_Bytes table );
#endif
#if 0
/* return lookup sub-table */
OTL_LOCAL( OTL_Bytes )
otl_lookup_get_table( OTL_Bytes table,
OTL_UInt idx );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LOOKUP LISTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate lookup list */
OTL_LOCAL( void )
otl_lookup_list_validate( OTL_Bytes table,
OTL_UInt type_count,
OTL_ValidateFunc* type_funcs,
OTL_UInt glyph_count,
OTL_Validator valid );
/* return number of lookups in list */
OTL_LOCAL( OTL_UInt )
otl_lookup_list_get_count( OTL_Bytes table );
#if 0
/* return a given lookup from a list */
OTL_LOCAL( OTL_Bytes )
otl_lookup_list_get_lookup( OTL_Bytes table,
OTL_UInt idx );
#endif
#if 0
/* return lookup sub-table from a list */
OTL_LOCAL( OTL_Bytes )
otl_lookup_list_get_table( OTL_Bytes table,
OTL_UInt lookup_index,
OTL_UInt table_index );
#endif
#if 0
/* iterate over lookup list */
OTL_LOCAL( void )
otl_lookup_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
OTL_Pointer func_data );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURES *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate feature table */
OTL_LOCAL( void )
otl_feature_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_Validator valid );
#if 0
/* return feature's lookup count */
OTL_LOCAL( OTL_UInt )
otl_feature_get_count( OTL_Bytes table );
#endif
#if 0
/* get several lookups indices from a feature. returns the number of */
/* lookups grabbed */
OTL_LOCAL( OTL_UInt )
otl_feature_get_lookups( OTL_Bytes table,
OTL_UInt start,
OTL_UInt count,
OTL_UInt *lookups );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** FEATURE LIST *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
/* validate a feature list */
/* lookups must already be validated */
OTL_LOCAL( void )
otl_feature_list_validate( OTL_Bytes table,
OTL_Bytes lookups,
OTL_Validator valid );
/* return number of features in list */
OTL_LOCAL( OTL_UInt )
otl_feature_list_get_count( OTL_Bytes table );
#if 0
/* return a given feature from a list */
OTL_LOCAL( OTL_Bytes )
otl_feature_list_get_feature( OTL_Bytes table,
OTL_UInt idx );
#endif
#if 0
/* iterate over all features in a list */
OTL_LOCAL( void )
otl_feature_list_foreach( OTL_Bytes table,
OTL_ForeachFunc func,
OTL_Pointer func_data );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LANGUAGE SYSTEM *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCAL( void )
otl_lang_validate( OTL_Bytes table,
OTL_UInt feature_count,
OTL_Validator valid );
#if 0
OTL_LOCAL( OTL_UInt )
otl_lang_get_req_feature( OTL_Bytes table );
#endif
#if 0
OTL_LOCAL( OTL_UInt )
otl_lang_get_count( OTL_Bytes table );
#endif
#if 0
OTL_LOCAL( OTL_UInt )
otl_lang_get_features( OTL_Bytes table,
OTL_UInt start,
OTL_UInt count,
OTL_UInt *features );
#endif
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** SCRIPTS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCAL( void )
otl_script_validate( OTL_Bytes table,
OTL_UInt feature_count,
OTL_Validator valid );
/* validate a script list */
/* features must already be validated */
OTL_LOCAL( void )
otl_script_list_validate( OTL_Bytes table,
OTL_Bytes features,
OTL_Validator valid );
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** UTILITY FUNCTIONS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_LOCAL( OTL_UInt )
otl_gsubgpos_get_lookup_count( OTL_Bytes table );
/* */
OTL_END_HEADER
#endif /* __OTLCOMMN_H__ */
/* END */

View File

@ -1,78 +0,0 @@
#ifndef __OT_LAYOUT_CONFIG_H__
#define __OT_LAYOUT_CONFIG_H__
/************************************************************************/
/************************************************************************/
/***** *****/
/***** CONFIGURATION MACROS *****/
/***** *****/
/************************************************************************/
/************************************************************************/
#ifdef __cplusplus
# define OTL_BEGIN_HEADER extern "C" {
#else
# define OTL_BEGIN_HEADER /* nothing */
#endif
#ifdef __cplusplus
# define OTL_END_HEADER }
#else
# define OTL_END_HEADER /* nothing */
#endif
#ifndef OTL_API
# ifdef __cplusplus
# define OTL_API( x ) extern "C"
# else
# define OTL_API( x ) extern x
# endif
#endif
#ifndef OTL_APIDEF
# define OTL_APIDEF( x ) x
#endif
#ifndef OTL_LOCAL
# define OTL_LOCAL( x ) extern x
#endif
#ifndef OTL_LOCALDEF
# define OTL_LOCALDEF( x ) x
#endif
#define OTL_BEGIN_STMNT do {
#define OTL_END_STMNT } while (0)
#define OTL_DUMMY_STMNT OTL_BEGIN_STMNT OTL_END_STMNT
#define OTL_UNUSED( x ) (x)=(x)
#define OTL_UNUSED_CONST(x) (void)(x)
#include <limits.h>
#if UINT_MAX == 0xFFFFU
# define OTL_SIZEOF_INT 2
#elif UINT_MAX == 0xFFFFFFFFU
# define OTL_SIZEOF_INT 4
#elif UINT_MAX > 0xFFFFFFFFU && UINT_MAX == 0xFFFFFFFFFFFFFFFFU
# define OTL_SIZEOF_INT 8
#else
# error "unsupported number of bytes in 'int' type!"
#endif
#if ULONG_MAX == 0xFFFFFFFFU
# define OTL_SIZEOF_LONG 4
#elif ULONG_MAX > 0xFFFFFFFFU && ULONG_MAX == 0xFFFFFFFFFFFFFFFFU
# define OTL_SIZEOF_LONG 8
#else
# error "unsupported number of bytes in 'long' type!"
#endif
#include <setjmp.h>
#define OTL_jmp_buf jmp_buf
#define otl_setjmp setjmp
#define otl_longjmp longjmp
/* */
#endif /* __OT_LAYOUT_CONFIG_H__ */

View File

@ -1,203 +0,0 @@
/***************************************************************************/
/* */
/* otlgdef.c */
/* */
/* OpenType layout support, GDEF table (body). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#include "otlgdef.h"
#include "otlcommn.h"
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** ATTACHMENTS LIST *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
static void
otl_attach_point_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt count;
OTL_CHECK( 2 );
count = OTL_NEXT_USHORT( p );
OTL_CHECK( count * 2 );
}
static void
otl_attach_list_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_Bytes coverage;
OTL_UInt num_glyphs;
OTL_CHECK( 4 );
coverage = table + OTL_NEXT_USHORT( p );
num_glyphs = OTL_NEXT_USHORT( p );
otl_coverage_validate( coverage, valid );
if ( num_glyphs != otl_coverage_get_count( coverage ) )
OTL_INVALID_DATA;
OTL_CHECK( num_glyphs * 2 );
/* scan attach point records */
for ( ; num_glyphs > 0; num_glyphs-- )
otl_attach_point_validate( table + OTL_NEXT_USHORT( p ), valid );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** LIGATURE CARETS *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
static void
otl_caret_value_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_Int format;
OTL_CHECK( 4 );
format = OTL_NEXT_USHORT( p );
switch ( format )
{
case 1:
/* skip coordinate, no test */
break;
case 2:
/* skip contour point index, no test */
break;
case 3:
p += 2; /* skip coordinate */
OTL_CHECK( 2 );
otl_device_table_validate( table + OTL_PEEK_USHORT( p ), valid );
break;
default:
OTL_INVALID_DATA;
}
}
static void
otl_ligature_glyph_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_carets;
OTL_CHECK( 2 );
num_carets = OTL_NEXT_USHORT( p );
OTL_CHECK( num_carets * 2 );
/* scan caret value records */
for ( ; num_carets > 0; num_carets-- )
otl_caret_value_validate( table + OTL_NEXT_USHORT( p ), valid );
}
static void
otl_ligature_caret_list_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_Bytes coverage;
OTL_UInt num_ligglyphs;
OTL_CHECK( 4 );
coverage = table + OTL_NEXT_USHORT( p );
num_ligglyphs = OTL_NEXT_USHORT( p );
otl_coverage_validate( coverage, valid );
if ( num_ligglyphs != otl_coverage_get_count( coverage ) )
OTL_INVALID_DATA;
OTL_CHECK( num_ligglyphs * 2 );
/* scan ligature glyph records */
for ( ; num_ligglyphs > 0; num_ligglyphs-- )
otl_ligature_glyph_validate( table + OTL_NEXT_USHORT( p ), valid );
}
/*************************************************************************/
/*************************************************************************/
/***** *****/
/***** GDEF TABLE *****/
/***** *****/
/*************************************************************************/
/*************************************************************************/
OTL_APIDEF( void )
otl_gdef_validate( OTL_Bytes table,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt val;
OTL_CHECK( 12 );
/* check format */
if ( OTL_NEXT_ULONG( p ) != 0x00010000UL )
OTL_INVALID_FORMAT;
/* validate glyph class definition table */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_class_definition_validate( table + val, valid );
/* validate attachment point list */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_attach_list_validate( table + val, valid );
/* validate ligature caret list */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_ligature_caret_list_validate( table + val, valid );
/* validate mark attachment class definition table */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_class_definition_validate( table + val, valid );
}
/* END */

View File

@ -1,41 +0,0 @@
/***************************************************************************/
/* */
/* otlgdef.h */
/* */
/* OpenType layout support, GDEF table (specification). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OTLGDEF_H__
#define __OTLGDEF_H__
#include "otlayout.h"
#if 0
#include "otltable.h"
#endif
OTL_BEGIN_HEADER
OTL_API( void )
otl_gdef_validate( OTL_Bytes table,
OTL_Validator valid );
OTL_END_HEADER
#endif /* __OTLGDEF_H__ */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,44 +0,0 @@
/***************************************************************************/
/* */
/* otlgpos.h */
/* */
/* OpenType layout support, GPOS table (specification). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OTLGPOS_H__
#define __OTLGPOS_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
OTL_LOCAL( void )
otl_gpos_subtable_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid );
OTL_LOCAL( void )
otl_gpos_validate( OTL_Bytes table,
OTL_UInt glyph_count,
OTL_Validator valid );
OTL_END_HEADER
#endif /* __OTLGPOS_H__ */
/* END */

File diff suppressed because it is too large Load Diff

View File

@ -1,52 +0,0 @@
/***************************************************************************/
/* */
/* otlgsub.h */
/* */
/* OpenType layout support, GSUB table (specification). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OTLGSUB_H__
#define __OTLGSUB_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
typedef OTL_UInt
(*OTL_GSUB_AlternateFunc)( OTL_UInt gindex,
OTL_UInt count,
OTL_Bytes alternates,
OTL_Pointer data );
typedef struct OTL_GSUB_AlternateRec_
{
OTL_GSUB_AlternateFunc handler_func;
OTL_Pointer handler_data;
} OTL_GSUB_AlternateRec, *OTL_GSUB_Alternate;
OTL_LOCAL( void )
otl_gsub_validate( OTL_Bytes table,
OTL_UInt glyph_count,
OTL_Validator valid );
OTL_END_HEADER
#endif /* __OTLGSUB_H__ */
/* END */

View File

@ -1,262 +0,0 @@
/***************************************************************************/
/* */
/* otljstf.c */
/* */
/* OpenType layout support, JSTF table (body). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#include "otljstf.h"
#include "otlcommn.h"
#include "otlgpos.h"
static void
otl_jstf_extender_validate( OTL_Bytes table,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_glyphs;
OTL_CHECK( 2 );
num_glyphs = OTL_NEXT_USHORT( p );
OTL_CHECK( num_glyphs * 2 );
for ( ; num_glyphs > 0; num_glyphs-- )
if ( OTL_NEXT_USHORT( p ) >= glyph_count )
OTL_INVALID_DATA;
}
static void
otl_jstf_gsubgpos_mods_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_lookups;
OTL_CHECK( 2 );
num_lookups = OTL_NEXT_USHORT( p );
OTL_CHECK( num_lookups * 2 );
if ( lookup_count )
{
for ( ; num_lookups > 0; num_lookups-- )
if ( OTL_NEXT_USHORT( p ) >= lookup_count )
OTL_INVALID_DATA;
}
}
static void
otl_jstf_max_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_lookups;
OTL_CHECK( 2 );
num_lookups = OTL_NEXT_USHORT( p );
OTL_CHECK( num_lookups * 2 );
/* scan subtable records */
for ( ; num_lookups > 0; num_lookups-- )
/* XXX: check lookup types? */
otl_gpos_subtable_validate( table + OTL_NEXT_USHORT( p ),
lookup_count, glyph_count, valid );
}
static void
otl_jstf_priority_validate( OTL_Bytes table,
OTL_UInt gsub_lookup_count,
OTL_UInt gpos_lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt val;
OTL_CHECK( 20 );
/* shrinkage GSUB enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
/* shrinkage GPOS enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
/* shrinkage JSTF max */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_max_validate( table + val, gpos_lookup_count, glyph_count,
valid );
/* extension GSUB enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
/* extension GPOS enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
/* extension JSTF max */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_max_validate( table + val, gpos_lookup_count, glyph_count,
valid );
}
static void
otl_jstf_lang_validate( OTL_Bytes table,
OTL_UInt gsub_lookup_count,
OTL_UInt gpos_lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_priorities;
OTL_CHECK( 2 );
num_priorities = OTL_NEXT_USHORT( p );
OTL_CHECK( num_priorities * 2 );
/* scan priority records */
for ( ; num_priorities > 0; num_priorities-- )
otl_jstf_priority_validate( table + OTL_NEXT_USHORT( p ),
gsub_lookup_count, gpos_lookup_count,
glyph_count, valid );
}
static void
otl_jstf_script_validate( OTL_Bytes table,
OTL_UInt gsub_lookup_count,
OTL_UInt gpos_lookup_count,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_langsys, extender, default_lang;
OTL_CHECK( 6 );
extender = OTL_NEXT_USHORT( p );
default_lang = OTL_NEXT_USHORT( p );
num_langsys = OTL_NEXT_USHORT( p );
if ( extender )
otl_jstf_extender_validate( table + extender, glyph_count, valid );
if ( default_lang )
otl_jstf_lang_validate( table + default_lang,
gsub_lookup_count, gpos_lookup_count,
glyph_count, valid );
OTL_CHECK( 6 * num_langsys );
/* scan langsys records */
for ( ; num_langsys > 0; num_langsys-- )
{
p += 4; /* skip tag */
otl_jstf_lang_validate( table + OTL_NEXT_USHORT( p ),
gsub_lookup_count, gpos_lookup_count,
glyph_count, valid );
}
}
OTL_LOCALDEF( void )
otl_jstf_validate( OTL_Bytes table,
OTL_Bytes gsub,
OTL_Bytes gpos,
OTL_UInt glyph_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_scripts, gsub_lookup_count, gpos_lookup_count;
OTL_CHECK( 6 );
if ( OTL_NEXT_ULONG( p ) != 0x10000UL )
OTL_INVALID_DATA;
num_scripts = OTL_NEXT_USHORT( p );
OTL_CHECK( num_scripts * 6 );
if ( gsub )
gsub_lookup_count = otl_gsubgpos_get_lookup_count( gsub );
else
gsub_lookup_count = 0;
if ( gpos )
gpos_lookup_count = otl_gsubgpos_get_lookup_count( gpos );
else
gpos_lookup_count = 0;
/* scan script records */
for ( ; num_scripts > 0; num_scripts-- )
{
p += 4; /* skip tag */
otl_jstf_script_validate( table + OTL_NEXT_USHORT( p ),
gsub_lookup_count, gpos_lookup_count,
glyph_count, valid );
}
}
/* END */

View File

@ -1,44 +0,0 @@
/***************************************************************************/
/* */
/* otljstf.h */
/* */
/* OpenType layout support, JSTF table (specification). */
/* */
/* Copyright 2002, 2004 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. */
/* */
/***************************************************************************/
#ifndef __OTLJSTF_H__
#define __OTLJSTF_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
/* validate JSTF table */
/* GSUB and GPOS tables should already be validated; */
/* if missing, set corresponding argument to 0 */
OTL_LOCAL( void )
otl_jstf_validate( OTL_Bytes table,
OTL_Bytes gsub,
OTL_Bytes gpos,
OTL_UInt glyph_count,
OTL_Validator valid );
OTL_END_HEADER
#endif /* __OTLJSTF_H__ */
/* END */

View File

@ -1,144 +0,0 @@
#include "otlparse.h"
#include "otlutils.h"
static void
otl_string_ensure( OTL_String string,
OTL_UInt count,
OTL_Parser parser )
{
count += string->length;
if ( count > string->capacity )
{
OTL_UInt old_count = string->capacity;
OTL_UInt new_count = old_count;
OTL_Memory memory = parser->memory;
while ( new_count < count )
new_count += (new_count >> 1) + 16;
if ( OTL_MEM_RENEW_ARRAY( string->glyphs, old_count, new_count ) )
otl_parser_error( parser, OTL_Err_Parser_Memory );
string->capacity = new_count;
}
}
#define OTL_STRING_ENSURE(str,count,parser) \
OTL_BEGIN_STMNT \
if ( (str)->length + (count) > (str)->capacity ) \
otl_string_ensure( str, count, parser ); \
OTL_END_STMNT
OTL_LOCALDEF( OTL_UInt )
otl_parser_get_gindex( OTL_Parser parser )
{
OTL_String in = parser->str_in;
if ( in->cursor >= in->length )
otl_parser_error( parser, OTL_Err_Parser_Internal );
return in->glyphs[ in->cursor ].gindex;
}
OTL_LOCALDEF( void )
otl_parser_error( OTL_Parser parser,
OTL_ParseError error )
{
parser->error = error;
otl_longjmp( parser->jump_buffer, 1 );
}
OTL_LOCALDEF( void )
otl_parser_check_property( OTL_Parser parser,
OTL_UInt gindex,
OTL_UInt *aproperty )
{
/* XXX: to do */
}
OTL_LOCALDEF( void )
otl_parser_replace_1( OTL_Parser parser,
OTL_UInt gindex )
{
OTL_String in = parser->str_in;
OTL_String out = parser->str_out;
OTL_StringGlyph glyph, in_glyph;
/* sanity check */
if ( in == 0 ||
out == 0 ||
in->length == 0 ||
in->cursor >= in->length )
{
/* report as internal error, since these should */
/* never happen !! */
otl_parser_error( parser, OTL_Err_Parser_Internal );
}
OTL_STRING_ENSURE( out, 1, parser );
glyph = out->glyphs + out->length;
in_glyph = in->glyphs + in->cursor;
glyph->gindex = gindex;
glyph->properties = in_glyph->properties;
glyph->lig_component = in_glyph->lig_component;
glyph->lig_id = in_glyph->lig_id;
out->length += 1;
out->cursor = out->length;
in->cursor += 1;
}
OTL_LOCALDEF( void )
otl_parser_replace_n( OTL_Parser parser,
OTL_UInt count,
OTL_Bytes indices )
{
OTL_UInt lig_component, lig_id, properties;
OTL_String in = parser->str_in;
OTL_String out = parser->str_out;
OTL_StringGlyph glyph, in_glyph;
OTL_Bytes p = indices;
/* sanity check */
if ( in == 0 ||
out == 0 ||
in->length == 0 ||
in->cursor >= in->length )
{
/* report as internal error, since these should */
/* never happen !! */
otl_parser_error( parser, OTL_Err_Parser_Internal );
}
OTL_STRING_ENSURE( out, count, parser );
glyph = out->glyphs + out->length;
in_glyph = in->glyphs + in->cursor;
glyph->gindex = in_glyph->gindex;
lig_component = in_glyph->lig_component;
lig_id = in_glyph->lig_id;
properties = in_glyph->properties;
for ( ; count > 0; count-- )
{
glyph->gindex = OTL_NEXT_USHORT(p);
glyph->properties = properties;
glyph->lig_component = lig_component;
glyph->lig_id = lig_id;
out->length ++;
}
out->cursor = out->length;
in->cursor += 1;
}

View File

@ -1,100 +0,0 @@
#ifndef __OTL_PARSER_H__
#define __OTL_PARSER_H__
#include "otlayout.h"
#include "otlgdef.h"
#include "otlgsub.h"
#include "otlgpos.h"
OTL_BEGIN_HEADER
typedef struct OTL_ParserRec_* OTL_Parser;
typedef struct OTL_StringRec_* OTL_String;
typedef struct OTL_StringGlyphRec_
{
OTL_UInt gindex;
OTL_UInt properties;
OTL_UInt lig_component;
OTL_UInt lig_id;
} OTL_StringGlyphRec, *OTL_StringGlyph;
typedef struct OTL_StringRec_
{
OTL_StringGlyph glyphs;
OTL_UInt cursor;
OTL_UInt length;
OTL_UInt capacity;
} OTL_StringRec;
typedef struct OTL_ParserRec_
{
OTL_Bytes tab_gdef;
OTL_Bytes tab_gsub;
OTL_Bytes tab_gpos;
OTL_Bytes tab_base;
OTL_Bytes tab_jstf;
OTL_GSUB_Alternate alternate; /* external alternate handler */
OTL_UInt context_len;
OTL_UInt markup_flags;
OTL_jmp_buf jump_buffer;
OTL_Memory memory;
OTL_Error error;
OTL_StringRec strings[2];
OTL_String str_in;
OTL_String str_out;
} OTL_ParserRec;
typedef enum
{
OTL_Err_Parser_Ok = 0,
OTL_Err_Parser_InvalidData,
OTL_Err_Parser_UncoveredGlyph,
OTL_Err_Parser_Memory,
OTL_Err_Parser_Internal,
} OTL_ParseError;
OTL_LOCAL( OTL_UInt )
otl_parser_get_gindex( OTL_Parser parser );
OTL_LOCAL( void )
otl_parser_error( OTL_Parser parser,
OTL_ParseError error );
#define OTL_PARSER_UNCOVERED(x) \
otl_parser_error( x, OTL_Err_Parser_UncoveredGlyph )
OTL_LOCAL( void )
otl_parser_check_property( OTL_Parser parser,
OTL_UInt gindex,
OTL_UInt *aproperty );
/* copy current input glyph to output */
OTL_LOCAL( void )
otl_parser_copy_1( OTL_Parser parser );
/* copy current input glyph to output, replacing its index */
OTL_LOCAL( void )
otl_parser_replace_1( OTL_Parser parser,
OTL_UInt gindex );
/* copy current input glyph to output, replacing it by several indices */
/* read directly from the table */
OTL_LOCAL( void )
otl_parser_replace_n( OTL_Parser parser,
OTL_UInt count,
OTL_Bytes indices );
OTL_END_HEADER
#endif /* __OTL_PARSER_H__ */

View File

@ -1,62 +0,0 @@
#ifndef __OTL_TABLE_H__
#define __OTL_TABLE_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
typedef struct OTL_TableRec_* OTL_Table;
typedef enum
{
OTL_TABLE_TYPE_GDEF = 1,
OTL_TABLE_TYPE_GSUB,
OTL_TABLE_TYPE_GPOS,
OTL_TABLE_TYPE_BASE,
OTL_TABLE_TYPE_JSTF
} OTL_TableType;
/* this may become a private structure later */
typedef struct OTL_TableRec_
{
OTL_TableType type;
OTL_Bytes base;
OTL_Bytes limit;
OTL_Tag script_tag;
OTL_Tag lang_tag;
OTL_UInt lookup_count;
OTL_Byte* lookup_flags;
OTL_UInt feature_count;
OTL_Tag feature_tags;
OTL_Byte* feature_flags;
} OTL_TableRec;
#if 0
OTL_API( OTL_Error )
otl_table_validate( OTL_Bytes table,
OTL_Size size,
OTL_TableType type,
OTL_Size *abyte_size );
OTL_API( void )
otl_table_init( OTL_Table table,
OTL_TableType type,
OTL_Bytes base,
OTL_Size size );
OTL_API( void )
otl_table_set_script( OTL_Table table,
OTL_ScriptTag script,
OTL_LangTag language );
#endif
OTL_END_HEADER
#endif /* __OTL_TABLE_H__ */

View File

@ -1,87 +0,0 @@
/* this file may be included several times by other parts of */
/* the OpenType Layout library.. don't add #ifdef .. #endif */
/* delimiters to it... */
/************************************************************************/
/************************************************************************/
/***** *****/
/***** SCRIPT TAGS *****/
/***** *****/
/************************************************************************/
/************************************************************************/
#ifndef OTL_SCRIPT_TAG
#define OTL_SCRIPT_TAG(c1,c2,c3,c4,s,n) /* void */
#endif
OTL_SCRIPT_TAG( 'a','r','a','b', "Arabic", ARABIC )
OTL_SCRIPT_TAG( 'a','r','m','n', "Armenian", ARMENIAN )
OTL_SCRIPT_TAG( 'b','e','n','g', "Bengali", BENGALI )
OTL_SCRIPT_TAG( 'b','o','p','o', "Bopomofo", BOPOMOFO )
OTL_SCRIPT_TAG( 'b','r','a','i', "Braille", BRAILLE )
OTL_SCRIPT_TAG( 'b','y','z','m', "Byzantine Music", BYZANTINE_MUSIC )
OTL_SCRIPT_TAG( 'c','a','n','s', "Canadian Syllabic", CANADIAN )
OTL_SCRIPT_TAG( 'c','h','e','r', "Cherokee", CHEROKEE )
OTL_SCRIPT_TAG( 'h','a','n','i', "CJK Ideographic", CJK )
OTL_SCRIPT_TAG( 'c','y','r','l', "Cyrillic", CYRILLIC )
OTL_SCRIPT_TAG( 'd','f','l','t', "Default", DEFAULT )
OTL_SCRIPT_TAG( 'd','e','v','a', "Devanagari", DEVANAGARI )
OTL_SCRIPT_TAG( 'e','t','h','i', "Ethiopic", ETHIOPIC )
OTL_SCRIPT_TAG( 'g','e','o','r', "Georgian", GEORGIAN )
OTL_SCRIPT_TAG( 'g','r','e','k', "Greek", GREEK )
OTL_SCRIPT_TAG( 'g','u','j','r', "Gujarati", GUJARATI )
OTL_SCRIPT_TAG( 'g','u','r','u', "Gurmukhi", GURMUKHI )
OTL_SCRIPT_TAG( 'j','a','m','o', "Hangul Jamo", JAMO )
OTL_SCRIPT_TAG( 'h','a','n','g', "Hangul", HANGUL )
OTL_SCRIPT_TAG( 'h','e','b','r', "Hebrew", HEBREW )
OTL_SCRIPT_TAG( 'h','i','r','a', "Hiragana", HIRAGANA ) /* not in TAGS.txt */
OTL_SCRIPT_TAG( 'k','n','d','a', "Kannada", KANNADA )
OTL_SCRIPT_TAG( 'k','a','n','a', "Katakana", KATAKANA ) /* in TAGS.txt, means Hiragana _and_ Katakana */
OTL_SCRIPT_TAG( 'k','h','m','r', "Khmer", KHMER )
OTL_SCRIPT_TAG( 'l','a','o',' ', "Lao", LAO )
OTL_SCRIPT_TAG( 'l','a','t','n', "Latin", LATIN )
OTL_SCRIPT_TAG( 'm','l','y','m', "Malayalam", MALAYALAM )
OTL_SCRIPT_TAG( 'm','o','n','g', "Mongolian", MONGOLIAN )
OTL_SCRIPT_TAG( 'm','y','m','r', "Myanmar", MYANMAR )
OTL_SCRIPT_TAG( 'o','g','a','m', "Ogham", OGHAM )
OTL_SCRIPT_TAG( 'o','r','y','a', "Oriya", ORIYA )
OTL_SCRIPT_TAG( 'r','u','n','r', "Runic", RUNIC )
OTL_SCRIPT_TAG( 's','i','n','h', "Sinhala", SINHALA )
OTL_SCRIPT_TAG( 's','y','r','c', "Syriac", SYRIAC )
OTL_SCRIPT_TAG( 't','a','m','l', "Tamil", TAMIL )
OTL_SCRIPT_TAG( 't','e','l','u', "Telugu", TELUGU )
OTL_SCRIPT_TAG( 't','h','a','a', "Thaana", THAANA )
OTL_SCRIPT_TAG( 't','h','a','i', "Thai", THAI )
OTL_SCRIPT_TAG( 't','i','b','t', "Tibetan", TIBETAN )
OTL_SCRIPT_TAG( 'y','i',' ',' ', "Yi", YI )
#undef OTL_SCRIPT_TAG
/************************************************************************/
/************************************************************************/
/***** *****/
/***** LANGUAGE TAGS *****/
/***** *****/
/************************************************************************/
/************************************************************************/
#ifndef OTL_LANG_TAG
#define OTL_LANG_TAG(c1,c2,c3,c4,s,n) /* void */
#endif
#undef OTL_LANG_TAG
/************************************************************************/
/************************************************************************/
/***** *****/
/***** FEATURE TAGS *****/
/***** *****/
/************************************************************************/
/************************************************************************/
#ifndef OTL_FEATURE_TAG
#define OTL_FEATURE_TAG(c1,c2,c3,c4,s,n) /* void */
#endif
#undef OTL_FEATURE_TAG

View File

@ -1,33 +0,0 @@
#ifndef __OTLAYOUT_UTILS_H__
#define __OTLAYOUT_UTILS_H__
#include "otlayout.h"
OTL_BEGIN_HEADER
OTL_LOCAL( OTL_Error )
otl_mem_alloc( OTL_Pointer* pblock,
OTL_ULong size,
OTL_Memory memory );
OTL_LOCAL( void )
otl_mem_free( OTL_Pointer* pblock,
OTL_Memory memory );
OTL_LOCAL( OTL_Error )
otl_mem_realloc( OTL_Pointer *pblock,
OTL_ULong cur_size,
OTL_ULong new_size,
OTL_Memory memory );
#define OTL_MEM_ALLOC(p,s) otl_mem_alloc( (void**)&(p), (s), memory )
#define OTL_MEM_FREE(p) otl_mem_free( (void**)&(p), memory )
#define OTL_MEM_REALLOC(p,c,s) otl_mem_realloc( (void**)&(p), (c), (s), memory )
#define OTL_MEM_NEW(p) OTL_MEM_ALLOC(p,sizeof(*(p)))
#define OTL_MEM_NEW_ARRAY(p,c) OTL_MEM_ALLOC(p,(c)*sizeof(*(p)))
#define OTL_MEM_RENEW_ARRAY(p,c,n) OTL_MEM_REALLOC(p,(c)*sizeof(*(p)),(n)*sizeof(*(p)))
OTL_END_HEADER
#endif /* __OTLAYOUT_UTILS_H__ */