if ((error = HB_Done_GSUB_Table (gsub)))
croak ("HB_Done_GSUB_Table", error);
}
- else if (error != HB_Err_Table_Missing)
+ else if (error != HB_Err_Not_Covered)
fprintf (stderr, "HB_Load_GSUB_Table %x\n", error);
if (!(error = HB_Load_GPOS_Table (face, &gpos, NULL)))
if ((error = HB_Done_GPOS_Table (gpos)))
croak ("HB_Done_GPOS_Table", error);
}
- else if (error != HB_Err_Table_Missing)
+ else if (error != HB_Err_Not_Covered)
fprintf (stderr, "HB_Load_GPOS_Table %x\n", error);
printf ("</OpenType>\n");
DUMP1("<FeatureIndex>%d</FeatureIndex>\n", LangSys->FeatureIndex[i]);
}
-DEF_DUMP (Script)
+DEF_DUMP (ScriptTable)
{
int i;
- RECURSE (DefaultLangSys, LangSys, &Script->DefaultLangSys);
+ RECURSE (DefaultLangSys, LangSys, &ScriptTable->DefaultLangSys);
- DUMP_FUINT (Script, LangSysCount);
+ DUMP_FUINT (ScriptTable, LangSysCount);
- for (i=0; i < Script->LangSysCount; i++)
+ for (i=0; i < ScriptTable->LangSysCount; i++)
{
do_indent (stream, indent);
fprintf (stream, "<LangSysTag>");
- Print_Tag (Script->LangSysRecord[i].LangSysTag, stream);
+ Print_Tag (ScriptTable->LangSysRecord[i].LangSysTag, stream);
fprintf (stream, "</LangSysTag>\n");
- RECURSE_NUM (LangSys, i, LangSys, &Script->LangSysRecord[i].LangSys);
+ RECURSE_NUM (LangSys, i, LangSys, &ScriptTable->LangSysRecord[i].LangSys);
}
}
fprintf (stream, "<ScriptTag>");
Print_Tag (ScriptList->ScriptRecord[i].ScriptTag, stream);
fprintf (stream, "</ScriptTag>\n");
- RECURSE_NUM (Script, i, Script, &ScriptList->ScriptRecord[i].Script);
+ RECURSE_NUM (Script, i, ScriptTable, &ScriptList->ScriptRecord[i].Script);
}
}
static void Free_AttachList( HB_AttachList* al );
static void Free_LigCaretList( HB_LigCaretList* lcl );
+
static void Free_NewGlyphClasses( HB_GDEFHeader* gdef );
if ( !_engine )
- return HB_Err_Invalid_Engine;
+ return ERR(HB_Err_Invalid_Engine);
return HB_Register_Extension( _engine,
GDEF_ID,
HB_GDEFHeader* gdef;
if ( !retptr )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
if ( ALLOC( gdef, sizeof( *gdef ) ) )
return error;
if ( !retptr )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
if ( GOTO_Table( TTAG_GDEF ) )
return error;
break;
default:
- return _hb_err(HB_Err_Invalid_GDEF_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok;
if ( !gdef || !property )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
/* first, we check for mark attach classes */
if ( !gdef || !glyph_array || !class_array )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gcd = &gdef->GlyphClassDef;
if ( curr_class >= 5 )
{
- error = HB_Err_Invalid_Argument;
+ error = ERR(HB_Err_Invalid_Argument);
goto Fail4;
}
{
if ( curr_glyph == 0xFFFF )
{
- error = HB_Err_Invalid_Argument;
+ error = ERR(HB_Err_Invalid_Argument);
goto Fail3;
}
else
if ( curr_glyph > glyph_array[n] )
{
- error = HB_Err_Invalid_Argument;
+ error = ERR(HB_Err_Invalid_Argument);
goto Fail3;
}
if ( curr_class >= 5 )
{
- error = HB_Err_Invalid_Argument;
+ error = ERR(HB_Err_Invalid_Argument);
goto Fail3;
}
{
if ( curr_glyph == 0xFFFF )
{
- error = HB_Err_Invalid_Argument;
+ error = ERR(HB_Err_Invalid_Argument);
goto Fail3;
}
else
break;
default:
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
}
count = gdef->GlyphClassDef.cd.cd2.ClassRangeCount;
HB_BEGIN_HEADER
-#define HB_Err_Invalid_GDEF_SubTable_Format 0x1030
-#define HB_Err_Invalid_GDEF_SubTable 0x1031
-
/* GDEF glyph properties. Note that HB_GDEF_COMPONENT has no corresponding
* flag in the LookupFlag field. */
typedef int HB_Bool;
-/* compatible with FT_Error */
typedef enum {
- HB_Err_Invalid_Argument = FT_Err_Invalid_Argument,
- HB_Err_Invalid_Face_Handle = FT_Err_Invalid_Face_Handle,
- HB_Err_Invalid_Stream_Operation = FT_Err_Invalid_Stream_Operation,
- HB_Err_Empty_Script = 0x1005,
-
- HB_Err_Ok = FT_Err_Ok,
- HB_Err_Not_Covered = 0x1002,
- HB_Err_Out_Of_Memory = FT_Err_Out_Of_Memory,
- HB_Err_Table_Missing = FT_Err_Table_Missing,
- HB_Err_Invalid_SubTable_Format = 0x1000,
- HB_Err_Invalid_SubTable = 0x1001,
- HB_Err_Too_Many_Nested_Contexts = 0x1003,
- HB_Err_No_MM_Interpreter = 0x1004
+ /* no error */
+ HB_Err_Ok = 0x0000,
+ HB_Err_Not_Covered = 0xFFFF,
+
+ /* _hb_err() is called whenever returning the following errors,
+ * and in a couple places for HB_Err_Not_Covered too. */
+
+ /* programmer error */
+ HB_Err_Invalid_Argument = 0x1A66,
+
+ /* font error */
+ HB_Err_Invalid_SubTable_Format = 0x157F,
+ HB_Err_Invalid_SubTable = 0x1570,
+ HB_Err_Read_Error = 0x6EAD,
+
+ /* system error */
+ HB_Err_Out_Of_Memory = 0xDEAD
} HB_Error;
HB_END_HEADER
HB_UNUSED(metric_id);
HB_UNUSED(metric_value);
HB_UNUSED(data);
- return _hb_err(HB_Err_No_MM_Interpreter);
+ return ERR(HB_Err_Not_Covered); /* ERR() call intended */
}
if ( !retptr )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
if ( GOTO_Table( TTAG_GPOS ) )
return error;
break;
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok;
return error;
if ( gpi->face->glyph->format != ft_glyph_format_outline )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
ap = an->af.af2.AnchorPoint;
goto no_contour_point;
if ( ap >= outline.n_points )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
*x_value = outline.points[ap].x;
*y_value = outline.points[ap].y;
FORGET_Frame();
if ( !format )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
break;
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok;
case 2:
if ( index >= sp->spf.spf2.ValueCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
error = Get_ValueRecord( gpi, &sp->spf.spf2.Value[index],
sp->ValueFormat, POSITION( buffer->in_pos ) );
if ( error )
break;
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
}
(buffer->in_pos)++;
break;
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok;
if ( index >= ppf1->PairSetCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
pvr = ppf1->PairSet[index].PairValueRecord;
if ( !pvr )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
glyph2 = IN_CURGLYPH();
c1r = &ppf2->Class1Record[cl1];
if ( !c1r )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
c2r = &c1r->Class2Record[cl2];
error = Get_ValueRecord( gpi, &c2r->Value1, format1, POSITION( first_pos ) );
break;
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
/* if we don't have coverage for the second glyph don't skip it for
}
if ( index >= cp->EntryExitCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
eer = &cp->EntryExitRecord[index];
FORGET_Frame();
if (mbp->PosFormat != 1)
- return _hb_err(HB_Err_Invalid_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
cur_offset = FILE_Pos();
if ( FILE_Seek( new_offset ) ||
ma = &mbp->MarkArray;
if ( mark_index >= ma->MarkCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
class = ma->MarkRecord[mark_index].Class;
mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor;
if ( class >= mbp->ClassCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
ba = &mbp->BaseArray;
if ( base_index >= ba->BaseCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
br = &ba->BaseRecord[base_index];
base_anchor = &br->BaseAnchor[class];
ma = &mlp->MarkArray;
if ( mark_index >= ma->MarkCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
class = ma->MarkRecord[mark_index].Class;
mark_anchor = &ma->MarkRecord[mark_index].MarkAnchor;
if ( class >= mlp->ClassCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
la = &mlp->LigatureArray;
if ( lig_index >= la->LigatureCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
lat = &la->LigatureAttach[lig_index];
ma1 = &mmp->Mark1Array;
if ( mark1_index >= ma1->MarkCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
class = ma1->MarkRecord[mark1_index].Class;
mark1_anchor = &ma1->MarkRecord[mark1_index].MarkAnchor;
if ( class >= mmp->ClassCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
ma2 = &mmp->Mark2Array;
if ( mark2_index >= ma2->Mark2Count )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
m2r = &ma2->Mark2Record[mark2_index];
mark2_anchor = &m2r->Mark2Anchor[class];
return Load_ContextPos3( &cp->cpf.cpf3, stream );
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
pcs = &cpf2->PosClassSet[classes[0]];
if ( !pcs )
{
- error = _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto End;
}
flags, context_length, nesting_level );
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
FORGET_Frame();
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->BacktrackClassDef, 65535,
- backtrack_offset, base_offset,
- stream ) ) != HB_Err_Ok )
+ backtrack_offset, base_offset,
+ stream ) ) != HB_Err_Ok )
goto Fail5;
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->InputClassDef, count,
- input_offset, base_offset,
- stream ) ) != HB_Err_Ok )
+ input_offset, base_offset,
+ stream ) ) != HB_Err_Ok )
goto Fail4;
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccpf2->LookaheadClassDef, 65535,
- lookahead_offset, base_offset,
- stream ) ) != HB_Err_Ok )
+ lookahead_offset, base_offset,
+ stream ) ) != HB_Err_Ok )
goto Fail3;
ccpf2->ChainPosClassSet = NULL;
return Load_ChainContextPos3( &ccp->ccpf.ccpf3, stream );
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
cpcs = &ccpf2->ChainPosClassSet[input_classes[0]];
if ( !cpcs )
{
- error = _hb_err(HB_Err_Invalid_GPOS_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto End1;
}
nesting_level );
default:
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
if ( !gpos || !script_index )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gpos->ScriptList;
sr = sl->ScriptRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
if ( !gpos || !language_index || !req_feature_index )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gpos->ScriptList;
sr = sl->ScriptRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
HB_LangSys* ls;
HB_UShort* fi;
if ( !gpos || !feature_index )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gpos->ScriptList;
sr = sl->ScriptRecord;
fr = fl->FeatureRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
else
{
if ( language_index >= s->LangSysCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
ls = &lsr[language_index].LangSys;
}
for ( n = 0; n < ls->FeatureCount; n++ )
{
if ( fi[n] >= fl->FeatureCount )
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
if ( feature_tag == fr[fi[n]].FeatureTag )
{
if ( !gpos || !script_tag_list )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gpos->ScriptList;
sr = sl->ScriptRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
if ( !gpos || !language_tag_list )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gpos->ScriptList;
sr = sl->ScriptRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
HB_LangSys* ls;
HB_UShort* fi;
if ( !gpos || !feature_tag_list )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gpos->ScriptList;
sr = sl->ScriptRecord;
fr = fl->FeatureRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
else
{
if ( language_index >= s->LangSysCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
ls = &lsr[language_index].LangSys;
}
if ( fi[n] >= fl->FeatureCount )
{
FREE( ftl );
- return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
ftl[n] = fr[fi[n]].FeatureTag;
}
nesting_level++;
if ( nesting_level > HB_MAX_NESTING_LEVEL )
- return _hb_err(HB_Err_Too_Many_Nested_Contexts);
+ return ERR(HB_Err_Not_Covered); /* ERR() call intended */
lookup_count = gpos->LookupList.LookupCount;
if (lookup_index >= lookup_count)
case HB_GPOS_LOOKUP_CONTEXT: return Load_ContextPos ( st, stream );
case HB_GPOS_LOOKUP_CHAIN: return Load_ChainContextPos ( st, stream );
/*case HB_GPOS_LOOKUP_EXTENSION: return Load_ExtensionPos ( st, stream );*/
- default: return _hb_err(HB_Err_Invalid_GPOS_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
}
if ( !gpos ||
feature_index >= gpos->FeatureList.FeatureCount ||
gpos->FeatureList.ApplyCount == gpos->FeatureList.FeatureCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gpos->FeatureList.ApplyOrder[gpos->FeatureList.ApplyCount++] = feature_index;
if ( !gpos )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gpos->FeatureList.ApplyCount = 0;
HB_GlyphFunction gfunc )
{
if ( !gpos )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gpos->gfunc = gfunc;
void* data )
{
if ( !gpos )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gpos->mmfunc = mmfunc;
gpos->data = data;
int i, j, lookup_count, num_features;
if ( !face || !gpos || !buffer )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
if ( buffer->in_length == 0 )
return HB_Err_Not_Covered;
HB_BEGIN_HEADER
-#define HB_Err_Invalid_GPOS_SubTable_Format 0x1020
-#define HB_Err_Invalid_GPOS_SubTable 0x1021
-
/* Lookup types for glyph positioning */
HB_Lookup* lo;
if ( !retptr )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
if ( GOTO_Table( TTAG_GSUB ) )
return error;
break;
default:
- return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok;
case 2:
if ( index >= ss->ssf.ssf2.GlyphCount )
- return _hb_err(HB_Err_Invalid_GSUB_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
value = ss->ssf.ssf2.Substitute[index];
if ( REPLACE_Glyph( buffer, value, nesting_level ) )
return error;
break;
default:
- return _hb_err(HB_Err_Invalid_GSUB_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
}
if ( gdef && gdef->NewGlyphClasses )
return error;
if ( index >= ms->SequenceCount )
- return _hb_err(HB_Err_Invalid_GSUB_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
count = ms->Sequence[index].GlyphCount;
s = ms->Sequence[index].Substitute;
return error;
if ( index >= ls->LigatureSetCount )
- return _hb_err(HB_Err_Invalid_GSUB_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
lig = ls->LigatureSet[index].Ligature;
case 1: return Load_ContextSubst1( &cs->csf.csf1, stream );
case 2: return Load_ContextSubst2( &cs->csf.csf2, stream );
case 3: return Load_ContextSubst3( &cs->csf.csf3, stream );
- default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
scs = &csf2->SubClassSet[classes[0]];
if ( !scs )
{
- error = _hb_err(HB_Err_Invalid_GSUB_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto End;
}
case 1: return Lookup_ContextSubst1( gsub, &cs->csf.csf1, buffer, flags, context_length, nesting_level );
case 2: return Lookup_ContextSubst2( gsub, &cs->csf.csf2, buffer, flags, context_length, nesting_level );
case 3: return Lookup_ContextSubst3( gsub, &cs->csf.csf3, buffer, flags, context_length, nesting_level );
- default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
FORGET_Frame();
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->BacktrackClassDef, 65535,
- backtrack_offset, base_offset,
- stream ) ) != HB_Err_Ok )
+ backtrack_offset, base_offset,
+ stream ) ) != HB_Err_Ok )
goto Fail5;
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->InputClassDef, count,
- input_offset, base_offset,
- stream ) ) != HB_Err_Ok )
+ input_offset, base_offset,
+ stream ) ) != HB_Err_Ok )
goto Fail4;
if ( ( error = _HB_OPEN_Load_EmptyOrClassDefinition( &ccsf2->LookaheadClassDef, 65535,
- lookahead_offset, base_offset,
- stream ) ) != HB_Err_Ok )
+ lookahead_offset, base_offset,
+ stream ) ) != HB_Err_Ok )
goto Fail3;
ccsf2->ChainSubClassSet = NULL;
case 1: return Load_ChainContextSubst1( &ccs->ccsf.ccsf1, stream );
case 2: return Load_ChainContextSubst2( &ccs->ccsf.ccsf2, stream );
case 3: return Load_ChainContextSubst3( &ccs->ccsf.ccsf3, stream );
- default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
cscs = &ccsf2->ChainSubClassSet[input_classes[0]];
if ( !cscs )
{
- error = _hb_err(HB_Err_Invalid_GSUB_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto End1;
}
case 1: return Lookup_ChainContextSubst1( gsub, &ccs->ccsf.ccsf1, buffer, flags, context_length, nesting_level );
case 2: return Lookup_ChainContextSubst2( gsub, &ccs->ccsf.ccsf2, buffer, flags, context_length, nesting_level );
case 3: return Lookup_ChainContextSubst3( gsub, &ccs->ccsf.ccsf3, buffer, flags, context_length, nesting_level );
- default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
}
rccs->SubstFormat = GET_UShort();
if ( rccs->SubstFormat != 1 )
- return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
FORGET_Frame();
if ( !gsub || !script_index )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gsub->ScriptList;
sr = sl->ScriptRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
if ( !gsub || !language_index || !req_feature_index )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gsub->ScriptList;
sr = sl->ScriptRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
HB_LangSys* ls;
HB_UShort* fi;
if ( !gsub || !feature_index )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gsub->ScriptList;
sr = sl->ScriptRecord;
fr = fl->FeatureRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
else
{
if ( language_index >= s->LangSysCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
ls = &lsr[language_index].LangSys;
}
for ( n = 0; n < ls->FeatureCount; n++ )
{
if ( fi[n] >= fl->FeatureCount )
- return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
if ( feature_tag == fr[fi[n]].FeatureTag )
{
if ( !gsub || !script_tag_list )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gsub->ScriptList;
sr = sl->ScriptRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
if ( !gsub || !language_tag_list )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gsub->ScriptList;
sr = sl->ScriptRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
HB_ScriptList* sl;
HB_ScriptRecord* sr;
- HB_Script* s;
+ HB_ScriptTable* s;
HB_LangSysRecord* lsr;
HB_LangSys* ls;
HB_UShort* fi;
if ( !gsub || !feature_tag_list )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
sl = &gsub->ScriptList;
sr = sl->ScriptRecord;
fr = fl->FeatureRecord;
if ( script_index >= sl->ScriptCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
s = &sr[script_index].Script;
lsr = s->LangSysRecord;
else
{
if ( language_index >= s->LangSysCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
ls = &lsr[language_index].LangSys;
}
if ( fi[n] >= fl->FeatureCount )
{
FREE( ftl );
- return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ return ERR(HB_Err_Invalid_SubTable_Format);
}
ftl[n] = fr[fi[n]].FeatureTag;
}
nesting_level++;
if ( nesting_level > HB_MAX_NESTING_LEVEL )
- return _hb_err(HB_Err_Too_Many_Nested_Contexts);
+ return ERR(HB_Err_Not_Covered); /* ERR() call intended */
lookup_count = gsub->LookupList.LookupCount;
if (lookup_index >= lookup_count)
case HB_GSUB_LOOKUP_CHAIN: return Load_ChainContextSubst ( st, stream );
/*case HB_GSUB_LOOKUP_EXTENSION: return Load_ExtensionSubst ( st, stream );*/
case HB_GSUB_LOOKUP_REVERSE_CHAIN: return Load_ReverseChainContextSubst ( st, stream );
- default: return _hb_err(HB_Err_Invalid_GSUB_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
};
}
if ( !gsub ||
feature_index >= gsub->FeatureList.FeatureCount ||
gsub->FeatureList.ApplyCount == gsub->FeatureList.FeatureCount )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gsub->FeatureList.ApplyOrder[gsub->FeatureList.ApplyCount++] = feature_index;
if ( !gsub )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gsub->FeatureList.ApplyCount = 0;
void* data )
{
if ( !gsub )
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
gsub->altfunc = altfunc;
gsub->data = data;
if ( !gsub ||
!buffer)
- return HB_Err_Invalid_Argument;
+ return ERR(HB_Err_Invalid_Argument);
if ( buffer->in_length == 0 )
return retError;
HB_BEGIN_HEADER
-#define HB_Err_Invalid_GSUB_SubTable_Format 0x1010
-#define HB_Err_Invalid_GSUB_SubTable 0x1011
-
/* Lookup types for glyph substitution */
{
block = malloc( size );
if ( !block )
- error = HB_Err_Out_Of_Memory;
+ error = ERR(HB_Err_Out_Of_Memory);
}
*perror = error;
{
block = malloc( size );
if ( !block )
- error = HB_Err_Out_Of_Memory;
+ error = ERR(HB_Err_Out_Of_Memory);
else
memset( (char*)block, 0, (size_t)size );
}
block2 = realloc( block, new_size );
if ( block2 == NULL && new_size != 0 )
- error = HB_Err_Out_Of_Memory;
+ error = ERR(HB_Err_Out_Of_Memory);
if ( !error )
block = block2;
if ( stream->read )
{
if ( stream->read( stream, pos, NULL, 0 ) )
- error = HB_Err_Invalid_Stream_Operation;
+ error = ERR(HB_Err_Read_Error);
}
else if ( pos > (HB_Int)stream->size )
- error = HB_Err_Invalid_Stream_Operation;
+ error = ERR(HB_Err_Read_Error);
LOG(( "_hb_stream_seek(%ld) -> %d\n", pos, error ));
return error;
if ( read_bytes < count )
{
FREE( stream->base );
- error = HB_Err_Invalid_Stream_Operation;
+ error = ERR(HB_Err_Read_Error);
}
stream->cursor = stream->base;
stream->limit = stream->cursor + count;
if ( stream->pos >= stream->size ||
stream->pos + count > stream->size )
{
- error = HB_Err_Invalid_Stream_Operation;
+ error = ERR(HB_Err_Read_Error);
goto Exit;
}
if ( !FT_IS_SFNT(face) )
{
LOG(( "not a SFNT face !!\n" ));
- error = HB_Err_Invalid_Face_Handle;
+ error = ERR(HB_Err_Invalid_Argument);
}
else
{
goto FoundIt;
}
}
- error = HB_Err_Table_Missing;
+ error = HB_Err_Not_Covered;
FoundIt:
FORGET_Frame();
#define MEM_Copy(dest,source,count) memcpy( (char*)(dest), (const char*)(source), (size_t)(count) )
+#define ERR(err) _hb_err (err)
+
HB_INTERNAL FT_Pointer
_hb_alloc( HB_UInt size,
/* Script */
-static HB_Error Load_Script( HB_Script* s,
+static HB_Error Load_Script( HB_ScriptTable* s,
HB_Stream stream )
{
HB_Error error;
if ( s->LangSysCount == 0 && s->DefaultLangSys.FeatureCount == 0 )
{
- error = HB_Err_Empty_Script;
+ error = HB_Err_Not_Covered;
goto Fail2;
}
}
-static void Free_Script( HB_Script* s )
+static void Free_Script( HB_ScriptTable* s )
{
HB_UShort n, count;
error = Load_Script( &sr[sl->ScriptCount].Script, stream );
if ( error == HB_Err_Ok )
sl->ScriptCount += 1;
- else if ( error != HB_Err_Empty_Script )
+ else if ( error != HB_Err_Not_Covered )
goto Fail;
(void)FILE_Seek( cur_offset );
#if 0
if ( sl->ScriptCount == 0 )
{
- error = _hb_err(HB_Err_Invalid_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto Fail;
}
#endif
( rr[n].End - rr[n].Start + (long)rr[n].StartCoverageIndex ) >=
0x10000L )
{
- error = _hb_err(HB_Err_Invalid_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto Fail;
}
}
{
case 1: return Load_Coverage1( &c->cf.cf1, stream );
case 2: return Load_Coverage2( &c->cf.cf2, stream );
- default: return _hb_err(HB_Err_Invalid_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
{
case 1: return Coverage_Index1( &c->cf.cf1, glyphID, index );
case 2: return Coverage_Index2( &c->cf.cf2, glyphID, index );
- default: return _hb_err(HB_Err_Invalid_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
/* sanity check; we are limited to 16bit integers */
if ( cdf1->StartGlyph + (long)count >= 0x10000L )
- return _hb_err(HB_Err_Invalid_SubTable);
+ return ERR(HB_Err_Invalid_SubTable);
cdf1->ClassValueArray = NULL;
cva[n] = GET_UShort();
if ( cva[n] >= limit )
{
- error = _hb_err(HB_Err_Invalid_SubTable);
+ error = ERR(HB_Err_Invalid_SubTable);
goto Fail;
}
d[cva[n]] = TRUE;
{
case 1: error = Load_ClassDef1( cd, limit, stream ); break;
case 2: error = Load_ClassDef2( cd, limit, stream ); break;
- default: error = _hb_err(HB_Err_Invalid_SubTable_Format); break;
+ default: error = ERR(HB_Err_Invalid_SubTable_Format); break;
}
if ( error )
{
case 1: return Get_Class1( &cd->cd.cd1, glyphID, klass, index );
case 2: return Get_Class2( &cd->cd.cd2, glyphID, klass, index );
- default: return _hb_err(HB_Err_Invalid_SubTable_Format);
+ default: return ERR(HB_Err_Invalid_SubTable_Format);
}
return HB_Err_Ok; /* never reached */
typedef struct HB_LangSysRecord_ HB_LangSysRecord;
-struct HB_Script_
+struct HB_ScriptTable_
{
HB_LangSys DefaultLangSys; /* DefaultLangSys table */
HB_UShort LangSysCount; /* number of LangSysRecords */
HB_LangSysRecord* LangSysRecord; /* array of LangSysRecords */
};
-typedef struct HB_Script_ HB_Script;
+typedef struct HB_ScriptTable_ HB_ScriptTable;
struct HB_ScriptRecord_
{
HB_UInt ScriptTag; /* ScriptTag identifier */
- HB_Script Script; /* Script table */
+ HB_ScriptTable Script; /* Script table */
};
typedef struct HB_ScriptRecord_ HB_ScriptRecord;