* src/otlayout/otljstf.c (otl_jstf_gsub_mods_validate): Removed.

(otl_jstf_gpos_mods_validate): Renamed to...
(otl_jstf_gsubgpos_mods_validate): This.
Test whether lookup_count is zero.
(otl_jstf_priority_validate): Use otl_jstf_gsubgpos_mods_validate.
(otl_jstf_validate): Initialize gsub_lookup_count and
gpos_lookup_count if gsub or gpos is zero.

* src/otlayout/otlgsub.c: Rename counting variables to be more
meaningful.
Add copyright.
(otl_gsub_lookup1_validate): Simplify code.
(otl_gsub_lookup2_validate, otl_gsub_lookup3_validate,
otl_gsub_lookup4_validate, otl_gsub_lookup7_validate): Remove unused
variables.
(otl_gsub_lookup5_validate): Remove unused variable.
Fix call to otl_sub_rule_set_validate and
otl_sub_class_rule_set_validate.
(otl_chain_sub_class_rule_validate,
otl_chain_sub_class_set_validate): Removed.
(otl_gsub_lookup6_validate): Remove unused variable.
Fix call to otl_chain_sub_rule_set_validate.
(otl_gsub_lookup7_validate): Handle lookup type 8 also.
(otl_gsub_lookup8_validate: New function.
(otl_gsub_lookup1_apply, otl_gsub_lookup2_apply,
otl_gsub_lookup3_apply): Commented out.
(otl_gsub_validate_funcs): Add otl_gsub_lookup7_validate and
otl_gsub_lookup8_validate.
(otl_gsub_validate): Updated.

* src/otlayout/otlgsub.h: Add copyright.

* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h
(otl_coverage_get_index): Comment out.
This commit is contained in:
Werner Lemberg 2004-08-14 07:20:43 +00:00
parent 373541e011
commit 61249b6ef2
7 changed files with 624 additions and 447 deletions

View File

@ -1,3 +1,40 @@
2004-08-14 Werner Lemberg <wl@gnu.org>
* src/otlayout/otljstf.c (otl_jstf_gsub_mods_validate): Removed.
(otl_jstf_gpos_mods_validate): Renamed to...
(otl_jstf_gsubgpos_mods_validate): This.
Test whether lookup_count is zero.
(otl_jstf_priority_validate): Use otl_jstf_gsubgpos_mods_validate.
(otl_jstf_validate): Initialize gsub_lookup_count and
gpos_lookup_count if gsub or gpos is zero.
* src/otlayout/otlgsub.c: Rename counting variables to be more
meaningful.
Add copyright.
(otl_gsub_lookup1_validate): Simplify code.
(otl_gsub_lookup2_validate, otl_gsub_lookup3_validate,
otl_gsub_lookup4_validate, otl_gsub_lookup7_validate): Remove unused
variables.
(otl_gsub_lookup5_validate): Remove unused variable.
Fix call to otl_sub_rule_set_validate and
otl_sub_class_rule_set_validate.
(otl_chain_sub_class_rule_validate,
otl_chain_sub_class_set_validate): Removed.
(otl_gsub_lookup6_validate): Remove unused variable.
Fix call to otl_chain_sub_rule_set_validate.
(otl_gsub_lookup7_validate): Handle lookup type 8 also.
(otl_gsub_lookup8_validate: New function.
(otl_gsub_lookup1_apply, otl_gsub_lookup2_apply,
otl_gsub_lookup3_apply): Commented out.
(otl_gsub_validate_funcs): Add otl_gsub_lookup7_validate and
otl_gsub_lookup8_validate.
(otl_gsub_validate): Updated.
* src/otlayout/otlgsub.h: Add copyright.
* src/otlayout/otlcommn.c, src/otlayout/otlcommn.h
(otl_coverage_get_index): Comment out.
2004-08-13 Werner Lemberg <wl@gnu.org>
* src/otlayout/otlcommn.c (otl_gsubgpos_get_lookup_count): New

View File

@ -47,7 +47,6 @@
OTL_CHECK( num_glyphs * 2 );
/* XXX: check glyph indices */
}
break;
@ -81,6 +80,9 @@
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 */
}
@ -122,6 +124,7 @@
}
#if 0
OTL_LOCALDEF( OTL_Long )
otl_coverage_get_index( OTL_Bytes table,
OTL_UInt glyph_index )
@ -186,6 +189,7 @@
return -1;
}
#endif
/*************************************************************************/
@ -219,7 +223,6 @@
OTL_CHECK( num_glyphs * 2 );
/* XXX: check glyph indices */
}
break;
@ -249,6 +252,9 @@
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 */
}

