ref: 4c1867bfab4e4c0c8f05cd1579ec7d709defa484
parent: cc7cab815c34aa34f8a6a3ba10703968836fd1e2
author: Werner Lemberg <[email protected]>
date: Thu Feb 3 19:02:31 EST 2005
* src/otlayout/*: Removed. Obsolete.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-02-04 Werner Lemberg <[email protected]>
+
+ * src/otlayout/*: Removed. Obsolete.
+
2004-12-28 Werner Lemberg <[email protected]>
* builds/unix/ltmain.sh: Regenerated with `libtoolize --force
--- a/src/otlayout/otlayout.h
+++ /dev/null
@@ -1,236 +1,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 */
--- a/src/otlayout/otlbase.c
+++ /dev/null
@@ -1,231 +1,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 */
--- a/src/otlayout/otlbase.h
+++ /dev/null
@@ -1,37 +1,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 */
--- a/src/otlayout/otlcommn.c
+++ /dev/null
@@ -1,967 +1,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 */
--- a/src/otlayout/otlcommn.h
+++ /dev/null
@@ -1,326 +1,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 */
--- a/src/otlayout/otlconf.h
+++ /dev/null
@@ -1,78 +1,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__ */
--- a/src/otlayout/otlgdef.c
+++ /dev/null
@@ -1,203 +1,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 */
--- a/src/otlayout/otlgdef.h
+++ /dev/null
@@ -1,41 +1,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 */
--- a/src/otlayout/otlgpos.c
+++ /dev/null
@@ -1,1102 +1,0 @@
-/***************************************************************************/
-/* */
-/* otlgpos.c */
-/* */
-/* OpenType layout support, GPOS 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 "otlgpos.h"
-#include "otlcommn.h"
-
-
- /* forward declaration */
- static OTL_ValidateFunc otl_gpos_validate_funcs[];
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** VALUE RECORDS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static OTL_UInt
- otl_value_length( OTL_UInt format )
- {
- OTL_UInt count;
-
-
- count = ( ( format & 0xAA ) >> 1 ) + ( format & 0x55 );
- count = ( ( count & 0xCC ) >> 2 ) + ( count & 0x33 );
- count = ( ( count & 0xF0 ) >> 4 ) + ( count & 0x0F );
-
- return count * 2;
- }
-
-
- static void
- otl_value_validate( OTL_Bytes table,
- OTL_Bytes pos_table,
- OTL_UInt format,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt count, device;
-
-
- if ( format >= 0x100 )
- OTL_INVALID_DATA;
-
- for ( count = 4; count > 0; count-- )
- {
- if ( format & 1 )
- {
- OTL_CHECK( 2 );
- p += 2;
- }
-
- format >>= 1;
- }
-
- for ( count = 4; count > 0; count-- )
- {
- if ( format & 1 )
- {
- OTL_CHECK( 2 );
- device = OTL_NEXT_USHORT( p );
- if ( device )
- otl_device_table_validate( pos_table + device, valid );
- }
- format >>= 1;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** ANCHORS *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_anchor_validate( OTL_Bytes table,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
-
- OTL_CHECK( 6 );
- format = OTL_NEXT_USHORT( p );
- p += 4; /* skip coordinates */
-
- switch ( format )
- {
- case 1:
- break;
-
- case 2:
- OTL_CHECK( 2 ); /* anchor point */
- break;
-
- case 3:
- {
- OTL_UInt x_device, y_device;
-
-
- OTL_CHECK( 4 );
- x_device = OTL_NEXT_USHORT( p );
- y_device = OTL_NEXT_USHORT( p );
-
- if ( x_device )
- otl_device_table_validate( table + x_device, valid );
-
- if ( y_device )
- otl_device_table_validate( table + y_device, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** MARK ARRAY *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_mark_array_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 );
- for ( ; count > 0; count-- )
- {
- p += 2; /* ignore class index */
- otl_anchor_validate( table + OTL_NEXT_USHORT( p ), valid );
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 1 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gpos_lookup1_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, value_format;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- value_format = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
- otl_value_validate( p, table, value_format, valid );
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, value_format, num_values, len_value;
-
-
- OTL_CHECK( 6 );
- coverage = OTL_NEXT_USHORT( p );
- value_format = OTL_NEXT_USHORT( p );
- num_values = OTL_NEXT_USHORT( p );
-
- len_value = otl_value_length( value_format );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_values * len_value );
-
- /* scan value records */
- for ( ; num_values > 0; num_values-- )
- {
- otl_value_validate( p, table, value_format, valid );
- p += len_value;
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 2 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gpos_pairset_validate( OTL_Bytes table,
- OTL_Bytes pos_table,
- OTL_UInt format1,
- OTL_UInt format2,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt value_len1, value_len2, num_pairvalues;
-
-
- OTL_CHECK( 2 );
- num_pairvalues = OTL_NEXT_USHORT( p );
- value_len1 = otl_value_length( format1 );
- value_len2 = otl_value_length( format2 );
-
- OTL_CHECK( num_pairvalues * ( value_len1 + value_len2 + 2 ) );
-
- /* scan pair value records */
- for ( ; num_pairvalues > 0; num_pairvalues-- )
- {
- p += 2; /* ignore glyph id */
-
- otl_value_validate( p, pos_table, format1, valid );
- p += value_len1;
-
- otl_value_validate( p, pos_table, format2, valid );
- p += value_len2;
- }
- }
-
-
- static void
- otl_gpos_lookup2_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, value1, value2, num_pairsets;
-
-
- OTL_CHECK( 8 );
- coverage = OTL_NEXT_USHORT( p );
- value1 = OTL_NEXT_USHORT( p );
- value2 = OTL_NEXT_USHORT( p );
- num_pairsets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_pairsets * 2 );
-
- for ( ; num_pairsets > 0; num_pairsets-- )
- otl_gpos_pairset_validate( table + OTL_NEXT_USHORT( p ),
- table, value1, value2, valid );
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, value1, value2, class1, class2;
- OTL_UInt num_classes1, num_classes2, len_value1, len_value2, count;
-
-
- OTL_CHECK( 14 );
- coverage = OTL_NEXT_USHORT( p );
- value1 = OTL_NEXT_USHORT( p );
- value2 = OTL_NEXT_USHORT( p );
- class1 = OTL_NEXT_USHORT( p );
- class2 = OTL_NEXT_USHORT( p );
- num_classes1 = OTL_NEXT_USHORT( p );
- num_classes2 = OTL_NEXT_USHORT( p );
-
- len_value1 = otl_value_length( value1 );
- len_value2 = otl_value_length( value2 );
-
- otl_coverage_validate( table + coverage, valid );
- otl_class_definition_validate( table + class1, valid );
- otl_class_definition_validate( table + class2, valid );
-
- OTL_CHECK( num_classes1 * num_classes2 *
- ( len_value1 + len_value2 ) );
-
- for ( ; num_classes1 > 0; num_classes1-- )
- {
- for ( count = num_classes2; count > 0; count-- )
- {
- otl_value_validate( p, table, value1, valid );
- p += len_value1;
-
- otl_value_validate( p, table, value2, valid );
- p += len_value2;
- }
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 3 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gpos_lookup3_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_entryexit, anchor1, anchor2;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_entryexit = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_entryexit * 4 );
-
- /* scan entry-exit records */
- for ( ; num_entryexit > 0; num_entryexit-- )
- {
- anchor1 = OTL_NEXT_USHORT( p );
- anchor2 = OTL_NEXT_USHORT( p );
-
- if ( anchor1 )
- otl_anchor_validate( table + anchor1, valid );
-
- if ( anchor2 )
- otl_anchor_validate( table + anchor2, valid );
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 4 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_base_array_validate( OTL_Bytes table,
- OTL_UInt class_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_bases, count;
-
-
- OTL_CHECK( 2 );
- num_bases = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_bases * class_count * 2 );
-
- /* scan base array records */
- for ( ; num_bases > 0; num_bases-- )
- /* scan base records */
- for ( count = class_count; count > 0; count-- )
- otl_anchor_validate( table + OTL_NEXT_USHORT( p ), valid );
- }
-
-
- static void
- otl_gpos_lookup4_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt mark_coverage, base_coverage, num_classes;
- OTL_UInt mark_array, base_array;
-
-
- OTL_CHECK( 10 );
- mark_coverage = OTL_NEXT_USHORT( p );
- base_coverage = OTL_NEXT_USHORT( p );
- num_classes = OTL_NEXT_USHORT( p );
- mark_array = OTL_NEXT_USHORT( p );
- base_array = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + mark_coverage, valid );
- otl_coverage_validate( table + base_coverage, valid );
-
- otl_mark_array_validate( table + mark_array, valid );
- otl_base_array_validate( table + base_array, num_classes, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 5 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* used by lookup type 5 and 6 */
- static void
- otl_liga_mark2_validate( OTL_Bytes table,
- OTL_UInt class_count,
- OTL_Bool maybe_zero,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_components, count;
-
-
- OTL_CHECK( 2 );
- num_components = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_components * class_count * 2 );
-
- /* scan component records */
- for ( ; num_components > 0; num_components-- )
- /* scan ligature anchor records */
- for ( count = class_count; count > 0; count-- )
- {
- OTL_UInt offset = OTL_NEXT_USHORT( p );
-
-
- if ( !offset && maybe_zero )
- continue;
-
- otl_anchor_validate( table + offset, valid );
- }
- }
-
-
- static void
- otl_liga_array_validate( OTL_Bytes table,
- OTL_UInt class_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt ligature_count;
-
-
- OTL_CHECK( 2 );
- ligature_count = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( ligature_count * 2 );
-
- /* scan ligature attach records */
- for ( ; ligature_count > 0; ligature_count-- )
- otl_liga_mark2_validate( table + OTL_NEXT_USHORT( p ), class_count, 1,
- valid );
- }
-
-
- static void
- otl_gpos_lookup5_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt mark_coverage, liga_coverage, num_classes;
- OTL_UInt mark_array, liga_array;
-
-
- OTL_CHECK( 10 );
- mark_coverage = OTL_NEXT_USHORT( p );
- liga_coverage = OTL_NEXT_USHORT( p );
- num_classes = OTL_NEXT_USHORT( p );
- mark_array = OTL_NEXT_USHORT( p );
- liga_array = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + mark_coverage, valid );
- otl_coverage_validate( table + liga_coverage, valid );
-
- otl_mark_array_validate( table + mark_array, valid );
- otl_liga_array_validate( table + liga_array, num_classes, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 6 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gpos_lookup6_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage1, coverage2, num_classes, array1, array2;
-
-
- OTL_CHECK( 10 );
- coverage1 = OTL_NEXT_USHORT( p );
- coverage2 = OTL_NEXT_USHORT( p );
- num_classes = OTL_NEXT_USHORT( p );
- array1 = OTL_NEXT_USHORT( p );
- array2 = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage1, valid );
- otl_coverage_validate( table + coverage2, valid );
-
- otl_mark_array_validate( table + array1, valid );
- otl_liga_mark2_validate( table + array2, num_classes, 0, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 7 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* used for both format 1 and 2 */
- static void
- otl_pos_rule_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_glyphs, num_pos;
-
-
- OTL_CHECK( 4 );
- num_glyphs = OTL_NEXT_USHORT( p );
- num_pos = OTL_NEXT_USHORT( p );
-
- if ( num_glyphs == 0 )
- OTL_INVALID_DATA;
-
- OTL_CHECK( ( num_glyphs - 1 ) * 2 + num_pos * 4 );
-
- for ( ; num_pos > 0; num_pos-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
-
- /* no need to check glyph indices/classes used as input for this */
- /* context rule since even invalid glyph indices/classes return a */
- /* meaningful result */
- }
-
-
- /* used for both format 1 and 2 */
- static void
- otl_pos_rule_set_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_posrules;
-
-
- OTL_CHECK( 2 );
- num_posrules = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_posrules * 2 );
-
- /* scan posrule records */
- for ( ; num_posrules > 0; num_posrules-- )
- otl_pos_rule_validate( table + OTL_NEXT_USHORT( p ), lookup_count,
- valid );
- }
-
-
- static void
- otl_gpos_lookup7_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_posrule_sets;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_posrule_sets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_posrule_sets * 2 );
-
- /* scan posrule set records */
- for ( ; num_posrule_sets > 0; num_posrule_sets-- )
- otl_pos_rule_set_validate( table + OTL_NEXT_USHORT( p ),
- lookup_count, valid );
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, class_def, num_posclass_sets;
-
-
- OTL_CHECK( 6 );
- coverage = OTL_NEXT_USHORT( p );
- class_def = OTL_NEXT_USHORT( p );
- num_posclass_sets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
- otl_class_definition_validate( table + class_def, valid );
-
- OTL_CHECK( num_posclass_sets * 2 );
-
- /* scan pos class set rules */
- for ( ; num_posclass_sets > 0; num_posclass_sets-- )
- {
- OTL_UInt offset = OTL_NEXT_USHORT( p );
-
-
- if ( offset )
- otl_pos_rule_set_validate( table + offset, lookup_count, valid );
- }
- }
- break;
-
- case 3:
- {
- OTL_UInt num_glyphs, num_pos, count;
-
-
- OTL_CHECK( 4 );
- num_glyphs = OTL_NEXT_USHORT( p );
- num_pos = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_glyphs * 2 + num_pos * 4 );
-
- for ( count = num_glyphs; count > 0; count-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- for ( ; num_pos > 0; num_pos-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 8 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* used for both format 1 and 2 */
- static void
- otl_chain_pos_rule_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_backtrack_glyphs, num_input_glyphs, num_lookahead_glyphs;
- OTL_UInt num_pos;
-
-
- OTL_CHECK( 2 );
- num_backtrack_glyphs = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_backtrack_glyphs * 2 + 2 );
- p += num_backtrack_glyphs * 2;
-
- num_input_glyphs = OTL_NEXT_USHORT( p );
- if ( num_input_glyphs == 0 )
- OTL_INVALID_DATA;
-
- OTL_CHECK( num_input_glyphs * 2 );
- p += ( num_input_glyphs - 1 ) * 2;
-
- num_lookahead_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_lookahead_glyphs * 2 + 2 );
- p += num_lookahead_glyphs * 2;
-
- num_pos = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_pos * 4 );
-
- for ( ; num_pos > 0; num_pos-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_input_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
-
- /* no need to check glyph indices/classes used as input for this */
- /* context rule since even invalid glyph indices/classes return a */
- /* meaningful result */
- }
-
-
- /* used for both format 1 and 2 */
- static void
- otl_chain_pos_rule_set_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_chain_subrules;
-
-
- OTL_CHECK( 2 );
- num_chain_subrules = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_chain_subrules * 2 );
-
- /* scan chain pos rule records */
- for ( ; num_chain_subrules > 0; num_chain_subrules-- )
- otl_chain_pos_rule_validate( table + OTL_NEXT_USHORT( p ),
- lookup_count, valid );
- }
-
-
- static void
- otl_gpos_lookup8_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_chain_pos_rulesets;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_chain_pos_rulesets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_chain_pos_rulesets * 2 );
-
- /* scan chain pos ruleset records */
- for ( ; num_chain_pos_rulesets > 0; num_chain_pos_rulesets-- )
- otl_chain_pos_rule_set_validate( table + OTL_NEXT_USHORT( p ),
- lookup_count, valid );
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, back_class, input_class, ahead_class;
- OTL_UInt num_chainpos_class_sets;
-
-
- OTL_CHECK( 10 );
- coverage = OTL_NEXT_USHORT( p );
- back_class = OTL_NEXT_USHORT( p );
- input_class = OTL_NEXT_USHORT( p );
- ahead_class = OTL_NEXT_USHORT( p );
- num_chainpos_class_sets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- otl_class_definition_validate( table + back_class, valid );
- otl_class_definition_validate( table + input_class, valid );
- otl_class_definition_validate( table + ahead_class, valid );
-
- OTL_CHECK( num_chainpos_class_sets * 2 );
-
- /* scan chainpos class set records */
- for ( ; num_chainpos_class_sets > 0; num_chainpos_class_sets-- )
- {
- OTL_UInt offset = OTL_NEXT_USHORT( p );
-
-
- if ( offset )
- otl_chain_pos_rule_set_validate( table + offset, lookup_count,
- valid );
- }
- }
- break;
-
- case 3:
- {
- OTL_UInt num_backtrack_glyphs, num_input_glyphs;
- OTL_UInt num_lookahead_glyphs, num_pos, count;
-
-
- OTL_CHECK( 2 );
-
- num_backtrack_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_backtrack_glyphs * 2 + 2 );
-
- for ( ; num_backtrack_glyphs > 0; num_backtrack_glyphs-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_input_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_input_glyphs * 2 + 2 );
-
- for ( count = num_input_glyphs; count > 0; count-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_lookahead_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_lookahead_glyphs * 2 + 2 );
-
- for ( ; num_lookahead_glyphs > 0; num_lookahead_glyphs-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_pos = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_pos * 4 );
-
- for ( ; num_pos > 0; num_pos-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_input_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS LOOKUP TYPE 9 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gpos_lookup9_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt lookup_type, lookup_offset;
- OTL_ValidateFunc validate;
-
-
- OTL_CHECK( 6 );
- lookup_type = OTL_NEXT_USHORT( p );
- lookup_offset = OTL_NEXT_ULONG( p );
-
- if ( lookup_type == 0 || lookup_type >= 9 )
- OTL_INVALID_DATA;
-
- validate = otl_gpos_validate_funcs[lookup_type - 1];
- validate( table + lookup_offset, lookup_count, glyph_count, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- static OTL_ValidateFunc otl_gpos_validate_funcs[9] =
- {
- otl_gpos_lookup1_validate,
- otl_gpos_lookup2_validate,
- otl_gpos_lookup3_validate,
- otl_gpos_lookup4_validate,
- otl_gpos_lookup5_validate,
- otl_gpos_lookup6_validate,
- otl_gpos_lookup7_validate,
- otl_gpos_lookup8_validate,
- otl_gpos_lookup9_validate
- };
-
-
- OTL_LOCALDEF( void )
- otl_gpos_subtable_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- otl_lookup_validate( table, 9, otl_gpos_validate_funcs,
- lookup_count, glyph_count, valid );
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GPOS TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- OTL_LOCALDEF( void )
- otl_gpos_validate( OTL_Bytes table,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt scripts, features, lookups;
-
-
- OTL_CHECK( 10 );
-
- if ( OTL_NEXT_USHORT( p ) != 0x10000UL )
- OTL_INVALID_DATA;
-
- scripts = OTL_NEXT_USHORT( p );
- features = OTL_NEXT_USHORT( p );
- lookups = OTL_NEXT_USHORT( p );
-
- otl_lookup_list_validate( table + lookups, 9, otl_gpos_validate_funcs,
- glyph_count, valid );
- otl_feature_list_validate( table + features, table + lookups, valid );
- otl_script_list_validate( table + scripts, table + features, valid );
- }
-
-
-/* END */
--- a/src/otlayout/otlgpos.h
+++ /dev/null
@@ -1,44 +1,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 */
--- a/src/otlayout/otlgsub.c
+++ /dev/null
@@ -1,1069 +1,0 @@
-/***************************************************************************/
-/* */
-/* otlgsub.c */
-/* */
-/* OpenType layout support, GSUB 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 "otlgsub.h"
-#include "otlcommn.h"
-#include "otlparse.h"
-
-
- /* forward declaration */
- static OTL_ValidateFunc otl_gsub_validate_funcs[];
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 1 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*
- * 1: Single Substitution - Table format(s)
- *
- * This table is used to substitute individual glyph indices
- * with another one. There are only two sub-formats:
- *
- * Name Offset Size Description
- * --------------------------------------------------------------
- * format 0 2 sub-table format (1)
- * offset 2 2 offset to coverage table
- * delta 4 2 16-bit delta to apply on all
- * covered glyph indices
- *
- * Name Offset Size Description
- * --------------------------------------------------------------
- * format 0 2 sub-table format (2)
- * offset 2 2 offset to coverage table
- * count 4 2 coverage table count
- * substs[] 6 2*count substituted glyph indices,
- *
- */
-
- static void
- otl_gsub_lookup1_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
-
- switch ( format )
- {
- case 1:
- {
- OTL_Bytes coverage;
- OTL_Int delta;
- OTL_Long idx;
-
-
- OTL_CHECK( 4 );
- coverage = table + OTL_NEXT_USHORT( p );
- delta = OTL_NEXT_SHORT( p );
-
- otl_coverage_validate( coverage, valid );
-
- idx = otl_coverage_get_first( coverage ) + delta;
- if ( idx < 0 )
- OTL_INVALID_DATA;
-
- idx = otl_coverage_get_last( coverage ) + delta;
- if ( (OTL_UInt)idx >= glyph_count )
- OTL_INVALID_DATA;
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, num_glyphs;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_glyphs = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_glyphs * 2 );
-
- for ( ; num_glyphs > 0; num_glyphs-- )
- if ( OTL_NEXT_USHORT( p ) >= glyph_count )
- OTL_INVALID_DATA;
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
-#if 0
- static OTL_Bool
- otl_gsub_lookup1_apply( OTL_Bytes table,
- OTL_Parser parser )
- {
- OTL_Bytes p = table;
- OTL_Bytes coverage;
- OTL_UInt format, gindex, property;
- OTL_Long index;
- OTL_Bool subst = 0;
-
-
- if ( parser->context_len != 0xFFFFU && parser->context_len < 1 )
- goto Exit;
-
- gindex = otl_parser_get_gindex( parser );
-
- otl_parser_check_property( parser, gindex, &property );
- if ( parser->error )
- goto Exit;
-
- format = OTL_NEXT_USHORT(p);
- coverage = table + OTL_NEXT_USHORT(p);
- index = otl_coverage_get_index( coverage, gindex );
-
- if ( index >= 0 )
- {
- switch ( format )
- {
- case 1:
- {
- OTL_Int delta = OTL_NEXT_SHORT( p );
-
-
- gindex = ( gindex + delta ) & 0xFFFFU;
- otl_parser_replace_1( parser, gindex );
- subst = 1;
- }
- break;
-
- case 2:
- {
- OTL_UInt count = OTL_NEXT_USHORT( p );
-
-
- if ( (OTL_UInt)index < count )
- {
- p += index * 2;
- otl_parser_replace_1( parser, OTL_PEEK_USHORT( p ) );
- subst = 1;
- }
- }
- break;
-
- default:
- ;
- }
- }
-
- Exit:
- return subst;
- }
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 2 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*
- * 2: Multiple Substitution - Table format(s)
- *
- * Replaces a single glyph with one or more glyphs.
- *
- * Name Offset Size Description
- * --------------------------------------------------------------
- * format 0 2 sub-table format (1)
- * offset 2 2 offset to coverage table
- * count 4 2 coverage table count
- * sequencess[] 6 2*count offsets to sequence items
- *
- * each sequence item has the following format:
- *
- * Name Offset Size Description
- * --------------------------------------------------------------
- * count 0 2 number of replacement glyphs
- * gindices[] 2 2*count string of glyph indices
- *
- */
-
- static void
- otl_sequence_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 );
-
- /* according to the specification, `num_glyphs' should be > 0; */
- /* we can deal with these cases pretty well, however */
-
- OTL_CHECK( num_glyphs * 2 );
-
- for ( ; num_glyphs > 0; num_glyphs-- )
- if ( OTL_NEXT_USHORT( p ) >= glyph_count )
- OTL_INVALID_DATA;
- }
-
-
- static void
- otl_gsub_lookup2_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_sequences;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_sequences = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_sequences * 2 );
-
- /* scan sequence records */
- for ( ; num_sequences > 0; num_sequences-- )
- otl_sequence_validate( table + OTL_NEXT_USHORT( p ), glyph_count,
- valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
-#if 0
- static OTL_Bool
- otl_gsub_lookup2_apply( OTL_Bytes table,
- OTL_Parser parser )
- {
- OTL_Bytes p = table;
- OTL_Bytes coverage, sequence;
- OTL_UInt format, gindex, property, context_len, seq_count, count;
- OTL_Long index;
- OTL_Bool subst = 0;
-
-
- if ( parser->context_len != 0xFFFFU && parser->context_len < 1 )
- goto Exit;
-
- gindex = otl_parser_get_gindex( parser );
-
- otl_parser_check_property( parser, gindex, &property );
- if ( parser->error )
- goto Exit;
-
- p += 2; /* skip format */
- coverage = table + OTL_NEXT_USHORT( p );
- seq_count = OTL_NEXT_USHORT( p );
- index = otl_coverage_get_index( coverage, gindex );
-
- if ( (OTL_UInt)index >= seq_count || index < 0 )
- goto Exit;
-
- p += index * 2;
- sequence = table + OTL_PEEK_USHORT( p );
- p = sequence;
- count = OTL_NEXT_USHORT( p );
-
- otl_parser_replace_n( parser, count, p );
- subst = 1;
-
- Exit:
- return subst;
- }
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 3 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /*
- * 3: Alternate Substitution - Table format(s)
- *
- * Replaces a single glyph by another one taken liberally
- * in a list of alternatives.
- *
- * Name Offset Size Description
- * ---------------------------------------------------------------
- * format 0 2 sub-table format (1)
- * offset 2 2 offset to coverage table
- * count 4 2 coverage table count
- * alternates[] 6 2*count offsets to alternate items
- *
- * each alternate item has the following format:
- *
- * Name Offset Size Description
- * ---------------------------------------------------------------
- * count 0 2 number of replacement glyphs
- * gindices[] 2 2*count string of glyph indices, each
- * one is a valid alternative
- *
- */
-
- static void
- otl_alternate_set_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_gsub_lookup3_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_alternate_sets;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_alternate_sets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_alternate_sets * 2 );
-
- /* scan alternate set records */
- for ( ; num_alternate_sets > 0; num_alternate_sets-- )
- otl_alternate_set_validate( table + OTL_NEXT_USHORT( p ),
- glyph_count, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
-#if 0
- static OTL_Bool
- otl_gsub_lookup3_apply( OTL_Bytes table,
- OTL_Parser parser )
- {
- OTL_Bytes p = table;
- OTL_Bytes coverage, alternates;
- OTL_UInt format, gindex, property, seq_count, count;
- OTL_Long index;
- OTL_Bool subst = 0;
-
- OTL_GSUB_Alternate alternate = parser->alternate;
-
-
- if ( parser->context_len != 0xFFFFU && parser->context_len < 1 )
- goto Exit;
-
- if ( alternate == 0 )
- goto Exit;
-
- gindex = otl_parser_get_gindex( parser );
-
- otl_parser_check_property( parser, gindex, &property );
- if ( parser->error )
- goto Exit;
-
- p += 2; /* skip format */
- coverage = table + OTL_NEXT_USHORT( p );
- seq_count = OTL_NEXT_USHORT( p );
- index = otl_coverage_get_index( coverage, gindex );
-
- if ( (OTL_UInt)index >= seq_count || index < 0 )
- goto Exit;
-
- p += index * 2;
- alternates = table + OTL_PEEK_USHORT( p );
- p = alternates;
- count = OTL_NEXT_USHORT( p );
-
- gindex = alternate->handler_func(
- gindex, count, p, alternate->handler_data );
-
- otl_parser_replace_1( parser, gindex );
- subst = 1;
-
- Exit:
- return subst;
- }
-#endif
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 4 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_ligature_validate( OTL_Bytes table,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt glyph_id, num_components;
-
-
- OTL_CHECK( 4 );
- glyph_id = OTL_NEXT_USHORT( p );
- if ( glyph_id >= glyph_count )
- OTL_INVALID_DATA;
-
- num_components = OTL_NEXT_USHORT( p );
-
- if ( num_components == 0 )
- OTL_INVALID_DATA;
-
- num_components--;
-
- OTL_CHECK( num_components * 2 );
- }
-
-
- static void
- otl_ligature_set_validate( OTL_Bytes table,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_ligatures;
-
-
- OTL_CHECK( 2 );
- num_ligatures = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_ligatures * 2 );
-
- /* scan ligature records */
- for ( ; num_ligatures > 0; num_ligatures-- )
- otl_ligature_validate( table + OTL_NEXT_USHORT( p ), glyph_count,
- valid );
- }
-
-
- static void
- otl_gsub_lookup4_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( lookup_count);
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_ligsets;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_ligsets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_ligsets * 2 );
-
- /* scan ligature set records */
- for ( ; num_ligsets > 0; num_ligsets-- )
- otl_ligature_set_validate( table + OTL_NEXT_USHORT( p ),
- glyph_count, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 5 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* used for both format 1 and 2 */
- static void
- otl_sub_rule_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_glyphs, num_subst;
-
-
- OTL_CHECK( 4 );
- num_glyphs = OTL_NEXT_USHORT( p );
- num_subst = OTL_NEXT_USHORT( p );
-
- if ( num_glyphs == 0 )
- OTL_INVALID_DATA;
-
- OTL_CHECK( ( num_glyphs - 1 ) * 2 + num_subst * 4 );
-
- for ( ; num_subst > 0; num_subst-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
-
- /* no need to check glyph indices/classes used as input for this */
- /* context rule since even invalid glyph indices/classes return a */
- /* meaningful result */
- }
-
-
- /* used for both format 1 and 2 */
- static void
- otl_sub_rule_set_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_subrules;
-
-
- OTL_CHECK( 2 );
- num_subrules = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_subrules * 2 );
-
- /* scan subrule records */
- for ( ; num_subrules > 0; num_subrules-- )
- otl_sub_rule_validate( table + OTL_NEXT_USHORT( p ), lookup_count,
- valid );
- }
-
-
- static void
- otl_gsub_lookup5_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_subrulesets;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_subrulesets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_subrulesets * 2 );
-
- /* scan subrule set records */
- for ( ; num_subrulesets > 0; num_subrulesets-- )
- otl_sub_rule_set_validate( table + OTL_NEXT_USHORT( p ),
- lookup_count, valid );
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, class_def, num_subclass_sets;
-
-
- OTL_CHECK( 6 );
- coverage = OTL_NEXT_USHORT( p );
- class_def = OTL_NEXT_USHORT( p );
- num_subclass_sets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
- otl_class_definition_validate( table + class_def, valid );
-
- OTL_CHECK( num_subclass_sets * 2 );
-
- /* scan subclass set records */
- for ( ; num_subclass_sets > 0; num_subclass_sets-- )
- {
- OTL_UInt offset = OTL_NEXT_USHORT( p );
-
-
- if ( offset )
- otl_sub_rule_set_validate( table + offset, lookup_count, valid );
- }
- }
- break;
-
- case 3:
- {
- OTL_UInt num_glyphs, num_subst, count;
-
-
- OTL_CHECK( 4 );
- num_glyphs = OTL_NEXT_USHORT( p );
- num_subst = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_glyphs * 2 + num_subst * 4 );
-
- for ( count = num_glyphs; count > 0; count-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- for ( ; num_subst > 0; num_subst-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 6 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- /* used for both format 1 and 2 */
- static void
- otl_chain_sub_rule_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_backtrack_glyphs, num_input_glyphs, num_lookahead_glyphs;
- OTL_UInt num_subst;
-
-
- OTL_CHECK( 2 );
- num_backtrack_glyphs = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_backtrack_glyphs * 2 + 2 );
- p += num_backtrack_glyphs * 2;
-
- num_input_glyphs = OTL_NEXT_USHORT( p );
- if ( num_input_glyphs == 0 )
- OTL_INVALID_DATA;
-
- OTL_CHECK( num_input_glyphs * 2 );
- p += ( num_input_glyphs - 1 ) * 2;
-
- num_lookahead_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_lookahead_glyphs * 2 + 2 );
- p += num_lookahead_glyphs * 2;
-
- num_subst = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_subst * 4 );
-
- for ( ; num_subst > 0; num_subst-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_input_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
-
- /* no need to check glyph indices/classes used as input for this */
- /* context rule since even invalid glyph indices/classes return a */
- /* meaningful result */
- }
-
-
- /* used for both format 1 and 2 */
- static void
- otl_chain_sub_rule_set_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt num_chain_subrules;
-
-
- OTL_CHECK( 2 );
- num_chain_subrules = OTL_NEXT_USHORT( p );
-
- OTL_CHECK( num_chain_subrules * 2 );
-
- /* scan chain subst rule records */
- for ( ; num_chain_subrules > 0; num_chain_subrules-- )
- otl_chain_sub_rule_validate( table + OTL_NEXT_USHORT( p ),
- lookup_count, valid );
- }
-
-
- static void
- otl_gsub_lookup6_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
- OTL_UNUSED( glyph_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt coverage, num_chain_subrulesets;
-
-
- OTL_CHECK( 4 );
- coverage = OTL_NEXT_USHORT( p );
- num_chain_subrulesets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- OTL_CHECK( num_chain_subrulesets * 2 );
-
- /* scan chain subrule set records */
- for ( ; num_chain_subrulesets > 0; num_chain_subrulesets-- )
- otl_chain_sub_rule_set_validate( table + OTL_NEXT_USHORT( p ),
- lookup_count, valid );
- }
- break;
-
- case 2:
- {
- OTL_UInt coverage, back_class, input_class, ahead_class;
- OTL_UInt num_chain_subclass_sets;
-
-
- OTL_CHECK( 10 );
- coverage = OTL_NEXT_USHORT( p );
- back_class = OTL_NEXT_USHORT( p );
- input_class = OTL_NEXT_USHORT( p );
- ahead_class = OTL_NEXT_USHORT( p );
- num_chain_subclass_sets = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( table + coverage, valid );
-
- otl_class_definition_validate( table + back_class, valid );
- otl_class_definition_validate( table + input_class, valid );
- otl_class_definition_validate( table + ahead_class, valid );
-
- OTL_CHECK( num_chain_subclass_sets * 2 );
-
- /* scan chain subclass set records */
- for ( ; num_chain_subclass_sets > 0; num_chain_subclass_sets-- )
- {
- OTL_UInt offset = OTL_NEXT_USHORT( p );
-
-
- if ( offset )
- otl_chain_sub_rule_set_validate( table + offset, lookup_count,
- valid );
- }
- }
- break;
-
- case 3:
- {
- OTL_UInt num_backtrack_glyphs, num_input_glyphs;
- OTL_UInt num_lookahead_glyphs, num_subst, count;
-
-
- OTL_CHECK( 2 );
-
- num_backtrack_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_backtrack_glyphs * 2 + 2 );
-
- for ( ; num_backtrack_glyphs > 0; num_backtrack_glyphs-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_input_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_input_glyphs * 2 + 2 );
-
- for ( count = num_input_glyphs; count > 0; count-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_lookahead_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_lookahead_glyphs * 2 + 2 );
-
- for ( ; num_lookahead_glyphs > 0; num_lookahead_glyphs-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_subst = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_subst * 4 );
-
- for ( ; num_subst > 0; num_subst-- )
- {
- if ( OTL_NEXT_USHORT( p ) >= num_input_glyphs )
- OTL_INVALID_DATA;
-
- if ( OTL_NEXT_USHORT( p ) >= lookup_count )
- OTL_INVALID_DATA;
- }
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 7 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gsub_lookup7_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt format;
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- {
- OTL_UInt lookup_type, lookup_offset;
- OTL_ValidateFunc validate;
-
-
- OTL_CHECK( 6 );
- lookup_type = OTL_NEXT_USHORT( p );
- lookup_offset = OTL_NEXT_ULONG( p );
-
- if ( lookup_type == 0 || lookup_type == 7 || lookup_type > 8 )
- OTL_INVALID_DATA;
-
- validate = otl_gsub_validate_funcs[lookup_type - 1];
- validate( table + lookup_offset, lookup_count, glyph_count, valid );
- }
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB LOOKUP TYPE 8 *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- static void
- otl_gsub_lookup8_validate( OTL_Bytes table,
- OTL_UInt lookup_count,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table, coverage;
- OTL_UInt format;
- OTL_UInt num_backtrack_glyphs, num_lookahead_glyphs, num_glyphs;
-
- OTL_UNUSED( lookup_count );
-
-
- OTL_CHECK( 2 );
- format = OTL_NEXT_USHORT( p );
- switch ( format )
- {
- case 1:
- OTL_CHECK( 4 );
-
- coverage = table + OTL_NEXT_USHORT( p );
- num_backtrack_glyphs = OTL_NEXT_USHORT( p );
-
- otl_coverage_validate( coverage, valid );
-
- OTL_CHECK( num_backtrack_glyphs * 2 + 2 );
-
- for ( ; num_backtrack_glyphs > 0; num_backtrack_glyphs-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_lookahead_glyphs = OTL_NEXT_USHORT( p );
- OTL_CHECK( num_lookahead_glyphs * 2 + 2 );
-
- for ( ; num_lookahead_glyphs > 0; num_lookahead_glyphs-- )
- otl_coverage_validate( table + OTL_NEXT_USHORT( p ), valid );
-
- num_glyphs = OTL_NEXT_USHORT( p );
- if ( num_glyphs != otl_coverage_get_count( coverage ) )
- OTL_INVALID_DATA;
-
- OTL_CHECK( num_glyphs * 2 );
-
- for ( ; num_glyphs > 0; num_glyphs-- )
- if ( OTL_NEXT_USHORT( p ) >= glyph_count )
- OTL_INVALID_DATA;
-
- break;
-
- default:
- OTL_INVALID_DATA;
- }
- }
-
-
- static OTL_ValidateFunc otl_gsub_validate_funcs[8] =
- {
- otl_gsub_lookup1_validate,
- otl_gsub_lookup2_validate,
- otl_gsub_lookup3_validate,
- otl_gsub_lookup4_validate,
- otl_gsub_lookup5_validate,
- otl_gsub_lookup6_validate,
- otl_gsub_lookup7_validate,
- otl_gsub_lookup8_validate
- };
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** GSUB TABLE *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
- OTL_LOCALDEF( void )
- otl_gsub_validate( OTL_Bytes table,
- OTL_UInt glyph_count,
- OTL_Validator valid )
- {
- OTL_Bytes p = table;
- OTL_UInt scripts, features, lookups;
-
-
- OTL_CHECK( 10 );
-
- if ( OTL_NEXT_USHORT( p ) != 0x10000UL )
- OTL_INVALID_DATA;
-
- scripts = OTL_NEXT_USHORT( p );
- features = OTL_NEXT_USHORT( p );
- lookups = OTL_NEXT_USHORT( p );
-
- otl_lookup_list_validate( table + lookups, 8, otl_gsub_validate_funcs,
- glyph_count, valid );
- otl_feature_list_validate( table + features, table + lookups, valid );
- otl_script_list_validate( table + scripts, table + features, valid );
- }
-
-
-/* END */
--- a/src/otlayout/otlgsub.h
+++ /dev/null
@@ -1,52 +1,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 */
--- a/src/otlayout/otljstf.c
+++ /dev/null
@@ -1,262 +1,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 */
--- a/src/otlayout/otljstf.h
+++ /dev/null
@@ -1,44 +1,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 */
--- a/src/otlayout/otlparse.c
+++ /dev/null
@@ -1,144 +1,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;
- }
--- a/src/otlayout/otlparse.h
+++ /dev/null
@@ -1,100 +1,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__ */
--- a/src/otlayout/otltable.h
+++ /dev/null
@@ -1,62 +1,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__ */
--- a/src/otlayout/otltags.h
+++ /dev/null
@@ -1,87 +1,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
--- a/src/otlayout/otlutils.h
+++ /dev/null
@@ -1,33 +1,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__ */