@ -2386,7 +2386,7 @@ static int stbtt__GetGlyphKernInfoAdvance(const stbtt_fontinfo *info, int glyph
static stbtt_int32 stbtt__GetCoverageIndex ( stbtt_uint8 * coverageTable , int glyph )
static stbtt_int32 stbtt__GetCoverageIndex ( stbtt_uint8 * coverageTable , int glyph )
{
{
stbtt_uint16 coverageFormat = ttUSHORT ( coverageTable ) ;
stbtt_uint16 coverageFormat = ttUSHORT ( coverageTable ) ;
switch ( coverageFormat ) {
switch ( coverageFormat ) {
case 1 : {
case 1 : {
stbtt_uint16 glyphCount = ttUSHORT ( coverageTable + 2 ) ;
stbtt_uint16 glyphCount = ttUSHORT ( coverageTable + 2 ) ;
@ -2407,7 +2407,8 @@ static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyp
return m ;
return m ;
}
}
}
}
} break ;
break ;
}
case 2 : {
case 2 : {
stbtt_uint16 rangeCount = ttUSHORT ( coverageTable + 2 ) ;
stbtt_uint16 rangeCount = ttUSHORT ( coverageTable + 2 ) ;
@ -2431,12 +2432,10 @@ static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyp
return startCoverageIndex + glyph - strawStart ;
return startCoverageIndex + glyph - strawStart ;
}
}
}
}
} break ;
break ;
}
default : {
default : return - 1 ; // unsupported
// There are no other cases.
STBTT_assert ( 0 ) ;
} break ;
}
}
return - 1 ;
return - 1 ;
@ -2445,7 +2444,7 @@ static stbtt_int32 stbtt__GetCoverageIndex(stbtt_uint8 *coverageTable, int glyp
static stbtt_int32 stbtt__GetGlyphClass ( stbtt_uint8 * classDefTable , int glyph )
static stbtt_int32 stbtt__GetGlyphClass ( stbtt_uint8 * classDefTable , int glyph )
{
{
stbtt_uint16 classDefFormat = ttUSHORT ( classDefTable ) ;
stbtt_uint16 classDefFormat = ttUSHORT ( classDefTable ) ;
switch ( classDefFormat )
switch ( classDefFormat )
{
{
case 1 : {
case 1 : {
stbtt_uint16 startGlyphID = ttUSHORT ( classDefTable + 2 ) ;
stbtt_uint16 startGlyphID = ttUSHORT ( classDefTable + 2 ) ;
@ -2454,7 +2453,8 @@ static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)
if ( glyph > = startGlyphID & & glyph < startGlyphID + glyphCount )
if ( glyph > = startGlyphID & & glyph < startGlyphID + glyphCount )
return ( stbtt_int32 ) ttUSHORT ( classDef1ValueArray + 2 * ( glyph - startGlyphID ) ) ;
return ( stbtt_int32 ) ttUSHORT ( classDef1ValueArray + 2 * ( glyph - startGlyphID ) ) ;
} break ;
break ;
}
case 2 : {
case 2 : {
stbtt_uint16 classRangeCount = ttUSHORT ( classDefTable + 2 ) ;
stbtt_uint16 classRangeCount = ttUSHORT ( classDefTable + 2 ) ;
@ -2476,12 +2476,11 @@ static stbtt_int32 stbtt__GetGlyphClass(stbtt_uint8 *classDefTable, int glyph)
else
else
return ( stbtt_int32 ) ttUSHORT ( classRangeRecord + 4 ) ;
return ( stbtt_int32 ) ttUSHORT ( classRangeRecord + 4 ) ;
}
}
} break ;
break ;
}
default : {
default :
// Unsupported defition type; return an error.
return - 1 ; // Unsupported definition type, return an error.
return - 1 ;
} break ;
}
}
// "All glyphs not assigned to a class fall into class 0". (OpenType spec)
// "All glyphs not assigned to a class fall into class 0". (OpenType spec)
@ -2497,7 +2496,7 @@ static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, i
stbtt_uint8 * lookupList ;
stbtt_uint8 * lookupList ;
stbtt_uint16 lookupCount ;
stbtt_uint16 lookupCount ;
stbtt_uint8 * data ;
stbtt_uint8 * data ;
stbtt_int32 i ;
stbtt_int32 i , st i;
if ( ! info - > gpos ) return 0 ;
if ( ! info - > gpos ) return 0 ;
@ -2517,9 +2516,9 @@ static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, i
stbtt_uint16 lookupType = ttUSHORT ( lookupTable ) ;
stbtt_uint16 lookupType = ttUSHORT ( lookupTable ) ;
stbtt_uint16 subTableCount = ttUSHORT ( lookupTable + 4 ) ;
stbtt_uint16 subTableCount = ttUSHORT ( lookupTable + 4 ) ;
stbtt_uint8 * subTableOffsets = lookupTable + 6 ;
stbtt_uint8 * subTableOffsets = lookupTable + 6 ;
switch ( lookupType ) {
if ( lookupType ! = 2 ) // Pair Adjustment Positioning Subtable
case 2 : { // Pair Adjustment Positioning Subtable
continue ;
stbtt_int32 sti ;
for ( sti = 0 ; sti < subTableCount ; sti + + ) {
for ( sti = 0 ; sti < subTableCount ; sti + + ) {
stbtt_uint16 subtableOffset = ttUSHORT ( subTableOffsets + 2 * sti ) ;
stbtt_uint16 subtableOffset = ttUSHORT ( subTableOffsets + 2 * sti ) ;
stbtt_uint8 * table = lookupTable + subtableOffset ;
stbtt_uint8 * table = lookupTable + subtableOffset ;
@ -2567,7 +2566,8 @@ static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, i
}
}
} else
} else
return 0 ;
return 0 ;
} break ;
break ;
}
case 2 : {
case 2 : {
stbtt_uint16 valueFormat1 = ttUSHORT ( table + 4 ) ;
stbtt_uint16 valueFormat1 = ttUSHORT ( table + 4 ) ;
@ -2590,21 +2590,12 @@ static stbtt_int32 stbtt__GetGlyphGPOSInfoAdvance(const stbtt_fontinfo *info, i
return xAdvance ;
return xAdvance ;
} else
} else
return 0 ;
return 0 ;
} break ;
default : {
// Unsupported definition type
return 0 ;
break ;
break ;
} ;
}
}
}
break ;
} ;
default :
default :
// TODO: Implement other stuff.
return 0 ; // Unsupported position format
break ;
}
}
}
}
}