View File

@ -41,11 +41,13 @@ OTL_BEGIN_HEADER
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
/*************************************************************************/

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,21 @@
/***************************************************************************/
/* */
/* 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__
@ -5,10 +23,12 @@
OTL_BEGIN_HEADER
typedef OTL_UInt (*OTL_GSUB_AlternateFunc)( OTL_UInt gindex,
OTL_UInt count,
OTL_Bytes alternates,
OTL_Pointer data );
typedef OTL_UInt
(*OTL_GSUB_AlternateFunc)( OTL_UInt gindex,
OTL_UInt count,
OTL_Bytes alternates,
OTL_Pointer data );
typedef struct OTL_GSUB_AlternateRec_
{
@ -26,3 +46,6 @@ OTL_BEGIN_HEADER
OTL_END_HEADER
#endif /* __OTLGSUB_H__ */
/* END */

View File

@ -40,9 +40,9 @@
static void
otl_jstf_gsub_mods_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_Validator valid )
otl_jstf_gsubgpos_mods_validate( OTL_Bytes table,
OTL_UInt lookup_count,
OTL_Validator valid )
{
OTL_Bytes p = table;
OTL_UInt num_lookups;
@ -52,28 +52,12 @@
num_lookups = OTL_NEXT_USHORT( p );
OTL_CHECK( num_lookups * 2 );
for ( ; num_lookups > 0; num_lookups-- )
if ( OTL_NEXT_USHORT( p ) >= lookup_count )
OTL_INVALID_DATA;
}
static void
otl_jstf_gpos_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 );
for ( ; num_lookups > 0; num_lookups-- )
if ( OTL_NEXT_USHORT( p ) >= lookup_count )
OTL_INVALID_DATA;
if ( lookup_count )
{
for ( ; num_lookups > 0; num_lookups-- )
if ( OTL_NEXT_USHORT( p ) >= lookup_count )
OTL_INVALID_DATA;
}
}
@ -111,20 +95,24 @@
/* shrinkage GSUB enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsub_mods_validate( table + val, gsub_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsub_mods_validate( table + val, gsub_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
/* shrinkage GPOS enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gpos_mods_validate( table + val, gpos_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gpos_mods_validate( table + val, gpos_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
/* shrinkage JSTF max */
val = OTL_NEXT_USHORT( p );
@ -134,20 +122,24 @@
/* extension GSUB enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsub_mods_validate( table + val, gsub_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gsub_mods_validate( table + val, gsub_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gsub_lookup_count,
valid );
/* extension GPOS enable/disable */
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gpos_mods_validate( table + val, gpos_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
val = OTL_NEXT_USHORT( p );
if ( val )
otl_jstf_gpos_mods_validate( table + val, gpos_lookup_count, valid );
otl_jstf_gsubgpos_mods_validate( table + val, gpos_lookup_count,
valid );
/* extension JSTF max */
val = OTL_NEXT_USHORT( p );
@ -231,8 +223,15 @@
num_scripts = OTL_NEXT_USHORT( p );
OTL_CHECK( num_scripts * 6 );
gsub_lookup_count = otl_gsubgpos_get_lookup_count( gsub );
gpos_lookup_count = otl_gsubgpos_get_lookup_count( gpos );
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-- )

View File

@ -25,8 +25,9 @@
OTL_BEGIN_HEADER
/* validate JSTF table */
/* GSUB and GPOS tables must already be validated */
/* validate JSTF table */
/* GSUB and GPOS tables must already be validated; if table is */
/* missing, set value to 0 */
OTL_LOCAL( void )
otl_jstf_validate( OTL_Bytes table,
OTL_Bytes gsub,